[STATEMENT]
lemma poly_circlepath_tan_eq:
  fixes z0::complex and r::real and p::"complex poly"
  defines "q1\<equiv> fcompose p [:(z0+r)*\<i>,z0-r:] [:\<i>,1:]" and "q2 \<equiv> [:\<i>,1:] ^ degree p"
  assumes "0\<le>t" "t\<le>1" "t\<noteq>1/2"
  shows "poly p (circlepath z0 r t) = poly q1 (tan (pi*t)) / poly q2 (tan (pi*t))"
    (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p (circlepath z0 r t) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly p (circlepath z0 r t) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
have "?L = poly p (z0+ r*exp (2 * of_real pi * \<i>  * t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p (circlepath z0 r t) = poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t))
[PROOF STEP]
unfolding circlepath
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t)) = poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly p (circlepath z0 r t) = poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t))

goal (1 subgoal):
 1. poly p (circlepath z0 r t) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly p (circlepath z0 r t) = poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t))

goal (1 subgoal):
 1. poly p (circlepath z0 r t) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
have "... = ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t)) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t)) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
define f where "f = (poly p \<circ> (\<lambda>x::real. z0 + r * exp (\<i> * x)))"
[PROOF STATE]
proof (state)
this:
f = poly p \<circ> (\<lambda>x. z0 + complex_of_real r * exp (\<i> * complex_of_real x))

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t)) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
have f_eq:"f t = ((\<lambda>x::real. poly q1 x / poly q2 x) o  (\<lambda>x. tan (x/2)) ) t"
      when "cos (t / 2) \<noteq> 0" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
have "f t = poly p (z0 + r * (cos t + \<i> * sin t)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f t = poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)))
[PROOF STEP]
unfolding f_def exp_Euler
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly p \<circ> (\<lambda>x. z0 + complex_of_real r * (cos (complex_of_real x) + \<i> * sin (complex_of_real x)))) t = poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)))
[PROOF STEP]
by (auto simp add:cos_of_real sin_of_real)
[PROOF STATE]
proof (state)
this:
f t = poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)))

goal (1 subgoal):
 1. f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f t = poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)))

goal (1 subgoal):
 1. f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
have "... = poly p ((\<lambda>x. ((z0-r)*x+(z0+r)*\<i>) / (\<i>+x)) (tan (t/2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
define tt where "tt=complex_of_real (tan (t / 2))"
[PROOF STATE]
proof (state)
this:
tt = complex_of_real (tan (t / 2))

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
define rr where "rr = complex_of_real r"
[PROOF STATE]
proof (state)
this:
rr = complex_of_real r

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
have "cos t = (1-tt*tt) / (1 + tt * tt)"
             "sin t = 2*tt  / (1 + tt * tt)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (cos t) = (1 - tt * tt) / (1 + tt * tt) &&& complex_of_real (sin t) = 2 * tt / (1 + tt * tt)
[PROOF STEP]
unfolding sin_tan_half[of "t/2",simplified] cos_tan_half[of "t/2",OF that, simplified] tt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real ((1 - (tan (t / 2))\<^sup>2) / (1 + (tan (t / 2))\<^sup>2)) = (1 - complex_of_real (tan (t / 2)) * complex_of_real (tan (t / 2))) / (1 + complex_of_real (tan (t / 2)) * complex_of_real (tan (t / 2))) &&& complex_of_real (2 * tan (t / 2) / (1 + (tan (t / 2))\<^sup>2)) = 2 * complex_of_real (tan (t / 2)) / (1 + complex_of_real (tan (t / 2)) * complex_of_real (tan (t / 2)))
[PROOF STEP]
by (auto simp add:power2_eq_square)
[PROOF STATE]
proof (state)
this:
complex_of_real (cos t) = (1 - tt * tt) / (1 + tt * tt)
complex_of_real (sin t) = 2 * tt / (1 + tt * tt)

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
complex_of_real (cos t) = (1 - tt * tt) / (1 + tt * tt)
complex_of_real (sin t) = 2 * tt / (1 + tt * tt)

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
have "1 + tt * tt \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + tt * tt \<noteq> 0
[PROOF STEP]
unfolding tt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + complex_of_real (tan (t / 2)) * complex_of_real (tan (t / 2)) \<noteq> 0
[PROOF STEP]
apply (fold of_real_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + complex_of_real (tan (t / 2) * tan (t / 2)) \<noteq> 0
[PROOF STEP]
by (metis (no_types, opaque_lifting) mult_numeral_1 numeral_One of_real_add of_real_eq_0_iff
              of_real_numeral sum_squares_eq_zero_iff zero_neq_one)
[PROOF STATE]
proof (state)
this:
1 + tt * tt \<noteq> 0

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
complex_of_real (cos t) = (1 - tt * tt) / (1 + tt * tt)
complex_of_real (sin t) = 2 * tt / (1 + tt * tt)
1 + tt * tt \<noteq> 0
[PROOF STEP]
have "z0 +  r * ( (cos t) + \<i> * (sin t))
            =(z0*(1+tt*tt)+rr*(1-tt*tt)+\<i>*rr*2*tt ) / (1 + tt * tt) "
[PROOF STATE]
proof (prove)
using this:
complex_of_real (cos t) = (1 - tt * tt) / (1 + tt * tt)
complex_of_real (sin t) = 2 * tt / (1 + tt * tt)
1 + tt * tt \<noteq> 0

goal (1 subgoal):
 1. z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)) = (z0 * (1 + tt * tt) + rr * (1 - tt * tt) + \<i> * rr * 2 * tt) / (1 + tt * tt)
[PROOF STEP]
apply (fold rr_def,simp add:add_divide_distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>complex_of_real (cos t) = (1 - tt * tt) / (1 + tt * tt); complex_of_real (sin t) = 2 * tt / (1 + tt * tt); 1 + tt * tt \<noteq> 0\<rbrakk> \<Longrightarrow> rr * ((1 - tt * tt) / (1 + tt * tt) + \<i> * (2 * tt) / (1 + tt * tt)) = rr * (1 - tt * tt) / (1 + tt * tt) + \<i> * rr * 2 * tt / (1 + tt * tt)
[PROOF STEP]
by (simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)) = (z0 * (1 + tt * tt) + rr * (1 - tt * tt) + \<i> * rr * 2 * tt) / (1 + tt * tt)

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)) = (z0 * (1 + tt * tt) + rr * (1 - tt * tt) + \<i> * rr * 2 * tt) / (1 + tt * tt)

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
have "... = ((z0-rr)*tt+z0*\<i>+rr*\<i>) / (tt + \<i>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z0 * (1 + tt * tt) + rr * (1 - tt * tt) + \<i> * rr * 2 * tt) / (1 + tt * tt) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (z0 * (1 + tt * tt) + rr * (1 - tt * tt) + \<i> * rr * 2 * tt) / (1 + tt * tt) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)
[PROOF STEP]
have "tt + \<i> \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tt + \<i> \<noteq> 0
[PROOF STEP]
using \<open>1 + tt * tt \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
1 + tt * tt \<noteq> 0

goal (1 subgoal):
 1. tt + \<i> \<noteq> 0
[PROOF STEP]
by (metis i_squared neg_eq_iff_add_eq_0 square_eq_iff)
[PROOF STATE]
proof (state)
this:
tt + \<i> \<noteq> 0

goal (1 subgoal):
 1. (z0 * (1 + tt * tt) + rr * (1 - tt * tt) + \<i> * rr * 2 * tt) / (1 + tt * tt) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
tt + \<i> \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
tt + \<i> \<noteq> 0

goal (1 subgoal):
 1. (z0 * (1 + tt * tt) + rr * (1 - tt * tt) + \<i> * rr * 2 * tt) / (1 + tt * tt) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)
[PROOF STEP]
using \<open>1 + tt * tt \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
tt + \<i> \<noteq> 0
1 + tt * tt \<noteq> 0

goal (1 subgoal):
 1. (z0 * (1 + tt * tt) + rr * (1 - tt * tt) + \<i> * rr * 2 * tt) / (1 + tt * tt) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)
[PROOF STEP]
by (auto simp add:divide_simps algebra_simps)
[PROOF STATE]
proof (state)
this:
(z0 * (1 + tt * tt) + rr * (1 - tt * tt) + \<i> * rr * 2 * tt) / (1 + tt * tt) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(z0 * (1 + tt * tt) + rr * (1 - tt * tt) + \<i> * rr * 2 * tt) / (1 + tt * tt) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)
[PROOF STEP]
have "z0 +  r * ( (cos t) + \<i> * (sin t)) = ((z0-rr)*tt+z0*\<i>+rr*\<i>) / (tt + \<i>)"
[PROOF STATE]
proof (prove)
using this:
z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)

goal (1 subgoal):
 1. z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)) = ((z0 - rr) * tt + z0 * \<i> + rr * \<i>) / (tt + \<i>)

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
unfolding tt_def rr_def
[PROOF STATE]
proof (prove)
using this:
z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t)) = ((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + z0 * \<i> + complex_of_real r * \<i>) / (complex_of_real (tan (t / 2)) + \<i>)

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))
[PROOF STEP]
by (auto simp add:algebra_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))

goal (1 subgoal):
 1. f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly p (z0 + complex_of_real r * (complex_of_real (cos t) + \<i> * complex_of_real (sin t))) = poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2))))

goal (1 subgoal):
 1. f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
have "... = (poly p o ((\<lambda>x. ((z0-r)*x+(z0+r)*\<i>) / (\<i>+x)) o (\<lambda>x. tan (x/2)) )) t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2)))) = (poly p \<circ> ((\<lambda>x. ((z0 - complex_of_real r) * x + (z0 + complex_of_real r) * \<i>) / (\<i> + x)) \<circ> (\<lambda>x. tan (x / 2)))) (complex_of_real t)
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2)))) = poly p (((z0 - complex_of_real r) * tan (complex_of_real t / 2) + (z0 + complex_of_real r) * \<i>) / (\<i> + tan (complex_of_real t / 2)))
[PROOF STEP]
by (auto simp:tan_of_real)
[PROOF STATE]
proof (state)
this:
poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2)))) = (poly p \<circ> ((\<lambda>x. ((z0 - complex_of_real r) * x + (z0 + complex_of_real r) * \<i>) / (\<i> + x)) \<circ> (\<lambda>x. tan (x / 2)))) (complex_of_real t)

goal (1 subgoal):
 1. f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly p (((z0 - complex_of_real r) * complex_of_real (tan (t / 2)) + (z0 + complex_of_real r) * \<i>) / (\<i> + complex_of_real (tan (t / 2)))) = (poly p \<circ> ((\<lambda>x. ((z0 - complex_of_real r) * x + (z0 + complex_of_real r) * \<i>) / (\<i> + x)) \<circ> (\<lambda>x. tan (x / 2)))) (complex_of_real t)

goal (1 subgoal):
 1. f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
have "... = ((\<lambda>x::real. poly q1 x / poly q2 x) o  (\<lambda>x. tan (x/2)) ) t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly p \<circ> ((\<lambda>x. ((z0 - complex_of_real r) * x + (z0 + complex_of_real r) * \<i>) / (\<i> + x)) \<circ> (\<lambda>x. tan (x / 2)))) (complex_of_real t) = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
unfolding q2_def q1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly p \<circ> ((\<lambda>x. ((z0 - complex_of_real r) * x + (z0 + complex_of_real r) * \<i>) / (\<i> + x)) \<circ> (\<lambda>x. tan (x / 2)))) (complex_of_real t) = ((\<lambda>x. poly (fcompose p [:(z0 + complex_of_real r) * \<i>, z0 - complex_of_real r:] [:\<i>, 1:]) (complex_of_real x) / poly ([:\<i>, 1:] ^ degree p) (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
apply (subst fcompose_poly[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. poly [:\<i>, 1:] (complex_of_real x) \<noteq> 0
 2. (poly p \<circ> ((\<lambda>x. ((z0 - complex_of_real r) * x + (z0 + complex_of_real r) * \<i>) / (\<i> + x)) \<circ> (\<lambda>x. tan (x / 2)))) (complex_of_real t) = ((\<lambda>x. poly p (poly [:(z0 + complex_of_real r) * \<i>, z0 - complex_of_real r:] (complex_of_real x) / poly [:\<i>, 1:] (complex_of_real x))) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
subgoal for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly [:\<i>, 1:] (complex_of_real x) \<noteq> 0
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i> + complex_of_real x \<noteq> 0
[PROOF STEP]
by (metis Re_complex_of_real add_cancel_right_left complex_i_not_zero imaginary_unit.sel(1) plus_complex.sel(1) rcis_zero_arg rcis_zero_mod)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly p \<circ> ((\<lambda>x. ((z0 - complex_of_real r) * x + (z0 + complex_of_real r) * \<i>) / (\<i> + x)) \<circ> (\<lambda>x. tan (x / 2)))) (complex_of_real t) = ((\<lambda>x. poly p (poly [:(z0 + complex_of_real r) * \<i>, z0 - complex_of_real r:] (complex_of_real x) / poly [:\<i>, 1:] (complex_of_real x))) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly p \<circ> ((\<lambda>x. ((z0 - complex_of_real r) * x + (z0 + complex_of_real r) * \<i>) / (\<i> + x)) \<circ> (\<lambda>x. tan (x / 2)))) (complex_of_real t) = ((\<lambda>x. poly p (poly [:(z0 + complex_of_real r) * \<i>, z0 - complex_of_real r:] (complex_of_real x) / poly [:\<i>, 1:] (complex_of_real x))) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
by (auto simp:tan_of_real algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(poly p \<circ> ((\<lambda>x. ((z0 - complex_of_real r) * x + (z0 + complex_of_real r) * \<i>) / (\<i> + x)) \<circ> (\<lambda>x. tan (x / 2)))) (complex_of_real t) = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t

goal (1 subgoal):
 1. f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t

goal (1 subgoal):
 1. f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) t

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cos (?t / 2) \<noteq> 0 \<Longrightarrow> f ?t = ((\<lambda>x. poly q1 (complex_of_real x) / poly q2 (complex_of_real x)) \<circ> (\<lambda>x. tan (x / 2))) ?t

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t)) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
have "cos (pi * t) \<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (pi * t) \<noteq> 0
[PROOF STEP]
unfolding cos_zero_iff_int2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>x. pi * t = real_of_int x * pi + pi / 2
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. pi * t = real_of_int x * pi + pi / 2 \<Longrightarrow> False
[PROOF STEP]
assume "\<exists>i. pi * t = real_of_int i * pi + pi / 2"
[PROOF STATE]
proof (state)
this:
\<exists>i. pi * t = real_of_int i * pi + pi / 2

goal (1 subgoal):
 1. \<exists>x. pi * t = real_of_int x * pi + pi / 2 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>i. pi * t = real_of_int i * pi + pi / 2
[PROOF STEP]
obtain i where "pi * t = real_of_int i * pi + pi / 2"
[PROOF STATE]
proof (prove)
using this:
\<exists>i. pi * t = real_of_int i * pi + pi / 2

goal (1 subgoal):
 1. (\<And>i. pi * t = real_of_int i * pi + pi / 2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pi * t = real_of_int i * pi + pi / 2

goal (1 subgoal):
 1. \<exists>x. pi * t = real_of_int x * pi + pi / 2 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pi * t = real_of_int i * pi + pi / 2
[PROOF STEP]
have "pi * t=pi * (real_of_int i + 1 / 2)"
[PROOF STATE]
proof (prove)
using this:
pi * t = real_of_int i * pi + pi / 2

goal (1 subgoal):
 1. pi * t = pi * (real_of_int i + 1 / 2)
[PROOF STEP]
by (simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
pi * t = pi * (real_of_int i + 1 / 2)

goal (1 subgoal):
 1. \<exists>x. pi * t = real_of_int x * pi + pi / 2 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pi * t = pi * (real_of_int i + 1 / 2)
[PROOF STEP]
have "t=real_of_int i + 1 / 2"
[PROOF STATE]
proof (prove)
using this:
pi * t = pi * (real_of_int i + 1 / 2)

goal (1 subgoal):
 1. t = real_of_int i + 1 / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t = real_of_int i + 1 / 2

goal (1 subgoal):
 1. \<exists>x. pi * t = real_of_int x * pi + pi / 2 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t = real_of_int i + 1 / 2
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
t = real_of_int i + 1 / 2

goal (1 subgoal):
 1. False
[PROOF STEP]
using \<open>0\<le>t\<close> \<open>t\<le>1\<close> \<open>t\<noteq>1/2\<close>
[PROOF STATE]
proof (prove)
using this:
t = real_of_int i + 1 / 2
0 \<le> t
t \<le> 1
t \<noteq> 1 / 2

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cos (pi * t) \<noteq> 0

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t)) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
from f_eq[of "2*pi*t",simplified,OF this]
[PROOF STATE]
proof (chain)
picking this:
f (2 * pi * t) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
show "?thesis"
[PROOF STATE]
proof (prove)
using this:
f (2 * pi * t) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t)) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
unfolding f_def comp_def
[PROOF STATE]
proof (prove)
using this:
poly p (z0 + complex_of_real r * exp (\<i> * complex_of_real (2 * pi * t))) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))

goal (1 subgoal):
 1. poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t)) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t)) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poly p (z0 + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real t)) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))

goal (1 subgoal):
 1. poly p (circlepath z0 r t) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly p (circlepath z0 r t) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly p (circlepath z0 r t) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))

goal (1 subgoal):
 1. poly p (circlepath z0 r t) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poly p (circlepath z0 r t) = poly q1 (complex_of_real (tan (pi * t))) / poly q2 (complex_of_real (tan (pi * t)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prim_pyth_triple_commute: "prim_pyth_triple x y z \<longleftrightarrow> prim_pyth_triple y x z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prim_pyth_triple x y z = prim_pyth_triple y x z
[PROOF STEP]
by (simp add: prim_pyth_triple_def coprime_commute add_ac conj_ac)


[STATEMENT]
lemma matrix_le_norm_mono:
  assumes "0 \<le> (blinfun_to_matrix C)"
    and "(blinfun_to_matrix C) \<le> (blinfun_to_matrix D)"
  shows "norm C \<le> norm D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm C \<le> norm D
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm C \<le> norm D
[PROOF STEP]
have "0 \<le> C 1" "0 \<le> D 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> blinfun_apply C 1 &&& 0 \<le> blinfun_apply D 1
[PROOF STEP]
using assms zero_le_one
[PROOF STATE]
proof (prove)
using this:
nonneg_blinfun C
blinfun_to_matrix C \<le> blinfun_to_matrix D
(0::?'a) \<le> (1::?'a)

goal (1 subgoal):
 1. 0 \<le> blinfun_apply C 1 &&& 0 \<le> blinfun_apply D 1
[PROOF STEP]
by (fastforce intro!: nonneg_blinfun_nonneg)+
[PROOF STATE]
proof (state)
this:
0 \<le> blinfun_apply C 1
0 \<le> blinfun_apply D 1

goal (1 subgoal):
 1. norm C \<le> norm D
[PROOF STEP]
have "\<And>v. v \<ge> 0 \<Longrightarrow> blinfun_to_matrix C *v v \<le> blinfun_to_matrix D *v v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. 0 \<le> v \<Longrightarrow> blinfun_to_matrix C *v v \<le> blinfun_to_matrix D *v v
[PROOF STEP]
using assms nonneg_mat_mono[of "blinfun_to_matrix D - blinfun_to_matrix C"]
[PROOF STATE]
proof (prove)
using this:
nonneg_blinfun C
blinfun_to_matrix C \<le> blinfun_to_matrix D
\<lbrakk>0 \<le> blinfun_to_matrix D - blinfun_to_matrix C; ?u \<le> ?v\<rbrakk> \<Longrightarrow> (blinfun_to_matrix D - blinfun_to_matrix C) *v ?u \<le> (blinfun_to_matrix D - blinfun_to_matrix C) *v ?v

goal (1 subgoal):
 1. \<And>v. 0 \<le> v \<Longrightarrow> blinfun_to_matrix C *v v \<le> blinfun_to_matrix D *v v
[PROOF STEP]
by (fastforce simp: matrix_vector_mult_diff_rdistrib)
[PROOF STATE]
proof (state)
this:
0 \<le> ?v \<Longrightarrow> blinfun_to_matrix C *v ?v \<le> blinfun_to_matrix D *v ?v

goal (1 subgoal):
 1. norm C \<le> norm D
[PROOF STEP]
hence *: "\<And>v. v \<ge> 0 \<Longrightarrow> C v \<le> D v"
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?v \<Longrightarrow> blinfun_to_matrix C *v ?v \<le> blinfun_to_matrix D *v ?v

goal (1 subgoal):
 1. \<And>v. 0 \<le> v \<Longrightarrow> blinfun_apply C v \<le> blinfun_apply D v
[PROOF STEP]
by (auto simp: less_eq_vec_def less_eq_bfun_def blinfun_to_matrix_mult[symmetric])
[PROOF STATE]
proof (state)
this:
0 \<le> ?v \<Longrightarrow> blinfun_apply C ?v \<le> blinfun_apply D ?v

goal (1 subgoal):
 1. norm C \<le> norm D
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm C \<le> norm D
[PROOF STEP]
using assms(1) assms(2) \<open>0 \<le> C 1\<close> \<open>0 \<le> D 1\<close> less_eq_bfunD[OF *, of 1]
[PROOF STATE]
proof (prove)
using this:
nonneg_blinfun C
blinfun_to_matrix C \<le> blinfun_to_matrix D
0 \<le> blinfun_apply C 1
0 \<le> blinfun_apply D 1
0 \<le> 1 \<Longrightarrow> apply_bfun (blinfun_apply C 1) ?x \<le> apply_bfun (blinfun_apply D 1) ?x

goal (1 subgoal):
 1. norm C \<le> norm D
[PROOF STEP]
by (fastforce intro!: cSUP_mono simp: norm_nonneg_blinfun_one norm_bfun_def' less_eq_bfun_def)
[PROOF STATE]
proof (state)
this:
norm C \<le> norm D

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_bit0 [simp]: "CARD('a bit0) = 2 * CARD('a::finite)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a bit0) = 2 * CARD('a)
[PROOF STEP]
unfolding type_definition.card [OF type_definition_bit0]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {0..<2 * int CARD('a)} = 2 * CARD('a)
[PROOF STEP]
by simp


[STATEMENT]
lemma one_time_pad:
  fixes xs :: "_ :: boolean_algebra list"
  shows "length xs \<ge> n \<Longrightarrow> map_spmf (xor_list xs) (spmf_of_set (nlists UNIV n)) = spmf_of_set (nlists UNIV n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> map_spmf (([\<oplus>]) xs) (spmf_of_set (nlists UNIV n)) = spmf_of_set (nlists UNIV n)
[PROOF STEP]
by(auto 4 3 simp add: in_nlists_UNIV intro: xor_list_left_inverse[symmetric] rev_image_eqI intro!: arg_cong[where f=spmf_of_set])


[STATEMENT]
lemma sum_le_2:
  "\<And>(f::nat\<Rightarrow>complex). sum f {0..<2} = f 0 + f 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. sum f {0..<2} = f 0 + f 1
[PROOF STEP]
by (simp add: numeral_2_eq_2)


[STATEMENT]
lemma P1_assert_correct2:
  shows   "(\<^bold>g [^] (\<alpha>0::nat)) [^] (r::nat) \<otimes> inv ((\<^bold>g [^] (\<alpha>1::nat)) [^] r) = (\<^bold>g [^] \<alpha>0 \<otimes> inv (\<^bold>g [^] \<alpha>1)) [^] r"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv ((\<^bold>g [^] \<alpha>1) [^] r) = (\<^bold>g [^] \<alpha>0 \<otimes> inv (\<^bold>g [^] \<alpha>1)) [^] r
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv ((\<^bold>g [^] \<alpha>1) [^] r) = (\<^bold>g [^] \<alpha>0 \<otimes> inv (\<^bold>g [^] \<alpha>1)) [^] r
[PROOF STEP]
have in_carrier2:"\<^bold>g [^] \<alpha>1 \<in> carrier \<G>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>g [^] \<alpha>1 \<in> carrier \<G>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] \<alpha>1 \<in> carrier \<G>

goal (1 subgoal):
 1. (\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv ((\<^bold>g [^] \<alpha>1) [^] r) = (\<^bold>g [^] \<alpha>0 \<otimes> inv (\<^bold>g [^] \<alpha>1)) [^] r
[PROOF STEP]
hence "?lhs = (\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv ((\<^bold>g [^] \<alpha>1)) [^] r"
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] \<alpha>1 \<in> carrier \<G>

goal (1 subgoal):
 1. (\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv ((\<^bold>g [^] \<alpha>1) [^] r) = (\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv (\<^bold>g [^] \<alpha>1) [^] r
[PROOF STEP]
using inverse_pow_pow
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] \<alpha>1 \<in> carrier \<G>
?a \<in> carrier \<G> \<Longrightarrow> inv (?a [^] ?r) = inv ?a [^] ?r

goal (1 subgoal):
 1. (\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv ((\<^bold>g [^] \<alpha>1) [^] r) = (\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv (\<^bold>g [^] \<alpha>1) [^] r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv ((\<^bold>g [^] \<alpha>1) [^] r) = (\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv (\<^bold>g [^] \<alpha>1) [^] r

goal (1 subgoal):
 1. (\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv ((\<^bold>g [^] \<alpha>1) [^] r) = (\<^bold>g [^] \<alpha>0 \<otimes> inv (\<^bold>g [^] \<alpha>1)) [^] r
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv ((\<^bold>g [^] \<alpha>1) [^] r) = (\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv (\<^bold>g [^] \<alpha>1) [^] r

goal (1 subgoal):
 1. (\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv ((\<^bold>g [^] \<alpha>1) [^] r) = (\<^bold>g [^] \<alpha>0 \<otimes> inv (\<^bold>g [^] \<alpha>1)) [^] r
[PROOF STEP]
by (simp add: cyclic_group_commute monoid_comm_monoidI pow_mult_distrib)
[PROOF STATE]
proof (state)
this:
(\<^bold>g [^] \<alpha>0) [^] r \<otimes> inv ((\<^bold>g [^] \<alpha>1) [^] r) = (\<^bold>g [^] \<alpha>0 \<otimes> inv (\<^bold>g [^] \<alpha>1)) [^] r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [simp]: "fib (Suc n) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < fib (Suc n)
[PROOF STEP]
by (induct n rule: fib.induct) simp_all


[STATEMENT]
lemma echelon_form_of_invertible:
  fixes A::"'a::{bezout_domain}^'cols::{mod_type}^'rows::{mod_type}"
  assumes ib: "is_bezout_ext (bezout)"
  shows "\<exists>P. invertible P
            \<and> P ** A = (echelon_form_of A bezout)
            \<and> echelon_form (echelon_form_of A bezout)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. invertible P \<and> P ** A = echelon_form_of A bezout \<and> echelon_form (echelon_form_of A bezout)
[PROOF STEP]
using echelon_form_of_upt_k_invertible[OF ib] echelon_form_echelon_form_of[OF ib]
[PROOF STATE]
proof (prove)
using this:
\<exists>P. invertible P \<and> P ** ?A = echelon_form_of_upt_k ?A ?k bezout
echelon_form (echelon_form_of ?A bezout)

goal (1 subgoal):
 1. \<exists>P. invertible P \<and> P ** A = echelon_form_of A bezout \<and> echelon_form (echelon_form_of A bezout)
[PROOF STEP]
unfolding echelon_form_of_def
[PROOF STATE]
proof (prove)
using this:
\<exists>P. invertible P \<and> P ** ?A = echelon_form_of_upt_k ?A ?k bezout
echelon_form (echelon_form_of_upt_k ?A (ncols ?A - 1) bezout)

goal (1 subgoal):
 1. \<exists>P. invertible P \<and> P ** A = echelon_form_of_upt_k A (ncols A - 1) bezout \<and> echelon_form (echelon_form_of_upt_k A (ncols A - 1) bezout)
[PROOF STEP]
by fast


[STATEMENT]
lemma complex_of_bounded_linear:
  shows "bounded_linear complex_of"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear complex_of
[PROOF STEP]
unfolding complex_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear (\<lambda>x. complex_of_real (x $\<^sub>e 0) + \<i> * complex_of_real (x $\<^sub>e 1))
[PROOF STEP]
apply (auto intro!:bounded_linearI' simp add: distrib_left plus_nth_eucl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c x. complex_of_real ((c *\<^sub>R x) $\<^sub>e 0) + \<i> * complex_of_real ((c *\<^sub>R x) $\<^sub>e Suc 0) = c *\<^sub>R (complex_of_real (x $\<^sub>e 0) + \<i> * complex_of_real (x $\<^sub>e Suc 0))
[PROOF STEP]
by (simp add: of_real_def scaleR_add_right scaleR_nth_eucl)


[STATEMENT]
lemma poly_pos_geq:
  "(\<forall>x::real. x \<ge> a \<longrightarrow> poly p x > 0) \<longleftrightarrow>
    poly_inf p = 1 \<and> (\<forall>x. x \<ge> a \<longrightarrow> poly p x \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<ge>a. 0 < poly p x) = (poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0))
[PROOF STEP]
proof (intro iffI conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> \<forall>x\<ge>a. poly p x \<noteq> 0
 3. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
assume A: "\<forall>x::real. x \<ge> a \<longrightarrow> poly p x > 0"
[PROOF STATE]
proof (state)
this:
\<forall>x\<ge>a. 0 < poly p x

goal (3 subgoals):
 1. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> \<forall>x\<ge>a. poly p x \<noteq> 0
 3. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
hence "\<forall>x::real. x > a \<longrightarrow> poly p x > 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<ge>a. 0 < poly p x

goal (1 subgoal):
 1. \<forall>x>a. 0 < poly p x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x>a. 0 < poly p x

goal (3 subgoals):
 1. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> \<forall>x\<ge>a. poly p x \<noteq> 0
 3. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<forall>x>a. 0 < poly p x

goal (3 subgoals):
 1. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> \<forall>x\<ge>a. poly p x \<noteq> 0
 3. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
note poly_pos_greater
[PROOF STATE]
proof (state)
this:
(\<forall>x>?a. 0 < poly ?p x) = (poly_inf ?p = 1 \<and> (\<forall>x>?a. poly ?p x \<noteq> 0))

goal (3 subgoals):
 1. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> \<forall>x\<ge>a. poly p x \<noteq> 0
 3. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0)
[PROOF STEP]
have "poly_inf p = 1" "(\<forall>x>a. poly p x \<noteq> 0)"
[PROOF STATE]
proof (prove)
using this:
poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0)

goal (1 subgoal):
 1. poly_inf p = 1 &&& \<forall>x>a. poly p x \<noteq> 0
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
poly_inf p = 1
\<forall>x>a. poly p x \<noteq> 0

goal (3 subgoals):
 1. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> \<forall>x\<ge>a. poly p x \<noteq> 0
 3. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
poly_inf p = 1
\<forall>x>a. poly p x \<noteq> 0

goal (3 subgoals):
 1. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> \<forall>x\<ge>a. poly p x \<noteq> 0
 3. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
have "poly p a > 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<ge>a. 0 < poly p x

goal (1 subgoal):
 1. 0 < poly p a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < poly p a

goal (3 subgoals):
 1. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. \<forall>x\<ge>a. 0 < poly p x \<Longrightarrow> \<forall>x\<ge>a. poly p x \<noteq> 0
 3. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
poly_inf p = 1
\<forall>x>a. poly p x \<noteq> 0
0 < poly p a
[PROOF STEP]
show "poly_inf p = 1" "\<forall>x\<ge>a. poly p x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
poly_inf p = 1
\<forall>x>a. poly p x \<noteq> 0
0 < poly p a

goal (1 subgoal):
 1. poly_inf p = 1 &&& \<forall>x\<ge>a. poly p x \<noteq> 0
[PROOF STEP]
by (auto simp: less_eq_real_def)
[PROOF STATE]
proof (state)
this:
poly_inf p = 1
\<forall>x\<ge>a. poly p x \<noteq> 0

goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
assume "poly_inf p = 1 \<and> (\<forall>x. x \<ge> a \<longrightarrow> poly p x \<noteq> 0)"
[PROOF STATE]
proof (state)
this:
poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0)

goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
hence A: "poly_inf p = 1" and
        B: "poly p a \<noteq> 0" and C: "\<forall>x>a. poly p x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0)

goal (1 subgoal):
 1. poly_inf p = 1 &&& poly p a \<noteq> 0 &&& \<forall>x>a. poly p x \<noteq> 0
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
poly_inf p = 1
poly p a \<noteq> 0
\<forall>x>a. poly p x \<noteq> 0

goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
from A and C and poly_pos_greater
[PROOF STATE]
proof (chain)
picking this:
poly_inf p = 1
\<forall>x>a. poly p x \<noteq> 0
(\<forall>x>?a. 0 < poly ?p x) = (poly_inf ?p = 1 \<and> (\<forall>x>?a. poly ?p x \<noteq> 0))
[PROOF STEP]
have "\<forall>x>a. poly p x > 0"
[PROOF STATE]
proof (prove)
using this:
poly_inf p = 1
\<forall>x>a. poly p x \<noteq> 0
(\<forall>x>?a. 0 < poly ?p x) = (poly_inf ?p = 1 \<and> (\<forall>x>?a. poly ?p x \<noteq> 0))

goal (1 subgoal):
 1. \<forall>x>a. 0 < poly p x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x>a. 0 < poly p x

goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x>a. 0 < poly p x

goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
with B C poly_IVT_pos[of a "a+1" p]
[PROOF STATE]
proof (chain)
picking this:
poly p a \<noteq> 0
\<forall>x>a. poly p x \<noteq> 0
\<lbrakk>a < a + 1; poly p a < 0; 0 < poly p (a + 1)\<rbrakk> \<Longrightarrow> \<exists>x>a. x < a + 1 \<and> poly p x = 0
\<forall>x>a. 0 < poly p x
[PROOF STEP]
have "poly p a > 0"
[PROOF STATE]
proof (prove)
using this:
poly p a \<noteq> 0
\<forall>x>a. poly p x \<noteq> 0
\<lbrakk>a < a + 1; poly p a < 0; 0 < poly p (a + 1)\<rbrakk> \<Longrightarrow> \<exists>x>a. x < a + 1 \<and> poly p x = 0
\<forall>x>a. 0 < poly p x

goal (1 subgoal):
 1. 0 < poly p a
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 < poly p a

goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x\<ge>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>x>a. 0 < poly p x
0 < poly p a
[PROOF STEP]
show "\<forall>x\<ge>a. poly p x > 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x>a. 0 < poly p x
0 < poly p a

goal (1 subgoal):
 1. \<forall>x\<ge>a. 0 < poly p x
[PROOF STEP]
by (auto simp: less_eq_real_def)
[PROOF STATE]
proof (state)
this:
\<forall>x\<ge>a. 0 < poly p x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_nat_non0:
  assumes n0: "n \<noteq> 0"
  shows       "length_nat n = Suc (length_nat (n div 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length_nat n = Suc (length_nat (n div 2))
[PROOF STEP]
apply (simp add: length_nat [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (nat_to_bv n) = Suc (length (nat_to_bv (n div 2)))
[PROOF STEP]
apply (subst nat_to_bv_non0 [of n])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. n \<noteq> 0
 2. length (nat_to_bv (n div 2) @ [if n mod 2 = 0 then \<zero> else \<one>]) = Suc (length (nat_to_bv (n div 2)))
[PROOF STEP]
apply (simp_all add: n0)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma evaln_max3:
"\<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>n1\<rightarrow> (w1, s1'); G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>n2\<rightarrow> (w2, s2'); G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>n3\<rightarrow> (w3, s3')\<rbrakk> \<Longrightarrow>
 G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w1, s1') \<and>
 G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w2, s2') \<and>
 G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w3, s3')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>n1\<rightarrow> (w1, s1'); G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>n2\<rightarrow> (w2, s2'); G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>n3\<rightarrow> (w3, s3')\<rbrakk> \<Longrightarrow> G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w1, s1') \<and> G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w2, s2') \<and> G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w3, s3')
[PROOF STEP]
apply (drule (1) evaln_max2, erule thin_rl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>n3\<rightarrow> (w3, s3'); G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max n1 n2\<rightarrow> (w1, s1') \<and> G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max n1 n2\<rightarrow> (w2, s2')\<rbrakk> \<Longrightarrow> G\<turnstile>s1 \<midarrow>t1\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w1, s1') \<and> G\<turnstile>s2 \<midarrow>t2\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w2, s2') \<and> G\<turnstile>s3 \<midarrow>t3\<succ>\<midarrow>max (max n1 n2) n3\<rightarrow> (w3, s3')
[PROOF STEP]
apply (fast intro!: max.cobounded1 max.cobounded2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma left_lang_UN:
     "\<lbrakk>\<Union>(left_lang ` qs1) = \<Union>(left_lang ` qs2); qs1 \<union> qs2 \<subseteq> accessible\<rbrakk>
      \<Longrightarrow> qs1 = qs2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<Union> (left_lang ` qs1) = \<Union> (left_lang ` qs2); qs1 \<union> qs2 \<subseteq> accessible\<rbrakk> \<Longrightarrow> qs1 = qs2
[PROOF STEP]
apply (rule equalityI [OF _ dfa.left_lang_half [OF dfa_Accessible]])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>\<Union> (left_lang ` qs1) = \<Union> (left_lang ` qs2); qs1 \<union> qs2 \<subseteq> accessible\<rbrakk> \<Longrightarrow> qs1 \<subseteq> qs2
 2. \<lbrakk>\<Union> (left_lang ` qs1) = \<Union> (left_lang ` qs2); qs1 \<union> qs2 \<subseteq> accessible\<rbrakk> \<Longrightarrow> \<Union> (Accessible.left_lang ` qs2) \<subseteq> \<Union> (Accessible.left_lang ` qs1)
 3. \<And>x. \<lbrakk>\<Union> (left_lang ` qs1) = \<Union> (left_lang ` qs2); qs1 \<union> qs2 \<subseteq> accessible; x \<in> qs2\<rbrakk> \<Longrightarrow> Accessible.left_lang x \<noteq> {}
[PROOF STEP]
apply (rule dfa.left_lang_half [OF dfa_Accessible], auto simp: accessible_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem summatory_totient_asymptotics:
  "(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
define H where "H = (\<lambda>x. of_int (floor x) * (of_int (floor x) + 1) / 2 - x ^ 2 / 2 :: real)"
[PROOF STATE]
proof (state)
this:
H = (\<lambda>x. real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2 - x\<^sup>2 / 2)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
define H' where "H' = (\<lambda>x. sum_upto (\<lambda>n. moebius_mu n * H (x / real n)) x)"
[PROOF STATE]
proof (state)
this:
H' = (\<lambda>x. sum_upto (\<lambda>n. moebius_mu n * H (x / real n)) x)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have H: "sum_upto real x = x^2/2 + H x" if "x \<ge> 0" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto real x = x\<^sup>2 / 2 + H x
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 \<le> x

goal (1 subgoal):
 1. sum_upto real x = x\<^sup>2 / 2 + H x
[PROOF STEP]
by (simp add: sum_upto_real H_def)
[PROOF STATE]
proof (state)
this:
0 \<le> ?x \<Longrightarrow> sum_upto real ?x = ?x\<^sup>2 / 2 + H ?x

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
define G where "G = (\<lambda>x::real. (\<Sum>n. moebius_mu (n + Suc (nat \<lfloor>x\<rfloor>)) / (n + Suc (nat \<lfloor>x\<rfloor>))^2))"
[PROOF STATE]
proof (state)
this:
G = (\<lambda>x. \<Sum>n. moebius_mu (n + Suc (nat \<lfloor>x\<rfloor>)) / real ((n + Suc (nat \<lfloor>x\<rfloor>))\<^sup>2))

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have H_bound: "\<bar>H t\<bar> \<le> t / 2" if "t \<ge> 0" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>H t\<bar> \<le> t / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>H t\<bar> \<le> t / 2
[PROOF STEP]
have "H t - t / 2 = (-(t - of_int (floor t))) * (floor t + t + 1) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H t - t / 2 = - (t - real_of_int \<lfloor>t\<rfloor>) * (real_of_int \<lfloor>t\<rfloor> + t + 1) / 2
[PROOF STEP]
by (simp add: H_def field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
H t - t / 2 = - (t - real_of_int \<lfloor>t\<rfloor>) * (real_of_int \<lfloor>t\<rfloor> + t + 1) / 2

goal (1 subgoal):
 1. \<bar>H t\<bar> \<le> t / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
H t - t / 2 = - (t - real_of_int \<lfloor>t\<rfloor>) * (real_of_int \<lfloor>t\<rfloor> + t + 1) / 2

goal (1 subgoal):
 1. \<bar>H t\<bar> \<le> t / 2
[PROOF STEP]
have "\<dots> \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (t - real_of_int \<lfloor>t\<rfloor>) * (real_of_int \<lfloor>t\<rfloor> + t + 1) / 2 \<le> 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 \<le> t

goal (1 subgoal):
 1. - (t - real_of_int \<lfloor>t\<rfloor>) * (real_of_int \<lfloor>t\<rfloor> + t + 1) / 2 \<le> 0
[PROOF STEP]
by (intro mult_nonpos_nonneg divide_nonpos_nonneg) simp_all
[PROOF STATE]
proof (state)
this:
- (t - real_of_int \<lfloor>t\<rfloor>) * (real_of_int \<lfloor>t\<rfloor> + t + 1) / 2 \<le> 0

goal (1 subgoal):
 1. \<bar>H t\<bar> \<le> t / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
H t - t / 2 \<le> 0
[PROOF STEP]
have "H t \<le> t / 2"
[PROOF STATE]
proof (prove)
using this:
H t - t / 2 \<le> 0

goal (1 subgoal):
 1. H t \<le> t / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
H t \<le> t / 2

goal (1 subgoal):
 1. \<bar>H t\<bar> \<le> t / 2
[PROOF STEP]
have "-H t - t / 2 = (t - of_int (floor t) - 1) * (of_int (floor t) + t) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - H t - t / 2 = (t - real_of_int \<lfloor>t\<rfloor> - 1) * (real_of_int \<lfloor>t\<rfloor> + t) / 2
[PROOF STEP]
by (simp add: H_def field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
- H t - t / 2 = (t - real_of_int \<lfloor>t\<rfloor> - 1) * (real_of_int \<lfloor>t\<rfloor> + t) / 2

goal (1 subgoal):
 1. \<bar>H t\<bar> \<le> t / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- H t - t / 2 = (t - real_of_int \<lfloor>t\<rfloor> - 1) * (real_of_int \<lfloor>t\<rfloor> + t) / 2

goal (1 subgoal):
 1. \<bar>H t\<bar> \<le> t / 2
[PROOF STEP]
have "\<dots> \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (t - real_of_int \<lfloor>t\<rfloor> - 1) * (real_of_int \<lfloor>t\<rfloor> + t) / 2 \<le> 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 \<le> t

goal (1 subgoal):
 1. (t - real_of_int \<lfloor>t\<rfloor> - 1) * (real_of_int \<lfloor>t\<rfloor> + t) / 2 \<le> 0
[PROOF STEP]
by (intro divide_nonpos_nonneg mult_nonpos_nonneg) ((simp; fail) | linarith)+
[PROOF STATE]
proof (state)
this:
(t - real_of_int \<lfloor>t\<rfloor> - 1) * (real_of_int \<lfloor>t\<rfloor> + t) / 2 \<le> 0

goal (1 subgoal):
 1. \<bar>H t\<bar> \<le> t / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
- H t - t / 2 \<le> 0
[PROOF STEP]
have "-H t \<le> t / 2"
[PROOF STATE]
proof (prove)
using this:
- H t - t / 2 \<le> 0

goal (1 subgoal):
 1. - H t \<le> t / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- H t \<le> t / 2

goal (1 subgoal):
 1. \<bar>H t\<bar> \<le> t / 2
[PROOF STEP]
with \<open>H t \<le> t / 2\<close>
[PROOF STATE]
proof (chain)
picking this:
H t \<le> t / 2
- H t \<le> t / 2
[PROOF STEP]
show "\<bar>H t\<bar> \<le> t / 2"
[PROOF STATE]
proof (prove)
using this:
H t \<le> t / 2
- H t \<le> t / 2

goal (1 subgoal):
 1. \<bar>H t\<bar> \<le> t / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>H t\<bar> \<le> t / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 \<le> ?t \<Longrightarrow> \<bar>H ?t\<bar> \<le> ?t / 2

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have H'_bound: "\<bar>H' t\<bar> \<le> t / 2 * sum_upto (\<lambda>i. 1 / real i) t" if "t \<ge> 0" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>H' t\<bar> \<le> t / 2 * sum_upto (\<lambda>i. 1 / real i) t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>H' t\<bar> \<le> t / 2 * sum_upto (\<lambda>i. 1 / real i) t
[PROOF STEP]
have "\<bar>H' t\<bar> \<le> (\<Sum>i | 0 < i \<and> real i \<le> t. \<bar>moebius_mu i * H (t / real i)\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>H' t\<bar> \<le> (\<Sum>i | 0 < i \<and> real i \<le> t. \<bar>moebius_mu i * H (t / real i)\<bar>)
[PROOF STEP]
unfolding H'_def sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<Sum>n\<in>{i. 0 < i \<and> real i \<le> t}. moebius_mu n * H (t / real n)\<bar> \<le> (\<Sum>i | 0 < i \<and> real i \<le> t. \<bar>moebius_mu i * H (t / real i)\<bar>)
[PROOF STEP]
by (rule sum_abs)
[PROOF STATE]
proof (state)
this:
\<bar>H' t\<bar> \<le> (\<Sum>i | 0 < i \<and> real i \<le> t. \<bar>moebius_mu i * H (t / real i)\<bar>)

goal (1 subgoal):
 1. \<bar>H' t\<bar> \<le> t / 2 * sum_upto (\<lambda>i. 1 / real i) t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>H' t\<bar> \<le> (\<Sum>i | 0 < i \<and> real i \<le> t. \<bar>moebius_mu i * H (t / real i)\<bar>)

goal (1 subgoal):
 1. \<bar>H' t\<bar> \<le> t / 2 * sum_upto (\<lambda>i. 1 / real i) t
[PROOF STEP]
have "\<dots> \<le> (\<Sum>i | 0 < i \<and> real i \<le> t. 1 * ((t / real i) / 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | 0 < i \<and> real i \<le> t. \<bar>moebius_mu i * H (t / real i)\<bar>) \<le> (\<Sum>i | 0 < i \<and> real i \<le> t. 1 * (t / real i / 2))
[PROOF STEP]
unfolding abs_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | 0 < i \<and> real i \<le> t. \<bar>moebius_mu i\<bar> * \<bar>H (t / real i)\<bar>) \<le> (\<Sum>i | 0 < i \<and> real i \<le> t. 1 * (t / real i / 2))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 \<le> t

goal (1 subgoal):
 1. (\<Sum>i | 0 < i \<and> real i \<le> t. \<bar>moebius_mu i\<bar> * \<bar>H (t / real i)\<bar>) \<le> (\<Sum>i | 0 < i \<and> real i \<le> t. 1 * (t / real i / 2))
[PROOF STEP]
by (intro sum_mono mult_mono abs_moebius_mu_le H_bound) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>i | 0 < i \<and> real i \<le> t. \<bar>moebius_mu i * H (t / real i)\<bar>) \<le> (\<Sum>i | 0 < i \<and> real i \<le> t. 1 * (t / real i / 2))

goal (1 subgoal):
 1. \<bar>H' t\<bar> \<le> t / 2 * sum_upto (\<lambda>i. 1 / real i) t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i | 0 < i \<and> real i \<le> t. \<bar>moebius_mu i * H (t / real i)\<bar>) \<le> (\<Sum>i | 0 < i \<and> real i \<le> t. 1 * (t / real i / 2))

goal (1 subgoal):
 1. \<bar>H' t\<bar> \<le> t / 2 * sum_upto (\<lambda>i. 1 / real i) t
[PROOF STEP]
have "\<dots> = t / 2 * sum_upto (\<lambda>i. 1 / real i) t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | 0 < i \<and> real i \<le> t. 1 * (t / real i / 2)) = t / 2 * sum_upto (\<lambda>i. 1 / real i) t
[PROOF STEP]
by (simp add: sum_upto_def sum_distrib_left sum_distrib_right mult_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>i | 0 < i \<and> real i \<le> t. 1 * (t / real i / 2)) = t / 2 * sum_upto (\<lambda>i. 1 / real i) t

goal (1 subgoal):
 1. \<bar>H' t\<bar> \<le> t / 2 * sum_upto (\<lambda>i. 1 / real i) t
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>H' t\<bar> \<le> t / 2 * sum_upto (\<lambda>i. 1 / real i) t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>H' t\<bar> \<le> t / 2 * sum_upto (\<lambda>i. 1 / real i) t

goal (1 subgoal):
 1. \<bar>H' t\<bar> \<le> t / 2 * sum_upto (\<lambda>i. 1 / real i) t
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>H' t\<bar> \<le> t / 2 * sum_upto (\<lambda>i. 1 / real i) t

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 \<le> ?t \<Longrightarrow> \<bar>H' ?t\<bar> \<le> ?t / 2 * sum_upto (\<lambda>i. 1 / real i) ?t

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
hence "H' \<in> O(\<lambda>t. t * sum_upto (\<lambda>i. 1 / real i) t)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?t \<Longrightarrow> \<bar>H' ?t\<bar> \<le> ?t / 2 * sum_upto (\<lambda>i. 1 / real i) ?t

goal (1 subgoal):
 1. H' \<in> O(\<lambda>t. t * sum_upto (\<lambda>i. 1 / real i) t)
[PROOF STEP]
using sum_upto_inverse_bound(1)
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?t \<Longrightarrow> \<bar>H' ?t\<bar> \<le> ?t / 2 * sum_upto (\<lambda>i. 1 / real i) ?t
0 \<le> sum_upto (\<lambda>i. 1 / real i) ?x

goal (1 subgoal):
 1. H' \<in> O(\<lambda>t. t * sum_upto (\<lambda>i. 1 / real i) t)
[PROOF STEP]
by (intro bigoI[of _ "1/2"] eventually_mono[OF eventually_ge_at_top[of "0::real"]])
       (auto elim!: eventually_mono simp: abs_mult)
[PROOF STATE]
proof (state)
this:
H' \<in> O(\<lambda>t. t * sum_upto (\<lambda>i. 1 / real i) t)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
H' \<in> O(\<lambda>t. t * sum_upto (\<lambda>i. 1 / real i) t)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have "(\<lambda>t. t * sum_upto (\<lambda>i. 1 / real i) t) \<in> O(\<lambda>t. t * ln t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. t * sum_upto (\<lambda>i. 1 / real i) t) \<in> O(\<lambda>t. t * ln t)
[PROOF STEP]
by (intro landau_o.big.mult sum_upto_inverse_bigo) simp_all
[PROOF STATE]
proof (state)
this:
(\<lambda>t. t * sum_upto (\<lambda>i. 1 / real i) t) \<in> O(\<lambda>t. t * ln t)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
H' \<in> O(\<lambda>t. t * ln t)
[PROOF STEP]
have H'_bigo: "H' \<in> O(\<lambda>x. x * ln x)"
[PROOF STATE]
proof (prove)
using this:
H' \<in> O(\<lambda>t. t * ln t)

goal (1 subgoal):
 1. H' \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
H' \<in> O(\<lambda>x. x * ln x)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
H' \<in> O(\<lambda>x. x * ln x)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
assume x: "x \<ge> 0"
[PROOF STATE]
proof (state)
this:
0 \<le> x

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have "sum_upto (\<lambda>n. real (totient n)) x = sum_upto (\<lambda>n. of_int (int (totient n))) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (totient n)) x = sum_upto (\<lambda>n. real_of_int (int (totient n))) x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real (totient n)) x = sum_upto (\<lambda>n. real_of_int (int (totient n))) x

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real (totient n)) x = sum_upto (\<lambda>n. real_of_int (int (totient n))) x

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have "\<dots> = sum_upto (\<lambda>n. moebius_mu n * sum_upto real (x / real n)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real_of_int (int (totient n))) x = sum_upto (\<lambda>n. moebius_mu n * sum_upto real (x / real n)) x
[PROOF STEP]
by (subst totient_conv_moebius_mu) (simp add: sum_upto_dirichlet_prod of_int_dirichlet_prod)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real_of_int (int (totient n))) x = sum_upto (\<lambda>n. moebius_mu n * sum_upto real (x / real n)) x

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real_of_int (int (totient n))) x = sum_upto (\<lambda>n. moebius_mu n * sum_upto real (x / real n)) x

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have "\<dots> = sum_upto (\<lambda>n. moebius_mu n * ((x / real n) ^ 2 / 2 + H (x / real n))) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. moebius_mu n * sum_upto real (x / real n)) x = sum_upto (\<lambda>n. moebius_mu n * ((x / real n)\<^sup>2 / 2 + H (x / real n))) x
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
0 \<le> x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. moebius_mu n * sum_upto real (x / real n)) x = sum_upto (\<lambda>n. moebius_mu n * ((x / real n)\<^sup>2 / 2 + H (x / real n))) x
[PROOF STEP]
by (intro sum_upto_cong) (simp_all add: H)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. moebius_mu n * sum_upto real (x / real n)) x = sum_upto (\<lambda>n. moebius_mu n * ((x / real n)\<^sup>2 / 2 + H (x / real n))) x

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. moebius_mu n * sum_upto real (x / real n)) x = sum_upto (\<lambda>n. moebius_mu n * ((x / real n)\<^sup>2 / 2 + H (x / real n))) x

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have "\<dots> = x^2 / 2 * sum_upto (\<lambda>n. moebius_mu n / real n ^ 2) x + H' x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. moebius_mu n * ((x / real n)\<^sup>2 / 2 + H (x / real n))) x = x\<^sup>2 / 2 * sum_upto (\<lambda>n. moebius_mu n / (real n)\<^sup>2) x + H' x
[PROOF STEP]
by (simp add: sum_upto_def H'_def sum.distrib ring_distribs
                    sum_distrib_left sum_distrib_right power_divide mult_ac)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. moebius_mu n * ((x / real n)\<^sup>2 / 2 + H (x / real n))) x = x\<^sup>2 / 2 * sum_upto (\<lambda>n. moebius_mu n / (real n)\<^sup>2) x + H' x

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. moebius_mu n * ((x / real n)\<^sup>2 / 2 + H (x / real n))) x = x\<^sup>2 / 2 * sum_upto (\<lambda>n. moebius_mu n / (real n)\<^sup>2) x + H' x

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have "sum_upto (\<lambda>n. moebius_mu n / real n ^ 2) x =
                 (\<Sum>n\<in>{..<Suc (nat \<lfloor>x\<rfloor>)}. moebius_mu n / real n ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. moebius_mu n / (real n)\<^sup>2) x = (\<Sum>n<Suc (nat \<lfloor>x\<rfloor>). moebius_mu n / (real n)\<^sup>2)
[PROOF STEP]
unfolding sum_upto_altdef
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. moebius_mu n / (real n)\<^sup>2) = (\<Sum>n<Suc (nat \<lfloor>x\<rfloor>). moebius_mu n / (real n)\<^sup>2)
[PROOF STEP]
by (intro sum.mono_neutral_cong_left refl) auto
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. moebius_mu n / (real n)\<^sup>2) x = (\<Sum>n<Suc (nat \<lfloor>x\<rfloor>). moebius_mu n / (real n)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. moebius_mu n / (real n)\<^sup>2) x = (\<Sum>n<Suc (nat \<lfloor>x\<rfloor>). moebius_mu n / (real n)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have "\<dots> = 6 / pi ^ 2 - G x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n<Suc (nat \<lfloor>x\<rfloor>). moebius_mu n / (real n)\<^sup>2) = 6 / pi\<^sup>2 - G x
[PROOF STEP]
using sums_split_initial_segment[OF moebius_over_square_sums, of "Suc (nat \<lfloor>x\<rfloor>)"]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. moebius_mu (i + Suc (nat \<lfloor>x\<rfloor>)) / real ((i + Suc (nat \<lfloor>x\<rfloor>))\<^sup>2)) sums (6 / pi\<^sup>2 - (\<Sum>i<Suc (nat \<lfloor>x\<rfloor>). moebius_mu i / real (i\<^sup>2)))

goal (1 subgoal):
 1. (\<Sum>n<Suc (nat \<lfloor>x\<rfloor>). moebius_mu n / (real n)\<^sup>2) = 6 / pi\<^sup>2 - G x
[PROOF STEP]
by (auto simp: sums_iff algebra_simps G_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>n<Suc (nat \<lfloor>x\<rfloor>). moebius_mu n / (real n)\<^sup>2) = 6 / pi\<^sup>2 - G x

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_upto (\<lambda>n. real (totient n)) x = x\<^sup>2 / 2 * (6 / pi\<^sup>2 - G x) + H' x
[PROOF STEP]
have "sum_upto (\<lambda>n. real (totient n)) x = 3 / pi\<^sup>2 * x\<^sup>2 - x\<^sup>2 / 2 * G x + H' x"
[PROOF STATE]
proof (prove)
using this:
sum_upto (\<lambda>n. real (totient n)) x = x\<^sup>2 / 2 * (6 / pi\<^sup>2 - G x) + H' x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (totient n)) x = 3 / pi\<^sup>2 * x\<^sup>2 - x\<^sup>2 / 2 * G x + H' x
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real (totient n)) x = 3 / pi\<^sup>2 * x\<^sup>2 - x\<^sup>2 / 2 * G x + H' x

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 \<le> ?x2 \<Longrightarrow> sum_upto (\<lambda>n. real (totient n)) ?x2 = 3 / pi\<^sup>2 * ?x2\<^sup>2 - ?x2\<^sup>2 / 2 * G ?x2 + H' ?x2

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
hence "(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi^2 * x^2) \<in>
            \<Theta>(\<lambda>x. (-(x^2) / 2) * G x + H' x)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?x2 \<Longrightarrow> sum_upto (\<lambda>n. real (totient n)) ?x2 = 3 / pi\<^sup>2 * ?x2\<^sup>2 - ?x2\<^sup>2 / 2 * G ?x2 + H' ?x2

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> \<Theta>(\<lambda>x. - x\<^sup>2 / 2 * G x + H' x)
[PROOF STEP]
by (intro bigthetaI_cong eventually_mono[OF eventually_ge_at_top[of "0::real"]])
       (auto elim!: eventually_mono)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> \<Theta>(\<lambda>x. - x\<^sup>2 / 2 * G x + H' x)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> \<Theta>(\<lambda>x. - x\<^sup>2 / 2 * G x + H' x)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have "(\<lambda>x. (-(x^2) / 2) * G x + H' x) \<in> O(\<lambda>x. x * ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. - x\<^sup>2 / 2 * G x + H' x) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
proof (intro sum_in_bigo H'_bigo)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. - x\<^sup>2 / 2 * G x) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have "(\<lambda>x. (- (x^2) / 2) * G x) \<in> O(\<lambda>x. x^2 * (1 / x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. - x\<^sup>2 / 2 * G x) \<in> O(\<lambda>x. x\<^sup>2 * (1 / x))
[PROOF STEP]
using moebius_sum_tail_bigo [folded G_def]
[PROOF STATE]
proof (prove)
using this:
G \<in> O((/) 1)

goal (1 subgoal):
 1. (\<lambda>x. - x\<^sup>2 / 2 * G x) \<in> O(\<lambda>x. x\<^sup>2 * (1 / x))
[PROOF STEP]
by (intro landau_o.big.mult) simp_all
[PROOF STATE]
proof (state)
this:
(\<lambda>x. - x\<^sup>2 / 2 * G x) \<in> O(\<lambda>x. x\<^sup>2 * (1 / x))

goal (1 subgoal):
 1. (\<lambda>x. - x\<^sup>2 / 2 * G x) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. - x\<^sup>2 / 2 * G x) \<in> O(\<lambda>x. x\<^sup>2 * (1 / x))

goal (1 subgoal):
 1. (\<lambda>x. - x\<^sup>2 / 2 * G x) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
have "(\<lambda>x::real. x^2 * (1 / x)) \<in> O(\<lambda>x. x * ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x\<^sup>2 * (1 / x)) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x\<^sup>2 * (1 / x)) \<in> O(\<lambda>x. x * ln x)

goal (1 subgoal):
 1. (\<lambda>x. - x\<^sup>2 / 2 * G x) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. - x\<^sup>2 / 2 * G x) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
show "(\<lambda>x. (- (x^2) / 2) * G x) \<in> O(\<lambda>x. x * ln x)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. - x\<^sup>2 / 2 * G x) \<in> O(\<lambda>x. x * ln x)

goal (1 subgoal):
 1. (\<lambda>x. - x\<^sup>2 / 2 * G x) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. - x\<^sup>2 / 2 * G x) \<in> O(\<lambda>x. x * ln x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. - x\<^sup>2 / 2 * G x + H' x) \<in> O(\<lambda>x. x * ln x)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma e_3 [simp]: "e 3 = 1/6"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e 3 = 1 / 6
[PROOF STEP]
by (subst e_recurrence; simp add: atLeastAtMost_nat_numeral)


[STATEMENT]
lemma finite_shattered_by:
  assumes "finite (\<Union> F)"
  shows "finite (shattered_by F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (shattered_by F)
[PROOF STEP]
using assms rev_finite_subset[OF _ shattered_by_in_Pow, of F]
[PROOF STATE]
proof (prove)
using this:
finite (\<Union> F)
finite (Pow (\<Union> F)) \<Longrightarrow> finite (shattered_by F)

goal (1 subgoal):
 1. finite (shattered_by F)
[PROOF STEP]
by fast


[STATEMENT]
lemma iT_Minus_Minus: "a \<ominus> (b \<ominus> I) = (I \<down>\<le> b) \<oplus> a \<oplus>- b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<ominus> (b \<ominus> I) = I \<down>\<le> b \<oplus> a \<oplus>- b
[PROOF STEP]
apply (rule set_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (x \<in> a \<ominus> (b \<ominus> I)) = (x \<in> I \<down>\<le> b \<oplus> a \<oplus>- b)
[PROOF STEP]
apply (simp add: iT_Minus_image_conv iT_Plus_image_conv iT_Plus_neg_image_conv image_iff Bex_def i_cut_mem_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (\<exists>xa. (\<exists>x. x \<in> I \<and> x \<le> b \<and> xa = b - x) \<and> xa \<le> a \<and> x = a - xa) = (\<exists>xa. (\<exists>x. x \<in> I \<and> x \<le> b \<and> xa = x + a) \<and> b \<le> xa \<and> x = xa - b)
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Cauchy_subseq_Cauchy:
  assumes "Cauchy X" "strict_mono f"
  shows "Cauchy (X \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cauchy (X \<circ> f)
[PROOF STEP]
unfolding Cauchy_uniform comp_def filtermap_filtermap[symmetric] cauchy_filter_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap X (filtermap f sequentially) \<times>\<^sub>F filtermap X (filtermap f sequentially) \<le> uniformity
[PROOF STEP]
by (rule order_trans[OF _ \<open>Cauchy X\<close>[unfolded Cauchy_uniform cauchy_filter_def]])
     (intro prod_filter_mono filtermap_mono filterlim_subseq[OF \<open>strict_mono f\<close>, unfolded filterlim_def])


[STATEMENT]
lemma le_Limsup:
  assumes F: "F \<noteq> bot" and x: "\<forall>\<^sub>F x in F. l \<le> f x"
  shows "l \<le> Limsup F f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l \<le> Limsup F f
[PROOF STEP]
using F Liminf_bounded[of l f F] Liminf_le_Limsup[of F f] order.trans x
[PROOF STATE]
proof (prove)
using this:
F \<noteq> bot
\<forall>\<^sub>F n in F. l \<le> f n \<Longrightarrow> l \<le> Liminf F f
F \<noteq> bot \<Longrightarrow> Liminf F f \<le> Limsup F f
\<lbrakk>?a \<le> ?b; ?b \<le> ?c\<rbrakk> \<Longrightarrow> ?a \<le> ?c
\<forall>\<^sub>F x in F. l \<le> f x

goal (1 subgoal):
 1. l \<le> Limsup F f
[PROOF STEP]
by blast


[STATEMENT]
lemma size_rbt_join[simp]: "size (rbt_join t1 a b t2) = Suc (size t1 + size t2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (rbt_join t1 a b t2) = Suc (size t1 + size t2)
[PROOF STEP]
by (auto simp: rbt_join_def Let_def)


[STATEMENT]
lemma smooth_on_inverse: "k-smooth_on S (\<lambda>x. inverse (f x))"
  if "k-smooth_on S f" "0 \<notin> f ` S" "open S"
  for f::"_ \<Rightarrow>_::real_normed_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k-smooth_on S (\<lambda>x. inverse (f x))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
k-smooth_on S f
(0::'d) \<notin> f ` S
open S

goal (1 subgoal):
 1. k-smooth_on S (\<lambda>x. inverse (f x))
[PROOF STEP]
by (auto simp: smooth_on_def intro!: higher_differentiable_on_inverse)


[STATEMENT]
lemma Arity_exhaust: "(y = 0 \<Longrightarrow> P) \<Longrightarrow> (\<And>x. y = inc \<cdot> x \<Longrightarrow> P) \<Longrightarrow> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y = 0 \<Longrightarrow> P; \<And>x. y = inc\<cdot>x \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by (metis Abs_cfun_inverse2 Arity.inc_def Rep_Arity_inverse inc_Arity.abs_eq inc_Arity_cont list_decode.cases zero_Arity_def)


[STATEMENT]
lemma surj_on_insert_right: "surj_on f A (insert b B) = (surj_on f A B \<and> surj_on f A {b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. surj_on f A (insert b B) = (surj_on f A B \<and> surj_on f A {b})
[PROOF STEP]
unfolding surj_on_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>b\<in>insert b B. \<exists>a\<in>A. b = f a) = ((\<forall>b\<in>B. \<exists>a\<in>A. b = f a) \<and> (\<forall>b\<in>{b}. \<exists>a\<in>A. b = f a))
[PROOF STEP]
by blast


[STATEMENT]
lemma d_IN_mono: "(\<And>x. f (x, y) \<le> g (x, y)) \<Longrightarrow> d_IN f y \<le> d_IN g y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. f (x, y) \<le> g (x, y)) \<Longrightarrow> d_IN f y \<le> d_IN g y
[PROOF STEP]
by(auto simp add: d_IN_def le_fun_def intro: nn_integral_mono)


[STATEMENT]
lemma Carmichael_Suc_0 [simp]: "Carmichael (Suc 0) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael (Suc 0) = 1
[PROOF STEP]
by (simp add: Carmichael_def)


[STATEMENT]
lemma round_down_correct: "f - (round_down e f) \<in> {0..2 powr -e}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f - round_down e f \<in> {0..2 powr - real_of_int e}
[PROOF STEP]
unfolding atLeastAtMost_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> f - round_down e f \<and> f - round_down e f \<le> 2 powr - real_of_int e
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> f - round_down e f
 2. f - round_down e f \<le> 2 powr - real_of_int e
[PROOF STEP]
have "f - round_down e f \<le> round_up e f - round_down e f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f - round_down e f \<le> round_up e f - round_down e f
[PROOF STEP]
using round_up
[PROOF STATE]
proof (prove)
using this:
?x \<le> round_up ?prec ?x

goal (1 subgoal):
 1. f - round_down e f \<le> round_up e f - round_down e f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f - round_down e f \<le> round_up e f - round_down e f

goal (2 subgoals):
 1. 0 \<le> f - round_down e f
 2. f - round_down e f \<le> 2 powr - real_of_int e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f - round_down e f \<le> round_up e f - round_down e f

goal (2 subgoals):
 1. 0 \<le> f - round_down e f
 2. f - round_down e f \<le> 2 powr - real_of_int e
[PROOF STEP]
have "\<dots> \<le> 2 powr -e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round_up e f - round_down e f \<le> 2 powr real_of_int (- e)
[PROOF STEP]
using round_up_diff_round_down
[PROOF STATE]
proof (prove)
using this:
round_up ?prec ?x - round_down ?prec ?x \<le> 2 powr - real_of_int ?prec

goal (1 subgoal):
 1. round_up e f - round_down e f \<le> 2 powr real_of_int (- e)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
round_up e f - round_down e f \<le> 2 powr real_of_int (- e)

goal (2 subgoals):
 1. 0 \<le> f - round_down e f
 2. f - round_down e f \<le> 2 powr - real_of_int e
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f - round_down e f \<le> 2 powr real_of_int (- e)
[PROOF STEP]
show "f - round_down e f \<le> 2 powr - (real_of_int e)"
[PROOF STATE]
proof (prove)
using this:
f - round_down e f \<le> 2 powr real_of_int (- e)

goal (1 subgoal):
 1. f - round_down e f \<le> 2 powr - real_of_int e
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f - round_down e f \<le> 2 powr - real_of_int e

goal (1 subgoal):
 1. 0 \<le> f - round_down e f
[PROOF STEP]
qed (simp add: algebra_simps round_down)


[STATEMENT]
lemma supp_sum_divide_distrib: "supp_sum f A / (r::'a::field) = supp_sum (\<lambda>n. f n / r) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp_sum f A / r = supp_sum (\<lambda>n. f n / r) A
[PROOF STEP]
by (cases "r = 0")
     (auto simp: supp_sum_def sum_divide_distrib intro!: sum.cong support_on_cong)


[STATEMENT]
lemma (in ring) finite_carr_imp_char_ge_0:
  assumes "finite (carrier R)"
  shows "char R > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < char R
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < char R
[PROOF STEP]
have "char_subring R \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_subring R \<subseteq> carrier R
[PROOF STEP]
using int_embed_closed
[PROOF STATE]
proof (prove)
using this:
int_embed R ?k \<in> carrier R

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

goal (1 subgoal):
 1. 0 < char R
[PROOF STEP]
hence "finite (char_subring R)"
[PROOF STATE]
proof (prove)
using this:
char_subring R \<subseteq> carrier R

goal (1 subgoal):
 1. finite (char_subring R)
[PROOF STEP]
using finite_subset assms
[PROOF STATE]
proof (prove)
using this:
char_subring R \<subseteq> carrier R
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
finite (carrier R)

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

goal (1 subgoal):
 1. 0 < char R
[PROOF STEP]
hence "card (char_subring R) > 0"
[PROOF STATE]
proof (prove)
using this:
finite (char_subring R)

goal (1 subgoal):
 1. 0 < card (char_subring R)
[PROOF STEP]
using card_range_greater_zero
[PROOF STATE]
proof (prove)
using this:
finite (char_subring R)
finite (range ?f) \<Longrightarrow> 0 < card (range ?f)

goal (1 subgoal):
 1. 0 < card (char_subring R)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < card (char_subring R)

goal (1 subgoal):
 1. 0 < char R
[PROOF STEP]
thus "char R > 0"
[PROOF STATE]
proof (prove)
using this:
0 < card (char_subring R)

goal (1 subgoal):
 1. 0 < char R
[PROOF STEP]
unfolding char_def
[PROOF STATE]
proof (prove)
using this:
0 < card (char_subring R)

goal (1 subgoal):
 1. 0 < card (char_subring R)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < char R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma normalize_poly_eq_map_poly: "normalize p = map_poly (\<lambda>x. x div unit_factor (lead_coeff p)) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize p = map_poly (\<lambda>x. x div unit_factor (lead_coeff p)) p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. normalize p = map_poly (\<lambda>x. x div unit_factor (lead_coeff p)) p
[PROOF STEP]
have "[:unit_factor (lead_coeff p):] dvd p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:unit_factor (lead_coeff p):] dvd p
[PROOF STEP]
by (metis unit_factor_poly_def unit_factor_self)
[PROOF STATE]
proof (state)
this:
[:unit_factor (lead_coeff p):] dvd p

goal (1 subgoal):
 1. normalize p = map_poly (\<lambda>x. x div unit_factor (lead_coeff p)) p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[:unit_factor (lead_coeff p):] dvd p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[:unit_factor (lead_coeff p):] dvd p

goal (1 subgoal):
 1. normalize p = map_poly (\<lambda>x. x div unit_factor (lead_coeff p)) p
[PROOF STEP]
by (simp add: normalize_poly_def div_const_poly_conv_map_poly)
[PROOF STATE]
proof (state)
this:
normalize p = map_poly (\<lambda>x. x div unit_factor (lead_coeff p)) p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma non_empty_backward_finite_path_root_iff:
  "(\<exists>r . backward_finite_path_root r x \<and> r \<le> x;1) \<longleftrightarrow> backward_finite_path x \<and> x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>r. backward_finite_path_root r x \<and> r \<le> x ; 1) = (backward_finite_path x \<and> x \<noteq> 0)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<exists>r. backward_finite_path_root r x \<and> r \<le> x ; 1 \<Longrightarrow> backward_finite_path x \<and> x \<noteq> 0
 2. backward_finite_path x \<and> x \<noteq> 0 \<Longrightarrow> \<exists>r. backward_finite_path_root r x \<and> r \<le> x ; 1
[PROOF STEP]
apply (metis backward_finite_path_root_iff annir backward_finite_path_root_def le_bot
              no_end_point_char ss_p18)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. backward_finite_path x \<and> x \<noteq> 0 \<Longrightarrow> \<exists>r. backward_finite_path_root r x \<and> r \<le> x ; 1
[PROOF STEP]
using backward_finite_path_root_iff backward_finite_path_root_def point_def root_in_edge_sources
[PROOF STATE]
proof (prove)
using this:
(\<exists>r. backward_finite_path_root r ?x) = backward_finite_path ?x
backward_finite_path_root ?r ?x \<equiv> connected_root ?r ?x \<and> is_inj ?x \<and> is_p_fun ?x \<and> point ?r
point ?x \<equiv> is_vector ?x \<and> bijective ?x
\<lbrakk>connected_root ?r ?x; ?x \<noteq> 0; is_vector ?r\<rbrakk> \<Longrightarrow> ?r \<le> ?x ; 1

goal (1 subgoal):
 1. backward_finite_path x \<and> x \<noteq> 0 \<Longrightarrow> \<exists>r. backward_finite_path_root r x \<and> r \<le> x ; 1
[PROOF STEP]
by blast


[STATEMENT]
lemma neg_diff_pos_meas_set:
  assumes "(neg_meas_set M2)"
    and "(pos_meas_set N1)"
    and "(space M = N1 \<union> N2)"
    and "N2 \<in> sets M"
  shows "pos_meas_set ((M2 - N2) \<inter> space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pos_meas_set ((M2 - N2) \<inter> space M)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pos_meas_set ((M2 - N2) \<inter> space M)
[PROOF STEP]
have "(M2 - N2) \<inter> space M \<subseteq> N1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M2 - N2) \<inter> space M \<subseteq> N1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
neg_meas_set M2
pos_meas_set N1
space M = N1 \<union> N2
N2 \<in> sets M

goal (1 subgoal):
 1. (M2 - N2) \<inter> space M \<subseteq> N1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(M2 - N2) \<inter> space M \<subseteq> N1

goal (1 subgoal):
 1. pos_meas_set ((M2 - N2) \<inter> space M)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(M2 - N2) \<inter> space M \<subseteq> N1

goal (1 subgoal):
 1. pos_meas_set ((M2 - N2) \<inter> space M)
[PROOF STEP]
using assms pos_meas_subset neg_meas_setD1
[PROOF STATE]
proof (prove)
using this:
(M2 - N2) \<inter> space M \<subseteq> N1
neg_meas_set M2
pos_meas_set N1
space M = N1 \<union> N2
N2 \<in> sets M
\<lbrakk>pos_meas_set ?A; ?B \<subseteq> ?A; ?B \<in> sets M\<rbrakk> \<Longrightarrow> pos_meas_set ?B
neg_meas_set ?E \<Longrightarrow> ?E \<in> sets M

goal (1 subgoal):
 1. pos_meas_set ((M2 - N2) \<inter> space M)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
pos_meas_set ((M2 - N2) \<inter> space M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma char_one [simp]: "\<chi> \<one> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<chi> \<one> = 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<chi> \<one> = 1
[PROOF STEP]
from char_mult[of \<one> \<one>]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<one> \<in> carrier G; \<one> \<in> carrier G\<rbrakk> \<Longrightarrow> \<chi> (\<one> \<otimes> \<one>) = \<chi> \<one> * \<chi> \<one>
[PROOF STEP]
have "\<chi> \<one> * (\<chi> \<one> - 1) = 0"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<one> \<in> carrier G; \<one> \<in> carrier G\<rbrakk> \<Longrightarrow> \<chi> (\<one> \<otimes> \<one>) = \<chi> \<one> * \<chi> \<one>

goal (1 subgoal):
 1. \<chi> \<one> * (\<chi> \<one> - 1) = 0
[PROOF STEP]
by (auto simp del: char_mult)
[PROOF STATE]
proof (state)
this:
\<chi> \<one> * (\<chi> \<one> - 1) = 0

goal (1 subgoal):
 1. \<chi> \<one> = 1
[PROOF STEP]
with char_one_nz
[PROOF STATE]
proof (chain)
picking this:
\<chi> \<one> \<noteq> 0
\<chi> \<one> * (\<chi> \<one> - 1) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<chi> \<one> \<noteq> 0
\<chi> \<one> * (\<chi> \<one> - 1) = 0

goal (1 subgoal):
 1. \<chi> \<one> = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<chi> \<one> = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lead_coeff_sym_mpoly [simp]:
  assumes "finite A" "k \<le> card A"
  shows   "lead_coeff (sym_mpoly A k) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (sym_mpoly A k) = (1::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (sym_mpoly A k) = (1::'a)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
k \<le> card A
[PROOF STEP]
have "lead_coeff (sym_mpoly A k) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
finite A
k \<le> card A

goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (sym_mpoly A k) \<noteq> (0::'b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Symmetric_Polynomials.lead_coeff (sym_mpoly A k) \<noteq> (0::?'b1)

goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (sym_mpoly A k) = (1::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Symmetric_Polynomials.lead_coeff (sym_mpoly A k) \<noteq> (0::?'b1)

goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (sym_mpoly A k) = (1::'a)
[PROOF STEP]
using coeff_sym_mpoly_0_or_1[of A k "lead_monom (sym_mpoly A k)"]
[PROOF STATE]
proof (prove)
using this:
Symmetric_Polynomials.lead_coeff (sym_mpoly A k) \<noteq> (0::?'b1)
MPoly_Type.coeff (sym_mpoly A k) (lead_monom (sym_mpoly A k)) \<in> {0::?'a, 1::?'a}

goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (sym_mpoly A k) = (1::'a)
[PROOF STEP]
unfolding lead_coeff_def
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.coeff (sym_mpoly A k) (lead_monom (sym_mpoly A k)) \<noteq> (0::?'b1)
MPoly_Type.coeff (sym_mpoly A k) (lead_monom (sym_mpoly A k)) \<in> {0::?'a, 1::?'a}

goal (1 subgoal):
 1. MPoly_Type.coeff (sym_mpoly A k) (lead_monom (sym_mpoly A k)) = (1::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Symmetric_Polynomials.lead_coeff (sym_mpoly A k) = (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed