[STATEMENT]
lemma simplicial_simplex_singular_face:
  fixes f :: "(nat \<Rightarrow> real) \<Rightarrow> nat \<Rightarrow> real"
  assumes ss: "simplicial_simplex p S f" and p: "1 \<le> p" "k \<le> p"
  shows "simplicial_simplex (p - Suc 0) S (singular_face p k f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simplicial_simplex (p - Suc 0) S (singular_face p k f)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. simplicial_simplex (p - Suc 0) S (singular_face p k f)
[PROOF STEP]
let ?X = "subtopology (powertop_real UNIV) S"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. simplicial_simplex (p - Suc 0) S (singular_face p k f)
[PROOF STEP]
obtain m where l: "singular_simplex p ?X (oriented_simplex p m)"
       and feq: "f = oriented_simplex p m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>m. \<lbrakk>singular_simplex p (subtopology (powertop_real UNIV) S) (oriented_simplex p m); f = oriented_simplex p m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
simplicial_simplex p S f
1 \<le> p
k \<le> p

goal (1 subgoal):
 1. (\<And>m. \<lbrakk>singular_simplex p (subtopology (powertop_real UNIV) S) (oriented_simplex p m); f = oriented_simplex p m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (force simp: simplicial_simplex_def)
[PROOF STATE]
proof (state)
this:
singular_simplex p (subtopology (powertop_real UNIV) S) (oriented_simplex p m)
f = oriented_simplex p m

goal (1 subgoal):
 1. simplicial_simplex (p - Suc 0) S (singular_face p k f)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
singular_simplex p (subtopology (powertop_real UNIV) S) (oriented_simplex p m)
f = oriented_simplex p m

goal (1 subgoal):
 1. simplicial_simplex (p - Suc 0) S (singular_face p k f)
[PROOF STEP]
have "singular_face p k f = oriented_simplex (p - Suc 0) (\<lambda>i. if i < k then m i else m (Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. singular_face p k f = oriented_simplex (p - Suc 0) (\<lambda>i. if i < k then m i else m (Suc i))
[PROOF STEP]
unfolding feq singular_face_def oriented_simplex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restrict ((\<lambda>x\<in>standard_simplex p. \<lambda>i. \<Sum>j\<le>p. m j i * x j) \<circ> simplical_face k) (standard_simplex (p - Suc 0)) = (\<lambda>x\<in>standard_simplex (p - Suc 0). \<lambda>i. \<Sum>j\<le>p - Suc 0. (if j < k then m j else m (Suc j)) i * x j)
[PROOF STEP]
apply (simp add: simplical_face_in_standard_simplex [OF p] restrict_compose_left subset_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restrict ((\<lambda>x i. \<Sum>j\<le>p. m j i * x j) \<circ> simplical_face k) (standard_simplex (p - Suc 0)) = (\<lambda>x\<in>standard_simplex (p - Suc 0). \<lambda>i. \<Sum>j\<le>p - Suc 0. (if j < k then m j else m (Suc j)) i * x j)
[PROOF STEP]
using sum.zero_middle [OF p, where 'a=real, symmetric]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j\<le>p - Suc 0. if j < k then ?g j else ?h j) = (\<Sum>j\<le>p. if j < k then ?g j else if j = k then 0 else ?h (j - Suc 0))

goal (1 subgoal):
 1. restrict ((\<lambda>x i. \<Sum>j\<le>p. m j i * x j) \<circ> simplical_face k) (standard_simplex (p - Suc 0)) = (\<lambda>x\<in>standard_simplex (p - Suc 0). \<lambda>i. \<Sum>j\<le>p - Suc 0. (if j < k then m j else m (Suc j)) i * x j)
[PROOF STEP]
unfolding simplical_face_def o_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j\<le>p - Suc 0. if j < k then ?g j else ?h j) = (\<Sum>j\<le>p. if j < k then ?g j else if j = k then 0 else ?h (j - Suc 0))

goal (1 subgoal):
 1. (\<lambda>x\<in>standard_simplex (p - Suc 0). \<lambda>i. \<Sum>j\<le>p. m j i * (if j < k then x j else if j = k then 0 else x (j - 1))) = (\<lambda>x\<in>standard_simplex (p - Suc 0). \<lambda>i. \<Sum>j\<le>p - Suc 0. (if j < k then m j else m (Suc j)) i * x j)
[PROOF STEP]
apply (simp add: if_distrib [of "\<lambda>x. _ * x"] if_distrib [of "\<lambda>f. f _ * _"] atLeast0AtMost cong: if_cong)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
singular_face p k f = oriented_simplex (p - Suc 0) (\<lambda>i. if i < k then m i else m (Suc i))

goal (1 subgoal):
 1. simplicial_simplex (p - Suc 0) S (singular_face p k f)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
singular_simplex p (subtopology (powertop_real UNIV) S) (oriented_simplex p m)
f = oriented_simplex p m
singular_face p k f = oriented_simplex (p - Suc 0) (\<lambda>i. if i < k then m i else m (Suc i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
singular_simplex p (subtopology (powertop_real UNIV) S) (oriented_simplex p m)
f = oriented_simplex p m
singular_face p k f = oriented_simplex (p - Suc 0) (\<lambda>i. if i < k then m i else m (Suc i))

goal (1 subgoal):
 1. simplicial_simplex (p - Suc 0) S (singular_face p k f)
[PROOF STEP]
using p simplicial_simplex_def singular_simplex_singular_face
[PROOF STATE]
proof (prove)
using this:
singular_simplex p (subtopology (powertop_real UNIV) S) (oriented_simplex p m)
f = oriented_simplex p m
singular_face p k f = oriented_simplex (p - Suc 0) (\<lambda>i. if i < k then m i else m (Suc i))
1 \<le> p
k \<le> p
simplicial_simplex ?p ?S ?f \<equiv> singular_simplex ?p (subtopology (powertop_real UNIV) ?S) ?f \<and> (\<exists>l. ?f = oriented_simplex ?p l)
\<lbrakk>singular_simplex ?p ?X ?f; 1 \<le> ?p; ?k \<le> ?p\<rbrakk> \<Longrightarrow> singular_simplex (?p - Suc 0) ?X (singular_face ?p ?k ?f)

goal (1 subgoal):
 1. simplicial_simplex (p - Suc 0) S (singular_face p k f)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
simplicial_simplex (p - Suc 0) S (singular_face p k f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integrable_scaleR_left[simp, intro]: "(c \<noteq> 0 \<Longrightarrow> integrable M f) \<Longrightarrow> integrable M (\<lambda>x. f x *\<^sub>R c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c \<noteq> (0::'a) \<Longrightarrow> integrable M f) \<Longrightarrow> integrable M (\<lambda>x. f x *\<^sub>R c)
[PROOF STEP]
unfolding integrable.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c \<noteq> (0::'a) \<Longrightarrow> Ex (has_bochner_integral M f)) \<Longrightarrow> Ex (has_bochner_integral M (\<lambda>x. f x *\<^sub>R c))
[PROOF STEP]
by fastforce


[STATEMENT]
lemma rqs_cost_exp_Suc':
  "rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * (\<Sum>i\<le>n. rqs_cost_exp i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
have "rqs_cost_exp (Suc n) = real n + (\<Sum>i\<le>n. rqs_cost_exp i + rqs_cost_exp (n - i)) / real (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + (\<Sum>i\<le>n. rqs_cost_exp i + rqs_cost_exp (n - i)) / real (Suc n)
[PROOF STEP]
by (rule rqs_cost_exp_Suc)
[PROOF STATE]
proof (state)
this:
rqs_cost_exp (Suc n) = real n + (\<Sum>i\<le>n. rqs_cost_exp i + rqs_cost_exp (n - i)) / real (Suc n)

goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rqs_cost_exp (Suc n) = real n + (\<Sum>i\<le>n. rqs_cost_exp i + rqs_cost_exp (n - i)) / real (Suc n)

goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
have "(\<Sum>i\<le>n. rqs_cost_exp i + rqs_cost_exp (n - i)) = (\<Sum>i\<le>n. rqs_cost_exp i) + (\<Sum>i\<le>n. rqs_cost_exp (n - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. rqs_cost_exp i + rqs_cost_exp (n - i)) = sum rqs_cost_exp {..n} + (\<Sum>i\<le>n. rqs_cost_exp (n - i))
[PROOF STEP]
by (simp add: sum.distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. rqs_cost_exp i + rqs_cost_exp (n - i)) = sum rqs_cost_exp {..n} + (\<Sum>i\<le>n. rqs_cost_exp (n - i))

goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. rqs_cost_exp i + rqs_cost_exp (n - i)) = sum rqs_cost_exp {..n} + (\<Sum>i\<le>n. rqs_cost_exp (n - i))

goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
have "(\<Sum>i\<le>n. rqs_cost_exp (n - i)) = (\<Sum>i\<le>n. rqs_cost_exp i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. rqs_cost_exp (n - i)) = sum rqs_cost_exp {..n}
[PROOF STEP]
by (intro sum.reindex_bij_witness[of _ "\<lambda>i. n - i" "\<lambda>i. n - i"]) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. rqs_cost_exp (n - i)) = sum rqs_cost_exp {..n}

goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. rqs_cost_exp (n - i)) = sum rqs_cost_exp {..n}

goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
have "\<dots> + \<dots> = 2 * \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum rqs_cost_exp {..n} + sum rqs_cost_exp {..n} = 2 * sum rqs_cost_exp {..n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum rqs_cost_exp {..n} + sum rqs_cost_exp {..n} = 2 * sum rqs_cost_exp {..n}

goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum rqs_cost_exp {..n} + sum rqs_cost_exp {..n} = 2 * sum rqs_cost_exp {..n}

goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
have "\<dots> / real (Suc n) = 2 / real (Suc n) * (\<Sum>i\<le>n. rqs_cost_exp i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * sum rqs_cost_exp {..n} / real (Suc n) = 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * sum rqs_cost_exp {..n} / real (Suc n) = 2 / real (Suc n) * sum rqs_cost_exp {..n}

goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}

goal (1 subgoal):
 1. rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rqs_cost_exp (Suc n) = real n + 2 / real (Suc n) * sum rqs_cost_exp {..n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma valid_path_equiv_valid_chain_list:
  assumes path_eq_chain: "chain_subdiv_path \<gamma> one_chain"
    and "boundary_chain one_chain" "\<forall>(k, \<gamma>) \<in> one_chain. valid_path \<gamma>"
  shows "valid_path \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_path \<gamma>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. valid_path \<gamma>
[PROOF STEP]
obtain l where l_props: "set l = one_chain" "distinct l" "rec_join l = \<gamma>" "valid_chain_list l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>l. \<lbrakk>set l = one_chain; distinct l; rec_join l = \<gamma>; valid_chain_list l\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using chain_subdiv_path.cases path_eq_chain
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>chain_subdiv_path ?a1.0 ?a2.0; \<And>l \<gamma>. \<lbrakk>?a1.0 = \<gamma>; ?a2.0 = set l; distinct l; rec_join l = \<gamma>; valid_chain_list l\<rbrakk> \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
chain_subdiv_path \<gamma> one_chain

goal (1 subgoal):
 1. (\<And>l. \<lbrakk>set l = one_chain; distinct l; rec_join l = \<gamma>; valid_chain_list l\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
set l = one_chain
distinct l
rec_join l = \<gamma>
valid_chain_list l

goal (1 subgoal):
 1. valid_path \<gamma>
[PROOF STEP]
show "valid_path \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_path \<gamma>
[PROOF STEP]
using joined_is_valid assms l_props
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>boundary_chain (set ?l); \<And>k \<gamma>. (k, \<gamma>) \<in> set ?l \<Longrightarrow> valid_path \<gamma>; valid_chain_list ?l\<rbrakk> \<Longrightarrow> valid_path (rec_join ?l)
chain_subdiv_path \<gamma> one_chain
boundary_chain one_chain
\<forall>(k, \<gamma>)\<in>one_chain. valid_path \<gamma>
set l = one_chain
distinct l
rec_join l = \<gamma>
valid_chain_list l

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isin_random_bst:
  assumes "finite A" "t \<in> set_pmf (random_bst A)"
  shows   "isin t x \<longleftrightarrow> x \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isin t x = (x \<in> A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. isin t x = (x \<in> A)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
t \<in> set_pmf (random_bst A)
[PROOF STEP]
have "bst t"
[PROOF STATE]
proof (prove)
using this:
finite A
t \<in> set_pmf (random_bst A)

goal (1 subgoal):
 1. bst t
[PROOF STEP]
by (auto dest: bst_random_bst)
[PROOF STATE]
proof (state)
this:
bst t

goal (1 subgoal):
 1. isin t x = (x \<in> A)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite A
t \<in> set_pmf (random_bst A)
bst t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A
t \<in> set_pmf (random_bst A)
bst t

goal (1 subgoal):
 1. isin t x = (x \<in> A)
[PROOF STEP]
by (simp add: isin_bst set_random_bst)
[PROOF STATE]
proof (state)
this:
isin t x = (x \<in> A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fixes f F
  defines "F \<equiv> \<lambda>lset xs. case xs of LNil \<Rightarrow> {} | LCons x xs \<Rightarrow> insert x (lset xs)"
  shows lset_conv_fixp: "lset \<equiv> ccpo.fixp (fun_lub Union) (fun_ord (\<subseteq>)) F" (is "_ \<equiv> ?fixp")
  and lset_mono: "\<And>x. monotone (fun_ord (\<subseteq>)) (\<subseteq>) (\<lambda>f. F f x)" (is "PROP ?mono")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lset \<equiv> lfp.fixp_fun F) &&& (\<And>x. monotone lfp.le_fun (\<subseteq>) (\<lambda>f. F f x))
[PROOF STEP]
proof(rule eq_reflection ext antisym subsetI)+
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x xa. xa \<in> lset x \<Longrightarrow> xa \<in> lfp.fixp_fun F x
 2. \<And>x. lfp.fixp_fun F x \<subseteq> lset x
 3. \<And>x. monotone lfp.le_fun (\<subseteq>) (\<lambda>f. F f x)
[PROOF STEP]
show mono: "PROP ?mono"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. monotone lfp.le_fun (\<subseteq>) (\<lambda>f. F f x)
[PROOF STEP]
unfolding F_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. monotone lfp.le_fun (\<subseteq>) (\<lambda>f. case x of LNil \<Rightarrow> {} | LCons x xs \<Rightarrow> insert x (f xs))
[PROOF STEP]
by(tactic \<open>Partial_Function.mono_tac @{context} 1\<close>)
[PROOF STATE]
proof (state)
this:
monotone lfp.le_fun (\<subseteq>) (\<lambda>f. F f ?x)

goal (2 subgoals):
 1. \<And>x xa. xa \<in> lset x \<Longrightarrow> xa \<in> lfp.fixp_fun F x
 2. \<And>x. lfp.fixp_fun F x \<subseteq> lset x
[PROOF STEP]
fix x xs
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x xa. xa \<in> lset x \<Longrightarrow> xa \<in> lfp.fixp_fun F x
 2. \<And>x. lfp.fixp_fun F x \<subseteq> lset x
[PROOF STEP]
show "?fixp xs \<subseteq> lset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfp.fixp_fun F xs \<subseteq> lset xs
[PROOF STEP]
by(induct arbitrary: xs rule: lfp.fixp_induct_uc[of "\<lambda>x. x" F "\<lambda>x. x", OF mono reflexive refl])(auto simp add: F_def split: llist.split)
[PROOF STATE]
proof (state)
this:
lfp.fixp_fun F xs \<subseteq> lset xs

goal (1 subgoal):
 1. \<And>x xa. xa \<in> lset x \<Longrightarrow> xa \<in> lfp.fixp_fun F x
[PROOF STEP]
assume "x \<in> lset xs"
[PROOF STATE]
proof (state)
this:
x \<in> lset xs

goal (1 subgoal):
 1. \<And>x xa. xa \<in> lset x \<Longrightarrow> xa \<in> lfp.fixp_fun F x
[PROOF STEP]
thus "x \<in> ?fixp xs"
[PROOF STATE]
proof (prove)
using this:
x \<in> lset xs

goal (1 subgoal):
 1. x \<in> lfp.fixp_fun F xs
[PROOF STEP]
by induct(subst lfp.mono_body_fixp[OF mono], simp add: F_def)+
[PROOF STATE]
proof (state)
this:
x \<in> lfp.fixp_fun F xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma expands_to_trim_cong:
  assumes "(f expands_to (MS (MSLCons (C, e) xs) g)) (b # basis)"
  assumes "(eval C expands_to C') basis"
  shows   "(f expands_to (MS (MSLCons (C', e) xs) g)) (b # basis)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f expands_to MS (MSLCons (C', e) xs) g) (b # basis)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f expands_to MS (MSLCons (C', e) xs) g) (b # basis)
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
(f expands_to MS (MSLCons (C, e) xs) g) (b # basis)
[PROOF STEP]
have "is_expansion_aux xs (\<lambda>x. g x - eval C x * b x powr e) (b # basis)"
[PROOF STATE]
proof (prove)
using this:
(f expands_to MS (MSLCons (C, e) xs) g) (b # basis)

goal (1 subgoal):
 1. is_expansion_aux xs (\<lambda>x. g x - eval C x * b x powr e) (b # basis)
[PROOF STEP]
by (auto simp: expands_to.simps elim!: is_expansion_aux_MSLCons)
[PROOF STATE]
proof (state)
this:
is_expansion_aux xs (\<lambda>x. g x - eval C x * b x powr e) (b # basis)

goal (1 subgoal):
 1. (f expands_to MS (MSLCons (C', e) xs) g) (b # basis)
[PROOF STEP]
hence "is_expansion_aux xs (\<lambda>x. g x - eval C' x * b x powr e) (b # basis)"
[PROOF STATE]
proof (prove)
using this:
is_expansion_aux xs (\<lambda>x. g x - eval C x * b x powr e) (b # basis)

goal (1 subgoal):
 1. is_expansion_aux xs (\<lambda>x. g x - eval C' x * b x powr e) (b # basis)
[PROOF STEP]
by (rule is_expansion_aux_cong)
       (insert assms(2), auto simp: expands_to.simps elim: eventually_mono)
[PROOF STATE]
proof (state)
this:
is_expansion_aux xs (\<lambda>x. g x - eval C' x * b x powr e) (b # basis)

goal (1 subgoal):
 1. (f expands_to MS (MSLCons (C', e) xs) g) (b # basis)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
(f expands_to MS (MSLCons (C, e) xs) g) (b # basis)
(eval C expands_to C') basis
is_expansion_aux xs (\<lambda>x. g x - eval C' x * b x powr e) (b # basis)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f expands_to MS (MSLCons (C, e) xs) g) (b # basis)
(eval C expands_to C') basis
is_expansion_aux xs (\<lambda>x. g x - eval C' x * b x powr e) (b # basis)

goal (1 subgoal):
 1. (f expands_to MS (MSLCons (C', e) xs) g) (b # basis)
[PROOF STEP]
by (auto simp: expands_to.simps elim!: is_expansion_aux_MSLCons intro!: is_expansion_aux.intros)
[PROOF STATE]
proof (state)
this:
(f expands_to MS (MSLCons (C', e) xs) g) (b # basis)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma anonymity_prefs_from_table:
  assumes "prefs_from_table_wf agents alts xs" "prefs_from_table_wf agents alts ys"
  assumes "mset (map snd xs) = mset (map snd ys)"
  shows   "sds (prefs_from_table xs) = sds (prefs_from_table ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sds (prefs_from_table xs) = sds (prefs_from_table ys)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sds (prefs_from_table xs) = sds (prefs_from_table ys)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prefs_from_table_wf agents alts xs
prefs_from_table_wf agents alts ys
mset (map snd xs) = mset (map snd ys)
[PROOF STEP]
obtain \<pi> where "\<pi> permutes agents" "prefs_from_table xs \<circ> \<pi> = prefs_from_table ys"
[PROOF STATE]
proof (prove)
using this:
prefs_from_table_wf agents alts xs
prefs_from_table_wf agents alts ys
mset (map snd xs) = mset (map snd ys)

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; prefs_from_table xs \<circ> \<pi> = prefs_from_table ys\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule prefs_from_table_agent_permutation)
[PROOF STATE]
proof (state)
this:
\<pi> permutes agents
prefs_from_table xs \<circ> \<pi> = prefs_from_table ys

goal (1 subgoal):
 1. sds (prefs_from_table xs) = sds (prefs_from_table ys)
[PROOF STEP]
with anonymous[of \<pi>, of "prefs_from_table xs"] assms(1)
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<pi> permutes agents; is_pref_profile (prefs_from_table xs)\<rbrakk> \<Longrightarrow> sds (prefs_from_table xs \<circ> \<pi>) = sds (prefs_from_table xs)
prefs_from_table_wf agents alts xs
\<pi> permutes agents
prefs_from_table xs \<circ> \<pi> = prefs_from_table ys
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<pi> permutes agents; is_pref_profile (prefs_from_table xs)\<rbrakk> \<Longrightarrow> sds (prefs_from_table xs \<circ> \<pi>) = sds (prefs_from_table xs)
prefs_from_table_wf agents alts xs
\<pi> permutes agents
prefs_from_table xs \<circ> \<pi> = prefs_from_table ys

goal (1 subgoal):
 1. sds (prefs_from_table xs) = sds (prefs_from_table ys)
[PROOF STEP]
by (simp add: pref_profile_from_tableI)
[PROOF STATE]
proof (state)
this:
sds (prefs_from_table xs) = sds (prefs_from_table ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lborel_permutations_of_set_bst_of_list:
  shows "distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A))
               (\<lambda>p. bst_of_list (sort_key p xs)) =
         distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
have [measurable]: "(0::real) < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < 1

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
have "insort_wrt R xs = insort_wrt R (remdups xs)" for R
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insort_wrt R xs = insort_wrt R (remdups xs)
[PROOF STEP]
using con_assms distinct_remdups_id
[PROOF STATE]
proof (prove)
using this:
countable A
set xs \<subseteq> A
distinct xs
distinct ?xs \<Longrightarrow> remdups ?xs = ?xs

goal (1 subgoal):
 1. insort_wrt R xs = insort_wrt R (remdups xs)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
insort_wrt ?R xs = insort_wrt ?R (remdups xs)

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
insort_wrt ?R xs = insort_wrt ?R (remdups xs)
[PROOF STEP]
have *: "insort_wrt R xs = sorted_wrt_list_of_set R (set xs)"
    if "linorder_on (set xs) R" for R
[PROOF STATE]
proof (prove)
using this:
insort_wrt ?R xs = insort_wrt ?R (remdups xs)

goal (1 subgoal):
 1. insort_wrt R xs = sorted_wrt_list_of_set R (set xs)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
insort_wrt ?R xs = insort_wrt ?R (remdups xs)
linorder_on (set xs) R

goal (1 subgoal):
 1. insort_wrt R xs = sorted_wrt_list_of_set R (set xs)
[PROOF STEP]
by (subst sorted_wrt_list_set) auto
[PROOF STATE]
proof (state)
this:
linorder_on (set xs) ?R \<Longrightarrow> insort_wrt ?R xs = sorted_wrt_list_of_set ?R (set xs)

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
have [measurable]: "(\<lambda>x. x) \<in> count_space (permutations_of_set (set xs)) \<rightarrow>\<^sub>M count_space (lists A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x) \<in> count_space (permutations_of_set (set xs)) \<rightarrow>\<^sub>M count_space (lists A)
[PROOF STEP]
using con_assms permutations_of_setD
[PROOF STATE]
proof (prove)
using this:
countable A
set xs \<subseteq> A
distinct xs
?xs \<in> permutations_of_set ?A \<Longrightarrow> set ?xs = ?A
?xs \<in> permutations_of_set ?A \<Longrightarrow> distinct ?xs

goal (1 subgoal):
 1. (\<lambda>x. x) \<in> count_space (permutations_of_set (set xs)) \<rightarrow>\<^sub>M count_space (lists A)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x) \<in> count_space (permutations_of_set (set xs)) \<rightarrow>\<^sub>M count_space (lists A)

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
have [measurable]: "(\<lambda>R. insort_wrt R xs) \<in>
                      count_space (Pow (A \<times> A)) \<rightarrow>\<^sub>M count_space (permutations_of_set (set xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>R. insort_wrt R xs) \<in> count_space (Pow (A \<times> A)) \<rightarrow>\<^sub>M count_space (permutations_of_set (set xs))
[PROOF STEP]
using con_assms
[PROOF STATE]
proof (prove)
using this:
countable A
set xs \<subseteq> A
distinct xs

goal (1 subgoal):
 1. (\<lambda>R. insort_wrt R xs) \<in> count_space (Pow (A \<times> A)) \<rightarrow>\<^sub>M count_space (permutations_of_set (set xs))
[PROOF STEP]
by (simp add: permutations_of_setI)
[PROOF STATE]
proof (state)
this:
(\<lambda>R. insort_wrt R xs) \<in> count_space (Pow (A \<times> A)) \<rightarrow>\<^sub>M count_space (permutations_of_set (set xs))

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
have "?lhs
   = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A))
           (\<lambda>p. bst_of_list (insort_wrt (linorder_from_keys (set xs) p) xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (insort_wrt (linorder_from_keys (set xs) p) xs))
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (insort_wrt (linorder_from_keys (set xs) p) xs))
[PROOF STEP]
by (simp add: insort_wrt_sort_key)
[PROOF STATE]
proof (state)
this:
distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (insort_wrt (linorder_from_keys (set xs) p) xs))

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (insort_wrt (linorder_from_keys (set xs) p) xs))

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
have "\<dots> =
  distr (distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0::real..1}))
    (count_space (Pow (A \<times> A))) (linorder_from_keys (set xs)))
  (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (insort_wrt (linorder_from_keys (set xs) p) xs)) = distr (distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (count_space (Pow (A \<times> A))) (linorder_from_keys (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs))
[PROOF STEP]
unfolding \<U>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (insort_wrt (linorder_from_keys (set xs) p) xs)) = distr (distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (count_space (Pow (A \<times> A))) (linorder_from_keys (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs))
[PROOF STEP]
using con_assms
[PROOF STATE]
proof (prove)
using this:
countable A
set xs \<subseteq> A
distinct xs

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (insort_wrt (linorder_from_keys (set xs) p) xs)) = distr (distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (count_space (Pow (A \<times> A))) (linorder_from_keys (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs))
[PROOF STEP]
by (subst distr_distr) (measurable, metis comp_apply)
[PROOF STATE]
proof (state)
this:
distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (insort_wrt (linorder_from_keys (set xs) p) xs)) = distr (distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (count_space (Pow (A \<times> A))) (linorder_from_keys (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs))

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (insort_wrt (linorder_from_keys (set xs) p) xs)) = distr (distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (count_space (Pow (A \<times> A))) (linorder_from_keys (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs))

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
have "\<dots> =
  distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs)))
        (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (count_space (Pow (A \<times> A))) (linorder_from_keys (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs)) = distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs))
[PROOF STEP]
using con_assms
[PROOF STATE]
proof (prove)
using this:
countable A
set xs \<subseteq> A
distinct xs

goal (1 subgoal):
 1. distr (distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (count_space (Pow (A \<times> A))) (linorder_from_keys (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs)) = distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs))
[PROOF STEP]
by (subst random_linorder_by_prios) auto
[PROOF STATE]
proof (state)
this:
distr (distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (count_space (Pow (A \<times> A))) (linorder_from_keys (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs)) = distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs))

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distr (distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (count_space (Pow (A \<times> A))) (linorder_from_keys (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs)) = distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs))

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
have "\<dots> = distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs)))
                               (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs))
                        (tree_sigma (count_space A)) bst_of_list"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs)) = distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
by (subst distr_distr) (measurable, metis comp_apply)
[PROOF STATE]
proof (state)
this:
distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs)) = distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)) (tree_sigma (count_space A)) bst_of_list

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (tree_sigma (count_space A)) (\<lambda>R. bst_of_list (insort_wrt R xs)) = distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)) (tree_sigma (count_space A)) bst_of_list

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
have "\<dots> = distr (uniform_measure (count_space (permutations_of_set (set xs)))
                          ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs)))
                    (tree_sigma (count_space A)) bst_of_list"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)) (tree_sigma (count_space A)) bst_of_list = distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)) (tree_sigma (count_space A)) bst_of_list = distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
have "bij_betw (\<lambda>R. insort_wrt R xs) (linorders_on (set xs)) (permutations_of_set (set xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (\<lambda>R. insort_wrt R xs) (linorders_on (set xs)) (permutations_of_set (set xs))
[PROOF STEP]
by (subst bij_betw_cong, fastforce simp add: * linorders_on_def bij_betw_cong)
         (use bij_betw_linorders_on' in blast)
[PROOF STATE]
proof (state)
this:
bij_betw (\<lambda>R. insort_wrt R xs) (linorders_on (set xs)) (permutations_of_set (set xs))

goal (1 subgoal):
 1. distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)) (tree_sigma (count_space A)) bst_of_list = distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bij_betw (\<lambda>R. insort_wrt R xs) (linorders_on (set xs)) (permutations_of_set (set xs))
[PROOF STEP]
have "inj_on (\<lambda>R. insort_wrt R xs) (linorders_on (set xs))"
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>R. insort_wrt R xs) (linorders_on (set xs)) (permutations_of_set (set xs))

goal (1 subgoal):
 1. inj_on (\<lambda>R. insort_wrt R xs) (linorders_on (set xs))
[PROOF STEP]
by (rule bij_betw_imp_inj_on)
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>R. insort_wrt R xs) (linorders_on (set xs))

goal (1 subgoal):
 1. distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)) (tree_sigma (count_space A)) bst_of_list = distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj_on (\<lambda>R. insort_wrt R xs) (linorders_on (set xs))
[PROOF STEP]
have "distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs)))
                     (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)
               = uniform_measure (count_space (permutations_of_set (set xs)))
                                 ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))"
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>R. insort_wrt R xs) (linorders_on (set xs))

goal (1 subgoal):
 1. distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs) = uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))
[PROOF STEP]
using con_assms
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>R. insort_wrt R xs) (linorders_on (set xs))
countable A
set xs \<subseteq> A
distinct xs

goal (1 subgoal):
 1. distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs) = uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))
[PROOF STEP]
by (intro distr_uniform_measure_count_space_inj)
        (auto simp add: linorders_on_def linorder_on_def refl_on_def)
[PROOF STATE]
proof (state)
this:
distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs) = uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))

goal (1 subgoal):
 1. distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)) (tree_sigma (count_space A)) bst_of_list = distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs) = uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs) = uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))

goal (1 subgoal):
 1. distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)) (tree_sigma (count_space A)) bst_of_list = distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)) (tree_sigma (count_space A)) bst_of_list = distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)) (tree_sigma (count_space A)) bst_of_list = distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distr (distr (uniform_measure (count_space (Pow (A \<times> A))) (linorders_on (set xs))) (count_space (permutations_of_set (set xs))) (\<lambda>R. insort_wrt R xs)) (tree_sigma (count_space A)) bst_of_list = distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
have "\<dots> = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
have "((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs)) = permutations_of_set (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>R. insort_wrt R xs) ` linorders_on (set xs) = permutations_of_set (set xs)
[PROOF STEP]
by (intro bij_betw_imp_surj_on, subst bij_betw_cong, rule *)
         (fastforce simp add: linorders_on_def,  use bij_betw_linorders_on' in blast)
[PROOF STATE]
proof (state)
this:
(\<lambda>R. insort_wrt R xs) ` linorders_on (set xs) = permutations_of_set (set xs)

goal (1 subgoal):
 1. distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>R. insort_wrt R xs) ` linorders_on (set xs) = permutations_of_set (set xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>R. insort_wrt R xs) ` linorders_on (set xs) = permutations_of_set (set xs)

goal (1 subgoal):
 1. distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
by (simp add: random_perm_def)
[PROOF STATE]
proof (state)
this:
distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
distr (uniform_measure (count_space (permutations_of_set (set xs))) ((\<lambda>R. insort_wrt R xs) ` linorders_on (set xs))) (tree_sigma (count_space A)) bst_of_list = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list

goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs)) = distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_of_domAD: "map_of \<Gamma> x = Some e \<Longrightarrow> x \<in> domA \<Gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_of \<Gamma> x = Some e \<Longrightarrow> x \<in> domA \<Gamma>
[PROOF STEP]
using dom_map_of_conv_domA
[PROOF STATE]
proof (prove)
using this:
dom (map_of ?\<Gamma>) = domA ?\<Gamma>

goal (1 subgoal):
 1. map_of \<Gamma> x = Some e \<Longrightarrow> x \<in> domA \<Gamma>
[PROOF STEP]
by fastforce


[STATEMENT]
lemma subst_clss_single[simp]: "{C} \<cdot>cs \<sigma> = {C \<cdot> \<sigma>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {C} \<cdot>cs \<sigma> = {C \<cdot> \<sigma>}
[PROOF STEP]
unfolding subst_clss_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>A. A \<cdot> \<sigma>) ` {C} = {C \<cdot> \<sigma>}
[PROOF STEP]
by auto


[STATEMENT]
lemma degree_root_unity[simp]: "degree (root_unity n) = n" (is "degree ?p = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (root_unity n) = n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree (root_unity n) = n
[PROOF STEP]
have p: "?p = monom 1 n + (-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root_unity n = monom (1::'a) n + - 1
[PROOF STEP]
unfolding root_unity_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom (1::'a) n - 1 = monom (1::'a) n + - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
root_unity n = monom (1::'a) n + - 1

goal (1 subgoal):
 1. degree (root_unity n) = n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (root_unity n) = n
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> degree (root_unity n) = n
 2. \<And>nat. n = Suc nat \<Longrightarrow> degree (root_unity n) = n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> degree (root_unity n) = n
 2. \<And>nat. n = Suc nat \<Longrightarrow> degree (root_unity n) = n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. degree (root_unity n) = n
[PROOF STEP]
unfolding p
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. degree (monom (1::'a) n + - 1) = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree (root_unity n) = n

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> degree (root_unity n) = n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> degree (root_unity n) = n
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
n = Suc m

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> degree (root_unity n) = n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (root_unity n) = n
[PROOF STEP]
unfolding p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (monom (1::'a) n + - 1) = n
[PROOF STEP]
unfolding Suc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (monom (1::'a) (Suc m) + - 1) = Suc m
[PROOF STEP]
by (subst degree_add_eq_left, auto simp: degree_monom_eq)
[PROOF STATE]
proof (state)
this:
degree (root_unity n) = n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (root_unity n) = n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isometry_on_inverse:
  assumes "isometry_on X f"
  shows "isometry_on (f`X) (inv_into X f)"
        "\<And>x. x \<in> X \<Longrightarrow> (inv_into X f) (f x) = x"
        "\<And>y. y \<in> f`X \<Longrightarrow> f (inv_into X f y) = y"
        "bij_betw f X (f`X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (isometry_on (f ` X) (inv_into X f) &&& (\<And>x. x \<in> X \<Longrightarrow> inv_into X f (f x) = x)) &&& (\<And>y. y \<in> f ` X \<Longrightarrow> f (inv_into X f y) = y) &&& bij_betw f X (f ` X)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. isometry_on (f ` X) (inv_into X f)
 2. \<And>x. x \<in> X \<Longrightarrow> inv_into X f (f x) = x
 3. \<And>y. y \<in> f ` X \<Longrightarrow> f (inv_into X f y) = y
 4. bij_betw f X (f ` X)
[PROOF STEP]
show *: "bij_betw f X (f`X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw f X (f ` X)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isometry_on X f

goal (1 subgoal):
 1. bij_betw f X (f ` X)
[PROOF STEP]
unfolding bij_betw_def inj_on_def isometry_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>X. \<forall>y\<in>X. dist (f x) (f y) = dist x y

goal (1 subgoal):
 1. (\<forall>x\<in>X. \<forall>y\<in>X. f x = f y \<longrightarrow> x = y) \<and> f ` X = f ` X
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
bij_betw f X (f ` X)

goal (3 subgoals):
 1. isometry_on (f ` X) (inv_into X f)
 2. \<And>x. x \<in> X \<Longrightarrow> inv_into X f (f x) = x
 3. \<And>y. y \<in> f ` X \<Longrightarrow> f (inv_into X f y) = y
[PROOF STEP]
show "isometry_on (f`X) (inv_into X f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isometry_on (f ` X) (inv_into X f)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isometry_on X f

goal (1 subgoal):
 1. isometry_on (f ` X) (inv_into X f)
[PROOF STEP]
unfolding isometry_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>X. \<forall>y\<in>X. dist (f x) (f y) = dist x y

goal (1 subgoal):
 1. \<forall>x\<in>f ` X. \<forall>y\<in>f ` X. dist (inv_into X f x) (inv_into X f y) = dist x y
[PROOF STEP]
by (auto) (metis (mono_tags, lifting) dist_eq_0_iff inj_on_def inv_into_f_f)
[PROOF STATE]
proof (state)
this:
isometry_on (f ` X) (inv_into X f)

goal (2 subgoals):
 1. \<And>x. x \<in> X \<Longrightarrow> inv_into X f (f x) = x
 2. \<And>y. y \<in> f ` X \<Longrightarrow> f (inv_into X f y) = y
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> X \<Longrightarrow> inv_into X f (f x) = x
 2. \<And>y. y \<in> f ` X \<Longrightarrow> f (inv_into X f y) = y
[PROOF STEP]
assume "x \<in> X"
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (2 subgoals):
 1. \<And>x. x \<in> X \<Longrightarrow> inv_into X f (f x) = x
 2. \<And>y. y \<in> f ` X \<Longrightarrow> f (inv_into X f y) = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> X
[PROOF STEP]
show "(inv_into X f) (f x) = x"
[PROOF STATE]
proof (prove)
using this:
x \<in> X

goal (1 subgoal):
 1. inv_into X f (f x) = x
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
x \<in> X
bij_betw f X (f ` X)

goal (1 subgoal):
 1. inv_into X f (f x) = x
[PROOF STEP]
by (simp add: bij_betw_def)
[PROOF STATE]
proof (state)
this:
inv_into X f (f x) = x

goal (1 subgoal):
 1. \<And>y. y \<in> f ` X \<Longrightarrow> f (inv_into X f y) = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. y \<in> f ` X \<Longrightarrow> f (inv_into X f y) = y
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. y \<in> f ` X \<Longrightarrow> f (inv_into X f y) = y
[PROOF STEP]
assume "y \<in> f`X"
[PROOF STATE]
proof (state)
this:
y \<in> f ` X

goal (1 subgoal):
 1. \<And>y. y \<in> f ` X \<Longrightarrow> f (inv_into X f y) = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> f ` X
[PROOF STEP]
show "f (inv_into X f y) = y"
[PROOF STATE]
proof (prove)
using this:
y \<in> f ` X

goal (1 subgoal):
 1. f (inv_into X f y) = y
[PROOF STEP]
by (simp add: f_inv_into_f)
[PROOF STATE]
proof (state)
this:
f (inv_into X f y) = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isomorphic_to_zero_left : "V = 0 \<Longrightarrow> isomorphic smult' W \<Longrightarrow> W = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>V = 0; isomorphic smult' W\<rbrakk> \<Longrightarrow> W = 0
[PROOF STEP]
using FGModuleIso.isomorphic_to_zero_left
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>FGModuleIso ?G ?smult ?V ?smult' ?T ?W; ?V = 0\<rbrakk> \<Longrightarrow> ?W = 0

goal (1 subgoal):
 1. \<lbrakk>V = 0; isomorphic smult' W\<rbrakk> \<Longrightarrow> W = 0
[PROOF STEP]
by fast


[STATEMENT]
lemma (in domain) lagrange_aux_poly:
  assumes "finite S"
  assumes "S \<subseteq> carrier R"
  shows "lagrange_basis_polynomial_aux S \<in> carrier (poly_ring R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lagrange_basis_polynomial_aux S \<in> carrier (poly_ring R)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lagrange_basis_polynomial_aux S \<in> carrier (poly_ring R)
[PROOF STEP]
have a:"subring (carrier R) R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subring (carrier R) R
[PROOF STEP]
using carrier_is_subring assms
[PROOF STATE]
proof (prove)
using this:
subring (carrier R) R
finite S
S \<subseteq> carrier R

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

goal (1 subgoal):
 1. lagrange_basis_polynomial_aux S \<in> carrier (poly_ring R)
[PROOF STEP]
have b: "\<And>a. a \<in> S \<Longrightarrow> X \<ominus>\<^bsub>poly_ring R\<^esub> poly_of_const a \<in> carrier (poly_ring R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<in> S \<Longrightarrow> X \<ominus>\<^bsub>poly_ring R\<^esub> poly_of_const a \<in> carrier (poly_ring R)
[PROOF STEP]
by (meson poly_of_const_in_carrier a assms(2) cring.cring_simprules(4) domain_def subsetD
        univ_poly_is_domain var_closed(1))
[PROOF STATE]
proof (state)
this:
?a \<in> S \<Longrightarrow> X \<ominus>\<^bsub>poly_ring R\<^esub> poly_of_const ?a \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. lagrange_basis_polynomial_aux S \<in> carrier (poly_ring R)
[PROOF STEP]
interpret x:cring "poly_ring R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cring (poly_ring R)
[PROOF STEP]
using carrier_is_subring domain.univ_poly_is_cring domain_axioms
[PROOF STATE]
proof (prove)
using this:
subring (carrier R) R
\<lbrakk>domain ?R; subring ?K ?R\<rbrakk> \<Longrightarrow> cring (?K [X]\<^bsub>?R\<^esub>)
domain R

goal (1 subgoal):
 1. cring (poly_ring R)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lagrange_basis_polynomial_aux S \<in> carrier (poly_ring R)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lagrange_basis_polynomial_aux S \<in> carrier (poly_ring R)
[PROOF STEP]
using lagrange_basis_polynomial_aux_def b x.finprod_closed[OF Pi_I]
[PROOF STATE]
proof (prove)
using this:
lagrange_basis_polynomial_aux ?S = (\<Otimes>\<^bsub>poly_ring R\<^esub>s\<in>?S. X \<ominus>\<^bsub>poly_ring R\<^esub> poly_of_const s)
?a \<in> S \<Longrightarrow> X \<ominus>\<^bsub>poly_ring R\<^esub> poly_of_const ?a \<in> carrier (poly_ring R)
(\<And>x. x \<in> ?A \<Longrightarrow> ?f x \<in> carrier (poly_ring R)) \<Longrightarrow> finprod (poly_ring R) ?f ?A \<in> carrier (poly_ring R)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_notin_vars:
  \<open>x \<notin> (vars B) \<Longrightarrow> degree (B :: 'a :: {monoid_add} mpoly) x = 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> vars B \<Longrightarrow> MPoly_Type.degree B x = 0
[PROOF STEP]
using degree_sum_notin[of x B 0]
[PROOF STATE]
proof (prove)
using this:
x \<notin> vars B \<Longrightarrow> MPoly_Type.degree (0 + B) x = MPoly_Type.degree 0 x

goal (1 subgoal):
 1. x \<notin> vars B \<Longrightarrow> MPoly_Type.degree B x = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma normf_upper:
    assumes "continuous_on S f" "x \<in> S" shows "\<bar>f x\<bar> \<le> normf f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f x\<bar> \<le> normf f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>f x\<bar> \<le> normf f
[PROOF STEP]
have "bdd_above ((\<lambda>x. \<bar>f x\<bar>) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above ((\<lambda>x. \<bar>f x\<bar>) ` S)
[PROOF STEP]
by (simp add: assms(1) bounded_imp_bdd_above compact compact_continuous_image compact_imp_bounded continuous_on_rabs)
[PROOF STATE]
proof (state)
this:
bdd_above ((\<lambda>x. \<bar>f x\<bar>) ` S)

goal (1 subgoal):
 1. \<bar>f x\<bar> \<le> normf f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bdd_above ((\<lambda>x. \<bar>f x\<bar>) ` S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bdd_above ((\<lambda>x. \<bar>f x\<bar>) ` S)

goal (1 subgoal):
 1. \<bar>f x\<bar> \<le> normf f
[PROOF STEP]
using assms cSUP_upper normf_def
[PROOF STATE]
proof (prove)
using this:
bdd_above ((\<lambda>x. \<bar>f x\<bar>) ` S)
continuous_on S f
x \<in> S
\<lbrakk>?x \<in> ?A; bdd_above (?f ` ?A)\<rbrakk> \<Longrightarrow> ?f ?x \<le> Sup (?f ` ?A)
normf ?f \<equiv> SUP x\<in>S. \<bar>?f x\<bar>

goal (1 subgoal):
 1. \<bar>f x\<bar> \<le> normf f
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<bar>f x\<bar> \<le> normf f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bij_enumerate:
  fixes S :: "nat set"
  assumes S: "infinite S"
  shows "bij_betw (enumerate S) UNIV S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) UNIV S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) UNIV S
[PROOF STEP]
have "\<forall>s \<in> S. \<exists>i. enumerate S i = s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>s\<in>S. \<exists>i. wellorder_class.enumerate S i = s
[PROOF STEP]
using enumerate_Ex[OF S]
[PROOF STATE]
proof (prove)
using this:
?s \<in> S \<Longrightarrow> \<exists>n. wellorder_class.enumerate S n = ?s

goal (1 subgoal):
 1. \<forall>s\<in>S. \<exists>i. wellorder_class.enumerate S i = s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>s\<in>S. \<exists>i. wellorder_class.enumerate S i = s

goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) UNIV S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>s\<in>S. \<exists>i. wellorder_class.enumerate S i = s

goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) UNIV S
[PROOF STEP]
note \<open>infinite S\<close> inj_enumerate
[PROOF STATE]
proof (state)
this:
infinite S
infinite ?S \<Longrightarrow> inj (wellorder_class.enumerate ?S)

goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) UNIV S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>s\<in>S. \<exists>i. wellorder_class.enumerate S i = s
infinite S
infinite ?S \<Longrightarrow> inj (wellorder_class.enumerate ?S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>s\<in>S. \<exists>i. wellorder_class.enumerate S i = s
infinite S
infinite ?S \<Longrightarrow> inj (wellorder_class.enumerate ?S)

goal (1 subgoal):
 1. bij_betw (wellorder_class.enumerate S) UNIV S
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
\<forall>s\<in>S. \<exists>i. wellorder_class.enumerate S i = s
infinite S
infinite ?S \<Longrightarrow> inj (wellorder_class.enumerate ?S)

goal (1 subgoal):
 1. inj (wellorder_class.enumerate S) \<and> range (wellorder_class.enumerate S) = S
[PROOF STEP]
by (auto intro: enumerate_in_set)
[PROOF STATE]
proof (state)
this:
bij_betw (wellorder_class.enumerate S) UNIV S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma slice_nth: "\<lbrakk> from < to; to \<le> length xs; i < to - from \<rbrakk> \<Longrightarrow> slice from to xs ! i = xs ! (from + i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>from < to; to \<le> length xs; i < to - from\<rbrakk> \<Longrightarrow> slice from to xs ! i = xs ! (from + i)
[PROOF STEP]
unfolding slice_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>from < to; to \<le> length xs; i < to - from\<rbrakk> \<Longrightarrow> take (to - from) (drop from xs) ! i = xs ! (from + i)
[PROOF STEP]
by (induction "to - from" arbitrary: "from" to i) simp+


[STATEMENT]
lemma foldl_elem_check:
  assumes "list.set xs \<subseteq> A"
  shows "foldl (\<lambda> y x . if x \<notin> A then y else f y x) v xs = foldl f v xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (\<lambda>y x. if x \<notin> A then y else f y x) v xs = foldl f v xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> A

goal (1 subgoal):
 1. foldl (\<lambda>y x. if x \<notin> A then y else f y x) v xs = foldl f v xs
[PROOF STEP]
by (induction xs rule: rev_induct; auto)


[STATEMENT]
lemma bin_cat_zero [simp]: "(\<lambda>k n l. concat_bit n l k) 0 n w = (take_bit :: nat \<Rightarrow> int \<Rightarrow> int) n w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat_bit n w 0 = take_bit n w
[PROOF STEP]
by (simp add: bin_cat_eq_push_bit_add_take_bit)


[STATEMENT]
lemma lookup_ev_None: "lookup_ev ev j A = None \<Longrightarrow> i < j \<Longrightarrow> A $$ (i,i) \<noteq> ev"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>lookup_ev ev j A = None; i < j\<rbrakk> \<Longrightarrow> A $$ (i, i) \<noteq> ev
[PROOF STEP]
by (induct j, auto split: if_splits, case_tac "i = j", auto)


[STATEMENT]
lemma gt_iff_chop_diff_same: "t >\<^sub>t s \<longleftrightarrow> gt_chop t s \<or> gt_diff t s \<or> gt_same t s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (t >\<^sub>t s) = (gt_chop t s \<or> gt_diff t s \<or> gt_same t s)
[PROOF STEP]
by (subst gt.simps) (auto simp: gt_chop.simps gt_diff.simps gt_same.simps)


[STATEMENT]
lemma bst_joinL:
  "\<lbrakk>bst (Node l (a, n) r); bheight l \<le> bheight r\<rbrakk>
  \<Longrightarrow> bst (joinL l a r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Tree2.bst \<langle>l, (a, n), r\<rangle>; bheight l \<le> bheight r\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l a r)
[PROOF STEP]
proof(induction l a r rule: joinL.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l x r. \<lbrakk>\<And>x21 x22 x23 xa y. \<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>x21, x22, x23\<rangle>; (xa, y) = x22; y = Red; Tree2.bst \<langle>l, (x, n), x21\<rangle>; bheight l \<le> bheight x21\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l x x21); \<And>x21 x22 x23 xa y. \<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>x21, x22, x23\<rangle>; (xa, y) = x22; y = Black; Tree2.bst \<langle>l, (x, n), x21\<rangle>; bheight l \<le> bheight x21\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l x x21); Tree2.bst \<langle>l, (x, n), r\<rangle>; bheight l \<le> bheight r\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l x r)
[PROOF STEP]
case (1 l a r)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>?x21.0, ?x22.0, ?x23.0\<rangle>; (?xa, ?y) = ?x22.0; ?y = Red; Tree2.bst \<langle>l, (a, n), ?x21.0\<rangle>; bheight l \<le> bheight ?x21.0\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l a ?x21.0)
\<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>?x21.0, ?x22.0, ?x23.0\<rangle>; (?xa, ?y) = ?x22.0; ?y = Black; Tree2.bst \<langle>l, (a, n), ?x21.0\<rangle>; bheight l \<le> bheight ?x21.0\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l a ?x21.0)
Tree2.bst \<langle>l, (a, n), r\<rangle>
bheight l \<le> bheight r

goal (1 subgoal):
 1. \<And>l x r. \<lbrakk>\<And>x21 x22 x23 xa y. \<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>x21, x22, x23\<rangle>; (xa, y) = x22; y = Red; Tree2.bst \<langle>l, (x, n), x21\<rangle>; bheight l \<le> bheight x21\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l x x21); \<And>x21 x22 x23 xa y. \<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>x21, x22, x23\<rangle>; (xa, y) = x22; y = Black; Tree2.bst \<langle>l, (x, n), x21\<rangle>; bheight l \<le> bheight x21\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l x x21); Tree2.bst \<langle>l, (x, n), r\<rangle>; bheight l \<le> bheight r\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l x r)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>?x21.0, ?x22.0, ?x23.0\<rangle>; (?xa, ?y) = ?x22.0; ?y = Red; Tree2.bst \<langle>l, (a, n), ?x21.0\<rangle>; bheight l \<le> bheight ?x21.0\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l a ?x21.0)
\<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>?x21.0, ?x22.0, ?x23.0\<rangle>; (?xa, ?y) = ?x22.0; ?y = Black; Tree2.bst \<langle>l, (a, n), ?x21.0\<rangle>; bheight l \<le> bheight ?x21.0\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l a ?x21.0)
Tree2.bst \<langle>l, (a, n), r\<rangle>
bheight l \<le> bheight r

goal (1 subgoal):
 1. Tree2.bst (joinL l a r)
[PROOF STEP]
by(auto simp: set_baliL joinL.simps[of l a r] set_joinL ball_Un intro!: bst_baliL
        split!: tree.splits color.splits)
[PROOF STATE]
proof (state)
this:
Tree2.bst (joinL l a r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Legendre_mult[simp]:
  assumes "prime p"
  shows "Legendre (a*b) p = Legendre a p * Legendre b p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
consider "p = 2" | "p > 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p = 2 \<Longrightarrow> thesis; 2 < p \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
using assms order_le_less prime_ge_2_int
[PROOF STATE]
proof (prove)
using this:
prime p
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)
prime ?p \<Longrightarrow> 2 \<le> ?p

goal (1 subgoal):
 1. \<lbrakk>p = 2 \<Longrightarrow> thesis; 2 < p \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>p = 2 \<Longrightarrow> ?thesis; 2 < p \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>p = 2 \<Longrightarrow> ?thesis; 2 < p \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
proof (cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 2 \<Longrightarrow> Legendre (a * b) p = Legendre a p * Legendre b p
 2. 2 < p \<Longrightarrow> Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
p = 2

goal (2 subgoals):
 1. p = 2 \<Longrightarrow> Legendre (a * b) p = Legendre a p * Legendre b p
 2. 2 < p \<Longrightarrow> Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 2

goal (1 subgoal):
 1. Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
by (metis Legendre_p_eq_2 mod_mult_eq mod_self mult_cancel_right2
                mult_eq_0_iff not_mod_2_eq_1_eq_0 one_mod_two_eq_one)
[PROOF STATE]
proof (state)
this:
Legendre (a * b) p = Legendre a p * Legendre b p

goal (1 subgoal):
 1. 2 < p \<Longrightarrow> Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 < p \<Longrightarrow> Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
2 < p

goal (1 subgoal):
 1. 2 < p \<Longrightarrow> Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
hence "[Legendre (a*b) p = (a*b)^((nat p-1) div 2)] (mod p)"
[PROOF STATE]
proof (prove)
using this:
2 < p

goal (1 subgoal):
 1. [Legendre (a * b) p = (a * b) ^ ((nat p - 1) div 2)] (mod p)
[PROOF STEP]
using euler_criterion_int assms
[PROOF STATE]
proof (prove)
using this:
2 < p
\<lbrakk>prime ?p; 2 < ?p\<rbrakk> \<Longrightarrow> [Legendre ?a ?p = ?a ^ ((nat ?p - 1) div 2)] (mod ?p)
prime p

goal (1 subgoal):
 1. [Legendre (a * b) p = (a * b) ^ ((nat p - 1) div 2)] (mod p)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[Legendre (a * b) p = (a * b) ^ ((nat p - 1) div 2)] (mod p)

goal (1 subgoal):
 1. 2 < p \<Longrightarrow> Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[Legendre (a * b) p = (a * b) ^ ((nat p - 1) div 2)] (mod p)

goal (1 subgoal):
 1. 2 < p \<Longrightarrow> Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
have "[(a*b)^((nat p-1) div 2) = a^((nat p-1) div 2) * b^((nat p-1) div 2)] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [(a * b) ^ ((nat p - 1) div 2) = a ^ ((nat p - 1) div 2) * b ^ ((nat p - 1) div 2)] (mod p)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
[(a * b) ^ ((nat p - 1) div 2) = a ^ ((nat p - 1) div 2) * b ^ ((nat p - 1) div 2)] (mod p)

goal (1 subgoal):
 1. 2 < p \<Longrightarrow> Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[(a * b) ^ ((nat p - 1) div 2) = a ^ ((nat p - 1) div 2) * b ^ ((nat p - 1) div 2)] (mod p)

goal (1 subgoal):
 1. 2 < p \<Longrightarrow> Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
have "[a^((nat p-1) div 2) * b^((nat p-1) div 2) = Legendre a p * Legendre b p] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a ^ ((nat p - 1) div 2) * b ^ ((nat p - 1) div 2) = Legendre a p * Legendre b p] (mod p)
[PROOF STEP]
using cong_sym[OF euler_criterion_int] assms 2 cong_mult
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime ?a; 2 < ?a\<rbrakk> \<Longrightarrow> [?a1 ^ ((nat ?a - 1) div 2) = Legendre ?a1 ?a] (mod ?a)
prime p
2 < p
\<lbrakk>[?b = ?c] (mod ?a); [?d = ?e] (mod ?a)\<rbrakk> \<Longrightarrow> [?b * ?d = ?c * ?e] (mod ?a)

goal (1 subgoal):
 1. [a ^ ((nat p - 1) div 2) * b ^ ((nat p - 1) div 2) = Legendre a p * Legendre b p] (mod p)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[a ^ ((nat p - 1) div 2) * b ^ ((nat p - 1) div 2) = Legendre a p * Legendre b p] (mod p)

goal (1 subgoal):
 1. 2 < p \<Longrightarrow> Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[Legendre (a * b) p = Legendre a p * Legendre b p] (mod p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[Legendre (a * b) p = Legendre a p * Legendre b p] (mod p)

goal (1 subgoal):
 1. Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
using Legendre_in_cong_eq[OF 2]
[PROOF STATE]
proof (prove)
using this:
[Legendre (a * b) p = Legendre a p * Legendre b p] (mod p)
?b \<in> {- 1, 0, 1} \<Longrightarrow> [Legendre ?a ?m = ?b] (mod p) = (Legendre ?a ?m = ?b)

goal (1 subgoal):
 1. Legendre (a * b) p = Legendre a p * Legendre b p
[PROOF STEP]
by (simp add: Legendre_def)
[PROOF STATE]
proof (state)
this:
Legendre (a * b) p = Legendre a p * Legendre b p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Legendre (a * b) p = Legendre a p * Legendre b p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in PolynRg) polyn_minus_nsum:"\<lbrakk>pol_coeff S c; k \<le> (fst c)\<rbrakk> \<Longrightarrow>
       -\<^sub>a (polyn_expr R X k c) = nsum R (\<lambda>j. ((-\<^sub>a\<^bsub>S\<^esub> ((snd c) j)) \<cdot>\<^sub>r (X^\<^bsup>R j\<^esup>))) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c\<rbrakk> \<Longrightarrow> -\<^sub>a polyn_expr R X k c = \<Sigma>\<^sub>e R (\<lambda>j. (-\<^sub>a\<^bsub>S\<^esub> snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) k
[PROOF STEP]
apply (cut_tac subring,
       frule subring_Ring[of S],
       frule Ring.ring_is_ag[of S],
       cut_tac ring_is_ag,
       cut_tac X_mem_R)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R\<rbrakk> \<Longrightarrow> -\<^sub>a polyn_expr R X k c = \<Sigma>\<^sub>e R (\<lambda>j. (-\<^sub>a\<^bsub>S\<^esub> snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) k
[PROOF STEP]
apply (simp add:polyn_expr_def,
       subst aGroup.nsum_minus[of R], assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R\<rbrakk> \<Longrightarrow> \<forall>j\<le>k. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup> \<in> carrier R
 2. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>x\<in>{j. j \<le> k}. -\<^sub>a snd c x \<cdot>\<^sub>r X^\<^bsup>R x\<^esup>) k = \<Sigma>\<^sub>e R (\<lambda>j. (-\<^sub>a\<^bsub>S\<^esub> snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) k
[PROOF STEP]
apply (frule monomial_mem[of c], rule allI, rule impI,
        frule_tac i = j and j = k and k = "fst c" in le_trans, assumption+,
        simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>x\<in>{j. j \<le> k}. -\<^sub>a snd c x \<cdot>\<^sub>r X^\<^bsup>R x\<^esup>) k = \<Sigma>\<^sub>e R (\<lambda>j. (-\<^sub>a\<^bsub>S\<^esub> snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) k
[PROOF STEP]
apply (rule aGroup.nsum_eq, assumption,
       rule allI, rule impI, simp,
       rule aGroup.ag_mOp_closed, assumption)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>j. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R; j \<le> k\<rbrakk> \<Longrightarrow> snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup> \<in> carrier R
 2. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R\<rbrakk> \<Longrightarrow> \<forall>j\<le>k. (-\<^sub>a\<^bsub>S\<^esub> snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup> \<in> carrier R
 3. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R\<rbrakk> \<Longrightarrow> \<forall>j\<le>k. (\<lambda>x\<in>{j. j \<le> k}. -\<^sub>a snd c x \<cdot>\<^sub>r X^\<^bsup>R x\<^esup>) j = (-\<^sub>a\<^bsub>S\<^esub> snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>
[PROOF STEP]
apply (frule monomial_mem[of c],
        frule_tac i = j and j = k and k = "fst c" in le_trans, assumption+,
        simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R\<rbrakk> \<Longrightarrow> \<forall>j\<le>k. (-\<^sub>a\<^bsub>S\<^esub> snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup> \<in> carrier R
 2. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R\<rbrakk> \<Longrightarrow> \<forall>j\<le>k. (\<lambda>x\<in>{j. j \<le> k}. -\<^sub>a snd c x \<cdot>\<^sub>r X^\<^bsup>R x\<^esup>) j = (-\<^sub>a\<^bsub>S\<^esub> snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>
[PROOF STEP]
apply (rule allI, rule impI,
       rule ring_tOp_closed)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>j. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R; j \<le> k\<rbrakk> \<Longrightarrow> -\<^sub>a\<^bsub>S\<^esub> snd c j \<in> carrier R
 2. \<And>j. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R; j \<le> k\<rbrakk> \<Longrightarrow> X^\<^bsup>R j\<^esup> \<in> carrier R
 3. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R\<rbrakk> \<Longrightarrow> \<forall>j\<le>k. (\<lambda>x\<in>{j. j \<le> k}. -\<^sub>a snd c x \<cdot>\<^sub>r X^\<^bsup>R x\<^esup>) j = (-\<^sub>a\<^bsub>S\<^esub> snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>
[PROOF STEP]
apply (frule_tac j = j  in pol_coeff_mem[of c])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>j. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R; j \<le> k\<rbrakk> \<Longrightarrow> j \<le> fst c
 2. \<And>j. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R; j \<le> k; snd c j \<in> carrier S\<rbrakk> \<Longrightarrow> -\<^sub>a\<^bsub>S\<^esub> snd c j \<in> carrier R
 3. \<And>j. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R; j \<le> k\<rbrakk> \<Longrightarrow> X^\<^bsup>R j\<^esup> \<in> carrier R
 4. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R\<rbrakk> \<Longrightarrow> \<forall>j\<le>k. (\<lambda>x\<in>{j. j \<le> k}. -\<^sub>a snd c x \<cdot>\<^sub>r X^\<^bsup>R x\<^esup>) j = (-\<^sub>a\<^bsub>S\<^esub> snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>
[PROOF STEP]
apply (frule_tac i = j and j = k and k = "fst c" in le_trans, assumption+,
       simp add:Subring_minus_ring_minus,
       frule_tac x = "(snd c) j" in mem_subring_mem_ring[of S], assumption,
       simp add:aGroup.ag_mOp_closed,
       simp add:npClose)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R\<rbrakk> \<Longrightarrow> \<forall>j\<le>k. (\<lambda>x\<in>{j. j \<le> k}. -\<^sub>a snd c x \<cdot>\<^sub>r X^\<^bsup>R x\<^esup>) j = (-\<^sub>a\<^bsub>S\<^esub> snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>
[PROOF STEP]
apply (rule allI, rule impI, simp,
       cut_tac j = j in pol_coeff_mem[of c], assumption,
       rule_tac i = j and j = k and k = "fst c" in le_trans, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R; j \<le> k; snd c j \<in> carrier S\<rbrakk> \<Longrightarrow> -\<^sub>a snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup> = (-\<^sub>a\<^bsub>S\<^esub> snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>
[PROOF STEP]
apply (simp add:Subring_minus_ring_minus,
       frule_tac x = "(snd c) j" in mem_subring_mem_ring[of S], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R; j \<le> k; snd c j \<in> carrier S; snd c j \<in> carrier R\<rbrakk> \<Longrightarrow> -\<^sub>a snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup> = (-\<^sub>a snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>
[PROOF STEP]
apply (subst ring_inv1_1, assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>j. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R; j \<le> k; snd c j \<in> carrier S; snd c j \<in> carrier R\<rbrakk> \<Longrightarrow> X^\<^bsup>R j\<^esup> \<in> carrier R
 2. \<And>j. \<lbrakk>pol_coeff S c; k \<le> fst c; Subring R S; Ring S; aGroup S; aGroup R; X \<in> carrier R; j \<le> k; snd c j \<in> carrier S; snd c j \<in> carrier R\<rbrakk> \<Longrightarrow> (-\<^sub>a snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup> = (-\<^sub>a snd c j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>
[PROOF STEP]
apply (simp add:npClose, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in normalization_semidom) normalize_power_normalize:
  "normalize (normalize x ^ n) = normalize (x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (normalize x ^ n) = normalize (x ^ n)
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. normalize (normalize x ^ 0) = normalize (x ^ 0)
 2. \<And>n. normalize (normalize x ^ n) = normalize (x ^ n) \<Longrightarrow> normalize (normalize x ^ Suc n) = normalize (x ^ Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
normalize (normalize x ^ n) = normalize (x ^ n)

goal (2 subgoals):
 1. normalize (normalize x ^ 0) = normalize (x ^ 0)
 2. \<And>n. normalize (normalize x ^ n) = normalize (x ^ n) \<Longrightarrow> normalize (normalize x ^ Suc n) = normalize (x ^ Suc n)
[PROOF STEP]
have "normalize (normalize x ^ Suc n) = normalize (x * normalize (normalize x ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (normalize x ^ Suc n) = normalize (x * normalize (normalize x ^ n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
normalize (normalize x ^ Suc n) = normalize (x * normalize (normalize x ^ n))

goal (2 subgoals):
 1. normalize (normalize x ^ 0) = normalize (x ^ 0)
 2. \<And>n. normalize (normalize x ^ n) = normalize (x ^ n) \<Longrightarrow> normalize (normalize x ^ Suc n) = normalize (x ^ Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
normalize (normalize x ^ Suc n) = normalize (x * normalize (normalize x ^ n))

goal (2 subgoals):
 1. normalize (normalize x ^ 0) = normalize (x ^ 0)
 2. \<And>n. normalize (normalize x ^ n) = normalize (x ^ n) \<Longrightarrow> normalize (normalize x ^ Suc n) = normalize (x ^ Suc n)
[PROOF STEP]
note Suc.IH
[PROOF STATE]
proof (state)
this:
normalize (normalize x ^ n) = normalize (x ^ n)

goal (2 subgoals):
 1. normalize (normalize x ^ 0) = normalize (x ^ 0)
 2. \<And>n. normalize (normalize x ^ n) = normalize (x ^ n) \<Longrightarrow> normalize (normalize x ^ Suc n) = normalize (x ^ Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
normalize (normalize x ^ Suc n) = normalize (x * normalize (x ^ n))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
normalize (normalize x ^ Suc n) = normalize (x * normalize (x ^ n))

goal (1 subgoal):
 1. normalize (normalize x ^ Suc n) = normalize (x ^ Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
normalize (normalize x ^ Suc n) = normalize (x ^ Suc n)

goal (1 subgoal):
 1. normalize (normalize x ^ 0) = normalize (x ^ 0)
[PROOF STEP]
qed auto


[STATEMENT]
lemma finpref_mono2: "s \<le> t \<Longrightarrow> finpref A s \<subseteq> finpref A t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<le> t \<Longrightarrow> finpref A s \<subseteq> finpref A t
[PROOF STEP]
by (unfold finpref_def) (auto dest: llist_le_trans)


[STATEMENT]
lemma degree_le: "\<forall>i>n. coeff p i = 0 \<Longrightarrow> degree p \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i>n. coeff p i = (0::'a) \<Longrightarrow> degree p \<le> n
[PROOF STEP]
unfolding degree_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i>n. coeff p i = (0::'a) \<Longrightarrow> (LEAST n. \<forall>i>n. coeff p i = (0::'a)) \<le> n
[PROOF STEP]
by (erule Least_le)


[STATEMENT]
lemma tensor_op_0_right[simp]: \<open>tensor_op x 0 = (0 :: ('a::finite*'b::finite) ell2 \<Rightarrow>\<^sub>C\<^sub>L ('c::finite*'d::finite) ell2)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<otimes>\<^sub>o 0 = 0
[PROOF STEP]
apply (rule equal_ket)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. (x \<otimes>\<^sub>o 0) *\<^sub>V ket xa = 0 *\<^sub>V ket xa
[PROOF STEP]
by (auto simp flip: tensor_ell2_ket simp: tensor_op_ell2)


[STATEMENT]
lemma (in group) solve_equation:
  assumes "subgroup H G" "x \<in> H" "y \<in> H"
  shows "\<exists>h \<in> H. y = h \<otimes> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>h\<in>H. y = h \<otimes> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>h\<in>H. y = h \<otimes> x
[PROOF STEP]
have "y = (y \<otimes> (inv x)) \<otimes> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = y \<otimes> inv x \<otimes> x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
subgroup H G
x \<in> H
y \<in> H

goal (1 subgoal):
 1. y = y \<otimes> inv x \<otimes> x
[PROOF STEP]
by (simp add: m_assoc subgroup.mem_carrier)
[PROOF STATE]
proof (state)
this:
y = y \<otimes> inv x \<otimes> x

goal (1 subgoal):
 1. \<exists>h\<in>H. y = h \<otimes> x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
y = y \<otimes> inv x \<otimes> x

goal (1 subgoal):
 1. \<exists>h\<in>H. y = h \<otimes> x
[PROOF STEP]
have "y \<otimes> (inv x) \<in> H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<otimes> inv x \<in> H
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
subgroup H G
x \<in> H
y \<in> H

goal (1 subgoal):
 1. y \<otimes> inv x \<in> H
[PROOF STEP]
by (simp add: subgroup_def)
[PROOF STATE]
proof (state)
this:
y \<otimes> inv x \<in> H

goal (1 subgoal):
 1. \<exists>h\<in>H. y = h \<otimes> x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
y = y \<otimes> inv x \<otimes> x
y \<otimes> inv x \<in> H
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y = y \<otimes> inv x \<otimes> x
y \<otimes> inv x \<in> H

goal (1 subgoal):
 1. \<exists>h\<in>H. y = h \<otimes> x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>h\<in>H. y = h \<otimes> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diameter_obtains:
  obtains v where "v \<in> V" and "diameter = eccentricity v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> V; diameter = eccentricity v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> V; diameter = eccentricity v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "diameter = Max ((\<lambda> v. eccentricity v) ` V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diameter = Max (eccentricity ` V)
[PROOF STEP]
using diameter_Max_alt
[PROOF STATE]
proof (prove)
using this:
diameter = Max (eccentricity ` V)

goal (1 subgoal):
 1. diameter = Max (eccentricity ` V)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diameter = Max (eccentricity ` V)

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> V; diameter = eccentricity v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
diameter = Max (eccentricity ` V)
[PROOF STEP]
obtain v where "v \<in> V" and "diameter = eccentricity v"
[PROOF STATE]
proof (prove)
using this:
diameter = Max (eccentricity ` V)

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> V; diameter = eccentricity v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using obtains_MAX[of V "(\<lambda> v . eccentricity v)"] not_empty finV
[PROOF STATE]
proof (prove)
using this:
diameter = Max (eccentricity ` V)
\<lbrakk>finite V; V \<noteq> {}; \<And>x. \<lbrakk>x \<in> V; Max (eccentricity ` V) = eccentricity x\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
V \<noteq> {}
finite V

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> V; diameter = eccentricity v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> V
diameter = eccentricity v

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> V; diameter = eccentricity v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
v \<in> V
diameter = eccentricity v

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma antisymPI: "(\<And>x y. \<lbrakk> r x y; r y x \<rbrakk> \<Longrightarrow> x = y) \<Longrightarrow> antisymp r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>r x y; r y x\<rbrakk> \<Longrightarrow> x = y) \<Longrightarrow> antisymp r
[PROOF STEP]
by (fact antisympI)


[STATEMENT]
lemma is_denormal_denormal_of_Float: "is_denormal (denormal_of_Float x::('e, 'f)float)"
  if "is_denormal_Float TYPE(('e, 'f)float) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_denormal (denormal_of_Float x)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
is_denormal_Float TYPE(('e, 'f) IEEE.float) x

goal (1 subgoal):
 1. is_denormal (denormal_of_Float x)
[PROOF STEP]
by (auto simp: is_denormal_def exponent_denormal_of_Float that is_denormal_Float_def
      emax_eq fraction_denormal_of_Float le_nat_iff bias_def)


[STATEMENT]
lemma (in Ring) int_ideal:"\<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> ideal R (I \<inter> J)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> ideal R (I \<inter> J)
[PROOF STEP]
apply (rule ideal_condition1)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> I \<inter> J \<subseteq> carrier R
 2. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> I \<inter> J \<noteq> {}
 3. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> \<forall>x\<in>I \<inter> J. \<forall>y\<in>I \<inter> J. x \<plusminus> y \<in> I \<inter> J
 4. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> \<forall>r\<in>carrier R. \<forall>x\<in>I \<inter> J. r \<cdot>\<^sub>r x \<in> I \<inter> J
[PROOF STEP]
apply (frule ideal_subset1[of "I"], frule ideal_subset1[of "J"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>ideal R I; ideal R J; I \<subseteq> carrier R; J \<subseteq> carrier R\<rbrakk> \<Longrightarrow> I \<inter> J \<subseteq> carrier R
 2. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> I \<inter> J \<noteq> {}
 3. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> \<forall>x\<in>I \<inter> J. \<forall>y\<in>I \<inter> J. x \<plusminus> y \<in> I \<inter> J
 4. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> \<forall>r\<in>carrier R. \<forall>x\<in>I \<inter> J. r \<cdot>\<^sub>r x \<in> I \<inter> J
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> I \<inter> J \<noteq> {}
 2. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> \<forall>x\<in>I \<inter> J. \<forall>y\<in>I \<inter> J. x \<plusminus> y \<in> I \<inter> J
 3. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> \<forall>r\<in>carrier R. \<forall>x\<in>I \<inter> J. r \<cdot>\<^sub>r x \<in> I \<inter> J
[PROOF STEP]
apply (frule ideal_zero[of "I"], frule ideal_zero[of "J"], blast)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> \<forall>x\<in>I \<inter> J. \<forall>y\<in>I \<inter> J. x \<plusminus> y \<in> I \<inter> J
 2. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> \<forall>r\<in>carrier R. \<forall>x\<in>I \<inter> J. r \<cdot>\<^sub>r x \<in> I \<inter> J
[PROOF STEP]
apply ((rule ballI)+, simp, (erule conjE)+,
         simp add:ideal_pOp_closed)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal R I; ideal R J\<rbrakk> \<Longrightarrow> \<forall>r\<in>carrier R. \<forall>x\<in>I \<inter> J. r \<cdot>\<^sub>r x \<in> I \<inter> J
[PROOF STEP]
apply ((rule ballI)+, simp, (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r x. \<lbrakk>ideal R I; ideal R J; r \<in> carrier R; x \<in> I; x \<in> J\<rbrakk> \<Longrightarrow> r \<cdot>\<^sub>r x \<in> I \<and> r \<cdot>\<^sub>r x \<in> J
[PROOF STEP]
apply (simp add:ideal_ring_multiple)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done