[STATEMENT]
lemma evnodd_Diff: "evnodd (A - B) b = evnodd A b - evnodd B b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. evnodd (A - B) b = evnodd A b - evnodd B b
[PROOF STEP]
unfolding evnodd_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A - B) \<inter> {(i, j). (i + j) mod 2 = b} = A \<inter> {(i, j). (i + j) mod 2 = b} - B \<inter> {(i, j). (i + j) mod 2 = b}
[PROOF STEP]
by blast


[STATEMENT]
lemma neg_numeral_le_ceiling [simp]: "- numeral v \<le> \<lceil>x\<rceil> \<longleftrightarrow> - numeral v - 1 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- numeral v \<le> \<lceil>x\<rceil>) = (- numeral v - (1::'a) < x)
[PROOF STEP]
by (simp add: le_ceiling_iff)


[STATEMENT]
lemma is_Proj_reduces_norm:
  fixes P :: \<open>'a::complex_inner \<Rightarrow>\<^sub>C\<^sub>L 'a\<close>
  assumes \<open>is_Proj P\<close>
  shows \<open>norm (P *\<^sub>V \<psi>) \<le> norm \<psi>\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (P *\<^sub>V \<psi>) \<le> norm \<psi>
[PROOF STEP]
apply (rule is_projection_on_reduces_norm[where M=\<open>range P\<close>])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. is_projection_on ((*\<^sub>V) P) (range ((*\<^sub>V) P))
 2. closed_csubspace (range ((*\<^sub>V) P))
[PROOF STEP]
using assms is_Proj.rep_eq is_projection_on_image
[PROOF STATE]
proof (prove)
using this:
is_Proj P
is_Proj ?x = Ex (is_projection_on ((*\<^sub>V) ?x))
is_projection_on ?\<pi> ?M \<Longrightarrow> range ?\<pi> = ?M

goal (2 subgoals):
 1. is_projection_on ((*\<^sub>V) P) (range ((*\<^sub>V) P))
 2. closed_csubspace (range ((*\<^sub>V) P))
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_csubspace (range ((*\<^sub>V) P))
[PROOF STEP]
by (simp add: Proj_range_closed assms closed_csubspace.intro)


[STATEMENT]
lemma continuous_open_vimage: "open S \<Longrightarrow> (\<And>x. continuous (at x) f) \<Longrightarrow> open (f -` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>open S; \<And>x. isCont f x\<rbrakk> \<Longrightarrow> open (f -` S)
[PROOF STEP]
by (metis continuous_on_eq_continuous_within open_vimage)


[STATEMENT]
lemma nat_floor_neg: "x \<le> 0 \<Longrightarrow> nat \<lfloor>x\<rfloor> = 0"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> 0 \<Longrightarrow> nat \<lfloor>x\<rfloor> = 0
[PROOF STEP]
by linarith


[STATEMENT]
lemma scaleR_mono':
  "a \<le> b \<Longrightarrow> c \<le> d \<Longrightarrow> 0 \<le> a \<Longrightarrow> 0 \<le> c \<Longrightarrow> a *\<^sub>R c \<le> b *\<^sub>R d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; c \<le> d; 0 \<le> a; (0::'a) \<le> c\<rbrakk> \<Longrightarrow> a *\<^sub>R c \<le> b *\<^sub>R d
[PROOF STEP]
by (rule scaleR_mono) (auto intro: order.trans)


[STATEMENT]
lemma points_index_on_set_def [simp]:
  assumes "finite B"
  shows "(mset_set B) index ps = card {b \<in> B. ps \<subseteq> b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset_set B index ps = card {b \<in> B. ps \<subseteq> b}
[PROOF STEP]
by (simp add: points_index_def assms)


[STATEMENT]
lemma sets_restrict_space_count_space :
  "sets (restrict_space (count_space A) B) = sets (count_space (A \<inter> B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (restrict_space (count_space A) B) = sets (count_space (A \<inter> B))
[PROOF STEP]
by(auto simp add: sets_restrict_space)


[STATEMENT]
lemma finite_tinfinite:
assumes "finite V"
shows "tinfinite (UNIV - V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tinfinite (UNIV - V)
[PROOF STEP]
using assms infinite_var
[PROOF STATE]
proof (prove)
using this:
finite V
infinite UNIV

goal (1 subgoal):
 1. tinfinite (UNIV - V)
[PROOF STEP]
unfolding tinfinite_def
[PROOF STATE]
proof (prove)
using this:
finite V
infinite UNIV

goal (1 subgoal):
 1. \<forall>\<sigma>. infinite ((UNIV - V) \<inter> tpOfV -` {\<sigma>})
[PROOF STEP]
by (metis Diff_Int2 Diff_Int_distrib2 Int_UNIV_left finite_Diff2 tpOfV)


[STATEMENT]
lemma face_of_Int: "\<lbrakk>t1 face_of S; t2 face_of S\<rbrakk> \<Longrightarrow> (t1 \<inter> t2) face_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t1 face_of S; t2 face_of S\<rbrakk> \<Longrightarrow> t1 \<inter> t2 face_of S
[PROOF STEP]
unfolding face_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t1 \<subseteq> S \<and> convex t1 \<and> (\<forall>a\<in>S. \<forall>b\<in>S. \<forall>x\<in>t1. x \<in> open_segment a b \<longrightarrow> a \<in> t1 \<and> b \<in> t1); t2 \<subseteq> S \<and> convex t2 \<and> (\<forall>a\<in>S. \<forall>b\<in>S. \<forall>x\<in>t2. x \<in> open_segment a b \<longrightarrow> a \<in> t2 \<and> b \<in> t2)\<rbrakk> \<Longrightarrow> t1 \<inter> t2 \<subseteq> S \<and> convex (t1 \<inter> t2) \<and> (\<forall>a\<in>S. \<forall>b\<in>S. \<forall>x\<in>t1 \<inter> t2. x \<in> open_segment a b \<longrightarrow> a \<in> t1 \<inter> t2 \<and> b \<in> t1 \<inter> t2)
[PROOF STEP]
by (blast intro: convex_Int)


[STATEMENT]
lemma (in group) coset_neq_imp_empty_inter:
  assumes "subgroup H G" "a \<in> carrier G" "b \<in> carrier G"
  shows "H #> a \<noteq> H #> b \<Longrightarrow> (H #> a) \<inter> (H #> b) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H #> a \<noteq> H #> b \<Longrightarrow> (H #> a) \<inter> (H #> b) = {}
[PROOF STEP]
by (metis Int_emptyI assms repr_independence)


[STATEMENT]
lemma least_arg_max_enum_correct:
  assumes "X \<noteq> {}"
  shows "
  (least_arg_max_enum (f :: _ \<Rightarrow> (_ :: linorder)) X) = (LEAST x. is_arg_max f (\<lambda>x. x \<in> X) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least_arg_max_enum f X = (LEAST x. is_arg_max f (\<lambda>x. x \<in> X) x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. least_arg_max_enum f X = (LEAST x. is_arg_max f (\<lambda>x. x \<in> X) x)
[PROOF STEP]
have *: "xs \<noteq> [] \<Longrightarrow> (x = hd xs \<or> x \<in> set (tl xs)) \<longleftrightarrow> x \<in> set xs" for x xs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> (x = hd xs \<or> x \<in> set (tl xs)) = (x \<in> set xs)
[PROOF STEP]
using list.set_sel list.exhaust_sel set_ConsD
[PROOF STATE]
proof (prove)
using this:
?a \<noteq> [] \<Longrightarrow> hd ?a \<in> set ?a
\<lbrakk>?a \<noteq> []; ?x \<in> set (tl ?a)\<rbrakk> \<Longrightarrow> ?x \<in> set ?a
\<lbrakk>?list = [] \<Longrightarrow> ?P; ?list = hd ?list # tl ?list \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
?y \<in> set (?x # ?xs) \<Longrightarrow> ?y = ?x \<or> ?y \<in> set ?xs

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> (x = hd xs \<or> x \<in> set (tl xs)) = (x \<in> set xs)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
?xs1 \<noteq> [] \<Longrightarrow> (?x1 = hd ?xs1 \<or> ?x1 \<in> set (tl ?xs1)) = (?x1 \<in> set ?xs1)

goal (1 subgoal):
 1. least_arg_max_enum f X = (LEAST x. is_arg_max f (\<lambda>x. x \<in> X) x)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
?xs1 \<noteq> [] \<Longrightarrow> (?x1 = hd ?xs1 \<or> ?x1 \<in> set (tl ?xs1)) = (?x1 \<in> set ?xs1)

goal (1 subgoal):
 1. least_arg_max_enum f X = (LEAST x. is_arg_max f (\<lambda>x. x \<in> X) x)
[PROOF STEP]
unfolding least_arg_max_enum_def
[PROOF STATE]
proof (prove)
using this:
?xs1 \<noteq> [] \<Longrightarrow> (?x1 = hd ?xs1 \<or> ?x1 \<in> set (tl ?xs1)) = (?x1 \<in> set ?xs1)

goal (1 subgoal):
 1. (let xs = sorted_list_of_set X in fst (least_max_arg_max_list f (hd xs, f (hd xs)) (tl xs))) = (LEAST x. is_arg_max f (\<lambda>x. x \<in> X) x)
[PROOF STEP]
using  assms
[PROOF STATE]
proof (prove)
using this:
?xs1 \<noteq> [] \<Longrightarrow> (?x1 = hd ?xs1 \<or> ?x1 \<in> set (tl ?xs1)) = (?x1 \<in> set ?xs1)
X \<noteq> {}

goal (1 subgoal):
 1. (let xs = sorted_list_of_set X in fst (least_max_arg_max_list f (hd xs, f (hd xs)) (tl xs))) = (LEAST x. is_arg_max f (\<lambda>x. x \<in> X) x)
[PROOF STEP]
by (auto simp: Let_def fst_least_max_arg_max_list *)
[PROOF STATE]
proof (state)
this:
least_arg_max_enum f X = (LEAST x. is_arg_max f (\<lambda>x. x \<in> X) x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "postList xs l s = (foldr (\<lambda>(x,e,v) acc l s. l x = e s \<and> acc l s) xs (%l s. True)) l s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. postList xs l s = foldr (\<lambda>(x, e, v) acc l s. l x = e s \<and> acc l s) xs (\<lambda>l s. True) l s
[PROOF STEP]
apply(induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. postList [] l s = foldr (\<lambda>a. case a of (x, a) \<Rightarrow> case a of (e, v) \<Rightarrow> \<lambda>acc l s. l x = e s \<and> acc l s) [] (\<lambda>l s. True) l s
 2. \<And>a xs. postList xs l s = foldr (\<lambda>a. case a of (x, a) \<Rightarrow> case a of (e, v) \<Rightarrow> \<lambda>acc l s. l x = e s \<and> acc l s) xs (\<lambda>l s. True) l s \<Longrightarrow> postList (a # xs) l s = foldr (\<lambda>a. case a of (x, a) \<Rightarrow> case a of (e, v) \<Rightarrow> \<lambda>acc l s. l x = e s \<and> acc l s) (a # xs) (\<lambda>l s. True) l s
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. postList xs l s = foldr (\<lambda>a. case a of (x, a) \<Rightarrow> case a of (e, v) \<Rightarrow> \<lambda>acc l s. l x = e s \<and> acc l s) xs (\<lambda>l s. True) l s \<Longrightarrow> postList (a # xs) l s = foldr (\<lambda>a. case a of (x, a) \<Rightarrow> case a of (e, v) \<Rightarrow> \<lambda>acc l s. l x = e s \<and> acc l s) (a # xs) (\<lambda>l s. True) l s
[PROOF STEP]
by (auto)


[STATEMENT]
lemma axis_eq_axis: "axis i x = axis j y \<longleftrightarrow> x = y \<and> i = j \<or> x = 0 \<and> y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (axis i x = axis j y) = (x = y \<and> i = j \<or> x = (0::'a) \<and> y = (0::'a))
[PROOF STEP]
unfolding axis_def vec_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>ia. (\<chi>ia. if ia = i then x else (0::'a)) $ ia = (\<chi>i. if i = j then y else (0::'a)) $ ia) = (x = y \<and> i = j \<or> x = (0::'a) \<and> y = (0::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma lemma_3_5_iv_4: "(d4 b c) * (d4 a b) * (d4 b c) \<le> d4 a c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d4 b c * d4 a b * d4 b c \<le> d4 a c
[PROOF STEP]
by (simp add: d4_def lemma_3_5_iv_2)


[STATEMENT]
lemma space_mapmeasure[simp]: "space (mapmeasure M N) = space (PiF (Collect finite) N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (mapmeasure M N) = space (Pi\<^sub>F (Collect finite) N)
[PROOF STEP]
unfolding mapmeasure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (distr M (Pi\<^sub>F (Collect finite) N) fm) = space (Pi\<^sub>F (Collect finite) N)
[PROOF STEP]
by simp


[STATEMENT]
lemma set_times_rearrange: "(a *o C) * (b *o D) = (a * b) *o (C * D)"
  for a b :: "'a::comm_monoid_mult"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a *o C * b *o D = (a * b) *o (C * D)
[PROOF STEP]
by (auto simp add: elt_set_times_def set_times_def; metis mult.assoc mult.left_commute)


[STATEMENT]
lemma (in Ring) Chinese_remTr3:"\<lbrakk>\<forall>k \<le> (Suc n). ideal R (J k);
      \<forall>k \<le> (Suc n). B k = qring R (J k); \<forall>k\<le> (Suc n). S k = pj R (J k);
  \<forall>i \<le> (Suc n). \<forall>j \<le> (Suc n). (i \<noteq>j \<longrightarrow> coprime_ideals R (J i) (J j))\<rbrakk> \<Longrightarrow>
    surjec\<^bsub>R,(r\<Pi>\<^bsub>{j. j \<le> (Suc n)}\<^esub> B)\<^esub>
                   (A_to_prodag R {j. j \<le> (Suc n)} S B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>k\<le>Suc n. ideal R (J k); \<forall>k\<le>Suc n. B k = R /\<^sub>r J k; \<forall>k\<le>Suc n. S k = pj R (J k); \<forall>i\<le>Suc n. \<forall>j\<le>Suc n. i \<noteq> j \<longrightarrow> coprime_ideals R (J i) (J j)\<rbrakk> \<Longrightarrow> surjec\<^bsub>R,(r\<Pi>\<^bsub>{j. j \<le> Suc n}\<^esub> B)\<^esub> A_to_prodag R {j. j \<le> Suc n} S B
[PROOF STEP]
apply (simp add:Chinese_remTr2 [of  "n" "J" "B" "S"])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma subset_eq_imp_le_zmset: "M \<subseteq>#\<^sub>z N \<Longrightarrow> M \<le> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M \<subseteq>#\<^sub>z N \<Longrightarrow> M \<le> N
[PROOF STEP]
by (metis (no_types) add_mono_thms_linordered_semiring(3) subset_eq_imp_le_multiset
    subseteq_mset_zmsetE zmset_of_le)


[STATEMENT]
lemma (in valid_unMultigraph) del_UnEdge_even':
  assumes "(v,w,v') \<in> E" "finite E"
  shows "v'\<in>odd_nodes_set(del_unEdge v w v' G) \<longleftrightarrow> even (degree v' G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v' \<in> odd_nodes_set (del_unEdge v w v' G)) = even (degree v' G)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (v' \<in> odd_nodes_set (del_unEdge v w v' G)) = even (degree v' G)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v' \<in> odd_nodes_set (del_unEdge v w v' G)) = even (degree v' G)
[PROOF STEP]
by (metis (full_types) assms corres del_UnEdge_even delete_edge_sym)
[PROOF STATE]
proof (state)
this:
(v' \<in> odd_nodes_set (del_unEdge v w v' G)) = even (degree v' G)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_gt_square: "norm x > a \<longleftrightarrow> a < 0 \<or> cinner x x > complex_of_real (a\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a < norm x) = (a < 0 \<or> complex_of_real (a\<^sup>2) < cinner x x)
[PROOF STEP]
by (smt (verit, ccfv_SIG) cdot_square_norm complex_of_real_strict_mono_iff norm_ge_zero power2_eq_imp_eq power_mono)


[STATEMENT]
lemma interval_integral_Icc':
  "a \<le> b \<Longrightarrow> (LBINT x=a..b. f x) = (LBINT x : {x. a \<le> ereal x \<and> ereal x \<le> b}. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> interval_lebesgue_integral lborel a b f = set_lebesgue_integral lborel {x. a \<le> ereal x \<and> ereal x \<le> b} f
[PROOF STEP]
by (auto intro!: set_integral_discrete_difference[where X="{real_of_ereal a, real_of_ereal b}"]
           simp add: interval_lebesgue_integral_def einterval_iff)


[STATEMENT]
lemma UN_If_cases: "(\<Union>x\<in>X. if P x then A x else B x) = (\<Union>x\<in>{x\<in>X. P x}. A x) \<union> (\<Union>x\<in>{x\<in>X. \<not> P x}. B x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>X. if P x then A x else B x) = \<Union> (A ` {x \<in> X. P x}) \<union> \<Union> (B ` {x \<in> X. \<not> P x})
[PROOF STEP]
by (auto split: if_splits)


[STATEMENT]
lemma nat_diff_left_cancel_eq1: "\<lbrakk> k - m = k - (n::nat); m < k \<rbrakk> \<Longrightarrow> m = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k - m = k - n; m < k\<rbrakk> \<Longrightarrow> m = n
[PROOF STEP]
by simp


[STATEMENT]
lemma transpose_cnj_is_dagger [simp]:
  "(M\<^sup>t)\<^sup>\<star> = (M\<^sup>\<dagger>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M\<^sup>t\<^sup>\<star> = M\<^sup>\<dagger>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row M\<^sup>\<dagger>; j < dim_col M\<^sup>\<dagger>\<rbrakk> \<Longrightarrow> M\<^sup>t\<^sup>\<star> $$ (i, j) = M\<^sup>\<dagger> $$ (i, j)
 2. dim_row M\<^sup>t\<^sup>\<star> = dim_row M\<^sup>\<dagger>
 3. dim_col M\<^sup>t\<^sup>\<star> = dim_col M\<^sup>\<dagger>
[PROOF STEP]
show f1:"dim_row ((M\<^sup>t)\<^sup>\<star>) = dim_row (M\<^sup>\<dagger>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row M\<^sup>t\<^sup>\<star> = dim_row M\<^sup>\<dagger>
[PROOF STEP]
by (simp add: cpx_mat_cnj_def transpose_mat_def dagger_def)
[PROOF STATE]
proof (state)
this:
dim_row M\<^sup>t\<^sup>\<star> = dim_row M\<^sup>\<dagger>

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row M\<^sup>\<dagger>; j < dim_col M\<^sup>\<dagger>\<rbrakk> \<Longrightarrow> M\<^sup>t\<^sup>\<star> $$ (i, j) = M\<^sup>\<dagger> $$ (i, j)
 2. dim_col M\<^sup>t\<^sup>\<star> = dim_col M\<^sup>\<dagger>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row M\<^sup>\<dagger>; j < dim_col M\<^sup>\<dagger>\<rbrakk> \<Longrightarrow> M\<^sup>t\<^sup>\<star> $$ (i, j) = M\<^sup>\<dagger> $$ (i, j)
 2. dim_col M\<^sup>t\<^sup>\<star> = dim_col M\<^sup>\<dagger>
[PROOF STEP]
show f2:"dim_col ((M\<^sup>t)\<^sup>\<star>) = dim_col (M\<^sup>\<dagger>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col M\<^sup>t\<^sup>\<star> = dim_col M\<^sup>\<dagger>
[PROOF STEP]
by (simp add: cpx_mat_cnj_def transpose_mat_def dagger_def)
[PROOF STATE]
proof (state)
this:
dim_col M\<^sup>t\<^sup>\<star> = dim_col M\<^sup>\<dagger>

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row M\<^sup>\<dagger>; j < dim_col M\<^sup>\<dagger>\<rbrakk> \<Longrightarrow> M\<^sup>t\<^sup>\<star> $$ (i, j) = M\<^sup>\<dagger> $$ (i, j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row M\<^sup>\<dagger>; j < dim_col M\<^sup>\<dagger>\<rbrakk> \<Longrightarrow> M\<^sup>t\<^sup>\<star> $$ (i, j) = M\<^sup>\<dagger> $$ (i, j)
[PROOF STEP]
fix i j::nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row M\<^sup>\<dagger>; j < dim_col M\<^sup>\<dagger>\<rbrakk> \<Longrightarrow> M\<^sup>t\<^sup>\<star> $$ (i, j) = M\<^sup>\<dagger> $$ (i, j)
[PROOF STEP]
assume "i < dim_row M\<^sup>\<dagger>" and "j < dim_col M\<^sup>\<dagger>"
[PROOF STATE]
proof (state)
this:
i < dim_row M\<^sup>\<dagger>
j < dim_col M\<^sup>\<dagger>

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row M\<^sup>\<dagger>; j < dim_col M\<^sup>\<dagger>\<rbrakk> \<Longrightarrow> M\<^sup>t\<^sup>\<star> $$ (i, j) = M\<^sup>\<dagger> $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_row M\<^sup>\<dagger>
j < dim_col M\<^sup>\<dagger>
[PROOF STEP]
show "M\<^sup>t\<^sup>\<star> $$ (i, j) = M\<^sup>\<dagger> $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
i < dim_row M\<^sup>\<dagger>
j < dim_col M\<^sup>\<dagger>

goal (1 subgoal):
 1. M\<^sup>t\<^sup>\<star> $$ (i, j) = M\<^sup>\<dagger> $$ (i, j)
[PROOF STEP]
by (simp add: cpx_mat_cnj_def transpose_mat_def dagger_def)
[PROOF STATE]
proof (state)
this:
M\<^sup>t\<^sup>\<star> $$ (i, j) = M\<^sup>\<dagger> $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in first_countable_topology) sequentially_imp_eventually_at:
  "(\<forall>f. (\<forall>n. f n \<noteq> a) \<and> f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially) \<Longrightarrow> eventually P (at a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f. (\<forall>n. f n \<noteq> a) \<and> f \<longlonglongrightarrow> a \<longrightarrow> (\<forall>\<^sub>F n in sequentially. P (f n)) \<Longrightarrow> eventually P (at a)
[PROOF STEP]
using sequentially_imp_eventually_within [where s=UNIV]
[PROOF STATE]
proof (prove)
using this:
\<forall>f. (\<forall>n. f n \<in> UNIV \<and> f n \<noteq> ?a) \<and> f \<longlonglongrightarrow> ?a \<longrightarrow> (\<forall>\<^sub>F n in sequentially. ?P (f n)) \<Longrightarrow> eventually ?P (at ?a)

goal (1 subgoal):
 1. \<forall>f. (\<forall>n. f n \<noteq> a) \<and> f \<longlonglongrightarrow> a \<longrightarrow> (\<forall>\<^sub>F n in sequentially. P (f n)) \<Longrightarrow> eventually P (at a)
[PROOF STEP]
by simp


[STATEMENT]
lemma fmimage_inter: "fmimage m (A |\<inter>| B) |\<subseteq>| fmimage m A |\<inter>| fmimage m B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmimage m (A |\<inter>| B) |\<subseteq>| fmimage m A |\<inter>| fmimage m B
[PROOF STEP]
by transfer' auto


[STATEMENT]
lemma wnf_lemma_2:
  "(n(p * L) * n(q * L) \<squnion> an(r * L) * an(q * L)) * n(q * L) = n(p * L) * n(q * L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n (p * L) * n (q * L) \<squnion> an (r * L) * an (q * L)) * n (q * L) = n (p * L) * n (q * L)
[PROOF STEP]
by (metis an_mult_commutative n_mult_commutative wnf_lemma_1)


[STATEMENT]
lemma (in monoid_cancel) associated_iff:
  assumes "a \<in> carrier G" "b \<in> carrier G"
  shows "a \<sim> b \<longleftrightarrow> (\<exists>c \<in> Units G. a = b \<otimes> c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<sim> b = (\<exists>c\<in>Units G. a = b \<otimes> c)
[PROOF STEP]
using assms associatedI2' associatedD2
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
b \<in> carrier G
\<lbrakk>?a = ?b \<otimes> ?u; ?u \<in> Units G; ?b \<in> carrier G\<rbrakk> \<Longrightarrow> ?a \<sim> ?b
\<lbrakk>?a \<sim> ?b; ?a \<in> carrier G; ?b \<in> carrier G\<rbrakk> \<Longrightarrow> \<exists>u\<in>Units G. ?a = ?b \<otimes> u

goal (1 subgoal):
 1. a \<sim> b = (\<exists>c\<in>Units G. a = b \<otimes> c)
[PROOF STEP]
by auto


[STATEMENT]
lemma moebius_pt_moebius_similarity':
  assumes "a \<noteq> 0"
  shows "moebius_pt (moebius_similarity a b) = (\<lambda> z. (of_complex a) *\<^sub>h z +\<^sub>h (of_complex b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_pt (moebius_similarity a b) = (\<lambda>z. of_complex a *\<^sub>h z +\<^sub>h of_complex b)
[PROOF STEP]
using moebius_pt_moebius_similarity[OF assms, symmetric]
[PROOF STATE]
proof (prove)
using this:
of_complex a *\<^sub>h ?z +\<^sub>h of_complex ?b = moebius_pt (moebius_similarity a ?b) ?z

goal (1 subgoal):
 1. moebius_pt (moebius_similarity a b) = (\<lambda>z. of_complex a *\<^sub>h z +\<^sub>h of_complex b)
[PROOF STEP]
by simp


[STATEMENT]
lemma (in finite_measure) measure_exclude:
  assumes "A \<in> sets M" "B \<in> sets M"
  assumes "measure M A = measure M (space M)" "A \<inter> B = {}"
  shows "measure M B = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M B = 0
[PROOF STEP]
using measure_space_inter[of B A] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>B \<in> sets M; A \<in> sets M; Sigma_Algebra.measure M A = Sigma_Algebra.measure M (space M)\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (B \<inter> A) = Sigma_Algebra.measure M B
A \<in> sets M
B \<in> sets M
Sigma_Algebra.measure M A = Sigma_Algebra.measure M (space M)
A \<inter> B = {}

goal (1 subgoal):
 1. Sigma_Algebra.measure M B = 0
[PROOF STEP]
by (auto simp: ac_simps)


[STATEMENT]
lemma init_Times [simp]: "init (Times fsm1 fsm2) = init fsm1 * init fsm2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. init (Times fsm1 fsm2) = init fsm1 * init fsm2
[PROOF STEP]
by (simp add: Times_def)


[STATEMENT]
lemma i_set_Div_not_closed: "Suc 0 < k \<Longrightarrow> \<exists>I\<in>i_set. I \<oslash> k \<notin> i_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 < k \<Longrightarrow> \<exists>I\<in>i_set. I \<oslash> k \<notin> i_set
[PROOF STEP]
apply (rule_tac x="[0, mod (Suc k)]" in bexI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Suc 0 < k \<Longrightarrow> [ 0, mod Suc k ] \<oslash> k \<notin> i_set
 2. Suc 0 < k \<Longrightarrow> [ 0, mod Suc k ] \<in> i_set
[PROOF STEP]
apply (rule iMOD_div_mod_gr0_not_in_i_set)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. Suc 0 < k \<Longrightarrow> 0 < k
 2. Suc 0 < k \<Longrightarrow> k < Suc k
 3. Suc 0 < k \<Longrightarrow> 0 < Suc k mod k
 4. Suc 0 < k \<Longrightarrow> [ 0, mod Suc k ] \<in> i_set
[PROOF STEP]
apply (simp_all add: mod_Suc i_set_MOD)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fin_dia_lowerB: "\<lbrakk> u \<in> verts G; v \<in> verts G; \<mu> w u v < \<infinity>\<rbrakk>
  \<Longrightarrow> fin_diameter w \<ge> \<mu> w u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> verts G; v \<in> verts G; \<mu> w u v < \<infinity>\<rbrakk> \<Longrightarrow> \<mu> w u v \<le> fin_diameter w
[PROOF STEP]
unfolding fin_diameter_def fin_sp_costs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> verts G; v \<in> verts G; \<mu> w u v < \<infinity>\<rbrakk> \<Longrightarrow> \<mu> w u v \<le> Sup {uu_. \<exists>u v c. uu_ = c \<and> u \<in> verts G \<and> v \<in> verts G \<and> \<mu> w u v = c \<and> c < \<infinity>}
[PROOF STEP]
by (metis (mono_tags, lifting) Sup_upper mem_Collect_eq)


[STATEMENT]
lemma weak_integer_composition_enum_zero: "length (weak_integer_composition_enum 0 (Suc n)) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (weak_integer_composition_enum 0 (Suc n)) = 1
[PROOF STEP]
by(induct n) auto


[STATEMENT]
lemma mpi_partial'_code[code]: "mpi_partial' eps d v m =
  (let d' = policy_improvement' d v in (
    if 2 * l * dist v (\<L>\<^sub>b v) <  eps * (1 - l)
    then (d', v)
    else mpi_partial' eps d' (L_pow v (Rep_Fun d') (m 0 v)) (\<lambda>n. m (Suc n))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mpi_partial' eps d v m = (let d' = policy_improvement' d v in if 2 * l * dist v (\<L>\<^sub>b v) < eps * (1 - l) then (d', v) else mpi_partial' eps d' (L_pow v (Rep_Fun d') (m 0 v)) (\<lambda>n. m (Suc n)))
[PROOF STEP]
by (auto simp: mpi_partial'_def mpi_partial.simps Let_def policy_improvement'_def)


[STATEMENT]
lemma (in first_countable_topology) eventually_nhds_iff_sequentially:
  "eventually P (nhds a) \<longleftrightarrow> (\<forall>f. f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (nhds a) = (\<forall>f. f \<longlonglongrightarrow> a \<longrightarrow> (\<forall>\<^sub>F n in sequentially. P (f n)))
[PROOF STEP]
using eventually_nhds_within_iff_sequentially[of P a UNIV]
[PROOF STATE]
proof (prove)
using this:
eventually P (inf (nhds a) (principal UNIV)) = (\<forall>f. (\<forall>n. f n \<in> UNIV) \<and> f \<longlonglongrightarrow> a \<longrightarrow> (\<forall>\<^sub>F n in sequentially. P (f n)))

goal (1 subgoal):
 1. eventually P (nhds a) = (\<forall>f. f \<longlonglongrightarrow> a \<longrightarrow> (\<forall>\<^sub>F n in sequentially. P (f n)))
[PROOF STEP]
by simp


[STATEMENT]
lemma seq_mult_closed:
  assumes "s \<in> closed_seqs R"
  assumes "s' \<in> closed_seqs R"
  shows "s \<otimes>\<^bsub>R\<^bsup>\<omega>\<^esup>\<^esub> s' \<in> closed_seqs R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<otimes>\<^bsub>R\<^bsup>\<omega>\<^esup>\<^esub> s' \<in> carrier R\<^bsup>\<omega>\<^esup>
[PROOF STEP]
apply(rule closed_seqs_memI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. (s \<otimes>\<^bsub>R\<^bsup>\<omega>\<^esup>\<^esub> s') k \<in> carrier R
[PROOF STEP]
by (metis assms(1) assms(2) closed_seqs_memE nat_seqs_def ring_functions.fun_mult_closed ring_functions_axioms)


[STATEMENT]
lemma forall_4: "(\<forall>i::4. P i) \<longleftrightarrow> P 1 \<and> P 2 \<and> P 3 \<and> P 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i. P i) = (P 1 \<and> P 2 \<and> P 3 \<and> P 4)
[PROOF STEP]
by (metis exhaust_4)


[STATEMENT]
lemma Z_I_ZmX_eq:
  shows "Z_I * I_ZmX = Z_ZmX"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Z_I * I_ZmX = Z_ZmX
[PROOF STEP]
unfolding Z_I_def I_ZmX_def Z_ZmX_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Z \<Otimes> 1\<^sub>m 2) * (1\<^sub>m 2 \<Otimes> ZmX) = Z \<Otimes> ZmX
[PROOF STEP]
using mult_distr_tensor
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>dim_col ?A = dim_row ?B; dim_col ?C = dim_row ?D; 0 < dim_col ?A; 0 < dim_col ?B; 0 < dim_col ?C; 0 < dim_col ?D\<rbrakk> \<Longrightarrow> ?A * ?B \<Otimes> ?C * ?D = (?A \<Otimes> ?C) * (?B \<Otimes> ?D)

goal (1 subgoal):
 1. (Z \<Otimes> 1\<^sub>m 2) * (1\<^sub>m 2 \<Otimes> ZmX) = Z \<Otimes> ZmX
[PROOF STEP]
by (metis (no_types, lifting) Z_inv ZmX_inv index_mult_mat(2) index_mult_mat(3) index_one_mat(2)
      index_one_mat(3) left_mult_one_mat' pos2 right_mult_one_mat')


[STATEMENT]
theorem ce_union: "\<lbrakk> A \<in> ce_sets; B \<in> ce_sets \<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
assume A1: "A \<in> ce_sets"
[PROOF STATE]
proof (state)
this:
A \<in> ce_sets

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<in> ce_sets
[PROOF STEP]
obtain p_a where S2: "p_a \<in> PrimRec2" and S3: "A = fn_to_set p_a"
[PROOF STATE]
proof (prove)
using this:
A \<in> ce_sets

goal (1 subgoal):
 1. (\<And>p_a. \<lbrakk>p_a \<in> PrimRec2; A = fn_to_set p_a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: ce_sets_def)
[PROOF STATE]
proof (state)
this:
p_a \<in> PrimRec2
A = fn_to_set p_a

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
assume A2: "B \<in> ce_sets"
[PROOF STATE]
proof (state)
this:
B \<in> ce_sets

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B \<in> ce_sets
[PROOF STEP]
obtain p_b where S5: "p_b \<in> PrimRec2" and S6: "B = fn_to_set p_b"
[PROOF STATE]
proof (prove)
using this:
B \<in> ce_sets

goal (1 subgoal):
 1. (\<And>p_b. \<lbrakk>p_b \<in> PrimRec2; B = fn_to_set p_b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: ce_sets_def)
[PROOF STATE]
proof (state)
this:
p_b \<in> PrimRec2
B = fn_to_set p_b

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
let ?p = "(\<lambda> x y. (p_a x y) * (p_b x y))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
from S2 S5
[PROOF STATE]
proof (chain)
picking this:
p_a \<in> PrimRec2
p_b \<in> PrimRec2
[PROOF STEP]
have S7: "?p \<in> PrimRec2"
[PROOF STATE]
proof (prove)
using this:
p_a \<in> PrimRec2
p_b \<in> PrimRec2

goal (1 subgoal):
 1. (\<lambda>x y. p_a x y * p_b x y) \<in> PrimRec2
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. p_a x y * p_b x y) \<in> PrimRec2

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
have S8: "\<forall> x y. (?p x y = 0) = ((p_a x y = 0) \<or> (p_b x y = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. (p_a x y * p_b x y = 0) = (p_a x y = 0 \<or> p_b x y = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x y. (p_a x y * p_b x y = 0) = (p_a x y = 0 \<or> p_b x y = 0)

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
let ?C = "fn_to_set ?p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
have S9: "?C = {x. \<exists> y. ?p x y = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fn_to_set (\<lambda>x y. p_a x y * p_b x y) = {x. \<exists>y. p_a x y * p_b x y = 0}
[PROOF STEP]
by (simp add: fn_to_set_def)
[PROOF STATE]
proof (state)
this:
fn_to_set (\<lambda>x y. p_a x y * p_b x y) = {x. \<exists>y. p_a x y * p_b x y = 0}

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
from S3
[PROOF STATE]
proof (chain)
picking this:
A = fn_to_set p_a
[PROOF STEP]
have S10: "A = {x. \<exists> y. p_a x y = 0}"
[PROOF STATE]
proof (prove)
using this:
A = fn_to_set p_a

goal (1 subgoal):
 1. A = {x. \<exists>y. p_a x y = 0}
[PROOF STEP]
by (simp add: fn_to_set_def)
[PROOF STATE]
proof (state)
this:
A = {x. \<exists>y. p_a x y = 0}

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
from S6
[PROOF STATE]
proof (chain)
picking this:
B = fn_to_set p_b
[PROOF STEP]
have S11: "B = {x. \<exists> y. p_b x y = 0}"
[PROOF STATE]
proof (prove)
using this:
B = fn_to_set p_b

goal (1 subgoal):
 1. B = {x. \<exists>y. p_b x y = 0}
[PROOF STEP]
by (simp add: fn_to_set_def)
[PROOF STATE]
proof (state)
this:
B = {x. \<exists>y. p_b x y = 0}

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
from S10 S11 S9 S8
[PROOF STATE]
proof (chain)
picking this:
A = {x. \<exists>y. p_a x y = 0}
B = {x. \<exists>y. p_b x y = 0}
fn_to_set (\<lambda>x y. p_a x y * p_b x y) = {x. \<exists>y. p_a x y * p_b x y = 0}
\<forall>x y. (p_a x y * p_b x y = 0) = (p_a x y = 0 \<or> p_b x y = 0)
[PROOF STEP]
have S12: "?C = A \<union> B"
[PROOF STATE]
proof (prove)
using this:
A = {x. \<exists>y. p_a x y = 0}
B = {x. \<exists>y. p_b x y = 0}
fn_to_set (\<lambda>x y. p_a x y * p_b x y) = {x. \<exists>y. p_a x y * p_b x y = 0}
\<forall>x y. (p_a x y * p_b x y = 0) = (p_a x y = 0 \<or> p_b x y = 0)

goal (1 subgoal):
 1. fn_to_set (\<lambda>x y. p_a x y * p_b x y) = A \<union> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fn_to_set (\<lambda>x y. p_a x y * p_b x y) = A \<union> B

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
from S7
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x y. p_a x y * p_b x y) \<in> PrimRec2
[PROOF STEP]
have "?C \<in> ce_sets"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x y. p_a x y * p_b x y) \<in> PrimRec2

goal (1 subgoal):
 1. fn_to_set (\<lambda>x y. p_a x y * p_b x y) \<in> ce_sets
[PROOF STEP]
by (auto simp add: ce_sets_def)
[PROOF STATE]
proof (state)
this:
fn_to_set (\<lambda>x y. p_a x y * p_b x y) \<in> ce_sets

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<union> B \<in> ce_sets
[PROOF STEP]
with S12
[PROOF STATE]
proof (chain)
picking this:
fn_to_set (\<lambda>x y. p_a x y * p_b x y) = A \<union> B
fn_to_set (\<lambda>x y. p_a x y * p_b x y) \<in> ce_sets
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fn_to_set (\<lambda>x y. p_a x y * p_b x y) = A \<union> B
fn_to_set (\<lambda>x y. p_a x y * p_b x y) \<in> ce_sets

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "mul2 (S(S(S(S(S Z))))) (S(S(S Z))) = S(S(S(S(S(S(S(S(S(S(S(S(S(S(S Z))))))))))))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mul2 (S (S (S (S (S Z))))) (S (S (S Z))) = S (S (S (S (S (S (S (S (S (S (S (S (S (S (S Z))))))))))))))
[PROOF STEP]
by normalization


[STATEMENT]
lemma less_two:
  shows "j < Suc (Suc 0) \<longleftrightarrow> j = 0 \<or> j = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (j < Suc (Suc 0)) = (j = 0 \<or> j = 1)
[PROOF STEP]
by auto


[STATEMENT]
lemma gcd_bezout_sum_nat:
  fixes a::nat
  assumes "a * x + b * y = d"
  shows "gcd a b dvd d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd a b dvd d
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gcd a b dvd d
[PROOF STEP]
let ?g = "gcd a b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gcd a b dvd d
[PROOF STEP]
have dv: "?g dvd a*x" "?g dvd b * y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd a b dvd a * x &&& gcd a b dvd b * y
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
gcd a b dvd a * x
gcd a b dvd b * y

goal (1 subgoal):
 1. gcd a b dvd d
[PROOF STEP]
from dvd_add[OF dv] assms
[PROOF STATE]
proof (chain)
picking this:
gcd a b dvd a * x + b * y
a * x + b * y = d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gcd a b dvd a * x + b * y
a * x + b * y = d

goal (1 subgoal):
 1. gcd a b dvd d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gcd a b dvd d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_frontiers_same_dimension:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  assumes "S homeomorphic T" "closed S" "closed T" and dimeq: "DIM('a) = DIM('b)"
  shows "(frontier S) homeomorphic (frontier T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier S homeomorphic frontier T
[PROOF STEP]
using assms [unfolded homeomorphic_minimal]
[PROOF STATE]
proof (prove)
using this:
\<exists>f g. (\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x) \<and> (\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y) \<and> continuous_on S f \<and> continuous_on T g
closed S
closed T
DIM('a) = DIM('b)

goal (1 subgoal):
 1. frontier S homeomorphic frontier T
[PROOF STEP]
unfolding homeomorphic_def
[PROOF STATE]
proof (prove)
using this:
\<exists>f g. (\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x) \<and> (\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y) \<and> continuous_on S f \<and> continuous_on T g
closed S
closed T
DIM('a) = DIM('b)

goal (1 subgoal):
 1. \<exists>f g. homeomorphism (frontier S) (frontier T) f g
[PROOF STEP]
proof (clarify elim!: ex_forward)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>closed S; closed T; DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (frontier S) (frontier T) f g
[PROOF STEP]
fix f g
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>closed S; closed T; DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (frontier S) (frontier T) f g
[PROOF STEP]
assume S: "\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x" and T: "\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y"
     and contf: "continuous_on S f" and contg: "continuous_on T g"
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>closed S; closed T; DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (frontier S) (frontier T) f g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g
[PROOF STEP]
have fST: "f ` S = T" and gTS: "g ` T = S" and "inj_on f S" "inj_on g T"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g

goal (1 subgoal):
 1. f ` S = T &&& g ` T = S &&& inj_on f S &&& inj_on g T
[PROOF STEP]
by (auto simp: inj_on_def intro: rev_image_eqI) metis+
[PROOF STATE]
proof (state)
this:
f ` S = T
g ` T = S
inj_on f S
inj_on g T

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>closed S; closed T; DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (frontier S) (frontier T) f g
[PROOF STEP]
have "g ` interior T \<subseteq> interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g ` interior T \<subseteq> interior S
[PROOF STEP]
using continuous_image_subset_interior [OF contg \<open>inj_on g T\<close>] dimeq gTS
[PROOF STATE]
proof (prove)
using this:
DIM('a) \<le> DIM('b) \<Longrightarrow> g ` interior T \<subseteq> interior (g ` T)
DIM('a) = DIM('b)
g ` T = S

goal (1 subgoal):
 1. g ` interior T \<subseteq> interior S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g ` interior T \<subseteq> interior S

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>closed S; closed T; DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (frontier S) (frontier T) f g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g ` interior T \<subseteq> interior S
[PROOF STEP]
have fim: "f ` frontier S \<subseteq> frontier T"
[PROOF STATE]
proof (prove)
using this:
g ` interior T \<subseteq> interior S

goal (1 subgoal):
 1. f ` frontier S \<subseteq> frontier T
[PROOF STEP]
apply (simp add: frontier_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g ` interior T \<subseteq> interior S \<Longrightarrow> f ` (closure S - interior S) \<subseteq> closure T - interior T
[PROOF STEP]
using continuous_image_subset_interior assms(2) assms(3) S
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on ?S ?f; inj_on ?f ?S; DIM(?'b) \<le> DIM(?'a)\<rbrakk> \<Longrightarrow> ?f ` interior ?S \<subseteq> interior (?f ` ?S)
closed S
closed T
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x

goal (1 subgoal):
 1. g ` interior T \<subseteq> interior S \<Longrightarrow> f ` (closure S - interior S) \<subseteq> closure T - interior T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` frontier S \<subseteq> frontier T

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>closed S; closed T; DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (frontier S) (frontier T) f g
[PROOF STEP]
have "f ` interior S \<subseteq> interior T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` interior S \<subseteq> interior T
[PROOF STEP]
using continuous_image_subset_interior [OF contf \<open>inj_on f S\<close>] dimeq fST
[PROOF STATE]
proof (prove)
using this:
DIM('b) \<le> DIM('a) \<Longrightarrow> f ` interior S \<subseteq> interior (f ` S)
DIM('a) = DIM('b)
f ` S = T

goal (1 subgoal):
 1. f ` interior S \<subseteq> interior T
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f ` interior S \<subseteq> interior T

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>closed S; closed T; DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (frontier S) (frontier T) f g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f ` interior S \<subseteq> interior T
[PROOF STEP]
have gim: "g ` frontier T \<subseteq> frontier S"
[PROOF STATE]
proof (prove)
using this:
f ` interior S \<subseteq> interior T

goal (1 subgoal):
 1. g ` frontier T \<subseteq> frontier S
[PROOF STEP]
apply (simp add: frontier_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` interior S \<subseteq> interior T \<Longrightarrow> g ` (closure T - interior T) \<subseteq> closure S - interior S
[PROOF STEP]
using continuous_image_subset_interior T assms(2) assms(3)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on ?S ?f; inj_on ?f ?S; DIM(?'b) \<le> DIM(?'a)\<rbrakk> \<Longrightarrow> ?f ` interior ?S \<subseteq> interior (?f ` ?S)
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
closed S
closed T

goal (1 subgoal):
 1. f ` interior S \<subseteq> interior T \<Longrightarrow> g ` (closure T - interior T) \<subseteq> closure S - interior S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g ` frontier T \<subseteq> frontier S

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>closed S; closed T; DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (frontier S) (frontier T) f g
[PROOF STEP]
show "homeomorphism (frontier S) (frontier T) f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphism (frontier S) (frontier T) f g
[PROOF STEP]
unfolding homeomorphism_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>frontier S. g (f x) = x) \<and> f ` frontier S = frontier T \<and> continuous_on (frontier S) f \<and> (\<forall>y\<in>frontier T. f (g y) = y) \<and> g ` frontier T = frontier S \<and> continuous_on (frontier T) g
[PROOF STEP]
proof (intro conjI ballI)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. \<And>x. x \<in> frontier S \<Longrightarrow> g (f x) = x
 2. f ` frontier S = frontier T
 3. continuous_on (frontier S) f
 4. \<And>y. y \<in> frontier T \<Longrightarrow> f (g y) = y
 5. g ` frontier T = frontier S
 6. continuous_on (frontier T) g
[PROOF STEP]
show gf: "\<And>x. x \<in> frontier S \<Longrightarrow> g (f x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> frontier S \<Longrightarrow> g (f x) = x
[PROOF STEP]
by (simp add: S assms(2) frontier_def)
[PROOF STATE]
proof (state)
this:
?x \<in> frontier S \<Longrightarrow> g (f ?x) = ?x

goal (5 subgoals):
 1. f ` frontier S = frontier T
 2. continuous_on (frontier S) f
 3. \<And>y. y \<in> frontier T \<Longrightarrow> f (g y) = y
 4. g ` frontier T = frontier S
 5. continuous_on (frontier T) g
[PROOF STEP]
show fg: "\<And>y. y \<in> frontier T \<Longrightarrow> f (g y) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. y \<in> frontier T \<Longrightarrow> f (g y) = y
[PROOF STEP]
by (simp add: T assms(3) frontier_def)
[PROOF STATE]
proof (state)
this:
?y \<in> frontier T \<Longrightarrow> f (g ?y) = ?y

goal (4 subgoals):
 1. f ` frontier S = frontier T
 2. continuous_on (frontier S) f
 3. g ` frontier T = frontier S
 4. continuous_on (frontier T) g
[PROOF STEP]
have "frontier T \<subseteq> f ` frontier S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier T \<subseteq> f ` frontier S
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> frontier T \<Longrightarrow> x \<in> f ` frontier S
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> frontier T \<Longrightarrow> x \<in> f ` frontier S
[PROOF STEP]
assume "x \<in> frontier T"
[PROOF STATE]
proof (state)
this:
x \<in> frontier T

goal (1 subgoal):
 1. \<And>x. x \<in> frontier T \<Longrightarrow> x \<in> f ` frontier S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> frontier T
[PROOF STEP]
have "g x \<in> frontier S"
[PROOF STATE]
proof (prove)
using this:
x \<in> frontier T

goal (1 subgoal):
 1. g x \<in> frontier S
[PROOF STEP]
using gim
[PROOF STATE]
proof (prove)
using this:
x \<in> frontier T
g ` frontier T \<subseteq> frontier S

goal (1 subgoal):
 1. g x \<in> frontier S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g x \<in> frontier S

goal (1 subgoal):
 1. \<And>x. x \<in> frontier T \<Longrightarrow> x \<in> f ` frontier S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g x \<in> frontier S
[PROOF STEP]
show "x \<in> f ` frontier S"
[PROOF STATE]
proof (prove)
using this:
g x \<in> frontier S

goal (1 subgoal):
 1. x \<in> f ` frontier S
[PROOF STEP]
by (metis fg \<open>x \<in> frontier T\<close> imageI)
[PROOF STATE]
proof (state)
this:
x \<in> f ` frontier S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
frontier T \<subseteq> f ` frontier S

goal (4 subgoals):
 1. f ` frontier S = frontier T
 2. continuous_on (frontier S) f
 3. g ` frontier T = frontier S
 4. continuous_on (frontier T) g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
frontier T \<subseteq> f ` frontier S
[PROOF STEP]
show "f ` frontier S = frontier T"
[PROOF STATE]
proof (prove)
using this:
frontier T \<subseteq> f ` frontier S

goal (1 subgoal):
 1. f ` frontier S = frontier T
[PROOF STEP]
using fim
[PROOF STATE]
proof (prove)
using this:
frontier T \<subseteq> f ` frontier S
f ` frontier S \<subseteq> frontier T

goal (1 subgoal):
 1. f ` frontier S = frontier T
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f ` frontier S = frontier T

goal (3 subgoals):
 1. continuous_on (frontier S) f
 2. g ` frontier T = frontier S
 3. continuous_on (frontier T) g
[PROOF STEP]
show "continuous_on (frontier S) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (frontier S) f
[PROOF STEP]
by (metis Diff_subset assms(2) closure_eq contf continuous_on_subset frontier_def)
[PROOF STATE]
proof (state)
this:
continuous_on (frontier S) f

goal (2 subgoals):
 1. g ` frontier T = frontier S
 2. continuous_on (frontier T) g
[PROOF STEP]
have "frontier S \<subseteq> g ` frontier T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier S \<subseteq> g ` frontier T
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> frontier S \<Longrightarrow> x \<in> g ` frontier T
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> frontier S \<Longrightarrow> x \<in> g ` frontier T
[PROOF STEP]
assume "x \<in> frontier S"
[PROOF STATE]
proof (state)
this:
x \<in> frontier S

goal (1 subgoal):
 1. \<And>x. x \<in> frontier S \<Longrightarrow> x \<in> g ` frontier T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> frontier S
[PROOF STEP]
have "f x \<in> frontier T"
[PROOF STATE]
proof (prove)
using this:
x \<in> frontier S

goal (1 subgoal):
 1. f x \<in> frontier T
[PROOF STEP]
using fim
[PROOF STATE]
proof (prove)
using this:
x \<in> frontier S
f ` frontier S \<subseteq> frontier T

goal (1 subgoal):
 1. f x \<in> frontier T
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f x \<in> frontier T

goal (1 subgoal):
 1. \<And>x. x \<in> frontier S \<Longrightarrow> x \<in> g ` frontier T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f x \<in> frontier T
[PROOF STEP]
show "x \<in> g ` frontier T"
[PROOF STATE]
proof (prove)
using this:
f x \<in> frontier T

goal (1 subgoal):
 1. x \<in> g ` frontier T
[PROOF STEP]
by (metis gf \<open>x \<in> frontier S\<close> imageI)
[PROOF STATE]
proof (state)
this:
x \<in> g ` frontier T

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
frontier S \<subseteq> g ` frontier T

goal (2 subgoals):
 1. g ` frontier T = frontier S
 2. continuous_on (frontier T) g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
frontier S \<subseteq> g ` frontier T
[PROOF STEP]
show "g ` frontier T = frontier S"
[PROOF STATE]
proof (prove)
using this:
frontier S \<subseteq> g ` frontier T

goal (1 subgoal):
 1. g ` frontier T = frontier S
[PROOF STEP]
using gim
[PROOF STATE]
proof (prove)
using this:
frontier S \<subseteq> g ` frontier T
g ` frontier T \<subseteq> frontier S

goal (1 subgoal):
 1. g ` frontier T = frontier S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g ` frontier T = frontier S

goal (1 subgoal):
 1. continuous_on (frontier T) g
[PROOF STEP]
show "continuous_on (frontier T) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (frontier T) g
[PROOF STEP]
by (metis Diff_subset assms(3) closure_closed contg continuous_on_subset frontier_def)
[PROOF STATE]
proof (state)
this:
continuous_on (frontier T) g

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
homeomorphism (frontier S) (frontier T) f g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sums_minus: "f sums a \<Longrightarrow> (\<lambda>n. - f n) sums (- a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f sums a \<Longrightarrow> (\<lambda>n. - f n) sums - a
[PROOF STEP]
unfolding sums_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> a \<Longrightarrow> (\<lambda>n. \<Sum>n<n. - f n) \<longlonglongrightarrow> - a
[PROOF STEP]
by (simp add: sum_negf tendsto_minus)


[STATEMENT]
lemma "\<^bold>V_def": "\<^bold>V\<^bsub>G\<^esub> = fst ` \<^bold>E\<^bsub>G\<^esub> \<union> snd ` \<^bold>E\<^bsub>G\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>V\<^bsub>G\<^esub> = fst ` \<^bold>E\<^bsub>G\<^esub> \<union> snd ` \<^bold>E\<^bsub>G\<^esub>
[PROOF STEP]
by(auto 4 3 simp add: vertex_def intro: rev_image_eqI prod.expand)


[STATEMENT]
lemma comp_primroot_conv': assumes "u \<noteq> \<epsilon>" and "v \<noteq> \<epsilon>" shows "u \<cdot> v = v \<cdot> u \<longleftrightarrow> \<rho> u \<cdot> \<rho> v = \<rho> v \<cdot> \<rho> u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<cdot> v = v \<cdot> u) = (\<rho> u \<cdot> \<rho> v = \<rho> v \<cdot> \<rho> u)
[PROOF STEP]
unfolding comm_primroot_conv[OF \<open>v \<noteq> \<epsilon>\<close>, symmetric] eq_commute[of "u \<cdot> v"] eq_commute[of "\<rho> u \<cdot> v"]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v \<cdot> u = u \<cdot> v) = (v \<cdot> \<rho> u = \<rho> u \<cdot> v)
[PROOF STEP]
unfolding comm_primroot_conv[OF \<open>u \<noteq> \<epsilon>\<close>, symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v \<cdot> u = u \<cdot> v) = (v \<cdot> u = u \<cdot> v)
[PROOF STEP]
..


[STATEMENT]
lemma find_max_append:  "find_max (xs @ ys) = max (find_max xs) (find_max ys) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. find_max (xs @ ys) = max (find_max xs) (find_max ys)
[PROOF STEP]
apply(simp only: Max.set_eq_fold[symmetric] append_Cons[symmetric] set_append find_max_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (set (1 # xs) \<union> set ys) = max (Max (set (1 # xs))) (Max (set (1 # ys)))
[PROOF STEP]
by (metis List.finite_set Max.union Un_absorb Un_insert_left Un_insert_right list.distinct(1) list.simps(15) set_empty)


[STATEMENT]
lemma len_lexext_rev_irrefl: "(\<forall>x \<in> set xs. \<not> gt x x) \<Longrightarrow> \<not> len_lexext_rev gt xs xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set xs. \<not> gt x x \<Longrightarrow> \<not> len_lexext_rev gt xs xs
[PROOF STEP]
by (rule lenext_irrefl) (rule lexext_rev_irrefl)


[STATEMENT]
lemma connected_component_eq:
  "y \<in> connected_component_set S x \<Longrightarrow> (connected_component_set S y = connected_component_set S x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> connected_component_set S x \<Longrightarrow> connected_component_set S y = connected_component_set S x
[PROOF STEP]
by (metis (no_types, lifting)
      Collect_cong connected_component_sym connected_component_trans mem_Collect_eq)


[STATEMENT]
lemma ladder_shift_n_cons: "ladder_shift_n N (x#L) = (fst x - N, snd x)#(ladder_shift_n N L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ladder_shift_n N (x # L) = (fst x - N, snd x) # ladder_shift_n N L
[PROOF STEP]
apply (induct L)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ladder_shift_n N [x] = (fst x - N, snd x) # ladder_shift_n N []
 2. \<And>a L. ladder_shift_n N (x # L) = (fst x - N, snd x) # ladder_shift_n N L \<Longrightarrow> ladder_shift_n N (x # a # L) = (fst x - N, snd x) # ladder_shift_n N (a # L)
[PROOF STEP]
by (cases x, simp)+


[STATEMENT]
lemma gcard_eq_vcard [simp]: "gcard (elts x) = vcard x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcard (elts x) = vcard x
[PROOF STEP]
by (simp add: vcard_def gcard_def)


[STATEMENT]
lemma residue_primroot_power_prime_power_neq_1:
  assumes "k \<ge> 2"
  assumes p: "prime p" "odd p" and "residue_primroot p g" and "[g ^ (p - 1) \<noteq> 1] (mod p\<^sup>2)"
  shows   "[g ^ totient (p ^ (k - 1)) \<noteq> 1] (mod (p ^ k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [g ^ totient (p ^ (k - 1)) \<noteq> 1] (mod p ^ k)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
2 \<le> k

goal (1 subgoal):
 1. [g ^ totient (p ^ (k - 1)) \<noteq> 1] (mod p ^ k)
[PROOF STEP]
proof (induction k rule: dec_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. [g ^ totient (p ^ (2 - 1)) \<noteq> 1] (mod p\<^sup>2)
 2. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
case base
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. [g ^ totient (p ^ (2 - 1)) \<noteq> 1] (mod p\<^sup>2)
 2. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [g ^ totient (p ^ (2 - 1)) \<noteq> 1] (mod p\<^sup>2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 \<le> k
prime p
odd p
residue_primroot p g
[g ^ (p - 1) \<noteq> 1] (mod p\<^sup>2)

goal (1 subgoal):
 1. [g ^ totient (p ^ (2 - 1)) \<noteq> 1] (mod p\<^sup>2)
[PROOF STEP]
by (simp add: totient_prime)
[PROOF STATE]
proof (state)
this:
[g ^ totient (p ^ (2 - 1)) \<noteq> 1] (mod p\<^sup>2)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
case (step k)
[PROOF STATE]
proof (state)
this:
2 \<le> k
k < k
[g ^ totient (p ^ (k - 1)) \<noteq> 1] (mod p ^ k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
from p
[PROOF STATE]
proof (chain)
picking this:
prime p
odd p
[PROOF STEP]
have "p > 2"
[PROOF STATE]
proof (prove)
using this:
prime p
odd p

goal (1 subgoal):
 1. 2 < p
[PROOF STEP]
using prime_gt_1_nat[of p]
[PROOF STATE]
proof (prove)
using this:
prime p
odd p
prime p \<Longrightarrow> 1 < p

goal (1 subgoal):
 1. 2 < p
[PROOF STEP]
by (cases "p = 2") auto
[PROOF STATE]
proof (state)
this:
2 < p

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
2 \<le> k
prime p
odd p
residue_primroot p g
[g ^ (p - 1) \<noteq> 1] (mod p\<^sup>2)
[PROOF STEP]
have g: "g > 0"
[PROOF STATE]
proof (prove)
using this:
2 \<le> k
prime p
odd p
residue_primroot p g
[g ^ (p - 1) \<noteq> 1] (mod p\<^sup>2)

goal (1 subgoal):
 1. 0 < g
[PROOF STEP]
by (auto intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
0 < g

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
have "[g ^ totient (p ^ (k - 1)) = 1] (mod p ^ (k - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [g ^ totient (p ^ (k - 1)) = 1] (mod p ^ (k - 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 \<le> k
prime p
odd p
residue_primroot p g
[g ^ (p - 1) \<noteq> 1] (mod p\<^sup>2)

goal (1 subgoal):
 1. [g ^ totient (p ^ (k - 1)) = 1] (mod p ^ (k - 1))
[PROOF STEP]
by (intro euler_theorem)
                   (auto simp: residue_primroot_def totatives_def coprime_commute)
[PROOF STATE]
proof (state)
this:
[g ^ totient (p ^ (k - 1)) = 1] (mod p ^ (k - 1))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
from cong_to_1_nat[OF this]
[PROOF STATE]
proof (chain)
picking this:
p ^ (k - 1) dvd g ^ totient (p ^ (k - 1)) - 1
[PROOF STEP]
obtain t where *: "g ^ totient (p ^ (k - 1)) - 1 = p ^ (k - 1) * t"
[PROOF STATE]
proof (prove)
using this:
p ^ (k - 1) dvd g ^ totient (p ^ (k - 1)) - 1

goal (1 subgoal):
 1. (\<And>t. g ^ totient (p ^ (k - 1)) - 1 = p ^ (k - 1) * t \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g ^ totient (p ^ (k - 1)) - 1 = p ^ (k - 1) * t

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
have t: "g ^ totient (p ^ (k - 1)) = p ^ (k - 1) * t + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g ^ totient (p ^ (k - 1)) = p ^ (k - 1) * t + 1
[PROOF STEP]
using g
[PROOF STATE]
proof (prove)
using this:
0 < g

goal (1 subgoal):
 1. g ^ totient (p ^ (k - 1)) = p ^ (k - 1) * t + 1
[PROOF STEP]
by (subst * [symmetric]) auto
[PROOF STATE]
proof (state)
this:
g ^ totient (p ^ (k - 1)) = p ^ (k - 1) * t + 1

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
have "\<not>p dvd t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> p dvd t
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p dvd t \<Longrightarrow> False
[PROOF STEP]
assume "p dvd t"
[PROOF STATE]
proof (state)
this:
p dvd t

goal (1 subgoal):
 1. p dvd t \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p dvd t
[PROOF STEP]
obtain q where [simp]: "t = p * q"
[PROOF STATE]
proof (prove)
using this:
p dvd t

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

goal (1 subgoal):
 1. p dvd t \<Longrightarrow> False
[PROOF STEP]
from t
[PROOF STATE]
proof (chain)
picking this:
g ^ totient (p ^ (k - 1)) = p ^ (k - 1) * t + 1
[PROOF STEP]
have "g ^ totient (p ^ (k - 1)) = p ^ k * q + 1"
[PROOF STATE]
proof (prove)
using this:
g ^ totient (p ^ (k - 1)) = p ^ (k - 1) * t + 1

goal (1 subgoal):
 1. g ^ totient (p ^ (k - 1)) = p ^ k * q + 1
[PROOF STEP]
using \<open>k \<ge> 2\<close>
[PROOF STATE]
proof (prove)
using this:
g ^ totient (p ^ (k - 1)) = p ^ (k - 1) * t + 1
2 \<le> k

goal (1 subgoal):
 1. g ^ totient (p ^ (k - 1)) = p ^ k * q + 1
[PROOF STEP]
by (cases k) auto
[PROOF STATE]
proof (state)
this:
g ^ totient (p ^ (k - 1)) = p ^ k * q + 1

goal (1 subgoal):
 1. p dvd t \<Longrightarrow> False
[PROOF STEP]
hence "[g ^ totient (p ^ (k - 1)) = p ^ k * q + 1] (mod p ^ k)"
[PROOF STATE]
proof (prove)
using this:
g ^ totient (p ^ (k - 1)) = p ^ k * q + 1

goal (1 subgoal):
 1. [g ^ totient (p ^ (k - 1)) = p ^ k * q + 1] (mod p ^ k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[g ^ totient (p ^ (k - 1)) = p ^ k * q + 1] (mod p ^ k)

goal (1 subgoal):
 1. p dvd t \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[g ^ totient (p ^ (k - 1)) = p ^ k * q + 1] (mod p ^ k)

goal (1 subgoal):
 1. p dvd t \<Longrightarrow> False
[PROOF STEP]
have "[p ^ k * q + 1 = 0 * q + 1] (mod p ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [p ^ k * q + 1 = 0 * q + 1] (mod p ^ k)
[PROOF STEP]
by (intro cong_add cong_mult) (auto simp: cong_0_iff)
[PROOF STATE]
proof (state)
this:
[p ^ k * q + 1 = 0 * q + 1] (mod p ^ k)

goal (1 subgoal):
 1. p dvd t \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[g ^ totient (p ^ (k - 1)) = 0 * q + 1] (mod p ^ k)
[PROOF STEP]
have "[g ^ totient (p ^ (k - 1)) = 1] (mod p ^ k)"
[PROOF STATE]
proof (prove)
using this:
[g ^ totient (p ^ (k - 1)) = 0 * q + 1] (mod p ^ k)

goal (1 subgoal):
 1. [g ^ totient (p ^ (k - 1)) = 1] (mod p ^ k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[g ^ totient (p ^ (k - 1)) = 1] (mod p ^ k)

goal (1 subgoal):
 1. p dvd t \<Longrightarrow> False
[PROOF STEP]
with step.IH
[PROOF STATE]
proof (chain)
picking this:
[g ^ totient (p ^ (k - 1)) \<noteq> 1] (mod p ^ k)
[g ^ totient (p ^ (k - 1)) = 1] (mod p ^ k)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
[g ^ totient (p ^ (k - 1)) \<noteq> 1] (mod p ^ k)
[g ^ totient (p ^ (k - 1)) = 1] (mod p ^ k)

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

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

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
from t
[PROOF STATE]
proof (chain)
picking this:
g ^ totient (p ^ (k - 1)) = p ^ (k - 1) * t + 1
[PROOF STEP]
have "(g ^ totient (p ^ (k - 1))) ^ p = (p ^ (k - 1) * t + 1) ^ p"
[PROOF STATE]
proof (prove)
using this:
g ^ totient (p ^ (k - 1)) = p ^ (k - 1) * t + 1

goal (1 subgoal):
 1. (g ^ totient (p ^ (k - 1))) ^ p = (p ^ (k - 1) * t + 1) ^ p
[PROOF STEP]
by (rule arg_cong)
[PROOF STATE]
proof (state)
this:
(g ^ totient (p ^ (k - 1))) ^ p = (p ^ (k - 1) * t + 1) ^ p

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(g ^ totient (p ^ (k - 1))) ^ p = (p ^ (k - 1) * t + 1) ^ p

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
have "(g ^ totient (p ^ (k - 1))) ^ p = g ^ (p * totient (p ^ (k - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g ^ totient (p ^ (k - 1))) ^ p = g ^ (p * totient (p ^ (k - 1)))
[PROOF STEP]
by (simp add: power_mult [symmetric] mult.commute)
[PROOF STATE]
proof (state)
this:
(g ^ totient (p ^ (k - 1))) ^ p = g ^ (p * totient (p ^ (k - 1)))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(g ^ totient (p ^ (k - 1))) ^ p = g ^ (p * totient (p ^ (k - 1)))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
have "p * totient (p ^ (k - 1)) = totient (p ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * totient (p ^ (k - 1)) = totient (p ^ k)
[PROOF STEP]
using p \<open>k \<ge> 2\<close>
[PROOF STATE]
proof (prove)
using this:
prime p
odd p
2 \<le> k

goal (1 subgoal):
 1. p * totient (p ^ (k - 1)) = totient (p ^ k)
[PROOF STEP]
by (simp add: totient_prime_power Suc_diff_Suc flip: power_Suc)
[PROOF STATE]
proof (state)
this:
p * totient (p ^ (k - 1)) = totient (p ^ k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p * totient (p ^ (k - 1)) = totient (p ^ k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
have "(p ^ (k - 1) * t + 1) ^ p = (\<Sum>i\<le>p. (p choose i) * t ^ i * p ^ (i * (k - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p ^ (k - 1) * t + 1) ^ p = (\<Sum>i\<le>p. (p choose i) * t ^ i * p ^ (i * (k - 1)))
[PROOF STEP]
by (subst binomial) (simp_all add: mult_ac power_mult_distrib power_mult [symmetric])
[PROOF STATE]
proof (state)
this:
(p ^ (k - 1) * t + 1) ^ p = (\<Sum>i\<le>p. (p choose i) * t ^ i * p ^ (i * (k - 1)))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
g ^ totient (p ^ k) = (\<Sum>i\<le>p. (p choose i) * t ^ i * p ^ (i * (k - 1)))
[PROOF STEP]
have "[g ^ totient (p ^ k) = (\<Sum>i\<le>p. (p choose i) * t ^ i * p ^ (i * (k - 1)))]
                  (mod (p ^ Suc k))" (is "[_ = ?rhs] (mod _)")
[PROOF STATE]
proof (prove)
using this:
g ^ totient (p ^ k) = (\<Sum>i\<le>p. (p choose i) * t ^ i * p ^ (i * (k - 1)))

goal (1 subgoal):
 1. [g ^ totient (p ^ k) = \<Sum>i\<le>p. (p choose i) * t ^ i * p ^ (i * (k - 1))] (mod p ^ Suc k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[g ^ totient (p ^ k) = \<Sum>i\<le>p. (p choose i) * t ^ i * p ^ (i * (k - 1))] (mod p ^ Suc k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[g ^ totient (p ^ k) = \<Sum>i\<le>p. (p choose i) * t ^ i * p ^ (i * (k - 1))] (mod p ^ Suc k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
have "[?rhs = (\<Sum>i\<le>p. if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0)]
               (mod (p ^ Suc k))" (is "[sum ?f _ = sum ?g _] (mod _)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [\<Sum>i\<le>p. (p choose i) * t ^ i * p ^ (i * (k - 1)) = \<Sum>i\<le>p. if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
proof (intro cong_sum)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..p} \<Longrightarrow> [(p choose x) * t ^ x * p ^ (x * (k - 1)) = if x \<le> 1 then (p choose x) * t ^ x * p ^ (x * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..p} \<Longrightarrow> [(p choose x) * t ^ x * p ^ (x * (k - 1)) = if x \<le> 1 then (p choose x) * t ^ x * p ^ (x * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
assume i: "i \<in> {..p}"
[PROOF STATE]
proof (state)
this:
i \<in> {..p}

goal (1 subgoal):
 1. \<And>x. x \<in> {..p} \<Longrightarrow> [(p choose x) * t ^ x * p ^ (x * (k - 1)) = if x \<le> 1 then (p choose x) * t ^ x * p ^ (x * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
consider "i \<le> 1" | "i = 2" | "i > 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<le> 1 \<Longrightarrow> thesis; i = 2 \<Longrightarrow> thesis; 2 < i \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<lbrakk>i \<le> 1 \<Longrightarrow> ?thesis; i = 2 \<Longrightarrow> ?thesis; 2 < i \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<And>x. x \<in> {..p} \<Longrightarrow> [(p choose x) * t ^ x * p ^ (x * (k - 1)) = if x \<le> 1 then (p choose x) * t ^ x * p ^ (x * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
thus "[?f i = ?g i] (mod (p ^ Suc k))"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i \<le> 1 \<Longrightarrow> ?thesis; i = 2 \<Longrightarrow> ?thesis; 2 < i \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 3. 2 < i \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
assume i: "i > 2"
[PROOF STATE]
proof (state)
this:
2 < i

goal (3 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 3. 2 < i \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
have "Suc k \<le> 3 * (k - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc k \<le> 3 * (k - 1)
[PROOF STEP]
using \<open>k \<ge> 2\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<le> k

goal (1 subgoal):
 1. Suc k \<le> 3 * (k - 1)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
Suc k \<le> 3 * (k - 1)

goal (3 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 3. 2 < i \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc k \<le> 3 * (k - 1)

goal (3 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 3. 2 < i \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
have "3 * (k - 1) \<le> i * (k - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 * (k - 1) \<le> i * (k - 1)
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
2 < i

goal (1 subgoal):
 1. 3 * (k - 1) \<le> i * (k - 1)
[PROOF STEP]
by (intro mult_right_mono) auto
[PROOF STATE]
proof (state)
this:
3 * (k - 1) \<le> i * (k - 1)

goal (3 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 3. 2 < i \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Suc k \<le> i * (k - 1)
[PROOF STEP]
have "p ^ Suc k dvd ?f i"
[PROOF STATE]
proof (prove)
using this:
Suc k \<le> i * (k - 1)

goal (1 subgoal):
 1. p ^ Suc k dvd (p choose i) * t ^ i * p ^ (i * (k - 1))
[PROOF STEP]
by (intro dvd_mult le_imp_power_dvd)
[PROOF STATE]
proof (state)
this:
p ^ Suc k dvd (p choose i) * t ^ i * p ^ (i * (k - 1))

goal (3 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 3. 2 < i \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
thus "[?f i = ?g i] (mod (p ^ Suc k))"
[PROOF STATE]
proof (prove)
using this:
p ^ Suc k dvd (p choose i) * t ^ i * p ^ (i * (k - 1))

goal (1 subgoal):
 1. [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
by (simp add: cong_0_iff)
[PROOF STATE]
proof (state)
this:
[(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)

goal (2 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
assume [simp]: "i = 2"
[PROOF STATE]
proof (state)
this:
i = 2

goal (2 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
have "?f i = p * (p - 1) div 2 * t\<^sup>2 * p ^ (2 * (k - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p choose i) * t ^ i * p ^ (i * (k - 1)) = p * (p - 1) div 2 * t\<^sup>2 * p ^ (2 * (k - 1))
[PROOF STEP]
using choose_two[of p]
[PROOF STATE]
proof (prove)
using this:
p choose 2 = p * (p - 1) div 2

goal (1 subgoal):
 1. (p choose i) * t ^ i * p ^ (i * (k - 1)) = p * (p - 1) div 2 * t\<^sup>2 * p ^ (2 * (k - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(p choose i) * t ^ i * p ^ (i * (k - 1)) = p * (p - 1) div 2 * t\<^sup>2 * p ^ (2 * (k - 1))

goal (2 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(p choose i) * t ^ i * p ^ (i * (k - 1)) = p * (p - 1) div 2 * t\<^sup>2 * p ^ (2 * (k - 1))

goal (2 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
have "p * (p - 1) div 2 = (p - 1) div 2 * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * (p - 1) div 2 = (p - 1) div 2 * p
[PROOF STEP]
using \<open>odd p\<close>
[PROOF STATE]
proof (prove)
using this:
odd p

goal (1 subgoal):
 1. p * (p - 1) div 2 = (p - 1) div 2 * p
[PROOF STEP]
by (auto elim!: oddE)
[PROOF STATE]
proof (state)
this:
p * (p - 1) div 2 = (p - 1) div 2 * p

goal (2 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p * (p - 1) div 2 = (p - 1) div 2 * p

goal (2 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
have "\<dots> * t\<^sup>2 * p ^ (2 * (k - 1)) = (p - 1) div 2 * t\<^sup>2 * (p * p ^ (2 * (k - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p - 1) div 2 * p * t\<^sup>2 * p ^ (2 * (k - 1)) = (p - 1) div 2 * t\<^sup>2 * (p * p ^ (2 * (k - 1)))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(p - 1) div 2 * p * t\<^sup>2 * p ^ (2 * (k - 1)) = (p - 1) div 2 * t\<^sup>2 * (p * p ^ (2 * (k - 1)))

goal (2 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(p - 1) div 2 * p * t\<^sup>2 * p ^ (2 * (k - 1)) = (p - 1) div 2 * t\<^sup>2 * (p * p ^ (2 * (k - 1)))

goal (2 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
have "p * p ^ (2 * (k - 1)) = p ^ (2 * k - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * p ^ (2 * (k - 1)) = p ^ (2 * k - 1)
[PROOF STEP]
using \<open>k \<ge> 2\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<le> k

goal (1 subgoal):
 1. p * p ^ (2 * (k - 1)) = p ^ (2 * k - 1)
[PROOF STEP]
by (cases k) auto
[PROOF STATE]
proof (state)
this:
p * p ^ (2 * (k - 1)) = p ^ (2 * k - 1)

goal (2 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p * p ^ (2 * (k - 1)) = p ^ (2 * k - 1)

goal (2 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
have "p ^ Suc k dvd (p - 1) div 2 * t\<^sup>2 * p ^ (2 * k - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ Suc k dvd (p - 1) div 2 * t\<^sup>2 * p ^ (2 * k - 1)
[PROOF STEP]
using \<open>k \<ge> 2\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<le> k

goal (1 subgoal):
 1. p ^ Suc k dvd (p - 1) div 2 * t\<^sup>2 * p ^ (2 * k - 1)
[PROOF STEP]
by (intro dvd_mult le_imp_power_dvd) auto
[PROOF STATE]
proof (state)
this:
p ^ Suc k dvd (p - 1) div 2 * t\<^sup>2 * p ^ (2 * k - 1)

goal (2 subgoals):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
 2. i = 2 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p ^ Suc k dvd (p choose i) * t ^ i * p ^ (i * (k - 1))
[PROOF STEP]
show "[?f i = ?g i] (mod (p ^ Suc k))"
[PROOF STATE]
proof (prove)
using this:
p ^ Suc k dvd (p choose i) * t ^ i * p ^ (i * (k - 1))

goal (1 subgoal):
 1. [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
by (simp add: cong_0_iff)
[PROOF STATE]
proof (state)
this:
[(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)

goal (1 subgoal):
 1. i \<le> 1 \<Longrightarrow> [(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
[(p choose i) * t ^ i * p ^ (i * (k - 1)) = if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[\<Sum>i\<le>p. (p choose i) * t ^ i * p ^ (i * (k - 1)) = \<Sum>i\<le>p. if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[\<Sum>i\<le>p. (p choose i) * t ^ i * p ^ (i * (k - 1)) = \<Sum>i\<le>p. if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0] (mod p ^ Suc k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
have "(\<Sum>i\<le>p. ?g i) = (\<Sum>i\<le>1. ?f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>p. if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0) = (\<Sum>i\<le>1. (p choose i) * t ^ i * p ^ (i * (k - 1)))
[PROOF STEP]
using p prime_gt_1_nat[of p]
[PROOF STATE]
proof (prove)
using this:
prime p
odd p
prime p \<Longrightarrow> 1 < p

goal (1 subgoal):
 1. (\<Sum>i\<le>p. if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0) = (\<Sum>i\<le>1. (p choose i) * t ^ i * p ^ (i * (k - 1)))
[PROOF STEP]
by (intro sum.mono_neutral_cong_right) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>p. if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0) = (\<Sum>i\<le>1. (p choose i) * t ^ i * p ^ (i * (k - 1)))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>p. if i \<le> 1 then (p choose i) * t ^ i * p ^ (i * (k - 1)) else 0) = (\<Sum>i\<le>1. (p choose i) * t ^ i * p ^ (i * (k - 1)))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
have "\<dots> = 1 + t * p ^ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>1. (p choose i) * t ^ i * p ^ (i * (k - 1))) = 1 + t * p ^ k
[PROOF STEP]
using choose_two[of p] \<open>k \<ge> 2\<close>
[PROOF STATE]
proof (prove)
using this:
p choose 2 = p * (p - 1) div 2
2 \<le> k

goal (1 subgoal):
 1. (\<Sum>i\<le>1. (p choose i) * t ^ i * p ^ (i * (k - 1))) = 1 + t * p ^ k
[PROOF STEP]
by (cases k) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>1. (p choose i) * t ^ i * p ^ (i * (k - 1))) = 1 + t * p ^ k

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[g ^ totient (p ^ k) = 1 + t * p ^ k] (mod p ^ Suc k)
[PROOF STEP]
have eq: "[g ^ totient (p ^ k) = 1 + t * p ^ k] (mod p ^ Suc k)"
[PROOF STATE]
proof (prove)
using this:
[g ^ totient (p ^ k) = 1 + t * p ^ k] (mod p ^ Suc k)

goal (1 subgoal):
 1. [g ^ totient (p ^ k) = 1 + t * p ^ k] (mod p ^ Suc k)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
[g ^ totient (p ^ k) = 1 + t * p ^ k] (mod p ^ Suc k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
have "[g ^ totient (p ^ k) \<noteq> 1] (mod p ^ Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [g ^ totient (p ^ k) \<noteq> 1] (mod p ^ Suc k)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [g ^ totient (p ^ k) = 1] (mod p ^ Suc k) \<Longrightarrow> False
[PROOF STEP]
assume "[g ^ totient (p ^ k) = 1] (mod p ^ Suc k)"
[PROOF STATE]
proof (state)
this:
[g ^ totient (p ^ k) = 1] (mod p ^ Suc k)

goal (1 subgoal):
 1. [g ^ totient (p ^ k) = 1] (mod p ^ Suc k) \<Longrightarrow> False
[PROOF STEP]
hence "[g ^ totient (p ^ k) - g ^ totient (p ^ k) = 1 + t * p ^ k - 1] (mod p ^ Suc k)"
[PROOF STATE]
proof (prove)
using this:
[g ^ totient (p ^ k) = 1] (mod p ^ Suc k)

goal (1 subgoal):
 1. [g ^ totient (p ^ k) - g ^ totient (p ^ k) = 1 + t * p ^ k - 1] (mod p ^ Suc k)
[PROOF STEP]
by (intro cong_diff_nat eq) auto
[PROOF STATE]
proof (state)
this:
[g ^ totient (p ^ k) - g ^ totient (p ^ k) = 1 + t * p ^ k - 1] (mod p ^ Suc k)

goal (1 subgoal):
 1. [g ^ totient (p ^ k) = 1] (mod p ^ Suc k) \<Longrightarrow> False
[PROOF STEP]
hence "[t * p ^ k = 0] (mod p ^ Suc k)"
[PROOF STATE]
proof (prove)
using this:
[g ^ totient (p ^ k) - g ^ totient (p ^ k) = 1 + t * p ^ k - 1] (mod p ^ Suc k)

goal (1 subgoal):
 1. [t * p ^ k = 0] (mod p ^ Suc k)
[PROOF STEP]
by (simp add: cong_sym_eq)
[PROOF STATE]
proof (state)
this:
[t * p ^ k = 0] (mod p ^ Suc k)

goal (1 subgoal):
 1. [g ^ totient (p ^ k) = 1] (mod p ^ Suc k) \<Longrightarrow> False
[PROOF STEP]
hence "p * p ^ k dvd t * p ^ k"
[PROOF STATE]
proof (prove)
using this:
[t * p ^ k = 0] (mod p ^ Suc k)

goal (1 subgoal):
 1. p * p ^ k dvd t * p ^ k
[PROOF STEP]
by (simp add: cong_0_iff)
[PROOF STATE]
proof (state)
this:
p * p ^ k dvd t * p ^ k

goal (1 subgoal):
 1. [g ^ totient (p ^ k) = 1] (mod p ^ Suc k) \<Longrightarrow> False
[PROOF STEP]
hence "p dvd t"
[PROOF STATE]
proof (prove)
using this:
p * p ^ k dvd t * p ^ k

goal (1 subgoal):
 1. p dvd t
[PROOF STEP]
using \<open>p > 2\<close>
[PROOF STATE]
proof (prove)
using this:
p * p ^ k dvd t * p ^ k
2 < p

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

goal (1 subgoal):
 1. [g ^ totient (p ^ k) = 1] (mod p ^ Suc k) \<Longrightarrow> False
[PROOF STEP]
with \<open>\<not>p dvd t\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> p dvd t
p dvd t
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<not> p dvd t
p dvd t

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[g ^ totient (p ^ k) \<noteq> 1] (mod p ^ Suc k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>2 \<le> n; n < k; [g ^ totient (p ^ (n - 1)) \<noteq> 1] (mod p ^ n)\<rbrakk> \<Longrightarrow> [g ^ totient (p ^ (Suc n - 1)) \<noteq> 1] (mod p ^ Suc n)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
[g ^ totient (p ^ k) \<noteq> 1] (mod p ^ Suc k)

goal (1 subgoal):
 1. [g ^ totient (p ^ (Suc k - 1)) \<noteq> 1] (mod p ^ Suc k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[g ^ totient (p ^ (Suc k - 1)) \<noteq> 1] (mod p ^ Suc k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_to_bv_non0 [simp]: "n\<noteq>0 ==> nat_to_bv n = nat_to_bv (n div 2) @ [if n mod 2 = 0 then \<zero> else \<one>]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> nat_to_bv n = nat_to_bv (n div 2) @ [if n mod 2 = 0 then \<zero> else \<one>]
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> nat_to_bv n = nat_to_bv (n div 2) @ [if n mod 2 = 0 then \<zero> else \<one>]
[PROOF STEP]
assume n: "n\<noteq>0"
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> nat_to_bv n = nat_to_bv (n div 2) @ [if n mod 2 = 0 then \<zero> else \<one>]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_bv n = nat_to_bv (n div 2) @ [if n mod 2 = 0 then \<zero> else \<one>]
[PROOF STEP]
apply (subst nat_to_bv_def [of n])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_bv_helper n [] = nat_to_bv (n div 2) @ [if n mod 2 = 0 then \<zero> else \<one>]
[PROOF STEP]
apply (simp only: nat_to_bv_helper.simps [of n])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if n = 0 then [] else nat_to_bv_helper (n div 2) [if n mod 2 = 0 then \<zero> else \<one>]) = nat_to_bv (n div 2) @ [if n mod 2 = 0 then \<zero> else \<one>]
[PROOF STEP]
apply (subst unfold_nat_to_bv_helper)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if n = 0 then [] else nat_to_bv_helper (n div 2) [] @ [if n mod 2 = 0 then \<zero> else \<one>]) = nat_to_bv (n div 2) @ [if n mod 2 = 0 then \<zero> else \<one>]
[PROOF STEP]
apply (simp add: n)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_bv_helper (n div 2) [] = nat_to_bv (n div 2)
[PROOF STEP]
apply (subst nat_to_bv_def [of "n div 2"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_bv_helper (n div 2) [] = nat_to_bv_helper (n div 2) []
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
nat_to_bv n = nat_to_bv (n div 2) @ [if n mod 2 = 0 then \<zero> else \<one>]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_of_foldr: "map_of xs = foldr (\<lambda>(k, v) m. m(k \<mapsto> v)) xs Map.empty"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_of xs = foldr (\<lambda>(k, v) m. m(k \<mapsto> v)) xs Map.empty
[PROOF STEP]
using map_add_map_of_foldr [of Map.empty]
[PROOF STATE]
proof (prove)
using this:
Map.empty ++ map_of ?ps = foldr (\<lambda>(k, v) m. m(k \<mapsto> v)) ?ps Map.empty

goal (1 subgoal):
 1. map_of xs = foldr (\<lambda>(k, v) m. m(k \<mapsto> v)) xs Map.empty
[PROOF STEP]
by auto


[STATEMENT]
lemma tendsto_mat_mult [tendsto_intros]:
  "(f \<longlongrightarrow> a) F \<Longrightarrow> (g \<longlongrightarrow> b) F \<Longrightarrow> ((\<lambda>x. f x ** g x) \<longlongrightarrow> a ** b) F"
  for f :: "'a \<Rightarrow> 'b :: {semiring_1, real_normed_algebra} ^ 'n1 ^ 'n2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> a) F; (g \<longlongrightarrow> b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x ** g x) \<longlongrightarrow> a ** b) F
[PROOF STEP]
unfolding matrix_matrix_mult_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> a) F; (g \<longlongrightarrow> b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<chi>i j. \<Sum>k\<in>UNIV. f x $h i $h k * g x $h k $h j) \<longlongrightarrow> (\<chi>i j. \<Sum>k\<in>UNIV. a $h i $h k * b $h k $h j)) F
[PROOF STEP]
by (auto intro!: tendsto_intros)


[STATEMENT]
lemma lookup_x:
  assumes "Some (b,c) = lookup G x"
  shows "x \<in> fst ` toSet G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> fst ` toSet G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Some (b, c) = lookup G x

goal (1 subgoal):
 1. x \<in> fst ` toSet G
[PROOF STEP]
by(induct "G" rule: \<Gamma>.induct ,auto+)


[STATEMENT]
lemma mu_fusion_equal_3:
  assumes "galois l u"
      and "isotone g"
      and "isotone h"
      and "has_least_prefixpoint g"
      and "has_least_fixpoint h"
      and "l \<circ> g = h \<circ> l"
    shows "\<mu> h = l (p\<mu> g)"
      and "\<mu> h = l (\<mu> g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<mu> h = l (p\<mu> g) &&& \<mu> h = l (\<mu> g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<mu> h = l (p\<mu> g)
 2. \<mu> h = l (\<mu> g)
[PROOF STEP]
have "\<forall>x . l (g x) = h (l x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. l (g x) = h (l x)
[PROOF STEP]
using assms(6) comp_eq_elim
[PROOF STATE]
proof (prove)
using this:
l \<circ> g = h \<circ> l
\<lbrakk>?a \<circ> ?b = ?c \<circ> ?d; (\<And>v. ?a (?b v) = ?c (?d v)) \<Longrightarrow> ?R\<rbrakk> \<Longrightarrow> ?R

goal (1 subgoal):
 1. \<forall>x. l (g x) = h (l x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x. l (g x) = h (l x)

goal (2 subgoals):
 1. \<mu> h = l (p\<mu> g)
 2. \<mu> h = l (\<mu> g)
[PROOF STEP]
thus "\<mu> h = l (p\<mu> g)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. l (g x) = h (l x)

goal (1 subgoal):
 1. \<mu> h = l (p\<mu> g)
[PROOF STEP]
using assms(1-5) mu_fusion_equal_1
[PROOF STATE]
proof (prove)
using this:
\<forall>x. l (g x) = h (l x)
galois l u
isotone g
isotone h
has_least_prefixpoint g
has_least_fixpoint h
\<lbrakk>galois ?l ?u; isotone ?g; isotone ?h; has_least_prefixpoint ?g; has_least_fixpoint ?h; ?l (?g (?u (\<mu> ?h))) \<le> ?h (?l (?u (\<mu> ?h))); ?l (?g (p\<mu> ?g)) = ?h (?l (p\<mu> ?g))\<rbrakk> \<Longrightarrow> \<mu> ?h = ?l (p\<mu> ?g) \<and> \<mu> ?h = ?l (\<mu> ?g)

goal (1 subgoal):
 1. \<mu> h = l (p\<mu> g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<mu> h = l (p\<mu> g)

goal (1 subgoal):
 1. \<mu> h = l (\<mu> g)
[PROOF STEP]
thus "\<mu> h = l (\<mu> g)"
[PROOF STATE]
proof (prove)
using this:
\<mu> h = l (p\<mu> g)

goal (1 subgoal):
 1. \<mu> h = l (\<mu> g)
[PROOF STEP]
by (simp add: assms(2,4) pmu_mu)
[PROOF STATE]
proof (state)
this:
\<mu> h = l (\<mu> g)

goal:
No subgoals!
[PROOF STEP]
qed