[STATEMENT]
lemma HMA_foldl_echelon_form_of_column_k:
  assumes k: "k\<le>CARD('n)"
  shows "((Mod_Type_Connect.HMA_M :: _ \<Rightarrow> int ^ 'n :: mod_type ^ 'm :: mod_type \<Rightarrow> _) ===> (=)
    ===> (rel_prod (Mod_Type_Connect.HMA_M) (\<lambda>a b. a=b \<and> a\<le>CARD('m))))
  (\<lambda>A bezout. (foldl (echelon_form_of_column_k_JNF bezout) (A,0) [0..<k]))
  (\<lambda>A bezout. (foldl (echelon_form_of_column_k bezout) (A,0) [0..<k]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Mod_Type_Connect.HMA_M ===> (=) ===> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m))) (\<lambda>A bezout. foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (\<lambda>A bezout. foldl (echelon_form_of_column_k bezout) (A, 0) [0..<k])
[PROOF STEP]
proof (intro rel_funI, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y xa ya. \<lbrakk>Mod_Type_Connect.HMA_M x y; xa = ya\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF xa) (x, 0) [0..<k]) (foldl (echelon_form_of_column_k ya) (y, 0) [0..<k])
[PROOF STEP]
case (1 A A' bezout bezout')
[PROOF STATE]
proof (state)
this:
Mod_Type_Connect.HMA_M A A'
bezout = bezout'

goal (1 subgoal):
 1. \<And>x y xa ya. \<lbrakk>Mod_Type_Connect.HMA_M x y; xa = ya\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF xa) (x, 0) [0..<k]) (foldl (echelon_form_of_column_k ya) (y, 0) [0..<k])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Mod_Type_Connect.HMA_M A A'
bezout = bezout'
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Mod_Type_Connect.HMA_M A A'
bezout = bezout'

goal (1 subgoal):
 1. rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k])
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Mod_Type_Connect.HMA_M A A'
bezout = bezout'
k \<le> CARD('n)

goal (1 subgoal):
 1. rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k])
[PROOF STEP]
proof (induct k arbitrary: A A' )
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; 0 \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<0]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<0])
 2. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
Mod_Type_Connect.HMA_M A A'
bezout = bezout'
0 \<le> CARD('n)

goal (2 subgoals):
 1. \<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; 0 \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<0]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<0])
 2. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Mod_Type_Connect.HMA_M A A'
bezout = bezout'
0 \<le> CARD('n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Mod_Type_Connect.HMA_M A A'
bezout = bezout'
0 \<le> CARD('n)

goal (1 subgoal):
 1. rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<0]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<0])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<0]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<0])

goal (1 subgoal):
 1. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
\<lbrakk>Mod_Type_Connect.HMA_M ?A ?A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (?A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (?A', 0) [0..<k])
Mod_Type_Connect.HMA_M A A'
bezout = bezout'
Suc k \<le> CARD('n)

goal (1 subgoal):
 1. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
note AA'[transfer_rule] = "Suc.prems"(1)
[PROOF STATE]
proof (state)
this:
Mod_Type_Connect.HMA_M A A'

goal (1 subgoal):
 1. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
note bb'[transfer_rule] = "Suc.prems"(2)
[PROOF STATE]
proof (state)
this:
bezout = bezout'

goal (1 subgoal):
 1. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
note Suc_k_less_m = "Suc.prems"(3)
[PROOF STATE]
proof (state)
this:
Suc k \<le> CARD('n)

goal (1 subgoal):
 1. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
let ?foldl_JNF = "foldl (echelon_form_of_column_k_JNF bezout) (A,0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
let ?foldl_HA = "foldl (echelon_form_of_column_k bezout') (A',0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
have set_rw: "[0..<Suc k] = [0..<k] @ [k]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<Suc k] = [0..<k] @ [k]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[0..<Suc k] = [0..<k] @ [k]

goal (1 subgoal):
 1. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
have f_JNF: "?foldl_JNF [0..<Suc k] = echelon_form_of_column_k_JNF bezout (?foldl_JNF [0..<k]) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k] = echelon_form_of_column_k_JNF bezout (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k] = echelon_form_of_column_k_JNF bezout (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) k

goal (1 subgoal):
 1. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
have f_HA: "?foldl_HA [0..<Suc k] = echelon_form_of_column_k bezout' (?foldl_HA [0..<k]) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k] = echelon_form_of_column_k bezout' (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]) k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k] = echelon_form_of_column_k bezout' (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]) k

goal (1 subgoal):
 1. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
have hyp[transfer_rule]: "rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a=b \<and> a\<le>CARD('m)) (?foldl_JNF [0..<k]) (?foldl_HA [0..<k])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k])
[PROOF STEP]
by (rule Suc.hyps[OF AA'], insert Suc.prems, auto)
[PROOF STATE]
proof (state)
this:
rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k])

goal (1 subgoal):
 1. \<And>k A A'. \<lbrakk>\<And>A A'. \<lbrakk>Mod_Type_Connect.HMA_M A A'; bezout = bezout'; k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]); Mod_Type_Connect.HMA_M A A'; bezout = bezout'; Suc k \<le> CARD('n)\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
unfolding f_JNF
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (echelon_form_of_column_k_JNF bezout (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) k) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])
[PROOF STEP]
unfolding f_HA bb'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (echelon_form_of_column_k_JNF bezout' (foldl (echelon_form_of_column_k_JNF bezout') (A, 0) [0..<k]) k) (echelon_form_of_column_k bezout' (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]) k)
[PROOF STEP]
using HMA_echelon_form_of_column_k'
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?k < CARD(?'n); ?i \<le> CARD(?'m); Mod_Type_Connect.HMA_M ?A ?A'\<rbrakk> \<Longrightarrow> rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD(?'m)) (echelon_form_of_column_k_JNF ?bezout (?A, ?i) ?k) (echelon_form_of_column_k ?bezout (?A', ?i) ?k)

goal (1 subgoal):
 1. rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (echelon_form_of_column_k_JNF bezout' (foldl (echelon_form_of_column_k_JNF bezout') (A, 0) [0..<k]) k) (echelon_form_of_column_k bezout' (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k]) k)
[PROOF STEP]
by (smt "1"(2) Suc_k_less_m Suc_le_lessD hyp rel_prod.cases)
[PROOF STATE]
proof (state)
this:
rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<Suc k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<Suc k])

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
rel_prod Mod_Type_Connect.HMA_M (\<lambda>a b. a = b \<and> a \<le> CARD('m)) (foldl (echelon_form_of_column_k_JNF bezout) (A, 0) [0..<k]) (foldl (echelon_form_of_column_k bezout') (A', 0) [0..<k])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group_hom) hom_ord_dvd_ord:
  assumes "a \<in> carrier G"
  shows "H.ord (h a) dvd G.ord a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H.ord (h a) dvd G.ord a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. H.ord (h a) dvd G.ord a
[PROOF STEP]
have "h a [^]\<^bsub>H\<^esub> (G.ord a) = h (a [^]\<^bsub>G\<^esub> G.ord a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h a [^]\<^bsub>H\<^esub> G.ord a = h (a [^] G.ord a)
[PROOF STEP]
using assms local.hom_nat_pow
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
?x \<in> carrier G \<Longrightarrow> h (?x [^] ?n) = h ?x [^]\<^bsub>H\<^esub> ?n

goal (1 subgoal):
 1. h a [^]\<^bsub>H\<^esub> G.ord a = h (a [^] G.ord a)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
h a [^]\<^bsub>H\<^esub> G.ord a = h (a [^] G.ord a)

goal (1 subgoal):
 1. H.ord (h a) dvd G.ord a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
h a [^]\<^bsub>H\<^esub> G.ord a = h (a [^] G.ord a)

goal (1 subgoal):
 1. H.ord (h a) dvd G.ord a
[PROOF STEP]
have "\<dots> = h (\<one>\<^bsub>G\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h (a [^] G.ord a) = h \<one>
[PROOF STEP]
using G.pow_ord_eq_1 assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> carrier G \<Longrightarrow> ?x [^] G.ord ?x = \<one>
a \<in> carrier G

goal (1 subgoal):
 1. h (a [^] G.ord a) = h \<one>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
h (a [^] G.ord a) = h \<one>

goal (1 subgoal):
 1. H.ord (h a) dvd G.ord a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
h (a [^] G.ord a) = h \<one>

goal (1 subgoal):
 1. H.ord (h a) dvd G.ord a
[PROOF STEP]
have "\<dots> = \<one>\<^bsub>H\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h \<one> = \<one>\<^bsub>H\<^esub>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
h \<one> = \<one>\<^bsub>H\<^esub>

goal (1 subgoal):
 1. H.ord (h a) dvd G.ord a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
h a [^]\<^bsub>H\<^esub> G.ord a = \<one>\<^bsub>H\<^esub>
[PROOF STEP]
have "h a [^]\<^bsub>H\<^esub> G.ord a = \<one>\<^bsub>H\<^esub>"
[PROOF STATE]
proof (prove)
using this:
h a [^]\<^bsub>H\<^esub> G.ord a = \<one>\<^bsub>H\<^esub>

goal (1 subgoal):
 1. h a [^]\<^bsub>H\<^esub> G.ord a = \<one>\<^bsub>H\<^esub>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
h a [^]\<^bsub>H\<^esub> G.ord a = \<one>\<^bsub>H\<^esub>

goal (1 subgoal):
 1. H.ord (h a) dvd G.ord a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
h a [^]\<^bsub>H\<^esub> G.ord a = \<one>\<^bsub>H\<^esub>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
h a [^]\<^bsub>H\<^esub> G.ord a = \<one>\<^bsub>H\<^esub>

goal (1 subgoal):
 1. H.ord (h a) dvd G.ord a
[PROOF STEP]
using pow_eq_id assms
[PROOF STATE]
proof (prove)
using this:
h a [^]\<^bsub>H\<^esub> G.ord a = \<one>\<^bsub>H\<^esub>
?x \<in> carrier H \<Longrightarrow> (?x [^]\<^bsub>H\<^esub> ?n = \<one>\<^bsub>H\<^esub>) = (H.ord ?x dvd ?n)
a \<in> carrier G

goal (1 subgoal):
 1. H.ord (h a) dvd G.ord a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
H.ord (h a) dvd G.ord a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma TC_induct_down_lemma:
  assumes ab: "a \<sqsubset> b" and base: "b \<le> d"
      and step: "\<And>y z. \<lbrakk>y \<sqsubset> b; y \<in> elts d; z \<in> elts y\<rbrakk> \<Longrightarrow> z \<in> elts d"
    shows "a \<in> elts d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> elts d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<in> elts d
[PROOF STEP]
have "Transset (TC b \<sqinter> d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Transset (TC b \<sqinter> d)
[PROOF STEP]
using Transset_TC
[PROOF STATE]
proof (prove)
using this:
Transset (TC ?a)

goal (1 subgoal):
 1. Transset (TC b \<sqinter> d)
[PROOF STEP]
unfolding Transset_def
[PROOF STATE]
proof (prove)
using this:
\<forall>y\<in>elts (TC ?a). y \<le> TC ?a

goal (1 subgoal):
 1. \<forall>y\<in>elts (TC b \<sqinter> d). y \<le> TC b \<sqinter> d
[PROOF STEP]
by (metis inf.bounded_iff less_TC_def less_eq_V_def local.step subsetI vsubsetD)
[PROOF STATE]
proof (state)
this:
Transset (TC b \<sqinter> d)

goal (1 subgoal):
 1. a \<in> elts d
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Transset (TC b \<sqinter> d)

goal (1 subgoal):
 1. a \<in> elts d
[PROOF STEP]
have "b \<le> TC b \<sqinter> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<le> TC b \<sqinter> d
[PROOF STEP]
by (simp add: arg_subset_TC base)
[PROOF STATE]
proof (state)
this:
b \<le> TC b \<sqinter> d

goal (1 subgoal):
 1. a \<in> elts d
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Transset (TC b \<sqinter> d)
b \<le> TC b \<sqinter> d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Transset (TC b \<sqinter> d)
b \<le> TC b \<sqinter> d

goal (1 subgoal):
 1. a \<in> elts d
[PROOF STEP]
using TC_least [THEN vsubsetD] ab
[PROOF STATE]
proof (prove)
using this:
Transset (TC b \<sqinter> d)
b \<le> TC b \<sqinter> d
\<lbrakk>Transset ?b; ?a1 \<le> ?b; ?c \<in> elts (TC ?a1)\<rbrakk> \<Longrightarrow> ?c \<in> elts ?b
a \<sqsubset> b

goal (1 subgoal):
 1. a \<in> elts d
[PROOF STEP]
unfolding less_TC_def
[PROOF STATE]
proof (prove)
using this:
Transset (TC b \<sqinter> d)
b \<le> TC b \<sqinter> d
\<lbrakk>Transset ?b; ?a1 \<le> ?b; ?c \<in> elts (TC ?a1)\<rbrakk> \<Longrightarrow> ?c \<in> elts ?b
a \<in> elts (TC b)

goal (1 subgoal):
 1. a \<in> elts d
[PROOF STEP]
by (meson TC_least le_inf_iff vsubsetD)
[PROOF STATE]
proof (state)
this:
a \<in> elts d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quat_inner_1_right [simp]: "inner x 1 = Re x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bullet> 1 = quat.Re x
[PROOF STEP]
unfolding inner_quat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quat.Re x * quat.Re 1 + Im1 x * Im1 1 + Im2 x * Im2 1 + Im3 x * Im3 1 = quat.Re x
[PROOF STEP]
by simp


[STATEMENT]
lemma differentiable_cmult_right_iff [simp]:
  fixes c::"'a::real_normed_field"
  shows "(\<lambda>t. q t * c) differentiable at t \<longleftrightarrow> c = 0 \<or> (\<lambda>t. q t) differentiable at t" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. q t * c) differentiable at t) = (c = (0::'a) \<or> q differentiable at t)
[PROOF STEP]
by (simp add: mult.commute flip: differentiable_cmult_left_iff)


[STATEMENT]
lemma multiplicity_radical_prime:
  assumes "prime p" "x \<noteq> 0"
  shows   "multiplicity p (radical x) = (if p dvd x then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (radical x) = (if p dvd x then 1 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity p (radical x) = (if p dvd x then 1 else 0)
[PROOF STEP]
have "multiplicity p (radical x) = (\<Sum>q\<in>prime_factors x. multiplicity p q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (radical x) = sum (multiplicity p) (prime_factors x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
x \<noteq> (0::'a)

goal (1 subgoal):
 1. multiplicity p (radical x) = sum (multiplicity p) (prime_factors x)
[PROOF STEP]
unfolding radical_def
[PROOF STATE]
proof (prove)
using this:
prime p
x \<noteq> (0::'a)

goal (1 subgoal):
 1. multiplicity p (if x = (0::'a) then 0::'a else \<Prod>(prime_factors x)) = sum (multiplicity p) (prime_factors x)
[PROOF STEP]
by (auto simp: prime_elem_multiplicity_prod_distrib)
[PROOF STATE]
proof (state)
this:
multiplicity p (radical x) = sum (multiplicity p) (prime_factors x)

goal (1 subgoal):
 1. multiplicity p (radical x) = (if p dvd x then 1 else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity p (radical x) = sum (multiplicity p) (prime_factors x)

goal (1 subgoal):
 1. multiplicity p (radical x) = (if p dvd x then 1 else 0)
[PROOF STEP]
have "\<dots> = (\<Sum>q\<in>prime_factors x. if p = q then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (multiplicity p) (prime_factors x) = (\<Sum>q\<in>prime_factors x. if p = q then 1 else 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
x \<noteq> (0::'a)

goal (1 subgoal):
 1. sum (multiplicity p) (prime_factors x) = (\<Sum>q\<in>prime_factors x. if p = q then 1 else 0)
[PROOF STEP]
by (intro Groups_Big.sum.cong) (auto intro!: prime_multiplicity_other)
[PROOF STATE]
proof (state)
this:
sum (multiplicity p) (prime_factors x) = (\<Sum>q\<in>prime_factors x. if p = q then 1 else 0)

goal (1 subgoal):
 1. multiplicity p (radical x) = (if p dvd x then 1 else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (multiplicity p) (prime_factors x) = (\<Sum>q\<in>prime_factors x. if p = q then 1 else 0)

goal (1 subgoal):
 1. multiplicity p (radical x) = (if p dvd x then 1 else 0)
[PROOF STEP]
have "\<dots> = (if p \<in> prime_factors x then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q\<in>prime_factors x. if p = q then 1 else 0) = (if p \<in> prime_factors x then 1 else 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>prime_factors x. if p = q then 1 else 0) = (if p \<in> prime_factors x then 1 else 0)

goal (1 subgoal):
 1. multiplicity p (radical x) = (if p dvd x then 1 else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>prime_factors x. if p = q then 1 else 0) = (if p \<in> prime_factors x then 1 else 0)

goal (1 subgoal):
 1. multiplicity p (radical x) = (if p dvd x then 1 else 0)
[PROOF STEP]
have "\<dots> = (if p dvd x then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if p \<in> prime_factors x then 1 else 0) = (if p dvd x then 1 else 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
x \<noteq> (0::'a)

goal (1 subgoal):
 1. (if p \<in> prime_factors x then 1 else 0) = (if p dvd x then 1 else 0)
[PROOF STEP]
by (auto simp: prime_factors_dvd)
[PROOF STATE]
proof (state)
this:
(if p \<in> prime_factors x then 1 else 0) = (if p dvd x then 1 else 0)

goal (1 subgoal):
 1. multiplicity p (radical x) = (if p dvd x then 1 else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
multiplicity p (radical x) = (if p dvd x then 1 else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
multiplicity p (radical x) = (if p dvd x then 1 else 0)

goal (1 subgoal):
 1. multiplicity p (radical x) = (if p dvd x then 1 else 0)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
multiplicity p (radical x) = (if p dvd x then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cartesian_product_margin1:
assumes "a\<in>A"
shows "{p\<in>A\<times>B. fst p = a} = {a}\<times>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p \<in> A \<times> B. fst p = a} = {a} \<times> B
[PROOF STEP]
using SigmaI assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> ?A; ?b \<in> ?B ?a\<rbrakk> \<Longrightarrow> (?a, ?b) \<in> Sigma ?A ?B
a \<in> A

goal (1 subgoal):
 1. {p \<in> A \<times> B. fst p = a} = {a} \<times> B
[PROOF STEP]
by auto


[STATEMENT]
theorem games_lfp_eq_gfp: "games_lfp = games_gfp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. games_lfp = games_gfp
[PROOF STEP]
apply (auto simp add: games_gfp_imp_lfp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> games_lfp \<Longrightarrow> x \<in> games_gfp
[PROOF STEP]
apply (insert games_lfp_subset_gfp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> games_lfp; games_lfp \<subseteq> games_gfp\<rbrakk> \<Longrightarrow> x \<in> games_gfp
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma equiv_utrans_trans[trans]:
  assumes xy: "equiv_utrans x y"
      and yz: "equiv_utrans y z"
  shows "equiv_utrans x z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equiv_utrans x z
[PROOF STEP]
proof(rule le_utrans_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. le_utrans x z
 2. le_utrans z x
[PROOF STEP]
from xy
[PROOF STATE]
proof (chain)
picking this:
equiv_utrans x y
[PROOF STEP]
have "le_utrans x y"
[PROOF STATE]
proof (prove)
using this:
equiv_utrans x y

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

goal (2 subgoals):
 1. le_utrans x z
 2. le_utrans z x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
le_utrans x y

goal (2 subgoals):
 1. le_utrans x z
 2. le_utrans z x
[PROOF STEP]
from yz
[PROOF STATE]
proof (chain)
picking this:
equiv_utrans y z
[PROOF STEP]
have "le_utrans y z"
[PROOF STATE]
proof (prove)
using this:
equiv_utrans y z

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

goal (2 subgoals):
 1. le_utrans x z
 2. le_utrans z x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
le_utrans x z
[PROOF STEP]
show "le_utrans x z"
[PROOF STATE]
proof (prove)
using this:
le_utrans x z

goal (1 subgoal):
 1. le_utrans x z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
le_utrans x z

goal (1 subgoal):
 1. le_utrans z x
[PROOF STEP]
from yz
[PROOF STATE]
proof (chain)
picking this:
equiv_utrans y z
[PROOF STEP]
have "le_utrans z y"
[PROOF STATE]
proof (prove)
using this:
equiv_utrans y z

goal (1 subgoal):
 1. le_utrans z y
[PROOF STEP]
by(force simp:ac_simps)
[PROOF STATE]
proof (state)
this:
le_utrans z y

goal (1 subgoal):
 1. le_utrans z x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
le_utrans z y

goal (1 subgoal):
 1. le_utrans z x
[PROOF STEP]
from xy
[PROOF STATE]
proof (chain)
picking this:
equiv_utrans x y
[PROOF STEP]
have "le_utrans y x"
[PROOF STATE]
proof (prove)
using this:
equiv_utrans x y

goal (1 subgoal):
 1. le_utrans y x
[PROOF STEP]
by(force simp:ac_simps)
[PROOF STATE]
proof (state)
this:
le_utrans y x

goal (1 subgoal):
 1. le_utrans z x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
le_utrans z x
[PROOF STEP]
show "le_utrans z x"
[PROOF STATE]
proof (prove)
using this:
le_utrans z x

goal (1 subgoal):
 1. le_utrans z x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
le_utrans z x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gbinomial_Suc_Suc: "(a + 1) gchoose (Suc k) = a gchoose k + (a gchoose (Suc k))"
  for a :: "'a::field_char_0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
proof (cases k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = 0 \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
 2. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
k = 0

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
 2. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k = 0

goal (1 subgoal):
 1. a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
case (Suc h)
[PROOF STATE]
proof (state)
this:
k = Suc h

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have eq0: "(\<Prod>i\<in>{1..k}. (a + 1) - of_nat i) = (\<Prod>i\<in>{0..h}. a - of_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 1..k. a + (1::'a) - of_nat i) = (\<Prod>i = 0..h. a - of_nat i)
[PROOF STEP]
proof (rule prod.reindex_cong)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. inj_on ?l {0..h}
 2. {1..k} = ?l ` {0..h}
 3. \<And>x. x \<in> {0..h} \<Longrightarrow> a + (1::'a) - of_nat (?l x) = a - of_nat x
[PROOF STEP]
show "{1..k} = Suc ` {0..h}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {1..k} = Suc ` {0..h}
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
k = Suc h

goal (1 subgoal):
 1. {1..k} = Suc ` {0..h}
[PROOF STEP]
by (auto simp add: image_Suc_atMost)
[PROOF STATE]
proof (state)
this:
{1..k} = Suc ` {0..h}

goal (2 subgoals):
 1. inj_on Suc {0..h}
 2. \<And>x. x \<in> {0..h} \<Longrightarrow> a + (1::'a) - of_nat (Suc x) = a - of_nat x
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 1..k. a + (1::'a) - of_nat i) = (\<Prod>i = 0..h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "fact (Suc k) * (a gchoose k + (a gchoose (Suc k))) =
      (a gchoose Suc h) * (fact (Suc (Suc h))) +
      (a gchoose Suc (Suc h)) * (fact (Suc (Suc h)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (Suc k) * (a gchoose k + (a gchoose Suc k)) = (a gchoose Suc h) * fact (Suc (Suc h)) + (a gchoose Suc (Suc h)) * fact (Suc (Suc h))
[PROOF STEP]
by (simp add: Suc field_simps del: fact_Suc)
[PROOF STATE]
proof (state)
this:
fact (Suc k) * (a gchoose k + (a gchoose Suc k)) = (a gchoose Suc h) * fact (Suc (Suc h)) + (a gchoose Suc (Suc h)) * fact (Suc (Suc h))

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact (Suc k) * (a gchoose k + (a gchoose Suc k)) = (a gchoose Suc h) * fact (Suc (Suc h)) + (a gchoose Suc (Suc h)) * fact (Suc (Suc h))

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> =
    (a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i=0..Suc h. a - of_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a gchoose Suc h) * fact (Suc (Suc h)) + (a gchoose Suc (Suc h)) * fact (Suc (Suc h)) = (a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i)
[PROOF STEP]
apply (simp only: gbinomial_mult_fact field_simps mult.left_commute [of _ "2"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a gchoose Suc h) * fact (Suc (Suc h)) + (\<Prod>i = 0..<Suc (Suc h). a - of_nat i) = (\<Prod>i = 0..Suc h. a - of_nat i) + (a gchoose Suc h) * of_nat (fact (Suc h) * Suc (Suc h))
[PROOF STEP]
apply (simp del: fact_Suc add: fact_Suc [of "Suc h"] field_simps gbinomial_mult_fact
      mult.left_commute [of _ "2"] atLeastLessThanSuc_atLeastAtMost)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(a gchoose Suc h) * fact (Suc (Suc h)) + (a gchoose Suc (Suc h)) * fact (Suc (Suc h)) = (a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a gchoose Suc h) * fact (Suc (Suc h)) + (a gchoose Suc (Suc h)) * fact (Suc (Suc h)) = (a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> =
    (fact (Suc h) * (a gchoose Suc h)) * of_nat (Suc (Suc h)) + (\<Prod>i=0..Suc h. a - of_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = fact (Suc h) * (a gchoose Suc h) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i)
[PROOF STEP]
by (simp only: fact_Suc mult.commute mult.left_commute of_nat_fact of_nat_id of_nat_mult)
[PROOF STATE]
proof (state)
this:
(a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = fact (Suc h) * (a gchoose Suc h) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a gchoose Suc h) * of_nat (Suc (Suc h) * fact (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = fact (Suc h) * (a gchoose Suc h) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> =
    of_nat (Suc (Suc h)) * (\<Prod>i=0..h. a - of_nat i) + (\<Prod>i=0..Suc h. a - of_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (Suc h) * (a gchoose Suc h) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i)
[PROOF STEP]
unfolding gbinomial_mult_fact atLeastLessThanSuc_atLeastAtMost
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..h. a - of_nat i) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fact (Suc h) * (a gchoose Suc h) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact (Suc h) * (a gchoose Suc h) * of_nat (Suc (Suc h)) + (\<Prod>i = 0..Suc h. a - of_nat i) = of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> =
    (\<Prod>i=0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i=0..h. a - of_nat i) + 2 * (\<Prod>i=0..h. a - of_nat i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i) = (\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i) = (\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i))

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat (Suc (Suc h)) * (\<Prod>i = 0..h. a - of_nat i) + (\<Prod>i = 0..Suc h. a - of_nat i) = (\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i))

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> =
    ((a gchoose Suc h) * (fact (Suc h)) * of_nat (Suc k)) + (\<Prod>i\<in>{0..Suc h}. a - of_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i)) = (a gchoose Suc h) * fact (Suc h) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i)
[PROOF STEP]
unfolding gbinomial_mult_fact'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i)) = (\<Prod>i = 0..<Suc h. a - of_nat i) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i)
[PROOF STEP]
by (simp add: comm_semiring_class.distrib field_simps Suc atLeastLessThanSuc_atLeastAtMost)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i)) = (a gchoose Suc h) * fact (Suc h) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..Suc h. a - of_nat i) + (of_nat h * (\<Prod>i = 0..h. a - of_nat i) + (2::'a) * (\<Prod>i = 0..h. a - of_nat i)) = (a gchoose Suc h) * fact (Suc h) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> = (\<Prod>i\<in>{0..h}. a - of_nat i) * (a + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a gchoose Suc h) * fact (Suc h) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i) = (\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a))
[PROOF STEP]
unfolding gbinomial_mult_fact' atLeast0_atMost_Suc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<Suc h. a - of_nat i) * of_nat (Suc k) + (\<Prod>i\<in>insert (Suc h) {0..h}. a - of_nat i) = (\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a))
[PROOF STEP]
by (simp add: field_simps Suc atLeastLessThanSuc_atLeastAtMost)
[PROOF STATE]
proof (state)
this:
(a gchoose Suc h) * fact (Suc h) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i) = (\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a))

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a gchoose Suc h) * fact (Suc h) * of_nat (Suc k) + (\<Prod>i = 0..Suc h. a - of_nat i) = (\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a))

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> = (\<Prod>i\<in>{0..k}. (a + 1) - of_nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a)) = (\<Prod>i = 0..k. a + (1::'a) - of_nat i)
[PROOF STEP]
using eq0
[PROOF STATE]
proof (prove)
using this:
(\<Prod>i = 1..k. a + (1::'a) - of_nat i) = (\<Prod>i = 0..h. a - of_nat i)

goal (1 subgoal):
 1. (\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a)) = (\<Prod>i = 0..k. a + (1::'a) - of_nat i)
[PROOF STEP]
by (simp add: Suc prod.atLeast0_atMost_Suc_shift del: prod.cl_ivl_Suc)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a)) = (\<Prod>i = 0..k. a + (1::'a) - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..h. a - of_nat i) * (a + (1::'a)) = (\<Prod>i = 0..k. a + (1::'a) - of_nat i)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
have "\<dots> = (fact (Suc k)) * ((a + 1) gchoose (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..k. a + (1::'a) - of_nat i) = fact (Suc k) * (a + (1::'a) gchoose Suc k)
[PROOF STEP]
by (simp only: gbinomial_mult_fact atLeastLessThanSuc_atLeastAtMost)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..k. a + (1::'a) - of_nat i) = fact (Suc k) * (a + (1::'a) gchoose Suc k)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fact (Suc k) * (a gchoose k + (a gchoose Suc k)) = fact (Suc k) * (a + (1::'a) gchoose Suc k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fact (Suc k) * (a gchoose k + (a gchoose Suc k)) = fact (Suc k) * (a + (1::'a) gchoose Suc k)

goal (1 subgoal):
 1. a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
using fact_nonzero [of "Suc k"]
[PROOF STATE]
proof (prove)
using this:
fact (Suc k) * (a gchoose k + (a gchoose Suc k)) = fact (Suc k) * (a + (1::'a) gchoose Suc k)
fact (Suc k) \<noteq> (0::?'a)

goal (1 subgoal):
 1. a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a + (1::'a) gchoose Suc k = a gchoose k + (a gchoose Suc k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linear_independent_extend:
  "vs1.independent B \<Longrightarrow> \<exists>g. linear s1 s2 g \<and> (\<forall>x\<in>B. g x = f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vs1.independent B \<Longrightarrow> \<exists>g. linear (*a) (*b) g \<and> (\<forall>x\<in>B. g x = f x)
[PROOF STEP]
using linear_independent_extend_subspace[of B f]
[PROOF STATE]
proof (prove)
using this:
vs1.independent B \<Longrightarrow> \<exists>g. linear (*a) (*b) g \<and> (\<forall>x\<in>B. g x = f x) \<and> range g = vs2.span (f ` B)

goal (1 subgoal):
 1. vs1.independent B \<Longrightarrow> \<exists>g. linear (*a) (*b) g \<and> (\<forall>x\<in>B. g x = f x)
[PROOF STEP]
by auto


[STATEMENT]
lemma inj_on_rotate_min_iff:
assumes "\<forall>vs \<in> A. distinct vs"  "[] \<notin> A"
shows "inj_on rotate_min A = inj_on (\<lambda>vs. {vs}//{\<cong>}) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on rotate_min A = inj_on (\<lambda>vs. {vs} // {\<cong>}) A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on rotate_min A = inj_on (\<lambda>vs. {vs} // {\<cong>}) A
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on rotate_min A = inj_on (\<lambda>vs. {vs} // {\<cong>}) A
[PROOF STEP]
fix xs ys
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on rotate_min A = inj_on (\<lambda>vs. {vs} // {\<cong>}) A
[PROOF STEP]
assume xs: "xs \<in> A" and ys : "ys \<in> A"
[PROOF STATE]
proof (state)
this:
xs \<in> A
ys \<in> A

goal (1 subgoal):
 1. inj_on rotate_min A = inj_on (\<lambda>vs. {vs} // {\<cong>}) A
[PROOF STEP]
hence "xs \<noteq> [] \<and> ys \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
xs \<in> A
ys \<in> A

goal (1 subgoal):
 1. xs \<noteq> [] \<and> ys \<noteq> []
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
xs \<in> A
ys \<in> A
[] \<notin> A

goal (1 subgoal):
 1. xs \<noteq> [] \<and> ys \<noteq> []
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
xs \<noteq> [] \<and> ys \<noteq> []

goal (1 subgoal):
 1. inj_on rotate_min A = inj_on (\<lambda>vs. {vs} // {\<cong>}) A
[PROOF STEP]
hence "(rotate_min xs = rotate_min ys) = (xs \<cong> ys)"
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> [] \<and> ys \<noteq> []

goal (1 subgoal):
 1. (rotate_min xs = rotate_min ys) = xs \<cong> ys
[PROOF STEP]
using xs assms(1)
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> [] \<and> ys \<noteq> []
xs \<in> A
\<forall>vs\<in>A. distinct vs

goal (1 subgoal):
 1. (rotate_min xs = rotate_min ys) = xs \<cong> ys
[PROOF STEP]
by(simp add: singleton_list_cong_eq_iff norm_eq_iff_face_cong)
[PROOF STATE]
proof (state)
this:
(rotate_min xs = rotate_min ys) = xs \<cong> ys

goal (1 subgoal):
 1. inj_on rotate_min A = inj_on (\<lambda>vs. {vs} // {\<cong>}) A
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?xs2 \<in> A; ?ys2 \<in> A\<rbrakk> \<Longrightarrow> (rotate_min ?xs2 = rotate_min ?ys2) = ?xs2 \<cong> ?ys2

goal (1 subgoal):
 1. inj_on rotate_min A = inj_on (\<lambda>vs. {vs} // {\<cong>}) A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?xs2 \<in> A; ?ys2 \<in> A\<rbrakk> \<Longrightarrow> (rotate_min ?xs2 = rotate_min ?ys2) = ?xs2 \<cong> ?ys2

goal (1 subgoal):
 1. inj_on rotate_min A = inj_on (\<lambda>vs. {vs} // {\<cong>}) A
[PROOF STEP]
by(simp add:inj_on_def)
[PROOF STATE]
proof (state)
this:
inj_on rotate_min A = inj_on (\<lambda>vs. {vs} // {\<cong>}) A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_mset_set_zip_leq:
  "size_mset (mset (zip ss ts)) \<le> size_list size ss + size_list size ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size_mset (mset (zip ss ts)) \<le> size_list size ss + size_list size ts
[PROOF STEP]
proof (induct ss arbitrary: ts)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ts. size_mset (mset (zip [] ts)) \<le> size_list size [] + size_list size ts
 2. \<And>a ss ts. (\<And>ts. size_mset (mset (zip ss ts)) \<le> size_list size ss + size_list size ts) \<Longrightarrow> size_mset (mset (zip (a # ss) ts)) \<le> size_list size (a # ss) + size_list size ts
[PROOF STEP]
case (Cons s ss)
[PROOF STATE]
proof (state)
this:
size_mset (mset (zip ss ?ts)) \<le> size_list size ss + size_list size ?ts

goal (2 subgoals):
 1. \<And>ts. size_mset (mset (zip [] ts)) \<le> size_list size [] + size_list size ts
 2. \<And>a ss ts. (\<And>ts. size_mset (mset (zip ss ts)) \<le> size_list size ss + size_list size ts) \<Longrightarrow> size_mset (mset (zip (a # ss) ts)) \<le> size_list size (a # ss) + size_list size ts
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
size_mset (mset (zip ss ?ts)) \<le> size_list size ss + size_list size ?ts
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
size_mset (mset (zip ss ?ts)) \<le> size_list size ss + size_list size ?ts

goal (1 subgoal):
 1. size_mset (mset (zip (s # ss) ts)) \<le> size_list size (s # ss) + size_list size ts
[PROOF STEP]
by (cases ts) (auto intro: le_SucI simp: pair_size_def)
[PROOF STATE]
proof (state)
this:
size_mset (mset (zip (s # ss) ts)) \<le> size_list size (s # ss) + size_list size ts

goal (1 subgoal):
 1. \<And>ts. size_mset (mset (zip [] ts)) \<le> size_list size [] + size_list size ts
[PROOF STEP]
qed simp


[STATEMENT]
lemma coprime_power_left_iff [simp]:
  "coprime (a ^ n) b \<longleftrightarrow> coprime a b \<or> n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime (a ^ n) b = (coprime a b \<or> n = 0)
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> coprime (a ^ n) b = (coprime a b \<or> n = 0)
 2. n \<noteq> 0 \<Longrightarrow> coprime (a ^ n) b = (coprime a b \<or> n = 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> coprime (a ^ n) b = (coprime a b \<or> n = 0)
 2. n \<noteq> 0 \<Longrightarrow> coprime (a ^ n) b = (coprime a b \<or> n = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. coprime (a ^ n) b = (coprime a b \<or> n = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coprime (a ^ n) b = (coprime a b \<or> n = 0)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> coprime (a ^ n) b = (coprime a b \<or> n = 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> coprime (a ^ n) b = (coprime a b \<or> n = 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> coprime (a ^ n) b = (coprime a b \<or> n = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
[PROOF STEP]
have "n > 0"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

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

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> coprime (a ^ n) b = (coprime a b \<or> n = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. coprime (a ^ n) b = (coprime a b \<or> n = 0)
[PROOF STEP]
by (induction n rule: nat_induct_non_zero) simp_all
[PROOF STATE]
proof (state)
this:
coprime (a ^ n) b = (coprime a b \<or> n = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem random_linorder_by_prios:
  "M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
from linorders_finite_nonempty[OF fin]
[PROOF STATE]
proof (chain)
picking this:
linorders_on A \<noteq> {}
[PROOF STEP]
obtain R where R: "linorder_on A R"
[PROOF STATE]
proof (prove)
using this:
linorders_on A \<noteq> {}

goal (1 subgoal):
 1. (\<And>R. linorder_on A R \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: linorders_on_def)
[PROOF STATE]
proof (state)
this:
linorder_on A R

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
have *: "emeasure M {R} \<le> emeasure M {R'}" if "linorder_on A R" "linorder_on A R'" for R R'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
define N where "N = PiM A (\<lambda>_. uniform_measure lborel {a..b})"
[PROOF STATE]
proof (state)
this:
N = Pi\<^sub>M A (\<lambda>_. uniform_measure lborel {a..b})

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
from linorder_permutation_exists[OF fin that]
[PROOF STATE]
proof (chain)
picking this:
(\<And>\<pi>. \<lbrakk>\<pi> permutes A; R' = map_relation A \<pi> R\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain \<pi> where \<pi>: "\<pi> permutes A" "R' = map_relation A \<pi> R"
[PROOF STATE]
proof (prove)
using this:
(\<And>\<pi>. \<lbrakk>\<pi> permutes A; R' = map_relation A \<pi> R\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; R' = map_relation A \<pi> R\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<pi> permutes A
R' = map_relation A \<pi> R

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
have "(\<lambda>f. f \<circ> \<pi>) \<in> Pi\<^sub>M A (\<lambda>_. lborel :: real measure) \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel :: real measure)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f. f \<circ> \<pi>) \<in> Pi\<^sub>M A (\<lambda>_. lborel) \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel)
[PROOF STEP]
by (auto intro!: measurable_PiM_single' measurable_PiM_component_rev
          simp: comp_def permutes_in_image[OF \<pi>(1)] space_PiM PiE_def extensional_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>f. f \<circ> \<pi>) \<in> Pi\<^sub>M A (\<lambda>_. lborel) \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>f. f \<circ> \<pi>) \<in> Pi\<^sub>M A (\<lambda>_. lborel) \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
have "\<dots> = N \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pi\<^sub>M A (\<lambda>_. lborel) \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel) = N \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel)
[PROOF STEP]
unfolding N_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pi\<^sub>M A (\<lambda>_. lborel) \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel) = Pi\<^sub>M A (\<lambda>_. uniform_measure lborel {a..b}) \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel)
[PROOF STEP]
by (intro measurable_cong_sets refl sets_PiM_cong) simp_all
[PROOF STATE]
proof (state)
this:
Pi\<^sub>M A (\<lambda>_. lborel) \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel) = N \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>f. f \<circ> \<pi>) \<in> N \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel)
[PROOF STEP]
have [measurable]: "(\<lambda>f. f \<circ> \<pi>) \<in> \<dots>"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>f. f \<circ> \<pi>) \<in> N \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel)

goal (1 subgoal):
 1. (\<lambda>f. f \<circ> \<pi>) \<in> N \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>f. f \<circ> \<pi>) \<in> N \<rightarrow>\<^sub>M Pi\<^sub>M A (\<lambda>_. lborel)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
have [simp]: "measurable N X = measurable (PiM A (\<lambda>_. lborel)) X" for X :: "('a \<times> 'a) set measure"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N \<rightarrow>\<^sub>M X = Pi\<^sub>M A (\<lambda>_. lborel) \<rightarrow>\<^sub>M X
[PROOF STEP]
unfolding N_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pi\<^sub>M A (\<lambda>_. uniform_measure lborel {a..b}) \<rightarrow>\<^sub>M X = Pi\<^sub>M A (\<lambda>_. lborel) \<rightarrow>\<^sub>M X
[PROOF STEP]
by (intro measurable_cong_sets refl sets_PiM_cong) simp_all
[PROOF STATE]
proof (state)
this:
N \<rightarrow>\<^sub>M ?X = Pi\<^sub>M A (\<lambda>_. lborel) \<rightarrow>\<^sub>M ?X

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
have [simp]: "measurable M X = measurable (count_space (Pow (B \<times> B))) X" for X :: "('a \<times> 'a) set measure"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M \<rightarrow>\<^sub>M X = count_space (Pow (B \<times> B)) \<rightarrow>\<^sub>M X
[PROOF STEP]
unfolding M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (Pi\<^sub>M A (\<lambda>_. uniform_measure lborel {a..b})) (count_space (Pow (B \<times> B))) (linorder_from_keys A) \<rightarrow>\<^sub>M X = count_space (Pow (B \<times> B)) \<rightarrow>\<^sub>M X
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
M \<rightarrow>\<^sub>M ?X = count_space (Pow (B \<times> B)) \<rightarrow>\<^sub>M ?X

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
have M_eq: "M = distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M = distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A)
[PROOF STEP]
by (simp only: M_def N_def)
[PROOF STATE]
proof (state)
this:
M = distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M = distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
have "N = distr N (PiM A (\<lambda>_. lborel)) (\<lambda>f. f \<circ> \<pi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N = distr N (Pi\<^sub>M A (\<lambda>_. lborel)) (\<lambda>f. f \<circ> \<pi>)
[PROOF STEP]
unfolding N_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pi\<^sub>M A (\<lambda>_. uniform_measure lborel {a..b}) = distr (Pi\<^sub>M A (\<lambda>_. uniform_measure lborel {a..b})) (Pi\<^sub>M A (\<lambda>_. lborel)) (\<lambda>f. f \<circ> \<pi>)
[PROOF STEP]
by (rule PiM_uniform_measure_permute [symmetric]) fact+
[PROOF STATE]
proof (state)
this:
N = distr N (Pi\<^sub>M A (\<lambda>_. lborel)) (\<lambda>f. f \<circ> \<pi>)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
N = distr N (Pi\<^sub>M A (\<lambda>_. lborel)) (\<lambda>f. f \<circ> \<pi>)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
have "distr \<dots> (count_space (Pow (B \<times> B))) (linorder_from_keys A) =
                 distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A \<circ> (\<lambda>f. f \<circ> \<pi>)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (distr N (Pi\<^sub>M A (\<lambda>_. lborel)) (\<lambda>f. f \<circ> \<pi>)) (count_space (Pow (B \<times> B))) (linorder_from_keys A) = distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A \<circ> (\<lambda>f. f \<circ> \<pi>))
[PROOF STEP]
by (intro distr_distr) simp_all
[PROOF STATE]
proof (state)
this:
distr (distr N (Pi\<^sub>M A (\<lambda>_. lborel)) (\<lambda>f. f \<circ> \<pi>)) (count_space (Pow (B \<times> B))) (linorder_from_keys A) = distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A \<circ> (\<lambda>f. f \<circ> \<pi>))

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distr (distr N (Pi\<^sub>M A (\<lambda>_. lborel)) (\<lambda>f. f \<circ> \<pi>)) (count_space (Pow (B \<times> B))) (linorder_from_keys A) = distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A \<circ> (\<lambda>f. f \<circ> \<pi>))

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
have "\<dots> = distr N (count_space (Pow (B \<times> B))) (map_relation A \<pi> \<circ> linorder_from_keys A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A \<circ> (\<lambda>f. f \<circ> \<pi>)) = distr N (count_space (Pow (B \<times> B))) (map_relation A \<pi> \<circ> linorder_from_keys A)
[PROOF STEP]
by (intro distr_cong refl) (auto simp: linorder_from_keys_permute[OF \<pi>(1)])
[PROOF STATE]
proof (state)
this:
distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A \<circ> (\<lambda>f. f \<circ> \<pi>)) = distr N (count_space (Pow (B \<times> B))) (map_relation A \<pi> \<circ> linorder_from_keys A)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A \<circ> (\<lambda>f. f \<circ> \<pi>)) = distr N (count_space (Pow (B \<times> B))) (map_relation A \<pi> \<circ> linorder_from_keys A)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
have "\<dots> = distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr N (count_space (Pow (B \<times> B))) (map_relation A \<pi> \<circ> linorder_from_keys A) = distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>)
[PROOF STEP]
unfolding M_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr N (count_space (Pow (B \<times> B))) (map_relation A \<pi> \<circ> linorder_from_keys A) = distr (distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A)) (count_space (Pow (B \<times> B))) (map_relation A \<pi>)
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B

goal (1 subgoal):
 1. distr N (count_space (Pow (B \<times> B))) (map_relation A \<pi> \<circ> linorder_from_keys A) = distr (distr N (count_space (Pow (B \<times> B))) (linorder_from_keys A)) (count_space (Pow (B \<times> B))) (map_relation A \<pi>)
[PROOF STEP]
by (intro distr_distr [symmetric]) (auto simp: map_relation_def)
[PROOF STATE]
proof (state)
this:
distr N (count_space (Pow (B \<times> B))) (map_relation A \<pi> \<circ> linorder_from_keys A) = distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
M = distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>)
[PROOF STEP]
have M_eq': "distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>) = M"
[PROOF STATE]
proof (prove)
using this:
M = distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>)

goal (1 subgoal):
 1. distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>) = M
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>) = M

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
linorder_on A R
linorder_on A R'
[PROOF STEP]
have subset': "R \<subseteq> B \<times> B" "R' \<subseteq> B \<times> B"
[PROOF STATE]
proof (prove)
using this:
linorder_on A R
linorder_on A R'

goal (1 subgoal):
 1. R \<subseteq> B \<times> B &&& R' \<subseteq> B \<times> B
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
linorder_on A R
linorder_on A R'
A \<subseteq> B

goal (1 subgoal):
 1. R \<subseteq> B \<times> B &&& R' \<subseteq> B \<times> B
[PROOF STEP]
by (auto simp: linorder_on_def refl_on_def)
[PROOF STATE]
proof (state)
this:
R \<subseteq> B \<times> B
R' \<subseteq> B \<times> B

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
hence "emeasure M {R} \<le> emeasure M (map_relation A \<pi> -` {R'} \<inter> space M)"
[PROOF STATE]
proof (prove)
using this:
R \<subseteq> B \<times> B
R' \<subseteq> B \<times> B

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M (map_relation A \<pi> -` {R'} \<inter> space M)
[PROOF STEP]
using subset'
[PROOF STATE]
proof (prove)
using this:
R \<subseteq> B \<times> B
R' \<subseteq> B \<times> B
R \<subseteq> B \<times> B
R' \<subseteq> B \<times> B

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M (map_relation A \<pi> -` {R'} \<inter> space M)
[PROOF STEP]
by (intro emeasure_mono) (auto simp: M_def \<pi> )
[PROOF STATE]
proof (state)
this:
emeasure M {R} \<le> emeasure M (map_relation A \<pi> -` {R'} \<inter> space M)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M {R} \<le> emeasure M (map_relation A \<pi> -` {R'} \<inter> space M)

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
have "\<dots> = emeasure (distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>)) {R'} "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (map_relation A \<pi> -` {R'} \<inter> space M) = emeasure (distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>)) {R'}
[PROOF STEP]
by (rule emeasure_distr [symmetric]) (insert subset' B, auto simp: map_relation_def)
[PROOF STATE]
proof (state)
this:
emeasure M (map_relation A \<pi> -` {R'} \<inter> space M) = emeasure (distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>)) {R'}

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M (map_relation A \<pi> -` {R'} \<inter> space M) = emeasure (distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>)) {R'}

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
note M_eq'
[PROOF STATE]
proof (state)
this:
distr M (count_space (Pow (B \<times> B))) (map_relation A \<pi>) = M

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure M {R} \<le> emeasure M {R'}

goal (1 subgoal):
 1. emeasure M {R} \<le> emeasure M {R'}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure M {R} \<le> emeasure M {R'}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>linorder_on A ?R; linorder_on A ?R'\<rbrakk> \<Longrightarrow> emeasure M {?R} \<le> emeasure M {?R'}

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
have same_prob: "emeasure M {R'} = emeasure M {R}" if "linorder_on A R'" for R'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M {R'} = emeasure M {R}
[PROOF STEP]
using *[of R R'] and *[of R' R] and R and that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>linorder_on A R; linorder_on A R'\<rbrakk> \<Longrightarrow> emeasure M {R} \<le> emeasure M {R'}
\<lbrakk>linorder_on A R'; linorder_on A R\<rbrakk> \<Longrightarrow> emeasure M {R'} \<le> emeasure M {R}
linorder_on A R
linorder_on A R'

goal (1 subgoal):
 1. emeasure M {R'} = emeasure M {R}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
linorder_on A ?R' \<Longrightarrow> emeasure M {?R'} = emeasure M {R}

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
from ab
[PROOF STATE]
proof (chain)
picking this:
a < b
[PROOF STEP]
have "prob_space M"
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. prob_space M
[PROOF STEP]
unfolding M_def
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. prob_space (distr (Pi\<^sub>M A (\<lambda>_. uniform_measure lborel {a..b})) (count_space (Pow (B \<times> B))) (linorder_from_keys A))
[PROOF STEP]
by (intro prob_space.prob_space_distr prob_space_PiM prob_space_uniform_measure) simp_all
[PROOF STATE]
proof (state)
this:
prob_space M

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
hence "1 = emeasure M (Pow (B \<times> B))"
[PROOF STATE]
proof (prove)
using this:
prob_space M

goal (1 subgoal):
 1. 1 = emeasure M (Pow (B \<times> B))
[PROOF STEP]
using prob_space.emeasure_space_1[OF \<open>prob_space M\<close>]
[PROOF STATE]
proof (prove)
using this:
prob_space M
emeasure M (space M) = 1

goal (1 subgoal):
 1. 1 = emeasure M (Pow (B \<times> B))
[PROOF STEP]
by (simp add: M_def)
[PROOF STATE]
proof (state)
this:
1 = emeasure M (Pow (B \<times> B))

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 = emeasure M (Pow (B \<times> B))

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
have "(Pow (B \<times> B)) = linorders_on A \<union> ((Pow (B \<times> B))-linorders_on A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pow (B \<times> B) = linorders_on A \<union> (Pow (B \<times> B) - linorders_on A)
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B

goal (1 subgoal):
 1. Pow (B \<times> B) = linorders_on A \<union> (Pow (B \<times> B) - linorders_on A)
[PROOF STEP]
by (auto simp: linorders_on_def linorder_on_def refl_on_def)
[PROOF STATE]
proof (state)
this:
Pow (B \<times> B) = linorders_on A \<union> (Pow (B \<times> B) - linorders_on A)

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Pow (B \<times> B) = linorders_on A \<union> (Pow (B \<times> B) - linorders_on A)

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
have "emeasure M \<dots> = emeasure M (linorders_on A) + emeasure M (Pow (B \<times> B)-linorders_on A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (linorders_on A \<union> (Pow (B \<times> B) - linorders_on A)) = emeasure M (linorders_on A) + emeasure M (Pow (B \<times> B) - linorders_on A)
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B

goal (1 subgoal):
 1. emeasure M (linorders_on A \<union> (Pow (B \<times> B) - linorders_on A)) = emeasure M (linorders_on A) + emeasure M (Pow (B \<times> B) - linorders_on A)
[PROOF STEP]
by (subst plus_emeasure) (auto simp: M_def linorders_on_def linorder_on_def refl_on_def)
[PROOF STATE]
proof (state)
this:
emeasure M (linorders_on A \<union> (Pow (B \<times> B) - linorders_on A)) = emeasure M (linorders_on A) + emeasure M (Pow (B \<times> B) - linorders_on A)

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M (linorders_on A \<union> (Pow (B \<times> B) - linorders_on A)) = emeasure M (linorders_on A) + emeasure M (Pow (B \<times> B) - linorders_on A)

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
have "emeasure M (Pow (B \<times> B)-linorders_on A) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (Pow (B \<times> B) - linorders_on A) = 0
[PROOF STEP]
using almost_everywhere_linorder
[PROOF STATE]
proof (prove)
using this:
almost_everywhere M (linorder_on A)

goal (1 subgoal):
 1. emeasure M (Pow (B \<times> B) - linorders_on A) = 0
[PROOF STEP]
by (subst (asm) AE_iff_measurable) (auto simp: linorders_on_def M_def)
[PROOF STATE]
proof (state)
this:
emeasure M (Pow (B \<times> B) - linorders_on A) = 0

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M (Pow (B \<times> B) - linorders_on A) = 0

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
from fin
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
have "emeasure M (linorders_on A) = (\<Sum>R'\<in>linorders_on A. emeasure M {R'})"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. emeasure M (linorders_on A) = (\<Sum>R'\<in>linorders_on A. emeasure M {R'})
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> B

goal (1 subgoal):
 1. emeasure M (linorders_on A) = (\<Sum>R'\<in>linorders_on A. emeasure M {R'})
[PROOF STEP]
by (intro emeasure_eq_sum_singleton)
               (auto simp: M_def  linorders_on_def linorder_on_def refl_on_def)
[PROOF STATE]
proof (state)
this:
emeasure M (linorders_on A) = (\<Sum>R'\<in>linorders_on A. emeasure M {R'})

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M (linorders_on A) = (\<Sum>R'\<in>linorders_on A. emeasure M {R'})

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
have "\<dots> = (\<Sum>R'\<in>linorders_on A. emeasure M {R})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>R'\<in>linorders_on A. emeasure M {R'}) = (\<Sum>R'\<in>linorders_on A. emeasure M {R})
[PROOF STEP]
by (rule sum.cong) (simp_all add: linorders_on_def same_prob)
[PROOF STATE]
proof (state)
this:
(\<Sum>R'\<in>linorders_on A. emeasure M {R'}) = (\<Sum>R'\<in>linorders_on A. emeasure M {R})

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>R'\<in>linorders_on A. emeasure M {R'}) = (\<Sum>R'\<in>linorders_on A. emeasure M {R})

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
from fin
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
have "\<dots> = fact (card A) * emeasure M {R}"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (\<Sum>R'\<in>linorders_on A. emeasure M {R}) = fact (card A) * emeasure M {R}
[PROOF STEP]
by (simp add: linorders_on_def card_finite_linorders)
[PROOF STATE]
proof (state)
this:
(\<Sum>R'\<in>linorders_on A. emeasure M {R}) = fact (card A) * emeasure M {R}

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 = fact (card A) * emeasure M {R} + 0
[PROOF STEP]
have [simp]: "emeasure M {R} = inverse (fact (card A))"
[PROOF STATE]
proof (prove)
using this:
1 = fact (card A) * emeasure M {R} + 0

goal (1 subgoal):
 1. emeasure M {R} = inverse (fact (card A))
[PROOF STEP]
by (simp add: inverse_ennreal_unique)
[PROOF STATE]
proof (state)
this:
emeasure M {R} = inverse (fact (card A))

goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
proof (rule measure_eqI_countable_AE')
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. sets M = Pow ?B
 2. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow ?B
 3. ?\<Omega> \<subseteq> ?B
 4. AE x in M. x \<in> ?\<Omega>
 5. AE x in uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A). x \<in> ?\<Omega>
 6. countable ?\<Omega>
 7. \<And>x. x \<in> ?\<Omega> \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
show "sets M = Pow (Pow (B \<times> B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets M = Pow (Pow (B \<times> B))
[PROOF STEP]
by (simp add: M_def)
[PROOF STATE]
proof (state)
this:
sets M = Pow (Pow (B \<times> B))

goal (6 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. ?\<Omega> \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> ?\<Omega>
 4. AE x in uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A). x \<in> ?\<Omega>
 5. countable ?\<Omega>
 6. \<And>x. x \<in> ?\<Omega> \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. ?\<Omega> \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> ?\<Omega>
 4. AE x in uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A). x \<in> ?\<Omega>
 5. countable ?\<Omega>
 6. \<And>x. x \<in> ?\<Omega> \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
from \<open>finite A\<close>
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
show "countable (linorders_on A)"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. countable (linorders_on A)
[PROOF STEP]
by (blast intro: countable_finite)
[PROOF STATE]
proof (state)
this:
countable (linorders_on A)

goal (5 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. AE x in uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A). x \<in> linorders_on A
 5. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. AE x in uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A). x \<in> linorders_on A
 5. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
show "AE R in uniform_measure (count_space (Pow (B \<times> B)))
            (linorders_on A). R \<in> linorders_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE R in uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A). R \<in> linorders_on A
[PROOF STEP]
by (rule AE_uniform_measureI)
         (insert B, auto simp: linorders_on_def linorder_on_def refl_on_def)
[PROOF STATE]
proof (state)
this:
AE R in uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A). R \<in> linorders_on A

goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
fix R'
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
assume R': "R' \<in> linorders_on A"
[PROOF STATE]
proof (state)
this:
R' \<in> linorders_on A

goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
have subset: "linorders_on A \<subseteq> Pow (B \<times> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linorders_on A \<subseteq> Pow (B \<times> B)
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B

goal (1 subgoal):
 1. linorders_on A \<subseteq> Pow (B \<times> B)
[PROOF STEP]
by (auto simp: linorders_on_def linorder_on_def refl_on_def)
[PROOF STATE]
proof (state)
this:
linorders_on A \<subseteq> Pow (B \<times> B)

goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
have "emeasure (uniform_measure (count_space (Pow (B \<times> B)))
           (linorders_on A)) {R'} = emeasure (count_space (Pow (B \<times> B))) (linorders_on A \<inter> {R'}) /
                                      emeasure (count_space (Pow (B \<times> B))) (linorders_on A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {R'} = emeasure (count_space (Pow (B \<times> B))) (linorders_on A \<inter> {R'}) / emeasure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
using R' B
[PROOF STATE]
proof (prove)
using this:
R' \<in> linorders_on A
A \<subseteq> B

goal (1 subgoal):
 1. emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {R'} = emeasure (count_space (Pow (B \<times> B))) (linorders_on A \<inter> {R'}) / emeasure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
by (subst emeasure_uniform_measure) (auto simp: linorders_on_def linorder_on_def refl_on_def)
[PROOF STATE]
proof (state)
this:
emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {R'} = emeasure (count_space (Pow (B \<times> B))) (linorders_on A \<inter> {R'}) / emeasure (count_space (Pow (B \<times> B))) (linorders_on A)

goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {R'} = emeasure (count_space (Pow (B \<times> B))) (linorders_on A \<inter> {R'}) / emeasure (count_space (Pow (B \<times> B))) (linorders_on A)

goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
have "\<dots> = 1 / emeasure (count_space (Pow (B \<times> B))) (linorders_on A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (count_space (Pow (B \<times> B))) (linorders_on A \<inter> {R'}) / emeasure (count_space (Pow (B \<times> B))) (linorders_on A) = 1 / emeasure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
using R' B
[PROOF STATE]
proof (prove)
using this:
R' \<in> linorders_on A
A \<subseteq> B

goal (1 subgoal):
 1. emeasure (count_space (Pow (B \<times> B))) (linorders_on A \<inter> {R'}) / emeasure (count_space (Pow (B \<times> B))) (linorders_on A) = 1 / emeasure (count_space (Pow (B \<times> B))) (linorders_on A)
[PROOF STEP]
by (subst emeasure_count_space) (auto simp: linorders_on_def linorder_on_def refl_on_def)
[PROOF STATE]
proof (state)
this:
emeasure (count_space (Pow (B \<times> B))) (linorders_on A \<inter> {R'}) / emeasure (count_space (Pow (B \<times> B))) (linorders_on A) = 1 / emeasure (count_space (Pow (B \<times> B))) (linorders_on A)

goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure (count_space (Pow (B \<times> B))) (linorders_on A \<inter> {R'}) / emeasure (count_space (Pow (B \<times> B))) (linorders_on A) = 1 / emeasure (count_space (Pow (B \<times> B))) (linorders_on A)

goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
have "\<dots> = 1 / fact (card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / emeasure (count_space (Pow (B \<times> B))) (linorders_on A) = 1 / fact (card A)
[PROOF STEP]
using fin finite_linorders_on[of A]
[PROOF STATE]
proof (prove)
using this:
finite A
finite A \<Longrightarrow> finite (linorders_on A)

goal (1 subgoal):
 1. 1 / emeasure (count_space (Pow (B \<times> B))) (linorders_on A) = 1 / fact (card A)
[PROOF STEP]
by (subst emeasure_count_space [OF subset])
         (auto simp: divide_ennreal [symmetric] linorders_on_def card_finite_linorders)
[PROOF STATE]
proof (state)
this:
1 / emeasure (count_space (Pow (B \<times> B))) (linorders_on A) = 1 / fact (card A)

goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / emeasure (count_space (Pow (B \<times> B))) (linorders_on A) = 1 / fact (card A)

goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
have "\<dots> = emeasure M {R}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / fact (card A) = emeasure M {R}
[PROOF STEP]
by (simp add: field_simps divide_ennreal_def)
[PROOF STATE]
proof (state)
this:
1 / fact (card A) = emeasure M {R}

goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / fact (card A) = emeasure M {R}

goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
have "\<dots> = emeasure M {R'}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M {R} = emeasure M {R'}
[PROOF STEP]
using R'
[PROOF STATE]
proof (prove)
using this:
R' \<in> linorders_on A

goal (1 subgoal):
 1. emeasure M {R} = emeasure M {R'}
[PROOF STEP]
by (intro same_prob [symmetric]) (auto simp: linorders_on_def)
[PROOF STATE]
proof (state)
this:
emeasure M {R} = emeasure M {R'}

goal (4 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
 4. \<And>x. x \<in> linorders_on A \<Longrightarrow> emeasure M {x} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {x}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {R'} = emeasure M {R'}
[PROOF STEP]
show "emeasure M {R'} = emeasure (uniform_measure (count_space (Pow (B \<times> B)))
                    (linorders_on A)) {R'}"
[PROOF STATE]
proof (prove)
using this:
emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {R'} = emeasure M {R'}

goal (1 subgoal):
 1. emeasure M {R'} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {R'}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
emeasure M {R'} = emeasure (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) {R'}

goal (3 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. linorders_on A \<subseteq> Pow (B \<times> B)
 3. AE x in M. x \<in> linorders_on A
[PROOF STEP]
show "linorders_on A \<subseteq> Pow (B \<times> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linorders_on A \<subseteq> Pow (B \<times> B)
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B

goal (1 subgoal):
 1. linorders_on A \<subseteq> Pow (B \<times> B)
[PROOF STEP]
by (auto simp: linorders_on_def linorder_on_def refl_on_def)
[PROOF STATE]
proof (state)
this:
linorders_on A \<subseteq> Pow (B \<times> B)

goal (2 subgoals):
 1. sets (uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)) = Pow (Pow (B \<times> B))
 2. AE x in M. x \<in> linorders_on A
[PROOF STEP]
qed (auto simp: M_def linorders_on_def almost_everywhere_linorder)
[PROOF STATE]
proof (state)
this:
M = uniform_measure (count_space (Pow (B \<times> B))) (linorders_on A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma f_Exec_Stream_Acc_LocalState_Cons: "
  0 < k \<Longrightarrow>
  f_Exec_Comp_Stream_Acc_LocalState k localState trans_fun (x # xs) c =
  localState (f_Exec_Comp trans_fun (x #  \<NoMsg>\<^bsup>k - Suc 0\<^esup>) c) #
  f_Exec_Comp_Stream_Acc_LocalState k localState trans_fun xs (
    f_Exec_Comp trans_fun (x # \<NoMsg>\<^bsup>k - Suc 0\<^esup>) c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> f_Exec_Comp_Stream_Acc_LocalState k localState trans_fun (x # xs) c = localState (f_Exec_Comp trans_fun (x # NoMsg\<^bsup>k - Suc 0\<^esup>) c) # f_Exec_Comp_Stream_Acc_LocalState k localState trans_fun xs (f_Exec_Comp trans_fun (x # NoMsg\<^bsup>k - Suc 0\<^esup>) c)
[PROOF STEP]
apply (unfold f_Exec_Comp_Stream_Acc_LocalState_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> map localState (f_Exec_Comp_Stream trans_fun ((x # xs) \<odot> k) c) \<div>\<^sub>l k = localState (f_Exec_Comp trans_fun (x # NoMsg\<^bsup>k - Suc 0\<^esup>) c) # map localState (f_Exec_Comp_Stream trans_fun (xs \<odot> k) (f_Exec_Comp trans_fun (x # NoMsg\<^bsup>k - Suc 0\<^esup>) c)) \<div>\<^sub>l k
[PROOF STEP]
apply (simp only: f_shrink_last_map f_expand_Cons append_Cons[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> map localState (f_Exec_Comp_Stream trans_fun ((x # NoMsg\<^bsup>k - Suc 0\<^esup>) @ xs \<odot> k) c \<div>\<^sub>l k) = localState (f_Exec_Comp trans_fun (x # NoMsg\<^bsup>k - Suc 0\<^esup>) c) # map localState (f_Exec_Comp_Stream trans_fun (xs \<odot> k) (f_Exec_Comp trans_fun (x # NoMsg\<^bsup>k - Suc 0\<^esup>) c) \<div>\<^sub>l k)
[PROOF STEP]
apply (simp add: f_Exec_Stream_append replicate_pred_Cons_length f_shrink_last_Cons del: f_Exec_Stream_Cons append_Cons)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> localState (last (f_Exec_Comp_Stream trans_fun (x # NoMsg\<^bsup>k - Suc 0\<^esup>) c)) = localState (f_Exec_Comp trans_fun NoMsg\<^bsup>k - Suc 0\<^esup> (trans_fun x c))
[PROOF STEP]
apply (simp add: f_Exec_eq_f_Exec_Stream_last2[symmetric] f_Exec_Stream_empty_conv)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in digraph_map) euler_genus_iso:
  assumes "digraph_isomorphism hom"
  shows "pre_digraph_map.euler_genus (app_iso hom G) (map_iso hom) = euler_genus"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pre_digraph_map.euler_genus (app_iso hom G) (map_iso hom) = euler_genus
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
digraph_isomorphism hom

goal (1 subgoal):
 1. pre_digraph_map.euler_genus (app_iso hom G) (map_iso hom) = euler_genus
[PROOF STEP]
by (auto simp: pre_digraph_map.euler_genus_def euler_char_iso)


[STATEMENT]
lemma plus_commute: "(x :: Nat) + y = y + x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + y = y + x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x + y = y + x
[PROOF STEP]
have dc: "\<And>u v. (undiscr (u::nat discr) + undiscr v) = (undiscr v + undiscr u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u v. undiscr u + undiscr v = undiscr v + undiscr u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
undiscr ?u + undiscr ?v = undiscr ?v + undiscr ?u

goal (1 subgoal):
 1. x + y = y + x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
undiscr ?u + undiscr ?v = undiscr ?v + undiscr ?u

goal (1 subgoal):
 1. x + y = y + x
[PROOF STEP]
apply (cases x)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<And>u v. undiscr u + undiscr v = undiscr v + undiscr u; x = \<bottom>\<rbrakk> \<Longrightarrow> x + y = y + x
 2. \<And>u. \<lbrakk>\<And>u v. undiscr u + undiscr v = undiscr v + undiscr u; x = box\<cdot>u\<rbrakk> \<Longrightarrow> x + y = y + x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u. \<lbrakk>\<And>u v. undiscr u + undiscr v = undiscr v + undiscr u; x = box\<cdot>u\<rbrakk> \<Longrightarrow> x + y = y + x
[PROOF STEP]
apply (cases y)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>u. \<lbrakk>\<And>u v. undiscr u + undiscr v = undiscr v + undiscr u; x = box\<cdot>u; y = \<bottom>\<rbrakk> \<Longrightarrow> x + y = y + x
 2. \<And>u ua. \<lbrakk>\<And>u v. undiscr u + undiscr v = undiscr v + undiscr u; x = box\<cdot>u; y = box\<cdot>ua\<rbrakk> \<Longrightarrow> x + y = y + x
[PROOF STEP]
by (simp_all add: dc plus_Box_def)
[PROOF STATE]
proof (state)
this:
x + y = y + x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma shiftpath_alt_def: "shiftpath a f = (\<lambda>x. if x \<le> 1-a then f (a + x) else f (a + x - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. shiftpath a f = (\<lambda>x. if x \<le> 1 - a then f (a + x) else f (a + x - 1))
[PROOF STEP]
by (auto simp: shiftpath_def)