[STATEMENT]
lemma vector_affinity_eq:
  assumes m0: "(m::'a::field) \<noteq> 0"
  shows "m *s x + c = y \<longleftrightarrow> x = inverse m *s y + -(inverse m *s c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (m *s x + c = y) = (x = inverse m *s y + - (inverse m *s c))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m *s x + c = y \<Longrightarrow> x = inverse m *s y + - (inverse m *s c)
 2. x = inverse m *s y + - (inverse m *s c) \<Longrightarrow> m *s x + c = y
[PROOF STEP]
assume h: "m *s x + c = y"
[PROOF STATE]
proof (state)
this:
m *s x + c = y

goal (2 subgoals):
 1. m *s x + c = y \<Longrightarrow> x = inverse m *s y + - (inverse m *s c)
 2. x = inverse m *s y + - (inverse m *s c) \<Longrightarrow> m *s x + c = y
[PROOF STEP]
hence "m *s x = y - c"
[PROOF STATE]
proof (prove)
using this:
m *s x + c = y

goal (1 subgoal):
 1. m *s x = y - c
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
m *s x = y - c

goal (2 subgoals):
 1. m *s x + c = y \<Longrightarrow> x = inverse m *s y + - (inverse m *s c)
 2. x = inverse m *s y + - (inverse m *s c) \<Longrightarrow> m *s x + c = y
[PROOF STEP]
hence "inverse m *s (m *s x) = inverse m *s (y - c)"
[PROOF STATE]
proof (prove)
using this:
m *s x = y - c

goal (1 subgoal):
 1. inverse m *s (m *s x) = inverse m *s (y - c)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse m *s (m *s x) = inverse m *s (y - c)

goal (2 subgoals):
 1. m *s x + c = y \<Longrightarrow> x = inverse m *s y + - (inverse m *s c)
 2. x = inverse m *s y + - (inverse m *s c) \<Longrightarrow> m *s x + c = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inverse m *s (m *s x) = inverse m *s (y - c)
[PROOF STEP]
show "x = inverse m *s y + - (inverse m *s c)"
[PROOF STATE]
proof (prove)
using this:
inverse m *s (m *s x) = inverse m *s (y - c)

goal (1 subgoal):
 1. x = inverse m *s y + - (inverse m *s c)
[PROOF STEP]
using m0
[PROOF STATE]
proof (prove)
using this:
inverse m *s (m *s x) = inverse m *s (y - c)
m \<noteq> (0::'a)

goal (1 subgoal):
 1. x = inverse m *s y + - (inverse m *s c)
[PROOF STEP]
by (simp add: vector_smult_assoc vector_ssub_ldistrib)
[PROOF STATE]
proof (state)
this:
x = inverse m *s y + - (inverse m *s c)

goal (1 subgoal):
 1. x = inverse m *s y + - (inverse m *s c) \<Longrightarrow> m *s x + c = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = inverse m *s y + - (inverse m *s c) \<Longrightarrow> m *s x + c = y
[PROOF STEP]
assume h: "x = inverse m *s y + - (inverse m *s c)"
[PROOF STATE]
proof (state)
this:
x = inverse m *s y + - (inverse m *s c)

goal (1 subgoal):
 1. x = inverse m *s y + - (inverse m *s c) \<Longrightarrow> m *s x + c = y
[PROOF STEP]
show "m *s x + c = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m *s x + c = y
[PROOF STEP]
unfolding h
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m *s (inverse m *s y + - (inverse m *s c)) + c = y
[PROOF STEP]
using m0
[PROOF STATE]
proof (prove)
using this:
m \<noteq> (0::'a)

goal (1 subgoal):
 1. m *s (inverse m *s y + - (inverse m *s c)) + c = y
[PROOF STEP]
by (simp add: vector_smult_assoc vector_ssub_ldistrib)
[PROOF STATE]
proof (state)
this:
m *s x + c = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vangle_eq_0D:
  assumes "vangle u v = 0"
  shows   "norm u *\<^sub>R v = norm v *\<^sub>R u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm u *\<^sub>R v = norm v *\<^sub>R u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm u *\<^sub>R v = norm v *\<^sub>R u
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
vangle u v = 0
[PROOF STEP]
have "u \<bullet> v = norm u * norm v"
[PROOF STATE]
proof (prove)
using this:
vangle u v = 0

goal (1 subgoal):
 1. u \<bullet> v = norm u * norm v
[PROOF STEP]
using arccos_eq_iff[of "(u \<bullet> v) / (norm u * norm v)" 1] Cauchy_Schwarz_ineq2[of u v]
[PROOF STATE]
proof (prove)
using this:
vangle u v = 0
\<bar>u \<bullet> v / (norm u * norm v)\<bar> \<le> 1 \<and> \<bar>1\<bar> \<le> 1 \<Longrightarrow> (arccos (u \<bullet> v / (norm u * norm v)) = arccos 1) = (u \<bullet> v / (norm u * norm v) = 1)
\<bar>u \<bullet> v\<bar> \<le> norm u * norm v

goal (1 subgoal):
 1. u \<bullet> v = norm u * norm v
[PROOF STEP]
by (fastforce simp: vangle_def split: if_split_asm)
[PROOF STATE]
proof (state)
this:
u \<bullet> v = norm u * norm v

goal (1 subgoal):
 1. norm u *\<^sub>R v = norm v *\<^sub>R u
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
u \<bullet> v = norm u * norm v

goal (1 subgoal):
 1. norm u *\<^sub>R v = norm v *\<^sub>R u
[PROOF STEP]
by (subst (asm) norm_cauchy_schwarz_eq) simp_all
[PROOF STATE]
proof (state)
this:
norm u *\<^sub>R v = norm v *\<^sub>R u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma per_diag_sorted_Re:
  fixes B::"complex Matrix.mat"
  assumes "B\<in> carrier_mat n n"
  obtains f where "bij_betw f {..< n} {..< n} \<and>
    map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define m where "m = sort (map Re (diag_mat B))"
[PROOF STATE]
proof (state)
this:
m = sort (map Re (diag_mat B))

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "length m = length (map Re (diag_mat B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length m = length (map Re (diag_mat B))
[PROOF STEP]
unfolding m_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (sort (map Re (diag_mat B))) = length (map Re (diag_mat B))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length m = length (map Re (diag_mat B))

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length m = length (map Re (diag_mat B))

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "... = length (diag_mat B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map Re (diag_mat B)) = length (diag_mat B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (map Re (diag_mat B)) = length (diag_mat B)

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (map Re (diag_mat B)) = length (diag_mat B)

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "... = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (diag_mat B) = n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat n n

goal (1 subgoal):
 1. length (diag_mat B) = n
[PROOF STEP]
unfolding diag_mat_def
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat n n

goal (1 subgoal):
 1. length (map (\<lambda>i. B $$ (i, i)) [0..<dim_row B]) = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (diag_mat B) = n

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
length m = n
[PROOF STEP]
have "length m = n"
[PROOF STATE]
proof (prove)
using this:
length m = n

goal (1 subgoal):
 1. length m = n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
length m = n

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
length m = n
[PROOF STEP]
obtain f where "bij_betw f {..<n} {..<n} \<and>
    (\<forall>i<n. (map Re (diag_mat B)) ! f i = m ! i)"
[PROOF STATE]
proof (prove)
using this:
length m = n

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> (\<forall>i<n. map Re (diag_mat B) ! f i = m ! i) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using sort_permutation[of m "map Re (diag_mat B)"] m_def
[PROOF STATE]
proof (prove)
using this:
length m = n
\<lbrakk>m = sort (map Re (diag_mat B)); \<And>f. bij_betw f {..<length (map Re (diag_mat B))} {..<length (map Re (diag_mat B))} \<and> (\<forall>i<length (map Re (diag_mat B)). map Re (diag_mat B) ! f i = m ! i) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
m = sort (map Re (diag_mat B))

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> (\<forall>i<n. map Re (diag_mat B) ! f i = m ! i) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bij_betw f {..<n} {..<n} \<and> (\<forall>i<n. map Re (diag_mat B) ! f i = m ! i)

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
note fprop = this
[PROOF STATE]
proof (state)
this:
bij_betw f {..<n} {..<n} \<and> (\<forall>i<n. map Re (diag_mat B) ! f i = m ! i)

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have l: "length (diag_mat (per_diag B f)) = length m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (diag_mat (per_diag B f)) = length m
[PROOF STEP]
using per_diag_carrier assms \<open>length m = n\<close>
[PROOF STATE]
proof (prove)
using this:
per_diag ?A ?f \<in> carrier_mat (dim_row ?A) (dim_col ?A)
B \<in> carrier_mat n n
length m = n

goal (1 subgoal):
 1. length (diag_mat (per_diag B f)) = length m
[PROOF STEP]
unfolding diag_mat_def
[PROOF STATE]
proof (prove)
using this:
per_diag ?A ?f \<in> carrier_mat (dim_row ?A) (dim_col ?A)
B \<in> carrier_mat n n
length m = n

goal (1 subgoal):
 1. length (map (\<lambda>i. per_diag B f $$ (i, i)) [0..<dim_row (per_diag B f)]) = length m
[PROOF STEP]
by (metis carrier_matD(1) length_map map_nth)
[PROOF STATE]
proof (state)
this:
length (diag_mat (per_diag B f)) = length m

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "map Re (diag_mat (per_diag B f)) = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map Re (diag_mat (per_diag B f)) = m
[PROOF STEP]
proof (rule list_eq_iff_nth_eq[THEN iffD2], intro conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (map Re (diag_mat (per_diag B f))) = length m
 2. \<forall>i<length (map Re (diag_mat (per_diag B f))). map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
show "length (map Re (diag_mat (per_diag B f))) = length m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map Re (diag_mat (per_diag B f))) = length m
[PROOF STEP]
using l
[PROOF STATE]
proof (prove)
using this:
length (diag_mat (per_diag B f)) = length m

goal (1 subgoal):
 1. length (map Re (diag_mat (per_diag B f))) = length m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (map Re (diag_mat (per_diag B f))) = length m

goal (1 subgoal):
 1. \<forall>i<length (map Re (diag_mat (per_diag B f))). map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
have "\<forall>i<n. (map Re (diag_mat (per_diag B f)))!i = m!i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<n. map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
proof (intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
assume "i< n"
[PROOF STATE]
proof (state)
this:
i < n

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
have "(map Re (diag_mat (per_diag B f)))!i = (map Re (diag_mat B))!(f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map Re (diag_mat (per_diag B f)) ! i = map Re (diag_mat B) ! f i
[PROOF STEP]
proof (rule per_diag_diag_mat_Re)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. B \<in> carrier_mat ?n ?n
 2. i < ?n
 3. f i < ?n
[PROOF STEP]
show "B\<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<in> carrier_mat n n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat n n

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

goal (2 subgoals):
 1. i < n
 2. f i < n
[PROOF STEP]
show "i < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < n
[PROOF STEP]
using \<open>i < n\<close>
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. i < n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
i < n

goal (1 subgoal):
 1. f i < n
[PROOF STEP]
thus "f i < n"
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. f i < n
[PROOF STEP]
using fprop bij_betwE
[PROOF STATE]
proof (prove)
using this:
i < n
bij_betw f {..<n} {..<n} \<and> (\<forall>i<n. map Re (diag_mat B) ! f i = m ! i)
bij_betw ?f ?A ?B \<Longrightarrow> \<forall>a\<in>?A. ?f a \<in> ?B

goal (1 subgoal):
 1. f i < n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f i < n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
map Re (diag_mat (per_diag B f)) ! i = map Re (diag_mat B) ! f i

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map Re (diag_mat (per_diag B f)) ! i = map Re (diag_mat B) ! f i

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
have "... = m!i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map Re (diag_mat B) ! f i = m ! i
[PROOF STEP]
using fprop \<open>i < n\<close>
[PROOF STATE]
proof (prove)
using this:
bij_betw f {..<n} {..<n} \<and> (\<forall>i<n. map Re (diag_mat B) ! f i = m ! i)
i < n

goal (1 subgoal):
 1. map Re (diag_mat B) ! f i = m ! i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map Re (diag_mat B) ! f i = m ! i

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
show "(map Re (diag_mat (per_diag B f)))!i = m!i"
[PROOF STATE]
proof (prove)
using this:
map Re (diag_mat (per_diag B f)) ! i = m ! i

goal (1 subgoal):
 1. map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
map Re (diag_mat (per_diag B f)) ! i = m ! i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i<n. map Re (diag_mat (per_diag B f)) ! i = m ! i

goal (1 subgoal):
 1. \<forall>i<length (map Re (diag_mat (per_diag B f))). map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
thus "\<forall>i<length (map Re (diag_mat (per_diag B f))).
      (map Re (diag_mat (per_diag B f)))!i = m ! i"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<n. map Re (diag_mat (per_diag B f)) ! i = m ! i

goal (1 subgoal):
 1. \<forall>i<length (map Re (diag_mat (per_diag B f))). map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
using l \<open>length m = n\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>i<n. map Re (diag_mat (per_diag B f)) ! i = m ! i
length (diag_mat (per_diag B f)) = length m
length m = n

goal (1 subgoal):
 1. \<forall>i<length (map Re (diag_mat (per_diag B f))). map Re (diag_mat (per_diag B f)) ! i = m ! i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>i<length (map Re (diag_mat (per_diag B f))). map Re (diag_mat (per_diag B f)) ! i = m ! i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
map Re (diag_mat (per_diag B f)) = m

goal (1 subgoal):
 1. (\<And>f. bij_betw f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
map Re (diag_mat (per_diag B f)) = m

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that fprop
[PROOF STATE]
proof (prove)
using this:
map Re (diag_mat (per_diag B f)) = m
bij_betw ?f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B ?f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis
bij_betw f {..<n} {..<n} \<and> (\<forall>i<n. map Re (diag_mat B) ! f i = m ! i)

goal (1 subgoal):
 1. thesis
[PROOF STEP]
unfolding m_def
[PROOF STATE]
proof (prove)
using this:
map Re (diag_mat (per_diag B f)) = sort (map Re (diag_mat B))
bij_betw ?f {..<n} {..<n} \<and> map Re (diag_mat (per_diag B ?f)) = sort (map Re (diag_mat B)) \<Longrightarrow> thesis
bij_betw f {..<n} {..<n} \<and> (\<forall>i<n. map Re (diag_mat B) ! f i = sort (map Re (diag_mat B)) ! i)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bezout_matrix_row_code [code abstract]:
  "vec_nth (bezout_matrix_row A a b j bezout x) =
      (let (p, q, u, v, d) = bezout (A $ a $ j) (A $ b $ j)
        in
          (\<lambda>y. if x = a \<and> y = a then p else
               if x = a \<and> y = b then q else
               if x = b \<and> y = a then u else
               if x = b \<and> y = b then v else
               if x = y then 1 else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (bezout_matrix_row A a b j bezout x) = (let (p, q, u, v, d) = bezout (A $ a $ j) (A $ b $ j) in (\<lambda>y. if x = a \<and> y = a then p else if x = a \<and> y = b then q else if x = b \<and> y = a then u else if x = b \<and> y = b then v else if x = y then 1::'b else (0::'b)))
[PROOF STEP]
unfolding bezout_matrix_row_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (let (p, q, u, v, d) = bezout (A $ a $ j) (A $ b $ j) in \<chi>y. if x = a \<and> y = a then p else if x = a \<and> y = b then q else if x = b \<and> y = a then u else if x = b \<and> y = b then v else if x = y then 1::'b else (0::'b)) = (let (p, q, u, v, d) = bezout (A $ a $ j) (A $ b $ j) in (\<lambda>y. if x = a \<and> y = a then p else if x = a \<and> y = b then q else if x = b \<and> y = a then u else if x = b \<and> y = b then v else if x = y then 1::'b else (0::'b)))
[PROOF STEP]
by (cases "bezout (A $ a $ j) (A $ b $ j)") auto


[STATEMENT]
lemma cos_one_2pi_int: "cos x = 1 \<longleftrightarrow> (\<exists>n::int. x = n * 2 * pi)" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos x = 1) = (\<exists>xa. x = real_of_int xa * 2 * pi)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. cos x = 1 \<Longrightarrow> \<exists>xa. x = real_of_int xa * 2 * pi
 2. \<exists>xa. x = real_of_int xa * 2 * pi \<Longrightarrow> cos x = 1
[PROOF STEP]
assume "cos x = 1"
[PROOF STATE]
proof (state)
this:
cos x = 1

goal (2 subgoals):
 1. cos x = 1 \<Longrightarrow> \<exists>xa. x = real_of_int xa * 2 * pi
 2. \<exists>xa. x = real_of_int xa * 2 * pi \<Longrightarrow> cos x = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cos x = 1
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
cos x = 1

goal (1 subgoal):
 1. \<exists>xa. x = real_of_int xa * 2 * pi
[PROOF STEP]
by (metis cos_one_2pi mult.commute mult_minus_right of_int_minus of_int_of_nat_eq)
[PROOF STATE]
proof (state)
this:
\<exists>xa. x = real_of_int xa * 2 * pi

goal (1 subgoal):
 1. \<exists>xa. x = real_of_int xa * 2 * pi \<Longrightarrow> cos x = 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>xa. x = real_of_int xa * 2 * pi \<Longrightarrow> cos x = 1
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
\<exists>xa. x = real_of_int xa * 2 * pi

goal (1 subgoal):
 1. \<exists>xa. x = real_of_int xa * 2 * pi \<Longrightarrow> cos x = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>xa. x = real_of_int xa * 2 * pi
[PROOF STEP]
show "cos x = 1"
[PROOF STATE]
proof (prove)
using this:
\<exists>xa. x = real_of_int xa * 2 * pi

goal (1 subgoal):
 1. cos x = 1
[PROOF STEP]
by (clarsimp simp add: cos_one_2pi) (metis mult_minus_right of_int_of_nat)
[PROOF STATE]
proof (state)
this:
cos x = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_is_empty: "nat_to_set 0 = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_set 0 = {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nat_to_set 0 = {}
[PROOF STEP]
have S1: "{i. i<(0::nat)} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < 0} = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{i. i < 0} = {}

goal (1 subgoal):
 1. nat_to_set 0 = {}
[PROOF STEP]
have S2: "nat_to_set 0 \<subseteq> {i. i<0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_set 0 \<subseteq> {i. i < 0}
[PROOF STEP]
by (rule nat_to_set_upper_bound2)
[PROOF STATE]
proof (state)
this:
nat_to_set 0 \<subseteq> {i. i < 0}

goal (1 subgoal):
 1. nat_to_set 0 = {}
[PROOF STEP]
from S1 S2
[PROOF STATE]
proof (chain)
picking this:
{i. i < 0} = {}
nat_to_set 0 \<subseteq> {i. i < 0}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{i. i < 0} = {}
nat_to_set 0 \<subseteq> {i. i < 0}

goal (1 subgoal):
 1. nat_to_set 0 = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_set 0 = {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in field) finite_field_mult_group_has_gen2:
  assumes finite:"finite (carrier R)"
  shows "\<exists>a \<in> carrier (mult_of R). group.ord (mult_of R) a = order (mult_of R)
  \<and> carrier (mult_of R) = {a[^]i | i::nat . i \<in> UNIV}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). group.ord (mult_of R) a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). group.ord (mult_of R) a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
note mult_of_simps[simp]
[PROOF STATE]
proof (state)
this:
carrier (mult_of ?R) = carrier ?R - {\<zero>\<^bsub>?R\<^esub>}
(\<otimes>\<^bsub>mult_of ?R\<^esub>) = (\<otimes>\<^bsub>?R\<^esub>)
([^]\<^bsub>mult_of ?R\<^esub>) = ([^]\<^bsub>?R\<^esub>)
\<one>\<^bsub>mult_of ?R\<^esub> = \<one>\<^bsub>?R\<^esub>

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). group.ord (mult_of R) a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
have finite': "finite (carrier (mult_of R))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (carrier (mult_of R))
[PROOF STEP]
using finite
[PROOF STATE]
proof (prove)
using this:
finite (carrier R)

goal (1 subgoal):
 1. finite (carrier (mult_of R))
[PROOF STEP]
by (rule finite_mult_of)
[PROOF STATE]
proof (state)
this:
finite (carrier (mult_of R))

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). group.ord (mult_of R) a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
interpret G: group "mult_of R" rewrites
      "([^]\<^bsub>mult_of R\<^esub>) = (([^]) :: _ \<Rightarrow> nat \<Rightarrow> _)" and "\<one>\<^bsub>mult_of R\<^esub> = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group (mult_of R) &&& ([^]\<^bsub>mult_of R\<^esub>) = ([^]) &&& \<one>\<^bsub>mult_of R\<^esub> = \<one>
[PROOF STEP]
by (rule field_mult_group) (simp_all add: fun_eq_iff nat_pow_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
let ?N = "\<lambda> x . card {a \<in> carrier (mult_of R). group.ord (mult_of R) a  = x}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
have "0 < order R - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < order R - 1
[PROOF STEP]
unfolding Coset.order_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < card (carrier R) - 1
[PROOF STEP]
using card_mono[OF finite, of "{\<zero>, \<one>}"]
[PROOF STATE]
proof (prove)
using this:
{\<zero>, \<one>} \<subseteq> carrier R \<Longrightarrow> card {\<zero>, \<one>} \<le> card (carrier R)

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

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < order R - 1
[PROOF STEP]
have *: "0 < order (mult_of R)"
[PROOF STATE]
proof (prove)
using this:
0 < order R - 1

goal (1 subgoal):
 1. 0 < order (mult_of R)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < order R - 1
finite (carrier R)

goal (1 subgoal):
 1. 0 < order (mult_of R)
[PROOF STEP]
by (simp add: order_mult_of)
[PROOF STATE]
proof (state)
this:
0 < order (mult_of R)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
have fin: "finite {d. d dvd order (mult_of R) }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {d. d dvd order (mult_of R)}
[PROOF STEP]
using dvd_nat_bounds[OF *]
[PROOF STATE]
proof (prove)
using this:
?n dvd order (mult_of R) \<Longrightarrow> 0 < ?n \<and> ?n \<le> order (mult_of R)

goal (1 subgoal):
 1. finite {d. d dvd order (mult_of R)}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
finite {d. d dvd order (mult_of R)}

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
have "(\<Sum>d | d dvd order (mult_of R). ?N d)
      = card (UN d:{d . d dvd order (mult_of R) }. {a \<in> carrier (mult_of R). group.ord (mult_of R) a  = d})"
      (is "_ = card ?U")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = d}) = card (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
using fin finite
[PROOF STATE]
proof (prove)
using this:
finite {d. d dvd order (mult_of R)}
finite (carrier R)

goal (1 subgoal):
 1. (\<Sum>d | d dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = d}) = card (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
by (subst card_UN_disjoint) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = d}) = card (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = d}) = card (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
have "?U = carrier (mult_of R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d}) = carrier (mult_of R)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d}) \<subseteq> carrier (mult_of R)
 2. carrier (mult_of R) \<subseteq> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d}) \<subseteq> carrier (mult_of R)
 2. carrier (mult_of R) \<subseteq> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d}) \<subseteq> carrier (mult_of R)
 2. carrier (mult_of R) \<subseteq> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
assume x:"x \<in> carrier (mult_of R)"
[PROOF STATE]
proof (state)
this:
x \<in> carrier (mult_of R)

goal (2 subgoals):
 1. (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d}) \<subseteq> carrier (mult_of R)
 2. carrier (mult_of R) \<subseteq> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
hence x':"x\<in>carrier (mult_of R)"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (mult_of R)

goal (1 subgoal):
 1. x \<in> carrier (mult_of R)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> carrier (mult_of R)

goal (2 subgoals):
 1. (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d}) \<subseteq> carrier (mult_of R)
 2. carrier (mult_of R) \<subseteq> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier (mult_of R)
[PROOF STEP]
have "group.ord (mult_of R) x dvd order (mult_of R)"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (mult_of R)

goal (1 subgoal):
 1. G.ord x dvd order (mult_of R)
[PROOF STEP]
using finite' G.ord_dvd_group_order[OF x']
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (mult_of R)
finite (carrier (mult_of R))
G.ord x dvd order (mult_of R)

goal (1 subgoal):
 1. G.ord x dvd order (mult_of R)
[PROOF STEP]
by (simp add: order_mult_of)
[PROOF STATE]
proof (state)
this:
G.ord x dvd order (mult_of R)

goal (2 subgoals):
 1. (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d}) \<subseteq> carrier (mult_of R)
 2. carrier (mult_of R) \<subseteq> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
hence "x \<in> ?U"
[PROOF STATE]
proof (prove)
using this:
G.ord x dvd order (mult_of R)

goal (1 subgoal):
 1. x \<in> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
using dvd_nat_bounds[of "order (mult_of R)" "group.ord (mult_of R) x"] x
[PROOF STATE]
proof (prove)
using this:
G.ord x dvd order (mult_of R)
\<lbrakk>0 < order (mult_of R); G.ord x dvd order (mult_of R)\<rbrakk> \<Longrightarrow> 0 < G.ord x \<and> G.ord x \<le> order (mult_of R)
x \<in> carrier (mult_of R)

goal (1 subgoal):
 1. x \<in> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})

goal (2 subgoals):
 1. (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d}) \<subseteq> carrier (mult_of R)
 2. carrier (mult_of R) \<subseteq> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x3 \<in> carrier (mult_of R) \<Longrightarrow> ?x3 \<in> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})

goal (2 subgoals):
 1. (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d}) \<subseteq> carrier (mult_of R)
 2. carrier (mult_of R) \<subseteq> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
thus "carrier (mult_of R) \<subseteq> ?U"
[PROOF STATE]
proof (prove)
using this:
?x3 \<in> carrier (mult_of R) \<Longrightarrow> ?x3 \<in> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})

goal (1 subgoal):
 1. carrier (mult_of R) \<subseteq> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
carrier (mult_of R) \<subseteq> (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d})

goal (1 subgoal):
 1. (\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d}) \<subseteq> carrier (mult_of R)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d}) = carrier (mult_of R)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Union>d\<in>{d. d dvd order (mult_of R)}. {a \<in> carrier (mult_of R). G.ord a = d}) = carrier (mult_of R)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
have "card ... = Coset.order (mult_of R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier (mult_of R)) = order (mult_of R)
[PROOF STEP]
using order_mult_of finite'
[PROOF STATE]
proof (prove)
using this:
finite (carrier R) \<Longrightarrow> order (mult_of R) = order R - 1
finite (carrier (mult_of R))

goal (1 subgoal):
 1. card (carrier (mult_of R)) = order (mult_of R)
[PROOF STEP]
by (simp add: Coset.order_def)
[PROOF STATE]
proof (state)
this:
card (carrier (mult_of R)) = order (mult_of R)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>d | d dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = d}) = order (mult_of R)
[PROOF STEP]
have sum_Ns_eq: "(\<Sum>d | d dvd order (mult_of R). ?N d) = order (mult_of R)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d | d dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = d}) = order (mult_of R)

goal (1 subgoal):
 1. (\<Sum>d | d dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = d}) = order (mult_of R)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = d}) = order (mult_of R)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = d}) = order (mult_of R)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
fix d
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
assume d:"d dvd order (mult_of R)"
[PROOF STATE]
proof (state)
this:
d dvd order (mult_of R)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
have "card {a \<in> carrier (mult_of R). group.ord (mult_of R) a = d} \<le> phi' d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d
 2. \<not> ?P \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d
[PROOF STEP]
assume "card {a \<in> carrier (mult_of R). group.ord (mult_of R) a = d} = 0"
[PROOF STATE]
proof (state)
this:
card {a \<in> carrier (mult_of R). G.ord a = d} = 0

goal (2 subgoals):
 1. ?P \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d
 2. \<not> ?P \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
card {a \<in> carrier (mult_of R). G.ord a = d} = 0

goal (1 subgoal):
 1. card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d

goal (1 subgoal):
 1. card {a \<in> carrier (mult_of R). G.ord a = d} \<noteq> 0 \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {a \<in> carrier (mult_of R). G.ord a = d} \<noteq> 0 \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d
[PROOF STEP]
assume "card {a \<in> carrier (mult_of R). group.ord (mult_of R) a = d} \<noteq> 0"
[PROOF STATE]
proof (state)
this:
card {a \<in> carrier (mult_of R). G.ord a = d} \<noteq> 0

goal (1 subgoal):
 1. card {a \<in> carrier (mult_of R). G.ord a = d} \<noteq> 0 \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d
[PROOF STEP]
hence "\<exists>a \<in> carrier (mult_of R). group.ord (mult_of R) a = d"
[PROOF STATE]
proof (prove)
using this:
card {a \<in> carrier (mult_of R). G.ord a = d} \<noteq> 0

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = d
[PROOF STEP]
by (auto simp: card_eq_0_iff)
[PROOF STATE]
proof (state)
this:
\<exists>a\<in>carrier (mult_of R). G.ord a = d

goal (1 subgoal):
 1. card {a \<in> carrier (mult_of R). G.ord a = d} \<noteq> 0 \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>a\<in>carrier (mult_of R). G.ord a = d

goal (1 subgoal):
 1. card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d
[PROOF STEP]
using num_elems_of_ord_eq_phi'[OF finite d]
[PROOF STATE]
proof (prove)
using this:
\<exists>a\<in>carrier (mult_of R). G.ord a = d
\<exists>a\<in>carrier (mult_of R). G.ord a = d \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = d} = phi' d

goal (1 subgoal):
 1. card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {a \<in> carrier (mult_of R). G.ord a = d} \<le> phi' d

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?d3 dvd order (mult_of R) \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = ?d3} \<le> phi' ?d3

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
hence all_le:"\<And>i. i \<in> {d. d dvd order (mult_of R) }
        \<Longrightarrow> (\<lambda>i. card {a \<in> carrier (mult_of R). group.ord (mult_of R) a = i}) i \<le> (\<lambda>i. phi' i) i"
[PROOF STATE]
proof (prove)
using this:
?d3 dvd order (mult_of R) \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = ?d3} \<le> phi' ?d3

goal (1 subgoal):
 1. \<And>i. i \<in> {d. d dvd order (mult_of R)} \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = i} \<le> phi' i
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
?i1 \<in> {d. d dvd order (mult_of R)} \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = ?i1} \<le> phi' ?i1

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
hence le:"(\<Sum>i | i dvd order (mult_of R). ?N i)
            \<le> (\<Sum>i | i dvd order (mult_of R). phi' i)"
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> {d. d dvd order (mult_of R)} \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = ?i1} \<le> phi' ?i1

goal (1 subgoal):
 1. (\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) \<le> (\<Sum>i | i dvd order (mult_of R). phi' i)
[PROOF STEP]
using sum_mono[of "{d .  d dvd order (mult_of R)}"
                  "\<lambda>i. card {a \<in> carrier (mult_of R). group.ord (mult_of R) a = i}"]
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> {d. d dvd order (mult_of R)} \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = ?i1} \<le> phi' ?i1
(\<And>i. i \<in> {d. d dvd order (mult_of R)} \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = i} \<le> ?g i) \<Longrightarrow> (\<Sum>i\<in>{d. d dvd order (mult_of R)}. card {a \<in> carrier (mult_of R). G.ord a = i}) \<le> sum ?g {d. d dvd order (mult_of R)}

goal (1 subgoal):
 1. (\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) \<le> (\<Sum>i | i dvd order (mult_of R). phi' i)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) \<le> (\<Sum>i | i dvd order (mult_of R). phi' i)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
have "order (mult_of R) = (\<Sum>d | d dvd order (mult_of R). phi' d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (mult_of R) = (\<Sum>d | d dvd order (mult_of R). phi' d)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
0 < order (mult_of R)

goal (1 subgoal):
 1. order (mult_of R) = (\<Sum>d | d dvd order (mult_of R). phi' d)
[PROOF STEP]
by (simp add: sum_phi'_factors)
[PROOF STATE]
proof (state)
this:
order (mult_of R) = (\<Sum>d | d dvd order (mult_of R). phi' d)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
hence eq:"(\<Sum>i | i dvd order (mult_of R). ?N i)
          = (\<Sum>i | i dvd order (mult_of R). phi' i)"
[PROOF STATE]
proof (prove)
using this:
order (mult_of R) = (\<Sum>d | d dvd order (mult_of R). phi' d)

goal (1 subgoal):
 1. (\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) = (\<Sum>i | i dvd order (mult_of R). phi' i)
[PROOF STEP]
using le sum_Ns_eq
[PROOF STATE]
proof (prove)
using this:
order (mult_of R) = (\<Sum>d | d dvd order (mult_of R). phi' d)
(\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) \<le> (\<Sum>i | i dvd order (mult_of R). phi' i)
(\<Sum>d | d dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = d}) = order (mult_of R)

goal (1 subgoal):
 1. (\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) = (\<Sum>i | i dvd order (mult_of R). phi' i)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) = (\<Sum>i | i dvd order (mult_of R). phi' i)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
have "\<And>i. i \<in> {d. d dvd order (mult_of R) } \<Longrightarrow> ?N i = (\<lambda>i. phi' i) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> {d. d dvd order (mult_of R)} \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = i} = phi' i
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<in> {d. d dvd order (mult_of R)}; card {a \<in> carrier (mult_of R). G.ord a = i} \<noteq> phi' i\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<in> {d. d dvd order (mult_of R)}; card {a \<in> carrier (mult_of R). G.ord a = i} \<noteq> phi' i\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume i1:"i \<in> {d. d dvd order (mult_of R)}" and "?N i \<noteq> phi' i"
[PROOF STATE]
proof (state)
this:
i \<in> {d. d dvd order (mult_of R)}
card {a \<in> carrier (mult_of R). G.ord a = i} \<noteq> phi' i

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<in> {d. d dvd order (mult_of R)}; card {a \<in> carrier (mult_of R). G.ord a = i} \<noteq> phi' i\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence "?N i = 0"
[PROOF STATE]
proof (prove)
using this:
i \<in> {d. d dvd order (mult_of R)}
card {a \<in> carrier (mult_of R). G.ord a = i} \<noteq> phi' i

goal (1 subgoal):
 1. card {a \<in> carrier (mult_of R). G.ord a = i} = 0
[PROOF STEP]
using num_elems_of_ord_eq_phi'[OF finite, of i]
[PROOF STATE]
proof (prove)
using this:
i \<in> {d. d dvd order (mult_of R)}
card {a \<in> carrier (mult_of R). G.ord a = i} \<noteq> phi' i
\<lbrakk>i dvd order (mult_of R); \<exists>a\<in>carrier (mult_of R). G.ord a = i\<rbrakk> \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = i} = phi' i

goal (1 subgoal):
 1. card {a \<in> carrier (mult_of R). G.ord a = i} = 0
[PROOF STEP]
by (auto simp: card_eq_0_iff)
[PROOF STATE]
proof (state)
this:
card {a \<in> carrier (mult_of R). G.ord a = i} = 0

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<in> {d. d dvd order (mult_of R)}; card {a \<in> carrier (mult_of R). G.ord a = i} \<noteq> phi' i\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card {a \<in> carrier (mult_of R). G.ord a = i} = 0

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<in> {d. d dvd order (mult_of R)}; card {a \<in> carrier (mult_of R). G.ord a = i} \<noteq> phi' i\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "0 < i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < i
[PROOF STEP]
using * i1
[PROOF STATE]
proof (prove)
using this:
0 < order (mult_of R)
i \<in> {d. d dvd order (mult_of R)}

goal (1 subgoal):
 1. 0 < i
[PROOF STEP]
by (simp add: dvd_nat_bounds[of "order (mult_of R)" i])
[PROOF STATE]
proof (state)
this:
0 < i

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<in> {d. d dvd order (mult_of R)}; card {a \<in> carrier (mult_of R). G.ord a = i} \<noteq> phi' i\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card {a \<in> carrier (mult_of R). G.ord a = i} = 0
0 < i
[PROOF STEP]
have "?N i < phi' i"
[PROOF STATE]
proof (prove)
using this:
card {a \<in> carrier (mult_of R). G.ord a = i} = 0
0 < i

goal (1 subgoal):
 1. card {a \<in> carrier (mult_of R). G.ord a = i} < phi' i
[PROOF STEP]
using phi'_nonzero
[PROOF STATE]
proof (prove)
using this:
card {a \<in> carrier (mult_of R). G.ord a = i} = 0
0 < i
0 < ?m \<Longrightarrow> 0 < phi' ?m

goal (1 subgoal):
 1. card {a \<in> carrier (mult_of R). G.ord a = i} < phi' i
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
card {a \<in> carrier (mult_of R). G.ord a = i} < phi' i

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<in> {d. d dvd order (mult_of R)}; card {a \<in> carrier (mult_of R). G.ord a = i} \<noteq> phi' i\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence "(\<Sum>i | i dvd order (mult_of R). ?N i)
         < (\<Sum>i | i dvd order (mult_of R). phi' i)"
[PROOF STATE]
proof (prove)
using this:
card {a \<in> carrier (mult_of R). G.ord a = i} < phi' i

goal (1 subgoal):
 1. (\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) < (\<Sum>i | i dvd order (mult_of R). phi' i)
[PROOF STEP]
using sum_strict_mono_ex1[OF fin, of "?N" "\<lambda> i . phi' i"]
            i1 all_le
[PROOF STATE]
proof (prove)
using this:
card {a \<in> carrier (mult_of R). G.ord a = i} < phi' i
\<lbrakk>\<forall>x\<in>{d. d dvd order (mult_of R)}. card {a \<in> carrier (mult_of R). G.ord a = x} \<le> phi' x; \<exists>a\<in>{d. d dvd order (mult_of R)}. card {aa \<in> carrier (mult_of R). G.ord aa = a} < phi' a\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>{d. d dvd order (mult_of R)}. card {a \<in> carrier (mult_of R). G.ord a = x}) < sum phi' {d. d dvd order (mult_of R)}
i \<in> {d. d dvd order (mult_of R)}
?i1 \<in> {d. d dvd order (mult_of R)} \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = ?i1} \<le> phi' ?i1

goal (1 subgoal):
 1. (\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) < (\<Sum>i | i dvd order (mult_of R). phi' i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) < (\<Sum>i | i dvd order (mult_of R). phi' i)

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<in> {d. d dvd order (mult_of R)}; card {a \<in> carrier (mult_of R). G.ord a = i} \<noteq> phi' i\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) < (\<Sum>i | i dvd order (mult_of R). phi' i)

goal (1 subgoal):
 1. False
[PROOF STEP]
using eq
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) < (\<Sum>i | i dvd order (mult_of R). phi' i)
(\<Sum>i | i dvd order (mult_of R). card {a \<in> carrier (mult_of R). G.ord a = i}) = (\<Sum>i | i dvd order (mult_of R). phi' i)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i1 \<in> {d. d dvd order (mult_of R)} \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = ?i1} = phi' ?i1

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
hence "?N (order (mult_of R)) > 0"
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> {d. d dvd order (mult_of R)} \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = ?i1} = phi' ?i1

goal (1 subgoal):
 1. 0 < card {a \<in> carrier (mult_of R). G.ord a = order (mult_of R)}
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> {d. d dvd order (mult_of R)} \<Longrightarrow> card {a \<in> carrier (mult_of R). G.ord a = ?i1} = phi' ?i1
0 < order (mult_of R)

goal (1 subgoal):
 1. 0 < card {a \<in> carrier (mult_of R). G.ord a = order (mult_of R)}
[PROOF STEP]
by (simp add: phi'_nonzero)
[PROOF STATE]
proof (state)
this:
0 < card {a \<in> carrier (mult_of R). G.ord a = order (mult_of R)}

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < card {a \<in> carrier (mult_of R). G.ord a = order (mult_of R)}
[PROOF STEP]
obtain a where a:"a \<in> carrier (mult_of R)" and a_ord:"group.ord (mult_of R) a = order (mult_of R)"
[PROOF STATE]
proof (prove)
using this:
0 < card {a \<in> carrier (mult_of R). G.ord a = order (mult_of R)}

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> carrier (mult_of R); G.ord a = order (mult_of R)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: card_gt_0_iff)
[PROOF STATE]
proof (state)
this:
a \<in> carrier (mult_of R)
G.ord a = order (mult_of R)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
hence set_eq:"{a[^]i | i::nat. i \<in> UNIV} = (\<lambda>x. a[^]x) ` {0 .. group.ord (mult_of R) a - 1}"
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (mult_of R)
G.ord a = order (mult_of R)

goal (1 subgoal):
 1. {a [^] i |i. i \<in> UNIV} = ([^]) a ` {0..G.ord a - 1}
[PROOF STEP]
using G.ord_elems[OF finite']
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (mult_of R)
G.ord a = order (mult_of R)
?a \<in> carrier (mult_of R) \<Longrightarrow> {?a [^] x |x. x \<in> UNIV} = {?a [^] x |x. x \<in> {0..G.ord ?a - 1}}

goal (1 subgoal):
 1. {a [^] i |i. i \<in> UNIV} = ([^]) a ` {0..G.ord a - 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{a [^] i |i. i \<in> UNIV} = ([^]) a ` {0..G.ord a - 1}

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
have card_eq:"card ((\<lambda>x. a[^]x) ` {0 .. group.ord (mult_of R) a - 1}) = card {0 .. group.ord (mult_of R) a - 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (([^]) a ` {0..G.ord a - 1}) = card {0..G.ord a - 1}
[PROOF STEP]
by (intro card_image G.ord_inj finite' a)
[PROOF STATE]
proof (state)
this:
card (([^]) a ` {0..G.ord a - 1}) = card {0..G.ord a - 1}

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
hence "card ((\<lambda> x . a[^]x) ` {0 .. group.ord (mult_of R) a - 1}) = card {0 ..order (mult_of R) - 1}"
[PROOF STATE]
proof (prove)
using this:
card (([^]) a ` {0..G.ord a - 1}) = card {0..G.ord a - 1}

goal (1 subgoal):
 1. card (([^]) a ` {0..G.ord a - 1}) = card {0..order (mult_of R) - 1}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
card (([^]) a ` {0..G.ord a - 1}) = card {0..G.ord a - 1}
finite (carrier R)

goal (1 subgoal):
 1. card (([^]) a ` {0..G.ord a - 1}) = card {0..order (mult_of R) - 1}
[PROOF STEP]
by (simp add: card_eq a_ord)
[PROOF STATE]
proof (state)
this:
card (([^]) a ` {0..G.ord a - 1}) = card {0..order (mult_of R) - 1}

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
hence card_R_minus_1:"card {a[^]i | i::nat. i \<in> UNIV} =  order (mult_of R)"
[PROOF STATE]
proof (prove)
using this:
card (([^]) a ` {0..G.ord a - 1}) = card {0..order (mult_of R) - 1}

goal (1 subgoal):
 1. card {a [^] i |i. i \<in> UNIV} = order (mult_of R)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
card (([^]) a ` {0..G.ord a - 1}) = card {0..order (mult_of R) - 1}
0 < order (mult_of R)

goal (1 subgoal):
 1. card {a [^] i |i. i \<in> UNIV} = order (mult_of R)
[PROOF STEP]
by (subst set_eq) auto
[PROOF STATE]
proof (state)
this:
card {a [^] i |i. i \<in> UNIV} = order (mult_of R)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
have **:"{a[^]i | i::nat. i \<in> UNIV} \<subseteq> carrier (mult_of R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a [^] i |i. i \<in> UNIV} \<subseteq> carrier (mult_of R)
[PROOF STEP]
using G.nat_pow_closed[OF a]
[PROOF STATE]
proof (prove)
using this:
a [^] ?n \<in> carrier (mult_of R)

goal (1 subgoal):
 1. {a [^] i |i. i \<in> UNIV} \<subseteq> carrier (mult_of R)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{a [^] i |i. i \<in> UNIV} \<subseteq> carrier (mult_of R)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
with _
[PROOF STATE]
proof (chain)
picking this:
PROP ?psi \<Longrightarrow> PROP ?psi
{a [^] i |i. i \<in> UNIV} \<subseteq> carrier (mult_of R)
[PROOF STEP]
have "carrier (mult_of R) = {a[^]i|i::nat. i \<in> UNIV}"
[PROOF STATE]
proof (prove)
using this:
PROP ?psi \<Longrightarrow> PROP ?psi
{a [^] i |i. i \<in> UNIV} \<subseteq> carrier (mult_of R)

goal (1 subgoal):
 1. carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
by (rule card_seteq[symmetric]) (simp_all add: card_R_minus_1 finite Coset.order_def del: UNIV_I)
[PROOF STATE]
proof (state)
this:
carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
using a a_ord
[PROOF STATE]
proof (prove)
using this:
carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
a \<in> carrier (mult_of R)
G.ord a = order (mult_of R)

goal (1 subgoal):
 1. \<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>a\<in>carrier (mult_of R). G.ord a = order (mult_of R) \<and> carrier (mult_of R) = {a [^] i |i. i \<in> UNIV}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hermitian_decomp_real_eigvals:
  assumes "hermitian_decomp A B U"
  shows "\<forall>i < dim_row B. B$$(i, i) \<in> Reals"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<dim_row B. B $$ (i, i) \<in> \<real>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hermitian_decomp A B U

goal (1 subgoal):
 1. \<forall>i<dim_row B. B $$ (i, i) \<in> \<real>
[PROOF STEP]
unfolding hermitian_decomp_def
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A B U (Complex_Matrix.adjoint U) \<and> diagonal_mat B \<and> diag_mat B = eigvals A \<and> Complex_Matrix.unitary U \<and> (\<forall>i<dim_row B. B $$ (i, i) \<in> \<real>)

goal (1 subgoal):
 1. \<forall>i<dim_row B. B $$ (i, i) \<in> \<real>
[PROOF STEP]
by simp


[STATEMENT]
lemma integral_mono_AE':
  fixes f::"_ \<Rightarrow> real"
  assumes "integrable M f" "AE x in M. g x \<le> f x" "AE x in M. 0 \<le> f x"
  shows "(\<integral>x. g x \<partial>M) \<le> (\<integral>x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L M g \<le> integral\<^sup>L M f
[PROOF STEP]
proof (cases "integrable M g")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integrable M g \<Longrightarrow> integral\<^sup>L M g \<le> integral\<^sup>L M f
 2. \<not> integrable M g \<Longrightarrow> integral\<^sup>L M g \<le> integral\<^sup>L M f
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
integrable M g

goal (2 subgoals):
 1. integrable M g \<Longrightarrow> integral\<^sup>L M g \<le> integral\<^sup>L M f
 2. \<not> integrable M g \<Longrightarrow> integral\<^sup>L M g \<le> integral\<^sup>L M f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L M g \<le> integral\<^sup>L M f
[PROOF STEP]
by (rule integral_mono_AE, auto simp add: assms True)
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M g \<le> integral\<^sup>L M f

goal (1 subgoal):
 1. \<not> integrable M g \<Longrightarrow> integral\<^sup>L M g \<le> integral\<^sup>L M f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> integrable M g \<Longrightarrow> integral\<^sup>L M g \<le> integral\<^sup>L M f
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> integrable M g

goal (1 subgoal):
 1. \<not> integrable M g \<Longrightarrow> integral\<^sup>L M g \<le> integral\<^sup>L M f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> integrable M g
[PROOF STEP]
have "(\<integral>x. g x \<partial>M) = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> integrable M g

goal (1 subgoal):
 1. integral\<^sup>L M g = 0
[PROOF STEP]
by (simp add: not_integrable_integral_eq)
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M g = 0

goal (1 subgoal):
 1. \<not> integrable M g \<Longrightarrow> integral\<^sup>L M g \<le> integral\<^sup>L M f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M g = 0

goal (1 subgoal):
 1. \<not> integrable M g \<Longrightarrow> integral\<^sup>L M g \<le> integral\<^sup>L M f
[PROOF STEP]
have "... \<le> (\<integral>x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> integral\<^sup>L M f
[PROOF STEP]
by (simp add: integral_nonneg_AE[OF assms(3)])
[PROOF STATE]
proof (state)
this:
0 \<le> integral\<^sup>L M f

goal (1 subgoal):
 1. \<not> integrable M g \<Longrightarrow> integral\<^sup>L M g \<le> integral\<^sup>L M f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>L M g \<le> integral\<^sup>L M f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L M g \<le> integral\<^sup>L M f

goal (1 subgoal):
 1. integral\<^sup>L M g \<le> integral\<^sup>L M f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M g \<le> integral\<^sup>L M f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma share_reconstruct_xor: "share x \<bind> (\<lambda>(a1, a2). share y \<bind> (\<lambda>(b1, b2).
          xor_protocol (a1, b1) (a2, b2) \<bind> (\<lambda>(a, b).
              reconstruct (a, b)))) = xor_evaluate x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. share x \<bind> (\<lambda>(a1, a2). share y \<bind> (\<lambda>(b1, b2). xor_protocol (a1, b1) (a2, b2) \<bind> (\<lambda>(a, b). reconstruct (a, b)))) = xor_evaluate x y
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. share x \<bind> (\<lambda>(a1, a2). share y \<bind> (\<lambda>(b1, b2). xor_protocol (a1, b1) (a2, b2) \<bind> (\<lambda>(a, b). reconstruct (a, b)))) = xor_evaluate x y
[PROOF STEP]
have "(((ya = (x = ya)) = (yb = (y = (\<not> yb))))) = (x = (\<not> y))" for ya yb
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((ya = (x = ya)) = (yb = (y = (\<not> yb)))) = (x = (\<not> y))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((?ya = (x = ?ya)) = (?yb = (y = (\<not> ?yb)))) = (x = (\<not> y))

goal (1 subgoal):
 1. share x \<bind> (\<lambda>(a1, a2). share y \<bind> (\<lambda>(b1, b2). xor_protocol (a1, b1) (a2, b2) \<bind> (\<lambda>(a, b). reconstruct (a, b)))) = xor_evaluate x y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((?ya = (x = ?ya)) = (?yb = (y = (\<not> ?yb)))) = (x = (\<not> y))

goal (1 subgoal):
 1. share x \<bind> (\<lambda>(a1, a2). share y \<bind> (\<lambda>(b1, b2). xor_protocol (a1, b1) (a2, b2) \<bind> (\<lambda>(a, b). reconstruct (a, b)))) = xor_evaluate x y
[PROOF STEP]
by(simp add: xor_protocol_def share_def reconstruct_def xor_evaluate_def bind_spmf_const)
[PROOF STATE]
proof (state)
this:
share x \<bind> (\<lambda>(a1, a2). share y \<bind> (\<lambda>(b1, b2). xor_protocol (a1, b1) (a2, b2) \<bind> (\<lambda>(a, b). reconstruct (a, b)))) = xor_evaluate x y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma content_cbox_if: "content (cbox a b) = (if cbox a b = {} then 0 else \<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (cbox a b) = (if cbox a b = {} then 0 else \<Prod>i\<in>Basis. b \<bullet> i - a \<bullet> i)
[PROOF STEP]
by (simp add: content_cbox')


[STATEMENT]
lemma ordered_map_image:
  assumes "finite S" "is_map S"
  shows "map (\<lambda>(a, b). (a, f a b)) (ordered_map S) = ordered_map ((\<lambda>(a, b). (a, f a b)) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>(a, b). (a, f a b)) (ordered_map S) = ordered_map ((\<lambda>(a, b). (a, f a b)) ` S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
is_map S

goal (1 subgoal):
 1. map (\<lambda>(a, b). (a, f a b)) (ordered_map S) = ordered_map ((\<lambda>(a, b). (a, f a b)) ` S)
[PROOF STEP]
unfolding ordered_map_def list.map_comp image_comp
[PROOF STATE]
proof (prove)
using this:
finite S
is_map S

goal (1 subgoal):
 1. map ((\<lambda>(a, b). (a, f a b)) \<circ> get_map S) (sorted_list_of_set (fst ` S)) = map (get_map ((\<lambda>(a, b). (a, f a b)) ` S)) (sorted_list_of_set ((fst \<circ> (\<lambda>(a, b). (a, f a b))) ` S))
[PROOF STEP]
by (auto simp: fst_def[abs_def] comp_def case_prod_twice get_map_map)


[STATEMENT]
lemma solution_preflect:
  assumes "t0 \<in> T"
  assumes sol: "(x solves_ode f) T X"
  shows "((\<lambda>t. x (preflect t0 t)) solves_ode (\<lambda>t x. - f (preflect t0 t) x)) (preflect t0 ` T) X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. x (preflect t0 t)) solves_ode (\<lambda>t x. - f (preflect t0 t) x)) (preflect t0 ` T) X
[PROOF STEP]
using sol \<open>t0 \<in> T\<close>
[PROOF STATE]
proof (prove)
using this:
(x solves_ode f) T X
t0 \<in> T

goal (1 subgoal):
 1. ((\<lambda>t. x (preflect t0 t)) solves_ode (\<lambda>t x. - f (preflect t0 t) x)) (preflect t0 ` T) X
[PROOF STEP]
by (simp_all add: preflect_def image_image preflect_solution[of t0])


[STATEMENT]
lemma ccINF_mono:
  "countable A \<Longrightarrow> countable B \<Longrightarrow> (\<And>m. m \<in> B \<Longrightarrow> \<exists>n\<in>A. f n \<le> g m) \<Longrightarrow> (INF n\<in>A. f n) \<le> (INF n\<in>B. g n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>countable A; countable B; \<And>m. m \<in> B \<Longrightarrow> \<exists>n\<in>A. f n \<le> g m\<rbrakk> \<Longrightarrow> Inf (f ` A) \<le> Inf (g ` B)
[PROOF STEP]
using ccInf_mono [of "g ` B" "f ` A"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>countable (g ` B); countable (f ` A); \<And>b. b \<in> g ` B \<Longrightarrow> \<exists>a\<in>f ` A. a \<le> b\<rbrakk> \<Longrightarrow> Inf (f ` A) \<le> Inf (g ` B)

goal (1 subgoal):
 1. \<lbrakk>countable A; countable B; \<And>m. m \<in> B \<Longrightarrow> \<exists>n\<in>A. f n \<le> g m\<rbrakk> \<Longrightarrow> Inf (f ` A) \<le> Inf (g ` B)
[PROOF STEP]
by auto


[STATEMENT]
lemma complex_mult_cnj: "z * cnj z = complex_of_real ((Re z)\<^sup>2 + (Im z)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z * cnj z = complex_of_real ((Re z)\<^sup>2 + (Im z)\<^sup>2)
[PROOF STEP]
by (simp add: complex_eq_iff power2_eq_square)


[STATEMENT]
lemma set_integrable_bound:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
    and g :: "'a \<Rightarrow> 'c::{banach, second_countable_topology}"
  shows "set_integrable M A f \<Longrightarrow> set_borel_measurable M A g \<Longrightarrow>
           (AE x in M. x \<in> A \<longrightarrow> norm (g x) \<le> norm (f x)) \<Longrightarrow> set_integrable M A g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set_integrable M A f; set_borel_measurable M A g; AE x\<in>A in M. norm (g x) \<le> norm (f x)\<rbrakk> \<Longrightarrow> set_integrable M A g
[PROOF STEP]
unfolding set_integrable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x); set_borel_measurable M A g; AE x\<in>A in M. norm (g x) \<le> norm (f x)\<rbrakk> \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R g x)
[PROOF STEP]
apply (erule Bochner_Integration.integrable_bound)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>set_borel_measurable M A g; AE x\<in>A in M. norm (g x) \<le> norm (f x)\<rbrakk> \<Longrightarrow> (\<lambda>x. indicat_real A x *\<^sub>R g x) \<in> borel_measurable M
 2. \<lbrakk>set_borel_measurable M A g; AE x\<in>A in M. norm (g x) \<le> norm (f x)\<rbrakk> \<Longrightarrow> AE x in M. norm (indicat_real A x *\<^sub>R g x) \<le> norm (indicat_real A x *\<^sub>R f x)
[PROOF STEP]
apply (simp add: set_borel_measurable_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set_borel_measurable M A g; AE x\<in>A in M. norm (g x) \<le> norm (f x)\<rbrakk> \<Longrightarrow> AE x in M. norm (indicat_real A x *\<^sub>R g x) \<le> norm (indicat_real A x *\<^sub>R f x)
[PROOF STEP]
apply (erule eventually_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>set_borel_measurable M A g; x \<in> A \<longrightarrow> norm (g x) \<le> norm (f x)\<rbrakk> \<Longrightarrow> norm (indicat_real A x *\<^sub>R g x) \<le> norm (indicat_real A x *\<^sub>R f x)
[PROOF STEP]
apply (auto simp: indicator_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_ivl_integral_nonneg:
  fixes f :: "real \<Rightarrow> real"
  assumes "(f has_ivl_integral i) a b"
    and "\<And>x. a \<le> x \<Longrightarrow> x \<le> b \<Longrightarrow> 0 \<le> f x"
    and "\<And>x. b \<le> x \<Longrightarrow> x \<le> a \<Longrightarrow> f x \<le> 0"
  shows "0 \<le> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> i
[PROOF STEP]
using assms has_integral_nonneg[of f i "{a .. b}"] has_integral_nonpos[of f "-i" "{b .. a}"]
[PROOF STATE]
proof (prove)
using this:
(f has_ivl_integral i) a b
\<lbrakk>a \<le> ?x; ?x \<le> b\<rbrakk> \<Longrightarrow> 0 \<le> f ?x
\<lbrakk>b \<le> ?x; ?x \<le> a\<rbrakk> \<Longrightarrow> f ?x \<le> 0
\<lbrakk>(f has_integral i) {a..b}; \<And>x. x \<in> {a..b} \<Longrightarrow> 0 \<le> f x\<rbrakk> \<Longrightarrow> 0 \<le> i
\<lbrakk>(f has_integral - i) {b..a}; \<forall>x\<in>{b..a}. f x \<le> 0\<rbrakk> \<Longrightarrow> - i \<le> 0

goal (1 subgoal):
 1. 0 \<le> i
[PROOF STEP]
by (auto simp: has_ivl_integral_def Ball_def not_le split: if_split_asm)


[STATEMENT]
lemma bigtheta_const_ln_powr [simp]: "a > 0 \<Longrightarrow> (\<lambda>x::real. ln (a*x) powr d) \<in> \<Theta>(\<lambda>x. ln x powr d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a \<Longrightarrow> (\<lambda>x. ln (a * x) powr d) \<in> \<Theta>(\<lambda>x. ln x powr d)
[PROOF STEP]
by (intro bigthetaI_tendsto[of 1] tendsto_ln_powr_over_ln_powr'') simp


[STATEMENT]
lemma s1_s2_P2:
  assumes "x < q" "xa < q" "xb < q" "xc < q" "y < q"
  shows "((y, xa, (xb * xa + q - xc) mod q, (x + xb) mod q), (x * ((y + q - xa) mod q) + q - xc) mod q, ((x + xb) mod q * xa + q - (xb * xa + q - xc) mod q) mod q) =
         ((y, xa, (xb * xa + q - xc) mod q, (x + xb) mod q), (x * ((y + q - xa) mod q) + q - xc) mod q, (x * y + q - (x * ((y + q - xa) mod q) + q - xc) mod q) mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((y, xa, (xb * xa + q - xc) mod q, (x + xb) mod q), (x * ((y + q - xa) mod q) + q - xc) mod q, ((x + xb) mod q * xa + q - (xb * xa + q - xc) mod q) mod q) = ((y, xa, (xb * xa + q - xc) mod q, (x + xb) mod q), (x * ((y + q - xa) mod q) + q - xc) mod q, (x * y + q - (x * ((y + q - xa) mod q) + q - xc) mod q) mod q)
[PROOF STEP]
using assms s1_s2
[PROOF STATE]
proof (prove)
using this:
x < q
xa < q
xb < q
xc < q
y < q
\<lbrakk>?x < q; ?a < q; ?b < q; ?r < q; ?y < q\<rbrakk> \<Longrightarrow> ((?x + ?a) mod q * ?b + q - (?a * ?b + q - ?r) mod q) mod q = (?x * ?y + q - (?x * ((?y + q - ?b) mod q) + q - ?r) mod q) mod q

goal (1 subgoal):
 1. ((y, xa, (xb * xa + q - xc) mod q, (x + xb) mod q), (x * ((y + q - xa) mod q) + q - xc) mod q, ((x + xb) mod q * xa + q - (xb * xa + q - xc) mod q) mod q) = ((y, xa, (xb * xa + q - xc) mod q, (x + xb) mod q), (x * ((y + q - xa) mod q) + q - xc) mod q, (x * y + q - (x * ((y + q - xa) mod q) + q - xc) mod q) mod q)
[PROOF STEP]
by metis


[STATEMENT]
lemma HMSet_diff: "HMSet (A - B) = HMSet A - HMSet B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HMSet (A - B) = HMSet A - HMSet B
[PROOF STEP]
by (simp add: minus_hmultiset_def)


[STATEMENT]
lemma split_01_prod: "{0..1::real} \<times> X = ({0..1/2} \<times> X) \<union> ({1/2..1} \<times> X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..1} \<times> X = {0..1 / 2} \<times> X \<union> {1 / 2..1} \<times> X
[PROOF STEP]
by force


[STATEMENT]
lemma "(2::int) + 3 = 5"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 + 3 = 5
[PROOF STEP]
by normalization


[STATEMENT]
theorem (in Module) misom2:"\<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N\<rbrakk> \<Longrightarrow>
                           (M /\<^sub>m H) /\<^sub>m (N \<^sub>s/\<^sub>M H) \<cong>\<^bsub>R\<^esub> (M /\<^sub>m N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N\<rbrakk> \<Longrightarrow> M /\<^sub>m H /\<^sub>m (N \<^sub>s/\<^sub>M H) \<cong>\<^bsub>R\<^esub> M /\<^sub>m N
[PROOF STEP]
apply (frule misom2Tr [of H N], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N; M /\<^sub>m H /\<^sub>m carrier (mdl M N /\<^sub>m H) \<cong>\<^bsub>R\<^esub> M /\<^sub>m N\<rbrakk> \<Longrightarrow> M /\<^sub>m H /\<^sub>m (N \<^sub>s/\<^sub>M H) \<cong>\<^bsub>R\<^esub> M /\<^sub>m N
[PROOF STEP]
apply (simp add:eq_class_of_Submodule)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma prefix_iff: "(xs <= zs) = (\<exists>ys. zs = xs@ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs \<le> zs) = (\<exists>ys. zs = xs @ ys)
[PROOF STEP]
apply (unfold prefix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((xs, zs) \<in> genPrefix Id) = (\<exists>ys. zs = xs @ ys)
[PROOF STEP]
apply (auto simp add: genPrefix_iff_nth nth_append)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs \<le> length zs; \<forall>i<length xs. xs ! i = zs ! i\<rbrakk> \<Longrightarrow> \<exists>ys. zs = xs @ ys
[PROOF STEP]
apply (rule_tac x = "drop (length xs) zs" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs \<le> length zs; \<forall>i<length xs. xs ! i = zs ! i\<rbrakk> \<Longrightarrow> zs = xs @ drop (length xs) zs
[PROOF STEP]
apply (rule nth_equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>length xs \<le> length zs; \<forall>i<length xs. xs ! i = zs ! i\<rbrakk> \<Longrightarrow> length zs = length (xs @ drop (length xs) zs)
 2. \<And>i. \<lbrakk>length xs \<le> length zs; \<forall>i<length xs. xs ! i = zs ! i; i < length zs\<rbrakk> \<Longrightarrow> zs ! i = (xs @ drop (length xs) zs) ! i
[PROOF STEP]
apply (simp_all (no_asm_simp) add: nth_append)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma translation_inverse_eq [simp]:
  assumes [simp]: "a \<in> G"
  shows "transformation.sub.inverse (a)\<^sub>R = (inverse a)\<^sub>R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transformation.sub.inverse (a)\<^sub>R = (inverse a)\<^sub>R
[PROOF STEP]
proof (rule transformation.sub.inverse_equality)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. compose G (a)\<^sub>R (inverse a)\<^sub>R = identity G
 2. compose G (inverse a)\<^sub>R (a)\<^sub>R = identity G
 3. (a)\<^sub>R \<in> Translations
 4. (inverse a)\<^sub>R \<in> Translations
[PROOF STEP]
show "compose G (a)\<^sub>R (inverse a)\<^sub>R = identity G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compose G (a)\<^sub>R (inverse a)\<^sub>R = identity G
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
compose G (a)\<^sub>R (inverse a)\<^sub>R = identity G

goal (3 subgoals):
 1. compose G (inverse a)\<^sub>R (a)\<^sub>R = identity G
 2. (a)\<^sub>R \<in> Translations
 3. (inverse a)\<^sub>R \<in> Translations
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. compose G (inverse a)\<^sub>R (a)\<^sub>R = identity G
 2. (a)\<^sub>R \<in> Translations
 3. (inverse a)\<^sub>R \<in> Translations
[PROOF STEP]
show "compose G (inverse a)\<^sub>R (a)\<^sub>R = identity G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compose G (inverse a)\<^sub>R (a)\<^sub>R = identity G
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
compose G (inverse a)\<^sub>R (a)\<^sub>R = identity G

goal (2 subgoals):
 1. (a)\<^sub>R \<in> Translations
 2. (inverse a)\<^sub>R \<in> Translations
[PROOF STEP]
qed auto


[STATEMENT]
lemma (in group) subgroups_card_coprime_inter_card_one:
  assumes "subgroup H G" "subgroup J G" "coprime (card H) (card J)"
  shows "card (H \<inter> J) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (H \<inter> J) = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (H \<inter> J) = 1
[PROOF STEP]
from assms inter_subgroup_dvd_card
[PROOF STATE]
proof (chain)
picking this:
subgroup H G
subgroup J G
coprime (card H) (card J)
\<lbrakk>subgroup ?H G; subgroup ?J G\<rbrakk> \<Longrightarrow> card (?H \<inter> ?J) dvd card ?H
[PROOF STEP]
have "is_unit (card (H \<inter> J))"
[PROOF STATE]
proof (prove)
using this:
subgroup H G
subgroup J G
coprime (card H) (card J)
\<lbrakk>subgroup ?H G; subgroup ?J G\<rbrakk> \<Longrightarrow> card (?H \<inter> ?J) dvd card ?H

goal (1 subgoal):
 1. is_unit (card (H \<inter> J))
[PROOF STEP]
unfolding coprime_def
[PROOF STATE]
proof (prove)
using this:
subgroup H G
subgroup J G
\<forall>c. c dvd card H \<longrightarrow> c dvd card J \<longrightarrow> is_unit c
\<lbrakk>subgroup ?H G; subgroup ?J G\<rbrakk> \<Longrightarrow> card (?H \<inter> ?J) dvd card ?H

goal (1 subgoal):
 1. is_unit (card (H \<inter> J))
[PROOF STEP]
by (metis assms(3) coprime_common_divisor inf_commute)
[PROOF STATE]
proof (state)
this:
is_unit (card (H \<inter> J))

goal (1 subgoal):
 1. card (H \<inter> J) = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_unit (card (H \<inter> J))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
is_unit (card (H \<inter> J))

goal (1 subgoal):
 1. card (H \<inter> J) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (H \<inter> J) = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sqrt_ub_pos_pos_1:
  assumes "sqrt x < b" and "0 < b" and "0 < x"
  shows "sqrt x < (b + x / b)/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt x < (b + x / b) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sqrt x < (b + x / b) / 2
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
sqrt x < b
0 < b
0 < x
[PROOF STEP]
have "0 < (b - sqrt x)\<^sup>2 "
[PROOF STATE]
proof (prove)
using this:
sqrt x < b
0 < b
0 < x

goal (1 subgoal):
 1. 0 < (b - sqrt x)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < (b - sqrt x)\<^sup>2

goal (1 subgoal):
 1. sqrt x < (b + x / b) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 < (b - sqrt x)\<^sup>2

goal (1 subgoal):
 1. sqrt x < (b + x / b) / 2
[PROOF STEP]
have "\<dots> = b\<^sup>2 - 2 * b * sqrt x + (sqrt x)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - sqrt x)\<^sup>2 = b\<^sup>2 - 2 * b * sqrt x + (sqrt x)\<^sup>2
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
(b - sqrt x)\<^sup>2 = b\<^sup>2 - 2 * b * sqrt x + (sqrt x)\<^sup>2

goal (1 subgoal):
 1. sqrt x < (b + x / b) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - sqrt x)\<^sup>2 = b\<^sup>2 - 2 * b * sqrt x + (sqrt x)\<^sup>2

goal (1 subgoal):
 1. sqrt x < (b + x / b) / 2
[PROOF STEP]
have "\<dots> = b\<^sup>2 - 2 * b * sqrt x + x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b\<^sup>2 - 2 * b * sqrt x + (sqrt x)\<^sup>2 = b\<^sup>2 - 2 * b * sqrt x + x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sqrt x < b
0 < b
0 < x

goal (1 subgoal):
 1. b\<^sup>2 - 2 * b * sqrt x + (sqrt x)\<^sup>2 = b\<^sup>2 - 2 * b * sqrt x + x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b\<^sup>2 - 2 * b * sqrt x + (sqrt x)\<^sup>2 = b\<^sup>2 - 2 * b * sqrt x + x

goal (1 subgoal):
 1. sqrt x < (b + x / b) / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 < b\<^sup>2 - 2 * b * sqrt x + x
[PROOF STEP]
have "0 < b\<^sup>2 - 2 * b * sqrt x + x"
[PROOF STATE]
proof (prove)
using this:
0 < b\<^sup>2 - 2 * b * sqrt x + x

goal (1 subgoal):
 1. 0 < b\<^sup>2 - 2 * b * sqrt x + x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
0 < b\<^sup>2 - 2 * b * sqrt x + x

goal (1 subgoal):
 1. sqrt x < (b + x / b) / 2
[PROOF STEP]
hence "0 < b / 2 - sqrt x + x / (2 * b)"
[PROOF STATE]
proof (prove)
using this:
0 < b\<^sup>2 - 2 * b * sqrt x + x

goal (1 subgoal):
 1. 0 < b / 2 - sqrt x + x / (2 * b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < b\<^sup>2 - 2 * b * sqrt x + x
sqrt x < b
0 < b
0 < x

goal (1 subgoal):
 1. 0 < b / 2 - sqrt x + x / (2 * b)
[PROOF STEP]
by (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
0 < b / 2 - sqrt x + x / (2 * b)

goal (1 subgoal):
 1. sqrt x < (b + x / b) / 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < b / 2 - sqrt x + x / (2 * b)

goal (1 subgoal):
 1. sqrt x < (b + x / b) / 2
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
sqrt x < (b + x / b) / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_restriction_fun_singleton: "
  set_restriction_fun P {a} = (if P a then {a} else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_restriction_fun P {a} = (if P a then {a} else {})
[PROOF STEP]
unfolding set_restriction_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> {a}. P x} = (if P a then {a} else {})
[PROOF STEP]
by force


[STATEMENT]
lemma fdia_bbox_galois: "(\<forall>x. ( |R\<rangle> f x) \<le> g x) \<longleftrightarrow> (\<forall>x. f x \<le> [R| g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x.  |R\<rangle> f x \<le> g x) = (\<forall>x. f x \<le> [R| g x)
[PROOF STEP]
apply (standard, simp_all add: fdia_def bbox_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x. \<Squnion>{f y |y. (x, y) \<in> R} \<le> g x \<Longrightarrow> \<forall>x. f x \<le> \<Sqinter>{g xa |xa. (xa, x) \<in> R}
 2. \<forall>x. f x \<le> \<Sqinter>{g xa |xa. (xa, x) \<in> R} \<Longrightarrow> \<forall>x. \<Squnion>{f y |y. (x, y) \<in> R} \<le> g x
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<forall>x. \<Squnion>{f y |y. (x, y) \<in> R} \<le> g x \<Longrightarrow> f x \<le> \<Sqinter>{g xa |xa. (xa, x) \<in> R}
 2. \<And>x. \<forall>x. f x \<le> \<Sqinter>{g xa |xa. (xa, x) \<in> R} \<Longrightarrow> \<Squnion>{f y |y. (x, y) \<in> R} \<le> g x
[PROOF STEP]
apply (rule Inf_greatest)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x xa. \<lbrakk>\<forall>x. \<Squnion>{f y |y. (x, y) \<in> R} \<le> g x; xa \<in> {g xa |xa. (xa, x) \<in> R}\<rbrakk> \<Longrightarrow> f x \<le> xa
 2. \<And>x. \<forall>x. f x \<le> \<Sqinter>{g xa |xa. (xa, x) \<in> R} \<Longrightarrow> \<Squnion>{f y |y. (x, y) \<in> R} \<le> g x
[PROOF STEP]
apply (force simp: Sup_le_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<forall>x. f x \<le> \<Sqinter>{g xa |xa. (xa, x) \<in> R} \<Longrightarrow> \<Squnion>{f y |y. (x, y) \<in> R} \<le> g x
[PROOF STEP]
apply (rule Sup_least)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>\<forall>x. f x \<le> \<Sqinter>{g xa |xa. (xa, x) \<in> R}; xa \<in> {f y |y. (x, y) \<in> R}\<rbrakk> \<Longrightarrow> xa \<le> g x
[PROOF STEP]
by (force simp: le_Inf_iff)


[STATEMENT]
lemma Bernstein_Poly_01: "Bernstein_Poly j p 0 1 = Bernstein_Poly_01 j p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bernstein_Poly j p 0 1 = Bernstein_Poly_01 j p
[PROOF STEP]
by (auto simp: Bernstein_Poly_def Bernstein_Poly_01_def monom_altdef)


[STATEMENT]
lemma nu_meet_precong: "\<nu> x \<le> \<nu> y \<Longrightarrow> \<nu> (x \<sqinter> z) \<le> \<nu> (y \<sqinter> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nu> x \<le> \<nu> y \<Longrightarrow> \<nu> (x \<sqinter> z) \<le> \<nu> (y \<sqinter> z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nu> x \<le> \<nu> y \<Longrightarrow> \<nu> (x \<sqinter> z) \<le> \<nu> (y \<sqinter> z)
[PROOF STEP]
assume "\<nu> x \<le> \<nu> y"
[PROOF STATE]
proof (state)
this:
\<nu> x \<le> \<nu> y

goal (1 subgoal):
 1. \<nu> x \<le> \<nu> y \<Longrightarrow> \<nu> (x \<sqinter> z) \<le> \<nu> (y \<sqinter> z)
[PROOF STEP]
hence "\<nu> y = \<nu> x + \<nu> y"
[PROOF STATE]
proof (prove)
using this:
\<nu> x \<le> \<nu> y

goal (1 subgoal):
 1. \<nu> y = \<nu> x + \<nu> y
[PROOF STEP]
using local.less_eq_def
[PROOF STATE]
proof (prove)
using this:
\<nu> x \<le> \<nu> y
(?x \<le> ?y) = (?x + ?y = ?y)

goal (1 subgoal):
 1. \<nu> y = \<nu> x + \<nu> y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<nu> y = \<nu> x + \<nu> y

goal (1 subgoal):
 1. \<nu> x \<le> \<nu> y \<Longrightarrow> \<nu> (x \<sqinter> z) \<le> \<nu> (y \<sqinter> z)
[PROOF STEP]
hence "\<nu> (y \<sqinter> z) = \<nu> (x \<sqinter> z) + \<nu> (y \<sqinter> z)"
[PROOF STATE]
proof (prove)
using this:
\<nu> y = \<nu> x + \<nu> y

goal (1 subgoal):
 1. \<nu> (y \<sqinter> z) = \<nu> (x \<sqinter> z) + \<nu> (y \<sqinter> z)
[PROOF STEP]
by (metis (no_types) local.lat_dist4 nu_meet)
[PROOF STATE]
proof (state)
this:
\<nu> (y \<sqinter> z) = \<nu> (x \<sqinter> z) + \<nu> (y \<sqinter> z)

goal (1 subgoal):
 1. \<nu> x \<le> \<nu> y \<Longrightarrow> \<nu> (x \<sqinter> z) \<le> \<nu> (y \<sqinter> z)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<nu> (y \<sqinter> z) = \<nu> (x \<sqinter> z) + \<nu> (y \<sqinter> z)

goal (1 subgoal):
 1. \<nu> (x \<sqinter> z) \<le> \<nu> (y \<sqinter> z)
[PROOF STEP]
using local.less_eq_def
[PROOF STATE]
proof (prove)
using this:
\<nu> (y \<sqinter> z) = \<nu> (x \<sqinter> z) + \<nu> (y \<sqinter> z)
(?x \<le> ?y) = (?x + ?y = ?y)

goal (1 subgoal):
 1. \<nu> (x \<sqinter> z) \<le> \<nu> (y \<sqinter> z)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<nu> (x \<sqinter> z) \<le> \<nu> (y \<sqinter> z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem regular_emptystr:  "regular {[]}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. regular {[]}
[PROOF STEP]
apply (auto simp: regular_def accepts_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>fsm. {[]} = {xs. \<exists>st st'. reaches fsm st xs st' \<and> st \<^bold>\<in> init fsm \<and> st' \<^bold>\<in> final fsm}
[PROOF STEP]
apply (rule exI [where x = NullStr], auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. reaches NullStr 0 x 0 \<Longrightarrow> x = []
[PROOF STEP]
apply (case_tac x, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Sigma_0: "\<forall> i \<le> n. (f (xs @ [i]) = 0) \<Longrightarrow>
                              Sigma f (xs @ [n]) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<le>n. f (xs @ [i]) = 0 \<Longrightarrow> UF.Sigma f (xs @ [n]) = 0
[PROOF STEP]
apply(induct n, simp add: Sigma.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>i\<le>n. f (xs @ [i]) = 0 \<Longrightarrow> UF.Sigma f (xs @ [n]) = 0; \<forall>i\<le>Suc n. f (xs @ [i]) = 0\<rbrakk> \<Longrightarrow> UF.Sigma f (xs @ [Suc n]) = 0
[PROOF STEP]
apply(simp add: Sigma_Suc_simp_rewrite)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nn_integral_count_space':
  assumes "finite A" "\<And>x. x \<in> B \<Longrightarrow> x \<notin> A \<Longrightarrow> f x = 0" "A \<subseteq> B"
  shows "(\<integral>\<^sup>+x. f x \<partial>count_space B) = (\<Sum>x\<in>A. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space B) f = sum f A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral\<^sup>N (count_space B) f = sum f A
[PROOF STEP]
have "(\<integral>\<^sup>+x. f x \<partial>count_space B) = (\<Sum>a | a \<in> B \<and> 0 < f a. f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space B) f = (\<Sum>a | a \<in> B \<and> 0 < f a. f a)
[PROOF STEP]
using assms(2,3)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> B; ?x \<notin> A\<rbrakk> \<Longrightarrow> f ?x = 0
A \<subseteq> B

goal (1 subgoal):
 1. integral\<^sup>N (count_space B) f = (\<Sum>a | a \<in> B \<and> 0 < f a. f a)
[PROOF STEP]
by (intro nn_integral_count_space finite_subset[OF _ \<open>finite A\<close>]) (auto simp: less_le)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space B) f = (\<Sum>a | a \<in> B \<and> 0 < f a. f a)

goal (1 subgoal):
 1. integral\<^sup>N (count_space B) f = sum f A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space B) f = (\<Sum>a | a \<in> B \<and> 0 < f a. f a)

goal (1 subgoal):
 1. integral\<^sup>N (count_space B) f = sum f A
[PROOF STEP]
have "\<dots> = (\<Sum>a\<in>A. f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a | a \<in> B \<and> 0 < f a. f a) = sum f A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
\<lbrakk>?x \<in> B; ?x \<notin> A\<rbrakk> \<Longrightarrow> f ?x = 0
A \<subseteq> B

goal (1 subgoal):
 1. (\<Sum>a | a \<in> B \<and> 0 < f a. f a) = sum f A
[PROOF STEP]
by (intro sum.mono_neutral_cong_left) (auto simp: less_le)
[PROOF STATE]
proof (state)
this:
(\<Sum>a | a \<in> B \<and> 0 < f a. f a) = sum f A

goal (1 subgoal):
 1. integral\<^sup>N (count_space B) f = sum f A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>N (count_space B) f = sum f A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>N (count_space B) f = sum f A

goal (1 subgoal):
 1. integral\<^sup>N (count_space B) f = sum f A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space B) f = sum f A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem goodsteins_theorem: "\<exists>i. goodstein i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. local.goodstein i = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>i. local.goodstein i = 0
[PROOF STEP]
let ?G = "\<lambda>i. encode (i + 2) 0 (goodstein i)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>i. local.goodstein i = 0
[PROOF STEP]
obtain i where
    "\<not> ?G i > ?G (i + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. \<not> encode (i + 1 + 2) 0 (local.goodstein (i + 1)) < encode (i + 2) 0 (local.goodstein i) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using wf_iff_no_infinite_down_chain[THEN iffD1, OF wf,
      unfolded not_ex not_all mem_Collect_eq prod.case, rule_format, of ?G]
[PROOF STATE]
proof (prove)
using this:
\<exists>x. \<not> encode (Suc x + 2) 0 (local.goodstein (Suc x)) < encode (x + 2) 0 (local.goodstein x)

goal (1 subgoal):
 1. (\<And>i. \<not> encode (i + 1 + 2) 0 (local.goodstein (i + 1)) < encode (i + 2) 0 (local.goodstein i) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> encode (i + 1 + 2) 0 (local.goodstein (i + 1)) < encode (i + 2) 0 (local.goodstein i)

goal (1 subgoal):
 1. \<exists>i. local.goodstein i = 0
[PROOF STEP]
hence "goodstein i = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> encode (i + 1 + 2) 0 (local.goodstein (i + 1)) < encode (i + 2) 0 (local.goodstein i)

goal (1 subgoal):
 1. local.goodstein i = 0
[PROOF STEP]
using goodstein_step
[PROOF STATE]
proof (prove)
using this:
\<not> encode (i + 1 + 2) 0 (local.goodstein (i + 1)) < encode (i + 2) 0 (local.goodstein i)
0 < local.goodstein ?i \<Longrightarrow> encode (?i + 3) 0 (local.goodstein (?i + 1)) < encode (?i + 2) 0 (local.goodstein ?i)

goal (1 subgoal):
 1. local.goodstein i = 0
[PROOF STEP]
by (metis add.assoc gr0I one_plus_numeral semiring_norm(3))
[PROOF STATE]
proof (state)
this:
local.goodstein i = 0

goal (1 subgoal):
 1. \<exists>i. local.goodstein i = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
local.goodstein i = 0

goal (1 subgoal):
 1. \<exists>i. local.goodstein i = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>i. local.goodstein i = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_insort1: "length (insort1 x xs) = length xs + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (insort1 x xs) = length xs + 1
[PROOF STEP]
apply(induction xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (insort1 x []) = length [] + 1
 2. \<And>a xs. length (insort1 x xs) = length xs + 1 \<Longrightarrow> length (insort1 x (a # xs)) = length (a # xs) + 1
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma center_dist:
  "dist x (center x y z) = Gromov_product_at x y z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x (center x y z) = Gromov_product_at x y z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist x (center x y z) = Gromov_product_at x y z
[PROOF STEP]
have "dist x y = dist x (center x y z) + dist (center x y z) y"
       "dist x z = dist x (center x y z) + dist (center x y z) z"
       "dist y z = dist y (center x y z) + dist (center x y z) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x y = dist x (center x y z) + dist (center x y z) y &&& dist x z = dist x (center x y z) + dist (center x y z) z &&& dist y z = dist y (center x y z) + dist (center x y z) z
[PROOF STEP]
by (auto simp add: geodesic_segment_dist geodesic_segment_unique)
[PROOF STATE]
proof (state)
this:
dist x y = dist x (center x y z) + dist (center x y z) y
dist x z = dist x (center x y z) + dist (center x y z) z
dist y z = dist y (center x y z) + dist (center x y z) z

goal (1 subgoal):
 1. dist x (center x y z) = Gromov_product_at x y z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dist x y = dist x (center x y z) + dist (center x y z) y
dist x z = dist x (center x y z) + dist (center x y z) z
dist y z = dist y (center x y z) + dist (center x y z) z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dist x y = dist x (center x y z) + dist (center x y z) y
dist x z = dist x (center x y z) + dist (center x y z) z
dist y z = dist y (center x y z) + dist (center x y z) z

goal (1 subgoal):
 1. dist x (center x y z) = Gromov_product_at x y z
[PROOF STEP]
unfolding Gromov_product_at_def
[PROOF STATE]
proof (prove)
using this:
dist x y = dist x (center x y z) + dist (center x y z) y
dist x z = dist x (center x y z) + dist (center x y z) z
dist y z = dist y (center x y z) + dist (center x y z) z

goal (1 subgoal):
 1. dist x (center x y z) = (dist x y + dist x z - dist y z) / 2
[PROOF STEP]
by (auto simp add: metric_space_class.dist_commute)
[PROOF STATE]
proof (state)
this:
dist x (center x y z) = Gromov_product_at x y z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma append_iff_take_drop:
  "w = u@v \<longleftrightarrow> (\<exists>k \<in> {0..length w}. u = take k w \<and> v = drop k w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w = u @ v) = (\<exists>k\<in>{0..length w}. u = take k w \<and> v = drop k w)
[PROOF STEP]
by (metis (full_types) append_eq_conv_conj append_take_drop_id atLeastAtMost_iff le0 le_add1 length_append)


[STATEMENT]
lemma sorted_by_lesseq [simp] :
  "sorted_by ((\<le>) :: ('a::{linorder}) => 'a => bool) = sorted"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_by (\<le>) = sorted
[PROOF STEP]
proof (rule ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. sorted_by (\<le>) x = sorted x
[PROOF STEP]
fix l :: "'a list"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. sorted_by (\<le>) x = sorted x
[PROOF STEP]
show "sorted_by (\<le>) l = sorted l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_by (\<le>) l = sorted l
[PROOF STEP]
proof (induct l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sorted_by (\<le>) [] = sorted []
 2. \<And>a l. sorted_by (\<le>) l = sorted l \<Longrightarrow> sorted_by (\<le>) (a # l) = sorted (a # l)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. sorted_by (\<le>) [] = sorted []
 2. \<And>a l. sorted_by (\<le>) l = sorted l \<Longrightarrow> sorted_by (\<le>) (a # l) = sorted (a # l)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_by (\<le>) [] = sorted []
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted_by (\<le>) [] = sorted []

goal (1 subgoal):
 1. \<And>a l. sorted_by (\<le>) l = sorted l \<Longrightarrow> sorted_by (\<le>) (a # l) = sorted (a # l)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l. sorted_by (\<le>) l = sorted l \<Longrightarrow> sorted_by (\<le>) (a # l) = sorted (a # l)
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
sorted_by (\<le>) xs = sorted xs

goal (1 subgoal):
 1. \<And>a l. sorted_by (\<le>) l = sorted l \<Longrightarrow> sorted_by (\<le>) (a # l) = sorted (a # l)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
sorted_by (\<le>) xs = sorted xs

goal (1 subgoal):
 1. sorted_by (\<le>) (x # xs) = sorted (x # xs)
[PROOF STEP]
by (smt (verit, best) list.inject sorted1 sorted2 sorted_by.elims(1))
[PROOF STATE]
proof (state)
this:
sorted_by (\<le>) (x # xs) = sorted (x # xs)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_by (\<le>) l = sorted l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma span_card_ge_dim:
  "B \<subseteq> V \<Longrightarrow> V \<subseteq> span B \<Longrightarrow> finite B \<Longrightarrow> dim V \<le> card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>B \<subseteq> V; V \<subseteq> span B; finite B\<rbrakk> \<Longrightarrow> dim V \<le> card B
[PROOF STEP]
by (simp add: dim_le_card)


[STATEMENT]
lemma time_replicate: "\<lbrakk>\<And>h. time x h \<le> c \<rbrakk> \<Longrightarrow> time (replicatei n x) h \<le> (1+(1+c)*n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>h. time x h \<le> c) \<Longrightarrow> time (replicatei n x) h \<le> 1 + (1 + c) * n
[PROOF STEP]
apply (induction n arbitrary: h)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>h. (\<And>h. time x h \<le> c) \<Longrightarrow> time (replicatei 0 x) h \<le> 1 + (1 + c) * 0
 2. \<And>n h. \<lbrakk>\<And>h. (\<And>h. time x h \<le> c) \<Longrightarrow> time (replicatei n x) h \<le> 1 + (1 + c) * n; \<And>h. time x h \<le> c\<rbrakk> \<Longrightarrow> time (replicatei (Suc n) x) h \<le> 1 + (1 + c) * Suc n
[PROOF STEP]
apply (simp add: time_simp algebra_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n h. \<lbrakk>\<And>h. (\<And>h. time x h \<le> c) \<Longrightarrow> time (replicatei n x) h \<le> 1 + (1 + c) * n; \<And>h. time x h \<le> c\<rbrakk> \<Longrightarrow> time (replicatei (Suc n) x) h \<le> 1 + (1 + c) * Suc n
[PROOF STEP]
apply (auto simp: time_simp fails_simp algebra_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n h. \<lbrakk>\<And>h. time (replicatei n x) h \<le> Suc (n + n * c); \<And>h. time x h \<le> c; \<not> fails x h; \<not> fails (replicatei n x) (the_heap x h)\<rbrakk> \<Longrightarrow> time x h + time (replicatei n x) (the_heap x h) \<le> Suc (n + (c + n * c))
[PROOF STEP]
by (metis add_le_mono group_cancel.add2 nat_arith.suc1)


[STATEMENT]
lemma le_t_stop_iff: "a \<noteq> 0 \<Longrightarrow> x \<le> t_stop \<longleftrightarrow> (if a < 0 then p' x \<ge> 0 else p' x \<le> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> (x \<le> t_stop) = (if a < 0 then 0 \<le> p' x else p' x \<le> 0)
[PROOF STEP]
by (auto simp: p'_def field_split_simps t_stop_def)


[STATEMENT]
lemma mod_sub_eq_mod_0_conv: "
  a + b \<le> (n::nat) \<Longrightarrow>
  ((n - a) mod m = b mod m) = ((n - (a + b)) mod m = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + b \<le> n \<Longrightarrow> ((n - a) mod m = b mod m) = ((n - (a + b)) mod m = 0)
[PROOF STEP]
by (insert mod_add[of "n-(a+b)" b m 0], simp)