[STATEMENT]
lemma finite_inverse_real_of_posnat_gt_real: "0 < u \<Longrightarrow> finite {n. u < inverse (real (Suc n))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < u \<Longrightarrow> finite {n. u < inverse (real (Suc n))}
[PROOF STEP]
proof (simp only: real_of_nat_less_inverse_iff)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < u \<Longrightarrow> finite {n. real (Suc n) < inverse u}
[PROOF STEP]
have "{n. 1 + real n < inverse u} = {n. real n < inverse u - 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {n. 1 + real n < inverse u} = {n. real n < inverse u - 1}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
{n. 1 + real n < inverse u} = {n. real n < inverse u - 1}

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> finite {n. real (Suc n) < inverse u}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{n. 1 + real n < inverse u} = {n. real n < inverse u - 1}
[PROOF STEP]
show "finite {n. real (Suc n) < inverse u}"
[PROOF STATE]
proof (prove)
using this:
{n. 1 + real n < inverse u} = {n. real n < inverse u - 1}

goal (1 subgoal):
 1. finite {n. real (Suc n) < inverse u}
[PROOF STEP]
using finite_real_of_nat_less_real [of "inverse u - 1"]
[PROOF STATE]
proof (prove)
using this:
{n. 1 + real n < inverse u} = {n. real n < inverse u - 1}
finite {n. real n < inverse u - 1}

goal (1 subgoal):
 1. finite {n. real (Suc n) < inverse u}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {n. real (Suc n) < inverse u}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_sum_shift_Suc:
  shows "(\<And>k. k < (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d)
    \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>k. k < Suc 0 \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc 0) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) 0
 2. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
?k < Suc 0 \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (2 subgoals):
 1. (\<And>k. k < Suc 0 \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc 0) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) 0
 2. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?k < Suc 0 \<Longrightarrow> f ?k \<in> carrier_mat d d
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?k < Suc 0 \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d f (Suc 0) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f (Suc 0) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n
?k < Suc (Suc n) \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
have dfk: "k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n
?k < Suc (Suc n) \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k < Suc (Suc n) \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
have dsSk: "k < Suc n \<Longrightarrow> matrix_sum d (\<lambda>k. f (Suc k)) n \<in> carrier_mat d d" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < Suc n \<Longrightarrow> matrix_sum d (\<lambda>k. f (Suc k)) n \<in> carrier_mat d d
[PROOF STEP]
using matrix_sum_dim[of _ "\<lambda>k. f (Suc k)"] dfk
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < ?n \<Longrightarrow> f (Suc k) \<in> carrier_mat ?d ?d) \<Longrightarrow> matrix_sum ?d (\<lambda>k. f (Suc k)) ?n \<in> carrier_mat ?d ?d
?k < Suc (Suc n) \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. k < Suc n \<Longrightarrow> matrix_sum d (\<lambda>k. f (Suc k)) n \<in> carrier_mat d d
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
?k < Suc n \<Longrightarrow> matrix_sum d (\<lambda>k. f (Suc k)) n \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
have "matrix_sum d f (Suc (Suc n)) = f (Suc n) + matrix_sum d f (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d f (Suc (Suc n)) = f (Suc n) + matrix_sum d f (Suc n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f (Suc (Suc n)) = f (Suc n) + matrix_sum d f (Suc n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_sum d f (Suc (Suc n)) = f (Suc n) + matrix_sum d f (Suc n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
have "\<dots> = f (Suc n) + f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (Suc n) + matrix_sum d f (Suc n) = f (Suc n) + f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n
[PROOF STEP]
using Suc dsSk assoc_add_mat[of "f (Suc n)" d d "f 0"]
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n
?k < Suc (Suc n) \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> matrix_sum d (\<lambda>k. f (Suc k)) n \<in> carrier_mat d d
\<lbrakk>f (Suc n) \<in> carrier_mat d d; f 0 \<in> carrier_mat d d; ?C \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> f (Suc n) + f 0 + ?C = f (Suc n) + (f 0 + ?C)

goal (1 subgoal):
 1. f (Suc n) + matrix_sum d f (Suc n) = f (Suc n) + f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f (Suc n) + matrix_sum d f (Suc n) = f (Suc n) + f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (Suc n) + matrix_sum d f (Suc n) = f (Suc n) + f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
have "\<dots> = f 0 + (f (Suc n) + matrix_sum d (\<lambda>k. f (Suc k)) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (Suc n) + f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n = f 0 + (f (Suc n) + matrix_sum d (\<lambda>k. f (Suc k)) n)
[PROOF STEP]
apply (mat_assoc d)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. matrix_sum d (\<lambda>k. f (Suc k)) n \<in> carrier_mat d d
 2. f (Suc n) \<in> carrier_mat d d
 3. f 0 \<in> carrier_mat d d
[PROOF STEP]
using dsSk dfk
[PROOF STATE]
proof (prove)
using this:
?k < Suc n \<Longrightarrow> matrix_sum d (\<lambda>k. f (Suc k)) n \<in> carrier_mat d d
?k < Suc (Suc n) \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (3 subgoals):
 1. matrix_sum d (\<lambda>k. f (Suc k)) n \<in> carrier_mat d d
 2. f (Suc n) \<in> carrier_mat d d
 3. f 0 \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (Suc n) + f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n = f 0 + (f (Suc n) + matrix_sum d (\<lambda>k. f (Suc k)) n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (Suc n) + f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n = f 0 + (f (Suc n) + matrix_sum d (\<lambda>k. f (Suc k)) n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
have "\<dots> = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 + (f (Suc n) + matrix_sum d (\<lambda>k. f (Suc k)) n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f 0 + (f (Suc n) + matrix_sum d (\<lambda>k. f (Suc k)) n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f (Suc n) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) n; \<And>k. k < Suc (Suc n) \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)

goal (1 subgoal):
 1. matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
matrix_sum d f (Suc (Suc n)) = f 0 + matrix_sum d (\<lambda>k. f (Suc k)) (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_bounded_functions:
  assumes fS: "finite S"
  shows "finite T \<Longrightarrow> finite {f. (\<forall>i \<in> T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite T \<Longrightarrow> finite {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}
[PROOF STEP]
proof (induct T rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite {f. (\<forall>i\<in>{}. f i \<in> S) \<and> (\<forall>i. i \<notin> {} \<longrightarrow> f i = i)}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; finite {f. (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i)}\<rbrakk> \<Longrightarrow> finite {f. (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i)}
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. finite {f. (\<forall>i\<in>{}. f i \<in> S) \<and> (\<forall>i. i \<notin> {} \<longrightarrow> f i = i)}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; finite {f. (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i)}\<rbrakk> \<Longrightarrow> finite {f. (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i)}
[PROOF STEP]
have th: "{f. \<forall>i. f i = i} = {id}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f. \<forall>i. f i = i} = {id}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{f. \<forall>i. f i = i} = {id}

goal (2 subgoals):
 1. finite {f. (\<forall>i\<in>{}. f i \<in> S) \<and> (\<forall>i. i \<notin> {} \<longrightarrow> f i = i)}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; finite {f. (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i)}\<rbrakk> \<Longrightarrow> finite {f. (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i)}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {f. (\<forall>i\<in>{}. f i \<in> S) \<and> (\<forall>i. i \<notin> {} \<longrightarrow> f i = i)}
[PROOF STEP]
by (auto simp add: th)
[PROOF STATE]
proof (state)
this:
finite {f. (\<forall>i\<in>{}. f i \<in> S) \<and> (\<forall>i. i \<notin> {} \<longrightarrow> f i = i)}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; finite {f. (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i)}\<rbrakk> \<Longrightarrow> finite {f. (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i)}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; finite {f. (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i)}\<rbrakk> \<Longrightarrow> finite {f. (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i)}
[PROOF STEP]
case (insert a T)
[PROOF STATE]
proof (state)
this:
finite T
a \<notin> T
finite {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; finite {f. (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i)}\<rbrakk> \<Longrightarrow> finite {f. (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i)}
[PROOF STEP]
let ?f = "\<lambda>(y,g) i. if i = a then y else g i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; finite {f. (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i)}\<rbrakk> \<Longrightarrow> finite {f. (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i)}
[PROOF STEP]
let ?S = "?f ` (S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)})"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; finite {f. (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i)}\<rbrakk> \<Longrightarrow> finite {f. (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i)}
[PROOF STEP]
have "?S = {f. (\<forall>i\<in> insert a T. f i \<in> S) \<and> (\<forall>i. i \<notin> insert a T \<longrightarrow> f i = i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(y, g) i. if i = a then y else g i) ` (S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}) = {f. (\<forall>i\<in>insert a T. f i \<in> S) \<and> (\<forall>i. i \<notin> insert a T \<longrightarrow> f i = i)}
[PROOF STEP]
apply (auto simp add: image_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x a \<in> S; \<forall>i\<in>T. x i \<in> S; \<forall>i. i \<noteq> a \<and> i \<notin> T \<longrightarrow> x i = i\<rbrakk> \<Longrightarrow> \<exists>xa\<in>S. \<exists>y. (\<forall>i\<in>T. y i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> y i = i) \<and> x = (\<lambda>i. if i = a then xa else y i)
[PROOF STEP]
apply (rule_tac x="x a" in bexI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>x a \<in> S; \<forall>i\<in>T. x i \<in> S; \<forall>i. i \<noteq> a \<and> i \<notin> T \<longrightarrow> x i = i\<rbrakk> \<Longrightarrow> \<exists>y. (\<forall>i\<in>T. y i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> y i = i) \<and> x = (\<lambda>i. if i = a then x a else y i)
 2. \<And>x. \<lbrakk>x a \<in> S; \<forall>i\<in>T. x i \<in> S; \<forall>i. i \<noteq> a \<and> i \<notin> T \<longrightarrow> x i = i\<rbrakk> \<Longrightarrow> x a \<in> S
[PROOF STEP]
apply (rule_tac x = "\<lambda>i. if i = a then i else x i" in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>x a \<in> S; \<forall>i\<in>T. x i \<in> S; \<forall>i. i \<noteq> a \<and> i \<notin> T \<longrightarrow> x i = i\<rbrakk> \<Longrightarrow> (\<forall>i\<in>T. (if i = a then i else x i) \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> (if i = a then i else x i) = i) \<and> x = (\<lambda>i. if i = a then x a else if i = a then i else x i)
 2. \<And>x. \<lbrakk>x a \<in> S; \<forall>i\<in>T. x i \<in> S; \<forall>i. i \<noteq> a \<and> i \<notin> T \<longrightarrow> x i = i\<rbrakk> \<Longrightarrow> x a \<in> S
[PROOF STEP]
apply (insert insert, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<lambda>(y, g) i. if i = a then y else g i) ` (S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}) = {f. (\<forall>i\<in>insert a T. f i \<in> S) \<and> (\<forall>i. i \<notin> insert a T \<longrightarrow> f i = i)}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; finite {f. (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i)}\<rbrakk> \<Longrightarrow> finite {f. (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i)}
[PROOF STEP]
with finite_imageI[OF finite_cartesian_product[OF fS insert.hyps(3)], of ?f]
[PROOF STATE]
proof (chain)
picking this:
finite ((\<lambda>(y, g) i. if i = a then y else g i) ` (S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}))
(\<lambda>(y, g) i. if i = a then y else g i) ` (S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}) = {f. (\<forall>i\<in>insert a T. f i \<in> S) \<and> (\<forall>i. i \<notin> insert a T \<longrightarrow> f i = i)}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite ((\<lambda>(y, g) i. if i = a then y else g i) ` (S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}))
(\<lambda>(y, g) i. if i = a then y else g i) ` (S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}) = {f. (\<forall>i\<in>insert a T. f i \<in> S) \<and> (\<forall>i. i \<notin> insert a T \<longrightarrow> f i = i)}

goal (1 subgoal):
 1. finite {f. (\<forall>i\<in>insert a T. f i \<in> S) \<and> (\<forall>i. i \<notin> insert a T \<longrightarrow> f i = i)}
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
finite {f. (\<forall>i\<in>insert a T. f i \<in> S) \<and> (\<forall>i. i \<notin> insert a T \<longrightarrow> f i = i)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma times_le_mono [simp]: "x \<le> y \<Longrightarrow> u \<le> v \<Longrightarrow> x * u \<le> y * v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y; u \<le> v\<rbrakk> \<Longrightarrow> x * u \<le> y * v
[PROOF STEP]
apply (rule_tac y = "x * v" in order_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<le> y; u \<le> v\<rbrakk> \<Longrightarrow> x * u \<le> x * v
 2. \<lbrakk>x \<le> y; u \<le> v\<rbrakk> \<Longrightarrow> x * v \<le> y * v
[PROOF STEP]
by (simp_all add: mult_left_mono mult_right_mono)


[STATEMENT]
lemma (in Semilat) antisym_r [intro?]: "\<lbrakk> x \<sqsubseteq>\<^sub>r y; y \<sqsubseteq>\<^sub>r x \<rbrakk> \<Longrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<sqsubseteq>\<^bsub>r\<^esub> y; y \<sqsubseteq>\<^bsub>r\<^esub> x\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
by (rule order_antisym) auto


[STATEMENT]
lemma drop_bit_Suc:
  "drop_bit (Suc n) a = drop_bit n (a div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop_bit (Suc n) a = drop_bit n (a div (2::'a))
[PROOF STEP]
using div_exp_eq [of a 1]
[PROOF STATE]
proof (prove)
using this:
a div (2::'a) ^ 1 div (2::'a) ^ ?n = a div (2::'a) ^ (1 + ?n)

goal (1 subgoal):
 1. drop_bit (Suc n) a = drop_bit n (a div (2::'a))
[PROOF STEP]
by (simp add: drop_bit_eq_div)


[STATEMENT]
lemma convex_imp_starlike:
  "convex S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> starlike S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>convex S; S \<noteq> {}\<rbrakk> \<Longrightarrow> starlike S
[PROOF STEP]
unfolding convex_contains_segment starlike_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a\<in>S. \<forall>b\<in>S. closed_segment a b \<subseteq> S; S \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>a\<in>S. \<forall>x\<in>S. closed_segment a x \<subseteq> S
[PROOF STEP]
by auto


[STATEMENT]
lemma pos_mean: "pos xs \<Longrightarrow> mean xs > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pos xs \<Longrightarrow> 0 < mean xs
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pos [] \<Longrightarrow> 0 < mean []
 2. \<And>a xs. \<lbrakk>pos xs \<Longrightarrow> 0 < mean xs; pos (a # xs)\<rbrakk> \<Longrightarrow> 0 < mean (a # xs)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
pos []

goal (2 subgoals):
 1. pos [] \<Longrightarrow> 0 < mean []
 2. \<And>a xs. \<lbrakk>pos xs \<Longrightarrow> 0 < mean xs; pos (a # xs)\<rbrakk> \<Longrightarrow> 0 < mean (a # xs)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
pos []

goal (1 subgoal):
 1. 0 < mean []
[PROOF STEP]
by(simp add: pos_def)
[PROOF STATE]
proof (state)
this:
0 < mean []

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>pos xs \<Longrightarrow> 0 < mean xs; pos (a # xs)\<rbrakk> \<Longrightarrow> 0 < mean (a # xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>pos xs \<Longrightarrow> 0 < mean xs; pos (a # xs)\<rbrakk> \<Longrightarrow> 0 < mean (a # xs)
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
pos xs \<Longrightarrow> 0 < mean xs
pos (x # xs)

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>pos xs \<Longrightarrow> 0 < mean xs; pos (a # xs)\<rbrakk> \<Longrightarrow> 0 < mean (a # xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < mean (x # xs)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
assume xse: "xs = []"
[PROOF STATE]
proof (state)
this:
xs = []

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
hence "pos (x#xs) = (x > 0)"
[PROOF STATE]
proof (prove)
using this:
xs = []

goal (1 subgoal):
 1. pos (x # xs) = (0 < x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pos (x # xs) = (0 < x)

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
with Cons(2)
[PROOF STATE]
proof (chain)
picking this:
pos (x # xs)
pos (x # xs) = (0 < x)
[PROOF STEP]
have "x>0"
[PROOF STATE]
proof (prove)
using this:
pos (x # xs)
pos (x # xs) = (0 < x)

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

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
with xse
[PROOF STATE]
proof (chain)
picking this:
xs = []
0 < x
[PROOF STEP]
have "0 < mean (x#xs)"
[PROOF STATE]
proof (prove)
using this:
xs = []
0 < x

goal (1 subgoal):
 1. 0 < mean (x # xs)
[PROOF STEP]
by(auto simp:mean_def)
[PROOF STATE]
proof (state)
this:
0 < mean (x # xs)

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < mean (x # xs)

goal (1 subgoal):
 1. 0 < mean (x # xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < mean (x # xs)

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
assume xsne: "xs \<noteq> []"
[PROOF STATE]
proof (state)
this:
xs \<noteq> []

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < mean (x # xs)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
assume pxs: "pos xs"
[PROOF STATE]
proof (state)
this:
pos xs

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
with Cons(1)
[PROOF STATE]
proof (chain)
picking this:
pos xs \<Longrightarrow> 0 < mean xs
pos xs
[PROOF STEP]
have z_le_mxs: "0 < mean xs"
[PROOF STATE]
proof (prove)
using this:
pos xs \<Longrightarrow> 0 < mean xs
pos xs

goal (1 subgoal):
 1. 0 < mean xs
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
0 < mean xs

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
0 < mean xs

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
assume ass: "x > 0"
[PROOF STATE]
proof (state)
this:
0 < x

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
with ass z_le_mxs xsne
[PROOF STATE]
proof (chain)
picking this:
0 < x
0 < mean xs
xs \<noteq> []
0 < x
[PROOF STEP]
have "0 < mean (x#xs)"
[PROOF STATE]
proof (prove)
using this:
0 < x
0 < mean xs
xs \<noteq> []
0 < x

goal (1 subgoal):
 1. 0 < mean (x # xs)
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < mean xs; xs \<noteq> []; 0 < x\<rbrakk> \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
apply (rule mean_gt_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < mean xs; xs \<noteq> []; 0 < x\<rbrakk> \<Longrightarrow> xs \<noteq> [] \<and> 0 < x \<and> 0 < mean xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < mean (x # xs)

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 < x \<Longrightarrow> 0 < mean (x # xs)

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < x \<Longrightarrow> 0 < mean (x # xs)

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
0 < x \<Longrightarrow> 0 < mean (x # xs)

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
from xsne pxs
[PROOF STATE]
proof (chain)
picking this:
xs \<noteq> []
pos xs
[PROOF STEP]
have "0 < x"
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
pos xs

goal (1 subgoal):
 1. 0 < x
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>xs \<noteq> []; pos xs; ?P2\<rbrakk> \<Longrightarrow> 0 < x
 2. \<lbrakk>xs \<noteq> []; pos xs; \<not> ?P2\<rbrakk> \<Longrightarrow> 0 < x
[PROOF STEP]
assume "0 < x"
[PROOF STATE]
proof (state)
this:
0 < x

goal (2 subgoals):
 1. \<lbrakk>xs \<noteq> []; pos xs; ?P2\<rbrakk> \<Longrightarrow> 0 < x
 2. \<lbrakk>xs \<noteq> []; pos xs; \<not> ?P2\<rbrakk> \<Longrightarrow> 0 < x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < x

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

goal (1 subgoal):
 1. \<lbrakk>xs \<noteq> []; pos xs; \<not> 0 < x\<rbrakk> \<Longrightarrow> 0 < x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>xs \<noteq> []; pos xs; \<not> 0 < x\<rbrakk> \<Longrightarrow> 0 < x
[PROOF STEP]
assume "\<not>(0 < x)"
[PROOF STATE]
proof (state)
this:
\<not> 0 < x

goal (1 subgoal):
 1. \<lbrakk>xs \<noteq> []; pos xs; \<not> 0 < x\<rbrakk> \<Longrightarrow> 0 < x
[PROOF STEP]
with xsne pos_cons
[PROOF STATE]
proof (chain)
picking this:
xs \<noteq> []
?xs \<noteq> [] \<longrightarrow> pos (?x # ?xs) = (if 0 < ?x then pos ?xs else False)
\<not> 0 < x
[PROOF STEP]
have "pos (x#xs) = False"
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
?xs \<noteq> [] \<longrightarrow> pos (?x # ?xs) = (if 0 < ?x then pos ?xs else False)
\<not> 0 < x

goal (1 subgoal):
 1. pos (x # xs) = False
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pos (x # xs) = False

goal (1 subgoal):
 1. \<lbrakk>xs \<noteq> []; pos xs; \<not> 0 < x\<rbrakk> \<Longrightarrow> 0 < x
[PROOF STEP]
with Cons(2)
[PROOF STATE]
proof (chain)
picking this:
pos (x # xs)
pos (x # xs) = False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pos (x # xs)
pos (x # xs) = False

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < x

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 < x

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < x \<Longrightarrow> 0 < mean (x # xs)
0 < x
[PROOF STEP]
have "0 < mean (x#xs)"
[PROOF STATE]
proof (prove)
using this:
0 < x \<Longrightarrow> 0 < mean (x # xs)
0 < x

goal (1 subgoal):
 1. 0 < mean (x # xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < mean (x # xs)

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < mean (x # xs)
 2. \<not> ?P \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < mean (x # xs)

goal (1 subgoal):
 1. 0 < mean (x # xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < mean (x # xs)

goal (1 subgoal):
 1. \<not> pos xs \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> pos xs \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
assume npxs: "\<not>pos xs"
[PROOF STATE]
proof (state)
this:
\<not> pos xs

goal (1 subgoal):
 1. \<not> pos xs \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
with xsne pos_cons
[PROOF STATE]
proof (chain)
picking this:
xs \<noteq> []
?xs \<noteq> [] \<longrightarrow> pos (?x # ?xs) = (if 0 < ?x then pos ?xs else False)
\<not> pos xs
[PROOF STEP]
have "pos (x#xs) = False"
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
?xs \<noteq> [] \<longrightarrow> pos (?x # ?xs) = (if 0 < ?x then pos ?xs else False)
\<not> pos xs

goal (1 subgoal):
 1. pos (x # xs) = False
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pos (x # xs) = False

goal (1 subgoal):
 1. \<not> pos xs \<Longrightarrow> 0 < mean (x # xs)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
pos (x # xs) = False

goal (1 subgoal):
 1. 0 < mean (x # xs)
[PROOF STEP]
using Cons(2)
[PROOF STATE]
proof (prove)
using this:
pos (x # xs) = False
pos (x # xs)

goal (1 subgoal):
 1. 0 < mean (x # xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < mean (x # xs)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < mean (x # xs)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < mean (x # xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma frontier_subset_compact:
  fixes S :: "'a::heine_borel set"
  shows "compact S \<Longrightarrow> frontier S \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact S \<Longrightarrow> frontier S \<subseteq> S
[PROOF STEP]
using frontier_subset_closed compact_eq_bounded_closed
[PROOF STATE]
proof (prove)
using this:
closed ?S \<Longrightarrow> frontier ?S \<subseteq> ?S
compact ?S = (bounded ?S \<and> closed ?S)

goal (1 subgoal):
 1. compact S \<Longrightarrow> frontier S \<subseteq> S
[PROOF STEP]
by blast


[STATEMENT]
lemma Equiv_Exec_stable_setI: "
  \<lbrakk> Equiv_Exec_stable_set A
    equiv_states localState1 localState2 input_fun1 input_fun2 output_fun1 output_fun2
    trans_fun1 trans_fun2 k1 k2 c1 c2;
    set input \<subseteq> A; m \<in> A \<rbrakk> \<Longrightarrow>
  Equiv_Exec
        m equiv_states
        localState1 localState2 input_fun1 input_fun2 output_fun1 output_fun2
        trans_fun1 trans_fun2 k1 k2
        (f_Exec_Comp trans_fun1 (map input_fun1 input \<odot>\<^sub>f k1) c1)
        (f_Exec_Comp trans_fun2 (map input_fun2 input \<odot>\<^sub>f k2) c2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Equiv_Exec_stable_set A equiv_states localState1 localState2 input_fun1 input_fun2 output_fun1 output_fun2 trans_fun1 trans_fun2 k1 k2 c1 c2; set input \<subseteq> A; m \<in> A\<rbrakk> \<Longrightarrow> Equiv_Exec m equiv_states localState1 localState2 input_fun1 input_fun2 output_fun1 output_fun2 trans_fun1 trans_fun2 k1 k2 (f_Exec_Comp trans_fun1 (map input_fun1 input \<odot> k1) c1) (f_Exec_Comp trans_fun2 (map input_fun2 input \<odot> k2) c2)
[PROOF STEP]
by (simp add: Equiv_Exec_stable_set_def)


[STATEMENT]
lemma "map (of_nat \<circ> nat) [1 .. 4] = ([1, 2, 3, 4]:: 32 word list)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (word_of_nat \<circ> nat) [1..4] = [1, 2, 3, 4]
[PROOF STEP]
by eval


[STATEMENT]
lemma set_least_squares_approximation_unique_solution_QR:
  fixes A::"real^'cols::{mod_type}^'rows::{mod_type}"
  assumes r: "rank A = ncols A"
  shows "(set_least_squares_approximation A b) = {matrix_inv (snd (QR_decomposition A)) ** transpose (fst (QR_decomposition A)) *v b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_least_squares_approximation A b = {matrix_inv (snd (QR_decomposition A)) ** Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) *v b}
[PROOF STEP]
by (metis (opaque_lifting, mono_tags) empty_iff in_set_least_squares_approximation_eq_full_rank_QR2 insertI1 r subsetI subset_singletonD)


[STATEMENT]
lemma Janiszewski_connected:
  fixes S :: "complex set"
  assumes ST: "compact S" "closed T" "connected(S \<inter> T)"
      and notST: "connected (- S)" "connected (- T)"
    shows "connected(- (S \<union> T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected (- (S \<union> T))
[PROOF STEP]
using Janiszewski [OF ST]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>connected_component (- S) ?a ?b; connected_component (- T) ?a ?b\<rbrakk> \<Longrightarrow> connected_component (- (S \<union> T)) ?a ?b

goal (1 subgoal):
 1. connected (- (S \<union> T))
[PROOF STEP]
by (metis IntD1 IntD2 notST compl_sup connected_iff_connected_component)


[STATEMENT]
lemma fps_compose_Lambert_W: "fps_compose fps_Lambert_W (fps_X * fps_exp 1) = fps_X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_Lambert_W oo fps_X * fps_exp 1 = fps_X
[PROOF STEP]
unfolding fps_Lambert_W_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_inv (fps_X * fps_exp 1) oo fps_X * fps_exp 1 = fps_X
[PROOF STEP]
by (rule fps_inv) auto


[STATEMENT]
lemma quadratic_linear3:
  assumes "b\<noteq>0"
  assumes "a \<noteq> 0"
  assumes "4 * a * ba \<le> aa\<^sup>2"
  assumes "(b::real) * (- (aa::real)- sqrt ((aa::real)\<^sup>2 - 4 * (a::real) * (ba::real)) ) / (2 * a) + (c::real) = 0"
  assumes "(\<forall>x\<in>set (les::(real*real*real)list).
          case x of
          (d, e, f) \<Rightarrow>
            d * ((- aa - sqrt (aa\<^sup>2 - 4 * a * ba)) / (2 * a))\<^sup>2 +
            e * (- aa - sqrt (aa\<^sup>2 - 4 * a * ba)) / (2 * a) +
            f
            < 0)"
  assumes "(aaa, aaaa, baa) \<in> set les"
  shows "aaa * (c / b)\<^sup>2 - aaaa * c / b + baa < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aaa * (c / b)\<^sup>2 - aaaa * c / b + baa < 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aaa * (c / b)\<^sup>2 - aaaa * c / b + baa < 0
[PROOF STEP]
have h:  "-((c::real)/(b::real)) = (- (aa::real) -sqrt (aa\<^sup>2 - 4 * (a::real) * (ba::real))) / (2 * a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (c / b) = (- aa - sqrt (aa\<^sup>2 - 4 * a * ba)) / (2 * a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
b \<noteq> 0
a \<noteq> 0
4 * a * ba \<le> aa\<^sup>2
b * (- aa - sqrt (aa\<^sup>2 - 4 * a * ba)) / (2 * a) + c = 0
\<forall>x\<in>set les. case x of (d, e, f) \<Rightarrow> d * ((- aa - sqrt (aa\<^sup>2 - 4 * a * ba)) / (2 * a))\<^sup>2 + e * (- aa - sqrt (aa\<^sup>2 - 4 * a * ba)) / (2 * a) + f < 0
(aaa, aaaa, baa) \<in> set les

goal (1 subgoal):
 1. - (c / b) = (- aa - sqrt (aa\<^sup>2 - 4 * a * ba)) / (2 * a)
[PROOF STEP]
by (smt divide_minus_left nonzero_mult_div_cancel_left times_divide_eq_right)
[PROOF STATE]
proof (state)
this:
- (c / b) = (- aa - sqrt (aa\<^sup>2 - 4 * a * ba)) / (2 * a)

goal (1 subgoal):
 1. aaa * (c / b)\<^sup>2 - aaaa * c / b + baa < 0
[PROOF STEP]
have h1 : "\<forall>x\<in>set les. case x of (d, e, f) \<Rightarrow> d * (c / b)\<^sup>2 + e * - (c / b) + f < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set les. case x of (d, e, f) \<Rightarrow> d * (c / b)\<^sup>2 + e * - (c / b) + f < 0
[PROOF STEP]
using assms(5)
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set les. case x of (d, e, f) \<Rightarrow> d * ((- aa - sqrt (aa\<^sup>2 - 4 * a * ba)) / (2 * a))\<^sup>2 + e * (- aa - sqrt (aa\<^sup>2 - 4 * a * ba)) / (2 * a) + f < 0

goal (1 subgoal):
 1. \<forall>x\<in>set les. case x of (d, e, f) \<Rightarrow> d * (c / b)\<^sup>2 + e * - (c / b) + f < 0
[PROOF STEP]
unfolding h[symmetric] Fields.division_ring_class.times_divide_eq_right[symmetric]
      Power.ring_1_class.power2_minus
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set les. case x of (d, e, f) \<Rightarrow> d * (c / b)\<^sup>2 + e * - (c / b) + f < 0

goal (1 subgoal):
 1. \<forall>x\<in>set les. case x of (d, e, f) \<Rightarrow> d * (c / b)\<^sup>2 + e * - (c / b) + f < 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set les. case x of (d, e, f) \<Rightarrow> d * (c / b)\<^sup>2 + e * - (c / b) + f < 0

goal (1 subgoal):
 1. aaa * (c / b)\<^sup>2 - aaaa * c / b + baa < 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aaa * (c / b)\<^sup>2 - aaaa * c / b + baa < 0
[PROOF STEP]
using bspec[OF h1 assms(6)]
[PROOF STATE]
proof (prove)
using this:
case (aaa, aaaa, baa) of (d, e, f) \<Rightarrow> d * (c / b)\<^sup>2 + e * - (c / b) + f < 0

goal (1 subgoal):
 1. aaa * (c / b)\<^sup>2 - aaaa * c / b + baa < 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
aaa * (c / b)\<^sup>2 - aaaa * c / b + baa < 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem "infinite {p::nat. prime p}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite {p. prime p}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {p. prime p} \<Longrightarrow> False
[PROOF STEP]
assume fin: "finite {p::nat. prime p}"
[PROOF STATE]
proof (state)
this:
finite {p. prime p}

goal (1 subgoal):
 1. finite {p. prime p} \<Longrightarrow> False
[PROOF STEP]
define A where "A = (\<Union>p\<in>{p::nat. prime p}. arith_prog_fb 0 p)"
[PROOF STATE]
proof (state)
this:
A = \<Union> (arith_prog_fb 0 ` {p. prime p})

goal (1 subgoal):
 1. finite {p. prime p} \<Longrightarrow> False
[PROOF STEP]
have "closed A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed A
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (\<Union> (arith_prog_fb 0 ` Collect prime))
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
finite {p. prime p}

goal (1 subgoal):
 1. closed (\<Union> (arith_prog_fb 0 ` Collect prime))
[PROOF STEP]
by (intro closed_Union) (auto simp: prime_gt_0_nat)
[PROOF STATE]
proof (state)
this:
closed A

goal (1 subgoal):
 1. finite {p. prime p} \<Longrightarrow> False
[PROOF STEP]
hence "open (-A)"
[PROOF STATE]
proof (prove)
using this:
closed A

goal (1 subgoal):
 1. open (- A)
[PROOF STEP]
by (simp add: closed_def)
[PROOF STATE]
proof (state)
this:
open (- A)

goal (1 subgoal):
 1. finite {p. prime p} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
open (- A)

goal (1 subgoal):
 1. finite {p. prime p} \<Longrightarrow> False
[PROOF STEP]
have "A = -{fbint 1, fbint (-1)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = - {fbint 1, fbint (- 1)}
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (arith_prog_fb 0 ` Collect prime) = - {fbint 1, fbint (- 1)}
[PROOF STEP]
proof transfer
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Union> (arith_prog 0 ` Collect prime) = - {1, - 1}
[PROOF STEP]
show "(\<Union>p\<in>{p::nat. prime p}. arith_prog 0 p) = - {1, - 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (arith_prog 0 ` {p. prime p}) = - {1, - 1}
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> \<Union> (arith_prog 0 ` {p. prime p}) \<Longrightarrow> x \<in> - {1, - 1}
 2. \<And>x. x \<in> - {1, - 1} \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
fix x :: int
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> \<Union> (arith_prog 0 ` {p. prime p}) \<Longrightarrow> x \<in> - {1, - 1}
 2. \<And>x. x \<in> - {1, - 1} \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
assume x: "x \<in> -{1, -1}"
[PROOF STATE]
proof (state)
this:
x \<in> - {1, - 1}

goal (2 subgoals):
 1. \<And>x. x \<in> \<Union> (arith_prog 0 ` {p. prime p}) \<Longrightarrow> x \<in> - {1, - 1}
 2. \<And>x. x \<in> - {1, - 1} \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
hence "\<bar>x\<bar> \<noteq> 1"
[PROOF STATE]
proof (prove)
using this:
x \<in> - {1, - 1}

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

goal (2 subgoals):
 1. \<And>x. x \<in> \<Union> (arith_prog 0 ` {p. prime p}) \<Longrightarrow> x \<in> - {1, - 1}
 2. \<And>x. x \<in> - {1, - 1} \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
show "x \<in> (\<Union>p\<in>{p::nat. prime p}. arith_prog 0 p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
proof (cases "x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 0 \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
 2. x \<noteq> 0 \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = 0

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
 2. x \<noteq> 0 \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x = 0

goal (1 subgoal):
 1. x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
by (auto simp: A_def intro!: exI[of _ 2])
[PROOF STATE]
proof (state)
this:
x \<in> \<Union> (arith_prog 0 ` {p. prime p})

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
obtain p where p: "prime p" "p dvd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; p dvd x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using prime_divisor_exists[of x] and \<open>\<bar>x\<bar> \<noteq> 1\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<noteq> 0; \<not> is_unit x\<rbrakk> \<Longrightarrow> \<exists>b. b dvd x \<and> prime b
\<bar>x\<bar> \<noteq> 1

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; p dvd x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime p
p dvd x

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
hence "x \<in> arith_prog 0 (nat p)"
[PROOF STATE]
proof (prove)
using this:
prime p
p dvd x

goal (1 subgoal):
 1. x \<in> arith_prog 0 (nat p)
[PROOF STEP]
using prime_gt_0_int[of p]
[PROOF STATE]
proof (prove)
using this:
prime p
p dvd x
prime p \<Longrightarrow> 0 < p

goal (1 subgoal):
 1. x \<in> arith_prog 0 (nat p)
[PROOF STEP]
by (auto simp: arith_prog_def cong_0_iff)
[PROOF STATE]
proof (state)
this:
x \<in> arith_prog 0 (nat p)

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> arith_prog 0 (nat p)

goal (1 subgoal):
 1. x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
x \<in> arith_prog 0 (nat p)
prime p
p dvd x

goal (1 subgoal):
 1. x \<in> \<Union> (arith_prog 0 ` {p. prime p})
[PROOF STEP]
by (auto simp: A_def intro!: exI[of _ "nat p"])
[PROOF STATE]
proof (state)
this:
x \<in> \<Union> (arith_prog 0 ` {p. prime p})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<in> \<Union> (arith_prog 0 ` {p. prime p})

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> (arith_prog 0 ` {p. prime p}) \<Longrightarrow> x \<in> - {1, - 1}
[PROOF STEP]
qed (auto simp: A_def arith_prog_def cong_0_iff)
[PROOF STATE]
proof (state)
this:
\<Union> (arith_prog 0 ` {p. prime p}) = - {1, - 1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
A = - {fbint 1, fbint (- 1)}

goal (1 subgoal):
 1. finite {p. prime p} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A = - {fbint 1, fbint (- 1)}

goal (1 subgoal):
 1. finite {p. prime p} \<Longrightarrow> False
[PROOF STEP]
have "-(-{fbint 1, fbint (-1)}) = {fbint 1, fbint (-1)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (- {fbint 1, fbint (- 1)}) = {fbint 1, fbint (- 1)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- (- {fbint 1, fbint (- 1)}) = {fbint 1, fbint (- 1)}

goal (1 subgoal):
 1. finite {p. prime p} \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
open {fbint 1, fbint (- 1)}
[PROOF STEP]
have "open {fbint 1, fbint (-1)}"
[PROOF STATE]
proof (prove)
using this:
open {fbint 1, fbint (- 1)}

goal (1 subgoal):
 1. open {fbint 1, fbint (- 1)}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
open {fbint 1, fbint (- 1)}

goal (1 subgoal):
 1. finite {p. prime p} \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
open {fbint 1, fbint (- 1)}

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inj_on_subgroup_iff_trivial_ker:
  assumes "subgroup H (add_monoid R)"
  shows "inj_on h H \<longleftrightarrow> a_kernel (R \<lparr> carrier := H \<rparr>) S h = { \<zero> }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on h H = (a_kernel (R\<lparr>carrier := H\<rparr>) S h = {\<zero>})
[PROOF STEP]
using group_hom.inj_on_subgroup_iff_trivial_ker[OF a_group_hom assms]
[PROOF STATE]
proof (prove)
using this:
inj_on h H = (kernel (add_monoid R\<lparr>carrier := H\<rparr>) (add_monoid S) h = {\<one>\<^bsub>add_monoid R\<^esub>})

goal (1 subgoal):
 1. inj_on h H = (a_kernel (R\<lparr>carrier := H\<rparr>) S h = {\<zero>})
[PROOF STEP]
unfolding a_kernel_def[of "R \<lparr> carrier := H \<rparr>" S h]
[PROOF STATE]
proof (prove)
using this:
inj_on h H = (kernel (add_monoid R\<lparr>carrier := H\<rparr>) (add_monoid S) h = {\<one>\<^bsub>add_monoid R\<^esub>})

goal (1 subgoal):
 1. inj_on h H = (kernel (add_monoid (R\<lparr>carrier := H\<rparr>)) (add_monoid S) h = {\<zero>})
[PROOF STEP]
by simp


[STATEMENT]
lemma Card_order_lists_infinite:
assumes "Card_order r" and "\<not>finite(Field r)"
shows "|lists(Field r)| =o r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |lists (Field r)| =o r
[PROOF STEP]
using assms card_of_lists_infinite card_of_Field_ordIso ordIso_transitive
[PROOF STATE]
proof (prove)
using this:
Card_order r
infinite (Field r)
infinite ?A \<Longrightarrow> |lists ?A| =o |?A|
Card_order ?r \<Longrightarrow> |Field ?r| =o ?r
\<lbrakk>?r =o ?r'; ?r' =o ?r''\<rbrakk> \<Longrightarrow> ?r =o ?r''

goal (1 subgoal):
 1. |lists (Field r)| =o r
[PROOF STEP]
by blast


[STATEMENT]
lemma UNIV_nat_eq: "UNIV = insert 0 (range Suc)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = insert 0 (range Suc)
[PROOF STEP]
by (metis UNIV_eq_I nat.nchotomy insertCI rangeI)


[STATEMENT]
lemma frechet_tendsto_vec_lambda:
  fixes f::"real \<Rightarrow> ('a::banach)^('m::finite)" and x::real and T::"real set"
  defines "x\<^sub>0 \<equiv> netlimit (at x within T)" and "m \<equiv> real CARD('m)"
  assumes "\<forall>i. ((\<lambda>y. (f y $ i - f x\<^sub>0 $ i - (y - x\<^sub>0) *\<^sub>R f' x $ i) /\<^sub>R (\<parallel>y - x\<^sub>0\<parallel>)) \<longlongrightarrow> 0) (at x within T)"
  shows "((\<lambda>y. (f y - f x\<^sub>0 - (y - x\<^sub>0) *\<^sub>R f' x) /\<^sub>R (\<parallel>y - x\<^sub>0\<parallel>)) \<longlongrightarrow> 0) (at x within T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>y. (f y - f x\<^sub>0 - (y - x\<^sub>0) *\<^sub>R f' x) /\<^sub>R \<parallel>y - x\<^sub>0\<parallel>) \<longlongrightarrow> 0) (at x within T)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x\<^sub>0 \<equiv> netlimit (at x within T)
m \<equiv> real CARD('m)
\<forall>i. ((\<lambda>y. (f y $ i - f x\<^sub>0 $ i - (y - x\<^sub>0) *\<^sub>R f' x $ i) /\<^sub>R \<parallel>y - x\<^sub>0\<parallel>) \<longlongrightarrow> (0::'a)) (at x within T)

goal (1 subgoal):
 1. ((\<lambda>y. (f y - f x\<^sub>0 - (y - x\<^sub>0) *\<^sub>R f' x) /\<^sub>R \<parallel>y - x\<^sub>0\<parallel>) \<longlongrightarrow> 0) (at x within T)
[PROOF STEP]
by (simp add: tendsto_nth_iff)


[STATEMENT]
lemma  (in rfr_disc_equity_market) self_finance_risk_free_update_ind:
  assumes "portfolio pf"
  shows "cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w +
    (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)
[PROOF STEP]
have "cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w =
    cls_val_process Mkt pf (Suc n) w +
    (prices Mkt risk_free_asset (Suc n) w / (prices Mkt risk_free_asset n w)) *
      (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w -
     val_process Mkt pf n w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w + prices Mkt risk_free_asset (Suc n) w / prices Mkt risk_free_asset n w * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)
[PROOF STEP]
proof (rule self_finance_updated_ind, (simp add: assms), intro allI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n w. prices Mkt risk_free_asset n w \<noteq> 0
[PROOF STEP]
fix n w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n w. prices Mkt risk_free_asset n w \<noteq> 0
[PROOF STEP]
show "prices Mkt risk_free_asset n w \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prices Mkt risk_free_asset n w \<noteq> 0
[PROOF STEP]
using positive
[PROOF STATE]
proof (prove)
using this:
\<forall>n w. 0 < prices Mkt risk_free_asset n w

goal (1 subgoal):
 1. prices Mkt risk_free_asset n w \<noteq> 0
[PROOF STEP]
by (metis less_irrefl)
[PROOF STATE]
proof (state)
this:
prices Mkt risk_free_asset n w \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w + prices Mkt risk_free_asset (Suc n) w / prices Mkt risk_free_asset n w * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)

goal (1 subgoal):
 1. cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w + prices Mkt risk_free_asset (Suc n) w / prices Mkt risk_free_asset n w * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)

goal (1 subgoal):
 1. cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)
[PROOF STEP]
have "... = cls_val_process Mkt pf (Suc n) w +
    (1+r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w -
     val_process Mkt pf n w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cls_val_process Mkt pf (Suc n) w + prices Mkt risk_free_asset (Suc n) w / prices Mkt risk_free_asset n w * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w) = cls_val_process Mkt pf (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)
[PROOF STEP]
using rf_price  positive
[PROOF STATE]
proof (prove)
using this:
prices Mkt risk_free_asset = disc_rfr_proc r
\<forall>n w. 0 < prices Mkt risk_free_asset n w

goal (1 subgoal):
 1. cls_val_process Mkt pf (Suc n) w + prices Mkt risk_free_asset (Suc n) w / prices Mkt risk_free_asset n w * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w) = cls_val_process Mkt pf (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)
[PROOF STEP]
by (metis acceptable_rate disc_rfr_proc_Suc_div)
[PROOF STATE]
proof (state)
this:
cls_val_process Mkt pf (Suc n) w + prices Mkt risk_free_asset (Suc n) w / prices Mkt risk_free_asset n w * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w) = cls_val_process Mkt pf (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)

goal (1 subgoal):
 1. cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)

goal (1 subgoal):
 1. cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cls_val_process Mkt (self_finance Mkt v pf risk_free_asset) (Suc n) w = cls_val_process Mkt pf (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt v pf risk_free_asset) n w - val_process Mkt pf n w)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hypext_sqrt_Hyperdual_Hyperdual:
  assumes "a > 0"
  shows "(*h* sqrt) (Hyperdual a b c d) =
         Hyperdual (sqrt a) (b * inverse (sqrt a) / 2) (c * inverse (sqrt a) / 2)
           (d * inverse (sqrt a) / 2 - b * c * inverse (sqrt a ^ 3) / 4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*h* sqrt) (Hyperdual a b c d) = Hyperdual (sqrt a) (b * inverse (sqrt a) / 2) (c * inverse (sqrt a) / 2) (d * inverse (sqrt a) / 2 - b * c * inverse (sqrt a ^ 3) / 4)
[PROOF STEP]
by (simp add: assms hypext_Hyperdual_eq)


[STATEMENT]
lemma "\<exists>y. \<forall>x::'a::linordered_field. \<exists>z w.
  min (5 * x + 3 * z) (17 * w) + 5 * \<bar>y - 8 * x + z\<bar> \<le> max y (7 * z - x + w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y. \<forall>x. \<exists>z w. min ((5::'a) * x + (3::'a) * z) ((17::'a) * w) + (5::'a) * \<bar>y - (8::'a) * x + z\<bar> \<le> max y ((7::'a) * z - x + w)
[PROOF STEP]
by ferrack


[STATEMENT]
lemma nat_le_omega [simp]: "ordinal_of_nat n \<le> \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinal_of_nat n \<le> \<omega>
[PROOF STEP]
by (unfold omega_def, rule le_oLimit)


[STATEMENT]
lemma ex_norm_eq_1: "\<exists>x. norm (x::'a::{real_normed_vector, perfect_space}) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. norm x = 1
[PROOF STEP]
by (metis vector_choose_size zero_le_one)


[STATEMENT]
lemma finite_sorted_distinct_unique:
  assumes "finite A" shows "\<exists>!xs. set xs = A \<and> sorted xs \<and> distinct xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!xs. set xs = A \<and> sorted xs \<and> distinct xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>!xs. set xs = A \<and> sorted xs \<and> distinct xs
[PROOF STEP]
obtain xs where "distinct xs" "A = set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>distinct xs; A = set xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using finite_distinct_list [OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>xs. set xs = A \<and> distinct xs

goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>distinct xs; A = set xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
distinct xs
A = set xs

goal (1 subgoal):
 1. \<exists>!xs. set xs = A \<and> sorted xs \<and> distinct xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distinct xs
A = set xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
distinct xs
A = set xs

goal (1 subgoal):
 1. \<exists>!xs. set xs = A \<and> sorted xs \<and> distinct xs
[PROOF STEP]
by (rule_tac a="sort xs" in ex1I) (auto simp: sorted_distinct_set_unique)
[PROOF STATE]
proof (state)
this:
\<exists>!xs. set xs = A \<and> sorted xs \<and> distinct xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hf_induct_ax: "\<lbrakk>P 0; \<forall>x. P x \<longrightarrow> (\<forall>y. P y \<longrightarrow> P (x \<triangleleft> y))\<rbrakk> \<Longrightarrow> P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P 0; \<forall>x. P x \<longrightarrow> (\<forall>y. P y \<longrightarrow> P (x \<triangleleft> y))\<rbrakk> \<Longrightarrow> P x
[PROOF STEP]
by (induct x, auto)


[STATEMENT]
theorem Cauchy_theorem_global:
    assumes S: "open S" and holf: "f holomorphic_on S"
        and vpg: "valid_path \<gamma>" and loop: "pathfinish \<gamma> = pathstart \<gamma>"
        and pas: "path_image \<gamma> \<subseteq> S"
        and zero: "\<And>w. w \<notin> S \<Longrightarrow> winding_number \<gamma> w = 0"
      shows "(f has_contour_integral 0) \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_contour_integral 0) \<gamma>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f has_contour_integral 0) \<gamma>
[PROOF STEP]
obtain z where "z \<in> S" and znot: "z \<notin> path_image \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> S; z \<notin> path_image \<gamma>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> S; z \<notin> path_image \<gamma>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "compact (path_image \<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (path_image \<gamma>)
[PROOF STEP]
using compact_valid_path_image vpg
[PROOF STATE]
proof (prove)
using this:
valid_path ?g \<Longrightarrow> compact (path_image ?g)
valid_path \<gamma>

goal (1 subgoal):
 1. compact (path_image \<gamma>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
compact (path_image \<gamma>)

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> S; z \<notin> path_image \<gamma>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
compact (path_image \<gamma>)
[PROOF STEP]
have "path_image \<gamma> \<noteq> S"
[PROOF STATE]
proof (prove)
using this:
compact (path_image \<gamma>)

goal (1 subgoal):
 1. path_image \<gamma> \<noteq> S
[PROOF STEP]
by (metis (no_types) compact_open path_image_nonempty S)
[PROOF STATE]
proof (state)
this:
path_image \<gamma> \<noteq> S

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> S; z \<notin> path_image \<gamma>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with pas
[PROOF STATE]
proof (chain)
picking this:
path_image \<gamma> \<subseteq> S
path_image \<gamma> \<noteq> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
path_image \<gamma> \<subseteq> S
path_image \<gamma> \<noteq> S

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (blast intro: that)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
z \<in> S
z \<notin> path_image \<gamma>

goal (1 subgoal):
 1. (f has_contour_integral 0) \<gamma>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> S
z \<notin> path_image \<gamma>
[PROOF STEP]
have pasz: "path_image \<gamma> \<subseteq> S - {z}"
[PROOF STATE]
proof (prove)
using this:
z \<in> S
z \<notin> path_image \<gamma>

goal (1 subgoal):
 1. path_image \<gamma> \<subseteq> S - {z}
[PROOF STEP]
using pas
[PROOF STATE]
proof (prove)
using this:
z \<in> S
z \<notin> path_image \<gamma>
path_image \<gamma> \<subseteq> S

goal (1 subgoal):
 1. path_image \<gamma> \<subseteq> S - {z}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
path_image \<gamma> \<subseteq> S - {z}

goal (1 subgoal):
 1. (f has_contour_integral 0) \<gamma>
[PROOF STEP]
have hol: "(\<lambda>w. (w - z) * f w) holomorphic_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>w. (w - z) * f w) holomorphic_on S
[PROOF STEP]
by (rule holomorphic_intros holf)+
[PROOF STATE]
proof (state)
this:
(\<lambda>w. (w - z) * f w) holomorphic_on S

goal (1 subgoal):
 1. (f has_contour_integral 0) \<gamma>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_contour_integral 0) \<gamma>
[PROOF STEP]
using Cauchy_integral_formula_global [OF S hol \<open>z \<in> S\<close> vpg pasz loop zero]
[PROOF STATE]
proof (prove)
using this:
(\<And>w. w \<notin> S \<Longrightarrow> w \<notin> S) \<Longrightarrow> ((\<lambda>w. (w - z) * f w / (w - z)) has_contour_integral complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z * ((z - z) * f z)) \<gamma>

goal (1 subgoal):
 1. (f has_contour_integral 0) \<gamma>
[PROOF STEP]
by (auto simp: znot elim!: has_contour_integral_eq)
[PROOF STATE]
proof (state)
this:
(f has_contour_integral 0) \<gamma>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Carmichael_number_odd:
  assumes "Carmichael_number n"
  shows   "odd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd n
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> odd n \<Longrightarrow> False
[PROOF STEP]
assume "\<not> odd n"
[PROOF STATE]
proof (state)
this:
\<not> odd n

goal (1 subgoal):
 1. \<not> odd n \<Longrightarrow> False
[PROOF STEP]
hence "even n"
[PROOF STATE]
proof (prove)
using this:
\<not> odd n

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

goal (1 subgoal):
 1. \<not> odd n \<Longrightarrow> False
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
Carmichael_number n
[PROOF STEP]
have "n \<ge> 4"
[PROOF STATE]
proof (prove)
using this:
Carmichael_number n

goal (1 subgoal):
 1. 4 \<le> n
[PROOF STEP]
using Carmichael_number_gt_3[of n]
[PROOF STATE]
proof (prove)
using this:
Carmichael_number n
Carmichael_number n \<Longrightarrow> 3 < n

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

goal (1 subgoal):
 1. \<not> odd n \<Longrightarrow> False
[PROOF STEP]
have "[(n - 1) ^ (n - 1) = n - 1] (mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [(n - 1) ^ (n - 1) = n - 1] (mod n)
[PROOF STEP]
using \<open>even n\<close> and \<open>n \<ge> 4\<close>
[PROOF STATE]
proof (prove)
using this:
even n
4 \<le> n

goal (1 subgoal):
 1. [(n - 1) ^ (n - 1) = n - 1] (mod n)
[PROOF STEP]
by (intro odd_pow_cong) auto
[PROOF STATE]
proof (state)
this:
[(n - 1) ^ (n - 1) = n - 1] (mod n)

goal (1 subgoal):
 1. \<not> odd n \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[(n - 1) ^ (n - 1) = n - 1] (mod n)
[PROOF STEP]
have "[(n - 1) ^ (n - 1) \<noteq> 1] (mod n)"
[PROOF STATE]
proof (prove)
using this:
[(n - 1) ^ (n - 1) = n - 1] (mod n)

goal (1 subgoal):
 1. [(n - 1) ^ (n - 1) \<noteq> 1] (mod n)
[PROOF STEP]
using cong_trans[of 1 "(n - 1) ^ (n - 1)" n "n-1", OF cong_sym] \<open>4 \<le> n\<close>
[PROOF STATE]
proof (prove)
using this:
[(n - 1) ^ (n - 1) = n - 1] (mod n)
\<lbrakk>[(n - 1) ^ (n - 1) = 1] (mod n); [(n - 1) ^ (n - 1) = n - 1] (mod n)\<rbrakk> \<Longrightarrow> [1 = n - 1] (mod n)
4 \<le> n

goal (1 subgoal):
 1. [(n - 1) ^ (n - 1) \<noteq> 1] (mod n)
[PROOF STEP]
by (auto simp: cong_def)
[PROOF STATE]
proof (state)
this:
[(n - 1) ^ (n - 1) \<noteq> 1] (mod n)

goal (1 subgoal):
 1. \<not> odd n \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[(n - 1) ^ (n - 1) \<noteq> 1] (mod n)

goal (1 subgoal):
 1. \<not> odd n \<Longrightarrow> False
[PROOF STEP]
have "coprime (n - 1) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime (n - 1) n
[PROOF STEP]
using \<open>n \<ge> 4\<close> coprime_diff_one_left_nat[of n]
[PROOF STATE]
proof (prove)
using this:
4 \<le> n
0 < n \<Longrightarrow> coprime (n - 1) n

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

goal (1 subgoal):
 1. \<not> odd n \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
[(n - 1) ^ (n - 1) \<noteq> 1] (mod n)
coprime (n - 1) n
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
[(n - 1) ^ (n - 1) \<noteq> 1] (mod n)
coprime (n - 1) n

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
[(n - 1) ^ (n - 1) \<noteq> 1] (mod n)
coprime (n - 1) n
Carmichael_number n

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding Carmichael_number_def
[PROOF STATE]
proof (prove)
using this:
[(n - 1) ^ (n - 1) \<noteq> 1] (mod n)
coprime (n - 1) n
1 < n \<and> \<not> prime n \<and> (\<forall>a. coprime a n \<longrightarrow> [a ^ (n - 1) = 1] (mod n))

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem limit_is_suffix:
  assumes fin: "finite (range x)"
  shows "\<exists>k. limit x = range (suffix k x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. limit x = range (suffix k x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k. limit x = range (suffix k x)
[PROOF STEP]
have "\<exists>k. range (suffix k x) \<subseteq> limit x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. range (suffix k x) \<subseteq> limit x
[PROOF STEP]
proof -
    \<comment> \<open>The set of letters that are not in the limit is certainly finite.\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k. range (suffix k x) \<subseteq> limit x
[PROOF STEP]
from fin
[PROOF STATE]
proof (chain)
picking this:
finite (range x)
[PROOF STEP]
have "finite (range x - limit x)"
[PROOF STATE]
proof (prove)
using this:
finite (range x)

goal (1 subgoal):
 1. finite (range x - limit x)
[PROOF STEP]
by simp
    \<comment> \<open>Moreover, any such letter occurs only finitely often\<close>
[PROOF STATE]
proof (state)
this:
finite (range x - limit x)

goal (1 subgoal):
 1. \<exists>k. range (suffix k x) \<subseteq> limit x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite (range x - limit x)

goal (1 subgoal):
 1. \<exists>k. range (suffix k x) \<subseteq> limit x
[PROOF STEP]
have "\<forall>a \<in> range x - limit x. finite (x -` {a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a\<in>range x - limit x. finite (x -` {a})
[PROOF STEP]
by (auto simp add: limit_vimage)
    \<comment> \<open>Thus, there are only finitely many occurrences of such letters.\<close>
[PROOF STATE]
proof (state)
this:
\<forall>a\<in>range x - limit x. finite (x -` {a})

goal (1 subgoal):
 1. \<exists>k. range (suffix k x) \<subseteq> limit x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite (range x - limit x)
\<forall>a\<in>range x - limit x. finite (x -` {a})
[PROOF STEP]
have "finite (UN a : range x - limit x. x -` {a})"
[PROOF STATE]
proof (prove)
using this:
finite (range x - limit x)
\<forall>a\<in>range x - limit x. finite (x -` {a})

goal (1 subgoal):
 1. finite (\<Union>a\<in>range x - limit x. x -` {a})
[PROOF STEP]
by (blast intro: finite_UN_I)
    \<comment> \<open>Therefore these occurrences are within some initial interval.\<close>
[PROOF STATE]
proof (state)
this:
finite (\<Union>a\<in>range x - limit x. x -` {a})

goal (1 subgoal):
 1. \<exists>k. range (suffix k x) \<subseteq> limit x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (\<Union>a\<in>range x - limit x. x -` {a})
[PROOF STEP]
obtain k where "(UN a : range x - limit x. x -` {a}) \<subseteq> {..<k}"
[PROOF STATE]
proof (prove)
using this:
finite (\<Union>a\<in>range x - limit x. x -` {a})

goal (1 subgoal):
 1. (\<And>k. (\<Union>a\<in>range x - limit x. x -` {a}) \<subseteq> {..<k} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (blast dest: finite_nat_bounded)
    \<comment> \<open>This is just the bound we are looking for.\<close>
[PROOF STATE]
proof (state)
this:
(\<Union>a\<in>range x - limit x. x -` {a}) \<subseteq> {..<k}

goal (1 subgoal):
 1. \<exists>k. range (suffix k x) \<subseteq> limit x
[PROOF STEP]
hence "\<forall>m. k \<le> m \<longrightarrow> x m \<in> limit x"
[PROOF STATE]
proof (prove)
using this:
(\<Union>a\<in>range x - limit x. x -` {a}) \<subseteq> {..<k}

goal (1 subgoal):
 1. \<forall>m\<ge>k. x m \<in> limit x
[PROOF STEP]
by (auto simp add: limit_vimage)
[PROOF STATE]
proof (state)
this:
\<forall>m\<ge>k. x m \<in> limit x

goal (1 subgoal):
 1. \<exists>k. range (suffix k x) \<subseteq> limit x
[PROOF STEP]
hence "range (suffix k x) \<subseteq> limit x"
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<ge>k. x m \<in> limit x

goal (1 subgoal):
 1. range (suffix k x) \<subseteq> limit x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
range (suffix k x) \<subseteq> limit x

goal (1 subgoal):
 1. \<exists>k. range (suffix k x) \<subseteq> limit x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
range (suffix k x) \<subseteq> limit x

goal (1 subgoal):
 1. \<exists>k. range (suffix k x) \<subseteq> limit x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>k. range (suffix k x) \<subseteq> limit x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>k. range (suffix k x) \<subseteq> limit x

goal (1 subgoal):
 1. \<exists>k. limit x = range (suffix k x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>k. range (suffix k x) \<subseteq> limit x
[PROOF STEP]
obtain k where "range (suffix k x) \<subseteq> limit x"
[PROOF STATE]
proof (prove)
using this:
\<exists>k. range (suffix k x) \<subseteq> limit x

goal (1 subgoal):
 1. (\<And>k. range (suffix k x) \<subseteq> limit x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
range (suffix k x) \<subseteq> limit x

goal (1 subgoal):
 1. \<exists>k. limit x = range (suffix k x)
[PROOF STEP]
with limit_in_range_suffix
[PROOF STATE]
proof (chain)
picking this:
limit ?x \<subseteq> range (suffix ?k ?x)
range (suffix k x) \<subseteq> limit x
[PROOF STEP]
have "limit x = range (suffix k x)"
[PROOF STATE]
proof (prove)
using this:
limit ?x \<subseteq> range (suffix ?k ?x)
range (suffix k x) \<subseteq> limit x

goal (1 subgoal):
 1. limit x = range (suffix k x)
[PROOF STEP]
by (rule subset_antisym)
[PROOF STATE]
proof (state)
this:
limit x = range (suffix k x)

goal (1 subgoal):
 1. \<exists>k. limit x = range (suffix k x)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
limit x = range (suffix k x)

goal (1 subgoal):
 1. \<exists>k. limit x = range (suffix k x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>k. limit x = range (suffix k x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma SReal_Int_Infinitesimal_zero: "\<real> Int Infinitesimal = {0::hypreal}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<real> \<inter> Infinitesimal = {0}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<real> \<inter> Infinitesimal = {0}
[PROOF STEP]
have "x = 0" if "x \<in> \<real>" "x \<in> Infinitesimal" for x :: "real star"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = 0
[PROOF STEP]
using that SReal_minus_not_Infinitesimal SReal_not_Infinitesimal not_less_iff_gr_or_eq
[PROOF STATE]
proof (prove)
using this:
x \<in> \<real>
x \<in> Infinitesimal
\<lbrakk>?y < 0; ?y \<in> \<real>\<rbrakk> \<Longrightarrow> ?y \<notin> Infinitesimal
\<lbrakk>0 < ?y; ?y \<in> \<real>\<rbrakk> \<Longrightarrow> ?y \<notin> Infinitesimal
(\<not> ?x < ?y) = (?y < ?x \<or> ?x = ?y)

goal (1 subgoal):
 1. x = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> \<real>; ?x \<in> Infinitesimal\<rbrakk> \<Longrightarrow> ?x = 0

goal (1 subgoal):
 1. \<real> \<inter> Infinitesimal = {0}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> \<real>; ?x \<in> Infinitesimal\<rbrakk> \<Longrightarrow> ?x = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> \<real>; ?x \<in> Infinitesimal\<rbrakk> \<Longrightarrow> ?x = 0

goal (1 subgoal):
 1. \<real> \<inter> Infinitesimal = {0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<real> \<inter> Infinitesimal = {0}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_rank_exist:
  assumes "finite S"
  assumes "x \<in> S"
  shows "\<exists>i. i < card S \<and> x = nth_elem S i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i<card S. x = nth_elem S i
[PROOF STEP]
using assms nth_elem.simps[of S]
[PROOF STATE]
proof (prove)
using this:
finite S
x \<in> S
nth_elem S ?n = sorted_list_of_set S ! ?n

goal (1 subgoal):
 1. \<exists>i<card S. x = nth_elem S i
[PROOF STEP]
by (metis in_set_conv_nth set_to_list_length sorted_list_of_set(1))


[STATEMENT]
lemma prime_factors_Prod:
  assumes "finite S" "\<And>a. a \<in> S \<Longrightarrow> f a \<noteq> 0"
  shows "prime_factors (prod f S) = \<Union>(prime_factors ` f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors (prod f S) = \<Union> (prime_factors ` f ` S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
?a \<in> S \<Longrightarrow> f ?a \<noteq> (0::'b)

goal (1 subgoal):
 1. prime_factors (prod f S) = \<Union> (prime_factors ` f ` S)
[PROOF STEP]
proof(induction S rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>a. a \<in> {} \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f {}) = \<Union> (prime_factors ` f ` {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F); \<And>a. a \<in> insert x F \<Longrightarrow> f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
?a \<in> {} \<Longrightarrow> f ?a \<noteq> (0::'b)

goal (2 subgoals):
 1. (\<And>a. a \<in> {} \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f {}) = \<Union> (prime_factors ` f ` {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F); \<And>a. a \<in> insert x F \<Longrightarrow> f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?a \<in> {} \<Longrightarrow> f ?a \<noteq> (0::'b)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?a \<in> {} \<Longrightarrow> f ?a \<noteq> (0::'b)

goal (1 subgoal):
 1. prime_factors (prod f {}) = \<Union> (prime_factors ` f ` {})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prime_factors (prod f {}) = \<Union> (prime_factors ` f ` {})

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F); \<And>a. a \<in> insert x F \<Longrightarrow> f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F); \<And>a. a \<in> insert x F \<Longrightarrow> f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)
[PROOF STEP]
case i: (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
(\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)
?a \<in> insert x F \<Longrightarrow> f ?a \<noteq> (0::'b)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F); \<And>a. a \<in> insert x F \<Longrightarrow> f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)
[PROOF STEP]
from i
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
(\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)
?a \<in> insert x F \<Longrightarrow> f ?a \<noteq> (0::'b)
[PROOF STEP]
have x: "f x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
(\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)
?a \<in> insert x F \<Longrightarrow> f ?a \<noteq> (0::'b)

goal (1 subgoal):
 1. f x \<noteq> (0::'b)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f x \<noteq> (0::'b)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F); \<And>a. a \<in> insert x F \<Longrightarrow> f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)
[PROOF STEP]
from i
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
(\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)
?a \<in> insert x F \<Longrightarrow> f ?a \<noteq> (0::'b)
[PROOF STEP]
have F: "prod f F \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
(\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)
?a \<in> insert x F \<Longrightarrow> f ?a \<noteq> (0::'b)

goal (1 subgoal):
 1. prod f F \<noteq> (0::'b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod f F \<noteq> (0::'b)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F); \<And>a. a \<in> insert x F \<Longrightarrow> f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)
[PROOF STEP]
from i
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
(\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)
?a \<in> insert x F \<Longrightarrow> f ?a \<noteq> (0::'b)
[PROOF STEP]
have "prime_factors(prod f F) = \<Union> (prime_factors ` f ` F)"
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
(\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)
?a \<in> insert x F \<Longrightarrow> f ?a \<noteq> (0::'b)

goal (1 subgoal):
 1. prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F); \<And>a. a \<in> insert x F \<Longrightarrow> f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F); \<And>a. a \<in> insert x F \<Longrightarrow> f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)
[PROOF STEP]
have "prod f (insert x F) = (prod f F) * f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f (insert x F) = prod f F * f x
[PROOF STEP]
using i mult.commute
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
(\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)
?a \<in> insert x F \<Longrightarrow> f ?a \<noteq> (0::'b)
?a * ?b = ?b * ?a

goal (1 subgoal):
 1. prod f (insert x F) = prod f F * f x
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
prod f (insert x F) = prod f F * f x

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F); \<And>a. a \<in> insert x F \<Longrightarrow> f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)
prod f (insert x F) = prod f F * f x
[PROOF STEP]
have "prime_factors (prod f (insert x F)) = (\<Union>(prime_factors ` f ` F)) \<union> prime_factors (f x)"
[PROOF STATE]
proof (prove)
using this:
prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)
prod f (insert x F) = prod f F * f x

goal (1 subgoal):
 1. prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` F) \<union> prime_factors (f x)
[PROOF STEP]
using prime_factors_product[OF F x]
[PROOF STATE]
proof (prove)
using this:
prime_factors (prod f F) = \<Union> (prime_factors ` f ` F)
prod f (insert x F) = prod f F * f x
prime_factors (prod f F * f x) = prime_factors (prod f F) \<union> prime_factors (f x)

goal (1 subgoal):
 1. prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` F) \<union> prime_factors (f x)
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` F) \<union> prime_factors (f x)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. a \<in> F \<Longrightarrow> f a \<noteq> (0::'b)) \<Longrightarrow> prime_factors (prod f F) = \<Union> (prime_factors ` f ` F); \<And>a. a \<in> insert x F \<Longrightarrow> f a \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` F) \<union> prime_factors (f x)

goal (1 subgoal):
 1. prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
prime_factors (prod f (insert x F)) = \<Union> (prime_factors ` f ` insert x F)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma notin_rtrancl:
  "(a,b) \<in> r\<^sup>* \<Longrightarrow> a \<noteq> b \<Longrightarrow> (\<And>y. (a,y) \<notin> r) \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(a, b) \<in> r\<^sup>*; a \<noteq> b; \<And>y. (a, y) \<notin> r\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (auto elim: converse_rtranclE)


[STATEMENT]
lemma finite_distinct_lists_subset:
  assumes "finite A"
  shows "finite {xs. distinct xs \<and> set xs \<subseteq> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. distinct xs \<and> set xs \<subseteq> A}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {xs. distinct xs \<and> set xs \<subseteq> A}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
have 1: "{xs. distinct xs \<and> set xs \<subseteq> A} = {xs. distinct xs \<and> length xs \<le> card A \<and> set xs \<subseteq> A}"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. {xs. distinct xs \<and> set xs \<subseteq> A} = {xs. distinct xs \<and> length xs \<le> card A \<and> set xs \<subseteq> A}
[PROOF STEP]
by (auto, metis card_mono distinct_card)
[PROOF STATE]
proof (state)
this:
{xs. distinct xs \<and> set xs \<subseteq> A} = {xs. distinct xs \<and> length xs \<le> card A \<and> set xs \<subseteq> A}

goal (1 subgoal):
 1. finite {xs. distinct xs \<and> set xs \<subseteq> A}
[PROOF STEP]
have 2: "... \<subseteq> {xs. set xs \<subseteq> A \<and> length xs \<le> card A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs. distinct xs \<and> length xs \<le> card A \<and> set xs \<subseteq> A} \<subseteq> {xs. set xs \<subseteq> A \<and> length xs \<le> card A}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{xs. distinct xs \<and> length xs \<le> card A \<and> set xs \<subseteq> A} \<subseteq> {xs. set xs \<subseteq> A \<and> length xs \<le> card A}

goal (1 subgoal):
 1. finite {xs. distinct xs \<and> set xs \<subseteq> A}
[PROOF STEP]
have 3: "finite ..."
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> A \<and> length xs \<le> card A}
[PROOF STEP]
using assms finite_lists_length_le
[PROOF STATE]
proof (prove)
using this:
finite A
finite ?A \<Longrightarrow> finite {xs. set xs \<subseteq> ?A \<and> length xs \<le> ?n}

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> A \<and> length xs \<le> card A}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite {xs. set xs \<subseteq> A \<and> length xs \<le> card A}

goal (1 subgoal):
 1. finite {xs. distinct xs \<and> set xs \<subseteq> A}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. distinct xs \<and> set xs \<subseteq> A}
[PROOF STEP]
by (metis (mono_tags, lifting) "1" "2" "3" infinite_super)
[PROOF STATE]
proof (state)
this:
finite {xs. distinct xs \<and> set xs \<subseteq> A}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma removeKeyList_cons[simp]:
  "removeKeyList ws (p#ps)
  = (if fst p \<in> set ws then removeKeyList ws ps else p#(removeKeyList ws ps))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. removeKeyList ws (p # ps) = (if fst p \<in> set ws then removeKeyList ws ps else p # removeKeyList ws ps)
[PROOF STEP]
by (induct ws) (simp_all split: if_split_asm add: removeKey_def)


[STATEMENT]
lemma closed_csubspace_UNIV[simp]: "closed_csubspace (UNIV::('a::{complex_vector,topological_space}) set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_csubspace UNIV
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed_csubspace UNIV
[PROOF STEP]
have \<open>csubspace UNIV\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. csubspace UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
csubspace UNIV

goal (1 subgoal):
 1. closed_csubspace UNIV
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
csubspace UNIV

goal (1 subgoal):
 1. closed_csubspace UNIV
[PROOF STEP]
have \<open>closed UNIV\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
closed UNIV

goal (1 subgoal):
 1. closed_csubspace UNIV
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
csubspace UNIV
closed UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
csubspace UNIV
closed UNIV

goal (1 subgoal):
 1. closed_csubspace UNIV
[PROOF STEP]
unfolding closed_csubspace_def
[PROOF STATE]
proof (prove)
using this:
csubspace UNIV
closed UNIV

goal (1 subgoal):
 1. csubspace UNIV \<and> closed UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
closed_csubspace UNIV

goal:
No subgoals!
[PROOF STEP]
qed