[STATEMENT]
lemma cf_cn_cov_rcomp_ObjMap_vdomain[cat_cs_simps]:
  assumes "category \<alpha> \<BB>" and "\<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
  shows "\<D>\<^sub>\<circ> (cf_cn_cov_rcomp \<BB> \<SS> \<GG>\<lparr>ObjMap\<rparr>) = (op_cat \<BB> \<times>\<^sub>C \<AA>)\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_cn_cov_rcomp \<BB> \<SS> \<GG>\<lparr>ObjMap\<rparr>) = (op_cat \<BB> \<times>\<^sub>C \<AA>)\<lparr>Obj\<rparr>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<BB>
\<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_cn_cov_rcomp \<BB> \<SS> \<GG>\<lparr>ObjMap\<rparr>) = (op_cat \<BB> \<times>\<^sub>C \<AA>)\<lparr>Obj\<rparr>
[PROOF STEP]
unfolding cf_cn_cov_rcomp_def
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<BB>
\<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_cn_cov_bcomp \<SS> (dghm_id \<BB>) \<GG>\<lparr>ObjMap\<rparr>) = (op_cat \<BB> \<times>\<^sub>C \<AA>)\<lparr>Obj\<rparr>
[PROOF STEP]
by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros)


[STATEMENT]
lemma unvis_finite: "finite (unvisited_verts u U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (unvisited_verts u U)
[PROOF STEP]
unfolding unvisited_verts_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x \<in> verts G - U. u \<rightarrow>\<^sup>* x}
[PROOF STEP]
using finite_verts
[PROOF STATE]
proof (prove)
using this:
finite (verts G)

goal (1 subgoal):
 1. finite {x \<in> verts G - U. u \<rightarrow>\<^sup>* x}
[PROOF STEP]
by auto


[STATEMENT]
lemma no_proots_line_code[code]: "no_proots_line p st tt = (if poly p st \<noteq>0 \<and> poly p tt \<noteq> 0 then
                (let pc = pcompose p [:st, tt - st:];
                     pR = map_poly Re pc;
                     pI = map_poly Im pc;
                     g  = gcd pR pI
                 in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False) else False)"
            (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
proof (cases "poly p st \<noteq>0 \<and> poly p tt \<noteq> 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
 2. \<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0) \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0)

goal (2 subgoals):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
 2. \<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0) \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0)

goal (1 subgoal):
 1. no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
unfolding no_proots_line_def
[PROOF STATE]
proof (prove)
using this:
\<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0)

goal (1 subgoal):
 1. (proots_within p (closed_segment st tt) = {}) = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0
[PROOF STEP]
have "poly p st \<noteq> 0" "poly p tt \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0

goal (1 subgoal):
 1. poly p st \<noteq> 0 &&& poly p tt \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly p st \<noteq> 0
poly p tt \<noteq> 0

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
define pc pR pI g where
      "pc = pcompose p [:st, tt-st:]" and
      "pR = map_poly Re pc" and
      "pI = map_poly Im pc" and
      "g  = gcd pR pI"
[PROOF STATE]
proof (state)
this:
pc = p \<circ>\<^sub>p [:st, tt - st:]
pR = map_poly Re pc
pI = map_poly Im pc
g = gcd pR pI

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
have poly_iff:"poly g t=0 \<longleftrightarrow> poly pc t =0" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly g t = 0) = (poly pc (complex_of_real t) = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (poly g t = 0) = (poly pc (complex_of_real t) = 0)
[PROOF STEP]
have "poly g t = 0 \<longleftrightarrow> poly pR t =0 \<and> poly pI t =0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly g t = 0) = (poly pR t = 0 \<and> poly pI t = 0)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly (gcd pR pI) t = 0) = (poly pR t = 0 \<and> poly pI t = 0)
[PROOF STEP]
using poly_gcd_0_iff
[PROOF STATE]
proof (prove)
using this:
(poly (gcd ?p ?q) ?x = (0::?'a)) = (poly ?p ?x = (0::?'a) \<and> poly ?q ?x = (0::?'a))

goal (1 subgoal):
 1. (poly (gcd pR pI) t = 0) = (poly pR t = 0 \<and> poly pI t = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(poly g t = 0) = (poly pR t = 0 \<and> poly pI t = 0)

goal (1 subgoal):
 1. (poly g t = 0) = (poly pc (complex_of_real t) = 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(poly g t = 0) = (poly pR t = 0 \<and> poly pI t = 0)

goal (1 subgoal):
 1. (poly g t = 0) = (poly pc (complex_of_real t) = 0)
[PROOF STEP]
have "... \<longleftrightarrow> poly pc t =0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly pR t = 0 \<and> poly pI t = 0) = (poly pc (complex_of_real t) = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (poly pR t = 0 \<and> poly pI t = 0) = (poly pc (complex_of_real t) = 0)
[PROOF STEP]
have "cpoly_of pR pI = pc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cpoly_of pR pI = pc
[PROOF STEP]
unfolding pc_def pR_def pI_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cpoly_of (map_poly Re (p \<circ>\<^sub>p [:st, tt - st:])) (map_poly Im (p \<circ>\<^sub>p [:st, tt - st:])) = p \<circ>\<^sub>p [:st, tt - st:]
[PROOF STEP]
using cpoly_of_decompose
[PROOF STATE]
proof (prove)
using this:
?p = cpoly_of (map_poly Re ?p) (map_poly Im ?p)

goal (1 subgoal):
 1. cpoly_of (map_poly Re (p \<circ>\<^sub>p [:st, tt - st:])) (map_poly Im (p \<circ>\<^sub>p [:st, tt - st:])) = p \<circ>\<^sub>p [:st, tt - st:]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cpoly_of pR pI = pc

goal (1 subgoal):
 1. (poly pR t = 0 \<and> poly pI t = 0) = (poly pc (complex_of_real t) = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cpoly_of pR pI = pc
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cpoly_of pR pI = pc

goal (1 subgoal):
 1. (poly pR t = 0 \<and> poly pI t = 0) = (poly pc (complex_of_real t) = 0)
[PROOF STEP]
using poly_cpoly_of_real_iff
[PROOF STATE]
proof (prove)
using this:
cpoly_of pR pI = pc
(poly (cpoly_of ?pR ?pI) (complex_of_real ?t) = 0) = (poly ?pR ?t = 0 \<and> poly ?pI ?t = 0)

goal (1 subgoal):
 1. (poly pR t = 0 \<and> poly pI t = 0) = (poly pc (complex_of_real t) = 0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(poly pR t = 0 \<and> poly pI t = 0) = (poly pc (complex_of_real t) = 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(poly pR t = 0 \<and> poly pI t = 0) = (poly pc (complex_of_real t) = 0)

goal (1 subgoal):
 1. (poly g t = 0) = (poly pc (complex_of_real t) = 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(poly g t = 0) = (poly pc (complex_of_real t) = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(poly g t = 0) = (poly pc (complex_of_real t) = 0)

goal (1 subgoal):
 1. (poly g t = 0) = (poly pc (complex_of_real t) = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(poly g t = 0) = (poly pc (complex_of_real t) = 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(poly g ?t = 0) = (poly pc (complex_of_real ?t) = 0)

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
have "?R = (changes_itv_smods 0 1 g (pderiv g) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False) = (changes_itv_smods 0 1 g (pderiv g) = 0)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0

goal (1 subgoal):
 1. (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False) = (changes_itv_smods 0 1 g (pderiv g) = 0)
[PROOF STEP]
unfolding pc_def g_def pI_def pR_def
[PROOF STATE]
proof (prove)
using this:
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0

goal (1 subgoal):
 1. (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False) = (changes_itv_smods 0 1 (gcd (map_poly Re (p \<circ>\<^sub>p [:st, tt - st:])) (map_poly Im (p \<circ>\<^sub>p [:st, tt - st:]))) (pderiv (gcd (map_poly Re (p \<circ>\<^sub>p [:st, tt - st:])) (map_poly Im (p \<circ>\<^sub>p [:st, tt - st:])))) = 0)
[PROOF STEP]
by (auto simp add:Let_def)
[PROOF STATE]
proof (state)
this:
(if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False) = (changes_itv_smods 0 1 g (pderiv g) = 0)

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False) = (changes_itv_smods 0 1 g (pderiv g) = 0)

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
have "... = (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (changes_itv_smods 0 1 g (pderiv g) = 0) = (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (changes_itv_smods 0 1 g (pderiv g) = 0) = (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0)
[PROOF STEP]
have "poly g 0 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly g 0 \<noteq> 0
[PROOF STEP]
using poly_iff[of 0] True
[PROOF STATE]
proof (prove)
using this:
(poly g 0 = 0) = (poly pc (complex_of_real 0) = 0)
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0

goal (1 subgoal):
 1. poly g 0 \<noteq> 0
[PROOF STEP]
unfolding pc_def
[PROOF STATE]
proof (prove)
using this:
(poly g 0 = 0) = (poly (p \<circ>\<^sub>p [:st, tt - st:]) (complex_of_real 0) = 0)
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0

goal (1 subgoal):
 1. poly g 0 \<noteq> 0
[PROOF STEP]
by (auto simp add:poly_pcompose)
[PROOF STATE]
proof (state)
this:
poly g 0 \<noteq> 0

goal (1 subgoal):
 1. (changes_itv_smods 0 1 g (pderiv g) = 0) = (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
poly g 0 \<noteq> 0

goal (1 subgoal):
 1. (changes_itv_smods 0 1 g (pderiv g) = 0) = (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0)
[PROOF STEP]
have "poly g 1 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly g 1 \<noteq> 0
[PROOF STEP]
using poly_iff[of 1] True
[PROOF STATE]
proof (prove)
using this:
(poly g 1 = 0) = (poly pc (complex_of_real 1) = 0)
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0

goal (1 subgoal):
 1. poly g 1 \<noteq> 0
[PROOF STEP]
unfolding pc_def
[PROOF STATE]
proof (prove)
using this:
(poly g 1 = 0) = (poly (p \<circ>\<^sub>p [:st, tt - st:]) (complex_of_real 1) = 0)
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0

goal (1 subgoal):
 1. poly g 1 \<noteq> 0
[PROOF STEP]
by (auto simp add:poly_pcompose)
[PROOF STATE]
proof (state)
this:
poly g 1 \<noteq> 0

goal (1 subgoal):
 1. (changes_itv_smods 0 1 g (pderiv g) = 0) = (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
poly g 0 \<noteq> 0
poly g 1 \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly g 0 \<noteq> 0
poly g 1 \<noteq> 0

goal (1 subgoal):
 1. (changes_itv_smods 0 1 g (pderiv g) = 0) = (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0)
[PROOF STEP]
using sturm_interval[of 0 1 g]
[PROOF STATE]
proof (prove)
using this:
poly g 0 \<noteq> 0
poly g 1 \<noteq> 0
\<lbrakk>0 < 1; poly g 0 \<noteq> 0; poly g 1 \<noteq> 0\<rbrakk> \<Longrightarrow> int (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1}) = changes_itv_smods 0 1 g (pderiv g)

goal (1 subgoal):
 1. (changes_itv_smods 0 1 g (pderiv g) = 0) = (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(changes_itv_smods 0 1 g (pderiv g) = 0) = (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(changes_itv_smods 0 1 g (pderiv g) = 0) = (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0)

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(changes_itv_smods 0 1 g (pderiv g) = 0) = (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0)

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
have "... = ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0) = ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0) = ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {})
[PROOF STEP]
have "g\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<noteq> 0
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> g \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
assume "\<not> g \<noteq> 0"
[PROOF STATE]
proof (state)
this:
\<not> g \<noteq> 0

goal (1 subgoal):
 1. \<not> g \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> g \<noteq> 0
[PROOF STEP]
have "poly pc 0 =0"
[PROOF STATE]
proof (prove)
using this:
\<not> g \<noteq> 0

goal (1 subgoal):
 1. poly pc 0 = 0
[PROOF STEP]
using poly_iff[of 0]
[PROOF STATE]
proof (prove)
using this:
\<not> g \<noteq> 0
(poly g 0 = 0) = (poly pc (complex_of_real 0) = 0)

goal (1 subgoal):
 1. poly pc 0 = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly pc 0 = 0

goal (1 subgoal):
 1. \<not> g \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
poly pc 0 = 0
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
poly pc 0 = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
poly pc 0 = 0
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding pc_def
[PROOF STATE]
proof (prove)
using this:
poly (p \<circ>\<^sub>p [:st, tt - st:]) 0 = 0
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0

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

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

goal (1 subgoal):
 1. (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0) = ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {})
[PROOF STEP]
from poly_roots_finite[OF this]
[PROOF STATE]
proof (chain)
picking this:
finite {x. poly g x = 0}
[PROOF STEP]
have "finite {x. poly g x = 0 \<and> 0 < x \<and> x < 1}"
[PROOF STATE]
proof (prove)
using this:
finite {x. poly g x = 0}

goal (1 subgoal):
 1. finite {x. poly g x = 0 \<and> 0 < x \<and> x < 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {x. poly g x = 0 \<and> 0 < x \<and> x < 1}

goal (1 subgoal):
 1. (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0) = ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite {x. poly g x = 0 \<and> 0 < x \<and> x < 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {x. poly g x = 0 \<and> 0 < x \<and> x < 1}

goal (1 subgoal):
 1. (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0) = ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {})
[PROOF STEP]
using card_eq_0_iff
[PROOF STATE]
proof (prove)
using this:
finite {x. poly g x = 0 \<and> 0 < x \<and> x < 1}
(card ?A = 0) = (?A = {} \<or> infinite ?A)

goal (1 subgoal):
 1. (card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0) = ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0) = ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0) = ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {})

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(card {x. poly g x = 0 \<and> 0 < x \<and> x < 1} = 0) = ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {})

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
have "... = ?L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {}) = no_proots_line p st tt
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {}) = no_proots_line p st tt
[PROOF STEP]
have "(\<exists>t. poly g (of_real t) = 0 \<and> 0 < t \<and> t < 1) \<longleftrightarrow>
          (\<exists>t::real. poly pc (of_real t) = 0 \<and> 0 < t \<and> t < 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>t. poly g (of_real t) = 0 \<and> 0 < t \<and> t < 1) = (\<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1)
[PROOF STEP]
using poly_iff
[PROOF STATE]
proof (prove)
using this:
(poly g ?t = 0) = (poly pc (complex_of_real ?t) = 0)

goal (1 subgoal):
 1. (\<exists>t. poly g (of_real t) = 0 \<and> 0 < t \<and> t < 1) = (\<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<exists>t. poly g (of_real t) = 0 \<and> 0 < t \<and> t < 1) = (\<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1)

goal (1 subgoal):
 1. ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {}) = no_proots_line p st tt
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>t. poly g (of_real t) = 0 \<and> 0 < t \<and> t < 1) = (\<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1)

goal (1 subgoal):
 1. ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {}) = no_proots_line p st tt
[PROOF STEP]
have "... \<longleftrightarrow> (\<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1) = (\<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1 \<Longrightarrow> \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0
 2. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
assume "\<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1"
[PROOF STATE]
proof (state)
this:
\<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1

goal (2 subgoals):
 1. \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1 \<Longrightarrow> \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0
 2. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
obtain t where *:"poly pc (of_real t) = 0" and "0 < t" "t < 1"
[PROOF STATE]
proof (prove)
using this:
\<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>poly pc (complex_of_real t) = 0; 0 < t; t < 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly pc (complex_of_real t) = 0
0 < t
t < 1

goal (2 subgoals):
 1. \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1 \<Longrightarrow> \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0
 2. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
define x where "x=poly [:st, tt - st:] t"
[PROOF STATE]
proof (state)
this:
x = poly [:st, tt - st:] (complex_of_real t)

goal (2 subgoals):
 1. \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1 \<Longrightarrow> \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0
 2. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
have "x \<in> closed_segment st tt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> closed_segment st tt
[PROOF STEP]
using \<open>0<t\<close> \<open>t<1\<close>
[PROOF STATE]
proof (prove)
using this:
0 < t
t < 1

goal (1 subgoal):
 1. x \<in> closed_segment st tt
[PROOF STEP]
unfolding x_def in_segment
[PROOF STATE]
proof (prove)
using this:
0 < t
t < 1

goal (1 subgoal):
 1. \<exists>u\<ge>0. u \<le> 1 \<and> poly [:st, tt - st:] (complex_of_real t) = (1 - u) *\<^sub>R st + u *\<^sub>R tt
[PROOF STEP]
by (intro exI[where x=t],auto simp add: algebra_simps scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
x \<in> closed_segment st tt

goal (2 subgoals):
 1. \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1 \<Longrightarrow> \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0
 2. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> closed_segment st tt

goal (2 subgoals):
 1. \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1 \<Longrightarrow> \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0
 2. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
have "poly p x=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p x = 0
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
poly pc (complex_of_real t) = 0

goal (1 subgoal):
 1. poly p x = 0
[PROOF STEP]
unfolding pc_def x_def
[PROOF STATE]
proof (prove)
using this:
poly (p \<circ>\<^sub>p [:st, tt - st:]) (complex_of_real t) = 0

goal (1 subgoal):
 1. poly p (poly [:st, tt - st:] (complex_of_real t)) = 0
[PROOF STEP]
by (auto simp add:poly_pcompose)
[PROOF STATE]
proof (state)
this:
poly p x = 0

goal (2 subgoals):
 1. \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1 \<Longrightarrow> \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0
 2. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> closed_segment st tt
poly p x = 0
[PROOF STEP]
show "\<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0"
[PROOF STATE]
proof (prove)
using this:
x \<in> closed_segment st tt
poly p x = 0

goal (1 subgoal):
 1. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0

goal (1 subgoal):
 1. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
assume "\<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0"
[PROOF STATE]
proof (state)
this:
\<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0

goal (1 subgoal):
 1. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0
[PROOF STEP]
obtain x where "x \<in> closed_segment st tt" "poly p x = 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> closed_segment st tt; poly p x = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> closed_segment st tt
poly p x = 0

goal (1 subgoal):
 1. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> closed_segment st tt
poly p x = 0
[PROOF STEP]
obtain t::real where *:"x = (1 - t) *\<^sub>R st + t *\<^sub>R tt" and "0\<le>t" "t\<le>1"
[PROOF STATE]
proof (prove)
using this:
x \<in> closed_segment st tt
poly p x = 0

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>x = (1 - t) *\<^sub>R st + t *\<^sub>R tt; 0 \<le> t; t \<le> 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding in_segment
[PROOF STATE]
proof (prove)
using this:
\<exists>u\<ge>0. u \<le> 1 \<and> x = (1 - u) *\<^sub>R st + u *\<^sub>R tt
poly p x = 0

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>x = (1 - t) *\<^sub>R st + t *\<^sub>R tt; 0 \<le> t; t \<le> 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = (1 - t) *\<^sub>R st + t *\<^sub>R tt
0 \<le> t
t \<le> 1

goal (1 subgoal):
 1. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = (1 - t) *\<^sub>R st + t *\<^sub>R tt
0 \<le> t
t \<le> 1
[PROOF STEP]
have "x=poly [:st, tt - st:] t"
[PROOF STATE]
proof (prove)
using this:
x = (1 - t) *\<^sub>R st + t *\<^sub>R tt
0 \<le> t
t \<le> 1

goal (1 subgoal):
 1. x = poly [:st, tt - st:] (complex_of_real t)
[PROOF STEP]
by (auto simp add: algebra_simps scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
x = poly [:st, tt - st:] (complex_of_real t)

goal (1 subgoal):
 1. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = poly [:st, tt - st:] (complex_of_real t)
[PROOF STEP]
have "poly pc (complex_of_real t) = 0"
[PROOF STATE]
proof (prove)
using this:
x = poly [:st, tt - st:] (complex_of_real t)

goal (1 subgoal):
 1. poly pc (complex_of_real t) = 0
[PROOF STEP]
using \<open>poly p x=0\<close>
[PROOF STATE]
proof (prove)
using this:
x = poly [:st, tt - st:] (complex_of_real t)
poly p x = 0

goal (1 subgoal):
 1. poly pc (complex_of_real t) = 0
[PROOF STEP]
unfolding pc_def
[PROOF STATE]
proof (prove)
using this:
x = poly [:st, tt - st:] (complex_of_real t)
poly p x = 0

goal (1 subgoal):
 1. poly (p \<circ>\<^sub>p [:st, tt - st:]) (complex_of_real t) = 0
[PROOF STEP]
by (auto simp add:poly_pcompose)
[PROOF STATE]
proof (state)
this:
poly pc (complex_of_real t) = 0

goal (1 subgoal):
 1. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
poly pc (complex_of_real t) = 0

goal (1 subgoal):
 1. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
have "t\<noteq>0" "t\<noteq>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<noteq> 0 &&& t \<noteq> 1
[PROOF STEP]
using True *  \<open>poly p x=0\<close>
[PROOF STATE]
proof (prove)
using this:
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0
x = (1 - t) *\<^sub>R st + t *\<^sub>R tt
poly p x = 0

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

goal (1 subgoal):
 1. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<noteq> 0
t \<noteq> 1
[PROOF STEP]
have "0<t" "t<1"
[PROOF STATE]
proof (prove)
using this:
t \<noteq> 0
t \<noteq> 1

goal (1 subgoal):
 1. 0 < t &&& t < 1
[PROOF STEP]
using \<open>0\<le>t\<close> \<open>t\<le>1\<close>
[PROOF STATE]
proof (prove)
using this:
t \<noteq> 0
t \<noteq> 1
0 \<le> t
t \<le> 1

goal (1 subgoal):
 1. 0 < t &&& t < 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < t
t < 1

goal (1 subgoal):
 1. \<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0 \<Longrightarrow> \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
poly pc (complex_of_real t) = 0
0 < t
t < 1
[PROOF STEP]
show "\<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1"
[PROOF STATE]
proof (prove)
using this:
poly pc (complex_of_real t) = 0
0 < t
t < 1

goal (1 subgoal):
 1. \<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<exists>t. poly pc (complex_of_real t) = 0 \<and> 0 < t \<and> t < 1) = (\<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0)

goal (1 subgoal):
 1. ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {}) = no_proots_line p st tt
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<exists>t. poly g (of_real t) = 0 \<and> 0 < t \<and> t < 1) = (\<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<exists>t. poly g (of_real t) = 0 \<and> 0 < t \<and> t < 1) = (\<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0)

goal (1 subgoal):
 1. ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {}) = no_proots_line p st tt
[PROOF STEP]
unfolding no_proots_line_def proots_within_def
[PROOF STATE]
proof (prove)
using this:
(\<exists>t. poly g (of_real t) = 0 \<and> 0 < t \<and> t < 1) = (\<exists>x. x \<in> closed_segment st tt \<and> poly p x = 0)

goal (1 subgoal):
 1. ({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {}) = ({x \<in> closed_segment st tt. poly p x = 0} = {})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {}) = no_proots_line p st tt

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
({x. poly g (of_real x) = 0 \<and> 0 < x \<and> x < 1} = {}) = no_proots_line p st tt

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<Longrightarrow> no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False) = no_proots_line p st tt
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False) = no_proots_line p st tt

goal (1 subgoal):
 1. no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
no_proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in if changes_itv_smods 0 1 g (pderiv g) = 0 then True else False else False)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma indspaceD_transform :
  "\<lbrakk>f \<in> indspace G FH V; g\<in>G; x\<in>FH \<rbrakk> \<Longrightarrow> f ( a \<delta>\<delta> g * x ) = (a \<delta>\<delta> g) \<cdot> (f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> indspace G FH V; g \<in> G; x \<in> FH\<rbrakk> \<Longrightarrow> f (a \<delta>\<delta> g * x) = (a \<delta>\<delta> g) \<cdot> f x
[PROOF STEP]
using indspace_def smultfunsetD
[PROOF STATE]
proof (prove)
using this:
indspace ?G ?FH ?V = addfunset ?FH ?V \<inter> smultfunset ?G ?FH
\<lbrakk>?f \<in> smultfunset ?G ?FH; ?g \<in> ?G; ?x \<in> ?FH\<rbrakk> \<Longrightarrow> ?f (?a \<delta>\<delta> ?g * ?x) = (?a \<delta>\<delta> ?g) \<cdot> ?f ?x

goal (1 subgoal):
 1. \<lbrakk>f \<in> indspace G FH V; g \<in> G; x \<in> FH\<rbrakk> \<Longrightarrow> f (a \<delta>\<delta> g * x) = (a \<delta>\<delta> g) \<cdot> f x
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_iff_card_of_natLeq_on:
"finite A = (\<exists>n. |A| =o natLeq_on n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A = (\<exists>n. |A| =o natLeq_on n)
[PROOF STEP]
using finite_imp_card_of_natLeq_on[of A]
[PROOF STATE]
proof (prove)
using this:
finite A \<Longrightarrow> |A| =o natLeq_on (card A)

goal (1 subgoal):
 1. finite A = (\<exists>n. |A| =o natLeq_on n)
[PROOF STEP]
by(auto simp add: ordIso_natLeq_on_imp_finite)


[STATEMENT]
lemma cfun_meet_simp[simp]: "(f \<squnion> g) \<cdot> x = f \<cdot> x \<squnion> (g \<cdot> x::'a::Finite_Join_cpo)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<squnion> g)\<cdot>x = f\<cdot>x \<squnion> g\<cdot>x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f \<squnion> g)\<cdot>x = f\<cdot>x \<squnion> g\<cdot>x
[PROOF STEP]
have "f \<squnion> g = (\<Lambda> x. f \<cdot> x \<squnion> g \<cdot> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<squnion> g = (\<Lambda> x. f\<cdot>x \<squnion> g\<cdot>x)
[PROOF STEP]
by (rule is_joinI)(auto simp add: cfun_below_iff)
[PROOF STATE]
proof (state)
this:
f \<squnion> g = (\<Lambda> x. f\<cdot>x \<squnion> g\<cdot>x)

goal (1 subgoal):
 1. (f \<squnion> g)\<cdot>x = f\<cdot>x \<squnion> g\<cdot>x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<squnion> g = (\<Lambda> x. f\<cdot>x \<squnion> g\<cdot>x)

goal (1 subgoal):
 1. (f \<squnion> g)\<cdot>x = f\<cdot>x \<squnion> g\<cdot>x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(f \<squnion> g)\<cdot>x = f\<cdot>x \<squnion> g\<cdot>x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_pi_i [simp]: "exp (of_real pi * \<i>) = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (complex_of_real pi * \<i>) = - 1
[PROOF STEP]
by (metis cis_conv_exp cis_pi mult.commute)


[STATEMENT]
lemma lformula_NFOR: "finite \<Phi> \<Longrightarrow> lformula (NFOR \<Phi>) = (\<forall>\<phi> \<in> \<Phi>. lformula \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite \<Phi> \<Longrightarrow> lformula (NFOR \<Phi>) = Ball \<Phi> lformula
[PROOF STEP]
unfolding NFOR_def o_apply lformula_nFOR
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite \<Phi> \<Longrightarrow> Ball (set (sorted_list_of_set \<Phi>)) lformula = Ball \<Phi> lformula
[PROOF STEP]
by simp


[STATEMENT]
lemma has_derivative_prod[simp, derivative_intros]:
  fixes f :: "'i \<Rightarrow> 'a::real_normed_vector \<Rightarrow> 'b::real_normed_field"
  shows "(\<And>i. i \<in> I \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow>
    ((\<lambda>x. \<Prod>i\<in>I. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x))) (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>I. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x))) (at x within S)
[PROOF STEP]
proof (induct I rule: infinite_finite_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>A. \<lbrakk>infinite A; \<And>i. i \<in> A \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>A. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>A. f' i y * (\<Prod>j\<in>A - {i}. f j x))) (at x within S)
 2. (\<And>i. i \<in> {} \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>{}. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>{}. f' i y * (\<Prod>j\<in>{} - {i}. f j x))) (at x within S)
 3. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>F. f' i y * (\<Prod>j\<in>F - {i}. f j x))) (at x within S); \<And>i. i \<in> insert xa F \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>insert xa F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>insert xa F. f' i y * (\<Prod>j\<in>insert xa F - {i}. f j x))) (at x within S)
[PROOF STEP]
case infinite
[PROOF STATE]
proof (state)
this:
infinite A_
?i \<in> A_ \<Longrightarrow> (f ?i has_derivative f' ?i) (at x within S)

goal (3 subgoals):
 1. \<And>A. \<lbrakk>infinite A; \<And>i. i \<in> A \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>A. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>A. f' i y * (\<Prod>j\<in>A - {i}. f j x))) (at x within S)
 2. (\<And>i. i \<in> {} \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>{}. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>{}. f' i y * (\<Prod>j\<in>{} - {i}. f j x))) (at x within S)
 3. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>F. f' i y * (\<Prod>j\<in>F - {i}. f j x))) (at x within S); \<And>i. i \<in> insert xa F \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>insert xa F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>insert xa F. f' i y * (\<Prod>j\<in>insert xa F - {i}. f j x))) (at x within S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite A_
?i \<in> A_ \<Longrightarrow> (f ?i has_derivative f' ?i) (at x within S)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
infinite A_
?i \<in> A_ \<Longrightarrow> (f ?i has_derivative f' ?i) (at x within S)

goal (1 subgoal):
 1. ((\<lambda>x. \<Prod>i\<in>A_. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>A_. f' i y * (\<Prod>j\<in>A_ - {i}. f j x))) (at x within S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Prod>i\<in>A_. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>A_. f' i y * (\<Prod>j\<in>A_ - {i}. f j x))) (at x within S)

goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>{}. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>{}. f' i y * (\<Prod>j\<in>{} - {i}. f j x))) (at x within S)
 2. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>F. f' i y * (\<Prod>j\<in>F - {i}. f j x))) (at x within S); \<And>i. i \<in> insert xa F \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>insert xa F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>insert xa F. f' i y * (\<Prod>j\<in>insert xa F - {i}. f j x))) (at x within S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>{}. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>{}. f' i y * (\<Prod>j\<in>{} - {i}. f j x))) (at x within S)
 2. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>F. f' i y * (\<Prod>j\<in>F - {i}. f j x))) (at x within S); \<And>i. i \<in> insert xa F \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>insert xa F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>insert xa F. f' i y * (\<Prod>j\<in>insert xa F - {i}. f j x))) (at x within S)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
?i \<in> {} \<Longrightarrow> (f ?i has_derivative f' ?i) (at x within S)

goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>{}. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>{}. f' i y * (\<Prod>j\<in>{} - {i}. f j x))) (at x within S)
 2. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>F. f' i y * (\<Prod>j\<in>F - {i}. f j x))) (at x within S); \<And>i. i \<in> insert xa F \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>insert xa F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>insert xa F. f' i y * (\<Prod>j\<in>insert xa F - {i}. f j x))) (at x within S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i \<in> {} \<Longrightarrow> (f ?i has_derivative f' ?i) (at x within S)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?i \<in> {} \<Longrightarrow> (f ?i has_derivative f' ?i) (at x within S)

goal (1 subgoal):
 1. ((\<lambda>x. \<Prod>i\<in>{}. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>{}. f' i y * (\<Prod>j\<in>{} - {i}. f j x))) (at x within S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Prod>i\<in>{}. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>{}. f' i y * (\<Prod>j\<in>{} - {i}. f j x))) (at x within S)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>F. f' i y * (\<Prod>j\<in>F - {i}. f j x))) (at x within S); \<And>i. i \<in> insert xa F \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>insert xa F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>insert xa F. f' i y * (\<Prod>j\<in>insert xa F - {i}. f j x))) (at x within S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>F. f' i y * (\<Prod>j\<in>F - {i}. f j x))) (at x within S); \<And>i. i \<in> insert xa F \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>insert xa F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>insert xa F. f' i y * (\<Prod>j\<in>insert xa F - {i}. f j x))) (at x within S)
[PROOF STEP]
case (insert i I)
[PROOF STATE]
proof (state)
this:
finite I
i \<notin> I
(\<And>i. i \<in> I \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>I. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x))) (at x within S)
?i \<in> insert i I \<Longrightarrow> (f ?i has_derivative f' ?i) (at x within S)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>F. f' i y * (\<Prod>j\<in>F - {i}. f j x))) (at x within S); \<And>i. i \<in> insert xa F \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>insert xa F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>insert xa F. f' i y * (\<Prod>j\<in>insert xa F - {i}. f j x))) (at x within S)
[PROOF STEP]
let ?P = "\<lambda>y. f i x * (\<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x)) + (f' i y) * (\<Prod>i\<in>I. f i x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>F. f' i y * (\<Prod>j\<in>F - {i}. f j x))) (at x within S); \<And>i. i \<in> insert xa F \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>insert xa F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>insert xa F. f' i y * (\<Prod>j\<in>insert xa F - {i}. f j x))) (at x within S)
[PROOF STEP]
have "((\<lambda>x. f i x * (\<Prod>i\<in>I. f i x)) has_derivative ?P) (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f i x * (\<Prod>i\<in>I. f i x)) has_derivative (\<lambda>y. f i x * (\<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x)) + f' i y * (\<Prod>i\<in>I. f i x))) (at x within S)
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite I
i \<notin> I
(\<And>i. i \<in> I \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>I. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x))) (at x within S)
?i \<in> insert i I \<Longrightarrow> (f ?i has_derivative f' ?i) (at x within S)

goal (1 subgoal):
 1. ((\<lambda>x. f i x * (\<Prod>i\<in>I. f i x)) has_derivative (\<lambda>y. f i x * (\<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x)) + f' i y * (\<Prod>i\<in>I. f i x))) (at x within S)
[PROOF STEP]
by (intro has_derivative_mult) auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f i x * (\<Prod>i\<in>I. f i x)) has_derivative (\<lambda>y. f i x * (\<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x)) + f' i y * (\<Prod>i\<in>I. f i x))) (at x within S)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>F. f' i y * (\<Prod>j\<in>F - {i}. f j x))) (at x within S); \<And>i. i \<in> insert xa F \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>insert xa F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>insert xa F. f' i y * (\<Prod>j\<in>insert xa F - {i}. f j x))) (at x within S)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f i x * (\<Prod>i\<in>I. f i x)) has_derivative (\<lambda>y. f i x * (\<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x)) + f' i y * (\<Prod>i\<in>I. f i x))) (at x within S)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>F. f' i y * (\<Prod>j\<in>F - {i}. f j x))) (at x within S); \<And>i. i \<in> insert xa F \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>insert xa F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>insert xa F. f' i y * (\<Prod>j\<in>insert xa F - {i}. f j x))) (at x within S)
[PROOF STEP]
have "?P = (\<lambda>y. \<Sum>i'\<in>insert i I. f' i' y * (\<Prod>j\<in>insert i I - {i'}. f j x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y. f i x * (\<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x)) + f' i y * (\<Prod>i\<in>I. f i x)) = (\<lambda>y. \<Sum>i'\<in>insert i I. f' i' y * (\<Prod>j\<in>insert i I - {i'}. f j x))
[PROOF STEP]
using insert(1,2)
[PROOF STATE]
proof (prove)
using this:
finite I
i \<notin> I

goal (1 subgoal):
 1. (\<lambda>y. f i x * (\<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x)) + f' i y * (\<Prod>i\<in>I. f i x)) = (\<lambda>y. \<Sum>i'\<in>insert i I. f' i' y * (\<Prod>j\<in>insert i I - {i'}. f j x))
[PROOF STEP]
by (auto simp add: sum_distrib_left insert_Diff_if intro!: ext sum.cong)
[PROOF STATE]
proof (state)
this:
(\<lambda>y. f i x * (\<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x)) + f' i y * (\<Prod>i\<in>I. f i x)) = (\<lambda>y. \<Sum>i'\<in>insert i I. f' i' y * (\<Prod>j\<in>insert i I - {i'}. f j x))

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>F. f' i y * (\<Prod>j\<in>F - {i}. f j x))) (at x within S); \<And>i. i \<in> insert xa F \<Longrightarrow> (f i has_derivative f' i) (at x within S)\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>insert xa F. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>insert xa F. f' i y * (\<Prod>j\<in>insert xa F - {i}. f j x))) (at x within S)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. f i x * (\<Prod>i\<in>I. f i x)) has_derivative (\<lambda>y. \<Sum>i'\<in>insert i I. f' i' y * (\<Prod>j\<in>insert i I - {i'}. f j x))) (at x within S)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f i x * (\<Prod>i\<in>I. f i x)) has_derivative (\<lambda>y. \<Sum>i'\<in>insert i I. f' i' y * (\<Prod>j\<in>insert i I - {i'}. f j x))) (at x within S)

goal (1 subgoal):
 1. ((\<lambda>x. \<Prod>i\<in>insert i I. f i x) has_derivative (\<lambda>y. \<Sum>ia\<in>insert i I. f' ia y * (\<Prod>j\<in>insert i I - {ia}. f j x))) (at x within S)
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f i x * (\<Prod>i\<in>I. f i x)) has_derivative (\<lambda>y. \<Sum>i'\<in>insert i I. f' i' y * (\<Prod>j\<in>insert i I - {i'}. f j x))) (at x within S)
finite I
i \<notin> I
(\<And>i. i \<in> I \<Longrightarrow> (f i has_derivative f' i) (at x within S)) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>I. f i x) has_derivative (\<lambda>y. \<Sum>i\<in>I. f' i y * (\<Prod>j\<in>I - {i}. f j x))) (at x within S)
?i \<in> insert i I \<Longrightarrow> (f ?i has_derivative f' ?i) (at x within S)

goal (1 subgoal):
 1. ((\<lambda>x. \<Prod>i\<in>insert i I. f i x) has_derivative (\<lambda>y. \<Sum>ia\<in>insert i I. f' ia y * (\<Prod>j\<in>insert i I - {ia}. f j x))) (at x within S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Prod>i\<in>insert i I. f i x) has_derivative (\<lambda>y. \<Sum>ia\<in>insert i I. f' ia y * (\<Prod>j\<in>insert i I - {ia}. f j x))) (at x within S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Module) monofun_sprod:"\<lbrakk>R module N; free_generator R M H;
      f \<in> H \<rightarrow> carrier N; h \<in> H; x \<in> fgs R M {h}; a \<in> carrier R\<rbrakk> \<Longrightarrow>
      monofun R M N f H h ( a \<cdot>\<^sub>s x) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> (monofun R M N f H h x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; free_generator R M H; f \<in> H \<rightarrow> carrier N; h \<in> H; x \<in> fgs R M {h}; a \<in> carrier R\<rbrakk> \<Longrightarrow> monofun R M N f H h (a \<cdot>\<^sub>s x) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> monofun R M N f H h x
[PROOF STEP]
apply (frule free_generator_sub,
       cut_tac sc_Ring,
       frule subsetD[of H "carrier M" h], assumption+,
       frule fgs_single_span[of h x], assumption+,
       erule bexE, simp add:sc_assoc[THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa. \<lbrakk>R module N; free_generator R M H; f \<in> H \<rightarrow> carrier N; h \<in> H; aa \<cdot>\<^sub>s h \<in> fgs R M {h}; a \<in> carrier R; H \<subseteq> carrier M; Ring R; h \<in> carrier M; aa \<in> carrier R; x = aa \<cdot>\<^sub>s h\<rbrakk> \<Longrightarrow> monofun R M N f H h ((a \<cdot>\<^sub>r\<^bsub>R\<^esub> aa) \<cdot>\<^sub>s h) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> monofun R M N f H h (aa \<cdot>\<^sub>s h)
[PROOF STEP]
apply (frule_tac x = a and y = aa in Ring.ring_tOp_closed, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa. \<lbrakk>R module N; free_generator R M H; f \<in> H \<rightarrow> carrier N; h \<in> H; aa \<cdot>\<^sub>s h \<in> fgs R M {h}; a \<in> carrier R; H \<subseteq> carrier M; Ring R; h \<in> carrier M; aa \<in> carrier R; x = aa \<cdot>\<^sub>s h; a \<cdot>\<^sub>r\<^bsub>R\<^esub> aa \<in> carrier R\<rbrakk> \<Longrightarrow> monofun R M N f H h ((a \<cdot>\<^sub>r\<^bsub>R\<^esub> aa) \<cdot>\<^sub>s h) = a \<cdot>\<^sub>s\<^bsub>N\<^esub> monofun R M N f H h (aa \<cdot>\<^sub>s h)
[PROOF STEP]
apply (simp add:monofun_mhomTr1,
       frule funcset_mem[of f H "carrier N" h], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa. \<lbrakk>R module N; free_generator R M H; f \<in> H \<rightarrow> carrier N; h \<in> H; aa \<cdot>\<^sub>s h \<in> fgs R M {h}; a \<in> carrier R; H \<subseteq> carrier M; Ring R; h \<in> carrier M; aa \<in> carrier R; x = aa \<cdot>\<^sub>s h; a \<cdot>\<^sub>r\<^bsub>R\<^esub> aa \<in> carrier R; f h \<in> carrier N\<rbrakk> \<Longrightarrow> (a \<cdot>\<^sub>r\<^bsub>R\<^esub> aa) \<cdot>\<^sub>s\<^bsub>N\<^esub> f h = a \<cdot>\<^sub>s\<^bsub>N\<^esub> (aa \<cdot>\<^sub>s\<^bsub>N\<^esub> f h)
[PROOF STEP]
apply (simp add:Module.sc_assoc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma HMA_M_mk_vec[transfer_rule]: "((HMA_I ===> (=)) ===> HMA_V)
  (\<lambda> f. Matrix.vec (CARD('n)) (\<lambda> i. f i))
  (mk_vec :: (('n \<Rightarrow> 'a) \<Rightarrow> 'a^'n:: mod_type))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((Mod_Type_Connect.HMA_I ===> (=)) ===> Mod_Type_Connect.HMA_V) (Matrix.vec CARD('n)) HMA_Connect.mk_vec
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((Mod_Type_Connect.HMA_I ===> (=)) ===> Mod_Type_Connect.HMA_V) (Matrix.vec CARD('n)) HMA_Connect.mk_vec
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((Mod_Type_Connect.HMA_I ===> (=)) ===> Mod_Type_Connect.HMA_V) (Matrix.vec CARD('n)) HMA_Connect.mk_vec
[PROOF STEP]
fix x y i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((Mod_Type_Connect.HMA_I ===> (=)) ===> Mod_Type_Connect.HMA_V) (Matrix.vec CARD('n)) HMA_Connect.mk_vec
[PROOF STEP]
assume id: "\<forall> (ya :: 'n). (x (to_nat ya) :: 'a) = y ya"
       and i: "i < CARD('n)"
[PROOF STATE]
proof (state)
this:
\<forall>ya. x (mod_type_class.to_nat ya) = y ya
i < CARD('n)

goal (1 subgoal):
 1. ((Mod_Type_Connect.HMA_I ===> (=)) ===> Mod_Type_Connect.HMA_V) (Matrix.vec CARD('n)) HMA_Connect.mk_vec
[PROOF STEP]
from to_nat_from_nat_id[OF i] id[rule_format, of "from_nat i"]
[PROOF STATE]
proof (chain)
picking this:
mod_type_class.to_nat (mod_type_class.from_nat i) = i
x (mod_type_class.to_nat (mod_type_class.from_nat i)) = y (mod_type_class.from_nat i)
[PROOF STEP]
have "x i = y (from_nat i)"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat (mod_type_class.from_nat i) = i
x (mod_type_class.to_nat (mod_type_class.from_nat i)) = y (mod_type_class.from_nat i)

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

goal (1 subgoal):
 1. ((Mod_Type_Connect.HMA_I ===> (=)) ===> Mod_Type_Connect.HMA_V) (Matrix.vec CARD('n)) HMA_Connect.mk_vec
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>ya. ?x2 (mod_type_class.to_nat ya) = ?y2 ya; ?i2 < CARD('n)\<rbrakk> \<Longrightarrow> ?x2 ?i2 = ?y2 (mod_type_class.from_nat ?i2)

goal (1 subgoal):
 1. ((Mod_Type_Connect.HMA_I ===> (=)) ===> Mod_Type_Connect.HMA_V) (Matrix.vec CARD('n)) HMA_Connect.mk_vec
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>ya. ?x2 (mod_type_class.to_nat ya) = ?y2 ya; ?i2 < CARD('n)\<rbrakk> \<Longrightarrow> ?x2 ?i2 = ?y2 (mod_type_class.from_nat ?i2)

goal (1 subgoal):
 1. ((Mod_Type_Connect.HMA_I ===> (=)) ===> Mod_Type_Connect.HMA_V) (Matrix.vec CARD('n)) HMA_Connect.mk_vec
[PROOF STEP]
unfolding rel_fun_def mk_vec_def HMA_V_def HMA_I_def from_hma\<^sub>v_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>ya. ?x2 (mod_type_class.to_nat ya) = ?y2 ya; ?i2 < CARD('n)\<rbrakk> \<Longrightarrow> ?x2 ?i2 = ?y2 (mod_type_class.from_nat ?i2)

goal (1 subgoal):
 1. \<forall>x y. (\<forall>xa ya. xa = mod_type_class.to_nat ya \<longrightarrow> x xa = y ya) \<longrightarrow> Matrix.vec CARD('n) x = Matrix.vec CARD('n) (\<lambda>i. vec_lambda y $h mod_type_class.from_nat i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((Mod_Type_Connect.HMA_I ===> (=)) ===> Mod_Type_Connect.HMA_V) (Matrix.vec CARD('n)) HMA_Connect.mk_vec

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Fake_analz_insert:
     "X\<in> synth (analz G) ==>
      analz (insert X H) \<subseteq> synth (analz G) \<union> analz (G \<union> H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<in> synth (analz G) \<Longrightarrow> analz (insert X H) \<subseteq> synth (analz G) \<union> analz (G \<union> H)
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>X \<in> synth (analz G); x \<in> analz (insert X H)\<rbrakk> \<Longrightarrow> x \<in> synth (analz G) \<union> analz (G \<union> H)
[PROOF STEP]
apply (subgoal_tac "x \<in> analz (synth (analz G) \<union> H)", force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>X \<in> synth (analz G); x \<in> analz (insert X H)\<rbrakk> \<Longrightarrow> x \<in> analz (synth (analz G) \<union> H)
[PROOF STEP]
apply (blast intro: analz_mono [THEN [2] rev_subsetD] analz_mono [THEN synth_mono, THEN [2] rev_subsetD])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma prv_imp_neg_imp_neg_imp:
  assumes "\<phi> \<in> fmla" "\<chi> \<in> fmla"
    and "prv (neg \<phi>)"
  shows "prv ((imp \<chi> (neg (imp \<chi> \<phi>))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp \<chi> (neg (imp \<chi> \<phi>)))
[PROOF STEP]
by (metis assms fls imp neg_def prv_imp_com prv_imp_monoL)


[STATEMENT]
lemma arctan_monotone: "x < y \<Longrightarrow> arctan x < arctan y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < y \<Longrightarrow> arctan x < arctan y
[PROOF STEP]
by (simp only: arctan_less_iff)


[STATEMENT]
lemma i_join_i_shrink_iMOD: "
  0 < k \<Longrightarrow> (f \<longmapsto>\<^sub>i k) \<Join>\<^sub>i [n * k + (k - 1), mod k] = f \<div>\<^sub>i k \<Join>\<^sub>i [n\<dots>]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> f \<longmapsto> k \<Join>\<^sub> [ n * k + (k - 1), mod k ] = f \<div> k \<Join>\<^sub> [n\<dots>]
[PROOF STEP]
apply (rule i_join_i_shrink_iT_Plus_iT_Div_mod_subst[where I="[n * k, mod k]"])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. 0 < k \<Longrightarrow> 0 < k
 2. 0 < k \<Longrightarrow> [ n * k, mod k ] \<noteq> {}
 3. 0 < k \<Longrightarrow> \<forall>x\<in>[ n * k, mod k ]. x mod k = 0
 4. 0 < k \<Longrightarrow> [ n * k + (k - 1), mod k ] = [ n * k, mod k ] \<oplus> k - 1
 5. 0 < k \<Longrightarrow> [n\<dots>] = [ n * k, mod k ] \<oslash> k
[PROOF STEP]
apply (simp add: iMOD_not_empty iMOD_iff iMOD_add iMOD_div_ge)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ln_fact_conv_mangoldt: "ln (fact n) = (\<Sum>d=1..n. mangoldt d * floor (n / d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
have *: "(\<Sum>da=1..n. if primepow da \<and> da dvd d then ln (aprimedivisor da) else 0) =
             (\<Sum>(da::nat)=1..d. if primepow da \<and> da dvd d then ln (aprimedivisor da) else 0)"
    if d: "d \<in> {1..n}" for d
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)
[PROOF STEP]
by (rule sum.mono_neutral_right, insert d) (auto dest: dvd_imp_le)
[PROOF STATE]
proof (state)
this:
?d \<in> {1..n} \<Longrightarrow> (\<Sum>da = 1..n. if primepow da \<and> da dvd ?d then ln (real (aprimedivisor da)) else 0) = (\<Sum>da = 1..?d. if primepow da \<and> da dvd ?d then ln (real (aprimedivisor da)) else 0)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
have "(\<Sum>d=1..n. \<Sum>da=1..d. if primepow da \<and>
      da dvd d then ln (aprimedivisor da) else 0) =
      (\<Sum>d=1..n. \<Sum>da=1..n. if primepow da \<and>
      da dvd d then ln (aprimedivisor da) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. \<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)
[PROOF STEP]
by (rule sum.cong) (insert *, simp_all)
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. \<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. \<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
have "\<dots> = (\<Sum>da=1..n. \<Sum>d=1..n. if primepow da \<and>
                     da dvd d then ln (aprimedivisor da) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d = 1..n. \<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>da = 1..n. \<Sum>d = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)
[PROOF STEP]
by (rule sum.swap)
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. \<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>da = 1..n. \<Sum>d = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. \<Sum>da = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>da = 1..n. \<Sum>d = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
have "\<dots> = sum (\<lambda>d. mangoldt d * floor (n/d)) {1..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>da = 1..n. \<Sum>d = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
proof (rule sum.cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
fix d
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
assume d: "d \<in> {1..n}"
[PROOF STATE]
proof (state)
this:
d \<in> {1..n}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) =
            (\<Sum>da = 1..n. if d dvd da then mangoldt d else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = (\<Sum>da = 1..n. if d dvd da then mangoldt d else 0)
[PROOF STEP]
by (intro sum.cong) (simp_all add: mangoldt_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = (\<Sum>da = 1..n. if d dvd da then mangoldt d else 0)

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = (\<Sum>da = 1..n. if d dvd da then mangoldt d else 0)

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "\<dots> = mangoldt d * real (card {x. x \<in> {1..n} \<and> d dvd x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>da = 1..n. if d dvd da then mangoldt d else 0) = mangoldt d * real (card {x \<in> {1..n}. d dvd x})
[PROOF STEP]
by (subst sum.inter_filter [symmetric]) (simp_all add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. if d dvd da then mangoldt d else 0) = mangoldt d * real (card {x \<in> {1..n}. d dvd x})

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. if d dvd da then mangoldt d else 0) = mangoldt d * real (card {x \<in> {1..n}. d dvd x})

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. if d dvd da then mangoldt d else 0) = mangoldt d * real (card {x \<in> {1..n}. d dvd x})

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "{x. x \<in> {1..n} \<and> d dvd x} = {x. \<exists>k \<in>{1..n div d}. x=k*d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> {1..n}. d dvd x} = {x. \<exists>k\<in>{1..n div d}. x = k * d}
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>x \<in> {1..n}; d dvd x\<rbrakk> \<Longrightarrow> \<exists>k\<in>{1..n div d}. x = k * d
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 3. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>x \<in> {1..n}; d dvd x\<rbrakk> \<Longrightarrow> \<exists>k\<in>{1..n div d}. x = k * d
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 3. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
assume "x \<in> {1..n}" "d dvd x"
[PROOF STATE]
proof (state)
this:
x \<in> {1..n}
d dvd x

goal (3 subgoals):
 1. \<And>x. \<lbrakk>x \<in> {1..n}; d dvd x\<rbrakk> \<Longrightarrow> \<exists>k\<in>{1..n div d}. x = k * d
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 3. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
thus "\<exists>k\<in>{1..n div d}. x = k * d"
[PROOF STATE]
proof (prove)
using this:
x \<in> {1..n}
d dvd x

goal (1 subgoal):
 1. \<exists>k\<in>{1..n div d}. x = k * d
[PROOF STEP]
using divisors[of x n d]
[PROOF STATE]
proof (prove)
using this:
x \<in> {1..n}
d dvd x
\<lbrakk>x \<in> {1..n}; d dvd x\<rbrakk> \<Longrightarrow> \<exists>k\<in>{1..n div d}. x = d * k

goal (1 subgoal):
 1. \<exists>k\<in>{1..n div d}. x = k * d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>k\<in>{1..n div d}. x = k * d

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
fix x k
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
assume k: "k \<in> {1..n div d}"
[PROOF STATE]
proof (state)
this:
k \<in> {1..n div d}

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
from k
[PROOF STATE]
proof (chain)
picking this:
k \<in> {1..n div d}
[PROOF STEP]
have "k * d \<le> n div d * d"
[PROOF STATE]
proof (prove)
using this:
k \<in> {1..n div d}

goal (1 subgoal):
 1. k * d \<le> n div d * d
[PROOF STEP]
by (intro mult_right_mono) simp_all
[PROOF STATE]
proof (state)
this:
k * d \<le> n div d * d

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k * d \<le> n div d * d

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
have "n div d * d \<le> n div d * d + n mod d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n div d * d \<le> n div d * d + n mod d
[PROOF STEP]
by (rule le_add1)
[PROOF STATE]
proof (state)
this:
n div d * d \<le> n div d * d + n mod d

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n div d * d \<le> n div d * d + n mod d

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
have "\<dots> = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n div d * d + n mod d = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n div d * d + n mod d = n

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
k * d \<le> n
[PROOF STEP]
have "k * d \<le> n"
[PROOF STATE]
proof (prove)
using this:
k * d \<le> n

goal (1 subgoal):
 1. k * d \<le> n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
k * d \<le> n

goal (2 subgoals):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> k * d \<in> {1..n}
 2. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
thus "k * d \<in> {1..n}"
[PROOF STATE]
proof (prove)
using this:
k * d \<le> n

goal (1 subgoal):
 1. k * d \<in> {1..n}
[PROOF STEP]
using d k
[PROOF STATE]
proof (prove)
using this:
k * d \<le> n
d \<in> {1..n}
k \<in> {1..n div d}

goal (1 subgoal):
 1. k * d \<in> {1..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k * d \<in> {1..n}

goal (1 subgoal):
 1. \<And>x k. k \<in> {1..n div d} \<Longrightarrow> d dvd k * d
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
{x \<in> {1..n}. d dvd x} = {x. \<exists>k\<in>{1..n div d}. x = k * d}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{x \<in> {1..n}. d dvd x} = {x. \<exists>k\<in>{1..n div d}. x = k * d}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "\<dots> = (\<lambda>k. k*d) ` {1..n div d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. \<exists>k\<in>{1..n div d}. x = k * d} = (\<lambda>k. k * d) ` {1..n div d}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
{x. \<exists>k\<in>{1..n div d}. x = k * d} = (\<lambda>k. k * d) ` {1..n div d}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{x. \<exists>k\<in>{1..n div d}. x = k * d} = (\<lambda>k. k * d) ` {1..n div d}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "card \<dots> = card {1..n div d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>k. k * d) ` {1..n div d}) = card {1..n div d}
[PROOF STEP]
by (rule card_image) (simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
card ((\<lambda>k. k * d) ` {1..n div d}) = card {1..n div d}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((\<lambda>k. k * d) ` {1..n div d}) = card {1..n div d}

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "\<dots> = n div d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {1..n div d} = n div d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {1..n div d} = n div d

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {1..n div d} = n div d

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
have "... = \<lfloor>n / d\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (n div d) = \<lfloor>real n / real d\<rfloor>
[PROOF STEP]
by (simp add: floor_divide_of_nat_eq)
[PROOF STATE]
proof (state)
this:
int (n div d) = \<lfloor>real n / real d\<rfloor>

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
int (card {x \<in> {1..n}. d dvd x}) = \<lfloor>real n / real d\<rfloor>
[PROOF STEP]
have "real (card {x. x \<in> {1..n} \<and> d dvd x}) = real_of_int \<lfloor>n / d\<rfloor>"
[PROOF STATE]
proof (prove)
using this:
int (card {x \<in> {1..n}. d dvd x}) = \<lfloor>real n / real d\<rfloor>

goal (1 subgoal):
 1. real (card {x \<in> {1..n}. d dvd x}) = real_of_int \<lfloor>real n / real d\<rfloor>
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
real (card {x \<in> {1..n}. d dvd x}) = real_of_int \<lfloor>real n / real d\<rfloor>

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
real (card {x \<in> {1..n}. d dvd x}) = real_of_int \<lfloor>real n / real d\<rfloor>

goal (2 subgoals):
 1. {1..n} = {1..n}
 2. \<And>x. x \<in> {1..n} \<Longrightarrow> (\<Sum>d = 1..n. if primepow x \<and> x dvd d then ln (real (aprimedivisor x)) else 0) = mangoldt x * real_of_int \<lfloor>real n / real x\<rfloor>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>
[PROOF STEP]
show "(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) =
            mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>

goal (1 subgoal):
 1. (\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. if primepow d \<and> d dvd da then ln (real (aprimedivisor d)) else 0) = mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>

goal (1 subgoal):
 1. {1..n} = {1..n}
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>da = 1..n. \<Sum>d = 1..n. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
have "(\<Sum>d=1..n. \<Sum>da=1..d. if primepow da \<and>
      da dvd d then ln (aprimedivisor da) else 0) =
    sum (\<lambda>d. mangoldt d * floor (n/d)) {1..n}"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal (1 subgoal):
 1. (\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
with ln_primefact
[PROOF STATE]
proof (chain)
picking this:
?n \<noteq> 0 \<Longrightarrow> ln (real ?n) = (\<Sum>d = 1..?n. if primepow d \<and> d dvd ?n then ln (real (aprimedivisor d)) else 0)
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
have "(\<Sum>d=1..n. ln d) =
    (\<Sum>d=1..n. mangoldt d * floor (n/d))"
[PROOF STATE]
proof (prove)
using this:
?n \<noteq> 0 \<Longrightarrow> ln (real ?n) = (\<Sum>d = 1..?n. if primepow d \<and> d dvd ?n then ln (real (aprimedivisor d)) else 0)
(\<Sum>d = 1..n. \<Sum>da = 1..d. if primepow da \<and> da dvd d then ln (real (aprimedivisor da)) else 0) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal (1 subgoal):
 1. (\<Sum>d = 1..n. ln (real d)) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. ln (real d)) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
with ln_fact
[PROOF STATE]
proof (chain)
picking this:
ln (fact ?n) = (\<Sum>d = 1..?n. ln (real d))
(\<Sum>d = 1..n. ln (real d)) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ln (fact ?n) = (\<Sum>d = 1..?n. ln (real d))
(\<Sum>d = 1..n. ln (real d)) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal (1 subgoal):
 1. ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ln (fact n) = (\<Sum>d = 1..n. mangoldt d * real_of_int \<lfloor>real n / real d\<rfloor>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pairwise_disjoint_sum:
  "pairwise (\<lambda>s t. disjnt ((\<lambda> x. {(a, b, c, d) | a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and>
     additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) s)
     ((\<lambda> x. {(a, b, c, d) | a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and>
     additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) t)) (sumset A A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise (\<lambda>s t. disjnt {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = s \<and> c \<oplus> d = s} {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = t \<and> c \<oplus> d = t}) (sumset A A)
[PROOF STEP]
unfolding disjnt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise (\<lambda>s t. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = s \<and> c \<oplus> d = s} \<inter> {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = t \<and> c \<oplus> d = t} = {}) (sumset A A)
[PROOF STEP]
by (intro pairwiseI) (auto)


[STATEMENT]
lemma deriv_pow [simp]:
  shows "Deriv c (A ^^ n) = (if n = 0 then {} else (Deriv c A) @@ (A ^^ (n - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Deriv c (A ^^ n) = (if n = 0 then {} else Deriv c A @@ A ^^ (n - 1))
[PROOF STEP]
apply(induct n arbitrary: A)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>A. Deriv c (A ^^ 0) = (if 0 = 0 then {} else Deriv c A @@ A ^^ (0 - 1))
 2. \<And>n A. (\<And>A. Deriv c (A ^^ n) = (if n = 0 then {} else Deriv c A @@ A ^^ (n - 1))) \<Longrightarrow> Deriv c (A ^^ Suc n) = (if Suc n = 0 then {} else Deriv c A @@ A ^^ (Suc n - 1))
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n A x. \<lbrakk>\<And>A. Deriv c (A ^^ n) = Deriv c A @@ A ^^ (n - Suc 0); 0 < n; [] \<in> A; x \<in> Deriv c A @@ A ^^ (n - Suc 0)\<rbrakk> \<Longrightarrow> x \<in> Deriv c A @@ A ^^ n
[PROOF STEP]
by (metis Suc_pred concI_if_Nil2 conc_assoc conc_pow_comm lang_pow.simps(2))


[STATEMENT]
lemma vfsequence_vcons_vproductE[elim!]:
  assumes "xs #\<^sub>\<circ> x \<in>\<^sub>\<circ> (\<Prod>\<^sub>\<circ>i\<in>\<^sub>\<circ>n. A i)" and "n \<in>\<^sub>\<circ> \<omega>"
  obtains "xs \<in>\<^sub>\<circ> (\<Prod>\<^sub>\<circ>i\<in>\<^sub>\<circ>vcard xs. A i)"
    and "x \<in>\<^sub>\<circ> A (vcard xs)"
    and "n = vcard (xs #\<^sub>\<circ> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>xs \<in>\<^sub>\<circ> vproduct (vcard xs) A; x \<in>\<^sub>\<circ> A (vcard xs); n = vcard (xs #\<^sub>\<circ> x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
xs #\<^sub>\<circ> x \<in>\<^sub>\<circ> vproduct n A
n \<in>\<^sub>\<circ> \<omega>

goal (1 subgoal):
 1. (\<lbrakk>xs \<in>\<^sub>\<circ> vproduct (vcard xs) A; x \<in>\<^sub>\<circ> A (vcard xs); n = vcard (xs #\<^sub>\<circ> x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: vfsequence_vcons_vproductD)


[STATEMENT]
lemma ln_ln_primorial_asymp_equiv [asymp_equiv_intros]:
  "(\<lambda>x. ln (ln (primorial x))) \<sim>[at_top] (\<lambda>x. ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (ln (real (primorial x)))) \<sim>[at_top] ln
[PROOF STEP]
by (auto simp: ln_primorial ln_\<theta>_asymp_equiv)


[STATEMENT]
lemma last_snd: "xs\<noteq>[] \<Longrightarrow>
  snd(((map (lift P) xs))!(length (map (lift P) xs) - (Suc 0)))=snd(xs!(length xs - (Suc 0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> snd (map (lift P) xs ! (length (map (lift P) xs) - Suc 0)) = snd (xs ! (length xs - Suc 0))
[PROOF STEP]
by (cases "(xs ! (length xs - (Suc 0)))") (simp_all add:lift_def)


[STATEMENT]
lemma subtrees_insert_union_suc:
  "{x. is_subtree x t} = insert t (\<Union>t1 \<in> fst ` fset (sucs t). {x. is_subtree x t1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. is_subtree x t} = insert t (\<Union>t1\<in>fst ` fset (sucs t). {x. is_subtree x t1})
[PROOF STEP]
using subtrees_insert_union[of "root t" "sucs t"]
[PROOF STATE]
proof (prove)
using this:
{x. is_subtree x (Node (dtree.root t) (sucs t))} = insert (Node (dtree.root t) (sucs t)) (\<Union>t1\<in>fst ` fset (sucs t). {x. is_subtree x t1})

goal (1 subgoal):
 1. {x. is_subtree x t} = insert t (\<Union>t1\<in>fst ` fset (sucs t). {x. is_subtree x t1})
[PROOF STEP]
by simp


[STATEMENT]
lemma push_bit_word_eq_nonzero:
  \<open>push_bit n w \<noteq> 0\<close> if \<open>w < 2 ^ m\<close> \<open>m + n < LENGTH('a)\<close> \<open>w \<noteq> 0\<close>
    for w :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. push_bit n w \<noteq> 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
w < 2 ^ m
m + n < LENGTH('a)
w \<noteq> 0

goal (1 subgoal):
 1. push_bit n w \<noteq> 0
[PROOF STEP]
apply (simp only: word_neq_0_conv word_less_nat_alt
                    mod_0 unat_word_ariths
                    unat_power_lower word_le_nat_alt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>unat w < 2 ^ m; m + n < LENGTH('a); 0 < unat w\<rbrakk> \<Longrightarrow> 0 < unat (push_bit n w)
[PROOF STEP]
apply (metis add_diff_cancel_right' gr0I gr_implies_not0 less_or_eq_imp_le min_def push_bit_eq_0_iff take_bit_nat_eq_self_iff take_bit_push_bit take_bit_take_bit unsigned_push_bit_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_plus_mono2 [intro]: "C \<subseteq> D \<Longrightarrow> E \<subseteq> F \<Longrightarrow> C + E \<subseteq> D + F"
  for C D E F :: "'a::plus set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>C \<subseteq> D; E \<subseteq> F\<rbrakk> \<Longrightarrow> C + E \<subseteq> D + F
[PROOF STEP]
by (auto simp add: set_plus_def)


[STATEMENT]
lemma cat_ordinal_Dom_vrange: "\<R>\<^sub>\<circ> (cat_ordinal A\<lparr>Dom\<rparr>) \<subseteq>\<^sub>\<circ> cat_ordinal A\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (cat_ordinal A\<lparr>Dom\<rparr>) \<subseteq>\<^sub>\<circ> cat_ordinal A\<lparr>Obj\<rparr>
[PROOF STEP]
unfolding cat_ordinal_components
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (\<lambda>f\<in>\<^sub>\<circ>ordinal_arrs A. f\<lparr>[]\<^sub>\<circ>\<rparr>) \<subseteq>\<^sub>\<circ> A
[PROOF STEP]
by (intro vrange_VLambda_vsubset, elim ordinal_arrsE) simp


[STATEMENT]
lemma per_classes_dj:
  "\<lbrakk>part_equiv R; (i,j)\<notin>R\<rbrakk> \<Longrightarrow> R``{i} \<inter> R``{j} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>part_equiv R; (i, j) \<notin> R\<rbrakk> \<Longrightarrow> R `` {i} \<inter> R `` {j} = {}
[PROOF STEP]
by (auto dest: part_equiv_trans_sym)


[STATEMENT]
lemma map_us_mono_pres:
  fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'b::complete_lattice_with_dual"
  shows "mono f \<Longrightarrow> mono (map_us f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> mono (map_us f)
[PROOF STEP]
unfolding mono_def map_us_def comp_def us_def IInf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y \<Longrightarrow> \<forall>x y. x \<le> y \<longrightarrow> Abs_upset (\<up> (f (\<Sqinter> Rep_upset x))) \<le> Abs_upset (\<up> (f (\<Sqinter> Rep_upset y)))
[PROOF STEP]
by (metis Abs_upset_inverse Inf_superset_mono less_eq_upset.rep_eq rangeI upset_anti_iff)


[STATEMENT]
lemma Sbis_transC[consumes 3, case_names Match]:
assumes 0: "c \<approx>s d" and "s \<approx> t" and "(c,s) \<rightarrow>c (c',s')"
obtains d' t' where
"(d,t) \<rightarrow>c (d',t')" and "s' \<approx> t'" and "c' \<approx>s d'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d' t'. \<lbrakk>(d, t) \<rightarrow>c (d', t'); s' \<approx> t'; c' \<approx>s d'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms Sbis_matchC_C[OF 0]
[PROOF STATE]
proof (prove)
using this:
c \<approx>s d
s \<approx> t
(c, s) \<rightarrow>c (c', s')
matchC_C Sbis c d

goal (1 subgoal):
 1. (\<And>d' t'. \<lbrakk>(d, t) \<rightarrow>c (d', t'); s' \<approx> t'; c' \<approx>s d'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding matchC_C_def
[PROOF STATE]
proof (prove)
using this:
c \<approx>s d
s \<approx> t
(c, s) \<rightarrow>c (c', s')
\<forall>s t c' s'. s \<approx> t \<and> (c, s) \<rightarrow>c (c', s') \<longrightarrow> (\<exists>d' t'. (d, t) \<rightarrow>c (d', t') \<and> s' \<approx> t' \<and> c' \<approx>s d')

goal (1 subgoal):
 1. (\<And>d' t'. \<lbrakk>(d, t) \<rightarrow>c (d', t'); s' \<approx> t'; c' \<approx>s d'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma multiset_image_do_nothing: "(\<And> x .x \<in># A \<Longrightarrow> f x = x) \<Longrightarrow> image_mset f A = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in># A \<Longrightarrow> f x = x) \<Longrightarrow> image_mset f A = A
[PROOF STEP]
by (induct A) auto