[STATEMENT]
lemma pi_approx:
  fixes n :: nat assumes n: "even n" and "n > 0"
  shows   "\<bar>pi - pi_approx n\<bar> \<le> inverse (2^(13*n - 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
even n
[PROOF STEP]
have n': "even (3*n)"
[PROOF STATE]
proof (prove)
using this:
even n

goal (1 subgoal):
 1. even (3 * n)
[PROOF STEP]
by simp
  \<comment> \<open>We apply the Machin formula\<close>
[PROOF STATE]
proof (state)
this:
even (3 * n)

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
from machin
[PROOF STATE]
proof (chain)
picking this:
pi / 4 = 4 * arctan (1 / 5) - arctan (1 / 239)
[PROOF STEP]
have "pi = 16 * arctan (1/5) - 4 * arctan (1/239::real)"
[PROOF STATE]
proof (prove)
using this:
pi / 4 = 4 * arctan (1 / 5) - arctan (1 / 239)

goal (1 subgoal):
 1. pi = 16 * arctan (1 / 5) - 4 * arctan (1 / 239)
[PROOF STEP]
by simp
  \<comment> \<open>Taylor series expansion of the arctangent\<close>
[PROOF STATE]
proof (state)
this:
pi = 16 * arctan (1 / 5) - 4 * arctan (1 / 239)

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pi = 16 * arctan (1 / 5) - 4 * arctan (1 / 239)

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
from arctan_approx[OF _ _ n', of "1/5"] arctan_approx[OF _ _ n, of "1/239"]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 \<le> 1 / 5; 1 / 5 < 1\<rbrakk> \<Longrightarrow> arctan (1 / 5) - arctan_approx (3 * n) (1 / 5) \<in> {0..(1 / 5) ^ (2 * (3 * n) + 1) / (1 - (1 / 5) ^ 4)}
\<lbrakk>0 \<le> 1 / 239; 1 / 239 < 1\<rbrakk> \<Longrightarrow> arctan (1 / 239) - arctan_approx n (1 / 239) \<in> {0..(1 / 239) ^ (2 * n + 1) / (1 - (1 / 239) ^ 4)}
[PROOF STEP]
have "\<dots> - pi_approx n \<in> {-4*((1/239)^(2*n+1) / (1-(1/239)^4))..16*(1/5)^(6*n+1) / (1-(1/5)^4)}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> 1 / 5; 1 / 5 < 1\<rbrakk> \<Longrightarrow> arctan (1 / 5) - arctan_approx (3 * n) (1 / 5) \<in> {0..(1 / 5) ^ (2 * (3 * n) + 1) / (1 - (1 / 5) ^ 4)}
\<lbrakk>0 \<le> 1 / 239; 1 / 239 < 1\<rbrakk> \<Longrightarrow> arctan (1 / 239) - arctan_approx n (1 / 239) \<in> {0..(1 / 239) ^ (2 * n + 1) / (1 - (1 / 239) ^ 4)}

goal (1 subgoal):
 1. 16 * arctan (1 / 5) - 4 * arctan (1 / 239) - pi_approx n \<in> {- 4 * ((1 / 239) ^ (2 * n + 1) / (1 - (1 / 239) ^ 4))..16 * (1 / 5) ^ (6 * n + 1) / (1 - (1 / 5) ^ 4)}
[PROOF STEP]
by (simp add: pi_approx_def)
  \<comment> \<open>Coarsening the bounds to make them a bit nicer\<close>
[PROOF STATE]
proof (state)
this:
16 * arctan (1 / 5) - 4 * arctan (1 / 239) - pi_approx n \<in> {- 4 * ((1 / 239) ^ (2 * n + 1) / (1 - (1 / 239) ^ 4))..16 * (1 / 5) ^ (6 * n + 1) / (1 - (1 / 5) ^ 4)}

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
16 * arctan (1 / 5) - 4 * arctan (1 / 239) - pi_approx n \<in> {- 4 * ((1 / 239) ^ (2 * n + 1) / (1 - (1 / 239) ^ 4))..16 * (1 / 5) ^ (6 * n + 1) / (1 - (1 / 5) ^ 4)}

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
have "-4*((1/239::real)^(2*n+1) / (1-(1/239)^4)) = -((13651919 / 815702160) / 57121^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 4 * ((1 / 239) ^ (2 * n + 1) / (1 - (1 / 239) ^ 4)) = - (13651919 / 815702160 / 57121 ^ n)
[PROOF STEP]
by (simp add: power_mult power2_eq_square) (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
- 4 * ((1 / 239) ^ (2 * n + 1) / (1 - (1 / 239) ^ 4)) = - (13651919 / 815702160 / 57121 ^ n)

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- 4 * ((1 / 239) ^ (2 * n + 1) / (1 - (1 / 239) ^ 4)) = - (13651919 / 815702160 / 57121 ^ n)

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
have "16*(1/5)^(6*n+1) / (1-(1/5::real)^4) = (125/39) / 15625^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 16 * (1 / 5) ^ (6 * n + 1) / (1 - (1 / 5) ^ 4) = 125 / 39 / 15625 ^ n
[PROOF STEP]
by (simp add: power_mult power2_eq_square) (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
16 * (1 / 5) ^ (6 * n + 1) / (1 - (1 / 5) ^ 4) = 125 / 39 / 15625 ^ n

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
16 * (1 / 5) ^ (6 * n + 1) / (1 - (1 / 5) ^ 4) = 125 / 39 / 15625 ^ n

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
have "{-((13651919 / 815702160) / 57121^n) .. (125 / 39) / 15625^n} \<subseteq>
               {- (4 / 2^(13*n)) .. 4 / (2^(13*n)::real)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {- (13651919 / 815702160 / 57121 ^ n)..125 / 39 / 15625 ^ n} \<subseteq> {- (4 / 2 ^ (13 * n))..4 / 2 ^ (13 * n)}
[PROOF STEP]
by (subst atLeastatMost_subset_iff, intro disjI2 conjI le_imp_neg_le)
       (rule frac_le; simp add: power_mult power_mono)+
[PROOF STATE]
proof (state)
this:
{- (13651919 / 815702160 / 57121 ^ n)..125 / 39 / 15625 ^ n} \<subseteq> {- (4 / 2 ^ (13 * n))..4 / 2 ^ (13 * n)}

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
pi - pi_approx n \<in> {- (4 / 2 ^ (13 * n))..4 / 2 ^ (13 * n)}
[PROOF STEP]
have "abs (pi - pi_approx n) \<le> 4 / 2^(13*n)"
[PROOF STATE]
proof (prove)
using this:
pi - pi_approx n \<in> {- (4 / 2 ^ (13 * n))..4 / 2 ^ (13 * n)}

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> 4 / 2 ^ (13 * n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>pi - pi_approx n\<bar> \<le> 4 / 2 ^ (13 * n)

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>pi - pi_approx n\<bar> \<le> 4 / 2 ^ (13 * n)

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
from \<open>n > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "4 / 2^(13*n) = 1 / (2^(13*n - 2) :: real)"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. 4 / 2 ^ (13 * n) = 1 / 2 ^ (13 * n - 2)
[PROOF STEP]
by (cases n) (simp_all add: power_add)
[PROOF STATE]
proof (state)
this:
4 / 2 ^ (13 * n) = 1 / 2 ^ (13 * n - 2)

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>pi - pi_approx n\<bar> \<le> 1 / 2 ^ (13 * n - 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>pi - pi_approx n\<bar> \<le> 1 / 2 ^ (13 * n - 2)

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))
[PROOF STEP]
by (simp add: divide_inverse)
[PROOF STATE]
proof (state)
this:
\<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ (13 * n - 2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma aezfun_setspan_proj_sum_list :
  "aezfun_setspan_proj A (\<Sum>x\<leftarrow>xs. f x) = (\<Sum>x\<leftarrow>xs. aezfun_setspan_proj A (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aezfun_setspan_proj A (sum_list (map f xs)) = (\<Sum>x\<leftarrow>xs. aezfun_setspan_proj A (f x))
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. aezfun_setspan_proj A (sum_list (map f [])) = (\<Sum>x\<leftarrow>[]. aezfun_setspan_proj A (f x))
 2. \<And>a xs. aezfun_setspan_proj A (sum_list (map f xs)) = (\<Sum>x\<leftarrow>xs. aezfun_setspan_proj A (f x)) \<Longrightarrow> aezfun_setspan_proj A (sum_list (map f (a # xs))) = (\<Sum>x\<leftarrow>a # xs. aezfun_setspan_proj A (f x))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. aezfun_setspan_proj A (sum_list (map f [])) = (\<Sum>x\<leftarrow>[]. aezfun_setspan_proj A (f x))
 2. \<And>a xs. aezfun_setspan_proj A (sum_list (map f xs)) = (\<Sum>x\<leftarrow>xs. aezfun_setspan_proj A (f x)) \<Longrightarrow> aezfun_setspan_proj A (sum_list (map f (a # xs))) = (\<Sum>x\<leftarrow>a # xs. aezfun_setspan_proj A (f x))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aezfun_setspan_proj A (sum_list (map f [])) = (\<Sum>x\<leftarrow>[]. aezfun_setspan_proj A (f x))
[PROOF STEP]
using aezfun_setspan_proj_zero
[PROOF STATE]
proof (prove)
using this:
aezfun_setspan_proj ?A 0 = 0

goal (1 subgoal):
 1. aezfun_setspan_proj A (sum_list (map f [])) = (\<Sum>x\<leftarrow>[]. aezfun_setspan_proj A (f x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
aezfun_setspan_proj A (sum_list (map f [])) = (\<Sum>x\<leftarrow>[]. aezfun_setspan_proj A (f x))

goal (1 subgoal):
 1. \<And>a xs. aezfun_setspan_proj A (sum_list (map f xs)) = (\<Sum>x\<leftarrow>xs. aezfun_setspan_proj A (f x)) \<Longrightarrow> aezfun_setspan_proj A (sum_list (map f (a # xs))) = (\<Sum>x\<leftarrow>a # xs. aezfun_setspan_proj A (f x))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. aezfun_setspan_proj A (sum_list (map f xs)) = (\<Sum>x\<leftarrow>xs. aezfun_setspan_proj A (f x)) \<Longrightarrow> aezfun_setspan_proj A (sum_list (map f (a # xs))) = (\<Sum>x\<leftarrow>a # xs. aezfun_setspan_proj A (f x))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
aezfun_setspan_proj A (sum_list (map f xs)) = (\<Sum>x\<leftarrow>xs. aezfun_setspan_proj A (f x))

goal (1 subgoal):
 1. \<And>a xs. aezfun_setspan_proj A (sum_list (map f xs)) = (\<Sum>x\<leftarrow>xs. aezfun_setspan_proj A (f x)) \<Longrightarrow> aezfun_setspan_proj A (sum_list (map f (a # xs))) = (\<Sum>x\<leftarrow>a # xs. aezfun_setspan_proj A (f x))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
aezfun_setspan_proj A (sum_list (map f xs)) = (\<Sum>x\<leftarrow>xs. aezfun_setspan_proj A (f x))

goal (1 subgoal):
 1. aezfun_setspan_proj A (sum_list (map f (x # xs))) = (\<Sum>x\<leftarrow>x # xs. aezfun_setspan_proj A (f x))
[PROOF STEP]
using aezfun_setspan_proj_add[of A "f x"]
[PROOF STATE]
proof (prove)
using this:
aezfun_setspan_proj A (sum_list (map f xs)) = (\<Sum>x\<leftarrow>xs. aezfun_setspan_proj A (f x))
aezfun_setspan_proj A (f x + ?y) = aezfun_setspan_proj A (f x) + aezfun_setspan_proj A ?y

goal (1 subgoal):
 1. aezfun_setspan_proj A (sum_list (map f (x # xs))) = (\<Sum>x\<leftarrow>x # xs. aezfun_setspan_proj A (f x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
aezfun_setspan_proj A (sum_list (map f (x # xs))) = (\<Sum>x\<leftarrow>x # xs. aezfun_setspan_proj A (f x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nfoldli_map: "nfoldli (map f l) ctd g s = nfoldli l ctd (g o f) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfoldli (map f l) ctd g s = nfoldli l ctd (g \<circ> f) s
[PROOF STEP]
apply (induction l arbitrary: s)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>s. nfoldli (map f []) ctd g s = nfoldli [] ctd (g \<circ> f) s
 2. \<And>a l s. (\<And>s. nfoldli (map f l) ctd g s = nfoldli l ctd (g \<circ> f) s) \<Longrightarrow> nfoldli (map f (a # l)) ctd g s = nfoldli (a # l) ctd (g \<circ> f) s
[PROOF STEP]
by (auto simp: pw_eq_iff refine_pw_simps)


[STATEMENT]
lemma (in weak_upper_semilattice) weak_join_assoc_lemma:
  assumes L: "x \<in> carrier L"  "y \<in> carrier L"  "z \<in> carrier L"
  shows "x \<squnion> (y \<squnion> z) .= \<Squnion>{x, y, z}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> (y \<squnion> z) .= \<Squnion>{x, y, z}
[PROOF STEP]
proof (rule finite_sup_insertI)
  \<comment> \<open>The textbook argument in Jacobson I, p 457\<close>
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>l. is_lub L l {x, y, z} \<Longrightarrow> x \<squnion> (y \<squnion> z) .= l
 2. finite {y, z}
 3. x \<in> carrier L
 4. {y, z} \<subseteq> carrier L
[PROOF STEP]
fix s
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>l. is_lub L l {x, y, z} \<Longrightarrow> x \<squnion> (y \<squnion> z) .= l
 2. finite {y, z}
 3. x \<in> carrier L
 4. {y, z} \<subseteq> carrier L
[PROOF STEP]
assume sup: "least L s (Upper L {x, y, z})"
[PROOF STATE]
proof (state)
this:
is_lub L s {x, y, z}

goal (4 subgoals):
 1. \<And>l. is_lub L l {x, y, z} \<Longrightarrow> x \<squnion> (y \<squnion> z) .= l
 2. finite {y, z}
 3. x \<in> carrier L
 4. {y, z} \<subseteq> carrier L
[PROOF STEP]
show "x \<squnion> (y \<squnion> z) .= s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> (y \<squnion> z) .= s
[PROOF STEP]
proof (rule weak_le_antisym)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. x \<squnion> (y \<squnion> z) \<sqsubseteq> s
 2. s \<sqsubseteq> x \<squnion> (y \<squnion> z)
 3. x \<squnion> (y \<squnion> z) \<in> carrier L
 4. s \<in> carrier L
[PROOF STEP]
from sup L
[PROOF STATE]
proof (chain)
picking this:
is_lub L s {x, y, z}
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L
[PROOF STEP]
show "x \<squnion> (y \<squnion> z) \<sqsubseteq> s"
[PROOF STATE]
proof (prove)
using this:
is_lub L s {x, y, z}
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L

goal (1 subgoal):
 1. x \<squnion> (y \<squnion> z) \<sqsubseteq> s
[PROOF STEP]
by (fastforce intro!: join_le elim: least_Upper_above)
[PROOF STATE]
proof (state)
this:
x \<squnion> (y \<squnion> z) \<sqsubseteq> s

goal (3 subgoals):
 1. s \<sqsubseteq> x \<squnion> (y \<squnion> z)
 2. x \<squnion> (y \<squnion> z) \<in> carrier L
 3. s \<in> carrier L
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. s \<sqsubseteq> x \<squnion> (y \<squnion> z)
 2. x \<squnion> (y \<squnion> z) \<in> carrier L
 3. s \<in> carrier L
[PROOF STEP]
from sup L
[PROOF STATE]
proof (chain)
picking this:
is_lub L s {x, y, z}
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L
[PROOF STEP]
show "s \<sqsubseteq> x \<squnion> (y \<squnion> z)"
[PROOF STATE]
proof (prove)
using this:
is_lub L s {x, y, z}
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L

goal (1 subgoal):
 1. s \<sqsubseteq> x \<squnion> (y \<squnion> z)
[PROOF STEP]
by (erule_tac least_le)
      (blast intro!: Upper_memI intro: le_trans join_left join_right join_closed)
[PROOF STATE]
proof (state)
this:
s \<sqsubseteq> x \<squnion> (y \<squnion> z)

goal (2 subgoals):
 1. x \<squnion> (y \<squnion> z) \<in> carrier L
 2. s \<in> carrier L
[PROOF STEP]
qed (simp_all add: L least_closed [OF sup])
[PROOF STATE]
proof (state)
this:
x \<squnion> (y \<squnion> z) .= s

goal (3 subgoals):
 1. finite {y, z}
 2. x \<in> carrier L
 3. {y, z} \<subseteq> carrier L
[PROOF STEP]
qed (simp_all add: L)


[STATEMENT]
lemma oLimit_Suc:
"f 0 < oLimit f \<Longrightarrow> oLimit (\<lambda>n. f (Suc n)) = oLimit f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 < oLimit f \<Longrightarrow> oLimit (\<lambda>n. f (Suc n)) = oLimit f
[PROOF STEP]
apply (rule oLimit_eqI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. f 0 < oLimit f \<Longrightarrow> \<exists>m. f (Suc n) \<le> f m
 2. \<And>n. f 0 < oLimit f \<Longrightarrow> \<exists>m. f n \<le> f (Suc m)
[PROOF STEP]
apply (rule exI, rule order_refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. f 0 < oLimit f \<Longrightarrow> \<exists>m. f n \<le> f (Suc m)
[PROOF STEP]
apply (case_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>f 0 < oLimit f; n = 0\<rbrakk> \<Longrightarrow> \<exists>m. f n \<le> f (Suc m)
 2. \<And>n nat. \<lbrakk>f 0 < oLimit f; n = Suc nat\<rbrakk> \<Longrightarrow> \<exists>m. f n \<le> f (Suc m)
[PROOF STEP]
apply (drule less_oLimitD, clarify, rename_tac m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n m. f 0 < f m \<Longrightarrow> \<exists>m. f 0 \<le> f (Suc m)
 2. \<And>n nat. \<lbrakk>f 0 < oLimit f; n = Suc nat\<rbrakk> \<Longrightarrow> \<exists>m. f n \<le> f (Suc m)
[PROOF STEP]
apply (case_tac m, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n m nat. \<lbrakk>f 0 < f m; m = Suc nat\<rbrakk> \<Longrightarrow> \<exists>m. f 0 \<le> f (Suc m)
 2. \<And>n nat. \<lbrakk>f 0 < oLimit f; n = Suc nat\<rbrakk> \<Longrightarrow> \<exists>m. f n \<le> f (Suc m)
[PROOF STEP]
apply (rule_tac x=nat in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n m nat. \<lbrakk>f 0 < f m; m = Suc nat\<rbrakk> \<Longrightarrow> f 0 \<le> f (Suc nat)
 2. \<And>n nat. \<lbrakk>f 0 < oLimit f; n = Suc nat\<rbrakk> \<Longrightarrow> \<exists>m. f n \<le> f (Suc m)
[PROOF STEP]
apply (simp add: order_less_imp_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n nat. \<lbrakk>f 0 < oLimit f; n = Suc nat\<rbrakk> \<Longrightarrow> \<exists>m. f n \<le> f (Suc m)
[PROOF STEP]
apply (rule_tac x=nat in exI, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lead_coeff_poly_x_minus_y:
  fixes p :: "'a::idom poly"
  shows "lead_coeff (poly_x_minus_y p) = [:lead_coeff p * ((- 1) ^ degree p):]" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (poly_x_minus_y p) = [:lead_coeff p * (- (1::'a)) ^ degree p:]
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lead_coeff (poly_x_minus_y p) = [:lead_coeff p * (- (1::'a)) ^ degree p:]
[PROOF STEP]
have "?l = Polynomial.smult (lead_coeff p) ((- 1) ^ degree p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (poly_x_minus_y p) = Polynomial.smult (lead_coeff p) ((- 1) ^ degree p)
[PROOF STEP]
by (unfold poly_x_minus_y_def, subst lead_coeff_comp; simp add: x_y_def)
[PROOF STATE]
proof (state)
this:
lead_coeff (poly_x_minus_y p) = Polynomial.smult (lead_coeff p) ((- 1) ^ degree p)

goal (1 subgoal):
 1. lead_coeff (poly_x_minus_y p) = [:lead_coeff p * (- (1::'a)) ^ degree p:]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lead_coeff (poly_x_minus_y p) = Polynomial.smult (lead_coeff p) ((- 1) ^ degree p)

goal (1 subgoal):
 1. lead_coeff (poly_x_minus_y p) = [:lead_coeff p * (- (1::'a)) ^ degree p:]
[PROOF STEP]
have "... = ?r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult (lead_coeff p) ((- 1) ^ degree p) = [:lead_coeff p * (- (1::'a)) ^ degree p:]
[PROOF STEP]
by (unfold hom_distribs, simp add: smult_as_map_poly[symmetric])
[PROOF STATE]
proof (state)
this:
Polynomial.smult (lead_coeff p) ((- 1) ^ degree p) = [:lead_coeff p * (- (1::'a)) ^ degree p:]

goal (1 subgoal):
 1. lead_coeff (poly_x_minus_y p) = [:lead_coeff p * (- (1::'a)) ^ degree p:]
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lead_coeff (poly_x_minus_y p) = [:lead_coeff p * (- (1::'a)) ^ degree p:]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lead_coeff (poly_x_minus_y p) = [:lead_coeff p * (- (1::'a)) ^ degree p:]

goal (1 subgoal):
 1. lead_coeff (poly_x_minus_y p) = [:lead_coeff p * (- (1::'a)) ^ degree p:]
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
lead_coeff (poly_x_minus_y p) = [:lead_coeff p * (- (1::'a)) ^ degree p:]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cdf_unique:
  "real_distribution M1 \<Longrightarrow> real_distribution M2 \<Longrightarrow> cdf M1 = cdf M2 \<Longrightarrow> M1 = M2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>real_distribution M1; real_distribution M2; cdf M1 = cdf M2\<rbrakk> \<Longrightarrow> M1 = M2
[PROOF STEP]
using cdf_unique'[of M1 M2]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite_borel_measure M1; finite_borel_measure M2; cdf M1 = cdf M2\<rbrakk> \<Longrightarrow> M1 = M2

goal (1 subgoal):
 1. \<lbrakk>real_distribution M1; real_distribution M2; cdf M1 = cdf M2\<rbrakk> \<Longrightarrow> M1 = M2
[PROOF STEP]
by (simp add: real_distribution.finite_borel_measure_M)


[STATEMENT]
lemma tendsto_of_int_iff:
  "filterlim (\<lambda>n. of_int (f n)) (nhds (of_int c :: 'a :: real_normed_div_algebra)) F \<longleftrightarrow>
     eventually (\<lambda>n. f n = c) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F = (\<forall>\<^sub>F n in F. f n = c)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F \<Longrightarrow> \<forall>\<^sub>F n in F. f n = c
 2. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F
[PROOF STEP]
assume "((\<lambda>n. of_int (f n)) \<longlongrightarrow> (of_int c :: 'a)) F"
[PROOF STATE]
proof (state)
this:
((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F

goal (2 subgoals):
 1. ((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F \<Longrightarrow> \<forall>\<^sub>F n in F. f n = c
 2. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F
[PROOF STEP]
hence "eventually (\<lambda>n. \<bar>real_of_int (f n) - of_int c\<bar> < 1/2) F"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. \<bar>real_of_int (f n) - real_of_int c\<bar> < 1 / 2
[PROOF STEP]
by (force simp: tendsto_iff dist_of_int dest: spec[of _ "1/2"])
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in F. \<bar>real_of_int (f n) - real_of_int c\<bar> < 1 / 2

goal (2 subgoals):
 1. ((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F \<Longrightarrow> \<forall>\<^sub>F n in F. f n = c
 2. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F
[PROOF STEP]
thus "eventually (\<lambda>n. f n = c) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in F. \<bar>real_of_int (f n) - real_of_int c\<bar> < 1 / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. f n = c
[PROOF STEP]
by eventually_elim (simp add: abs_if split: if_splits)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in F. f n = c

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F
[PROOF STEP]
assume "eventually (\<lambda>n. f n = c) F"
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in F. f n = c

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F
[PROOF STEP]
hence "eventually (\<lambda>n. of_int (f n) = (of_int c :: 'a)) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in F. f n = c

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. of_int (f n) = of_int c
[PROOF STEP]
by eventually_elim simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in F. of_int (f n) = of_int c

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. f n = c \<Longrightarrow> ((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F
[PROOF STEP]
thus "filterlim (\<lambda>n. of_int (f n)) (nhds (of_int c :: 'a)) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in F. of_int (f n) = of_int c

goal (1 subgoal):
 1. ((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F
[PROOF STEP]
by (rule tendsto_eventually)
[PROOF STATE]
proof (state)
this:
((\<lambda>n. of_int (f n)) \<longlongrightarrow> of_int c) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_prod_list: "poly (prod_list ps) x = prod_list (map (\<lambda> p. poly p x) ps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (prod_list ps) x = (\<Prod>p\<leftarrow>ps. poly p x)
[PROOF STEP]
by (induct ps, auto)


[STATEMENT]
lemma LIMSEQ_powrat_inverse_of_nat:
   "a > 0 \<Longrightarrow> (\<lambda>n. a pow\<^sub>\<rat> (inverse (of_nat n))) \<longlonglongrightarrow> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a \<Longrightarrow> (\<lambda>n. a pow\<^sub>\<rat> inverse (rat_of_nat n)) \<longlonglongrightarrow> 1
[PROOF STEP]
by (metis LIMSEQ_powrat_inverse_of_nat_ge_one
       LIMSEQ_powrat_inverse_of_nat_pos_less_one leI)


[STATEMENT]
lemma euclid:
  "PRE (\<lambda>s::nat store. s ''x'' = x \<and> s ''y'' = y)
   (WHILE (\<lambda>s. s ''y'' \<noteq> 0) INV (\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y)
    DO
     (''z'' ::= (\<lambda>s. s ''y''));
     (''y'' ::= (\<lambda>s. s ''x'' mod s ''y''));
     (''x'' ::= (\<lambda>s. s ''z''))
    OD)
   POST (\<lambda>s. s ''x'' = gcd x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_kat.H \<lceil>\<lambda>s. s ''x'' = x \<and> s ''y'' = y\<rceil> (rel_kat.while_inv \<lceil>\<lambda>s. s ''y'' \<noteq> 0\<rceil> \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y\<rceil> ((''z'' ::= (\<lambda>s. s ''y'')) ; (''y'' ::= (\<lambda>s. s ''x'' mod s ''y'')) ; (''x'' ::= (\<lambda>s. s ''z'')))) \<lceil>\<lambda>s. s ''x'' = gcd x y\<rceil>
[PROOF STEP]
apply (rule rel_kat.H_while_inv, simp_all, clarsimp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_kat.H \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y \<and> 0 < s ''y''\<rceil> ((''z'' ::= (\<lambda>s. s ''y'')) ; (''y'' ::= (\<lambda>s. s ''x'' mod s ''y'')) ; (''x'' ::= (\<lambda>s. s ''z''))) \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y\<rceil>
[PROOF STEP]
apply (intro rel_kat.H_seq)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. rel_kat.H ?r9 (''x'' ::= (\<lambda>s. s ''z'')) \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y\<rceil>
 2. rel_kat.H ?r10 (''y'' ::= (\<lambda>s. s ''x'' mod s ''y'')) ?r9
 3. rel_kat.H \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y \<and> 0 < s ''y''\<rceil> (''z'' ::= (\<lambda>s. s ''y'')) ?r10
[PROOF STEP]
apply (subst H_assign, simp)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_kat.H \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y \<and> 0 < s ''y''\<rceil> (''z'' ::= (\<lambda>s. s ''y'')) \<lceil>\<lambda>s. gcd ((s(''y'' := s ''x'' mod s ''y'', ''x'' := (s(''y'' := s ''x'' mod s ''y'')) ''z'')) ''x'') ((s(''y'' := s ''x'' mod s ''y'', ''x'' := (s(''y'' := s ''x'' mod s ''y'')) ''z'')) ''y'') = gcd x y\<rceil>
[PROOF STEP]
apply (rule H_assign_var)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>s. gcd (s ''x'') (s ''y'') = gcd x y \<and> 0 < s ''y'' \<longrightarrow> gcd ((s(''z'' := s ''y'', ''y'' := (s(''z'' := s ''y'')) ''x'' mod (s(''z'' := s ''y'')) ''y'', ''x'' := (s(''z'' := s ''y'', ''y'' := (s(''z'' := s ''y'')) ''x'' mod (s(''z'' := s ''y'')) ''y'')) ''z'')) ''x'') ((s(''z'' := s ''y'', ''y'' := (s(''z'' := s ''y'')) ''x'' mod (s(''z'' := s ''y'')) ''y'', ''x'' := (s(''z'' := s ''y'', ''y'' := (s(''z'' := s ''y'')) ''x'' mod (s(''z'' := s ''y'')) ''y'')) ''z'')) ''y'') = gcd x y
[PROOF STEP]
using gcd_red_nat
[PROOF STATE]
proof (prove)
using this:
gcd ?x ?y = gcd ?y (?x mod ?y)

goal (1 subgoal):
 1. \<forall>s. gcd (s ''x'') (s ''y'') = gcd x y \<and> 0 < s ''y'' \<longrightarrow> gcd ((s(''z'' := s ''y'', ''y'' := (s(''z'' := s ''y'')) ''x'' mod (s(''z'' := s ''y'')) ''y'', ''x'' := (s(''z'' := s ''y'', ''y'' := (s(''z'' := s ''y'')) ''x'' mod (s(''z'' := s ''y'')) ''y'')) ''z'')) ''x'') ((s(''z'' := s ''y'', ''y'' := (s(''z'' := s ''y'')) ''x'' mod (s(''z'' := s ''y'')) ''y'', ''x'' := (s(''z'' := s ''y'', ''y'' := (s(''z'' := s ''y'')) ''x'' mod (s(''z'' := s ''y'')) ''y'')) ''z'')) ''y'') = gcd x y
[PROOF STEP]
by auto


[STATEMENT]
lemma mult_left_strict_mono: "0 < n \<Longrightarrow> strict_mono (\<lambda>x. n * (x::nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> strict_mono ((*) n)
[PROOF STEP]
by (unfold strict_mono_def, clarify, simp)


[STATEMENT]
lemma ix_lt: "p \<in> sparsegrid dm lm \<Longrightarrow> d < dm \<Longrightarrow> ix p d < 2^(lv p d + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> sparsegrid dm lm; d < dm\<rbrakk> \<Longrightarrow> ix p d < 2 ^ (lv p d + 1)
[PROOF STEP]
unfolding sparsegrid_def lgrid_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> {p \<in> grid (start dm) {0..<dm}. level p < lm}; d < dm\<rbrakk> \<Longrightarrow> ix p d < 2 ^ (lv p d + 1)
[PROOF STEP]
using grid_estimate[of d "start dm" p "{0 ..< dm}"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>d < length (start dm); p \<in> grid (start dm) {0..<dm}\<rbrakk> \<Longrightarrow> ix p d < (ix (start dm) d + 1) * 2 ^ (lv p d - lv (start dm) d) \<and> (ix (start dm) d - 1) * 2 ^ (lv p d - lv (start dm) d) < ix p d

goal (1 subgoal):
 1. \<lbrakk>p \<in> {p \<in> grid (start dm) {0..<dm}. level p < lm}; d < dm\<rbrakk> \<Longrightarrow> ix p d < 2 ^ (lv p d + 1)
[PROOF STEP]
by auto


[STATEMENT]
lemma fct_gen_subalgebra_space:
  shows "space (fct_gen_subalgebra M N X) = space M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (fct_gen_subalgebra M N X) = space M
[PROOF STEP]
unfolding fct_gen_subalgebra_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (gen_subalgebra M (sigma_sets (space M) {X -` B \<inter> space M |B. B \<in> sets N})) = space M
[PROOF STEP]
by (simp add: gen_subalgebra_space)


[STATEMENT]
lemma short_ch_card_2:
  assumes "ch_by_ord f X"
  shows "short_ch X \<longleftrightarrow> card X = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. short_ch X = (card X = 2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
[f\<leadsto>X]

goal (1 subgoal):
 1. short_ch X = (card X = 2)
[PROOF STEP]
unfolding chain_defs
[PROOF STATE]
proof (prove)
using this:
X = {f 0, f 1} \<and> (\<exists>Q. path Q (f 0) (f 1)) \<or> (infinite X \<or> 3 \<le> card X) \<and> local_ordering f betw X

goal (1 subgoal):
 1. (card X = 2 \<and> (\<exists>P\<in>\<P>. X \<subseteq> P)) = (card X = 2)
[PROOF STEP]
using card_2_iff' card_gt_0_iff
[PROOF STATE]
proof (prove)
using this:
X = {f 0, f 1} \<and> (\<exists>Q. path Q (f 0) (f 1)) \<or> (infinite X \<or> 3 \<le> card X) \<and> local_ordering f betw X
(card ?S = 2) = (\<exists>x\<in>?S. \<exists>y\<in>?S. x \<noteq> y \<and> (\<forall>z\<in>?S. z = x \<or> z = y))
(0 < card ?A) = (?A \<noteq> {} \<and> finite ?A)

goal (1 subgoal):
 1. (card X = 2 \<and> (\<exists>P\<in>\<P>. X \<subseteq> P)) = (card X = 2)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma int_sum_of_fourth_powers:
  "30 * int (\<Sum>i=0..<m. i * i * i * i) =
    int m * (int m - 1) * (int(2 * m) - 1) *
    (int(3 * m * m) - int(3 * m) - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 30 * int (\<Sum>i = 0..<m. i * i * i * i) = int m * (int m - 1) * (int (2 * m) - 1) * (int (3 * m * m) - int (3 * m) - 1)
[PROOF STEP]
by (induct m) simp_all


[STATEMENT]
lemma float_down_correct: "real_of_float f - real_of_float (float_down e f) \<in> {0..2 powr -e}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_float f - real_of_float (float_down e f) \<in> {0..2 powr - real_of_int e}
[PROOF STEP]
by transfer (rule round_down_correct)


[STATEMENT]
lemma twice_field_differentiable_at_sqrt [simp, intro]:
  assumes "x > 0"
    shows "sqrt twice_field_differentiable_at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt twice_field_differentiable_at x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sqrt twice_field_differentiable_at x
[PROOF STEP]
have "sqrt field_differentiable_on {0<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt field_differentiable_on {0<..}
[PROOF STEP]
by (metis DERIV_real_sqrt at_within_open field_differentiable_def field_differentiable_on_def
        greaterThan_iff open_greaterThan)
[PROOF STATE]
proof (state)
this:
sqrt field_differentiable_on {0<..}

goal (1 subgoal):
 1. sqrt twice_field_differentiable_at x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sqrt field_differentiable_on {0<..}

goal (1 subgoal):
 1. sqrt twice_field_differentiable_at x
[PROOF STEP]
have "x \<in> interior {0<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> interior {0<..}
[PROOF STEP]
by (metis assms greaterThan_iff interior_interior interior_real_atLeast)
[PROOF STATE]
proof (state)
this:
x \<in> interior {0<..}

goal (1 subgoal):
 1. sqrt twice_field_differentiable_at x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> interior {0<..}

goal (1 subgoal):
 1. sqrt twice_field_differentiable_at x
[PROOF STEP]
have "deriv sqrt field_differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv sqrt field_differentiable at x
[PROOF STEP]
using assms field_differentiable_def has_real_derivative_deriv_sqrt
[PROOF STATE]
proof (prove)
using this:
0 < x
?f field_differentiable ?F \<equiv> \<exists>f'. (?f has_field_derivative f') ?F
0 < ?x \<Longrightarrow> (deriv sqrt has_real_derivative - inverse (sqrt ?x ^ 3) / 4) (at ?x)

goal (1 subgoal):
 1. deriv sqrt field_differentiable at x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
deriv sqrt field_differentiable at x

goal (1 subgoal):
 1. sqrt twice_field_differentiable_at x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sqrt field_differentiable_on {0<..}
x \<in> interior {0<..}
deriv sqrt field_differentiable at x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sqrt field_differentiable_on {0<..}
x \<in> interior {0<..}
deriv sqrt field_differentiable at x

goal (1 subgoal):
 1. sqrt twice_field_differentiable_at x
[PROOF STEP]
using twice_field_differentiable_at_def
[PROOF STATE]
proof (prove)
using this:
sqrt field_differentiable_on {0<..}
x \<in> interior {0<..}
deriv sqrt field_differentiable at x
?f twice_field_differentiable_at ?x \<equiv> \<exists>S. ?f field_differentiable_on S \<and> ?x \<in> interior S \<and> deriv ?f field_differentiable at ?x

goal (1 subgoal):
 1. sqrt twice_field_differentiable_at x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sqrt twice_field_differentiable_at x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_one_prod':
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::topological_comm_monoid_mult"
  assumes "\<And>i. i \<in> I \<Longrightarrow> ((\<lambda>x. f x i) \<longlongrightarrow> 1) F"
  shows "((\<lambda>i. prod (f i) I) \<longlongrightarrow> 1) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>i. prod (f i) I) \<longlongrightarrow> (1::'c)) F
[PROOF STEP]
using tendsto_prod' [of I "\<lambda>x y. f y x" "\<lambda>x. 1"] assms
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i \<in> I \<Longrightarrow> ((\<lambda>y. f y i) \<longlongrightarrow> (1::'c)) ?F) \<Longrightarrow> ((\<lambda>x. prod (f x) I) \<longlongrightarrow> (\<Prod>i\<in>I. (1::'c))) ?F
?i \<in> I \<Longrightarrow> ((\<lambda>x. f x ?i) \<longlongrightarrow> (1::'c)) F

goal (1 subgoal):
 1. ((\<lambda>i. prod (f i) I) \<longlongrightarrow> (1::'c)) F
[PROOF STEP]
by simp


[STATEMENT]
lemma ivl_integral_has_vderiv_on:
  fixes f :: "real \<Rightarrow> 'a::banach"
  assumes "continuous_on (closed_segment a b) f"
  shows "((\<lambda>u. ivl_integral a u f) has_vderiv_on f) (closed_segment a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>u. ivl_integral a u f) has_vderiv_on f) (closed_segment a b)
[PROOF STEP]
using ivl_integral_has_vector_derivative[OF assms]
[PROOF STATE]
proof (prove)
using this:
?x \<in> closed_segment a b \<Longrightarrow> ((\<lambda>u. ivl_integral a u f) has_vector_derivative f ?x) (at ?x within closed_segment a b)

goal (1 subgoal):
 1. ((\<lambda>u. ivl_integral a u f) has_vderiv_on f) (closed_segment a b)
[PROOF STEP]
by (auto simp: has_vderiv_on_def)


[STATEMENT]
lemma (in monoid) order_gt_0_iff_finite: "0 < order G \<longleftrightarrow> finite (carrier G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < order G) = finite (carrier G)
[PROOF STEP]
by(auto simp add: order_def card_gt_0_iff)


[STATEMENT]
lemma map_filter_snd_map_filter: "List.map_filter (\<lambda>(a, b). if P b then None else Some (f a b)) xs =
    map (\<lambda>(a, b). f a b) (filter (\<lambda>x. \<not> P (snd x)) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List.map_filter (\<lambda>(a, b). if P b then None else Some (f a b)) xs = map (\<lambda>(a, b). f a b) (filter (\<lambda>x. \<not> P (snd x)) xs)
[PROOF STEP]
by (simp add: map_filter_def prod.case_eq_if)


[STATEMENT]
lemma distinct_alt: "(\<forall>x\<in># mset xs. count (mset xs) x = 1) \<longleftrightarrow> distinct xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>#mset xs. count (mset xs) x = 1) = distinct xs
[PROOF STEP]
by(induction xs) auto


[STATEMENT]
lemma (in finite_group) finite_ord_conv_Least:
  assumes "x \<in> carrier G"
  shows "ord x = (LEAST n::nat. 0 < n \<and> x [^] n = \<one>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord x = (LEAST n. 0 < n \<and> x [^] n = \<one>)
[PROOF STEP]
using pow_order_eq_1 order_gt_0_iff_finite ord_conv_Least assms
[PROOF STATE]
proof (prove)
using this:
?a \<in> carrier G \<Longrightarrow> ?a [^] order G = \<one>
(0 < order G) = finite (carrier G)
\<lbrakk>?x \<in> carrier G; \<exists>n>0. ?x [^] n = \<one>\<rbrakk> \<Longrightarrow> ord ?x = (LEAST n. 0 < n \<and> ?x [^] n = \<one>)
x \<in> carrier G

goal (1 subgoal):
 1. ord x = (LEAST n. 0 < n \<and> x [^] n = \<one>)
[PROOF STEP]
by auto


[STATEMENT]
lemma homeomorphic_maps_subtopologies:
   "\<lbrakk>homeomorphic_maps X Y f g;  f ` (topspace X \<inter> S) = topspace Y \<inter> T\<rbrakk>
        \<Longrightarrow> homeomorphic_maps (subtopology X S) (subtopology Y T) f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>homeomorphic_maps X Y f g; f ` (topspace X \<inter> S) = topspace Y \<inter> T\<rbrakk> \<Longrightarrow> homeomorphic_maps (subtopology X S) (subtopology Y T) f g
[PROOF STEP]
unfolding homeomorphic_maps_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_map X Y f \<and> continuous_map Y X g \<and> (\<forall>x\<in>topspace X. g (f x) = x) \<and> (\<forall>y\<in>topspace Y. f (g y) = y); f ` (topspace X \<inter> S) = topspace Y \<inter> T\<rbrakk> \<Longrightarrow> continuous_map (subtopology X S) (subtopology Y T) f \<and> continuous_map (subtopology Y T) (subtopology X S) g \<and> (\<forall>x\<in>topspace (subtopology X S). g (f x) = x) \<and> (\<forall>y\<in>topspace (subtopology Y T). f (g y) = y)
[PROOF STEP]
by (force simp: continuous_map_from_subtopology continuous_map_in_subtopology)


[STATEMENT]
lemma prime_field: "a < (order \<G>) \<Longrightarrow> a \<noteq> 0 \<Longrightarrow> coprime a (order \<G>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < order \<G>; a \<noteq> 0\<rbrakk> \<Longrightarrow> coprime a (order \<G>)
[PROOF STEP]
by (metis dvd_imp_le neq0_conv not_le prime_imp_coprime prime_order coprime_commute)


[STATEMENT]
lemma tendsto_top_iff_ennreal:
  fixes f :: "'a \<Rightarrow> ennreal"
  shows "(f \<longlongrightarrow> top) F \<longleftrightarrow> (\<forall>l\<ge>0. eventually (\<lambda>x. ennreal l < f x) F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> top) F = (\<forall>l\<ge>0. \<forall>\<^sub>F x in F. ennreal l < f x)
[PROOF STEP]
by (auto simp: less_top_ennreal order_tendsto_iff )


[STATEMENT]
lemma list_all_take: "list_all P (take n s) = (\<forall> i. i < n \<and> i < length s \<longrightarrow> P (s ! i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all P (take n s) = (\<forall>i. i < n \<and> i < length s \<longrightarrow> P (s ! i))
[PROOF STEP]
by (auto simp add: set_take list_all_iff)


[STATEMENT]
lemma box_def: "box a b = {x. \<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i}"
  and in_box_eucl_less: "x \<in> box a b \<longleftrightarrow> a <e x \<and> x <e b"
  and mem_box: "x \<in> box a b \<longleftrightarrow> (\<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i)"
    "x \<in> cbox a b \<longleftrightarrow> (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. box a b = {x. \<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i} &&& (x \<in> box a b) = (a <e x \<and> x <e b) &&& (x \<in> box a b) = (\<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i) &&& (x \<in> cbox a b) = (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i)
[PROOF STEP]
by (auto simp: box_eucl_less eucl_less_def cbox_def)


[STATEMENT]
lemma token_run_P:
  assumes "\<not> P (token_run x n)"
  assumes "P (token_run x (Suc (n + m)))"
  shows "\<exists>m' \<le> m. \<not> P (token_run x (n + m')) \<and> P (token_run x (Suc (n + m')))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m'\<le>m. \<not> P (token_run x (n + m')) \<and> P (token_run x (Suc (n + m')))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> P (token_run x n)
P (token_run x (Suc (n + m)))

goal (1 subgoal):
 1. \<exists>m'\<le>m. \<not> P (token_run x (n + m')) \<and> P (token_run x (Suc (n + m')))
[PROOF STEP]
by (induction m) (simp_all, metis add_Suc_right le_Suc_eq)


[STATEMENT]
theorem general_qe :
  (* finite sets of atoms involving = < \<le> and \<noteq>*)
  assumes "R = {(=), (<), (\<le>), (\<noteq>)}"
  assumes "\<forall>rel\<in>R. finite (Atoms rel)"
    (* Direct substitution F(x) *)
  assumes "F = (\<lambda>x. \<forall>rel\<in>R. \<forall>(a,b,c)\<in>(Atoms rel). rel (a*x\<^sup>2+b*x+c) 0)"
    (* Substitution of r+\<epsilon> into F *)
  assumes "F\<epsilon> = (\<lambda>r. \<forall>rel\<in>R. \<forall>(a,b,c)\<in>(Atoms rel). \<exists>y>r.\<forall>x\<in>{r<..y}. rel (a*x\<^sup>2+b*x+c) 0)"
    (* Substitution of -\<infinity> into F *)
  assumes "F\<^sub>i\<^sub>n\<^sub>f = (\<forall>rel\<in>R. \<forall>(a,b,c)\<in>(Atoms rel). \<exists>x. \<forall>y<x. rel (a*y\<^sup>2+b*y+c) 0)"
    (* finds linear or quadratic roots of a polynomial *)
  assumes "roots = (\<lambda>(a,b,c).
     if a=0 \<and> b\<noteq>0 then {-c/b} else
     if a\<noteq>0 \<and> b\<^sup>2-4*a*c\<ge>0 then {(-b+sqrt(b\<^sup>2-4*a*c))/(2*a)}\<union>{(-b-sqrt(b\<^sup>2-4*a*c))/(2*a)} else {})"
    (* Quantifier Elimination *)
  shows "(\<exists>x. F(x)) =
            (F\<^sub>i\<^sub>n\<^sub>f \<or>
            (\<exists>r\<in>\<Union>(roots ` (Atoms (=) \<union> Atoms (\<le>))). F r) \<or>
            (\<exists>r\<in>\<Union>(roots ` (Atoms (<) \<union> Atoms (\<noteq>))). F\<epsilon> r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. F x) = (F\<^sub>i\<^sub>n\<^sub>f \<or> (\<exists>r\<in>\<Union> (roots ` (Atoms (=) \<union> Atoms (\<le>))). F r) \<or> (\<exists>r\<in>\<Union> (roots ` (Atoms (<) \<union> Atoms (\<noteq>))). F\<epsilon> r))
[PROOF STEP]
using general_qe''[OF assms(1) _ _ _ _ assms(3-6) refl refl refl refl]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (Atoms (=)); finite (Atoms (<)); finite (Atoms (\<le>)); finite (Atoms (\<noteq>))\<rbrakk> \<Longrightarrow> (\<exists>x. F x) = (F\<^sub>i\<^sub>n\<^sub>f \<or> (\<exists>r\<in>\<Union> (roots ` Atoms (=)). F r) \<or> (\<exists>r\<in>\<Union> (roots ` Atoms (<)). F\<epsilon> r) \<or> (\<exists>r\<in>\<Union> (roots ` Atoms (\<le>)). F r) \<or> (\<exists>r\<in>\<Union> (roots ` Atoms (\<noteq>)). F\<epsilon> r))

goal (1 subgoal):
 1. (\<exists>x. F x) = (F\<^sub>i\<^sub>n\<^sub>f \<or> (\<exists>r\<in>\<Union> (roots ` (Atoms (=) \<union> Atoms (\<le>))). F r) \<or> (\<exists>r\<in>\<Union> (roots ` (Atoms (<) \<union> Atoms (\<noteq>))). F\<epsilon> r))
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (Atoms (=)); finite (Atoms (<)); finite (Atoms (\<le>)); finite (Atoms (\<noteq>))\<rbrakk> \<Longrightarrow> (\<exists>x. F x) = (F\<^sub>i\<^sub>n\<^sub>f \<or> (\<exists>r\<in>\<Union> (roots ` Atoms (=)). F r) \<or> (\<exists>r\<in>\<Union> (roots ` Atoms (<)). F\<epsilon> r) \<or> (\<exists>r\<in>\<Union> (roots ` Atoms (\<le>)). F r) \<or> (\<exists>r\<in>\<Union> (roots ` Atoms (\<noteq>)). F\<epsilon> r))
\<forall>rel\<in>R. finite (Atoms rel)

goal (1 subgoal):
 1. (\<exists>x. F x) = (F\<^sub>i\<^sub>n\<^sub>f \<or> (\<exists>r\<in>\<Union> (roots ` (Atoms (=) \<union> Atoms (\<le>))). F r) \<or> (\<exists>r\<in>\<Union> (roots ` (Atoms (<) \<union> Atoms (\<noteq>))). F\<epsilon> r))
[PROOF STEP]
unfolding assms(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (Atoms (=)); finite (Atoms (<)); finite (Atoms (\<le>)); finite (Atoms (\<noteq>))\<rbrakk> \<Longrightarrow> (\<exists>x. F x) = (F\<^sub>i\<^sub>n\<^sub>f \<or> (\<exists>r\<in>\<Union> (roots ` Atoms (=)). F r) \<or> (\<exists>r\<in>\<Union> (roots ` Atoms (<)). F\<epsilon> r) \<or> (\<exists>r\<in>\<Union> (roots ` Atoms (\<le>)). F r) \<or> (\<exists>r\<in>\<Union> (roots ` Atoms (\<noteq>)). F\<epsilon> r))
\<forall>rel\<in>{(=), (<), (\<le>), (\<noteq>)}. finite (Atoms rel)

goal (1 subgoal):
 1. (\<exists>x. F x) = (F\<^sub>i\<^sub>n\<^sub>f \<or> (\<exists>r\<in>\<Union> (roots ` (Atoms (=) \<union> Atoms (\<le>))). F r) \<or> (\<exists>r\<in>\<Union> (roots ` (Atoms (<) \<union> Atoms (\<noteq>))). F\<epsilon> r))
[PROOF STEP]
by auto


[STATEMENT]
lemma rev_path_append[simp]: "rev_path (xs@ys) = (rev_path ys) @ (rev_path xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev_path (xs @ ys) = rev_path ys @ rev_path xs
[PROOF STEP]
unfolding rev_path_def rev_append
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>(a, b, c). (c, b, a)) (rev ys @ rev xs) = map (\<lambda>(a, b, c). (c, b, a)) (rev ys) @ map (\<lambda>(a, b, c). (c, b, a)) (rev xs)
[PROOF STEP]
by auto


[STATEMENT]
lemma numgcd0:
  assumes g0: "numgcd t = 0"
  shows "Inum bs t = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inum bs t = 0
[PROOF STEP]
using g0[simplified numgcd_def]
[PROOF STATE]
proof (prove)
using this:
numgcdh t (maxcoeff t) = 0

goal (1 subgoal):
 1. Inum bs t = 0
[PROOF STEP]
by (induct t rule: numgcdh.induct) (auto simp add: natabs0 maxcoeff_pos max.absorb2)


[STATEMENT]
lemma interior_of_closure_of:
   "X interior_of S = topspace X - X closure_of (topspace X - S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X interior_of S = topspace X - X closure_of (topspace X - S)
[PROOF STEP]
unfolding interior_of_complement [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X interior_of S = X interior_of (topspace X - (topspace X - S))
[PROOF STEP]
by (metis Diff_Diff_Int interior_of_restrict)


[STATEMENT]
lemma cake_times_correct:
  assumes "evaluate env s u = (s', Rval (Litv (IntLit y)))"
  assumes "evaluate env s' t = (s'', Rval (Litv (IntLit x)))"
  shows "evaluate env s (cake_times t u) = (s'', Rval (Litv (IntLit (x * y))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Evaluate_Single.evaluate env s (cake_times t u) = (s'', Rval (Litv (IntLit (x * y))))
[PROOF STEP]
unfolding cake_times_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Evaluate_Single.evaluate env s (App (Opn Times) [t, u]) = (s'', Rval (Litv (IntLit (x * y))))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Evaluate_Single.evaluate env s u = (s', Rval (Litv (IntLit y)))
Evaluate_Single.evaluate env s' t = (s'', Rval (Litv (IntLit x)))

goal (1 subgoal):
 1. Evaluate_Single.evaluate env s (App (Opn Times) [t, u]) = (s'', Rval (Litv (IntLit (x * y))))
[PROOF STEP]
by simp


[STATEMENT]
lemma prod_unfold_prod_mset:
  "prod f A = prod_mset (image_mset f (mset_set A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f A = prod_mset (image_mset f (mset_set A))
[PROOF STEP]
by (cases "finite A") (induct A rule: finite_induct, simp_all)


[STATEMENT]
lemma path_connected_interval [simp]:
  fixes a b::"'a::ordered_euclidean_space"
  shows "path_connected {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connected {a..b}
[PROOF STEP]
using is_interval_cc is_interval_path_connected
[PROOF STATE]
proof (prove)
using this:
is_interval {?b..?a}
is_interval ?S \<Longrightarrow> path_connected ?S

goal (1 subgoal):
 1. path_connected {a..b}
[PROOF STEP]
by blast


[STATEMENT]
lemma E_nonneg_fun: fixes f::"'a\<Rightarrow>real"
  shows "(\<forall>x\<in>set_pmf X. 0\<le>f x) \<Longrightarrow> 0 \<le> E (map_pmf f X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set_pmf X. 0 \<le> f x \<Longrightarrow> 0 \<le> E (map_pmf f X)
[PROOF STEP]
using E_nonneg
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set_pmf ?X. 0 \<le> x \<Longrightarrow> 0 \<le> E ?X

goal (1 subgoal):
 1. \<forall>x\<in>set_pmf X. 0 \<le> f x \<Longrightarrow> 0 \<le> E (map_pmf f X)
[PROOF STEP]
by auto


[STATEMENT]
lemma trancl_to_subtuple:
  "(subtuple r)\<^sup>+\<^sup>+ xm ym \<Longrightarrow>
   subtuple r\<^sup>+\<^sup>+ xm ym"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (subtuple r)\<^sup>+\<^sup>+ xm ym \<Longrightarrow> subtuple r\<^sup>+\<^sup>+ xm ym
[PROOF STEP]
apply (induct rule: tranclp_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y. subtuple r xm y \<Longrightarrow> subtuple r\<^sup>+\<^sup>+ xm y
 2. \<And>y z. \<lbrakk>(subtuple r)\<^sup>+\<^sup>+ xm y; subtuple r y z; subtuple r\<^sup>+\<^sup>+ xm y\<rbrakk> \<Longrightarrow> subtuple r\<^sup>+\<^sup>+ xm z
[PROOF STEP]
apply (metis subtuple_mono tranclp.r_into_trancl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y z. \<lbrakk>(subtuple r)\<^sup>+\<^sup>+ xm y; subtuple r y z; subtuple r\<^sup>+\<^sup>+ xm y\<rbrakk> \<Longrightarrow> subtuple r\<^sup>+\<^sup>+ xm z
[PROOF STEP]
by (rule fmrel_on_fset_trans; auto)


[STATEMENT]
lemma integral_component_eq_cart[simp]:
  fixes f :: "'n::euclidean_space \<Rightarrow> real^'m"
  assumes "f integrable_on s"
  shows "integral s (\<lambda>x. f x $ k) = integral s f $ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral s (\<lambda>x. f x $ k) = integral s f $ k
[PROOF STEP]
using integral_linear[OF assms(1) bounded_linear_vec_nth,unfolded o_def]
[PROOF STATE]
proof (prove)
using this:
integral s (\<lambda>x. f x $ ?i1) = integral s f $ ?i1

goal (1 subgoal):
 1. integral s (\<lambda>x. f x $ k) = integral s f $ k
[PROOF STEP]
.


[STATEMENT]
lemma map2_mult_scalar_plus:
  "map2 (\<odot>) (map2 (+) xs ys) zs = map2 (+) (map2 (\<odot>) xs zs) (map2 (\<odot>) ys zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map2 (\<odot>) (map2 (+) xs ys) zs = map2 (+) (map2 (\<odot>) xs zs) (map2 (\<odot>) ys zs)
[PROOF STEP]
by (rule nth_equalityI, simp_all add: mult_scalar_distrib_right)


[STATEMENT]
lemma Suc_card_if_fin: "fin_digraph G \<Longrightarrow> \<exists>n. Suc n = card (verts G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fin_digraph G \<Longrightarrow> \<exists>n. Suc n = card (verts G)
[PROOF STEP]
using root_in_G card_0_eq not0_implies_Suc[of "card (verts G)"] fin_digraph.finite_verts
[PROOF STATE]
proof (prove)
using this:
root \<in> verts G
finite ?A \<Longrightarrow> (card ?A = 0) = (?A = {})
card (verts G) \<noteq> 0 \<Longrightarrow> \<exists>m. card (verts G) = Suc m
fin_digraph ?G \<Longrightarrow> finite (verts ?G)

goal (1 subgoal):
 1. fin_digraph G \<Longrightarrow> \<exists>n. Suc n = card (verts G)
[PROOF STEP]
by force


[STATEMENT]
lemma in_lset_lappend_iff: "x \<in> lset (lappend xs ys) \<longleftrightarrow> x \<in> lset xs \<or> lfinite xs \<and> x \<in> lset ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> lset (lappend xs ys)) = (x \<in> lset xs \<or> lfinite xs \<and> x \<in> lset ys)
[PROOF STEP]
by(simp add: lset_lappend_conv)


[STATEMENT]
lemma homeomorphism_st_proj2: "homeomorphism (UNIV - {bot_sphere}) UNIV st_proj2 st_proj2_inv"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphism (UNIV - {bot_sphere}) UNIV st_proj2 st_proj2_inv
[PROOF STEP]
apply (auto simp: homeomorphism_def st_proj2_continuous st_proj2_inv_continuous st_proj2_inv_inv
      st_proj2_inv st_proj2_inv_ne_top)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> st_proj2 ` (UNIV - {bot_sphere})
 2. \<And>x. x \<notin> range st_proj2_inv \<Longrightarrow> x = bot_sphere
[PROOF STEP]
subgoal for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> st_proj2 ` (UNIV - {bot_sphere})
[PROOF STEP]
by (rule image_eqI[where x="st_proj2_inv x"]) (auto simp: st_proj2_inv_inv st_proj2_inv_ne_top)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<notin> range st_proj2_inv \<Longrightarrow> x = bot_sphere
[PROOF STEP]
by (metis rangeI st_proj2_inv)


[STATEMENT]
lemma face_of_Int_subface:
     "\<lbrakk>A \<inter> B face_of A; A \<inter> B face_of B; C face_of A; D face_of B\<rbrakk>
      \<Longrightarrow> (C \<inter> D) face_of C \<and> (C \<inter> D) face_of D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<inter> B face_of A; A \<inter> B face_of B; C face_of A; D face_of B\<rbrakk> \<Longrightarrow> C \<inter> D face_of C \<and> C \<inter> D face_of D
[PROOF STEP]
by (meson face_of_Int_Int face_of_face inf_le1 inf_le2)


[STATEMENT]
lemma eq_im_imp_diff_in_Ker : "\<lbrakk> g \<in> G; h \<in> G; T g = T h \<rbrakk> \<Longrightarrow> g - h \<in> Ker"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g \<in> G; h \<in> G; T g = T h\<rbrakk> \<Longrightarrow> g - h \<in> Ker
[PROOF STEP]
using im_diff kerI diff_closed[of g h]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?g \<in> G; ?g' \<in> G\<rbrakk> \<Longrightarrow> T (?g - ?g') = T ?g - T ?g'
?f ?a = (0::?'a) \<Longrightarrow> ?a \<in> ker ?f
\<lbrakk>g \<in> G; h \<in> G\<rbrakk> \<Longrightarrow> g - h \<in> G

goal (1 subgoal):
 1. \<lbrakk>g \<in> G; h \<in> G; T g = T h\<rbrakk> \<Longrightarrow> g - h \<in> Ker
[PROOF STEP]
by force


[STATEMENT]
lemma ereal_semiline_unique:
  fixes a b :: ereal
  shows "{y. a \<le> ereal y} = {y. b \<le> ereal y} \<longleftrightarrow> a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({y. a \<le> ereal y} = {y. b \<le> ereal y}) = (a = b)
[PROOF STEP]
by (metis mem_Collect_eq ereal_le_real order_antisym)


[STATEMENT]
lemma emax_eq: "emax x = 2 ^ LENGTH('e) - 1"
  for x::"('e, 'f)float itself"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emax x = 2 ^ LENGTH('e) - 1
[PROOF STEP]
by (simp add: emax_def unsigned_minus_1_eq_mask mask_eq_exp_minus_1)


[STATEMENT]
lemma fin_neighbourhood: "finite (neighborhood x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (neighborhood x)
[PROOF STEP]
unfolding neighborhood_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {v \<in> V. vert_adj x v}
[PROOF STEP]
using finV
[PROOF STATE]
proof (prove)
using this:
finite V

goal (1 subgoal):
 1. finite {v \<in> V. vert_adj x v}
[PROOF STEP]
by simp


[STATEMENT]
lemma mult_neg_neg: "a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> 0 < a * b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < (0::'a); b < (0::'a)\<rbrakk> \<Longrightarrow> (0::'a) < a * b
[PROOF STEP]
using mult_strict_right_mono_neg [of a 0 b]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a < (0::'a); b < (0::'a)\<rbrakk> \<Longrightarrow> (0::'a) * b < a * b

goal (1 subgoal):
 1. \<lbrakk>a < (0::'a); b < (0::'a)\<rbrakk> \<Longrightarrow> (0::'a) < a * b
[PROOF STEP]
by simp


[STATEMENT]
lemma of_int_mod_ring_lift_01_eq:
  assumes "zero_one_matrix N"
  shows "map_mat (of_int_mod_ring) N = (lift_01_mat) N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_mod_ring_hom_sr.mat_hom N = lift_01_mat N
[PROOF STEP]
apply (auto simp add: mat_eq_iff[of "map_mat (of_int_mod_ring) N" "lift_01_mat N"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row N; j < dim_col N\<rbrakk> \<Longrightarrow> of_int_mod_ring (N $$ (i, j)) = of_zero_neq_one (N $$ (i, j))
[PROOF STEP]
using assms zero_one_matrix.M_not_one_simp
[PROOF STATE]
proof (prove)
using this:
zero_one_matrix N
\<lbrakk>zero_one_matrix ?matrix; ?j < dim_col ?matrix; ?i < dim_row ?matrix; ?matrix $$ (?i, ?j) \<noteq> (1::?'b)\<rbrakk> \<Longrightarrow> ?matrix $$ (?i, ?j) = (0::?'b)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row N; j < dim_col N\<rbrakk> \<Longrightarrow> of_int_mod_ring (N $$ (i, j)) = of_zero_neq_one (N $$ (i, j))
[PROOF STEP]
by fastforce


[STATEMENT]
lemma (in edge_space) cylinder_empty_prob:
  "A \<subseteq> S_edges \<Longrightarrow> prob (cylinder S_edges A {}) = p ^ (card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> S_edges \<Longrightarrow> prob (cylinder S_edges A {}) = p ^ card A
[PROOF STEP]
using cylinder_prob
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<subseteq> S_edges; ?B \<subseteq> S_edges; ?A \<inter> ?B = {}\<rbrakk> \<Longrightarrow> prob (cylinder S_edges ?A ?B) = p ^ card ?A * (1 - p) ^ card ?B

goal (1 subgoal):
 1. A \<subseteq> S_edges \<Longrightarrow> prob (cylinder S_edges A {}) = p ^ card A
[PROOF STEP]
by auto


[STATEMENT]
lemma nth_elem_set_rank_inv:
  assumes "finite S"
  assumes "x \<in> S"
  shows "nth_elem S (set_rank S x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_elem S (set_rank S x) = x
[PROOF STEP]
using the_equality  set_rank_unique set_rank_exist assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?P ?a; \<And>x. ?P x \<Longrightarrow> x = ?a\<rbrakk> \<Longrightarrow> (THE x. ?P x) = ?a
\<lbrakk>finite ?S; ?x \<in> ?S; ?i < card ?S \<and> ?x = nth_elem ?S ?i; ?j < card ?S \<and> ?x = nth_elem ?S ?j\<rbrakk> \<Longrightarrow> ?i = ?j
\<lbrakk>finite ?S; ?x \<in> ?S\<rbrakk> \<Longrightarrow> \<exists>i<card ?S. ?x = nth_elem ?S i
finite S
x \<in> S

goal (1 subgoal):
 1. nth_elem S (set_rank S x) = x
[PROOF STEP]
unfolding set_rank_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?P ?a; \<And>x. ?P x \<Longrightarrow> x = ?a\<rbrakk> \<Longrightarrow> (THE x. ?P x) = ?a
\<lbrakk>finite ?S; ?x \<in> ?S; ?i < card ?S \<and> ?x = nth_elem ?S ?i; ?j < card ?S \<and> ?x = nth_elem ?S ?j\<rbrakk> \<Longrightarrow> ?i = ?j
\<lbrakk>finite ?S; ?x \<in> ?S\<rbrakk> \<Longrightarrow> \<exists>i<card ?S. ?x = nth_elem ?S i
finite S
x \<in> S

goal (1 subgoal):
 1. nth_elem S (THE i. i < card S \<and> x = nth_elem S i) = x
[PROOF STEP]
by smt


[STATEMENT]
lemma jump_Im_divide_Re_0:
  assumes "path g" "Re (g x)\<noteq>0" "0<x" "x<1"
  shows "jump (\<lambda>t. Im (g t) / Re (g t)) x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jump (\<lambda>t. Im (g t) / Re (g t)) x = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jump (\<lambda>t. Im (g t) / Re (g t)) x = 0
[PROOF STEP]
have "isCont g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont g x
[PROOF STEP]
using \<open>path g\<close>[unfolded path_def] \<open>0<x\<close> \<open>x<1\<close>
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} g
0 < x
x < 1

goal (1 subgoal):
 1. isCont g x
[PROOF STEP]
apply (elim continuous_on_interior)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; x < 1\<rbrakk> \<Longrightarrow> x \<in> interior {0..1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
isCont g x

goal (1 subgoal):
 1. jump (\<lambda>t. Im (g t) / Re (g t)) x = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
isCont g x
[PROOF STEP]
have "isCont (\<lambda>t. Im(g t)/Re(g t)) x"
[PROOF STATE]
proof (prove)
using this:
isCont g x

goal (1 subgoal):
 1. isCont (\<lambda>t. Im (g t) / Re (g t)) x
[PROOF STEP]
using \<open>Re (g x)\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
isCont g x
Re (g x) \<noteq> 0

goal (1 subgoal):
 1. isCont (\<lambda>t. Im (g t) / Re (g t)) x
[PROOF STEP]
by (auto intro:continuous_intros isCont_Re isCont_Im)
[PROOF STATE]
proof (state)
this:
isCont (\<lambda>t. Im (g t) / Re (g t)) x

goal (1 subgoal):
 1. jump (\<lambda>t. Im (g t) / Re (g t)) x = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
isCont (\<lambda>t. Im (g t) / Re (g t)) x
[PROOF STEP]
show "jump (\<lambda>t. Im(g t)/Re(g t)) x=0"
[PROOF STATE]
proof (prove)
using this:
isCont (\<lambda>t. Im (g t) / Re (g t)) x

goal (1 subgoal):
 1. jump (\<lambda>t. Im (g t) / Re (g t)) x = 0
[PROOF STEP]
using jump_not_infinity
[PROOF STATE]
proof (prove)
using this:
isCont (\<lambda>t. Im (g t) / Re (g t)) x
isCont ?f ?a \<Longrightarrow> jump ?f ?a = 0

goal (1 subgoal):
 1. jump (\<lambda>t. Im (g t) / Re (g t)) x = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jump (\<lambda>t. Im (g t) / Re (g t)) x = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem sqrt_prime_irrational:
  fixes p :: nat
  assumes "prime p"
  shows "sqrt p \<notin> \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (real p) \<notin> \<rat>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sqrt (real p) \<in> \<rat> \<Longrightarrow> False
[PROOF STEP]
from \<open>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
prime p
[PROOF STEP]
have p: "p > 1"
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. 1 < p
[PROOF STEP]
by (rule prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
1 < p

goal (1 subgoal):
 1. sqrt (real p) \<in> \<rat> \<Longrightarrow> False
[PROOF STEP]
assume "sqrt p \<in> \<rat>"
[PROOF STATE]
proof (state)
this:
sqrt (real p) \<in> \<rat>

goal (1 subgoal):
 1. sqrt (real p) \<in> \<rat> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sqrt (real p) \<in> \<rat>
[PROOF STEP]
obtain m n :: nat
    where n: "n \<noteq> 0"
      and sqrt_rat: "\<bar>sqrt p\<bar> = m / n"
      and "coprime m n"
[PROOF STATE]
proof (prove)
using this:
sqrt (real p) \<in> \<rat>

goal (1 subgoal):
 1. (\<And>n m. \<lbrakk>n \<noteq> 0; \<bar>sqrt (real p)\<bar> = real m / real n; coprime m n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule Rats_abs_nat_div_natE)
[PROOF STATE]
proof (state)
this:
n \<noteq> 0
\<bar>sqrt (real p)\<bar> = real m / real n
coprime m n

goal (1 subgoal):
 1. sqrt (real p) \<in> \<rat> \<Longrightarrow> False
[PROOF STEP]
have eq: "m\<^sup>2 = p * n\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m\<^sup>2 = p * n\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m\<^sup>2 = p * n\<^sup>2
[PROOF STEP]
from n and sqrt_rat
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
\<bar>sqrt (real p)\<bar> = real m / real n
[PROOF STEP]
have "m = \<bar>sqrt p\<bar> * n"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0
\<bar>sqrt (real p)\<bar> = real m / real n

goal (1 subgoal):
 1. real m = \<bar>sqrt (real p)\<bar> * real n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real m = \<bar>sqrt (real p)\<bar> * real n

goal (1 subgoal):
 1. m\<^sup>2 = p * n\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real m = \<bar>sqrt (real p)\<bar> * real n
[PROOF STEP]
have "m\<^sup>2 = (sqrt p)\<^sup>2 * n\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
real m = \<bar>sqrt (real p)\<bar> * real n

goal (1 subgoal):
 1. real (m\<^sup>2) = (sqrt (real p))\<^sup>2 * real (n\<^sup>2)
[PROOF STEP]
by (simp add: power_mult_distrib)
[PROOF STATE]
proof (state)
this:
real (m\<^sup>2) = (sqrt (real p))\<^sup>2 * real (n\<^sup>2)

goal (1 subgoal):
 1. m\<^sup>2 = p * n\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (m\<^sup>2) = (sqrt (real p))\<^sup>2 * real (n\<^sup>2)

goal (1 subgoal):
 1. m\<^sup>2 = p * n\<^sup>2
[PROOF STEP]
have "(sqrt p)\<^sup>2 = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sqrt (real p))\<^sup>2 = real p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(sqrt (real p))\<^sup>2 = real p

goal (1 subgoal):
 1. m\<^sup>2 = p * n\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(sqrt (real p))\<^sup>2 = real p

goal (1 subgoal):
 1. m\<^sup>2 = p * n\<^sup>2
[PROOF STEP]
have "\<dots> * n\<^sup>2 = p * n\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real p * real (n\<^sup>2) = real (p * n\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real p * real (n\<^sup>2) = real (p * n\<^sup>2)

goal (1 subgoal):
 1. m\<^sup>2 = p * n\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (m\<^sup>2) = real (p * n\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (m\<^sup>2) = real (p * n\<^sup>2)

goal (1 subgoal):
 1. m\<^sup>2 = p * n\<^sup>2
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
m\<^sup>2 = p * n\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
m\<^sup>2 = p * n\<^sup>2

goal (1 subgoal):
 1. sqrt (real p) \<in> \<rat> \<Longrightarrow> False
[PROOF STEP]
have "p dvd m \<and> p dvd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p dvd m \<and> p dvd n
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p dvd m
 2. p dvd n
[PROOF STEP]
from eq
[PROOF STATE]
proof (chain)
picking this:
m\<^sup>2 = p * n\<^sup>2
[PROOF STEP]
have "p dvd m\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
m\<^sup>2 = p * n\<^sup>2

goal (1 subgoal):
 1. p dvd m\<^sup>2
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
p dvd m\<^sup>2

goal (2 subgoals):
 1. p dvd m
 2. p dvd n
[PROOF STEP]
with \<open>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
prime p
p dvd m\<^sup>2
[PROOF STEP]
show "p dvd m"
[PROOF STATE]
proof (prove)
using this:
prime p
p dvd m\<^sup>2

goal (1 subgoal):
 1. p dvd m
[PROOF STEP]
by (rule prime_dvd_power)
[PROOF STATE]
proof (state)
this:
p dvd m

goal (1 subgoal):
 1. p dvd n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p dvd m
[PROOF STEP]
obtain k where "m = p * k"
[PROOF STATE]
proof (prove)
using this:
p dvd m

goal (1 subgoal):
 1. (\<And>k. m = p * k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
m = p * k

goal (1 subgoal):
 1. p dvd n
[PROOF STEP]
with eq
[PROOF STATE]
proof (chain)
picking this:
m\<^sup>2 = p * n\<^sup>2
m = p * k
[PROOF STEP]
have "p * n\<^sup>2 = p\<^sup>2 * k\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
m\<^sup>2 = p * n\<^sup>2
m = p * k

goal (1 subgoal):
 1. p * n\<^sup>2 = p\<^sup>2 * k\<^sup>2
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
p * n\<^sup>2 = p\<^sup>2 * k\<^sup>2

goal (1 subgoal):
 1. p dvd n
[PROOF STEP]
with p
[PROOF STATE]
proof (chain)
picking this:
1 < p
p * n\<^sup>2 = p\<^sup>2 * k\<^sup>2
[PROOF STEP]
have "n\<^sup>2 = p * k\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
1 < p
p * n\<^sup>2 = p\<^sup>2 * k\<^sup>2

goal (1 subgoal):
 1. n\<^sup>2 = p * k\<^sup>2
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
n\<^sup>2 = p * k\<^sup>2

goal (1 subgoal):
 1. p dvd n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n\<^sup>2 = p * k\<^sup>2
[PROOF STEP]
have "p dvd n\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
n\<^sup>2 = p * k\<^sup>2

goal (1 subgoal):
 1. p dvd n\<^sup>2
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
p dvd n\<^sup>2

goal (1 subgoal):
 1. p dvd n
[PROOF STEP]
with \<open>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
prime p
p dvd n\<^sup>2
[PROOF STEP]
show "p dvd n"
[PROOF STATE]
proof (prove)
using this:
prime p
p dvd n\<^sup>2

goal (1 subgoal):
 1. p dvd n
[PROOF STEP]
by (rule prime_dvd_power)
[PROOF STATE]
proof (state)
this:
p dvd n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p dvd m \<and> p dvd n

goal (1 subgoal):
 1. sqrt (real p) \<in> \<rat> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p dvd m \<and> p dvd n
[PROOF STEP]
have "p dvd gcd m n"
[PROOF STATE]
proof (prove)
using this:
p dvd m \<and> p dvd n

goal (1 subgoal):
 1. p dvd gcd m n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p dvd gcd m n

goal (1 subgoal):
 1. sqrt (real p) \<in> \<rat> \<Longrightarrow> False
[PROOF STEP]
with \<open>coprime m n\<close>
[PROOF STATE]
proof (chain)
picking this:
coprime m n
p dvd gcd m n
[PROOF STEP]
have "p = 1"
[PROOF STATE]
proof (prove)
using this:
coprime m n
p dvd gcd m n

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

goal (1 subgoal):
 1. sqrt (real p) \<in> \<rat> \<Longrightarrow> False
[PROOF STEP]
with p
[PROOF STATE]
proof (chain)
picking this:
1 < p
p = 1
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
1 < p
p = 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dtree_size_img_lt:
  assumes "\<forall>t \<in> fst ` fset xs. size (f t) \<le> size t"
      and "\<exists>t \<in> fst ` fset xs. size (f t) < size t"
    shows "size (Node r ((\<lambda>(t,e). (f t, e)) |`| xs)) < size (Node r xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (Node r ((\<lambda>(t, e). (f t, e)) |`| xs)) < size (Node r xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. size (Node r ((\<lambda>(t, e). (f t, e)) |`| xs)) < size (Node r xs)
[PROOF STEP]
have 0: "\<forall>t \<in> fst ` fset xs. size (f t) + 2 \<le> size t + 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t\<in>fst ` fset xs. size (f t) + 2 \<le> size t + 2
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>fst ` fset xs. size (f t) \<le> size t

goal (1 subgoal):
 1. \<forall>t\<in>fst ` fset xs. size (f t) + 2 \<le> size t + 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>t\<in>fst ` fset xs. size (f t) + 2 \<le> size t + 2

goal (1 subgoal):
 1. size (Node r ((\<lambda>(t, e). (f t, e)) |`| xs)) < size (Node r xs)
[PROOF STEP]
have "\<forall>t\<in>fst ` fset xs. 0 < size t + 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t\<in>fst ` fset xs. 0 < size t + 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>t\<in>fst ` fset xs. 0 < size t + 2

goal (1 subgoal):
 1. size (Node r ((\<lambda>(t, e). (f t, e)) |`| xs)) < size (Node r xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>t\<in>fst ` fset xs. 0 < size t + 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>fst ` fset xs. 0 < size t + 2

goal (1 subgoal):
 1. size (Node r ((\<lambda>(t, e). (f t, e)) |`| xs)) < size (Node r xs)
[PROOF STEP]
using sum_img_lt[OF 0] dtree_size_alt assms(2)
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>fst ` fset xs. 0 < size t + 2
\<lbrakk>\<exists>t\<in>fst ` fset xs. size (f t) + 2 < size t + 2; \<forall>t\<in>fst ` fset xs. 0 < size t + 2\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). size x + 2) < (\<Sum>(x, y)\<in>fset xs. size x + 2)
size (Node ?r ?xs) = (\<Sum>(x, y)\<in>fset ?xs. size x + 2) + 1
\<exists>t\<in>fst ` fset xs. size (f t) < size t

goal (1 subgoal):
 1. size (Node r ((\<lambda>(t, e). (f t, e)) |`| xs)) < size (Node r xs)
[PROOF STEP]
by (smt (z3) add_less_mono1)
[PROOF STATE]
proof (state)
this:
size (Node r ((\<lambda>(t, e). (f t, e)) |`| xs)) < size (Node r xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zip_replicate_map: "length xs = n \<Longrightarrow> zip (replicate n x) xs = map (Pair x) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = n \<Longrightarrow> zip (replicate n x) xs = map (Pair x) xs
[PROOF STEP]
apply (induct n arbitrary: xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xs. length xs = 0 \<Longrightarrow> zip (replicate 0 x) xs = map (Pair x) xs
 2. \<And>n xs. \<lbrakk>\<And>xs. length xs = n \<Longrightarrow> zip (replicate n x) xs = map (Pair x) xs; length xs = Suc n\<rbrakk> \<Longrightarrow> zip (replicate (Suc n) x) xs = map (Pair x) xs
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n xs. \<lbrakk>\<And>xs. length xs = n \<Longrightarrow> zip (replicate n x) xs = map (Pair x) xs; length xs = Suc n\<rbrakk> \<Longrightarrow> zip (replicate (Suc n) x) xs = map (Pair x) xs
[PROOF STEP]
apply (case_tac xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n xs. \<lbrakk>\<And>xs. length xs = n \<Longrightarrow> zip (replicate n x) xs = map (Pair x) xs; length xs = Suc n; xs = []\<rbrakk> \<Longrightarrow> zip (replicate (Suc n) x) xs = map (Pair x) xs
 2. \<And>n xs a list. \<lbrakk>\<And>xs. length xs = n \<Longrightarrow> zip (replicate n x) xs = map (Pair x) xs; length xs = Suc n; xs = a # list\<rbrakk> \<Longrightarrow> zip (replicate (Suc n) x) xs = map (Pair x) xs
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma distproj_in_proj_set:
  assumes "proj_set x A \<noteq> {}"
  shows "distproj x A \<in> proj_set x A"
        "distproj x A \<in> A"
        "dist x (distproj x A) = infdist x A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distproj x A \<in> proj_set x A &&& distproj x A \<in> A &&& dist x (distproj x A) = infdist x A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. distproj x A \<in> proj_set x A
 2. distproj x A \<in> A
 3. dist x (distproj x A) = infdist x A
[PROOF STEP]
show "distproj x A \<in> proj_set x A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distproj x A \<in> proj_set x A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
proj_set x A \<noteq> {}

goal (1 subgoal):
 1. distproj x A \<in> proj_set x A
[PROOF STEP]
unfolding distproj_def
[PROOF STATE]
proof (prove)
using this:
proj_set x A \<noteq> {}

goal (1 subgoal):
 1. (if proj_set x A \<noteq> {} then SOME y. y \<in> proj_set x A else x) \<in> proj_set x A
[PROOF STEP]
using some_in_eq
[PROOF STATE]
proof (prove)
using this:
proj_set x A \<noteq> {}
((SOME x. x \<in> ?A) \<in> ?A) = (?A \<noteq> {})

goal (1 subgoal):
 1. (if proj_set x A \<noteq> {} then SOME y. y \<in> proj_set x A else x) \<in> proj_set x A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distproj x A \<in> proj_set x A

goal (2 subgoals):
 1. distproj x A \<in> A
 2. dist x (distproj x A) = infdist x A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distproj x A \<in> proj_set x A
[PROOF STEP]
show "distproj x A \<in> A" "dist x (distproj x A) = infdist x A"
[PROOF STATE]
proof (prove)
using this:
distproj x A \<in> proj_set x A

goal (1 subgoal):
 1. distproj x A \<in> A &&& dist x (distproj x A) = infdist x A
[PROOF STEP]
unfolding proj_set_def
[PROOF STATE]
proof (prove)
using this:
distproj x A \<in> {y \<in> A. dist x y = infdist x A}

goal (1 subgoal):
 1. distproj x A \<in> A &&& dist x (distproj x A) = infdist x A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distproj x A \<in> A
dist x (distproj x A) = infdist x A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma f_inc_mono: "(\<forall> (x::nat). (f::nat\<Rightarrow>nat) x < f (x+1)) \<Longrightarrow> \<forall> (x::nat) (y::nat). (x < y \<longrightarrow> f x < f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x < f (x + 1) \<Longrightarrow> \<forall>x y. x < y \<longrightarrow> f x < f y
[PROOF STEP]
proof (rule allI, rule allI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<forall>x. f x < f (x + 1) \<Longrightarrow> x < y \<longrightarrow> f x < f y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<forall>x. f x < f (x + 1) \<Longrightarrow> x < y \<longrightarrow> f x < f y
[PROOF STEP]
assume A: "\<forall> (x::nat). f x < f (x+1)"
[PROOF STATE]
proof (state)
this:
\<forall>x. f x < f (x + 1)

goal (1 subgoal):
 1. \<And>x y. \<forall>x. f x < f (x + 1) \<Longrightarrow> x < y \<longrightarrow> f x < f y
[PROOF STEP]
show " x < y \<longrightarrow> f x < f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < y \<longrightarrow> f x < f y
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x < y \<Longrightarrow> f x < f y
[PROOF STEP]
assume A1: "x < y"
[PROOF STATE]
proof (state)
this:
x < y

goal (1 subgoal):
 1. x < y \<Longrightarrow> f x < f y
[PROOF STEP]
have L1: "\<And> u v. f u < f (u + (v+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u v. f u < f (u + (v + 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u v. f u < f (u + (v + 1))
[PROOF STEP]
fix u v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u v. f u < f (u + (v + 1))
[PROOF STEP]
show "f u < f (u + (v+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f u < f (u + (v + 1))
[PROOF STEP]
proof (induct v)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f u < f (u + (0 + 1))
 2. \<And>v. f u < f (u + (v + 1)) \<Longrightarrow> f u < f (u + (Suc v + 1))
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. f x < f (x + 1)
[PROOF STEP]
show "f u < f (u + (0 + 1))"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. f x < f (x + 1)

goal (1 subgoal):
 1. f u < f (u + (0 + 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f u < f (u + (0 + 1))

goal (1 subgoal):
 1. \<And>v. f u < f (u + (v + 1)) \<Longrightarrow> f u < f (u + (Suc v + 1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v. f u < f (u + (v + 1)) \<Longrightarrow> f u < f (u + (Suc v + 1))
[PROOF STEP]
fix v n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v. f u < f (u + (v + 1)) \<Longrightarrow> f u < f (u + (Suc v + 1))
[PROOF STEP]
assume A2: "f u < f (u + (n + 1))"
[PROOF STATE]
proof (state)
this:
f u < f (u + (n + 1))

goal (1 subgoal):
 1. \<And>v. f u < f (u + (v + 1)) \<Longrightarrow> f u < f (u + (Suc v + 1))
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. f x < f (x + 1)
[PROOF STEP]
have S1: "f (u + (n + 1)) < f (u + (Suc n + 1))"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. f x < f (x + 1)

goal (1 subgoal):
 1. f (u + (n + 1)) < f (u + (Suc n + 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (u + (n + 1)) < f (u + (Suc n + 1))

goal (1 subgoal):
 1. \<And>v. f u < f (u + (v + 1)) \<Longrightarrow> f u < f (u + (Suc v + 1))
[PROOF STEP]
from A2 S1
[PROOF STATE]
proof (chain)
picking this:
f u < f (u + (n + 1))
f (u + (n + 1)) < f (u + (Suc n + 1))
[PROOF STEP]
show " f u < f (u + (Suc n + 1))"
[PROOF STATE]
proof (prove)
using this:
f u < f (u + (n + 1))
f (u + (n + 1)) < f (u + (Suc n + 1))

goal (1 subgoal):
 1. f u < f (u + (Suc n + 1))
[PROOF STEP]
by (rule less_trans)
[PROOF STATE]
proof (state)
this:
f u < f (u + (Suc n + 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f u < f (u + (v + 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f ?u < f (?u + (?v + 1))

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

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

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

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

goal (1 subgoal):
 1. f x < f y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f x < f y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x < y \<longrightarrow> f x < f y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma relpow_image: assumes f: "\<And> s t. (s,t) \<in> r \<Longrightarrow> (f s, f t) \<in> r'"
  shows "(s,t) \<in> r ^^ n \<Longrightarrow> (f s, f t) \<in> r' ^^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (s, t) \<in> r ^^ n \<Longrightarrow> (f s, f t) \<in> r' ^^ n
[PROOF STEP]
proof (induct n arbitrary: t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>t. (s, t) \<in> r ^^ 0 \<Longrightarrow> (f s, f t) \<in> r' ^^ 0
 2. \<And>n t. \<lbrakk>\<And>t. (s, t) \<in> r ^^ n \<Longrightarrow> (f s, f t) \<in> r' ^^ n; (s, t) \<in> r ^^ Suc n\<rbrakk> \<Longrightarrow> (f s, f t) \<in> r' ^^ Suc n
[PROOF STEP]
case (Suc n u)
[PROOF STATE]
proof (state)
this:
(s, ?t) \<in> r ^^ n \<Longrightarrow> (f s, f ?t) \<in> r' ^^ n
(s, u) \<in> r ^^ Suc n

goal (2 subgoals):
 1. \<And>t. (s, t) \<in> r ^^ 0 \<Longrightarrow> (f s, f t) \<in> r' ^^ 0
 2. \<And>n t. \<lbrakk>\<And>t. (s, t) \<in> r ^^ n \<Longrightarrow> (f s, f t) \<in> r' ^^ n; (s, t) \<in> r ^^ Suc n\<rbrakk> \<Longrightarrow> (f s, f t) \<in> r' ^^ Suc n
[PROOF STEP]
from Suc(2)
[PROOF STATE]
proof (chain)
picking this:
(s, u) \<in> r ^^ Suc n
[PROOF STEP]
obtain t where st: "(s,t) \<in> r ^^ n" and tu: "(t,u) \<in> r"
[PROOF STATE]
proof (prove)
using this:
(s, u) \<in> r ^^ Suc n

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>(s, t) \<in> r ^^ n; (t, u) \<in> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(s, t) \<in> r ^^ n
(t, u) \<in> r

goal (2 subgoals):
 1. \<And>t. (s, t) \<in> r ^^ 0 \<Longrightarrow> (f s, f t) \<in> r' ^^ 0
 2. \<And>n t. \<lbrakk>\<And>t. (s, t) \<in> r ^^ n \<Longrightarrow> (f s, f t) \<in> r' ^^ n; (s, t) \<in> r ^^ Suc n\<rbrakk> \<Longrightarrow> (f s, f t) \<in> r' ^^ Suc n
[PROOF STEP]
from Suc(1)[OF st] f[OF tu]
[PROOF STATE]
proof (chain)
picking this:
(f s, f t) \<in> r' ^^ n
(f t, f u) \<in> r'
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(f s, f t) \<in> r' ^^ n
(f t, f u) \<in> r'

goal (1 subgoal):
 1. (f s, f u) \<in> r' ^^ Suc n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(f s, f u) \<in> r' ^^ Suc n

goal (1 subgoal):
 1. \<And>t. (s, t) \<in> r ^^ 0 \<Longrightarrow> (f s, f t) \<in> r' ^^ 0
[PROOF STEP]
qed auto


[STATEMENT]
lemma spectrum_non_empty: assumes A: "(A :: complex mat) \<in> carrier_mat n n"
  and n: "n > 0"
  shows "spectrum A \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. spectrum A \<noteq> {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. spectrum A \<noteq> {}
[PROOF STEP]
define CP where "CP = char_poly A"
[PROOF STATE]
proof (state)
this:
CP = char_poly A

goal (1 subgoal):
 1. spectrum A \<noteq> {}
[PROOF STEP]
from spectrum_root_char_poly[OF A]
[PROOF STATE]
proof (chain)
picking this:
spectrum A = {k. poly (char_poly A) k = 0}
[PROOF STEP]
have id: "spectrum A = { k. poly CP k = 0}"
[PROOF STATE]
proof (prove)
using this:
spectrum A = {k. poly (char_poly A) k = 0}

goal (1 subgoal):
 1. spectrum A = {k. poly CP k = 0}
[PROOF STEP]
unfolding CP_def
[PROOF STATE]
proof (prove)
using this:
spectrum A = {k. poly (char_poly A) k = 0}

goal (1 subgoal):
 1. spectrum A = {k. poly (char_poly A) k = 0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
spectrum A = {k. poly CP k = 0}

goal (1 subgoal):
 1. spectrum A \<noteq> {}
[PROOF STEP]
from degree_monic_char_poly[OF A]
[PROOF STATE]
proof (chain)
picking this:
degree (char_poly A) = n \<and> coeff (char_poly A) n = 1
[PROOF STEP]
have d: "degree CP > 0"
[PROOF STATE]
proof (prove)
using this:
degree (char_poly A) = n \<and> coeff (char_poly A) n = 1

goal (1 subgoal):
 1. 0 < degree CP
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
degree (char_poly A) = n \<and> coeff (char_poly A) n = 1
0 < n

goal (1 subgoal):
 1. 0 < degree CP
[PROOF STEP]
unfolding CP_def
[PROOF STATE]
proof (prove)
using this:
degree (char_poly A) = n \<and> coeff (char_poly A) n = 1
0 < n

goal (1 subgoal):
 1. 0 < degree (char_poly A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < degree CP

goal (1 subgoal):
 1. spectrum A \<noteq> {}
[PROOF STEP]
hence "\<not> constant (poly CP)"
[PROOF STATE]
proof (prove)
using this:
0 < degree CP

goal (1 subgoal):
 1. \<not> constant (poly CP)
[PROOF STEP]
by (simp add: constant_degree)
[PROOF STATE]
proof (state)
this:
\<not> constant (poly CP)

goal (1 subgoal):
 1. spectrum A \<noteq> {}
[PROOF STEP]
from fundamental_theorem_of_algebra[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>z. poly CP z = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>z. poly CP z = 0

goal (1 subgoal):
 1. spectrum A \<noteq> {}
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
using this:
\<exists>z. poly CP z = 0

goal (1 subgoal):
 1. {k. poly CP k = 0} \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
spectrum A \<noteq> {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eucl_induct [case_names zero mod]:
  assumes H1: "\<And>b. P b 0"
  and H2: "\<And>a b. b \<noteq> 0 \<Longrightarrow> P b (a mod b) \<Longrightarrow> P a b"
  shows "P a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P a b
[PROOF STEP]
proof (induct a b rule: gcd.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (b \<noteq> (0::'a) \<Longrightarrow> P b (a mod b)) \<Longrightarrow> P a b
[PROOF STEP]
case (1 a b)
[PROOF STATE]
proof (state)
this:
b \<noteq> (0::'a) \<Longrightarrow> P b (a mod b)

goal (1 subgoal):
 1. \<And>a b. (b \<noteq> (0::'a) \<Longrightarrow> P b (a mod b)) \<Longrightarrow> P a b
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P a b
[PROOF STEP]
proof (cases "b = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b = (0::'a) \<Longrightarrow> P a b
 2. b \<noteq> (0::'a) \<Longrightarrow> P a b
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
b = (0::'a)

goal (2 subgoals):
 1. b = (0::'a) \<Longrightarrow> P a b
 2. b \<noteq> (0::'a) \<Longrightarrow> P a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b = (0::'a)
[PROOF STEP]
show "P a b"
[PROOF STATE]
proof (prove)
using this:
b = (0::'a)

goal (1 subgoal):
 1. P a b
[PROOF STEP]
by simp (rule H1)
[PROOF STATE]
proof (state)
this:
P a b

goal (1 subgoal):
 1. b \<noteq> (0::'a) \<Longrightarrow> P a b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<noteq> (0::'a) \<Longrightarrow> P a b
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
b \<noteq> (0::'a)

goal (1 subgoal):
 1. b \<noteq> (0::'a) \<Longrightarrow> P a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> (0::'a)
[PROOF STEP]
have "P b (a mod b)"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)

goal (1 subgoal):
 1. P b (a mod b)
[PROOF STEP]
by (rule "1.hyps")
[PROOF STATE]
proof (state)
this:
P b (a mod b)

goal (1 subgoal):
 1. b \<noteq> (0::'a) \<Longrightarrow> P a b
[PROOF STEP]
with \<open>b \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> (0::'a)
P b (a mod b)
[PROOF STEP]
show "P a b"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)
P b (a mod b)

goal (1 subgoal):
 1. P a b
[PROOF STEP]
by (blast intro: H2)
[PROOF STATE]
proof (state)
this:
P a b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P a b

goal:
No subgoals!
[PROOF STEP]
qed