[STATEMENT]
lemma (in aGroup) nt_mult_pp:"\<lbrakk> a \<in> carrier A; 0 \<le> m; 0 \<le> n\<rbrakk>
                                   \<Longrightarrow> m\<triangleright>(n\<triangleright>a\<^bsub>A\<^esub>)\<^bsub>A\<^esub> = (m * n)\<triangleright>a\<^bsub>A\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; 0 \<le> n\<rbrakk> \<Longrightarrow> m\<triangleright>n\<triangleright>a\<^bsub>A\<^esub>\<^bsub>A\<^esub> = (m * n)\<triangleright>a\<^bsub>A\<^esub>
[PROOF STEP]
apply (simp add:sprod_n_a_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; 0 \<le> n\<rbrakk> \<Longrightarrow> aSum A (nat m) (aSum A (nat n) a) = aSum A (nat (m * n)) a
[PROOF STEP]
apply (subgoal_tac "0 \<le> m * n", simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; 0 \<le> n\<rbrakk> \<Longrightarrow> aSum A (nat m) (aSum A (nat n) a) = aSum A (nat (m * n)) a
 2. \<lbrakk>a \<in> carrier A; 0 \<le> m; 0 \<le> n\<rbrakk> \<Longrightarrow> 0 \<le> m * n
[PROOF STEP]
apply (simp add:asum_multTr_pp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; 0 \<le> n\<rbrakk> \<Longrightarrow> aSum A (nat m * nat n) a = aSum A (nat (m * n)) a
 2. \<lbrakk>a \<in> carrier A; 0 \<le> m; 0 \<le> n\<rbrakk> \<Longrightarrow> 0 \<le> m * n
[PROOF STEP]
apply (simp add:nat_mult_distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; 0 \<le> n\<rbrakk> \<Longrightarrow> 0 \<le> m * n
[PROOF STEP]
apply (frule int_mult_le [of "0" "m" "n"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; 0 \<le> n; n * 0 \<le> n * m\<rbrakk> \<Longrightarrow> 0 \<le> m * n
[PROOF STEP]
apply (simp add:mult.commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sin_pi [simp]: "sin pi = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin pi = 0
[PROOF STEP]
using sin_add [where x = "pi/2" and y = "pi/2"]
[PROOF STATE]
proof (prove)
using this:
sin (pi / 2 + pi / 2) = sin (pi / 2) * cos (pi / 2) + cos (pi / 2) * sin (pi / 2)

goal (1 subgoal):
 1. sin pi = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma proj_sum_list: "proj_poly k (sum_list xs) = sum_list (map (proj_poly k) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_poly k (sum_list xs) = sum_list (map (proj_poly k) xs)
[PROOF STEP]
using proj_zero proj_plus
[PROOF STATE]
proof (prove)
using this:
proj_poly ?k 0 = 0
proj_poly ?k (?p + ?q) = proj_poly ?k ?p + proj_poly ?k ?q

goal (1 subgoal):
 1. proj_poly k (sum_list xs) = sum_list (map (proj_poly k) xs)
[PROOF STEP]
by (rule fun_sum_list_commute)


[STATEMENT]
lemma emeasure_buffon_set':
  "emeasure lborel Buffon_set' =
     ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))"
  (is "emeasure lborel ?A = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
have "emeasure lborel ?A = nn_integral lborel (\<lambda>x. indicator ?A x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel Buffon_set' = integral\<^sup>N lborel (indicator Buffon_set')
[PROOF STEP]
by (intro nn_integral_indicator [symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
emeasure lborel Buffon_set' = integral\<^sup>N lborel (indicator Buffon_set')

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure lborel Buffon_set' = integral\<^sup>N lborel (indicator Buffon_set')

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
have "(lborel :: (real \<times> real) measure) = lborel \<Otimes>\<^sub>M lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lborel = lborel \<Otimes>\<^sub>M lborel
[PROOF STEP]
by (simp only: lborel_prod)
[PROOF STATE]
proof (state)
this:
lborel = lborel \<Otimes>\<^sub>M lborel

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lborel = lborel \<Otimes>\<^sub>M lborel

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
have "nn_integral \<dots> (indicator ?A) = (\<integral>\<^sup>+\<phi>. \<integral>\<^sup>+x. indicator ?A (x, \<phi>) \<partial>lborel \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (lborel \<Otimes>\<^sub>M lborel) (indicator Buffon_set') = \<integral>\<^sup>+ \<phi>. \<integral>\<^sup>+ x. indicator Buffon_set' (x, \<phi>) \<partial>lborel \<partial>lborel
[PROOF STEP]
by (subst lborel_pair.nn_integral_snd [symmetric]) (simp_all add: lborel_prod borel_prod)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (lborel \<Otimes>\<^sub>M lborel) (indicator Buffon_set') = \<integral>\<^sup>+ \<phi>. \<integral>\<^sup>+ x. indicator Buffon_set' (x, \<phi>) \<partial>lborel \<partial>lborel

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (lborel \<Otimes>\<^sub>M lborel) (indicator Buffon_set') = \<integral>\<^sup>+ \<phi>. \<integral>\<^sup>+ x. indicator Buffon_set' (x, \<phi>) \<partial>lborel \<partial>lborel

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+\<phi>. \<integral>\<^sup>+x. indicator {0..pi} \<phi> * indicator {max 0 (d/2 - sin \<phi> * l / 2) .. d/2} x \<partial>lborel \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ \<phi>. \<integral>\<^sup>+ x. indicator Buffon_set' (x, \<phi>) \<partial>lborel \<partial>lborel = \<integral>\<^sup>+ \<phi>. (\<integral>\<^sup>+x\<in>{max 0 (d / 2 - sin \<phi> * l / 2)..d / 2}. indicator {0..pi} \<phi>\<partial>lborel) \<partial>lborel
[PROOF STEP]
using d l
[PROOF STATE]
proof (prove)
using this:
0 < d
0 < l

goal (1 subgoal):
 1. \<integral>\<^sup>+ \<phi>. \<integral>\<^sup>+ x. indicator Buffon_set' (x, \<phi>) \<partial>lborel \<partial>lborel = \<integral>\<^sup>+ \<phi>. (\<integral>\<^sup>+x\<in>{max 0 (d / 2 - sin \<phi> * l / 2)..d / 2}. indicator {0..pi} \<phi>\<partial>lborel) \<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong) (auto simp: indicator_def field_simps Buffon_set'_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ \<phi>. \<integral>\<^sup>+ x. indicator Buffon_set' (x, \<phi>) \<partial>lborel \<partial>lborel = \<integral>\<^sup>+ \<phi>. (\<integral>\<^sup>+x\<in>{max 0 (d / 2 - sin \<phi> * l / 2)..d / 2}. indicator {0..pi} \<phi>\<partial>lborel) \<partial>lborel

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ \<phi>. \<integral>\<^sup>+ x. indicator Buffon_set' (x, \<phi>) \<partial>lborel \<partial>lborel = \<integral>\<^sup>+ \<phi>. (\<integral>\<^sup>+x\<in>{max 0 (d / 2 - sin \<phi> * l / 2)..d / 2}. indicator {0..pi} \<phi>\<partial>lborel) \<partial>lborel

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
have "\<dots> = \<integral>\<^sup>+ \<phi>. indicator {0..pi} \<phi> * emeasure lborel {max 0 (d / 2 - sin \<phi> * l / 2)..d / 2} \<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ \<phi>. (\<integral>\<^sup>+x\<in>{max 0 (d / 2 - sin \<phi> * l / 2)..d / 2}. indicator {0..pi} \<phi>\<partial>lborel) \<partial>lborel = \<integral>\<^sup>+ \<phi>. indicator {0..pi} \<phi> * emeasure lborel {max 0 (d / 2 - sin \<phi> * l / 2)..d / 2} \<partial>lborel
[PROOF STEP]
by (subst nn_integral_cmult) simp_all
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ \<phi>. (\<integral>\<^sup>+x\<in>{max 0 (d / 2 - sin \<phi> * l / 2)..d / 2}. indicator {0..pi} \<phi>\<partial>lborel) \<partial>lborel = \<integral>\<^sup>+ \<phi>. indicator {0..pi} \<phi> * emeasure lborel {max 0 (d / 2 - sin \<phi> * l / 2)..d / 2} \<partial>lborel

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ \<phi>. (\<integral>\<^sup>+x\<in>{max 0 (d / 2 - sin \<phi> * l / 2)..d / 2}. indicator {0..pi} \<phi>\<partial>lborel) \<partial>lborel = \<integral>\<^sup>+ \<phi>. indicator {0..pi} \<phi> * emeasure lborel {max 0 (d / 2 - sin \<phi> * l / 2)..d / 2} \<partial>lborel

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
have "\<dots> = \<integral>\<^sup>+ \<phi>. ennreal (indicator {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2)) \<partial>lborel"
    (is "_ = ?I")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ \<phi>. indicator {0..pi} \<phi> * emeasure lborel {max 0 (d / 2 - sin \<phi> * l / 2)..d / 2} \<partial>lborel = \<integral>\<^sup>+ \<phi>. ennreal (indicat_real {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2)) \<partial>lborel
[PROOF STEP]
using d l
[PROOF STATE]
proof (prove)
using this:
0 < d
0 < l

goal (1 subgoal):
 1. \<integral>\<^sup>+ \<phi>. indicator {0..pi} \<phi> * emeasure lborel {max 0 (d / 2 - sin \<phi> * l / 2)..d / 2} \<partial>lborel = \<integral>\<^sup>+ \<phi>. ennreal (indicat_real {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2)) \<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong) (auto simp: indicator_def sin_ge_zero max_def min_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ \<phi>. indicator {0..pi} \<phi> * emeasure lborel {max 0 (d / 2 - sin \<phi> * l / 2)..d / 2} \<partial>lborel = \<integral>\<^sup>+ \<phi>. ennreal (indicat_real {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2)) \<partial>lborel

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ \<phi>. indicator {0..pi} \<phi> * emeasure lborel {max 0 (d / 2 - sin \<phi> * l / 2)..d / 2} \<partial>lborel = \<integral>\<^sup>+ \<phi>. ennreal (indicat_real {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2)) \<partial>lborel

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
have "integrable lborel (\<lambda>\<phi>. (d / 2) * indicator {0..pi} \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable lborel (\<lambda>\<phi>. d / 2 * indicat_real {0..pi} \<phi>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integrable lborel (\<lambda>\<phi>. d / 2 * indicat_real {0..pi} \<phi>)

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
hence int: "integrable lborel (\<lambda>\<phi>. indicator {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2))"
[PROOF STATE]
proof (prove)
using this:
integrable lborel (\<lambda>\<phi>. d / 2 * indicat_real {0..pi} \<phi>)

goal (1 subgoal):
 1. integrable lborel (\<lambda>\<phi>. indicat_real {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2))
[PROOF STEP]
by (rule Bochner_Integration.integrable_bound)
       (insert l d, auto intro!: AE_I2 simp: indicator_def min_def sin_ge_zero)
[PROOF STATE]
proof (state)
this:
integrable lborel (\<lambda>\<phi>. indicat_real {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
hence "?I = set_lebesgue_integral lborel {0..pi} (\<lambda>\<phi>. min (d / 2) (sin \<phi> * l / 2))"
[PROOF STATE]
proof (prove)
using this:
integrable lborel (\<lambda>\<phi>. indicat_real {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2))

goal (1 subgoal):
 1. \<integral>\<^sup>+ \<phi>. ennreal (indicat_real {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2)) \<partial>lborel = ennreal (LBINT \<phi>:{0..pi}. min (d / 2) (sin \<phi> * l / 2))
[PROOF STEP]
by (subst nn_integral_eq_integral, assumption)
       (insert d l, auto intro!: AE_I2 simp: sin_ge_zero min_def indicator_def set_lebesgue_integral_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ \<phi>. ennreal (indicat_real {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2)) \<partial>lborel = ennreal (LBINT \<phi>:{0..pi}. min (d / 2) (sin \<phi> * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ \<phi>. ennreal (indicat_real {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2)) \<partial>lborel = ennreal (LBINT \<phi>:{0..pi}. min (d / 2) (sin \<phi> * l / 2))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
have "\<dots> = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))"
    (is "_ = ennreal ?I")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (LBINT \<phi>:{0..pi}. min (d / 2) (sin \<phi> * l / 2)) = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
using int
[PROOF STATE]
proof (prove)
using this:
integrable lborel (\<lambda>\<phi>. indicat_real {0..pi} \<phi> * min (d / 2) (sin \<phi> * l / 2))

goal (1 subgoal):
 1. ennreal (LBINT \<phi>:{0..pi}. min (d / 2) (sin \<phi> * l / 2)) = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
by (subst set_borel_integral_eq_integral) (simp_all add: set_integrable_def)
[PROOF STATE]
proof (state)
this:
ennreal (LBINT \<phi>:{0..pi}. min (d / 2) (sin \<phi> * l / 2)) = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure (lborel \<Otimes>\<^sub>M lborel) Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure (lborel \<Otimes>\<^sub>M lborel) Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))

goal (1 subgoal):
 1. emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))
[PROOF STEP]
by (simp add: lborel_prod)
[PROOF STATE]
proof (state)
this:
emeasure lborel Buffon_set' = ennreal (integral {0..pi} (\<lambda>x. min (d / 2) (sin x * l / 2)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fcard_normalize_img_if_disjoint_lverts:
  "\<lbrakk>disjoint_dlverts xs; \<forall>(t, e)\<in>fset xs. dlverts t \<noteq> {}\<rbrakk>
    \<Longrightarrow> fcard ((\<lambda>(t,e). (normalize1 t,e)) |`| xs) = fcard xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>disjoint_dlverts xs; \<forall>(t, e)\<in>fset xs. dlverts t \<noteq> {}\<rbrakk> \<Longrightarrow> fcard ((\<lambda>(t, e). (normalize1 t, e)) |`| xs) = fcard xs
[PROOF STEP]
using fst_neq_img_card_eq[of xs normalize1] normalize1_fsts_uneq
[PROOF STATE]
proof (prove)
using this:
\<forall>(t, e)\<in>fset xs. \<forall>(t2, e2)\<in>fset xs. normalize1 t \<noteq> normalize1 t2 \<or> (t, e) = (t2, e2) \<Longrightarrow> fcard ((\<lambda>(t1, e1). (normalize1 t1, e1)) |`| xs) = fcard xs
\<lbrakk>disjoint_dlverts ?xs; \<forall>(t, e)\<in>fset ?xs. dlverts t \<noteq> {}\<rbrakk> \<Longrightarrow> \<forall>(t, e)\<in>fset ?xs. \<forall>(t2, e2)\<in>fset ?xs. normalize1 t \<noteq> normalize1 t2 \<or> (t, e) = (t2, e2)

goal (1 subgoal):
 1. \<lbrakk>disjoint_dlverts xs; \<forall>(t, e)\<in>fset xs. dlverts t \<noteq> {}\<rbrakk> \<Longrightarrow> fcard ((\<lambda>(t, e). (normalize1 t, e)) |`| xs) = fcard xs
[PROOF STEP]
by auto


[STATEMENT]
theorem residue_prime_mult_group_has_gen:
 fixes p :: nat
 assumes prime_p : "prime p"
 shows "\<exists>a \<in> {1 .. p - 1}. {1 .. p - 1} = {a^i mod p|i . i \<in> UNIV}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
have "p \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> p
[PROOF STEP]
using prime_gt_1_nat[OF prime_p]
[PROOF STATE]
proof (prove)
using this:
1 < p

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

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
interpret R: residues_prime p "residue_ring p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residues_prime p &&& residue_ring (int p) \<equiv> residue_ring (int p)
[PROOF STEP]
by (simp add: residues_prime_def prime_p)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
have car: "carrier (residue_ring (int p)) - {\<zero>\<^bsub>residue_ring (int p)\<^esub>} = {1 .. int p - 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (residue_ring (int p)) - {\<zero>\<^bsub>residue_ring (int p)\<^esub>} = {1..int p - 1}
[PROOF STEP]
by (auto simp add: R.zero_cong R.res_carrier_eq)
[PROOF STATE]
proof (state)
this:
carrier (residue_ring (int p)) - {\<zero>\<^bsub>residue_ring (int p)\<^esub>} = {1..int p - 1}

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
have "x [^]\<^bsub>residue_ring (int p)\<^esub> i = x ^ i mod (int p)"
    if "x \<in> {1 .. int p - 1}" for x and i :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^]\<^bsub>residue_ring (int p)\<^esub> i = x ^ i mod int p
[PROOF STEP]
using that R.pow_cong[of x i]
[PROOF STATE]
proof (prove)
using this:
x \<in> {1..int p - 1}
(x mod int p) [^]\<^bsub>residue_ring (int p)\<^esub> i = x ^ i mod int p

goal (1 subgoal):
 1. x [^]\<^bsub>residue_ring (int p)\<^esub> i = x ^ i mod int p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> {1..int p - 1} \<Longrightarrow> ?x [^]\<^bsub>residue_ring (int p)\<^esub> ?i = ?x ^ ?i mod int p

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?x \<in> {1..int p - 1} \<Longrightarrow> ?x [^]\<^bsub>residue_ring (int p)\<^esub> ?i = ?x ^ ?i mod int p

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
obtain a where a: "a \<in> {1 .. int p - 1}"
    and a_gen: "{1 .. int p - 1} = {a[^]\<^bsub>residue_ring (int p)\<^esub>i|i::nat . i \<in> UNIV}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> {1..int p - 1}; {1..int p - 1} = {a [^]\<^bsub>residue_ring (int p)\<^esub> i |i. i \<in> UNIV}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using field.finite_field_mult_group_has_gen[OF R.is_field]
[PROOF STATE]
proof (prove)
using this:
finite (carrier (residue_ring (int p))) \<Longrightarrow> \<exists>a\<in>carrier (mult_of (residue_ring (int p))). carrier (mult_of (residue_ring (int p))) = {a [^]\<^bsub>residue_ring (int p)\<^esub> i |i. i \<in> UNIV}

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> {1..int p - 1}; {1..int p - 1} = {a [^]\<^bsub>residue_ring (int p)\<^esub> i |i. i \<in> UNIV}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: car[symmetric] carrier_mult_of)
[PROOF STATE]
proof (state)
this:
a \<in> {1..int p - 1}
{1..int p - 1} = {a [^]\<^bsub>residue_ring (int p)\<^esub> i |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a \<in> {1..int p - 1}
{1..int p - 1} = {a [^]\<^bsub>residue_ring (int p)\<^esub> i |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
have "nat ` {1 .. int p - 1} = {1 .. p - 1}" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat ` {1..int p - 1} = {1..p - 1}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. nat ` {1..int p - 1} \<subseteq> {1..p - 1}
 2. {1..p - 1} \<subseteq> nat ` {1..int p - 1}
[PROOF STEP]
have "n \<in> ?R" if "n \<in> ?L" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<in> {1..p - 1}
[PROOF STEP]
using that \<open>p\<ge>2\<close>
[PROOF STATE]
proof (prove)
using this:
n \<in> nat ` {1..int p - 1}
2 \<le> p

goal (1 subgoal):
 1. n \<in> {1..p - 1}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
?n \<in> nat ` {1..int p - 1} \<Longrightarrow> ?n \<in> {1..p - 1}

goal (2 subgoals):
 1. nat ` {1..int p - 1} \<subseteq> {1..p - 1}
 2. {1..p - 1} \<subseteq> nat ` {1..int p - 1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?n \<in> nat ` {1..int p - 1} \<Longrightarrow> ?n \<in> {1..p - 1}
[PROOF STEP]
show "?L \<subseteq> ?R"
[PROOF STATE]
proof (prove)
using this:
?n \<in> nat ` {1..int p - 1} \<Longrightarrow> ?n \<in> {1..p - 1}

goal (1 subgoal):
 1. nat ` {1..int p - 1} \<subseteq> {1..p - 1}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
nat ` {1..int p - 1} \<subseteq> {1..p - 1}

goal (1 subgoal):
 1. {1..p - 1} \<subseteq> nat ` {1..int p - 1}
[PROOF STEP]
have "n \<in> ?L" if "n \<in> ?R" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<in> nat ` {1..int p - 1}
[PROOF STEP]
using that \<open>p\<ge>2\<close>
[PROOF STATE]
proof (prove)
using this:
n \<in> {1..p - 1}
2 \<le> p

goal (1 subgoal):
 1. n \<in> nat ` {1..int p - 1}
[PROOF STEP]
by (auto intro: rev_image_eqI [of "int n"])
[PROOF STATE]
proof (state)
this:
?n \<in> {1..p - 1} \<Longrightarrow> ?n \<in> nat ` {1..int p - 1}

goal (1 subgoal):
 1. {1..p - 1} \<subseteq> nat ` {1..int p - 1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?n \<in> {1..p - 1} \<Longrightarrow> ?n \<in> nat ` {1..int p - 1}
[PROOF STEP]
show "?R \<subseteq> ?L"
[PROOF STATE]
proof (prove)
using this:
?n \<in> {1..p - 1} \<Longrightarrow> ?n \<in> nat ` {1..int p - 1}

goal (1 subgoal):
 1. {1..p - 1} \<subseteq> nat ` {1..int p - 1}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{1..p - 1} \<subseteq> nat ` {1..int p - 1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
nat ` {1..int p - 1} = {1..p - 1}

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
nat ` {1..int p - 1} = {1..p - 1}

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
have "nat ` {a^i mod (int p) | i::nat. i \<in> UNIV} = {nat a^i mod p | i . i \<in> UNIV}" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat ` {a ^ i mod int p |i. i \<in> UNIV} = {nat a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. nat ` {a ^ i mod int p |i. i \<in> UNIV} \<subseteq> {nat a ^ i mod p |i. i \<in> UNIV}
 2. {nat a ^ i mod p |i. i \<in> UNIV} \<subseteq> nat ` {a ^ i mod int p |i. i \<in> UNIV}
[PROOF STEP]
have "x \<in> ?R" if "x \<in> ?L" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {nat a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> {nat a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV}
[PROOF STEP]
obtain i where i: "x = nat (a^i mod (int p))"
[PROOF STATE]
proof (prove)
using this:
x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV}

goal (1 subgoal):
 1. (\<And>i. x = nat (a ^ i mod int p) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x = nat (a ^ i mod int p)

goal (1 subgoal):
 1. x \<in> {nat a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = nat (a ^ i mod int p)
[PROOF STEP]
have "x = nat a ^ i mod p"
[PROOF STATE]
proof (prove)
using this:
x = nat (a ^ i mod int p)

goal (1 subgoal):
 1. x = nat a ^ i mod p
[PROOF STEP]
using mod_nat_int_pow_eq[of a "int p" i] a \<open>p\<ge>2\<close>
[PROOF STATE]
proof (prove)
using this:
x = nat (a ^ i mod int p)
\<lbrakk>0 \<le> a; 0 \<le> int p\<rbrakk> \<Longrightarrow> nat a ^ i mod nat (int p) = nat (a ^ i mod int p)
a \<in> {1..int p - 1}
2 \<le> p

goal (1 subgoal):
 1. x = nat a ^ i mod p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = nat a ^ i mod p

goal (1 subgoal):
 1. x \<in> {nat a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
with i
[PROOF STATE]
proof (chain)
picking this:
x = nat (a ^ i mod int p)
x = nat a ^ i mod p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = nat (a ^ i mod int p)
x = nat a ^ i mod p

goal (1 subgoal):
 1. x \<in> {nat a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> {nat a ^ i mod p |i. i \<in> UNIV}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV} \<Longrightarrow> ?x \<in> {nat a ^ i mod p |i. i \<in> UNIV}

goal (2 subgoals):
 1. nat ` {a ^ i mod int p |i. i \<in> UNIV} \<subseteq> {nat a ^ i mod p |i. i \<in> UNIV}
 2. {nat a ^ i mod p |i. i \<in> UNIV} \<subseteq> nat ` {a ^ i mod int p |i. i \<in> UNIV}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV} \<Longrightarrow> ?x \<in> {nat a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
show "?L \<subseteq> ?R"
[PROOF STATE]
proof (prove)
using this:
?x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV} \<Longrightarrow> ?x \<in> {nat a ^ i mod p |i. i \<in> UNIV}

goal (1 subgoal):
 1. nat ` {a ^ i mod int p |i. i \<in> UNIV} \<subseteq> {nat a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
nat ` {a ^ i mod int p |i. i \<in> UNIV} \<subseteq> {nat a ^ i mod p |i. i \<in> UNIV}

goal (1 subgoal):
 1. {nat a ^ i mod p |i. i \<in> UNIV} \<subseteq> nat ` {a ^ i mod int p |i. i \<in> UNIV}
[PROOF STEP]
have "x \<in> ?L" if "x \<in> ?R" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV}
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
x \<in> {nat a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
obtain i where i: "x = nat a^i mod p"
[PROOF STATE]
proof (prove)
using this:
x \<in> {nat a ^ i mod p |i. i \<in> UNIV}

goal (1 subgoal):
 1. (\<And>i. x = nat a ^ i mod p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x = nat a ^ i mod p

goal (1 subgoal):
 1. x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV}
[PROOF STEP]
with mod_nat_int_pow_eq[of a "int p" i] a \<open>p\<ge>2\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 \<le> a; 0 \<le> int p\<rbrakk> \<Longrightarrow> nat a ^ i mod nat (int p) = nat (a ^ i mod int p)
a \<in> {1..int p - 1}
2 \<le> p
x = nat a ^ i mod p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> a; 0 \<le> int p\<rbrakk> \<Longrightarrow> nat a ^ i mod nat (int p) = nat (a ^ i mod int p)
a \<in> {1..int p - 1}
2 \<le> p
x = nat a ^ i mod p

goal (1 subgoal):
 1. x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> {nat a ^ i mod p |i. i \<in> UNIV} \<Longrightarrow> ?x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV}

goal (1 subgoal):
 1. {nat a ^ i mod p |i. i \<in> UNIV} \<subseteq> nat ` {a ^ i mod int p |i. i \<in> UNIV}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> {nat a ^ i mod p |i. i \<in> UNIV} \<Longrightarrow> ?x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV}
[PROOF STEP]
show "?R \<subseteq> ?L"
[PROOF STATE]
proof (prove)
using this:
?x \<in> {nat a ^ i mod p |i. i \<in> UNIV} \<Longrightarrow> ?x \<in> nat ` {a ^ i mod int p |i. i \<in> UNIV}

goal (1 subgoal):
 1. {nat a ^ i mod p |i. i \<in> UNIV} \<subseteq> nat ` {a ^ i mod int p |i. i \<in> UNIV}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{nat a ^ i mod p |i. i \<in> UNIV} \<subseteq> nat ` {a ^ i mod int p |i. i \<in> UNIV}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
nat ` {a ^ i mod int p |i. i \<in> UNIV} = {nat a ^ i mod p |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?x \<in> {1..int p - 1} \<Longrightarrow> ?x [^]\<^bsub>residue_ring (int p)\<^esub> ?i = ?x ^ ?i mod int p
a \<in> {1..int p - 1}
{1..int p - 1} = {a [^]\<^bsub>residue_ring (int p)\<^esub> i |i. i \<in> UNIV}
nat ` {1..int p - 1} = {1..p - 1}
nat ` {a ^ i mod int p |i. i \<in> UNIV} = {nat a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
have "{1 .. p - 1} = {nat a^i mod p | i. i \<in> UNIV}"
[PROOF STATE]
proof (prove)
using this:
?x \<in> {1..int p - 1} \<Longrightarrow> ?x [^]\<^bsub>residue_ring (int p)\<^esub> ?i = ?x ^ ?i mod int p
a \<in> {1..int p - 1}
{1..int p - 1} = {a [^]\<^bsub>residue_ring (int p)\<^esub> i |i. i \<in> UNIV}
nat ` {1..int p - 1} = {1..p - 1}
nat ` {a ^ i mod int p |i. i \<in> UNIV} = {nat a ^ i mod p |i. i \<in> UNIV}

goal (1 subgoal):
 1. {1..p - 1} = {nat a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
{1..p - 1} = {nat a ^ i mod p |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{1..p - 1} = {nat a ^ i mod p |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
a \<in> {1..int p - 1}
[PROOF STEP]
have "nat a \<in> {1 .. p - 1}"
[PROOF STATE]
proof (prove)
using this:
a \<in> {1..int p - 1}

goal (1 subgoal):
 1. nat a \<in> {1..p - 1}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
nat a \<in> {1..p - 1}

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{1..p - 1} = {nat a ^ i mod p |i. i \<in> UNIV}
nat a \<in> {1..p - 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{1..p - 1} = {nat a ^ i mod p |i. i \<in> UNIV}
nat a \<in> {1..p - 1}

goal (1 subgoal):
 1. \<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>a\<in>{1..p - 1}. {1..p - 1} = {a ^ i mod p |i. i \<in> UNIV}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma horner_sum_of_bool_2_less:
  \<open>(horner_sum of_bool 2 bs :: int) < 2 ^ length bs\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. horner_sum of_bool 2 bs < 2 ^ length bs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. horner_sum of_bool 2 bs < 2 ^ length bs
[PROOF STEP]
have \<open>(\<Sum>n = 0..<length bs. of_bool (bs ! n) * (2::int) ^ n) \<le> (\<Sum>n = 0..<length bs. 2 ^ n)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n = 0..<length bs. of_bool (bs ! n) * 2 ^ n) \<le> sum ((^) 2) {0..<length bs}
[PROOF STEP]
by (rule sum_mono) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n = 0..<length bs. of_bool (bs ! n) * 2 ^ n) \<le> sum ((^) 2) {0..<length bs}

goal (1 subgoal):
 1. horner_sum of_bool 2 bs < 2 ^ length bs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n = 0..<length bs. of_bool (bs ! n) * 2 ^ n) \<le> sum ((^) 2) {0..<length bs}

goal (1 subgoal):
 1. horner_sum of_bool 2 bs < 2 ^ length bs
[PROOF STEP]
have \<open>\<dots> = 2 ^ length bs - 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) 2) {0..<length bs} = 2 ^ length bs - 1
[PROOF STEP]
by (induction bs) simp_all
[PROOF STATE]
proof (state)
this:
sum ((^) 2) {0..<length bs} = 2 ^ length bs - 1

goal (1 subgoal):
 1. horner_sum of_bool 2 bs < 2 ^ length bs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n = 0..<length bs. of_bool (bs ! n) * 2 ^ n) \<le> 2 ^ length bs - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n = 0..<length bs. of_bool (bs ! n) * 2 ^ n) \<le> 2 ^ length bs - 1

goal (1 subgoal):
 1. horner_sum of_bool 2 bs < 2 ^ length bs
[PROOF STEP]
by (simp add: horner_sum_eq_sum)
[PROOF STATE]
proof (state)
this:
horner_sum of_bool 2 bs < 2 ^ length bs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_real_le_2_powr_bitlen[simp]: "\<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)
[PROOF STEP]
proof (cases "m2 = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m2 = 0 \<Longrightarrow> \<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)
 2. m2 \<noteq> 0 \<Longrightarrow> \<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
m2 = 0

goal (2 subgoals):
 1. m2 = 0 \<Longrightarrow> \<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)
 2. m2 \<noteq> 0 \<Longrightarrow> \<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m2 = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m2 = 0

goal (1 subgoal):
 1. \<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)

goal (1 subgoal):
 1. m2 \<noteq> 0 \<Longrightarrow> \<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m2 \<noteq> 0 \<Longrightarrow> \<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
m2 \<noteq> 0

goal (1 subgoal):
 1. m2 \<noteq> 0 \<Longrightarrow> \<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m2 \<noteq> 0
[PROOF STEP]
have "\<bar>m2\<bar> < 2 ^ nat (bitlen \<bar>m2\<bar>)"
[PROOF STATE]
proof (prove)
using this:
m2 \<noteq> 0

goal (1 subgoal):
 1. \<bar>m2\<bar> < 2 ^ nat (bitlen \<bar>m2\<bar>)
[PROOF STEP]
using bitlen_bounds[of "\<bar>m2\<bar>"]
[PROOF STATE]
proof (prove)
using this:
m2 \<noteq> 0
0 < \<bar>m2\<bar> \<Longrightarrow> 2 ^ nat (bitlen \<bar>m2\<bar> - 1) \<le> \<bar>m2\<bar> \<and> \<bar>m2\<bar> < 2 ^ nat (bitlen \<bar>m2\<bar>)

goal (1 subgoal):
 1. \<bar>m2\<bar> < 2 ^ nat (bitlen \<bar>m2\<bar>)
[PROOF STEP]
by (auto simp: powr_add bitlen_nonneg)
[PROOF STATE]
proof (state)
this:
\<bar>m2\<bar> < 2 ^ nat (bitlen \<bar>m2\<bar>)

goal (1 subgoal):
 1. m2 \<noteq> 0 \<Longrightarrow> \<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>m2\<bar> < 2 ^ nat (bitlen \<bar>m2\<bar>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>m2\<bar> < 2 ^ nat (bitlen \<bar>m2\<bar>)

goal (1 subgoal):
 1. \<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)
[PROOF STEP]
by (metis bitlen_nonneg powr_int of_int_abs of_int_less_numeral_power_cancel_iff
        zero_less_numeral)
[PROOF STATE]
proof (state)
this:
\<bar>real_of_int m2\<bar> < 2 powr real_of_int (bitlen \<bar>m2\<bar>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tensor_mat_minus1:
  assumes "m1 \<in> carrier_mat d1 d1"
    and "m2 \<in> carrier_mat d1 d1"
    and "m3 \<in> carrier_mat d2 d2"
  shows "tensor_mat (m1 - m2) m3 = tensor_mat m1 m3 - tensor_mat m2 m3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_mat (m1 - m2) m3 = tensor_mat m1 m3 - tensor_mat m2 m3
[PROOF STEP]
apply (rule eq_matI, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> tensor_mat (m1 - m2) m3 $$ (i, j) = tensor_mat m1 m3 $$ (i, j) - tensor_mat m2 m3 $$ (i, j)
[PROOF STEP]
unfolding tensor_mat_eval
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> (m1 - m2) $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j) = m1 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j) - m2 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j)
[PROOF STEP]
apply (subst index_minus_mat)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> encode1 i < dim_row m2
 2. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> encode1 j < dim_col m2
 3. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> (m1 $$ (encode1 i, encode1 j) - m2 $$ (encode1 i, encode1 j)) * m3 $$ (encode2 i, encode2 j) = m1 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j) - m2 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i_ < d; j_ < d\<rbrakk> \<Longrightarrow> encode1 i_ < dim_row m2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat d1 d1
m2 \<in> carrier_mat d1 d1
m3 \<in> carrier_mat d2 d2

goal (1 subgoal):
 1. \<lbrakk>i_ < d; j_ < d\<rbrakk> \<Longrightarrow> encode1 i_ < dim_row m2
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> encode1 j < dim_col m2
 2. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> (m1 $$ (encode1 i, encode1 j) - m2 $$ (encode1 i, encode1 j)) * m3 $$ (encode2 i, encode2 j) = m1 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j) - m2 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i_ < d; j_ < d\<rbrakk> \<Longrightarrow> encode1 j_ < dim_col m2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat d1 d1
m2 \<in> carrier_mat d1 d1
m3 \<in> carrier_mat d2 d2

goal (1 subgoal):
 1. \<lbrakk>i_ < d; j_ < d\<rbrakk> \<Longrightarrow> encode1 j_ < dim_col m2
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> (m1 $$ (encode1 i, encode1 j) - m2 $$ (encode1 i, encode1 j)) * m3 $$ (encode2 i, encode2 j) = m1 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j) - m2 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j)
[PROOF STEP]
using assms(2) ring_class.left_diff_distrib
[PROOF STATE]
proof (prove)
using this:
m2 \<in> carrier_mat d1 d1
(?a - ?b) * ?c = ?a * ?c - ?b * ?c

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> (m1 $$ (encode1 i, encode1 j) - m2 $$ (encode1 i, encode1 j)) * m3 $$ (encode2 i, encode2 j) = m1 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j) - m2 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j)
[PROOF STEP]
by force


[STATEMENT]
lemma glb_dual_lub: "glb S cl = lub S (dual cl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. glb S cl = lub S (dual cl)
[PROOF STEP]
by (simp add: lub_def glb_def least_def greatest_def dual_def converse_unfold)


[STATEMENT]
lemma orthogonal_complement_subset:
  assumes "A \<subseteq> B"
  shows "orthogonal_complement B \<subseteq> orthogonal_complement A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement B \<subseteq> orthogonal_complement A
[PROOF STEP]
unfolding orthogonal_complement_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> carrier_vec n. \<forall>y\<in>B. x \<bullet> y = (0::'b)} \<subseteq> {x \<in> carrier_vec n. \<forall>y\<in>A. x \<bullet> y = (0::'b)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B

goal (1 subgoal):
 1. {x \<in> carrier_vec n. \<forall>y\<in>B. x \<bullet> y = (0::'b)} \<subseteq> {x \<in> carrier_vec n. \<forall>y\<in>A. x \<bullet> y = (0::'b)}
[PROOF STEP]
by auto


[STATEMENT]
theorem meld_invar:
  "\<lbrakk>invar bq1; invar bq2\<rbrakk>
  \<Longrightarrow> invar (meld bq1 bq2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar bq1; invar bq2\<rbrakk> \<Longrightarrow> invar (meld bq1 bq2)
[PROOF STEP]
by (metis meld_queue_invar rank_meld invar_def)


[STATEMENT]
lemma subadditive_converges_ereal:
  assumes "subadditive u"
  shows "(\<lambda>m. ereal(u m/m)) \<longlonglongrightarrow> Inf {ereal(u n/n) | n. n>0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. ereal (u m / real m)) \<longlonglongrightarrow> Inf {ereal (u n / real n) |n. 0 < n}
[PROOF STEP]
by (rule subadditive_converges_ereal'[OF subadditive_imp_eventually_subadditive[OF assms]])


[STATEMENT]
lemma mult_mm_non_zero_r:
  assumes "A \<noteq> mat_zero" and "mat_det B \<noteq> 0"
  shows "A *\<^sub>m\<^sub>m B \<noteq> mat_zero"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>m\<^sub>m B \<noteq> mat_zero
[PROOF STEP]
using assms mat_zero_l
[PROOF STATE]
proof (prove)
using this:
A \<noteq> mat_zero
mat_det B \<noteq> 0
mat_zero *\<^sub>m\<^sub>m ?A = mat_zero

goal (1 subgoal):
 1. A *\<^sub>m\<^sub>m B \<noteq> mat_zero
[PROOF STEP]
using mult_mm_inv_r[OF assms(2), of A mat_zero]
[PROOF STATE]
proof (prove)
using this:
A \<noteq> mat_zero
mat_det B \<noteq> 0
mat_zero *\<^sub>m\<^sub>m ?A = mat_zero
A *\<^sub>m\<^sub>m B = mat_zero \<Longrightarrow> A = mat_zero *\<^sub>m\<^sub>m mat_inv B

goal (1 subgoal):
 1. A *\<^sub>m\<^sub>m B \<noteq> mat_zero
[PROOF STEP]
by auto


[STATEMENT]
lemma suminf_offset:
  fixes f g :: "nat \<Rightarrow> 'a :: {t2_space, topological_comm_monoid_add}"
  shows "summable (\<lambda>j. f (j + i)) \<Longrightarrow> suminf f = (\<Sum>j. f (j + i)) + (\<Sum>j<i. f j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>j. f (j + i)) \<Longrightarrow> suminf f = (\<Sum>j. f (j + i)) + sum f {..<i}
[PROOF STEP]
by (intro sums_unique[symmetric] sums_offset summable_sums)


[STATEMENT]
lemma my_div_exp_min1:
  assumes "2^(Suc l) \<le> n"
  shows "(\<mu> ^(n div 2^(Suc l)))^(2^l) = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<mu> ^ (n div 2 ^ Suc l)) ^ 2 ^ l = - 1
[PROOF STEP]
by (metis assms divide_minus1 mult_zero_right mu_properties(1) nonzero_mult_div_cancel_right omega_div_exp_min1 power_one_over zero_neq_one)


[STATEMENT]
lemma divisor_sigma_conv_dirichlet_prod:
  "divisor_sigma x n = dirichlet_prod (\<lambda>n. real n powr x) (\<lambda>_. 1) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_sigma x n = dirichlet_prod (\<lambda>n. real n powr x) (\<lambda>_. 1) n
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_sigma x n = dirichlet_prod (\<lambda>n. real n powr x) (\<lambda>_. 1) n
 2. n \<noteq> 0 \<Longrightarrow> divisor_sigma x n = dirichlet_prod (\<lambda>n. real n powr x) (\<lambda>_. 1) n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_sigma x n = dirichlet_prod (\<lambda>n. real n powr x) (\<lambda>_. 1) n
 2. n \<noteq> 0 \<Longrightarrow> divisor_sigma x n = dirichlet_prod (\<lambda>n. real n powr x) (\<lambda>_. 1) n
[PROOF STEP]
have "fds (divisor_sigma x) = fds_shift x fds_zeta * fds_zeta"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds (divisor_sigma x) = fds_shift x fds_zeta * fds_zeta
[PROOF STEP]
using fds_divisor_sigma[of x]
[PROOF STATE]
proof (prove)
using this:
fds (divisor_sigma x) = fds_zeta * fds_shift x fds_zeta

goal (1 subgoal):
 1. fds (divisor_sigma x) = fds_shift x fds_zeta * fds_zeta
[PROOF STEP]
by (simp add: mult_ac)
[PROOF STATE]
proof (state)
this:
fds (divisor_sigma x) = fds_shift x fds_zeta * fds_zeta

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_sigma x n = dirichlet_prod (\<lambda>n. real n powr x) (\<lambda>_. 1) n
 2. n \<noteq> 0 \<Longrightarrow> divisor_sigma x n = dirichlet_prod (\<lambda>n. real n powr x) (\<lambda>_. 1) n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
fds (divisor_sigma x) = fds_shift x fds_zeta * fds_zeta

goal (1 subgoal):
 1. divisor_sigma x n = dirichlet_prod (\<lambda>n. real n powr x) (\<lambda>_. 1) n
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
fds (divisor_sigma x) = fds_shift x fds_zeta * fds_zeta
n \<noteq> 0

goal (1 subgoal):
 1. divisor_sigma x n = dirichlet_prod (\<lambda>n. real n powr x) (\<lambda>_. 1) n
[PROOF STEP]
by (auto simp: fds_eq_iff fds_nth_mult)
[PROOF STATE]
proof (state)
this:
divisor_sigma x n = dirichlet_prod (\<lambda>n. real n powr x) (\<lambda>_. 1) n

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> divisor_sigma x n = dirichlet_prod (\<lambda>n. real n powr x) (\<lambda>_. 1) n
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma
  fixes s :: "'a :: {nat_power_normed_field,banach,euclidean_space}"
  assumes "s \<bullet> 1 > 1"
  shows   euler_product_fds_zeta:
            "(\<lambda>n. \<Prod>p\<le>n. if prime p then inverse (1 - 1 / nat_power p s) else 1)
                \<longlonglongrightarrow> eval_fds fds_zeta s" (is ?th1)
  and     eval_fds_zeta_nonzero: "eval_fds fds_zeta s \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s &&& eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s
 2. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
have *: "completely_multiplicative_function (fds_nth fds_zeta)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. completely_multiplicative_function (fds_nth fds_zeta)
[PROOF STEP]
by standard auto
[PROOF STATE]
proof (state)
this:
completely_multiplicative_function (fds_nth fds_zeta)

goal (2 subgoals):
 1. (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s
 2. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
have lim: "(\<lambda>n. \<Prod>p\<le>n. if prime p then inverse (1 - fds_nth fds_zeta p / nat_power p s) else 1)
          \<longlonglongrightarrow> eval_fds fds_zeta s" (is "filterlim ?g _ _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - fds_nth fds_zeta p / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < s \<bullet> (1::'a)

goal (1 subgoal):
 1. (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - fds_nth fds_zeta p / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s
[PROOF STEP]
by (intro fds_euler_product_LIMSEQ' * fds_abs_summable_zeta)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - fds_nth fds_zeta p / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s

goal (2 subgoals):
 1. (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s
 2. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - fds_nth fds_zeta p / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s

goal (2 subgoals):
 1. (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s
 2. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
have "?g = (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse (1 - 1 / nat_power p s) else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - fds_nth fds_zeta p / nat_power p s) else (1::'a)) = (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a))
[PROOF STEP]
by (intro ext prod.cong refl) (auto simp: fds_zeta_def fds_nth_fds)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - fds_nth fds_zeta p / nat_power p s) else (1::'a)) = (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a))

goal (2 subgoals):
 1. (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s
 2. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s
[PROOF STEP]
show ?th1
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s

goal (1 subgoal):
 1. (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s

goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - (1::'a) / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds fds_zeta s

goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
fix p :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
assume "prime p"
[PROOF STATE]
proof (state)
this:
prime p

goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
prime p
[PROOF STEP]
have "p > 1"
[PROOF STATE]
proof (prove)
using this:
prime p

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

goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
hence "norm (nat_power p s) = real p powr (s \<bullet> 1)"
[PROOF STATE]
proof (prove)
using this:
1 < p

goal (1 subgoal):
 1. norm (nat_power p s) = real p powr (s \<bullet> (1::'a))
[PROOF STEP]
by (simp add: norm_nat_power)
[PROOF STATE]
proof (state)
this:
norm (nat_power p s) = real p powr (s \<bullet> (1::'a))

goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (nat_power p s) = real p powr (s \<bullet> (1::'a))

goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
have "\<dots> > real p powr 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real p powr 0 < real p powr (s \<bullet> (1::'a))
[PROOF STEP]
using assms and \<open>p > 1\<close>
[PROOF STATE]
proof (prove)
using this:
1 < s \<bullet> (1::'a)
1 < p

goal (1 subgoal):
 1. real p powr 0 < real p powr (s \<bullet> (1::'a))
[PROOF STEP]
by (intro powr_less_mono) auto
[PROOF STATE]
proof (state)
this:
real p powr 0 < real p powr (s \<bullet> (1::'a))

goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real p powr 0 < norm (nat_power p s)
[PROOF STEP]
have "nat_power p s \<noteq> 1"
[PROOF STATE]
proof (prove)
using this:
real p powr 0 < norm (nat_power p s)

goal (1 subgoal):
 1. nat_power p s \<noteq> (1::'a)
[PROOF STEP]
using \<open>p > 1\<close>
[PROOF STATE]
proof (prove)
using this:
real p powr 0 < norm (nat_power p s)
1 < p

goal (1 subgoal):
 1. nat_power p s \<noteq> (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_power p s \<noteq> (1::'a)

goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
prime ?p3 \<Longrightarrow> nat_power ?p3 s \<noteq> (1::'a)

goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
hence **: "\<nexists>p. prime p \<and> fds_nth fds_zeta p = nat_power p s"
[PROOF STATE]
proof (prove)
using this:
prime ?p3 \<Longrightarrow> nat_power ?p3 s \<noteq> (1::'a)

goal (1 subgoal):
 1. \<nexists>p. prime p \<and> fds_nth fds_zeta p = nat_power p s
[PROOF STEP]
by (auto simp: fds_zeta_def fds_nth_fds)
[PROOF STATE]
proof (state)
this:
\<nexists>p. prime p \<and> fds_nth fds_zeta p = nat_power p s

goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
show "eval_fds fds_zeta s \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
using assms * **
[PROOF STATE]
proof (prove)
using this:
1 < s \<bullet> (1::'a)
completely_multiplicative_function (fds_nth fds_zeta)
\<nexists>p. prime p \<and> fds_nth fds_zeta p = nat_power p s

goal (1 subgoal):
 1. eval_fds fds_zeta s \<noteq> (0::'a)
[PROOF STEP]
by (subst fds_abs_convergent_zero_iff) simp_all
[PROOF STATE]
proof (state)
this:
eval_fds fds_zeta s \<noteq> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [field_split_simps]:
  "0 < c \<Longrightarrow> a \<le> b /\<^sub>R c \<longleftrightarrow> (if c > 0 then c *\<^sub>R a \<le> b else if c < 0 then b \<le> c *\<^sub>R a else a \<le> 0)"
  "0 < c \<Longrightarrow> a < b /\<^sub>R c \<longleftrightarrow> (if c > 0 then c *\<^sub>R a < b else if c < 0 then b < c *\<^sub>R a else a < 0)"
  "0 < c \<Longrightarrow> b /\<^sub>R c \<le> a \<longleftrightarrow> (if c > 0 then b \<le> c *\<^sub>R a else if c < 0 then c *\<^sub>R a \<le> b else a \<ge> 0)"
  "0 < c \<Longrightarrow> b /\<^sub>R c < a \<longleftrightarrow> (if c > 0 then b < c *\<^sub>R a else if c < 0 then c *\<^sub>R a < b else a > 0)"
  "0 < c \<Longrightarrow> a \<le> - (b /\<^sub>R c) \<longleftrightarrow> (if c > 0 then c *\<^sub>R a \<le> - b else if c < 0 then - b \<le> c *\<^sub>R a else a \<le> 0)"
  "0 < c \<Longrightarrow> a < - (b /\<^sub>R c) \<longleftrightarrow> (if c > 0 then c *\<^sub>R a < - b else if c < 0 then - b < c *\<^sub>R a else a < 0)"
  "0 < c \<Longrightarrow> - (b /\<^sub>R c) \<le> a \<longleftrightarrow> (if c > 0 then - b \<le> c *\<^sub>R a else if c < 0 then c *\<^sub>R a \<le> - b else a \<ge> 0)"
  "0 < c \<Longrightarrow> - (b /\<^sub>R c) < a \<longleftrightarrow> (if c > 0 then - b < c *\<^sub>R a else if c < 0 then c *\<^sub>R a < - b else a > 0)"
  for a b :: "'a :: ordered_real_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((0 < c \<Longrightarrow> (a \<le> b /\<^sub>R c) = (if 0 < c then c *\<^sub>R a \<le> b else if c < 0 then b \<le> c *\<^sub>R a else a \<le> (0::'a))) &&& (0 < c \<Longrightarrow> (a < b /\<^sub>R c) = (if 0 < c then c *\<^sub>R a < b else if c < 0 then b < c *\<^sub>R a else a < (0::'a)))) &&& (0 < c \<Longrightarrow> (b /\<^sub>R c \<le> a) = (if 0 < c then b \<le> c *\<^sub>R a else if c < 0 then c *\<^sub>R a \<le> b else (0::'a) \<le> a)) &&& (0 < c \<Longrightarrow> (b /\<^sub>R c < a) = (if 0 < c then b < c *\<^sub>R a else if c < 0 then c *\<^sub>R a < b else (0::'a) < a))) &&& ((0 < c \<Longrightarrow> (a \<le> - (b /\<^sub>R c)) = (if 0 < c then c *\<^sub>R a \<le> - b else if c < 0 then - b \<le> c *\<^sub>R a else a \<le> (0::'a))) &&& (0 < c \<Longrightarrow> (a < - (b /\<^sub>R c)) = (if 0 < c then c *\<^sub>R a < - b else if c < 0 then - b < c *\<^sub>R a else a < (0::'a)))) &&& (0 < c \<Longrightarrow> (- (b /\<^sub>R c) \<le> a) = (if 0 < c then - b \<le> c *\<^sub>R a else if c < 0 then c *\<^sub>R a \<le> - b else (0::'a) \<le> a)) &&& (0 < c \<Longrightarrow> (- (b /\<^sub>R c) < a) = (if 0 < c then - b < c *\<^sub>R a else if c < 0 then c *\<^sub>R a < - b else (0::'a) < a))
[PROOF STEP]
by (clarsimp intro!: field_simps)+


[STATEMENT]
lemma to_fun_Fun_add:
  assumes "x \<in> carrier P"
  assumes "y \<in> carrier P"
  shows "to_fun (x \<oplus>\<^bsub>P\<^esub> y) = to_fun x \<oplus>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (x \<oplus>\<^bsub>P\<^esub> y) = to_fun x \<oplus>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y
[PROOF STEP]
apply(rule ring_functions.function_ring_car_eqI[of R _ "carrier R"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. ring_functions R
 2. to_fun (x \<oplus>\<^bsub>P\<^esub> y) \<in> carrier (function_ring (carrier R) R)
 3. to_fun x \<oplus>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y \<in> carrier (function_ring (carrier R) R)
 4. \<And>a. a \<in> carrier R \<Longrightarrow> to_fun (x \<oplus>\<^bsub>P\<^esub> y) a = (to_fun x \<oplus>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y) a
[PROOF STEP]
apply (simp add: R.ring_axioms ring_functions_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. to_fun (x \<oplus>\<^bsub>P\<^esub> y) \<in> carrier (function_ring (carrier R) R)
 2. to_fun x \<oplus>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y \<in> carrier (function_ring (carrier R) R)
 3. \<And>a. a \<in> carrier R \<Longrightarrow> to_fun (x \<oplus>\<^bsub>P\<^esub> y) a = (to_fun x \<oplus>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y) a
[PROOF STEP]
apply (simp add: assms(1) assms(2) to_fun_is_Fun)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. to_fun x \<oplus>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y \<in> carrier (function_ring (carrier R) R)
 2. \<And>a. a \<in> carrier R \<Longrightarrow> to_fun (x \<oplus>\<^bsub>P\<^esub> y) a = (to_fun x \<oplus>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y) a
[PROOF STEP]
apply (simp add: R.ring_axioms assms(1) assms(2) ring_functions.fun_add_closed ring_functions.intro to_fun_is_Fun)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<in> carrier R \<Longrightarrow> to_fun (x \<oplus>\<^bsub>P\<^esub> y) a = (to_fun x \<oplus>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y) a
[PROOF STEP]
by (simp add: R.ring_axioms assms(1) assms(2) ring_functions.fun_add_eval_car ring_functions.intro to_fun_is_Fun to_fun_plus)


[STATEMENT]
lemma set_integral_finite_Union:
  fixes f :: "_ \<Rightarrow> _ :: {banach, second_countable_topology}"
  assumes "finite I" "disjoint_family_on A I"
    and "\<And>i. i \<in> I \<Longrightarrow> set_integrable M (A i) f" "\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets M"
  shows "(LINT x:(\<Union>i\<in>I. A i)|M. f x) = (\<Sum>i\<in>I. LINT x:A i|M. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_lebesgue_integral M (\<Union> (A ` I)) f = (\<Sum>i\<in>I. set_lebesgue_integral M (A i) f)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite I
disjoint_family_on A I
?i \<in> I \<Longrightarrow> set_integrable M (A ?i) f
?i \<in> I \<Longrightarrow> A ?i \<in> sets M

goal (1 subgoal):
 1. set_lebesgue_integral M (\<Union> (A ` I)) f = (\<Sum>i\<in>I. set_lebesgue_integral M (A i) f)
[PROOF STEP]
proof induction
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>disjoint_family_on A {}; \<And>i. i \<in> {} \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> {} \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` {})) f = (\<Sum>i\<in>{}. set_lebesgue_integral M (A i) f)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> F \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` F)) f = (\<Sum>i\<in>F. set_lebesgue_integral M (A i) f); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` insert x F)) f = (\<Sum>i\<in>insert x F. set_lebesgue_integral M (A i) f)
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
\<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> F \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` F)) f = (\<Sum>i\<in>F. set_lebesgue_integral M (A i) f)
disjoint_family_on A (insert x F)
?i \<in> insert x F \<Longrightarrow> set_integrable M (A ?i) f
?i \<in> insert x F \<Longrightarrow> A ?i \<in> sets M

goal (2 subgoals):
 1. \<lbrakk>disjoint_family_on A {}; \<And>i. i \<in> {} \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> {} \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` {})) f = (\<Sum>i\<in>{}. set_lebesgue_integral M (A i) f)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> F \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` F)) f = (\<Sum>i\<in>F. set_lebesgue_integral M (A i) f); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` insert x F)) f = (\<Sum>i\<in>insert x F. set_lebesgue_integral M (A i) f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
\<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> F \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` F)) f = (\<Sum>i\<in>F. set_lebesgue_integral M (A i) f)
disjoint_family_on A (insert x F)
?i \<in> insert x F \<Longrightarrow> set_integrable M (A ?i) f
?i \<in> insert x F \<Longrightarrow> A ?i \<in> sets M
[PROOF STEP]
have "A x \<inter> \<Union>(A ` F) = {}"
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> F \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` F)) f = (\<Sum>i\<in>F. set_lebesgue_integral M (A i) f)
disjoint_family_on A (insert x F)
?i \<in> insert x F \<Longrightarrow> set_integrable M (A ?i) f
?i \<in> insert x F \<Longrightarrow> A ?i \<in> sets M

goal (1 subgoal):
 1. A x \<inter> \<Union> (A ` F) = {}
[PROOF STEP]
by (meson disjoint_family_on_insert)
[PROOF STATE]
proof (state)
this:
A x \<inter> \<Union> (A ` F) = {}

goal (2 subgoals):
 1. \<lbrakk>disjoint_family_on A {}; \<And>i. i \<in> {} \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> {} \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` {})) f = (\<Sum>i\<in>{}. set_lebesgue_integral M (A i) f)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> F \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` F)) f = (\<Sum>i\<in>F. set_lebesgue_integral M (A i) f); disjoint_family_on A (insert x F); \<And>i. i \<in> insert x F \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` insert x F)) f = (\<Sum>i\<in>insert x F. set_lebesgue_integral M (A i) f)
[PROOF STEP]
with insert
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
\<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> F \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` F)) f = (\<Sum>i\<in>F. set_lebesgue_integral M (A i) f)
disjoint_family_on A (insert x F)
?i \<in> insert x F \<Longrightarrow> set_integrable M (A ?i) f
?i \<in> insert x F \<Longrightarrow> A ?i \<in> sets M
A x \<inter> \<Union> (A ` F) = {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>disjoint_family_on A F; \<And>i. i \<in> F \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> F \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` F)) f = (\<Sum>i\<in>F. set_lebesgue_integral M (A i) f)
disjoint_family_on A (insert x F)
?i \<in> insert x F \<Longrightarrow> set_integrable M (A ?i) f
?i \<in> insert x F \<Longrightarrow> A ?i \<in> sets M
A x \<inter> \<Union> (A ` F) = {}

goal (1 subgoal):
 1. set_lebesgue_integral M (\<Union> (A ` insert x F)) f = (\<Sum>i\<in>insert x F. set_lebesgue_integral M (A i) f)
[PROOF STEP]
by (simp add: set_integral_Un set_integrable_Un set_integrable_UN disjoint_family_on_insert)
[PROOF STATE]
proof (state)
this:
set_lebesgue_integral M (\<Union> (A ` insert x F)) f = (\<Sum>i\<in>insert x F. set_lebesgue_integral M (A i) f)

goal (1 subgoal):
 1. \<lbrakk>disjoint_family_on A {}; \<And>i. i \<in> {} \<Longrightarrow> set_integrable M (A i) f; \<And>i. i \<in> {} \<Longrightarrow> A i \<in> sets M\<rbrakk> \<Longrightarrow> set_lebesgue_integral M (\<Union> (A ` {})) f = (\<Sum>i\<in>{}. set_lebesgue_integral M (A i) f)
[PROOF STEP]
qed (simp add: set_lebesgue_integral_def)


[STATEMENT]
lemma ptensor_vec_add:
  fixes v1 v2 v3 :: "'a::comm_ring vec"
  assumes "v1 \<in> carrier_vec d1"
    and "v2 \<in> carrier_vec d1"
    and "v3 \<in> carrier_vec d2"
  shows "ptensor_vec (v1 + v2) v3 = ptensor_vec v1 v3 + ptensor_vec v2 v3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ptensor_vec (v1 + v2) v3 = ptensor_vec v1 v3 + ptensor_vec v2 v3
[PROOF STEP]
unfolding ptensor_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partial_state.tensor_vec dims0 vars1' (v1 + v2) v3 = partial_state.tensor_vec dims0 vars1' v1 v3 + partial_state.tensor_vec dims0 vars1' v2 v3
[PROOF STEP]
apply (rule partial_state.tensor_vec_add1)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. v1 \<in> carrier_vec (partial_state.d1 dims0 vars1')
 2. v2 \<in> carrier_vec (partial_state.d1 dims0 vars1')
 3. v3 \<in> carrier_vec (partial_state.d2 dims0 vars1')
[PROOF STEP]
unfolding partial_state.d1_def partial_state.d2_def
    partial_state.dims1_def partial_state.dims2_def nths_vars1' nths_vars2'
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. v1 \<in> carrier_vec (prod_list dims1)
 2. v2 \<in> carrier_vec (prod_list dims1)
 3. v3 \<in> carrier_vec (prod_list dims2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v1 \<in> carrier_vec d1
v2 \<in> carrier_vec d1
v3 \<in> carrier_vec d2

goal (3 subgoals):
 1. v1 \<in> carrier_vec (prod_list dims1)
 2. v2 \<in> carrier_vec (prod_list dims1)
 3. v3 \<in> carrier_vec (prod_list dims2)
[PROOF STEP]
unfolding d1_def d2_def
[PROOF STATE]
proof (prove)
using this:
v1 \<in> carrier_vec (prod_list dims1)
v2 \<in> carrier_vec (prod_list dims1)
v3 \<in> carrier_vec (prod_list dims2)

goal (3 subgoals):
 1. v1 \<in> carrier_vec (prod_list dims1)
 2. v2 \<in> carrier_vec (prod_list dims1)
 3. v3 \<in> carrier_vec (prod_list dims2)
[PROOF STEP]
by auto


[STATEMENT]
lemma intersects_x_axis_positive_iff':
  assumes "is_poincare_line H"
  shows "intersects_x_axis_positive H \<longleftrightarrow>
         calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis" (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. intersects_x_axis_positive H = (calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. intersects_x_axis_positive H \<Longrightarrow> calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis
 2. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis \<Longrightarrow> intersects_x_axis_positive H
[PROOF STEP]
let ?x = "calc_x_axis_intersection H"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. intersects_x_axis_positive H \<Longrightarrow> calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis
 2. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis \<Longrightarrow> intersects_x_axis_positive H
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
intersects_x_axis_positive H

goal (2 subgoals):
 1. intersects_x_axis_positive H \<Longrightarrow> calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis
 2. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis \<Longrightarrow> intersects_x_axis_positive H
[PROOF STEP]
hence "?x \<in> circline_set x_axis" "?x \<in> circline_set H" "?x \<in> unit_disc"
[PROOF STATE]
proof (prove)
using this:
intersects_x_axis_positive H

goal (1 subgoal):
 1. calc_x_axis_intersection H \<in> circline_set x_axis &&& calc_x_axis_intersection H \<in> circline_set H &&& calc_x_axis_intersection H \<in> unit_disc
[PROOF STEP]
using calc_x_axis_intersection_in_unit_disc[OF assms] calc_x_axis_intersection[OF assms]
[PROOF STATE]
proof (prove)
using this:
intersects_x_axis_positive H
intersects_x_axis H \<Longrightarrow> calc_x_axis_intersection H \<in> unit_disc
intersects_x_axis H \<Longrightarrow> calc_x_axis_intersection H \<in> circline_set H \<inter> circline_set x_axis

goal (1 subgoal):
 1. calc_x_axis_intersection H \<in> circline_set x_axis &&& calc_x_axis_intersection H \<in> circline_set H &&& calc_x_axis_intersection H \<in> unit_disc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
calc_x_axis_intersection H \<in> circline_set x_axis
calc_x_axis_intersection H \<in> circline_set H
calc_x_axis_intersection H \<in> unit_disc

goal (2 subgoals):
 1. intersects_x_axis_positive H \<Longrightarrow> calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis
 2. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis \<Longrightarrow> intersects_x_axis_positive H
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
calc_x_axis_intersection H \<in> circline_set x_axis
calc_x_axis_intersection H \<in> circline_set H
calc_x_axis_intersection H \<in> unit_disc

goal (2 subgoals):
 1. intersects_x_axis_positive H \<Longrightarrow> calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis
 2. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis \<Longrightarrow> intersects_x_axis_positive H
[PROOF STEP]
have "Re (to_complex ?x) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Re (to_complex (calc_x_axis_intersection H))
[PROOF STEP]
using \<open>?lhs\<close> assms
[PROOF STATE]
proof (prove)
using this:
intersects_x_axis_positive H
is_poincare_line H

goal (1 subgoal):
 1. 0 < Re (to_complex (calc_x_axis_intersection H))
[PROOF STEP]
proof (transfer, transfer)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
fix H
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
assume hh: "hermitean H \<and> H \<noteq> mat_zero"
[PROOF STATE]
proof (state)
this:
hermitean H \<and> H \<noteq> mat_zero

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
obtain A B C D where *: "H = (A, B, C, D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A B C D. H = (A, B, C, D) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases H, auto)
[PROOF STATE]
proof (state)
this:
H = (A, B, C, D)

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
assume "intersects_x_axis_positive_cmat H"
[PROOF STATE]
proof (state)
this:
intersects_x_axis_positive_cmat H

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
hence **: "Re B / Re A < - 1" "Re A \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
intersects_x_axis_positive_cmat H

goal (1 subgoal):
 1. Re B / Re A < - 1 &&& Re A \<noteq> 0
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
intersects_x_axis_positive_cmat H
H = (A, B, C, D)

goal (1 subgoal):
 1. Re B / Re A < - 1 &&& Re A \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re B / Re A < - 1
Re A \<noteq> 0

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
have "(Re B)\<^sup>2 > (Re A)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Re A)\<^sup>2 < (Re B)\<^sup>2
[PROOF STEP]
using **
[PROOF STATE]
proof (prove)
using this:
Re B / Re A < - 1
Re A \<noteq> 0

goal (1 subgoal):
 1. (Re A)\<^sup>2 < (Re B)\<^sup>2
[PROOF STEP]
by (smt divide_less_eq_1_neg divide_minus_left less_divide_eq_1_pos real_sqrt_abs real_sqrt_less_iff right_inverse_eq)
[PROOF STATE]
proof (state)
this:
(Re A)\<^sup>2 < (Re B)\<^sup>2

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
have "is_real A" "A \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_real A &&& A \<noteq> 0
[PROOF STEP]
using hh hermitean_elems * \<open>Re A \<noteq> 0\<close> complex.expand[of A 0]
[PROOF STATE]
proof (prove)
using this:
hermitean H \<and> H \<noteq> mat_zero
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> is_real ?A
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> is_real ?D
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> ?B = cnj ?C
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> cnj ?B = ?C
H = (A, B, C, D)
Re A \<noteq> 0
Re A = Re 0 \<and> Im A = Im 0 \<Longrightarrow> A = 0

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

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
have "(cmod B)\<^sup>2 > (cmod A)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod A)\<^sup>2 < (cmod B)\<^sup>2
[PROOF STEP]
using \<open>(Re B)\<^sup>2 > (Re A)\<^sup>2\<close> \<open>is_real A\<close>
[PROOF STATE]
proof (prove)
using this:
(Re A)\<^sup>2 < (Re B)\<^sup>2
is_real A

goal (1 subgoal):
 1. (cmod A)\<^sup>2 < (cmod B)\<^sup>2
[PROOF STEP]
by (smt cmod_power2 power2_less_0 zero_power2)
[PROOF STATE]
proof (state)
this:
(cmod A)\<^sup>2 < (cmod B)\<^sup>2

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
have ***: "0 < (- Re B + sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) / Re A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < (- Re B + sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) / Re A
[PROOF STEP]
using calc_intersect_x_axis_positive_lemma[of "Re A" "Re B"] ** \<open>(Re B)\<^sup>2 > (Re A)\<^sup>2\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(Re A)\<^sup>2 < (Re B)\<^sup>2; Re A \<noteq> 0\<rbrakk> \<Longrightarrow> (0 < (- Re B + sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) / Re A) = (1 < - Re B / Re A)
Re B / Re A < - 1
Re A \<noteq> 0
(Re A)\<^sup>2 < (Re B)\<^sup>2

goal (1 subgoal):
 1. 0 < (- Re B + sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) / Re A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < (- Re B + sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) / Re A

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
assume "is_poincare_line_cmat H"
[PROOF STATE]
proof (state)
this:
is_poincare_line_cmat H

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
hence "A = D"
[PROOF STATE]
proof (prove)
using this:
is_poincare_line_cmat H

goal (1 subgoal):
 1. A = D
[PROOF STEP]
using * hh
[PROOF STATE]
proof (prove)
using this:
is_poincare_line_cmat H
H = (A, B, C, D)
hermitean H \<and> H \<noteq> mat_zero

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

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
have "Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) - cor (Re B)) / A) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2) - Re B) / Re D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) - cor (Re B)) / A) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2) - Re B) / Re D
[PROOF STEP]
using \<open>is_real A\<close> \<open>A = D\<close>
[PROOF STATE]
proof (prove)
using this:
is_real A
A = D

goal (1 subgoal):
 1. Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) - cor (Re B)) / A) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2) - Re B) / Re D
[PROOF STEP]
by (metis (no_types, lifting) Re_complex_of_real complex_of_real_Re of_real_diff of_real_divide of_real_mult)
[PROOF STATE]
proof (state)
this:
Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) - cor (Re B)) / A) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2) - Re B) / Re D

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_positive_cmat H; is_poincare_line_cmat H; intersects_x_axis_positive_clmat Ha; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
thus "0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))"
[PROOF STATE]
proof (prove)
using this:
Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) - cor (Re B)) / A) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2) - Re B) / Re D

goal (1 subgoal):
 1. 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
using * hh ** *** \<open>(cmod B)\<^sup>2 > (cmod A)\<^sup>2\<close> \<open>(Re B)\<^sup>2 > (Re A)\<^sup>2\<close> \<open>A \<noteq> 0\<close> \<open>A = D\<close>
[PROOF STATE]
proof (prove)
using this:
Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) - cor (Re B)) / A) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2) - Re B) / Re D
H = (A, B, C, D)
hermitean H \<and> H \<noteq> mat_zero
Re B / Re A < - 1
Re A \<noteq> 0
0 < (- Re B + sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) / Re A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
(Re A)\<^sup>2 < (Re B)\<^sup>2
A \<noteq> 0
A = D

goal (1 subgoal):
 1. 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < Re (to_complex (calc_x_axis_intersection H))

goal (2 subgoals):
 1. intersects_x_axis_positive H \<Longrightarrow> calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis
 2. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis \<Longrightarrow> intersects_x_axis_positive H
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
calc_x_axis_intersection H \<in> circline_set x_axis
calc_x_axis_intersection H \<in> circline_set H
calc_x_axis_intersection H \<in> unit_disc
0 < Re (to_complex (calc_x_axis_intersection H))
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
calc_x_axis_intersection H \<in> circline_set x_axis
calc_x_axis_intersection H \<in> circline_set H
calc_x_axis_intersection H \<in> unit_disc
0 < Re (to_complex (calc_x_axis_intersection H))

goal (1 subgoal):
 1. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis
[PROOF STEP]
unfolding positive_x_axis_def
[PROOF STATE]
proof (prove)
using this:
calc_x_axis_intersection H \<in> circline_set x_axis
calc_x_axis_intersection H \<in> circline_set H
calc_x_axis_intersection H \<in> unit_disc
0 < Re (to_complex (calc_x_axis_intersection H))

goal (1 subgoal):
 1. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> {z \<in> circline_set x_axis. z \<noteq> \<infinity>\<^sub>h \<and> 0 < Re (to_complex z)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis

goal (1 subgoal):
 1. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis \<Longrightarrow> intersects_x_axis_positive H
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis \<Longrightarrow> intersects_x_axis_positive H
[PROOF STEP]
let ?x = "calc_x_axis_intersection H"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis \<Longrightarrow> intersects_x_axis_positive H
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis

goal (1 subgoal):
 1. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis \<Longrightarrow> intersects_x_axis_positive H
[PROOF STEP]
hence "Re (to_complex ?x) > 0"  "?x \<noteq> \<infinity>\<^sub>h" "?x \<in> circline_set x_axis" "?x \<in> unit_disc" "?x \<in> circline_set H"
[PROOF STATE]
proof (prove)
using this:
calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis

goal (1 subgoal):
 1. (0 < Re (to_complex (calc_x_axis_intersection H)) &&& calc_x_axis_intersection H \<noteq> \<infinity>\<^sub>h) &&& calc_x_axis_intersection H \<in> circline_set x_axis &&& calc_x_axis_intersection H \<in> unit_disc &&& calc_x_axis_intersection H \<in> circline_set H
[PROOF STEP]
unfolding positive_x_axis_def
[PROOF STATE]
proof (prove)
using this:
calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> {z \<in> circline_set x_axis. z \<noteq> \<infinity>\<^sub>h \<and> 0 < Re (to_complex z)}

goal (1 subgoal):
 1. (0 < Re (to_complex (calc_x_axis_intersection H)) &&& calc_x_axis_intersection H \<noteq> \<infinity>\<^sub>h) &&& calc_x_axis_intersection H \<in> circline_set x_axis &&& calc_x_axis_intersection H \<in> unit_disc &&& calc_x_axis_intersection H \<in> circline_set H
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < Re (to_complex (calc_x_axis_intersection H))
calc_x_axis_intersection H \<noteq> \<infinity>\<^sub>h
calc_x_axis_intersection H \<in> circline_set x_axis
calc_x_axis_intersection H \<in> unit_disc
calc_x_axis_intersection H \<in> circline_set H

goal (1 subgoal):
 1. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis \<Longrightarrow> intersects_x_axis_positive H
[PROOF STEP]
hence "intersects_x_axis H"
[PROOF STATE]
proof (prove)
using this:
0 < Re (to_complex (calc_x_axis_intersection H))
calc_x_axis_intersection H \<noteq> \<infinity>\<^sub>h
calc_x_axis_intersection H \<in> circline_set x_axis
calc_x_axis_intersection H \<in> unit_disc
calc_x_axis_intersection H \<in> circline_set H

goal (1 subgoal):
 1. intersects_x_axis H
[PROOF STEP]
using intersects_x_axis_iff[OF assms]
[PROOF STATE]
proof (prove)
using this:
0 < Re (to_complex (calc_x_axis_intersection H))
calc_x_axis_intersection H \<noteq> \<infinity>\<^sub>h
calc_x_axis_intersection H \<in> circline_set x_axis
calc_x_axis_intersection H \<in> unit_disc
calc_x_axis_intersection H \<in> circline_set H
(\<exists>x\<in>unit_disc. x \<in> circline_set H \<inter> circline_set x_axis) = intersects_x_axis H

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

goal (1 subgoal):
 1. calc_x_axis_intersection H \<in> unit_disc \<and> calc_x_axis_intersection H \<in> circline_set H \<inter> positive_x_axis \<Longrightarrow> intersects_x_axis_positive H
[PROOF STEP]
thus ?lhs
[PROOF STATE]
proof (prove)
using this:
intersects_x_axis H

goal (1 subgoal):
 1. intersects_x_axis_positive H
[PROOF STEP]
using \<open>Re (to_complex ?x) > 0\<close> assms
[PROOF STATE]
proof (prove)
using this:
intersects_x_axis H
0 < Re (to_complex (calc_x_axis_intersection H))
is_poincare_line H

goal (1 subgoal):
 1. intersects_x_axis_positive H
[PROOF STEP]
proof (transfer, transfer)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_cmat H; 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H)); is_poincare_line_cmat H; intersects_x_axis_clmat Ha; 0 < Re (to_complex_homo_coords (calc_x_axis_intersection_clmat_hcoords Ha)); is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> intersects_x_axis_positive_cmat H
[PROOF STEP]
fix H
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_cmat H; 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H)); is_poincare_line_cmat H; intersects_x_axis_clmat Ha; 0 < Re (to_complex_homo_coords (calc_x_axis_intersection_clmat_hcoords Ha)); is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> intersects_x_axis_positive_cmat H
[PROOF STEP]
assume hh: "hermitean H \<and> H \<noteq> mat_zero"
[PROOF STATE]
proof (state)
this:
hermitean H \<and> H \<noteq> mat_zero

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_cmat H; 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H)); is_poincare_line_cmat H; intersects_x_axis_clmat Ha; 0 < Re (to_complex_homo_coords (calc_x_axis_intersection_clmat_hcoords Ha)); is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> intersects_x_axis_positive_cmat H
[PROOF STEP]
obtain A B C D where *: "H = (A, B, C, D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A B C D. H = (A, B, C, D) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases H, auto)
[PROOF STATE]
proof (state)
this:
H = (A, B, C, D)

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_cmat H; 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H)); is_poincare_line_cmat H; intersects_x_axis_clmat Ha; 0 < Re (to_complex_homo_coords (calc_x_axis_intersection_clmat_hcoords Ha)); is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> intersects_x_axis_positive_cmat H
[PROOF STEP]
assume "0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))" "intersects_x_axis_cmat H" "is_poincare_line_cmat H"
[PROOF STATE]
proof (state)
this:
0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
intersects_x_axis_cmat H
is_poincare_line_cmat H

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_cmat H; 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H)); is_poincare_line_cmat H; intersects_x_axis_clmat Ha; 0 < Re (to_complex_homo_coords (calc_x_axis_intersection_clmat_hcoords Ha)); is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> intersects_x_axis_positive_cmat H
[PROOF STEP]
hence **: "A \<noteq> 0" "0 < Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) - cor (Re B)) / A)"  "A = D" "is_real A" "(Re B)\<^sup>2 > (Re A)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
intersects_x_axis_cmat H
is_poincare_line_cmat H

goal (1 subgoal):
 1. (A \<noteq> 0 &&& 0 < Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) - cor (Re B)) / A)) &&& A = D &&& is_real A &&& (Re A)\<^sup>2 < (Re B)\<^sup>2
[PROOF STEP]
using * hh hermitean_elems
[PROOF STATE]
proof (prove)
using this:
0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H))
intersects_x_axis_cmat H
is_poincare_line_cmat H
H = (A, B, C, D)
hermitean H \<and> H \<noteq> mat_zero
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> is_real ?A
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> is_real ?D
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> ?B = cnj ?C
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> cnj ?B = ?C

goal (1 subgoal):
 1. (A \<noteq> 0 &&& 0 < Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) - cor (Re B)) / A)) &&& A = D &&& is_real A &&& (Re A)\<^sup>2 < (Re B)\<^sup>2
[PROOF STEP]
by (auto split: if_split_asm)
[PROOF STATE]
proof (state)
this:
A \<noteq> 0
0 < Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) - cor (Re B)) / A)
A = D
is_real A
(Re A)\<^sup>2 < (Re B)\<^sup>2

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_cmat H; 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H)); is_poincare_line_cmat H; intersects_x_axis_clmat Ha; 0 < Re (to_complex_homo_coords (calc_x_axis_intersection_clmat_hcoords Ha)); is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> intersects_x_axis_positive_cmat H
[PROOF STEP]
have "Re A \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re A \<noteq> 0
[PROOF STEP]
using complex.expand[of A 0] \<open>A \<noteq> 0\<close> \<open>is_real A\<close>
[PROOF STATE]
proof (prove)
using this:
Re A = Re 0 \<and> Im A = Im 0 \<Longrightarrow> A = 0
A \<noteq> 0
is_real A

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

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_cmat H; 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H)); is_poincare_line_cmat H; intersects_x_axis_clmat Ha; 0 < Re (to_complex_homo_coords (calc_x_axis_intersection_clmat_hcoords Ha)); is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> intersects_x_axis_positive_cmat H
[PROOF STEP]
have "Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2)) - cor (Re B)) / D) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2) - Re B) / Re D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2)) - cor (Re B)) / D) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2) - Re B) / Re D
[PROOF STEP]
using \<open>is_real A\<close> \<open>A = D\<close>
[PROOF STATE]
proof (prove)
using this:
is_real A
A = D

goal (1 subgoal):
 1. Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2)) - cor (Re B)) / D) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2) - Re B) / Re D
[PROOF STEP]
by (metis (no_types, lifting) Re_complex_of_real complex_of_real_Re of_real_diff of_real_divide of_real_mult)
[PROOF STATE]
proof (state)
this:
Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2)) - cor (Re B)) / D) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2) - Re B) / Re D

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; intersects_x_axis_cmat H; 0 < Re (to_complex_cvec (calc_x_axis_intersection_cmat_cvec H)); is_poincare_line_cmat H; intersects_x_axis_clmat Ha; 0 < Re (to_complex_homo_coords (calc_x_axis_intersection_clmat_hcoords Ha)); is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> intersects_x_axis_positive_cmat H
[PROOF STEP]
thus "intersects_x_axis_positive_cmat H"
[PROOF STATE]
proof (prove)
using this:
Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2)) - cor (Re B)) / D) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2) - Re B) / Re D

goal (1 subgoal):
 1. intersects_x_axis_positive_cmat H
[PROOF STEP]
using * ** \<open>Re A \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2)) - cor (Re B)) / D) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2) - Re B) / Re D
H = (A, B, C, D)
A \<noteq> 0
0 < Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) - cor (Re B)) / A)
A = D
is_real A
(Re A)\<^sup>2 < (Re B)\<^sup>2
Re A \<noteq> 0

goal (1 subgoal):
 1. intersects_x_axis_positive_cmat H
[PROOF STEP]
using calc_intersect_x_axis_positive_lemma[of "Re A" "Re B"]
[PROOF STATE]
proof (prove)
using this:
Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2)) - cor (Re B)) / D) = (sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re D)\<^sup>2) - Re B) / Re D
H = (A, B, C, D)
A \<noteq> 0
0 < Re ((cor (sgn (Re B)) * cor (sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) - cor (Re B)) / A)
A = D
is_real A
(Re A)\<^sup>2 < (Re B)\<^sup>2
Re A \<noteq> 0
\<lbrakk>(Re A)\<^sup>2 < (Re B)\<^sup>2; Re A \<noteq> 0\<rbrakk> \<Longrightarrow> (0 < (- Re B + sgn (Re B) * sqrt ((Re B)\<^sup>2 - (Re A)\<^sup>2)) / Re A) = (1 < - Re B / Re A)

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "encode (Node (3::nat) (Node 1 Leaf Leaf) (Node 2 Leaf Leaf))
  = [True, True, True, True, True, True, False, False, True, True, True, False, False]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. encode (Node 3 (Node 1 Leaf Leaf) (Node 2 Leaf Leaf)) = [True, True, True, True, True, True, False, False, True, True, True, False, False]
[PROOF STEP]
by eval


[STATEMENT]
lemma real_roots_of_int_poly: "p \<noteq> 0 \<Longrightarrow> set (real_roots_of_int_poly p) = {x. ipoly p x = 0}"
  "distinct (real_roots_of_int_poly p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<noteq> 0 \<Longrightarrow> set (real_roots_of_int_poly p) = {x. poly (real_of_int_poly p) x = 0}) &&& distinct (real_roots_of_int_poly p)
[PROOF STEP]
unfolding real_roots_of_int_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<noteq> 0 \<Longrightarrow> set (map real_of (roots_of_real_alg p)) = {x. poly (real_of_int_poly p) x = 0}) &&& distinct (map real_of (roots_of_real_alg p))
[PROOF STEP]
using roots_of_real_alg[of p]
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0 \<Longrightarrow> real_of ` set (roots_of_real_alg p) = {x. poly (real_of_int_poly p) x = 0}
distinct (map real_of (roots_of_real_alg p))

goal (1 subgoal):
 1. (p \<noteq> 0 \<Longrightarrow> set (map real_of (roots_of_real_alg p)) = {x. poly (real_of_int_poly p) x = 0}) &&& distinct (map real_of (roots_of_real_alg p))
[PROOF STEP]
by auto


[STATEMENT]
lemma eq_iff: "x = y \<longleftrightarrow> x \<le>\<^sub>a y \<and> y \<le>\<^sub>a x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x = y) = (x \<le>\<^sub>a y \<and> y \<le>\<^sub>a x)
[PROOF STEP]
by (blast intro: antisym)


[STATEMENT]
lemma prod_ennreal: "(\<And>i. i \<in> A \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (\<Prod>i\<in>A. ennreal (f i)) = ennreal (prod f A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> A \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (\<Prod>i\<in>A. ennreal (f i)) = ennreal (prod f A)
[PROOF STEP]
by (induction A rule: infinite_finite_induct)
     (auto simp: ennreal_mult prod_nonneg)