[STATEMENT]
lemma aux: "Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {0..<Suc (length as)}
  = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {0..<Suc (length as)} = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {0..<Suc (length as)} = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
have 1: "{0..<Suc (length as)} = insert 0 {1..<Suc (length as)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<Suc (length as)} = insert 0 {1..<Suc (length as)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<Suc (length as)} = insert 0 {1..<Suc (length as)}

goal (1 subgoal):
 1. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {0..<Suc (length as)} = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
have 2: "{Suc 0..<Suc (Suc n)} = insert (Suc n) {Suc 0 ..< Suc n}" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {Suc 0..<Suc (Suc n)} = insert (Suc n) {Suc 0..<Suc n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{Suc 0..<Suc (Suc ?n)} = insert (Suc ?n) {Suc 0..<Suc ?n}

goal (1 subgoal):
 1. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {0..<Suc (length as)} = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
have 3: "{0..<Suc n} = insert n {0..<n}" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<Suc n} = insert n {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<Suc ?n} = insert ?n {0..<?n}

goal (1 subgoal):
 1. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {0..<Suc (length as)} = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
have A: "
    Finite_Set.fold P emp {Suc 0..<Suc n}
    = Finite_Set.fold Q emp {0..<n}"
    if "\<forall>i x. P (Suc i) x = Q i x"
      and "comp_fun_commute P"
      and "comp_fun_commute Q"
    for P Q n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.fold P emp {Suc 0..<Suc n} = Finite_Set.fold Q emp {0..<n}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<forall>i x. P (Suc i) x = Q i x
comp_fun_commute P
comp_fun_commute Q

goal (1 subgoal):
 1. Finite_Set.fold P emp {Suc 0..<Suc n} = Finite_Set.fold Q emp {0..<n}
[PROOF STEP]
apply (induction n arbitrary: a)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>i x. P (Suc i) x = Q i x; comp_fun_commute P; comp_fun_commute Q\<rbrakk> \<Longrightarrow> Finite_Set.fold P emp {Suc 0..<Suc 0} = Finite_Set.fold Q emp {0..<0}
 2. \<And>n. \<lbrakk>\<lbrakk>\<forall>i x. P (Suc i) x = Q i x; comp_fun_commute P; comp_fun_commute Q\<rbrakk> \<Longrightarrow> Finite_Set.fold P emp {Suc 0..<Suc n} = Finite_Set.fold Q emp {0..<n}; \<forall>i x. P (Suc i) x = Q i x; comp_fun_commute P; comp_fun_commute Q\<rbrakk> \<Longrightarrow> Finite_Set.fold P emp {Suc 0..<Suc (Suc n)} = Finite_Set.fold Q emp {0..<Suc n}
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i x. P (Suc i) x = Q i x; comp_fun_commute P; comp_fun_commute Q\<rbrakk> \<Longrightarrow> Finite_Set.fold P emp {Suc 0..<Suc 0} = Finite_Set.fold Q emp {0..<0}
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>\<forall>i x. P (Suc i) x = Q i x; comp_fun_commute P; comp_fun_commute Q\<rbrakk> \<Longrightarrow> Finite_Set.fold P emp {Suc 0..<Suc n} = Finite_Set.fold Q emp {0..<n}; \<forall>i x. P (Suc i) x = Q i x; comp_fun_commute P; comp_fun_commute Q\<rbrakk> \<Longrightarrow> Finite_Set.fold P emp {Suc 0..<Suc (Suc n)} = Finite_Set.fold Q emp {0..<Suc n}
[PROOF STEP]
thm comp_fun_commute_on.fold_insert
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>\<forall>i x. P (Suc i) x = Q i x; comp_fun_commute P; comp_fun_commute Q\<rbrakk> \<Longrightarrow> Finite_Set.fold P emp {Suc 0..<Suc n} = Finite_Set.fold Q emp {0..<n}; \<forall>i x. P (Suc i) x = Q i x; comp_fun_commute P; comp_fun_commute Q\<rbrakk> \<Longrightarrow> Finite_Set.fold P emp {Suc 0..<Suc (Suc n)} = Finite_Set.fold Q emp {0..<Suc n}
[PROOF STEP]
apply (simp add: comp_fun_commute_fold_insert)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Finite_Set.fold P emp {Suc 0..<Suc n} = Finite_Set.fold Q emp {0..<n}; \<forall>i x. P (Suc i) x = Q i x; comp_fun_commute P; comp_fun_commute Q\<rbrakk> \<Longrightarrow> Finite_Set.fold P emp {Suc 0..<Suc (Suc n)} = Finite_Set.fold Q emp {0..<Suc n}
[PROOF STEP]
apply (subst 2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Finite_Set.fold P emp {Suc 0..<Suc n} = Finite_Set.fold Q emp {0..<n}; \<forall>i x. P (Suc i) x = Q i x; comp_fun_commute P; comp_fun_commute Q\<rbrakk> \<Longrightarrow> Finite_Set.fold P emp (insert (Suc n) {Suc 0..<Suc n}) = Finite_Set.fold Q emp {0..<Suc n}
[PROOF STEP]
apply (subst 3)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Finite_Set.fold P emp {Suc 0..<Suc n} = Finite_Set.fold Q emp {0..<n}; \<forall>i x. P (Suc i) x = Q i x; comp_fun_commute P; comp_fun_commute Q\<rbrakk> \<Longrightarrow> Finite_Set.fold P emp (insert (Suc n) {Suc 0..<Suc n}) = Finite_Set.fold Q emp (insert n {0..<n})
[PROOF STEP]
apply (simp add: comp_fun_commute_fold_insert)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>i x. ?P (Suc i) x = ?Q i x; comp_fun_commute ?P; comp_fun_commute ?Q\<rbrakk> \<Longrightarrow> Finite_Set.fold ?P emp {Suc 0..<Suc ?n} = Finite_Set.fold ?Q emp {0..<?n}

goal (1 subgoal):
 1. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {0..<Suc (length as)} = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {0..<Suc (length as)} = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
apply (simp add: 1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp (insert 0 {Suc 0..<Suc (length as)}) = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
apply (subst comp_fun_commute_fold_insert)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. comp_fun_commute (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i))
 2. finite {Suc 0..<Suc (length as)}
 3. 0 \<notin> {Suc 0..<Suc (length as)}
 4. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {Suc 0..<Suc (length as)} * P ((a # as) ! 0) ((c # cs) ! 0) = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_commute (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i))
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y x. (\<lambda>aa. aa * P ((a # as) ! y) ((c # cs) ! y)) \<circ> (\<lambda>aa. aa * P ((a # as) ! x) ((c # cs) ! x)) = (\<lambda>aa. aa * P ((a # as) ! x) ((c # cs) ! x)) \<circ> (\<lambda>aa. aa * P ((a # as) ! y) ((c # cs) ! y))
[PROOF STEP]
apply (auto simp: fun_eq_iff algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite {Suc 0..<Suc (length as)}
 2. 0 \<notin> {Suc 0..<Suc (length as)}
 3. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {Suc 0..<Suc (length as)} * P ((a # as) ! 0) ((c # cs) ! 0) = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {Suc 0..<Suc (length as)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 \<notin> {Suc 0..<Suc (length as)}
 2. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {Suc 0..<Suc (length as)} * P ((a # as) ! 0) ((c # cs) ! 0) = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<notin> {Suc 0..<Suc (length as)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {Suc 0..<Suc (length as)} * P ((a # as) ! 0) ((c # cs) ! 0) = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {Suc 0..<Suc (length as)} * P a c = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
apply (rewrite at "\<hole> = _*_" mult.commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P a c * Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {Suc 0..<Suc (length as)} = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
apply (rule arg_cong[where f="\<lambda>x. P _ _ * x"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {Suc 0..<Suc (length as)} = Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}
[PROOF STEP]
apply (rule A)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<forall>i x. x * P ((a # as) ! Suc i) ((c # cs) ! Suc i) = x * P (as ! i) (cs ! i)
 2. comp_fun_commute (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i))
 3. comp_fun_commute (\<lambda>i aa. aa * P (as ! i) (cs ! i))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i x. x * P ((a # as) ! Suc i) ((c # cs) ! Suc i) = x * P (as ! i) (cs ! i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. comp_fun_commute (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i))
 2. comp_fun_commute (\<lambda>i aa. aa * P (as ! i) (cs ! i))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_commute (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i))
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y x. (\<lambda>aa. aa * P ((a # as) ! y) ((c # cs) ! y)) \<circ> (\<lambda>aa. aa * P ((a # as) ! x) ((c # cs) ! x)) = (\<lambda>aa. aa * P ((a # as) ! x) ((c # cs) ! x)) \<circ> (\<lambda>aa. aa * P ((a # as) ! y) ((c # cs) ! y))
[PROOF STEP]
apply (auto simp: fun_eq_iff algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_commute (\<lambda>i aa. aa * P (as ! i) (cs ! i))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_commute (\<lambda>i aa. aa * P (as ! i) (cs ! i))
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y x. (\<lambda>aa. aa * P (as ! y) (cs ! y)) \<circ> (\<lambda>aa. aa * P (as ! x) (cs ! x)) = (\<lambda>aa. aa * P (as ! x) (cs ! x)) \<circ> (\<lambda>aa. aa * P (as ! y) (cs ! y))
[PROOF STEP]
apply (auto simp: fun_eq_iff algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Finite_Set.fold (\<lambda>i aa. aa * P ((a # as) ! i) ((c # cs) ! i)) emp {0..<Suc (length as)} = P a c * Finite_Set.fold (\<lambda>i aa. aa * P (as ! i) (cs ! i)) emp {0..<length as}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma range_inj_infinite:
  fixes f :: "nat \<Rightarrow> 'a"
  assumes "inj f"
  shows "infinite (range f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite (range f)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (range f) \<Longrightarrow> False
[PROOF STEP]
assume "finite (range f)"
[PROOF STATE]
proof (state)
this:
finite (range f)

goal (1 subgoal):
 1. finite (range f) \<Longrightarrow> False
[PROOF STEP]
from this assms
[PROOF STATE]
proof (chain)
picking this:
finite (range f)
inj f
[PROOF STEP]
have "finite (UNIV::nat set)"
[PROOF STATE]
proof (prove)
using this:
finite (range f)
inj f

goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
by (rule finite_imageD)
[PROOF STATE]
proof (state)
this:
finite UNIV

goal (1 subgoal):
 1. finite (range f) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite UNIV
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
finite UNIV

goal (1 subgoal):
 1. False
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma boolean_II_is_boolean:
   "class.boolean_algebra minus uminus (\<sqinter>) (\<sqsubseteq>) (\<sqsubset>) (\<squnion>) \<bottom> \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.boolean_algebra (-) uminus (\<sqinter>) (\<sqsubseteq>) (\<sqsubset>) (\<squnion>) \<bottom> \<top>
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (16 subgoals):
 1. \<And>x y. (x \<sqsubset> y) = (x \<sqsubseteq> y \<and> \<not> y \<sqsubseteq> x)
 2. \<And>x. x \<sqsubseteq> x
 3. \<And>x y z. \<lbrakk>x \<sqsubseteq> y; y \<sqsubseteq> z\<rbrakk> \<Longrightarrow> x \<sqsubseteq> z
 4. \<And>x y. \<lbrakk>x \<sqsubseteq> y; y \<sqsubseteq> x\<rbrakk> \<Longrightarrow> x = y
 5. \<And>x y. x \<sqinter> y \<sqsubseteq> x
 6. \<And>x y. x \<sqinter> y \<sqsubseteq> y
 7. \<And>x y z. \<lbrakk>x \<sqsubseteq> y; x \<sqsubseteq> z\<rbrakk> \<Longrightarrow> x \<sqsubseteq> y \<sqinter> z
 8. \<And>x y. x \<sqsubseteq> x \<squnion> y
 9. \<And>y x. y \<sqsubseteq> x \<squnion> y
 10. \<And>y x z. \<lbrakk>y \<sqsubseteq> x; z \<sqsubseteq> x\<rbrakk> \<Longrightarrow> y \<squnion> z \<sqsubseteq> x
A total of 16 subgoals...
[PROOF STEP]
apply (metis inf_absorb inf_assoc inf_comm inf_compl
             less_def less_eq_def minus_def
             sup_absorb sup_assoc sup_comm
             sup_compl sup_inf_distrib1
             sup_absorb inf_comm)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma swapidseq_even_even:
  assumes m: "swapidseq m p"
    and n: "swapidseq n p"
  shows "even m \<longleftrightarrow> even n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even m = even n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. even m = even n
[PROOF STEP]
from swapidseq_inverse_exists[OF n]
[PROOF STATE]
proof (chain)
picking this:
\<exists>q. swapidseq n q \<and> p \<circ> q = id \<and> q \<circ> p = id
[PROOF STEP]
obtain q where q: "swapidseq n q" "p \<circ> q = id" "q \<circ> p = id"
[PROOF STATE]
proof (prove)
using this:
\<exists>q. swapidseq n q \<and> p \<circ> q = id \<and> q \<circ> p = id

goal (1 subgoal):
 1. (\<And>q. \<lbrakk>swapidseq n q; p \<circ> q = id; q \<circ> p = id\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
swapidseq n q
p \<circ> q = id
q \<circ> p = id

goal (1 subgoal):
 1. even m = even n
[PROOF STEP]
from swapidseq_identity_even[OF swapidseq_comp_add[OF m q(1), unfolded q]]
[PROOF STATE]
proof (chain)
picking this:
even (m + n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
even (m + n)

goal (1 subgoal):
 1. even m = even n
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
even m = even n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sliding: "Times (Star (Times r s)) r = Times r (Star (Times s r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Times (Star (Times r s)) r = Times r (Star (Times s r))
[PROOF STEP]
proof (rule antisym[OF ardenL[OF Plus_upper[OF le_TimesL]] ardenR[OF Plus_upper[OF le_TimesR]]])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<oo> (Star (Times s r))
 2. Times (Times r s) (Times r (Star (Times s r))) \<le> Times r (Star (Times s r))
 3. \<oo> (Star (Times r s))
 4. Times (Times (Star (Times r s)) r) (Times s r) \<le> Times (Star (Times r s)) r
[PROOF STEP]
show "Times (Times r s) (Times r (Star (Times s r))) \<le> Times r (Star (Times s r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Times (Times r s) (Times r (Star (Times s r))) \<le> Times r (Star (Times s r))
[PROOF STEP]
by (rule order_trans[OF _
        Times_mono[OF order_refl ord_le_eq_trans[OF le_PlusR Star_unfoldL[symmetric]]]]) simp
[PROOF STATE]
proof (state)
this:
Times (Times r s) (Times r (Star (Times s r))) \<le> Times r (Star (Times s r))

goal (3 subgoals):
 1. \<oo> (Star (Times s r))
 2. \<oo> (Star (Times r s))
 3. Times (Times (Star (Times r s)) r) (Times s r) \<le> Times (Star (Times r s)) r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<oo> (Star (Times s r))
 2. \<oo> (Star (Times r s))
 3. Times (Times (Star (Times r s)) r) (Times s r) \<le> Times (Star (Times r s)) r
[PROOF STEP]
show "Times (Times (Star (Times r s)) r) (Times s r) \<le> Times (Star (Times r s)) r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Times (Times (Star (Times r s)) r) (Times s r) \<le> Times (Star (Times r s)) r
[PROOF STEP]
by (rule order_trans[OF _
        Times_mono[OF ord_le_eq_trans[OF le_PlusR Star_unfoldR[symmetric]] order_refl]]) simp
[PROOF STATE]
proof (state)
this:
Times (Times (Star (Times r s)) r) (Times s r) \<le> Times (Star (Times r s)) r

goal (2 subgoals):
 1. \<oo> (Star (Times s r))
 2. \<oo> (Star (Times r s))
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma is_open_imp_in_Qp:
  assumes "is_open U"
  shows "U \<subseteq> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<subseteq> carrier Q\<^sub>p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_open U

goal (1 subgoal):
 1. U \<subseteq> carrier Q\<^sub>p
[PROOF STEP]
unfolding is_open_def
[PROOF STATE]
proof (prove)
using this:
U \<subseteq> carrier Q\<^sub>p \<and> (\<forall>c\<in>U. \<exists>n. B\<^bsub>n\<^esub>[c] \<subseteq> U)

goal (1 subgoal):
 1. U \<subseteq> carrier Q\<^sub>p
[PROOF STEP]
by linarith


[STATEMENT]
lemma fps_ginv_deriv:
  assumes a0:"a$0 = (0::'a::field)"
    and a1: "a$1 \<noteq> 0"
  shows "fps_deriv (fps_ginv b a) = (fps_deriv b / fps_deriv a) oo fps_ginv fps_X a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
let ?ia = "fps_ginv b a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
let ?ifps_Xa = "fps_ginv fps_X a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
let ?d = "fps_deriv"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
let ?dia = "?d ?ia"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
have ifps_Xa0: "?ifps_Xa $ 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_ginv fps_X a $ 0 = (0::'a)
[PROOF STEP]
by (simp add: fps_ginv_def)
[PROOF STATE]
proof (state)
this:
fps_ginv fps_X a $ 0 = (0::'a)

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
have da0: "?d a $ 0 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv a $ 0 \<noteq> (0::'a)
[PROOF STEP]
using a1
[PROOF STATE]
proof (prove)
using this:
a $ 1 \<noteq> (0::'a)

goal (1 subgoal):
 1. fps_deriv a $ 0 \<noteq> (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_deriv a $ 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
from fps_ginv[OF a0 a1, of b]
[PROOF STATE]
proof (chain)
picking this:
fps_ginv b a oo a = b
[PROOF STEP]
have "?d (?ia oo a) = fps_deriv b"
[PROOF STATE]
proof (prove)
using this:
fps_ginv b a oo a = b

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a oo a) = fps_deriv b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_deriv (fps_ginv b a oo a) = fps_deriv b

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fps_deriv (fps_ginv b a oo a) = fps_deriv b
[PROOF STEP]
have "(?d ?ia oo a) * ?d a = ?d b"
[PROOF STATE]
proof (prove)
using this:
fps_deriv (fps_ginv b a oo a) = fps_deriv b

goal (1 subgoal):
 1. (fps_deriv (fps_ginv b a) oo a) * fps_deriv a = fps_deriv b
[PROOF STEP]
unfolding fps_compose_deriv[OF a0]
[PROOF STATE]
proof (prove)
using this:
(fps_deriv (fps_ginv b a) oo a) * fps_deriv a = fps_deriv b

goal (1 subgoal):
 1. (fps_deriv (fps_ginv b a) oo a) * fps_deriv a = fps_deriv b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(fps_deriv (fps_ginv b a) oo a) * fps_deriv a = fps_deriv b

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(fps_deriv (fps_ginv b a) oo a) * fps_deriv a = fps_deriv b
[PROOF STEP]
have "(?d ?ia oo a) * ?d a * inverse (?d a) = ?d b * inverse (?d a)"
[PROOF STATE]
proof (prove)
using this:
(fps_deriv (fps_ginv b a) oo a) * fps_deriv a = fps_deriv b

goal (1 subgoal):
 1. (fps_deriv (fps_ginv b a) oo a) * fps_deriv a * inverse (fps_deriv a) = fps_deriv b * inverse (fps_deriv a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(fps_deriv (fps_ginv b a) oo a) * fps_deriv a * inverse (fps_deriv a) = fps_deriv b * inverse (fps_deriv a)

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
with a1
[PROOF STATE]
proof (chain)
picking this:
a $ 1 \<noteq> (0::'a)
(fps_deriv (fps_ginv b a) oo a) * fps_deriv a * inverse (fps_deriv a) = fps_deriv b * inverse (fps_deriv a)
[PROOF STEP]
have "(?d ?ia oo a) * (inverse (?d a) * ?d a) = ?d b / ?d a"
[PROOF STATE]
proof (prove)
using this:
a $ 1 \<noteq> (0::'a)
(fps_deriv (fps_ginv b a) oo a) * fps_deriv a * inverse (fps_deriv a) = fps_deriv b * inverse (fps_deriv a)

goal (1 subgoal):
 1. (fps_deriv (fps_ginv b a) oo a) * (inverse (fps_deriv a) * fps_deriv a) = fps_deriv b / fps_deriv a
[PROOF STEP]
by (simp add: fps_divide_unit)
[PROOF STATE]
proof (state)
this:
(fps_deriv (fps_ginv b a) oo a) * (inverse (fps_deriv a) * fps_deriv a) = fps_deriv b / fps_deriv a

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(fps_deriv (fps_ginv b a) oo a) * (inverse (fps_deriv a) * fps_deriv a) = fps_deriv b / fps_deriv a
[PROOF STEP]
have "(?d ?ia oo a) oo ?ifps_Xa =  (?d b / ?d a) oo ?ifps_Xa"
[PROOF STATE]
proof (prove)
using this:
(fps_deriv (fps_ginv b a) oo a) * (inverse (fps_deriv a) * fps_deriv a) = fps_deriv b / fps_deriv a

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) oo a oo fps_ginv fps_X a = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
unfolding inverse_mult_eq_1[OF da0]
[PROOF STATE]
proof (prove)
using this:
(fps_deriv (fps_ginv b a) oo a) * 1 = fps_deriv b / fps_deriv a

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) oo a oo fps_ginv fps_X a = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_deriv (fps_ginv b a) oo a oo fps_ginv fps_X a = fps_deriv b / fps_deriv a oo fps_ginv fps_X a

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fps_deriv (fps_ginv b a) oo a oo fps_ginv fps_X a = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
have "?d ?ia oo (a oo ?ifps_Xa) =  (?d b / ?d a) oo ?ifps_Xa"
[PROOF STATE]
proof (prove)
using this:
fps_deriv (fps_ginv b a) oo a oo fps_ginv fps_X a = fps_deriv b / fps_deriv a oo fps_ginv fps_X a

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) oo (a oo fps_ginv fps_X a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
unfolding fps_compose_assoc[OF ifps_Xa0 a0]
[PROOF STATE]
proof (prove)
using this:
fps_deriv (fps_ginv b a) oo a oo fps_ginv fps_X a = fps_deriv b / fps_deriv a oo fps_ginv fps_X a

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) oo a oo fps_ginv fps_X a = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fps_deriv (fps_ginv b a) oo (a oo fps_ginv fps_X a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fps_deriv (fps_ginv b a) oo (a oo fps_ginv fps_X a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fps_deriv (fps_ginv b a) oo (a oo fps_ginv fps_X a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a
[PROOF STEP]
unfolding fps_inv_ginv[symmetric]
[PROOF STATE]
proof (prove)
using this:
fps_deriv (fps_ginv b a) oo (a oo fps_inv a) = fps_deriv b / fps_deriv a oo fps_inv a

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_inv a
[PROOF STEP]
unfolding fps_inv_right[OF a0 a1]
[PROOF STATE]
proof (prove)
using this:
fps_deriv (fps_ginv b a) oo fps_X = fps_deriv b / fps_deriv a oo fps_inv a

goal (1 subgoal):
 1. fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_inv a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_deriv (fps_ginv b a) = fps_deriv b / fps_deriv a oo fps_ginv fps_X a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lipschitz_onD:
  "dist (f x) (f y) \<le> L * dist x y"
  if "L-lipschitz_on X f" "x \<in> X" "y \<in> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (f x) (f y) \<le> L * dist x y
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
L-lipschitz_on X f
x \<in> X
y \<in> X

goal (1 subgoal):
 1. dist (f x) (f y) \<le> L * dist x y
[PROOF STEP]
by (auto simp: lipschitz_on_def)


[STATEMENT]
lemma inj_on_span_iff_independent_image: "m2.independent (f ` B) \<Longrightarrow> inj_on f (m1.span B) \<longleftrightarrow> inj_on f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m2.independent (f ` B) \<Longrightarrow> inj_on f (m1.span B) = inj_on f B
[PROOF STEP]
using inj_on_span_independent_image[of B] inj_on_subset[OF _ m1.span_superset, of f B]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>m2.independent (f ` B); inj_on f B\<rbrakk> \<Longrightarrow> inj_on f (m1.span B)
inj_on f (m1.span B) \<Longrightarrow> inj_on f B

goal (1 subgoal):
 1. m2.independent (f ` B) \<Longrightarrow> inj_on f (m1.span B) = inj_on f B
[PROOF STEP]
by auto


[STATEMENT]
lemma set_rel_compp: "\<langle>A O B\<rangle>set_rel = \<langle>A\<rangle>set_rel O \<langle>B\<rangle>set_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>A O B\<rangle>set_rel = \<langle>A\<rangle>set_rel O \<langle>B\<rangle>set_rel
[PROOF STEP]
using rel_set_OO[of "rel2p A" "rel2p B"]
[PROOF STATE]
proof (prove)
using this:
rel_set (rel2p A) OO rel_set (rel2p B) = rel_set (rel2p A OO rel2p B)

goal (1 subgoal):
 1. \<langle>A O B\<rangle>set_rel = \<langle>A\<rangle>set_rel O \<langle>B\<rangle>set_rel
[PROOF STEP]
by (auto simp: rel2p(2-)[symmetric] rel2p_comp)


[STATEMENT]
lemma N_minus_commute: "N (x - y) = N (y - x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N (x - y) = N (y - x)
[PROOF STEP]
using N_uminus[of "x - y"]
[PROOF STATE]
proof (prove)
using this:
N (- (x - y)) = N (x - y)

goal (1 subgoal):
 1. N (x - y) = N (y - x)
[PROOF STEP]
by (simp del: N_uminus)


[STATEMENT]
lemma (in group) right_cancel [simp]:
  "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
   (y \<otimes> x = z \<otimes> x) = (y = z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G\<rbrakk> \<Longrightarrow> (y \<otimes> x = z \<otimes> x) = (y = z)
[PROOF STEP]
by (metis inv_closed m_assoc r_inv r_one)


[STATEMENT]
lemma ncols_diagonal_to_Smith_i[simp]: "ncols (diagonal_to_Smith_i xs A i bezout) = ncols A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ncols (diagonal_to_Smith_i xs A i bezout) = ncols A
[PROOF STEP]
by (induct xs A i bezout rule: diagonal_to_Smith_i.induct, auto simp add: ncols_def)


[STATEMENT]
lemma (in field) inverse_exists [simp, intro]:
  assumes h1: "a\<in>carrier R"  and h2: "a\<noteq>\<zero>\<^bsub>R\<^esub>"
  shows "inv\<^bsub>R\<^esub> a\<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv a \<in> carrier R
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inv a \<in> carrier R
[PROOF STEP]
have 1: "Units R = carrier R - {\<zero>\<^bsub>R\<^esub>} "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Units R = carrier R - {\<zero>}
[PROOF STEP]
by (rule field_Units)
[PROOF STATE]
proof (state)
this:
Units R = carrier R - {\<zero>}

goal (1 subgoal):
 1. inv a \<in> carrier R
[PROOF STEP]
from h1 h2 1
[PROOF STATE]
proof (chain)
picking this:
a \<in> carrier R
a \<noteq> \<zero>
Units R = carrier R - {\<zero>}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
a \<noteq> \<zero>
Units R = carrier R - {\<zero>}

goal (1 subgoal):
 1. inv a \<in> carrier R
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inv a \<in> carrier R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma residual_conj_eq: "residuated f \<Longrightarrow> residual (conjugate f) = (\<lambda>x. -f(-x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residuated f \<Longrightarrow> residual (conjugate f) = (\<lambda>x. - f (- x))
[PROOF STEP]
apply (unfold residual_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residuated f \<Longrightarrow> (THE g. residuated_pair (conjugate f) g) = (\<lambda>x. - f (- x))
[PROOF STEP]
apply (rule the1_equality)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. residuated f \<Longrightarrow> \<exists>!g. residuated_pair (conjugate f) g
 2. residuated f \<Longrightarrow> residuated_pair (conjugate f) (\<lambda>x. - f (- x))
[PROOF STEP]
apply (rule residual_unique)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. residuated f \<Longrightarrow> residuated (conjugate f)
 2. residuated f \<Longrightarrow> residuated_pair (conjugate f) (\<lambda>x. - f (- x))
[PROOF STEP]
apply (auto intro: conj_residuated conjugate_residuated residuated_conj2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma shiftl_shiftr_id:
  "\<lbrakk> n < LENGTH('a); x < 2 ^ (LENGTH('a) - n) \<rbrakk> \<Longrightarrow> x << n >> n = (x::'a::len word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n < LENGTH('a); x < 2 ^ (LENGTH('a) - n)\<rbrakk> \<Longrightarrow> x << n >> n = x
[PROOF STEP]
by word_eqI (metis add.commute less_diff_conv)


[STATEMENT]
lemma transp_tranclp_id:
  assumes "transp R"
  shows "tranclp R = R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R\<^sup>+\<^sup>+ = R
[PROOF STEP]
proof(intro ext iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x xa. R\<^sup>+\<^sup>+ x xa \<Longrightarrow> R x xa
 2. \<And>x xa. R x xa \<Longrightarrow> R\<^sup>+\<^sup>+ x xa
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x xa. R\<^sup>+\<^sup>+ x xa \<Longrightarrow> R x xa
 2. \<And>x xa. R x xa \<Longrightarrow> R\<^sup>+\<^sup>+ x xa
[PROOF STEP]
assume "R^++ x y"
[PROOF STATE]
proof (state)
this:
R\<^sup>+\<^sup>+ x y

goal (2 subgoals):
 1. \<And>x xa. R\<^sup>+\<^sup>+ x xa \<Longrightarrow> R x xa
 2. \<And>x xa. R x xa \<Longrightarrow> R\<^sup>+\<^sup>+ x xa
[PROOF STEP]
thus "R x y"
[PROOF STATE]
proof (prove)
using this:
R\<^sup>+\<^sup>+ x y

goal (1 subgoal):
 1. R x y
[PROOF STEP]
by induction(blast dest: transpD[OF assms])+
[PROOF STATE]
proof (state)
this:
R x y

goal (1 subgoal):
 1. \<And>x xa. R x xa \<Longrightarrow> R\<^sup>+\<^sup>+ x xa
[PROOF STEP]
qed simp


[STATEMENT]
lemma tl_list_minus_butlast_empty:
  assumes "strict_prefix (butlast s) t" and "length s > 0" and "length t = length s"
  shows "tl (t - (butlast s)) = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tl (t - butlast s) = []
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
strict_prefix (butlast s) t
0 < length s
length t = length s

goal (1 subgoal):
 1. tl (t - butlast s) = []
[PROOF STEP]
by (simp add: list_minus_butlast_eq_butlast_list)


[STATEMENT]
lemma aprimedivisor_gt_0_nat [simp]: "d > Suc 0 \<Longrightarrow> aprimedivisor d > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 < d \<Longrightarrow> 0 < aprimedivisor d
[PROOF STEP]
using prime_aprimedivisor'[of d]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>d \<noteq> 0; \<not> is_unit d\<rbrakk> \<Longrightarrow> prime (aprimedivisor d)

goal (1 subgoal):
 1. Suc 0 < d \<Longrightarrow> 0 < aprimedivisor d
[PROOF STEP]
by (simp add: prime_gt_0_nat)


[STATEMENT]
lemma suminf_le: "(\<And>n. f n \<le> g n) \<Longrightarrow> summable f \<Longrightarrow> summable g \<Longrightarrow> suminf f \<le> suminf g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>n. f n \<le> g n; summable f; summable g\<rbrakk> \<Longrightarrow> suminf f \<le> suminf g
[PROOF STEP]
using sums_le
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>n. ?f n \<le> ?g n; ?f sums ?s; ?g sums ?t\<rbrakk> \<Longrightarrow> ?s \<le> ?t

goal (1 subgoal):
 1. \<lbrakk>\<And>n. f n \<le> g n; summable f; summable g\<rbrakk> \<Longrightarrow> suminf f \<le> suminf g
[PROOF STEP]
by blast


[STATEMENT]
lemma ide_implies_finite_set:
    assumes "ide a"
    shows "finite (set a)" and "finite (hom unity a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (local.set a) &&& finite (hom unity a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (local.set a)
 2. finite (hom unity a)
[PROOF STEP]
show 1: "finite (set a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (local.set a)
[PROOF STEP]
using assms set_ide_char
[PROOF STATE]
proof (prove)
using this:
ide a
(?A \<in> local.set ` Collect ide) = (?A \<subseteq> Univ \<and> finite ?A)

goal (1 subgoal):
 1. finite (local.set a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (local.set a)

goal (1 subgoal):
 1. finite (hom unity a)
[PROOF STEP]
show "finite (hom unity a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (hom unity a)
[PROOF STEP]
using assms 1 bij_betw_points_and_set finite_imageD inj_img set_def
[PROOF STATE]
proof (prove)
using this:
ide a
finite (local.set a)
ide ?a \<Longrightarrow> bij_betw img (hom unity ?a) (local.set ?a)
\<lbrakk>finite (?f ` ?A); inj_on ?f ?A\<rbrakk> \<Longrightarrow> finite ?A
ide ?a \<Longrightarrow> inj_on some_img (hom unity ?a)
local.set ?a = some_img ` hom unity ?a

goal (1 subgoal):
 1. finite (hom unity a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (hom unity a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in gram_schmidt_fs_Rn) Gramian_determinant_1 [simp]:
  assumes "0 < length fs"
  shows "Gramian_determinant fs (Suc 0) = \<parallel>fs ! 0\<parallel>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gramian_determinant fs (Suc 0) = \<parallel>fs ! 0\<parallel>\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Gramian_determinant fs (Suc 0) = \<parallel>fs ! 0\<parallel>\<^sup>2
[PROOF STEP]
have "Gramian_determinant fs (Suc 0) = fs ! 0 \<bullet> fs ! 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gramian_determinant fs (Suc 0) = fs ! 0 \<bullet> fs ! 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < length fs

goal (1 subgoal):
 1. Gramian_determinant fs (Suc 0) = fs ! 0 \<bullet> fs ! 0
[PROOF STEP]
unfolding Gramian_determinant_def
[PROOF STATE]
proof (prove)
using this:
0 < length fs

goal (1 subgoal):
 1. det (Gramian_matrix fs (Suc 0)) = fs ! 0 \<bullet> fs ! 0
[PROOF STEP]
by (subst det_def') (auto simp add: Gramian_matrix_def Let_def scalar_prod_def)
[PROOF STATE]
proof (state)
this:
Gramian_determinant fs (Suc 0) = fs ! 0 \<bullet> fs ! 0

goal (1 subgoal):
 1. Gramian_determinant fs (Suc 0) = \<parallel>fs ! 0\<parallel>\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Gramian_determinant fs (Suc 0) = fs ! 0 \<bullet> fs ! 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Gramian_determinant fs (Suc 0) = fs ! 0 \<bullet> fs ! 0

goal (1 subgoal):
 1. Gramian_determinant fs (Suc 0) = \<parallel>fs ! 0\<parallel>\<^sup>2
[PROOF STEP]
by (subst sq_norm_vec_as_cscalar_prod) simp
[PROOF STATE]
proof (state)
this:
Gramian_determinant fs (Suc 0) = \<parallel>fs ! 0\<parallel>\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIMSEQ_inverse_real_of_nat_add_minus_mult: "(\<lambda>n. r * (1 + - inverse (real (Suc n)))) \<longlonglongrightarrow> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. r * (1 + - inverse (real (Suc n)))) \<longlonglongrightarrow> r
[PROOF STEP]
using tendsto_mult [OF tendsto_const LIMSEQ_inverse_real_of_nat_add_minus [of 1]]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. ?a * (1 + - inverse (real (Suc x)))) \<longlonglongrightarrow> ?a * 1

goal (1 subgoal):
 1. (\<lambda>n. r * (1 + - inverse (real (Suc n)))) \<longlonglongrightarrow> r
[PROOF STEP]
by auto


[STATEMENT]
lemma UNIV_union: "{x. x < dim_vec a \<and> vec_index (a::bool vec) x = True}
  \<union> {x. x < dim_vec a \<and> vec_index (a::bool vec) x = False} = {x. x < dim_vec a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x < dim_vec a \<and> a $ x = True} \<union> {x. x < dim_vec a \<and> a $ x = False} = {x. x < dim_vec a}
[PROOF STEP]
by auto


[STATEMENT]
lemma isCont_powreal_exponent_gt_one:
   "a > 1 \<Longrightarrow> isCont (\<lambda>x. a pow\<^sub>\<real> x) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < a \<Longrightarrow> isCont ((pow\<^sub>\<real>) a) x
[PROOF STEP]
by (metis ext isCont_powa_exponent_gt_one less_eq_real_def powreal_eq_powa)


[STATEMENT]
lemma poly_root_set_eq:
  assumes "(\<Prod>(a::'a::field)\<leftarrow>L. [:- a, 1:]) = (\<Prod>a\<leftarrow>M. [:- a, 1:])"
  shows "set L = set M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set L = set M
[PROOF STEP]
using assms poly_root_set_subseteq
[PROOF STATE]
proof (prove)
using this:
(\<Prod>a\<leftarrow>L. [:- a, 1::'a:]) = (\<Prod>a\<leftarrow>M. [:- a, 1::'a:])
(\<Prod>a\<leftarrow>?L. [:- a, 1::?'a:]) = (\<Prod>a\<leftarrow>?M. [:- a, 1::?'a:]) \<Longrightarrow> set ?L \<subseteq> set ?M

goal (1 subgoal):
 1. set L = set M
[PROOF STEP]
by (simp add: poly_root_set_subseteq equalityI)


[STATEMENT]
lemma poly_eval_eq_poly: "poly_eval a (pm_of_poly x p) = poly p (a x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_eval a (pm_of_poly x p) = poly p (a x)
[PROOF STEP]
by (induct p)
    (simp_all add: pm_of_poly_pCons poly_eval_plus poly_eval_times poly_eval_monomial
              flip: times_monomial_left)


[STATEMENT]
lemma inf_eq_cases:
  "-x \<sqinter> -y = -x \<sqinter> -z \<Longrightarrow> --x \<sqinter> -y = --x \<sqinter> -z \<Longrightarrow> -y = -z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- x \<sqinter> - y = - x \<sqinter> - z; - - x \<sqinter> - y = - - x \<sqinter> - z\<rbrakk> \<Longrightarrow> - y = - z
[PROOF STEP]
by (metis inf_commutative sup_cases)


[STATEMENT]
lemma bigo_powr:
  fixes f :: "'a \<Rightarrow> real"
  assumes "f \<in> O[F](g)" "p \<ge> 0"
  shows   "(\<lambda>x. \<bar>f x\<bar> powr p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<bar>f x\<bar> powr p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr p)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. \<bar>f x\<bar> powr p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr p)
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
f \<in> O[F](g)
[PROOF STEP]
obtain c where c: "c > 0" and *: "\<forall>\<^sub>F x in F. norm (f x) \<le> c * norm (g x)"
[PROOF STATE]
proof (prove)
using this:
f \<in> O[F](g)

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>0 < c; \<forall>\<^sub>F x in F. norm (f x) \<le> c * norm (g x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim landau_o.bigE landau_omega.bigE IntE)
[PROOF STATE]
proof (state)
this:
0 < c
\<forall>\<^sub>F x in F. norm (f x) \<le> c * norm (g x)

goal (1 subgoal):
 1. (\<lambda>x. \<bar>f x\<bar> powr p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr p)
[PROOF STEP]
from assms(2) *
[PROOF STATE]
proof (chain)
picking this:
0 \<le> p
\<forall>\<^sub>F x in F. norm (f x) \<le> c * norm (g x)
[PROOF STEP]
have "eventually (\<lambda>x. (norm (f x)) powr p \<le> (c * norm (g x)) powr p) F"
[PROOF STATE]
proof (prove)
using this:
0 \<le> p
\<forall>\<^sub>F x in F. norm (f x) \<le> c * norm (g x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. norm (f x) powr p \<le> (c * norm (g x)) powr p
[PROOF STEP]
by (auto elim!: eventually_mono intro!: powr_mono2)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. norm (f x) powr p \<le> (c * norm (g x)) powr p

goal (1 subgoal):
 1. (\<lambda>x. \<bar>f x\<bar> powr p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr p)
[PROOF STEP]
with c
[PROOF STATE]
proof (chain)
picking this:
0 < c
\<forall>\<^sub>F x in F. norm (f x) powr p \<le> (c * norm (g x)) powr p
[PROOF STEP]
show "(\<lambda>x. \<bar>f x\<bar> powr p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr p)"
[PROOF STATE]
proof (prove)
using this:
0 < c
\<forall>\<^sub>F x in F. norm (f x) powr p \<le> (c * norm (g x)) powr p

goal (1 subgoal):
 1. (\<lambda>x. \<bar>f x\<bar> powr p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr p)
[PROOF STEP]
by (intro bigoI[of _ "c powr p"]) (simp_all add: powr_mult)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<bar>f x\<bar> powr p) \<in> O[F](\<lambda>x. \<bar>g x\<bar> powr p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma expand_list_case:
 "P(list_case a f xs) = ((xs=[] \<longrightarrow> P a ) \<and> (\<forall>y ys. xs=y#ys \<longrightarrow> P(f y ys)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (list_case a f xs) = ((xs = [] \<longrightarrow> P a) \<and> (\<forall>y ys. xs = y # ys \<longrightarrow> P (f y ys)))
[PROOF STEP]
by (induct xs rule: list_induct) simp_all


[STATEMENT]
lemma multiset_induct_min[case_names empty add]:
  fixes M :: "'a::linorder multiset"
  assumes
    empty: "P {#}" and
    add: "\<And>x M. P M \<Longrightarrow> (\<forall>y \<in># M. y \<ge> x) \<Longrightarrow> P (add_mset x M)"
  shows "P M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P M
[PROOF STEP]
proof (induct "size M" arbitrary: M)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k = size ?M \<Longrightarrow> P ?M
Suc k = size M

goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
note ih = this(1) and Sk_eq_sz_M = this(2)
[PROOF STATE]
proof (state)
this:
k = size ?M \<Longrightarrow> P ?M
Suc k = size M

goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
let ?y = "Min_mset M"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
let ?N = "M - {#?y#}"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
have M: "M = add_mset ?y ?N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M = add_mset (Min_mset M) (M - {#Min_mset M#})
[PROOF STEP]
by (metis Min_in Sk_eq_sz_M finite_set_mset insert_DiffM lessI not_less_zero
      set_mset_eq_empty_iff size_empty)
[PROOF STATE]
proof (state)
this:
M = add_mset (Min_mset M) (M - {#Min_mset M#})

goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P M
[PROOF STEP]
by (subst M, rule add, rule ih, metis M Sk_eq_sz_M nat.inject size_add_mset,
      meson Min_le finite_set_mset in_diffD)
[PROOF STATE]
proof (state)
this:
P M

goal (1 subgoal):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
[PROOF STEP]
qed (simp add: empty)


[STATEMENT]
lemma cong_mult_rcancel:
  "[a * k = b * k] (mod m) \<longleftrightarrow> [a = b] (mod m)"
  if "coprime k m" for a k m :: "'a::{unique_euclidean_ring, ring_gcd}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a * k = b * k] (mod m) = [a = b] (mod m)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
coprime k m

goal (1 subgoal):
 1. [a * k = b * k] (mod m) = [a = b] (mod m)
[PROOF STEP]
by (auto simp add: cong_iff_dvd_diff left_diff_distrib [symmetric] ac_simps coprime_dvd_mult_right_iff)


[STATEMENT]
lemma poly_as_sum:
  fixes p :: "'a::comm_semiring_1 poly"
  shows "poly p x = (\<Sum>i\<le>degree p. x ^ i * coeff p i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p x = (\<Sum>i\<le>degree p. x ^ i * coeff p i)
[PROOF STEP]
unfolding poly_altdef
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>degree p. coeff p i * x ^ i) = (\<Sum>i\<le>degree p. x ^ i * coeff p i)
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
theorem "\<forall>(x::int). (2 dvd x) --> (\<exists>(y::int). x = 2*y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. even x \<longrightarrow> (\<exists>y. x = 2 * y)
[PROOF STEP]
by presburger


[STATEMENT]
lemma arg_less_sf: "x > 1 \<Longrightarrow> x < sf(x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> x < sf x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> x < sf x
[PROOF STEP]
assume A1: "x > 1"
[PROOF STATE]
proof (state)
this:
1 < x

goal (1 subgoal):
 1. 1 < x \<Longrightarrow> x < sf x
[PROOF STEP]
let ?y = "x-(1::nat)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> x < sf x
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
1 < x
[PROOF STEP]
have S1: "x = ?y+1"
[PROOF STATE]
proof (prove)
using this:
1 < x

goal (1 subgoal):
 1. x = x - 1 + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = x - 1 + 1

goal (1 subgoal):
 1. 1 < x \<Longrightarrow> x < sf x
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
1 < x
[PROOF STEP]
have "?y > 0"
[PROOF STATE]
proof (prove)
using this:
1 < x

goal (1 subgoal):
 1. 0 < x - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < x - 1

goal (1 subgoal):
 1. 1 < x \<Longrightarrow> x < sf x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < x - 1
[PROOF STEP]
have S2: "sf(?y) > 0"
[PROOF STATE]
proof (prove)
using this:
0 < x - 1

goal (1 subgoal):
 1. 0 < sf (x - 1)
[PROOF STEP]
by (rule sf_posI)
[PROOF STATE]
proof (state)
this:
0 < sf (x - 1)

goal (1 subgoal):
 1. 1 < x \<Longrightarrow> x < sf x
[PROOF STEP]
have "sf(?y+1) = sf(?y) + ?y + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sf (x - 1 + 1) = sf (x - 1) + (x - 1) + 1
[PROOF STEP]
by (rule sf_at_Suc)
[PROOF STATE]
proof (state)
this:
sf (x - 1 + 1) = sf (x - 1) + (x - 1) + 1

goal (1 subgoal):
 1. 1 < x \<Longrightarrow> x < sf x
[PROOF STEP]
with S1
[PROOF STATE]
proof (chain)
picking this:
x = x - 1 + 1
sf (x - 1 + 1) = sf (x - 1) + (x - 1) + 1
[PROOF STEP]
have "sf(x) = sf(?y) + x"
[PROOF STATE]
proof (prove)
using this:
x = x - 1 + 1
sf (x - 1 + 1) = sf (x - 1) + (x - 1) + 1

goal (1 subgoal):
 1. sf x = sf (x - 1) + x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sf x = sf (x - 1) + x

goal (1 subgoal):
 1. 1 < x \<Longrightarrow> x < sf x
[PROOF STEP]
with S2
[PROOF STATE]
proof (chain)
picking this:
0 < sf (x - 1)
sf x = sf (x - 1) + x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < sf (x - 1)
sf x = sf (x - 1) + x

goal (1 subgoal):
 1. x < sf x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x < sf x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma foldl_Gauss_condition_1:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}" and k::nat
  assumes "\<forall>m. is_zero_row_upt_k m k A"
  and "\<forall>m\<ge>0. A $ m $ from_nat k = 0"
  shows "is_zero_row_upt_k m (Suc k) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row_upt_k m (Suc k) A
[PROOF STEP]
by (rule is_zero_row_upt_k_suc, auto simp add: assms least_mod_type)


[STATEMENT]
lemma filtermap_nhds_open_map:
  assumes cont: "isCont f a"
    and open_map: "\<And>S. open S \<Longrightarrow> open (f`S)"
  shows "filtermap f (nhds a) = nhds (f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap f (nhds a) = nhds (f a)
[PROOF STEP]
unfolding filter_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>P. eventually P (filtermap f (nhds a)) = eventually P (nhds (f a))
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>P. eventually P (filtermap f (nhds a)) \<Longrightarrow> eventually P (nhds (f a))
 2. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
fix P
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>P. eventually P (filtermap f (nhds a)) \<Longrightarrow> eventually P (nhds (f a))
 2. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
assume "eventually P (filtermap f (nhds a))"
[PROOF STATE]
proof (state)
this:
eventually P (filtermap f (nhds a))

goal (2 subgoals):
 1. \<And>P. eventually P (filtermap f (nhds a)) \<Longrightarrow> eventually P (nhds (f a))
 2. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eventually P (filtermap f (nhds a))
[PROOF STEP]
obtain S where "open S" "a \<in> S" "\<forall>x\<in>S. P (f x)"
[PROOF STATE]
proof (prove)
using this:
eventually P (filtermap f (nhds a))

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>open S; a \<in> S; \<forall>x\<in>S. P (f x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: eventually_filtermap eventually_nhds)
[PROOF STATE]
proof (state)
this:
open S
a \<in> S
\<forall>x\<in>S. P (f x)

goal (2 subgoals):
 1. \<And>P. eventually P (filtermap f (nhds a)) \<Longrightarrow> eventually P (nhds (f a))
 2. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open S
a \<in> S
\<forall>x\<in>S. P (f x)
[PROOF STEP]
show "eventually P (nhds (f a))"
[PROOF STATE]
proof (prove)
using this:
open S
a \<in> S
\<forall>x\<in>S. P (f x)

goal (1 subgoal):
 1. eventually P (nhds (f a))
[PROOF STEP]
unfolding eventually_nhds
[PROOF STATE]
proof (prove)
using this:
open S
a \<in> S
\<forall>x\<in>S. P (f x)

goal (1 subgoal):
 1. \<exists>S. open S \<and> f a \<in> S \<and> Ball S P
[PROOF STEP]
apply (intro exI[of _ "f`S"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>open S; a \<in> S; \<forall>x\<in>S. P (f x)\<rbrakk> \<Longrightarrow> open (f ` S) \<and> f a \<in> f ` S \<and> Ball (f ` S) P
[PROOF STEP]
by (auto intro!: open_map)
[PROOF STATE]
proof (state)
this:
eventually P (nhds (f a))

goal (1 subgoal):
 1. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
qed (metis filterlim_iff tendsto_at_iff_tendsto_nhds isCont_def eventually_filtermap cont)


[STATEMENT]
lemma (in fin_sgraph) triangle_set_graph_edge_ss_bound:
  assumes "E' \<subseteq> E"
  shows "card (triangle_set) \<ge> card (sgraph.triangle_set E')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sgraph.triangle_set E') \<le> card triangle_set
[PROOF STEP]
using triangle_set_graph_edge_ss finite_triangle_set
[PROOF STATE]
proof (prove)
using this:
?E' \<subseteq> E \<Longrightarrow> sgraph.triangle_set ?E' \<subseteq> triangle_set
finite triangle_set

goal (1 subgoal):
 1. card (sgraph.triangle_set E') \<le> card triangle_set
[PROOF STEP]
by (simp add: assms card_mono)


[STATEMENT]
lemma lex_p_eq: "((n',x'), (n,x)) \<in> lex_p = (n'<n \<or> n'=n \<and> x'<x) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((n', x'), n, x) \<in> lex_p) = (n' < n \<or> n' = n \<and> x' < x)
[PROOF STEP]
apply(simp add: lex_p_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma landau_sum_2:
  assumes "eventually (\<lambda>x. g1 x \<ge> (0::real)) F"
  assumes "eventually (\<lambda>x. g2 x \<ge> 0) F"
  assumes "f \<in> O[F](g2)"
  shows "f \<in> O[F](\<lambda>x. g1 x + g2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
have "f = (\<lambda>x. 0 + f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = (\<lambda>x. 0 + f x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. 0 + f x)

goal (1 subgoal):
 1. f \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. 0 + f x)

goal (1 subgoal):
 1. f \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
have "... \<in> O[F](\<lambda>x. g1 x + g2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. 0 + f x) \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
using assms zero_in_bigo
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. 0 \<le> g1 x
\<forall>\<^sub>F x in F. 0 \<le> g2 x
f \<in> O[F](g2)
(\<lambda>_. 0::?'b) \<in> O[?F](?f)

goal (1 subgoal):
 1. (\<lambda>x. 0 + f x) \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
by (intro landau_sum)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. 0 + f x) \<in> O[F](\<lambda>x. g1 x + g2 x)

goal (1 subgoal):
 1. f \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<in> O[F](\<lambda>x. g1 x + g2 x)

goal (1 subgoal):
 1. f \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f \<in> O[F](\<lambda>x. g1 x + g2 x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma r_append [simp]: "eval r_append [a, b] \<down>= e_append a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval r_append [a, b] \<down>= e_append a b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval r_append [a, b] \<down>= e_append a b
[PROOF STEP]
define g where "g = Cn 4 r_snoc [Id 4 1, Cn 4 r_nth [Id 4 3, Id 4 0]]"
[PROOF STATE]
proof (state)
this:
g = Cn 4 r_snoc [recf.Id 4 1, Cn 4 r_nth [recf.Id 4 3, recf.Id 4 0]]

goal (1 subgoal):
 1. eval r_append [a, b] \<down>= e_append a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g = Cn 4 r_snoc [recf.Id 4 1, Cn 4 r_nth [recf.Id 4 3, recf.Id 4 0]]
[PROOF STEP]
have g: "eval g [j, r, a, b] \<down>= e_snoc r (e_nth b j)" for j r
[PROOF STATE]
proof (prove)
using this:
g = Cn 4 r_snoc [recf.Id 4 1, Cn 4 r_nth [recf.Id 4 3, recf.Id 4 0]]

goal (1 subgoal):
 1. eval g [j, r, a, b] \<down>= e_snoc r (e_nth b j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval g [?j, ?r, a, b] \<down>= e_snoc ?r (e_nth b ?j)

goal (1 subgoal):
 1. eval r_append [a, b] \<down>= e_append a b
[PROOF STEP]
let ?h = "Pr 2 (Id 2 0) g"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval r_append [a, b] \<down>= e_append a b
[PROOF STEP]
have "eval ?h [n, a, b] \<down>= list_encode (list_decode a @ (take n (list_decode b)))"
      if "n \<le> e_length b" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (Pr 2 (recf.Id 2 0) g) [n, a, b] \<down>= Partial_Recursive.list_encode (Partial_Recursive.list_decode a @ take n (Partial_Recursive.list_decode b))
[PROOF STEP]
using that g g_def
[PROOF STATE]
proof (prove)
using this:
n \<le> e_length b
eval g [?j, ?r, a, b] \<down>= e_snoc ?r (e_nth b ?j)
g = Cn 4 r_snoc [recf.Id 4 1, Cn 4 r_nth [recf.Id 4 3, recf.Id 4 0]]

goal (1 subgoal):
 1. eval (Pr 2 (recf.Id 2 0) g) [n, a, b] \<down>= Partial_Recursive.list_encode (Partial_Recursive.list_decode a @ take n (Partial_Recursive.list_decode b))
[PROOF STEP]
by (induction n) (simp_all add: take_Suc_conv_app_nth)
[PROOF STATE]
proof (state)
this:
?n \<le> e_length b \<Longrightarrow> eval (Pr 2 (recf.Id 2 0) g) [?n, a, b] \<down>= Partial_Recursive.list_encode (Partial_Recursive.list_decode a @ take ?n (Partial_Recursive.list_decode b))

goal (1 subgoal):
 1. eval r_append [a, b] \<down>= e_append a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?n \<le> e_length b \<Longrightarrow> eval (Pr 2 (recf.Id 2 0) g) [?n, a, b] \<down>= Partial_Recursive.list_encode (Partial_Recursive.list_decode a @ take ?n (Partial_Recursive.list_decode b))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?n \<le> e_length b \<Longrightarrow> eval (Pr 2 (recf.Id 2 0) g) [?n, a, b] \<down>= Partial_Recursive.list_encode (Partial_Recursive.list_decode a @ take ?n (Partial_Recursive.list_decode b))

goal (1 subgoal):
 1. eval r_append [a, b] \<down>= e_append a b
[PROOF STEP]
unfolding r_append_def g_def e_append_def
[PROOF STATE]
proof (prove)
using this:
?n \<le> e_length b \<Longrightarrow> eval (Pr 2 (recf.Id 2 0) (Cn 4 r_snoc [recf.Id 4 1, Cn 4 r_nth [recf.Id 4 3, recf.Id 4 0]])) [?n, a, b] \<down>= Partial_Recursive.list_encode (Partial_Recursive.list_decode a @ take ?n (Partial_Recursive.list_decode b))

goal (1 subgoal):
 1. eval (let f = recf.Id 2 0; g = Cn 4 r_snoc [recf.Id 4 1, Cn 4 r_nth [recf.Id 4 3, recf.Id 4 0]] in Cn 2 (Pr 2 f g) [Cn 2 r_length [recf.Id 2 1], recf.Id 2 0, recf.Id 2 1]) [a, b] \<down>= Partial_Recursive.list_encode (Partial_Recursive.list_decode a @ Partial_Recursive.list_decode b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval r_append [a, b] \<down>= e_append a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_nempty_preorder_has_max:
  assumes "finite B" "B \<noteq> {}" "refl_on B R" "trans R" "total_on B R"
  shows "\<exists>x \<in> B. \<forall>y \<in> B. (x, y) \<in> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>B. \<forall>y\<in>B. x \<succeq>[R] y
[PROOF STEP]
using assms(1) subset_refl[of B] assms(2)
[PROOF STATE]
proof (prove)
using this:
finite B
B \<subseteq> B
B \<noteq> {}

goal (1 subgoal):
 1. \<exists>x\<in>B. \<forall>y\<in>B. x \<succeq>[R] y
[PROOF STEP]
proof (induct B rule: finite_subset_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {} \<noteq> {} \<Longrightarrow> \<exists>x\<in>{}. \<forall>y\<in>{}. x \<succeq>[R] y
 2. \<And>a F. \<lbrakk>finite F; a \<in> B; a \<notin> F; F \<noteq> {} \<Longrightarrow> \<exists>x\<in>F. \<forall>y\<in>F. x \<succeq>[R] y; insert a F \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>x\<in>insert a F. \<forall>y\<in>insert a F. x \<succeq>[R] y
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<in> B
x \<notin> F
F \<noteq> {} \<Longrightarrow> \<exists>x\<in>F. \<forall>y\<in>F. x \<succeq>[R] y
insert x F \<noteq> {}

goal (2 subgoals):
 1. {} \<noteq> {} \<Longrightarrow> \<exists>x\<in>{}. \<forall>y\<in>{}. x \<succeq>[R] y
 2. \<And>a F. \<lbrakk>finite F; a \<in> B; a \<notin> F; F \<noteq> {} \<Longrightarrow> \<exists>x\<in>F. \<forall>y\<in>F. x \<succeq>[R] y; insert a F \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>x\<in>insert a F. \<forall>y\<in>insert a F. x \<succeq>[R] y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<in> B
x \<notin> F
F \<noteq> {} \<Longrightarrow> \<exists>x\<in>F. \<forall>y\<in>F. x \<succeq>[R] y
insert x F \<noteq> {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite F
x \<in> B
x \<notin> F
F \<noteq> {} \<Longrightarrow> \<exists>x\<in>F. \<forall>y\<in>F. x \<succeq>[R] y
insert x F \<noteq> {}

goal (1 subgoal):
 1. \<exists>xa\<in>insert x F. \<forall>y\<in>insert x F. xa \<succeq>[R] y
[PROOF STEP]
using assms(3-)
[PROOF STATE]
proof (prove)
using this:
finite F
x \<in> B
x \<notin> F
F \<noteq> {} \<Longrightarrow> \<exists>x\<in>F. \<forall>y\<in>F. x \<succeq>[R] y
insert x F \<noteq> {}
refl_on B R
trans R
total_on B R

goal (1 subgoal):
 1. \<exists>xa\<in>insert x F. \<forall>y\<in>insert x F. xa \<succeq>[R] y
[PROOF STEP]
by (cases "F = {}") (auto simp: refl_onD total_on_def, metis refl_onD2 transE)
[PROOF STATE]
proof (state)
this:
\<exists>xa\<in>insert x F. \<forall>y\<in>insert x F. xa \<succeq>[R] y

goal (1 subgoal):
 1. {} \<noteq> {} \<Longrightarrow> \<exists>x\<in>{}. \<forall>y\<in>{}. x \<succeq>[R] y
[PROOF STEP]
qed auto


[STATEMENT]
lemma res_function_Complete_set_residues:
  assumes f: "res_function f"
  shows "Complete_set_residues (\<lambda>c. (f c)`UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complete_set_residues (\<lambda>c. range (f c))
[PROOF STEP]
unfolding Complete_set_residues_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>fa. res_function fa \<and> (\<forall>c. pairwise (\<lambda>a b. \<not> cong a b c) (range (fa c)) \<and> range (f c) = range (fa c))
[PROOF STEP]
apply (rule exI[of _ f])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. res_function f \<and> (\<forall>c. pairwise (\<lambda>a b. \<not> cong a b c) (range (f c)) \<and> range (f c) = range (f c))
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
res_function f

goal (1 subgoal):
 1. res_function f \<and> (\<forall>c. pairwise (\<lambda>a b. \<not> cong a b c) (range (f c)) \<and> range (f c) = range (f c))
[PROOF STEP]
unfolding res_function_def
[PROOF STATE]
proof (prove)
using this:
\<forall>c. (\<forall>a b. cong a b c = (f c a = f c b)) \<and> pairwise (\<lambda>a b. \<not> cong a b c) (range (f c)) \<and> (\<forall>a. \<exists>k. f c a = a + k * c)

goal (1 subgoal):
 1. (\<forall>c. (\<forall>a b. cong a b c = (f c a = f c b)) \<and> pairwise (\<lambda>a b. \<not> cong a b c) (range (f c)) \<and> (\<forall>a. \<exists>k. f c a = a + k * c)) \<and> (\<forall>c. pairwise (\<lambda>a b. \<not> cong a b c) (range (f c)) \<and> range (f c) = range (f c))
[PROOF STEP]
by blast


[STATEMENT]
theorem Rice_3: "\<lbrakk> C \<subseteq> ce_sets; computable { n. nat_to_ce_set n \<in> C} \<rbrakk> \<Longrightarrow> C = {} \<or> C = ce_sets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> ce_sets; computable {n. nat_to_ce_set n \<in> C}\<rbrakk> \<Longrightarrow> C = {} \<or> C = ce_sets
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> ce_sets; computable {n. nat_to_ce_set n \<in> C}; \<not> (C = {} \<or> C = ce_sets)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume A1: "C \<subseteq> ce_sets"
[PROOF STATE]
proof (state)
this:
C \<subseteq> ce_sets

goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> ce_sets; computable {n. nat_to_ce_set n \<in> C}; \<not> (C = {} \<or> C = ce_sets)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume A2: "computable { n. nat_to_ce_set n \<in> C}"
[PROOF STATE]
proof (state)
this:
computable {n. nat_to_ce_set n \<in> C}

goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> ce_sets; computable {n. nat_to_ce_set n \<in> C}; \<not> (C = {} \<or> C = ce_sets)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume A3: "\<not> (C = {} \<or> C = ce_sets)"
[PROOF STATE]
proof (state)
this:
\<not> (C = {} \<or> C = ce_sets)

goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> ce_sets; computable {n. nat_to_ce_set n \<in> C}; \<not> (C = {} \<or> C = ce_sets)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from A3
[PROOF STATE]
proof (chain)
picking this:
\<not> (C = {} \<or> C = ce_sets)
[PROOF STEP]
have A4: "C \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
\<not> (C = {} \<or> C = ce_sets)

goal (1 subgoal):
 1. C \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C \<noteq> {}

goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> ce_sets; computable {n. nat_to_ce_set n \<in> C}; \<not> (C = {} \<or> C = ce_sets)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from A3
[PROOF STATE]
proof (chain)
picking this:
\<not> (C = {} \<or> C = ce_sets)
[PROOF STEP]
have A5: "C \<noteq> ce_sets"
[PROOF STATE]
proof (prove)
using this:
\<not> (C = {} \<or> C = ce_sets)

goal (1 subgoal):
 1. C \<noteq> ce_sets
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C \<noteq> ce_sets

goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> ce_sets; computable {n. nat_to_ce_set n \<in> C}; \<not> (C = {} \<or> C = ce_sets)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
define A where "A = { n. nat_to_ce_set n \<in> C}"
[PROOF STATE]
proof (state)
this:
A = {n. nat_to_ce_set n \<in> C}

goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> ce_sets; computable {n. nat_to_ce_set n \<in> C}; \<not> (C = {} \<or> C = ce_sets)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have S1: "index_set A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. index_set A
[PROOF STEP]
proof (unfold index_set_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>n m. n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m \<longrightarrow> m \<in> A
[PROOF STEP]
show "\<forall>n m. n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m \<longrightarrow> m \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n m. n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m \<longrightarrow> m \<in> A
[PROOF STEP]
proof (rule allI, rule allI, rule impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m \<Longrightarrow> m \<in> A
[PROOF STEP]
fix n m
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m \<Longrightarrow> m \<in> A
[PROOF STEP]
assume A1_1: "n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m"
[PROOF STATE]
proof (state)
this:
n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m

goal (1 subgoal):
 1. \<And>n m. n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m \<Longrightarrow> m \<in> A
[PROOF STEP]
from A1_1
[PROOF STATE]
proof (chain)
picking this:
n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m
[PROOF STEP]
have "n \<in> A"
[PROOF STATE]
proof (prove)
using this:
n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m

goal (1 subgoal):
 1. n \<in> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n \<in> A

goal (1 subgoal):
 1. \<And>n m. n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m \<Longrightarrow> m \<in> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<in> A
[PROOF STEP]
have S1_1: "nat_to_ce_set n \<in> C"
[PROOF STATE]
proof (prove)
using this:
n \<in> A

goal (1 subgoal):
 1. nat_to_ce_set n \<in> C
[PROOF STEP]
by (unfold A_def, auto)
[PROOF STATE]
proof (state)
this:
nat_to_ce_set n \<in> C

goal (1 subgoal):
 1. \<And>n m. n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m \<Longrightarrow> m \<in> A
[PROOF STEP]
from A1_1
[PROOF STATE]
proof (chain)
picking this:
n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m
[PROOF STEP]
have "nat_to_ce_set n = nat_to_ce_set m"
[PROOF STATE]
proof (prove)
using this:
n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m

goal (1 subgoal):
 1. nat_to_ce_set n = nat_to_ce_set m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_ce_set n = nat_to_ce_set m

goal (1 subgoal):
 1. \<And>n m. n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m \<Longrightarrow> m \<in> A
[PROOF STEP]
with S1_1
[PROOF STATE]
proof (chain)
picking this:
nat_to_ce_set n \<in> C
nat_to_ce_set n = nat_to_ce_set m
[PROOF STEP]
have "nat_to_ce_set m \<in> C"
[PROOF STATE]
proof (prove)
using this:
nat_to_ce_set n \<in> C
nat_to_ce_set n = nat_to_ce_set m

goal (1 subgoal):
 1. nat_to_ce_set m \<in> C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_ce_set m \<in> C

goal (1 subgoal):
 1. \<And>n m. n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m \<Longrightarrow> m \<in> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat_to_ce_set m \<in> C
[PROOF STEP]
show "m \<in> A"
[PROOF STATE]
proof (prove)
using this:
nat_to_ce_set m \<in> C

goal (1 subgoal):
 1. m \<in> A
[PROOF STEP]
by (unfold A_def, auto)
[PROOF STATE]
proof (state)
this:
m \<in> A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>n m. n \<in> A \<and> nat_to_ce_set n = nat_to_ce_set m \<longrightarrow> m \<in> A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
index_set A

goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> ce_sets; computable {n. nat_to_ce_set n \<in> C}; \<not> (C = {} \<or> C = ce_sets)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have S2: "A \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<noteq> {}
[PROOF STEP]
from A4
[PROOF STATE]
proof (chain)
picking this:
C \<noteq> {}
[PROOF STEP]
obtain B where S2_1: "B \<in> C"
[PROOF STATE]
proof (prove)
using this:
C \<noteq> {}

goal (1 subgoal):
 1. (\<And>B. B \<in> C \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<in> C

goal (1 subgoal):
 1. A \<noteq> {}
[PROOF STEP]
with A1
[PROOF STATE]
proof (chain)
picking this:
C \<subseteq> ce_sets
B \<in> C
[PROOF STEP]
have "B \<in> ce_sets"
[PROOF STATE]
proof (prove)
using this:
C \<subseteq> ce_sets
B \<in> C

goal (1 subgoal):
 1. B \<in> ce_sets
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<in> ce_sets

goal (1 subgoal):
 1. A \<noteq> {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B \<in> ce_sets
[PROOF STEP]
have "\<exists> n. B = nat_to_ce_set n"
[PROOF STATE]
proof (prove)
using this:
B \<in> ce_sets

goal (1 subgoal):
 1. \<exists>n. B = nat_to_ce_set n
[PROOF STEP]
by (rule nat_to_ce_set_srj)
[PROOF STATE]
proof (state)
this:
\<exists>n. B = nat_to_ce_set n

goal (1 subgoal):
 1. A \<noteq> {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>n. B = nat_to_ce_set n
[PROOF STEP]
obtain n where "B = nat_to_ce_set n"
[PROOF STATE]
proof (prove)
using this:
\<exists>n. B = nat_to_ce_set n

goal (1 subgoal):
 1. (\<And>n. B = nat_to_ce_set n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
B = nat_to_ce_set n

goal (1 subgoal):
 1. A \<noteq> {}
[PROOF STEP]
with S2_1
[PROOF STATE]
proof (chain)
picking this:
B \<in> C
B = nat_to_ce_set n
[PROOF STEP]
have "nat_to_ce_set n \<in> C"
[PROOF STATE]
proof (prove)
using this:
B \<in> C
B = nat_to_ce_set n

goal (1 subgoal):
 1. nat_to_ce_set n \<in> C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_ce_set n \<in> C

goal (1 subgoal):
 1. A \<noteq> {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat_to_ce_set n \<in> C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nat_to_ce_set n \<in> C

goal (1 subgoal):
 1. A \<noteq> {}
[PROOF STEP]
by (unfold A_def, auto)
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> ce_sets; computable {n. nat_to_ce_set n \<in> C}; \<not> (C = {} \<or> C = ce_sets)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have S3: "A \<noteq> UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<noteq> UNIV
[PROOF STEP]
from A1 A5
[PROOF STATE]
proof (chain)
picking this:
C \<subseteq> ce_sets
C \<noteq> ce_sets
[PROOF STEP]
obtain B where S2_1: "B \<notin> C" and S2_2: "B \<in> ce_sets"
[PROOF STATE]
proof (prove)
using this:
C \<subseteq> ce_sets
C \<noteq> ce_sets

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>B \<notin> C; B \<in> ce_sets\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<notin> C
B \<in> ce_sets

goal (1 subgoal):
 1. A \<noteq> UNIV
[PROOF STEP]
from S2_2
[PROOF STATE]
proof (chain)
picking this:
B \<in> ce_sets
[PROOF STEP]
have "\<exists> n. B = nat_to_ce_set n"
[PROOF STATE]
proof (prove)
using this:
B \<in> ce_sets

goal (1 subgoal):
 1. \<exists>n. B = nat_to_ce_set n
[PROOF STEP]
by (rule nat_to_ce_set_srj)
[PROOF STATE]
proof (state)
this:
\<exists>n. B = nat_to_ce_set n

goal (1 subgoal):
 1. A \<noteq> UNIV
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>n. B = nat_to_ce_set n
[PROOF STEP]
obtain n where "B = nat_to_ce_set n"
[PROOF STATE]
proof (prove)
using this:
\<exists>n. B = nat_to_ce_set n

goal (1 subgoal):
 1. (\<And>n. B = nat_to_ce_set n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
B = nat_to_ce_set n

goal (1 subgoal):
 1. A \<noteq> UNIV
[PROOF STEP]
with S2_1
[PROOF STATE]
proof (chain)
picking this:
B \<notin> C
B = nat_to_ce_set n
[PROOF STEP]
have "nat_to_ce_set n \<notin> C"
[PROOF STATE]
proof (prove)
using this:
B \<notin> C
B = nat_to_ce_set n

goal (1 subgoal):
 1. nat_to_ce_set n \<notin> C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_ce_set n \<notin> C

goal (1 subgoal):
 1. A \<noteq> UNIV
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat_to_ce_set n \<notin> C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nat_to_ce_set n \<notin> C

goal (1 subgoal):
 1. A \<noteq> UNIV
[PROOF STEP]
by (unfold A_def, auto)
[PROOF STATE]
proof (state)
this:
A \<noteq> UNIV

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
A \<noteq> UNIV

goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> ce_sets; computable {n. nat_to_ce_set n \<in> C}; \<not> (C = {} \<or> C = ce_sets)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from S1 S2 S3
[PROOF STATE]
proof (chain)
picking this:
index_set A
A \<noteq> {}
A \<noteq> UNIV
[PROOF STEP]
have "\<not> computable A"
[PROOF STATE]
proof (prove)
using this:
index_set A
A \<noteq> {}
A \<noteq> UNIV

goal (1 subgoal):
 1. \<not> computable A
[PROOF STEP]
by (rule Rice_2)
[PROOF STATE]
proof (state)
this:
\<not> computable A

goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> ce_sets; computable {n. nat_to_ce_set n \<in> C}; \<not> (C = {} \<or> C = ce_sets)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with A2
[PROOF STATE]
proof (chain)
picking this:
computable {n. nat_to_ce_set n \<in> C}
\<not> computable A
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
computable {n. nat_to_ce_set n \<in> C}
\<not> computable A

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
using this:
computable {n. nat_to_ce_set n \<in> C}
\<not> computable {n. nat_to_ce_set n \<in> C}

goal (1 subgoal):
 1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma normal_vector_span:
  assumes card: "Suc (card D) = n"
    and D: "D \<subseteq> carrier_vec n" and fin: "finite D" and lin: "lin_indpt D"
  shows "span D = { x. x \<in> carrier_vec n \<and> x \<bullet> normal_vector D = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
note nv = normal_vector[OF fin card lin D]
[PROOF STATE]
proof (state)
this:
normal_vector D \<in> carrier_vec n
normal_vector D \<noteq> 0\<^sub>v n
?w \<in> D \<Longrightarrow> ?w \<bullet> normal_vector D = (0::'a)
?w \<in> D \<Longrightarrow> normal_vector D \<bullet> ?w = (0::'a)
lin_indpt (insert (normal_vector D) D)
normal_vector D \<notin> D
\<lbrakk>is_det_bound ?db; D \<subseteq> \<int>\<^sub>v \<inter> Bounded_vec (of_int ?Bnd)\<rbrakk> \<Longrightarrow> normal_vector D \<in> \<int>\<^sub>v \<inter> Bounded_vec (of_int (?db (n - 1) ?Bnd))

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
normal_vector D \<in> carrier_vec n
normal_vector D \<noteq> 0\<^sub>v n
?w \<in> D \<Longrightarrow> ?w \<bullet> normal_vector D = (0::'a)
?w \<in> D \<Longrightarrow> normal_vector D \<bullet> ?w = (0::'a)
lin_indpt (insert (normal_vector D) D)
normal_vector D \<notin> D
\<lbrakk>is_det_bound ?db; D \<subseteq> \<int>\<^sub>v \<inter> Bounded_vec (of_int ?Bnd)\<rbrakk> \<Longrightarrow> normal_vector D \<in> \<int>\<^sub>v \<inter> Bounded_vec (of_int (?db (n - 1) ?Bnd))

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
assume xspan: "x \<in> span D"
[PROOF STATE]
proof (state)
this:
x \<in> local.span D

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
from finite_in_span[OF fin D xspan]
[PROOF STATE]
proof (chain)
picking this:
\<exists>a. True \<and> lincomb a D = x
[PROOF STEP]
obtain c where
      "x \<bullet> normal_vector D = lincomb c D \<bullet> normal_vector D"
[PROOF STATE]
proof (prove)
using this:
\<exists>a. True \<and> lincomb a D = x

goal (1 subgoal):
 1. (\<And>c. x \<bullet> normal_vector D = lincomb c D \<bullet> normal_vector D \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<bullet> normal_vector D = lincomb c D \<bullet> normal_vector D

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<bullet> normal_vector D = lincomb c D \<bullet> normal_vector D

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
have "\<dots> = (\<Sum>w\<in>D. c w * (w \<bullet> normal_vector D))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb c D \<bullet> normal_vector D = (\<Sum>w\<in>D. c w * (w \<bullet> normal_vector D))
[PROOF STEP]
by (rule lincomb_scalar_prod_left, insert D nv, auto)
[PROOF STATE]
proof (state)
this:
lincomb c D \<bullet> normal_vector D = (\<Sum>w\<in>D. c w * (w \<bullet> normal_vector D))

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lincomb c D \<bullet> normal_vector D = (\<Sum>w\<in>D. c w * (w \<bullet> normal_vector D))

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
have "\<dots> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>w\<in>D. c w * (w \<bullet> normal_vector D)) = (0::'a)
[PROOF STEP]
apply (rule sum.neutral)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>D. c x * (x \<bullet> normal_vector D) = (0::'a)
[PROOF STEP]
using nv(1,2,3) D comm_scalar_prod[of "normal_vector D"]
[PROOF STATE]
proof (prove)
using this:
normal_vector D \<in> carrier_vec n
normal_vector D \<noteq> 0\<^sub>v n
?w \<in> D \<Longrightarrow> ?w \<bullet> normal_vector D = (0::'a)
D \<subseteq> carrier_vec n
\<lbrakk>normal_vector D \<in> carrier_vec ?n; ?v\<^sub>2 \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> normal_vector D \<bullet> ?v\<^sub>2 = ?v\<^sub>2 \<bullet> normal_vector D

goal (1 subgoal):
 1. \<forall>x\<in>D. c x * (x \<bullet> normal_vector D) = (0::'a)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>w\<in>D. c w * (w \<bullet> normal_vector D)) = (0::'a)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x \<bullet> normal_vector D = (0::'a)
[PROOF STEP]
have "x \<in> carrier_vec n"  "x \<bullet> normal_vector D = 0"
[PROOF STATE]
proof (prove)
using this:
x \<bullet> normal_vector D = (0::'a)

goal (1 subgoal):
 1. x \<in> carrier_vec n &&& x \<bullet> normal_vector D = (0::'a)
[PROOF STEP]
using xspan D
[PROOF STATE]
proof (prove)
using this:
x \<bullet> normal_vector D = (0::'a)
x \<in> local.span D
D \<subseteq> carrier_vec n

goal (1 subgoal):
 1. x \<in> carrier_vec n &&& x \<bullet> normal_vector D = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> carrier_vec n
x \<bullet> normal_vector D = (0::'a)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x5 \<in> local.span D \<Longrightarrow> ?x5 \<in> carrier_vec n
?x5 \<in> local.span D \<Longrightarrow> ?x5 \<bullet> normal_vector D = (0::'a)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?x5 \<in> local.span D \<Longrightarrow> ?x5 \<in> carrier_vec n
?x5 \<in> local.span D \<Longrightarrow> ?x5 \<bullet> normal_vector D = (0::'a)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?x5 \<in> local.span D \<Longrightarrow> ?x5 \<in> carrier_vec n
?x5 \<in> local.span D \<Longrightarrow> ?x5 \<bullet> normal_vector D = (0::'a)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
let ?n = "normal_vector D"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
assume x: "x \<in> carrier_vec n" and xscal: "x \<bullet> normal_vector D = 0"
[PROOF STATE]
proof (state)
this:
x \<in> carrier_vec n
x \<bullet> normal_vector D = (0::'a)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
let ?B = "(insert (normal_vector D) D)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
have "card ?B = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (insert (normal_vector D) D) = n
[PROOF STEP]
using card card_insert_disjoint[OF fin nv(6)]
[PROOF STATE]
proof (prove)
using this:
Suc (card D) = n
card (insert (normal_vector D) D) = Suc (card D)

goal (1 subgoal):
 1. card (insert (normal_vector D) D) = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (insert (normal_vector D) D) = n

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (insert (normal_vector D) D) = n

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
have B: "?B \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert (normal_vector D) D \<subseteq> carrier_vec n
[PROOF STEP]
using D nv
[PROOF STATE]
proof (prove)
using this:
D \<subseteq> carrier_vec n
normal_vector D \<in> carrier_vec n
normal_vector D \<noteq> 0\<^sub>v n
?w \<in> D \<Longrightarrow> ?w \<bullet> normal_vector D = (0::'a)
?w \<in> D \<Longrightarrow> normal_vector D \<bullet> ?w = (0::'a)
lin_indpt (insert (normal_vector D) D)
normal_vector D \<notin> D
\<lbrakk>is_det_bound ?db; D \<subseteq> \<int>\<^sub>v \<inter> Bounded_vec (of_int ?Bnd)\<rbrakk> \<Longrightarrow> normal_vector D \<in> \<int>\<^sub>v \<inter> Bounded_vec (of_int (?db (n - 1) ?Bnd))

goal (1 subgoal):
 1. insert (normal_vector D) D \<subseteq> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert (normal_vector D) D \<subseteq> carrier_vec n

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (insert (normal_vector D) D) = n
insert (normal_vector D) D \<subseteq> carrier_vec n
[PROOF STEP]
have "span ?B = carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
card (insert (normal_vector D) D) = n
insert (normal_vector D) D \<subseteq> carrier_vec n

goal (1 subgoal):
 1. local.span (insert (normal_vector D) D) = carrier_vec n
[PROOF STEP]
by (intro span_carrier_lin_indpt_card_n, insert nv(5), auto)
[PROOF STATE]
proof (state)
this:
local.span (insert (normal_vector D) D) = carrier_vec n

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
hence xspan: "x \<in> span ?B"
[PROOF STATE]
proof (prove)
using this:
local.span (insert (normal_vector D) D) = carrier_vec n

goal (1 subgoal):
 1. x \<in> local.span (insert (normal_vector D) D)
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
local.span (insert (normal_vector D) D) = carrier_vec n
x \<in> carrier_vec n

goal (1 subgoal):
 1. x \<in> local.span (insert (normal_vector D) D)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> local.span (insert (normal_vector D) D)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
obtain c where "x = lincomb c ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. x = lincomb c (insert (normal_vector D) D) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using finite_in_span[OF _ B xspan] fin
[PROOF STATE]
proof (prove)
using this:
finite (insert (normal_vector D) D) \<Longrightarrow> \<exists>a. True \<and> lincomb a (insert (normal_vector D) D) = x
finite D

goal (1 subgoal):
 1. (\<And>c. x = lincomb c (insert (normal_vector D) D) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = lincomb c (insert (normal_vector D) D)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
hence "0 = lincomb c ?B \<bullet> normal_vector D"
[PROOF STATE]
proof (prove)
using this:
x = lincomb c (insert (normal_vector D) D)

goal (1 subgoal):
 1. (0::'a) = lincomb c (insert (normal_vector D) D) \<bullet> normal_vector D
[PROOF STEP]
using xscal
[PROOF STATE]
proof (prove)
using this:
x = lincomb c (insert (normal_vector D) D)
x \<bullet> normal_vector D = (0::'a)

goal (1 subgoal):
 1. (0::'a) = lincomb c (insert (normal_vector D) D) \<bullet> normal_vector D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) = lincomb c (insert (normal_vector D) D) \<bullet> normal_vector D

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0::'a) = lincomb c (insert (normal_vector D) D) \<bullet> normal_vector D

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
have "\<dots> = (\<Sum>w\<in> ?B. c w * (w \<bullet> normal_vector D))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb c (insert (normal_vector D) D) \<bullet> normal_vector D = (\<Sum>w\<in>insert (normal_vector D) D. c w * (w \<bullet> normal_vector D))
[PROOF STEP]
by (subst lincomb_scalar_prod_left, insert B, auto)
[PROOF STATE]
proof (state)
this:
lincomb c (insert (normal_vector D) D) \<bullet> normal_vector D = (\<Sum>w\<in>insert (normal_vector D) D. c w * (w \<bullet> normal_vector D))

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lincomb c (insert (normal_vector D) D) \<bullet> normal_vector D = (\<Sum>w\<in>insert (normal_vector D) D. c w * (w \<bullet> normal_vector D))

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
have "\<dots> = (\<Sum>w\<in> D. c w * (w \<bullet> normal_vector D)) + c ?n * (?n \<bullet> ?n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>w\<in>insert (normal_vector D) D. c w * (w \<bullet> normal_vector D)) = (\<Sum>w\<in>D. c w * (w \<bullet> normal_vector D)) + c (normal_vector D) * (normal_vector D \<bullet> normal_vector D)
[PROOF STEP]
by (subst sum.insert[OF fin nv(6)], auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>w\<in>insert (normal_vector D) D. c w * (w \<bullet> normal_vector D)) = (\<Sum>w\<in>D. c w * (w \<bullet> normal_vector D)) + c (normal_vector D) * (normal_vector D \<bullet> normal_vector D)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>w\<in>insert (normal_vector D) D. c w * (w \<bullet> normal_vector D)) = (\<Sum>w\<in>D. c w * (w \<bullet> normal_vector D)) + c (normal_vector D) * (normal_vector D \<bullet> normal_vector D)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
have "(\<Sum>w\<in> D. c w * (w \<bullet> normal_vector D)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>w\<in>D. c w * (w \<bullet> normal_vector D)) = (0::'a)
[PROOF STEP]
apply(rule sum.neutral)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>D. c x * (x \<bullet> normal_vector D) = (0::'a)
[PROOF STEP]
using nv(1,3) comm_scalar_prod[OF nv(1)] D
[PROOF STATE]
proof (prove)
using this:
normal_vector D \<in> carrier_vec n
?w \<in> D \<Longrightarrow> ?w \<bullet> normal_vector D = (0::'a)
?v\<^sub>2 \<in> carrier_vec n \<Longrightarrow> normal_vector D \<bullet> ?v\<^sub>2 = ?v\<^sub>2 \<bullet> normal_vector D
D \<subseteq> carrier_vec n

goal (1 subgoal):
 1. \<forall>x\<in>D. c x * (x \<bullet> normal_vector D) = (0::'a)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>w\<in>D. c w * (w \<bullet> normal_vector D)) = (0::'a)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>w\<in>D. c w * (w \<bullet> normal_vector D)) = (0::'a)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
have "?n \<bullet> ?n = sq_norm ?n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normal_vector D \<bullet> normal_vector D = \<parallel>normal_vector D\<parallel>\<^sup>2
[PROOF STEP]
using sq_norm_vec_as_cscalar_prod[of ?n]
[PROOF STATE]
proof (prove)
using this:
\<parallel>normal_vector D\<parallel>\<^sup>2 = normal_vector D \<bullet>c normal_vector D

goal (1 subgoal):
 1. normal_vector D \<bullet> normal_vector D = \<parallel>normal_vector D\<parallel>\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
normal_vector D \<bullet> normal_vector D = \<parallel>normal_vector D\<parallel>\<^sup>2

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(0::'a) = (0::'a) + c (normal_vector D) * \<parallel>normal_vector D\<parallel>\<^sup>2
[PROOF STEP]
have "c ?n * sq_norm ?n = 0"
[PROOF STATE]
proof (prove)
using this:
(0::'a) = (0::'a) + c (normal_vector D) * \<parallel>normal_vector D\<parallel>\<^sup>2

goal (1 subgoal):
 1. c (normal_vector D) * \<parallel>normal_vector D\<parallel>\<^sup>2 = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c (normal_vector D) * \<parallel>normal_vector D\<parallel>\<^sup>2 = (0::'a)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
hence ncoord: "c ?n = 0"
[PROOF STATE]
proof (prove)
using this:
c (normal_vector D) * \<parallel>normal_vector D\<parallel>\<^sup>2 = (0::'a)

goal (1 subgoal):
 1. c (normal_vector D) = (0::'a)
[PROOF STEP]
using nv(1-5)
[PROOF STATE]
proof (prove)
using this:
c (normal_vector D) * \<parallel>normal_vector D\<parallel>\<^sup>2 = (0::'a)
normal_vector D \<in> carrier_vec n
normal_vector D \<noteq> 0\<^sub>v n
?w \<in> D \<Longrightarrow> ?w \<bullet> normal_vector D = (0::'a)
?w \<in> D \<Longrightarrow> normal_vector D \<bullet> ?w = (0::'a)
lin_indpt (insert (normal_vector D) D)

goal (1 subgoal):
 1. c (normal_vector D) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c (normal_vector D) = (0::'a)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
have "x = lincomb c ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = lincomb c (insert (normal_vector D) D)
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
x = lincomb c (insert (normal_vector D) D)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x = lincomb c (insert (normal_vector D) D)

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
have "\<dots> = lincomb c D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb c (insert (normal_vector D) D) = lincomb c D
[PROOF STEP]
apply (subst lincomb_insert2[OF fin D _ nv(6,1)])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c \<in> insert (normal_vector D) D \<rightarrow> UNIV
 2. c (normal_vector D) \<cdot>\<^sub>v normal_vector D + lincomb c D = lincomb c D
[PROOF STEP]
using ncoord nv(1) D
[PROOF STATE]
proof (prove)
using this:
c (normal_vector D) = (0::'a)
normal_vector D \<in> carrier_vec n
D \<subseteq> carrier_vec n

goal (2 subgoals):
 1. c \<in> insert (normal_vector D) D \<rightarrow> UNIV
 2. c (normal_vector D) \<cdot>\<^sub>v normal_vector D + lincomb c D = lincomb c D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb c (insert (normal_vector D) D) = lincomb c D

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x = lincomb c D
[PROOF STEP]
have "x \<in> span D"
[PROOF STATE]
proof (prove)
using this:
x = lincomb c D

goal (1 subgoal):
 1. x \<in> local.span D
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
x = lincomb c D
finite D

goal (1 subgoal):
 1. x \<in> local.span D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> local.span D

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x5 \<in> carrier_vec n; ?x5 \<bullet> normal_vector D = (0::'a)\<rbrakk> \<Longrightarrow> ?x5 \<in> local.span D

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?x5 \<in> local.span D \<Longrightarrow> ?x5 \<in> carrier_vec n
?x5 \<in> local.span D \<Longrightarrow> ?x5 \<bullet> normal_vector D = (0::'a)
\<lbrakk>?x5 \<in> carrier_vec n; ?x5 \<bullet> normal_vector D = (0::'a)\<rbrakk> \<Longrightarrow> ?x5 \<in> local.span D
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x5 \<in> local.span D \<Longrightarrow> ?x5 \<in> carrier_vec n
?x5 \<in> local.span D \<Longrightarrow> ?x5 \<bullet> normal_vector D = (0::'a)
\<lbrakk>?x5 \<in> carrier_vec n; ?x5 \<bullet> normal_vector D = (0::'a)\<rbrakk> \<Longrightarrow> ?x5 \<in> local.span D

goal (1 subgoal):
 1. local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.span D = {x \<in> carrier_vec n. x \<bullet> normal_vector D = (0::'a)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coprime_prime_exists:
  assumes "n > (0 :: nat)"
  obtains p where "prime p" "coprime p n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; coprime p n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; coprime p n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from bigger_prime[of n]
[PROOF STATE]
proof (chain)
picking this:
\<exists>p. prime p \<and> n < p
[PROOF STEP]
obtain p where p: "prime p" "p > n"
[PROOF STATE]
proof (prove)
using this:
\<exists>p. prime p \<and> n < p

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; n < p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime p
n < p

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; coprime p n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
prime p
n < p
[PROOF STEP]
have "\<not>p dvd n"
[PROOF STATE]
proof (prove)
using this:
0 < n
prime p
n < p

goal (1 subgoal):
 1. \<not> p dvd n
[PROOF STEP]
by (auto dest: dvd_imp_le)
[PROOF STATE]
proof (state)
this:
\<not> p dvd n

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; coprime p n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with p
[PROOF STATE]
proof (chain)
picking this:
prime p
n < p
\<not> p dvd n
[PROOF STEP]
have "coprime p n"
[PROOF STATE]
proof (prove)
using this:
prime p
n < p
\<not> p dvd n

goal (1 subgoal):
 1. coprime p n
[PROOF STEP]
by (intro prime_imp_coprime)
[PROOF STATE]
proof (state)
this:
coprime p n

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; coprime p n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with that[of p] and p
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>prime p; coprime p n\<rbrakk> \<Longrightarrow> thesis
prime p
n < p
coprime p n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime p; coprime p n\<rbrakk> \<Longrightarrow> thesis
prime p
n < p
coprime p n

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed