[STATEMENT]
lemma compos_bijec:"\<lbrakk>aGroup E; aGroup F; aGroup G; bijec\<^bsub>E,F\<^esub> f; bijec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow>
                     bijec\<^bsub>E,G\<^esub> (compos E g f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup E; aGroup F; aGroup G; bijec\<^bsub>E,F\<^esub> f; bijec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> bijec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (simp add:bijec_def, (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> injec\<^bsub>E,G\<^esub> compos E g f \<and> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> injec\<^bsub>E,G\<^esub> compos E g f
 2. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (simp add:injec_def, (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; ker\<^bsub>E,F\<^esub> f = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; ker\<^bsub>F,G\<^esub> g = {\<zero>\<^bsub>F\<^esub>}\<rbrakk> \<Longrightarrow> compos E g f \<in> aHom E G \<and> ker\<^bsub>E,G\<^esub> compos E g f = {\<zero>\<^bsub>E\<^esub>}
 2. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (simp add:aHom_compos[of "E" "F" "G" "f" "g"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; ker\<^bsub>E,F\<^esub> f = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; ker\<^bsub>F,G\<^esub> g = {\<zero>\<^bsub>F\<^esub>}\<rbrakk> \<Longrightarrow> ker\<^bsub>E,G\<^esub> compos E g f = {\<zero>\<^bsub>E\<^esub>}
 2. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (rule equalityI, rule subsetI, simp add:ker_def, erule conjE)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; {a \<in> carrier E. f a = \<zero>\<^bsub>F\<^esub>} = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>} = {\<zero>\<^bsub>F\<^esub>}; x \<in> carrier E; compos E g f x = \<zero>\<^bsub>G\<^esub>\<rbrakk> \<Longrightarrow> x = \<zero>\<^bsub>E\<^esub>
 2. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; ker\<^bsub>E,F\<^esub> f = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; ker\<^bsub>F,G\<^esub> g = {\<zero>\<^bsub>F\<^esub>}\<rbrakk> \<Longrightarrow> {\<zero>\<^bsub>E\<^esub>} \<subseteq> ker\<^bsub>E,G\<^esub> compos E g f
 3. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (simp add:compos_def compose_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; {a \<in> carrier E. f a = \<zero>\<^bsub>F\<^esub>} = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>} = {\<zero>\<^bsub>F\<^esub>}; x \<in> carrier E; g (f x) = \<zero>\<^bsub>G\<^esub>\<rbrakk> \<Longrightarrow> x = \<zero>\<^bsub>E\<^esub>
 2. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; ker\<^bsub>E,F\<^esub> f = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; ker\<^bsub>F,G\<^esub> g = {\<zero>\<^bsub>F\<^esub>}\<rbrakk> \<Longrightarrow> {\<zero>\<^bsub>E\<^esub>} \<subseteq> ker\<^bsub>E,G\<^esub> compos E g f
 3. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (frule_tac a = x in aHom_mem[of "E" "F" "f"], assumption+)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; {a \<in> carrier E. f a = \<zero>\<^bsub>F\<^esub>} = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>} = {\<zero>\<^bsub>F\<^esub>}; x \<in> carrier E; g (f x) = \<zero>\<^bsub>G\<^esub>; f x \<in> carrier F\<rbrakk> \<Longrightarrow> x = \<zero>\<^bsub>E\<^esub>
 2. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; ker\<^bsub>E,F\<^esub> f = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; ker\<^bsub>F,G\<^esub> g = {\<zero>\<^bsub>F\<^esub>}\<rbrakk> \<Longrightarrow> {\<zero>\<^bsub>E\<^esub>} \<subseteq> ker\<^bsub>E,G\<^esub> compos E g f
 3. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (subgoal_tac "(f x) \<in> {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>}", simp)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; {a \<in> carrier E. f a = \<zero>\<^bsub>F\<^esub>} = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>} = {\<zero>\<^bsub>F\<^esub>}; x \<in> carrier E; g \<zero>\<^bsub>F\<^esub> = \<zero>\<^bsub>G\<^esub>; \<zero>\<^bsub>F\<^esub> \<in> carrier F; f x = \<zero>\<^bsub>F\<^esub>\<rbrakk> \<Longrightarrow> x = \<zero>\<^bsub>E\<^esub>
 2. \<And>x. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; {a \<in> carrier E. f a = \<zero>\<^bsub>F\<^esub>} = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>} = {\<zero>\<^bsub>F\<^esub>}; x \<in> carrier E; g (f x) = \<zero>\<^bsub>G\<^esub>; f x \<in> carrier F\<rbrakk> \<Longrightarrow> f x \<in> {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>}
 3. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; ker\<^bsub>E,F\<^esub> f = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; ker\<^bsub>F,G\<^esub> g = {\<zero>\<^bsub>F\<^esub>}\<rbrakk> \<Longrightarrow> {\<zero>\<^bsub>E\<^esub>} \<subseteq> ker\<^bsub>E,G\<^esub> compos E g f
 4. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (subgoal_tac "x \<in> {a \<in> carrier E. f a = \<zero>\<^bsub>F\<^esub>}", simp)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; {a \<in> carrier E. f a = \<zero>\<^bsub>F\<^esub>} = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>} = {\<zero>\<^bsub>F\<^esub>}; x \<in> carrier E; g \<zero>\<^bsub>F\<^esub> = \<zero>\<^bsub>G\<^esub>; \<zero>\<^bsub>F\<^esub> \<in> carrier F; f x = \<zero>\<^bsub>F\<^esub>\<rbrakk> \<Longrightarrow> x \<in> {a \<in> carrier E. f a = \<zero>\<^bsub>F\<^esub>}
 2. \<And>x. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; {a \<in> carrier E. f a = \<zero>\<^bsub>F\<^esub>} = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>} = {\<zero>\<^bsub>F\<^esub>}; x \<in> carrier E; g (f x) = \<zero>\<^bsub>G\<^esub>; f x \<in> carrier F\<rbrakk> \<Longrightarrow> f x \<in> {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>}
 3. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; ker\<^bsub>E,F\<^esub> f = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; ker\<^bsub>F,G\<^esub> g = {\<zero>\<^bsub>F\<^esub>}\<rbrakk> \<Longrightarrow> {\<zero>\<^bsub>E\<^esub>} \<subseteq> ker\<^bsub>E,G\<^esub> compos E g f
 4. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; {a \<in> carrier E. f a = \<zero>\<^bsub>F\<^esub>} = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>} = {\<zero>\<^bsub>F\<^esub>}; x \<in> carrier E; g (f x) = \<zero>\<^bsub>G\<^esub>; f x \<in> carrier F\<rbrakk> \<Longrightarrow> f x \<in> {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>}
 2. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; ker\<^bsub>E,F\<^esub> f = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; ker\<^bsub>F,G\<^esub> g = {\<zero>\<^bsub>F\<^esub>}\<rbrakk> \<Longrightarrow> {\<zero>\<^bsub>E\<^esub>} \<subseteq> ker\<^bsub>E,G\<^esub> compos E g f
 3. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; ker\<^bsub>E,F\<^esub> f = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; ker\<^bsub>F,G\<^esub> g = {\<zero>\<^bsub>F\<^esub>}\<rbrakk> \<Longrightarrow> {\<zero>\<^bsub>E\<^esub>} \<subseteq> ker\<^bsub>E,G\<^esub> compos E g f
 2. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (rule subsetI, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; ker\<^bsub>E,F\<^esub> f = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; ker\<^bsub>F,G\<^esub> g = {\<zero>\<^bsub>F\<^esub>}; x = \<zero>\<^bsub>E\<^esub>\<rbrakk> \<Longrightarrow> \<zero>\<^bsub>E\<^esub> \<in> ker\<^bsub>E,G\<^esub> compos E g f
 2. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (simp add:ker_def compos_def compose_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; {a \<in> carrier E. f a = \<zero>\<^bsub>F\<^esub>} = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>} = {\<zero>\<^bsub>F\<^esub>}; x = \<zero>\<^bsub>E\<^esub>\<rbrakk> \<Longrightarrow> (\<zero>\<^bsub>E\<^esub> \<in> carrier E \<longrightarrow> g (f \<zero>\<^bsub>E\<^esub>) = \<zero>\<^bsub>G\<^esub>) \<and> \<zero>\<^bsub>E\<^esub> \<in> carrier E
 2. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (simp add:aGroup.ag_inc_zero)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>aGroup E; aGroup F; aGroup G; surjec\<^bsub>E,F\<^esub> f; surjec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; {a \<in> carrier E. f a = \<zero>\<^bsub>F\<^esub>} = {\<zero>\<^bsub>E\<^esub>}; g \<in> aHom F G; {a \<in> carrier F. g a = \<zero>\<^bsub>G\<^esub>} = {\<zero>\<^bsub>F\<^esub>}; x = \<zero>\<^bsub>E\<^esub>\<rbrakk> \<Longrightarrow> g (f \<zero>\<^bsub>E\<^esub>) = \<zero>\<^bsub>G\<^esub>
 2. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (simp add:aHom_0_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surjec\<^bsub>F,G\<^esub> g\<rbrakk> \<Longrightarrow> surjec\<^bsub>E,G\<^esub> compos E g f
[PROOF STEP]
apply (simp add:surjec_def, (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; surj_to f (carrier E) (carrier F); g \<in> aHom F G; surj_to g (carrier F) (carrier G)\<rbrakk> \<Longrightarrow> compos E g f \<in> aHom E G \<and> surj_to (compos E g f) (carrier E) (carrier G)
[PROOF STEP]
apply (simp add:aHom_compos)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; f \<in> aHom E F; surj_to f (carrier E) (carrier F); g \<in> aHom F G; surj_to g (carrier F) (carrier G)\<rbrakk> \<Longrightarrow> surj_to (compos E g f) (carrier E) (carrier G)
[PROOF STEP]
apply (simp add:aHom_def, (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surj_to f (carrier E) (carrier F); surj_to g (carrier F) (carrier G); f \<in> carrier E \<rightarrow> carrier F; g \<in> carrier F \<rightarrow> carrier G; f \<in> extensional (carrier E); \<forall>a\<in>carrier E. \<forall>b\<in>carrier E. f (a \<plusminus>\<^bsub>E\<^esub> b) = f a \<plusminus>\<^bsub>F\<^esub> f b; g \<in> extensional (carrier F); \<forall>a\<in>carrier F. \<forall>b\<in>carrier F. g (a \<plusminus>\<^bsub>F\<^esub> b) = g a \<plusminus>\<^bsub>G\<^esub> g b\<rbrakk> \<Longrightarrow> surj_to (compos E g f) (carrier E) (carrier G)
[PROOF STEP]
apply (simp add:compos_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup E; aGroup F; aGroup G; injec\<^bsub>E,F\<^esub> f; injec\<^bsub>F,G\<^esub> g; surj_to f (carrier E) (carrier F); surj_to g (carrier F) (carrier G); f \<in> carrier E \<rightarrow> carrier F; g \<in> carrier F \<rightarrow> carrier G; f \<in> extensional (carrier E); \<forall>a\<in>carrier E. \<forall>b\<in>carrier E. f (a \<plusminus>\<^bsub>E\<^esub> b) = f a \<plusminus>\<^bsub>F\<^esub> f b; g \<in> extensional (carrier F); \<forall>a\<in>carrier F. \<forall>b\<in>carrier F. g (a \<plusminus>\<^bsub>F\<^esub> b) = g a \<plusminus>\<^bsub>G\<^esub> g b\<rbrakk> \<Longrightarrow> surj_to (compose (carrier E) g f) (carrier E) (carrier G)
[PROOF STEP]
apply (rule compose_surj[of "f" "carrier E" "carrier F" "g" "carrier G"],
            assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma integrable_on_mono_on:
  fixes f :: "real \<Rightarrow> real"
  assumes "mono_on {a..b} f"
  shows "f integrable_on {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f integrable_on {a..b}
[PROOF STEP]
by (simp add: assms integrable_mono_on integrable_on_lebesgue_on)


[STATEMENT]
lemma "A * true * \<up>(b \<and> c) * true * B \<Longrightarrow>\<^sub>A \<up>b * \<up>c * true *A * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * true * \<up> (b \<and> c) * true * B \<Longrightarrow>\<^sub>A \<up> b * \<up> c * true * A * B
[PROOF STEP]
by simp


[STATEMENT]
lemma g_group_sort: "g (group_sort xs) = g xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (group_sort xs) = g xs
[PROOF STEP]
by (simp add: group_sort_correct g_group g_sort)


[STATEMENT]
lemma vsubset_vinsertI:
  assumes "A -\<^sub>\<circ> set {x} \<subseteq>\<^sub>\<circ> B"
  shows "A \<subseteq>\<^sub>\<circ> vinsert x B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq>\<^sub>\<circ> vinsert x B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A -\<^sub>\<circ> set {x} \<subseteq>\<^sub>\<circ> B

goal (1 subgoal):
 1. A \<subseteq>\<^sub>\<circ> vinsert x B
[PROOF STEP]
by auto


[STATEMENT]
lemma hypnat_diff_add_0 [simp]: "\<And>m n::hypnat. n - (n + m) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m n. n - (n + m) = 0
[PROOF STEP]
by transfer (rule diff_add_0)


[STATEMENT]
lemma pos_caps_pos_records:
  assumes "InvCapsNonneg c"
  shows "0 < zcount (c_caps c p) x \<Longrightarrow> 0 < zcount (records c) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < zcount (c_caps c p) x \<Longrightarrow> 0 < zcount (records c) x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < zcount (c_caps c p) x \<Longrightarrow> 0 < zcount (records c) x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < zcount (c_caps c p) x \<Longrightarrow> 0 < zcount (records c) x
[PROOF STEP]
assume "0 < zcount (c_caps c p) x"
[PROOF STATE]
proof (state)
this:
0 < zcount (c_caps c p) x

goal (1 subgoal):
 1. 0 < zcount (c_caps c p) x \<Longrightarrow> 0 < zcount (records c) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < zcount (c_caps c p) x
[PROOF STEP]
have "0 < zcount (\<Sum>p\<in>UNIV. c_caps c p) x"
[PROOF STATE]
proof (prove)
using this:
0 < zcount (c_caps c p) x

goal (1 subgoal):
 1. 0 < zcount (sum (c_caps c) UNIV) x
[PROOF STEP]
using assms(1)[unfolded InvCapsNonneg_def]
[PROOF STATE]
proof (prove)
using this:
0 < zcount (c_caps c p) x
\<forall>p t. 0 \<le> zcount (c_caps c p) t

goal (1 subgoal):
 1. 0 < zcount (sum (c_caps c) UNIV) x
[PROOF STEP]
by (auto intro!: sum_pos2 simp: zcount_sum)
[PROOF STATE]
proof (state)
this:
0 < zcount (sum (c_caps c) UNIV) x

goal (1 subgoal):
 1. 0 < zcount (c_caps c p) x \<Longrightarrow> 0 < zcount (records c) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < zcount (sum (c_caps c) UNIV) x
[PROOF STEP]
show "0 < zcount (records c) x"
[PROOF STATE]
proof (prove)
using this:
0 < zcount (sum (c_caps c) UNIV) x

goal (1 subgoal):
 1. 0 < zcount (records c) x
[PROOF STEP]
unfolding records_def
[PROOF STATE]
proof (prove)
using this:
0 < zcount (sum (c_caps c) UNIV) x

goal (1 subgoal):
 1. 0 < zcount (sum (c_caps c) UNIV + timestamps (zmset_of (c_data_msg c))) x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < zcount (records c) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_cancel_eq_conv:
  fixes x :: "'a::field"
  shows "x = 0 \<Longrightarrow> a \<noteq> 0 \<Longrightarrow> y = 0 \<longleftrightarrow> a * y - b * x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x = (0::'a); a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> (y = (0::'a)) = (a * y - b * x = (0::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma arcsin_sin: "- (pi/2) \<le> x \<Longrightarrow> x \<le> pi/2 \<Longrightarrow> arcsin (sin x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- (pi / 2) \<le> x; x \<le> pi / 2\<rbrakk> \<Longrightarrow> arcsin (sin x) = x
[PROOF STEP]
unfolding arcsin_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- (pi / 2) \<le> x; x \<le> pi / 2\<rbrakk> \<Longrightarrow> (THE xa. - (pi / 2) \<le> xa \<and> xa \<le> pi / 2 \<and> sin xa = sin x) = x
[PROOF STEP]
using the1_equality [OF sin_total]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- 1 \<le> ?y1; ?y1 \<le> 1; - (pi / 2) \<le> ?a \<and> ?a \<le> pi / 2 \<and> sin ?a = ?y1\<rbrakk> \<Longrightarrow> (THE x. - (pi / 2) \<le> x \<and> x \<le> pi / 2 \<and> sin x = ?y1) = ?a

goal (1 subgoal):
 1. \<lbrakk>- (pi / 2) \<le> x; x \<le> pi / 2\<rbrakk> \<Longrightarrow> (THE xa. - (pi / 2) \<le> xa \<and> xa \<le> pi / 2 \<and> sin xa = sin x) = x
[PROOF STEP]
by simp


[STATEMENT]
lemma fixed_point_congruence:
  assumes "order G = p ^ a"
  assumes "prime p"
  assumes finM:"finite M"
  shows "card M mod p = card fixed_points mod p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
define big_orbits where "big_orbits = {N\<in>orbits. card N > 1}"
[PROOF STATE]
proof (state)
this:
big_orbits = {N \<in> orbits. 1 < card N}

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
from finM
[PROOF STATE]
proof (chain)
picking this:
finite M
[PROOF STEP]
have orbit_part:"orbits = big_orbits \<union> {N\<in>orbits. card N = 1}"
[PROOF STATE]
proof (prove)
using this:
finite M

goal (1 subgoal):
 1. orbits = big_orbits \<union> {N \<in> orbits. card N = 1}
[PROOF STEP]
unfolding big_orbits_def
[PROOF STATE]
proof (prove)
using this:
finite M

goal (1 subgoal):
 1. orbits = {N \<in> orbits. 1 < card N} \<union> {N \<in> orbits. card N = 1}
[PROOF STEP]
by (auto dest:orbit_not_empty)
[PROOF STATE]
proof (state)
this:
orbits = big_orbits \<union> {N \<in> orbits. card N = 1}

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
have orbit_disj:"big_orbits \<inter> {N\<in>orbits. card N = 1} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. big_orbits \<inter> {N \<in> orbits. card N = 1} = {}
[PROOF STEP]
unfolding big_orbits_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {N \<in> orbits. 1 < card N} \<inter> {N \<in> orbits. card N = 1} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
big_orbits \<inter> {N \<in> orbits. card N = 1} = {}

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
from finM
[PROOF STATE]
proof (chain)
picking this:
finite M
[PROOF STEP]
have orbits_fin:"finite orbits"
[PROOF STATE]
proof (prove)
using this:
finite M

goal (1 subgoal):
 1. finite orbits
[PROOF STEP]
by (rule fin_set_imp_fin_orbits)
[PROOF STATE]
proof (state)
this:
finite orbits

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
hence fin_parts:"finite big_orbits" "finite {N\<in>orbits. card N = 1}"
[PROOF STATE]
proof (prove)
using this:
finite orbits

goal (1 subgoal):
 1. finite big_orbits &&& finite {N \<in> orbits. card N = 1}
[PROOF STEP]
unfolding big_orbits_def
[PROOF STATE]
proof (prove)
using this:
finite orbits

goal (1 subgoal):
 1. finite {N \<in> orbits. 1 < card N} &&& finite {N \<in> orbits. card N = 1}
[PROOF STEP]
by simp+
[PROOF STATE]
proof (state)
this:
finite big_orbits
finite {N \<in> orbits. card N = 1}

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
order G = p ^ a
prime p
finite M
[PROOF STEP]
have "\<And>N. N \<in> big_orbits \<Longrightarrow> p dvd card N"
[PROOF STATE]
proof (prove)
using this:
order G = p ^ a
prime p
finite M

goal (1 subgoal):
 1. \<And>N. N \<in> big_orbits \<Longrightarrow> p dvd card N
[PROOF STEP]
unfolding big_orbits_def
[PROOF STATE]
proof (prove)
using this:
order G = p ^ a
prime p
finite M

goal (1 subgoal):
 1. \<And>N. N \<in> {N \<in> orbits. 1 < card N} \<Longrightarrow> p dvd card N
[PROOF STEP]
by (auto simp: p_dvd_orbit_size)
[PROOF STATE]
proof (state)
this:
?N \<in> big_orbits \<Longrightarrow> p dvd card ?N

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
hence orbit_div:"\<And>N. N \<in> big_orbits \<Longrightarrow> card N = (card N div p) * p"
[PROOF STATE]
proof (prove)
using this:
?N \<in> big_orbits \<Longrightarrow> p dvd card ?N

goal (1 subgoal):
 1. \<And>N. N \<in> big_orbits \<Longrightarrow> card N = card N div p * p
[PROOF STEP]
by (metis dvd_mult_div_cancel mult.commute)
[PROOF STATE]
proof (state)
this:
?N \<in> big_orbits \<Longrightarrow> card ?N = card ?N div p * p

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
have "card M = card (\<Union> orbits)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card M = card (\<Union> orbits)
[PROOF STEP]
unfolding orbits_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card M = card (\<Union> (M // same_orbit_rel))
[PROOF STEP]
by (metis Union_quotient same_orbit_is_equiv)
[PROOF STATE]
proof (state)
this:
card M = card (\<Union> orbits)

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card M = card (\<Union> orbits)

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
have "card (\<Union> orbits) = (\<Sum>N\<in>orbits. card N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union> orbits) = sum card orbits
[PROOF STEP]
unfolding orbits_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union> (M // same_orbit_rel)) = sum card (M // same_orbit_rel)
[PROOF STEP]
proof (rule card_Union_disjoint)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pairwise disjnt (M // same_orbit_rel)
 2. \<And>A. A \<in> M // same_orbit_rel \<Longrightarrow> finite A
[PROOF STEP]
show "pairwise disjnt (M // same_orbit_rel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise disjnt (M // same_orbit_rel)
[PROOF STEP]
unfolding pairwise_def disjnt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>M // same_orbit_rel. \<forall>y\<in>M // same_orbit_rel. x \<noteq> y \<longrightarrow> x \<inter> y = {}
[PROOF STEP]
by(metis same_orbit_is_equiv quotient_disj)
[PROOF STATE]
proof (state)
this:
pairwise disjnt (M // same_orbit_rel)

goal (1 subgoal):
 1. \<And>A. A \<in> M // same_orbit_rel \<Longrightarrow> finite A
[PROOF STEP]
show "\<And>A. A \<in> M // same_orbit_rel \<Longrightarrow> finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A. A \<in> M // same_orbit_rel \<Longrightarrow> finite A
[PROOF STEP]
using finM same_orbit_rel_def
[PROOF STATE]
proof (prove)
using this:
finite M
same_orbit_rel = {p \<in> M \<times> M. \<exists>g\<in>carrier G. \<phi> g (snd p) = fst p}

goal (1 subgoal):
 1. \<And>A. A \<in> M // same_orbit_rel \<Longrightarrow> finite A
[PROOF STEP]
by (auto dest:finite_equiv_class)
[PROOF STATE]
proof (state)
this:
?A \<in> M // same_orbit_rel \<Longrightarrow> finite ?A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (\<Union> orbits) = sum card orbits

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (\<Union> orbits) = sum card orbits

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
from orbit_part orbit_disj fin_parts
[PROOF STATE]
proof (chain)
picking this:
orbits = big_orbits \<union> {N \<in> orbits. card N = 1}
big_orbits \<inter> {N \<in> orbits. card N = 1} = {}
finite big_orbits
finite {N \<in> orbits. card N = 1}
[PROOF STEP]
have "... = (\<Sum>N\<in>big_orbits. card N) + (\<Sum>N\<in>{N'\<in>orbits. card N' = 1}. card N)"
[PROOF STATE]
proof (prove)
using this:
orbits = big_orbits \<union> {N \<in> orbits. card N = 1}
big_orbits \<inter> {N \<in> orbits. card N = 1} = {}
finite big_orbits
finite {N \<in> orbits. card N = 1}

goal (1 subgoal):
 1. sum card orbits = sum card big_orbits + sum card {N' \<in> orbits. card N' = 1}
[PROOF STEP]
by (metis (lifting) sum.union_disjoint)
[PROOF STATE]
proof (state)
this:
sum card orbits = sum card big_orbits + sum card {N' \<in> orbits. card N' = 1}

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum card orbits = sum card big_orbits + sum card {N' \<in> orbits. card N' = 1}

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
from assms orbit_div fin_parts
[PROOF STATE]
proof (chain)
picking this:
order G = p ^ a
prime p
finite M
?N \<in> big_orbits \<Longrightarrow> card ?N = card ?N div p * p
finite big_orbits
finite {N \<in> orbits. card N = 1}
[PROOF STEP]
have "... = (\<Sum>N\<in>big_orbits. (card N div p) * p) + card (\<Union>{N'\<in>orbits. card N' = 1})"
[PROOF STATE]
proof (prove)
using this:
order G = p ^ a
prime p
finite M
?N \<in> big_orbits \<Longrightarrow> card ?N = card ?N div p * p
finite big_orbits
finite {N \<in> orbits. card N = 1}

goal (1 subgoal):
 1. sum card big_orbits + sum card {N' \<in> orbits. card N' = 1} = (\<Sum>N\<in>big_orbits. card N div p * p) + card (\<Union> {N' \<in> orbits. card N' = 1})
[PROOF STEP]
by (auto simp: card_singleton_set)
[PROOF STATE]
proof (state)
this:
sum card big_orbits + sum card {N' \<in> orbits. card N' = 1} = (\<Sum>N\<in>big_orbits. card N div p * p) + card (\<Union> {N' \<in> orbits. card N' = 1})

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum card big_orbits + sum card {N' \<in> orbits. card N' = 1} = (\<Sum>N\<in>big_orbits. card N div p * p) + card (\<Union> {N' \<in> orbits. card N' = 1})

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
have "... = (\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>N\<in>big_orbits. card N div p * p) + card (\<Union> {N' \<in> orbits. card N' = 1}) = (\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points
[PROOF STEP]
using singleton_orbits
[PROOF STATE]
proof (prove)
using this:
\<Union> {N \<in> orbits. card N = 1} = fixed_points

goal (1 subgoal):
 1. (\<Sum>N\<in>big_orbits. card N div p * p) + card (\<Union> {N' \<in> orbits. card N' = 1}) = (\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points
[PROOF STEP]
by (auto simp:sum_distrib_right)
[PROOF STATE]
proof (state)
this:
(\<Sum>N\<in>big_orbits. card N div p * p) + card (\<Union> {N' \<in> orbits. card N' = 1}) = (\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card M = (\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points
[PROOF STEP]
have "card M = (\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points"
[PROOF STATE]
proof (prove)
using this:
card M = (\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points

goal (1 subgoal):
 1. card M = (\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card M = (\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
hence "card M mod p = ((\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points) mod p"
[PROOF STATE]
proof (prove)
using this:
card M = (\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points

goal (1 subgoal):
 1. card M mod p = ((\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points) mod p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card M mod p = ((\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points) mod p

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card M mod p = ((\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points) mod p

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
have "... = (card fixed_points) mod p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points) mod p = card fixed_points mod p
[PROOF STEP]
by (metis mod_mult_self3)
[PROOF STATE]
proof (state)
this:
((\<Sum>N\<in>big_orbits. card N div p) * p + card fixed_points) mod p = card fixed_points mod p

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card M mod p = card fixed_points mod p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card M mod p = card fixed_points mod p

goal (1 subgoal):
 1. card M mod p = card fixed_points mod p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card M mod p = card fixed_points mod p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma frontier_of_subtopology_open:
     "openin X U \<Longrightarrow> (subtopology X U) frontier_of S = U \<inter> X frontier_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin X U \<Longrightarrow> subtopology X U frontier_of S = U \<inter> X frontier_of S
[PROOF STEP]
by (simp add: Diff_Int_distrib closure_of_subtopology_open frontier_of_def interior_of_subtopology_open)


[STATEMENT]
lemma singleton_eq_union_iff [iff]:
  "{#x#} = M + {#y#} \<longleftrightarrow> M = {#} \<and> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({#x#} = M + {#y#}) = (M = {#} \<and> x = y)
[PROOF STEP]
by (metis multi_self_add_other_not_self single_eq_single single_is_union)


[STATEMENT]
theorem diagonal_admits_SNF_iff_bezout_ring:
  shows "class.bezout_ring (*) (1::'a::comm_ring_1) (+) 0 (-) uminus
  \<longleftrightarrow> (\<forall>A::'a mat. admits_SNF_JNF A)" (is "?a \<longleftrightarrow> ?b")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus = (\<forall>A. admits_SNF_JNF A)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus \<Longrightarrow> \<forall>A. admits_SNF_JNF A
 2. \<forall>A. admits_SNF_JNF A \<Longrightarrow> class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus
[PROOF STEP]
assume ?a
[PROOF STATE]
proof (state)
this:
class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus

goal (2 subgoals):
 1. class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus \<Longrightarrow> \<forall>A. admits_SNF_JNF A
 2. \<forall>A. admits_SNF_JNF A \<Longrightarrow> class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus
[PROOF STEP]
thus ?b
[PROOF STATE]
proof (prove)
using this:
class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus

goal (1 subgoal):
 1. \<forall>A. admits_SNF_JNF A
[PROOF STEP]
using bezout_ring_imp_diagonal_admits_SNF_JNF
[PROOF STATE]
proof (prove)
using this:
class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus
class.bezout_ring (*) (1::?'a) (+) (0::?'a) (-) uminus \<Longrightarrow> \<forall>A. admits_SNF_JNF A

goal (1 subgoal):
 1. \<forall>A. admits_SNF_JNF A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>A. admits_SNF_JNF A

goal (1 subgoal):
 1. \<forall>A. admits_SNF_JNF A \<Longrightarrow> class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>A. admits_SNF_JNF A \<Longrightarrow> class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus
[PROOF STEP]
assume b: ?b
[PROOF STATE]
proof (state)
this:
\<forall>A. admits_SNF_JNF A

goal (1 subgoal):
 1. \<forall>A. admits_SNF_JNF A \<Longrightarrow> class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus
[PROOF STEP]
have rw: "\<forall>A n. (A::'a mat) \<in> carrier_mat n n \<and> isDiagonal_mat A \<longrightarrow>
          (\<exists>P Q. P \<in> carrier_mat n n \<and> Q \<in> carrier_mat n n \<and> invertible_mat P
          \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A n. A \<in> carrier_mat n n \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat n n \<and> Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
using admits_SNF_JNF_alt_def b
[PROOF STATE]
proof (prove)
using this:
(\<forall>A. admits_SNF_JNF A) = (\<forall>A n. A \<in> carrier_mat n n \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat n n \<and> Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q)))
\<forall>A. admits_SNF_JNF A

goal (1 subgoal):
 1. \<forall>A n. A \<in> carrier_mat n n \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat n n \<and> Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>A n. A \<in> carrier_mat n n \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat n n \<and> Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))

goal (1 subgoal):
 1. \<forall>A. admits_SNF_JNF A \<Longrightarrow> class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus
[PROOF STEP]
show ?a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus
[PROOF STEP]
using diagonal_admits_SNF_imp_bezout_ring_JNF[OF rw]
[PROOF STATE]
proof (prove)
using this:
OFCLASS('a, bezout_ring_class)

goal (1 subgoal):
 1. class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus
[PROOF STEP]
using OFCLASS_bezout_ring_imp_class_bezout_ring[where ?'a='a]
[PROOF STATE]
proof (prove)
using this:
OFCLASS('a, bezout_ring_class)
OFCLASS('a, bezout_ring_class) \<Longrightarrow> class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus

goal (1 subgoal):
 1. class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
class.bezout_ring (*) (1::'a) (+) (0::'a) (-) uminus

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in \<Z>) dg_Rel_incl_Rel_is_arr:
  assumes "A \<in>\<^sub>\<circ> Vset \<alpha>" and "B \<in>\<^sub>\<circ> Vset \<alpha>" and "A \<subseteq>\<^sub>\<circ> B"
  shows "incl_Rel A B : A \<mapsto>\<^bsub>dg_Rel \<alpha>\<^esub> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incl_Rel A B : A \<mapsto>\<^bsub>dg_Rel \<alpha>\<^esub> B
[PROOF STEP]
proof(rule dg_Rel_is_arrI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. arr_Rel \<alpha> (incl_Rel A B)
 2. incl_Rel A B\<lparr>ArrDom\<rparr> = A
 3. incl_Rel A B\<lparr>ArrCod\<rparr> = B
[PROOF STEP]
show "arr_Rel \<alpha> (incl_Rel A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arr_Rel \<alpha> (incl_Rel A B)
[PROOF STEP]
by (intro arr_Rel_incl_RelI assms)
[PROOF STATE]
proof (state)
this:
arr_Rel \<alpha> (incl_Rel A B)

goal (2 subgoals):
 1. incl_Rel A B\<lparr>ArrDom\<rparr> = A
 2. incl_Rel A B\<lparr>ArrCod\<rparr> = B
[PROOF STEP]
qed (simp_all add: incl_Rel_components)


[STATEMENT]
lemma path_Append:"\<lbrakk>n -as\<rightarrow>* n''; n'' -as'\<rightarrow>* n'\<rbrakk>
  \<Longrightarrow> n -as@as'\<rightarrow>* n'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n -as\<rightarrow>* n''; n'' -as'\<rightarrow>* n'\<rbrakk> \<Longrightarrow> n -as @ as'\<rightarrow>* n'
[PROOF STEP]
by(induct rule:path.induct,auto intro:Cons_path)


[STATEMENT]
lemma resultant_mpoly_poly_hom: "resultant_mpoly_poly x (map_mpoly hom p) (map_poly hom q) = map_mpoly hom (resultant_mpoly_poly x p q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant_mpoly_poly x (map_mpoly hom p) (map_poly hom q) = map_mpoly hom (resultant_mpoly_poly x p q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. resultant_mpoly_poly x (map_mpoly hom p) (map_poly hom q) = map_mpoly hom (resultant_mpoly_poly x p q)
[PROOF STEP]
interpret mp: inj_comm_ring_hom "map_mpoly hom"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_comm_ring_hom (map_mpoly hom)
[PROOF STEP]
by (rule inj_comm_ring_hom_mpoly_map)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. resultant_mpoly_poly x (map_mpoly hom p) (map_poly hom q) = map_mpoly hom (resultant_mpoly_poly x p q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant_mpoly_poly x (map_mpoly hom p) (map_poly hom q) = map_mpoly hom (resultant_mpoly_poly x p q)
[PROOF STEP]
unfolding resultant_mpoly_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant (mpoly_to_mpoly_poly x (map_mpoly hom p)) (map_poly Const (map_poly hom q)) = map_mpoly hom (resultant (mpoly_to_mpoly_poly x p) (map_poly Const q))
[PROOF STEP]
unfolding mpoly_to_mpoly_poly_map_mpoly_hom
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant (map_poly (map_mpoly hom) (mpoly_to_mpoly_poly x p)) (map_poly Const (map_poly hom q)) = map_mpoly hom (resultant (mpoly_to_mpoly_poly x p) (map_poly Const q))
[PROOF STEP]
apply (subst mp.resultant_map_poly[symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. degree (map_poly (map_mpoly hom) (mpoly_to_mpoly_poly x p)) = degree (mpoly_to_mpoly_poly x p)
 2. degree (map_poly (map_mpoly hom) (map_poly Const q)) = degree (map_poly Const q)
 3. resultant (map_poly (map_mpoly hom) (mpoly_to_mpoly_poly x p)) (map_poly Const (map_poly hom q)) = resultant (map_poly (map_mpoly hom) (mpoly_to_mpoly_poly x p)) (map_poly (map_mpoly hom) (map_poly Const q))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (map_poly (map_mpoly hom) (mpoly_to_mpoly_poly x p)) = degree (mpoly_to_mpoly_poly x p)
[PROOF STEP]
by (subst mp.degree_map_poly_hom, unfold_locales, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. degree (map_poly (map_mpoly hom) (map_poly Const q)) = degree (map_poly Const q)
 2. resultant (map_poly (map_mpoly hom) (mpoly_to_mpoly_poly x p)) (map_poly Const (map_poly hom q)) = resultant (map_poly (map_mpoly hom) (mpoly_to_mpoly_poly x p)) (map_poly (map_mpoly hom) (map_poly Const q))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (map_poly (map_mpoly hom) (map_poly Const q)) = degree (map_poly Const q)
[PROOF STEP]
by (subst mp.degree_map_poly_hom, unfold_locales, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant (map_poly (map_mpoly hom) (mpoly_to_mpoly_poly x p)) (map_poly Const (map_poly hom q)) = resultant (map_poly (map_mpoly hom) (mpoly_to_mpoly_poly x p)) (map_poly (map_mpoly hom) (map_poly Const q))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant (map_poly (map_mpoly hom) (mpoly_to_mpoly_poly x p)) (map_poly Const (map_poly hom q)) = resultant (map_poly (map_mpoly hom) (mpoly_to_mpoly_poly x p)) (map_poly (map_mpoly hom) (map_poly Const q))
[PROOF STEP]
apply (rule arg_cong[of _ _ "resultant _"], intro poly_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. coeff (map_poly Const (map_poly hom q)) n = coeff (map_poly (map_mpoly hom) (map_poly Const q)) n
[PROOF STEP]
apply (subst coeff_map_poly, force)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. Const (hom (coeff q n)) = map_mpoly hom (Const (coeff q n))
[PROOF STEP]
by (simp add: map_mpoly_hom_Const)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
resultant_mpoly_poly x (map_mpoly hom p) (map_poly hom q) = map_mpoly hom (resultant_mpoly_poly x p q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mpoly_to_poly_code_aux:
  fixes p :: "'a :: comm_monoid_add mpoly" and x :: nat
  defines "I \<equiv> (\<lambda>m. lookup m x) ` Set.filter (\<lambda>m. \<forall>y\<in>keys m. y = x) (keys (mapping_of p))"
  shows   "I = {n. poly.coeff (mpoly_to_poly x p) n \<noteq> 0}"
    and   "mpoly_to_poly x p = 0 \<longleftrightarrow> I = {}"
    and   "I \<noteq> {} \<Longrightarrow> Polynomial.degree (mpoly_to_poly x p) = Max I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I = {n. poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a)} &&& (mpoly_to_poly x p = 0) = (I = {}) &&& (I \<noteq> {} \<Longrightarrow> Polynomial.degree (mpoly_to_poly x p) = Max I)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. I = {n. poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a)}
 2. (mpoly_to_poly x p = 0) = (I = {})
 3. I \<noteq> {} \<Longrightarrow> Polynomial.degree (mpoly_to_poly x p) = Max I
[PROOF STEP]
have "n \<in> I \<longleftrightarrow> poly.coeff (mpoly_to_poly x p) n \<noteq> 0" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))
[PROOF STEP]
have "I = (\<lambda>m. lookup m x) ` (keys (mapping_of p) \<inter> {m. \<forall>y\<in>keys m. y = x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I = (\<lambda>m. lookup m x) ` (keys (mapping_of p) \<inter> {m. \<forall>y\<in>keys m. y = x})
[PROOF STEP]
by (auto simp: I_def Set.filter_def)
[PROOF STATE]
proof (state)
this:
I = (\<lambda>m. lookup m x) ` (keys (mapping_of p) \<inter> {m. \<forall>y\<in>keys m. y = x})

goal (1 subgoal):
 1. (n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
I = (\<lambda>m. lookup m x) ` (keys (mapping_of p) \<inter> {m. \<forall>y\<in>keys m. y = x})

goal (1 subgoal):
 1. (n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))
[PROOF STEP]
have "{m. \<forall>y\<in>keys m. y = x} = range (\<lambda>n. monomial n x)" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {m. \<forall>y\<in>keys m. y = x} = range (\<lambda>n. monomial n x)
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> {m. \<forall>y\<in>keys m. y = x} \<Longrightarrow> xa \<in> range (\<lambda>n. monomial n x)
 2. \<And>xa. xa \<in> range (\<lambda>n. monomial n x) \<Longrightarrow> xa \<in> {m. \<forall>y\<in>keys m. y = x}
[PROOF STEP]
fix m
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> {m. \<forall>y\<in>keys m. y = x} \<Longrightarrow> xa \<in> range (\<lambda>n. monomial n x)
 2. \<And>xa. xa \<in> range (\<lambda>n. monomial n x) \<Longrightarrow> xa \<in> {m. \<forall>y\<in>keys m. y = x}
[PROOF STEP]
assume "m \<in> ?lhs"
[PROOF STATE]
proof (state)
this:
m \<in> {m. \<forall>y\<in>keys m. y = x}

goal (2 subgoals):
 1. \<And>xa. xa \<in> {m. \<forall>y\<in>keys m. y = x} \<Longrightarrow> xa \<in> range (\<lambda>n. monomial n x)
 2. \<And>xa. xa \<in> range (\<lambda>n. monomial n x) \<Longrightarrow> xa \<in> {m. \<forall>y\<in>keys m. y = x}
[PROOF STEP]
hence "m = monomial (lookup m x) x"
[PROOF STATE]
proof (prove)
using this:
m \<in> {m. \<forall>y\<in>keys m. y = x}

goal (1 subgoal):
 1. m = monomial (lookup m x) x
[PROOF STEP]
by transfer (auto simp: fun_eq_iff when_def)
[PROOF STATE]
proof (state)
this:
m = monomial (lookup m x) x

goal (2 subgoals):
 1. \<And>xa. xa \<in> {m. \<forall>y\<in>keys m. y = x} \<Longrightarrow> xa \<in> range (\<lambda>n. monomial n x)
 2. \<And>xa. xa \<in> range (\<lambda>n. monomial n x) \<Longrightarrow> xa \<in> {m. \<forall>y\<in>keys m. y = x}
[PROOF STEP]
thus "m \<in> ?rhs"
[PROOF STATE]
proof (prove)
using this:
m = monomial (lookup m x) x

goal (1 subgoal):
 1. m \<in> range (\<lambda>n. monomial n x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m \<in> range (\<lambda>n. monomial n x)

goal (1 subgoal):
 1. \<And>xa. xa \<in> range (\<lambda>n. monomial n x) \<Longrightarrow> xa \<in> {m. \<forall>y\<in>keys m. y = x}
[PROOF STEP]
qed (auto split: if_splits)
[PROOF STATE]
proof (state)
this:
{m. \<forall>y\<in>keys m. y = x} = range (\<lambda>n. monomial n x)

goal (1 subgoal):
 1. (n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{m. \<forall>y\<in>keys m. y = x} = range (\<lambda>n. monomial n x)

goal (1 subgoal):
 1. (n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))
[PROOF STEP]
have "n \<in> (\<lambda>m. lookup m x) ` (keys (mapping_of p) \<inter> \<dots>) \<longleftrightarrow>
               monomial n x \<in> keys (mapping_of p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n \<in> (\<lambda>m. lookup m x) ` (keys (mapping_of p) \<inter> range (\<lambda>n. monomial n x))) = (monomial n x \<in> keys (mapping_of p))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(n \<in> (\<lambda>m. lookup m x) ` (keys (mapping_of p) \<inter> range (\<lambda>n. monomial n x))) = (monomial n x \<in> keys (mapping_of p))

goal (1 subgoal):
 1. (n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(n \<in> (\<lambda>m. lookup m x) ` (keys (mapping_of p) \<inter> range (\<lambda>n. monomial n x))) = (monomial n x \<in> keys (mapping_of p))

goal (1 subgoal):
 1. (n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> poly.coeff (mpoly_to_poly x p) n \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (monomial n x \<in> keys (mapping_of p)) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))
[PROOF STEP]
by (simp add: coeff_def in_keys_iff)
[PROOF STATE]
proof (state)
this:
(monomial n x \<in> keys (mapping_of p)) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))

goal (1 subgoal):
 1. (n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))

goal (1 subgoal):
 1. (n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(n \<in> I) = (poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(?n \<in> I) = (poly.coeff (mpoly_to_poly x p) ?n \<noteq> (0::'a))

goal (3 subgoals):
 1. I = {n. poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a)}
 2. (mpoly_to_poly x p = 0) = (I = {})
 3. I \<noteq> {} \<Longrightarrow> Polynomial.degree (mpoly_to_poly x p) = Max I
[PROOF STEP]
thus I: "I = {n. poly.coeff (mpoly_to_poly x p) n \<noteq> 0}"
[PROOF STATE]
proof (prove)
using this:
(?n \<in> I) = (poly.coeff (mpoly_to_poly x p) ?n \<noteq> (0::'a))

goal (1 subgoal):
 1. I = {n. poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a)}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
I = {n. poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a)}

goal (2 subgoals):
 1. (mpoly_to_poly x p = 0) = (I = {})
 2. I \<noteq> {} \<Longrightarrow> Polynomial.degree (mpoly_to_poly x p) = Max I
[PROOF STEP]
show eq_0_iff: "mpoly_to_poly x p = 0 \<longleftrightarrow> I = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mpoly_to_poly x p = 0) = (I = {})
[PROOF STEP]
unfolding I
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mpoly_to_poly x p = 0) = ({n. poly.coeff (mpoly_to_poly x p) n \<noteq> (0::'a)} = {})
[PROOF STEP]
by (auto simp: poly_eq_iff)
[PROOF STATE]
proof (state)
this:
(mpoly_to_poly x p = 0) = (I = {})

goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> Polynomial.degree (mpoly_to_poly x p) = Max I
[PROOF STEP]
show "I \<noteq> {} \<Longrightarrow> Polynomial.degree (mpoly_to_poly x p) = Max I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> Polynomial.degree (mpoly_to_poly x p) = Max I
[PROOF STEP]
by (subst poly_degree_conv_Max) (use eq_0_iff I in auto)
[PROOF STATE]
proof (state)
this:
I \<noteq> {} \<Longrightarrow> Polynomial.degree (mpoly_to_poly x p) = Max I

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bexCI: "(\<forall>x\<^bold>\<in>A. \<not> P x \<Longrightarrow> P a) \<Longrightarrow> a\<^bold>\<in>A \<Longrightarrow> \<exists>x\<^bold>\<in>A. P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<^bold>\<in>A. \<not> P x \<Longrightarrow> P a; a \<^bold>\<in> A\<rbrakk> \<Longrightarrow> HBex A P
[PROOF STEP]
by (unfold HBex_def) blast


[STATEMENT]
lemma size_Diff1_less: "x\<in># M \<Longrightarrow> size (M - {#x#}) < size M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in># M \<Longrightarrow> size (M - {#x#}) < size M
[PROOF STEP]
by (rule Suc_less_SucD) (simp add: size_Suc_Diff1)


[STATEMENT]
lemma Iter_comm:
  "(Iter f n) (f x) = f ((Iter f n) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Iter f n (f x) = f (Iter f n x)
[PROOF STEP]
by (induct n) (simp_all)


[STATEMENT]
lemma thermostat:
  assumes "a > 0" and "0 < Tmin" and "Tmax < L"
  shows "\<lceil>\<lambda>s. Tmin \<le> s$1 \<and> s$1 \<le> Tmax \<and> s$4 = 0\<rceil> \<le> wp
  (LOOP
    \<comment> \<open>control\<close>
    ((2 ::= (\<lambda>s. 0));(3 ::= (\<lambda>s. s$1));
    (IF (\<lambda>s. s$4 = 0 \<and> s$3 \<le> Tmin + 1) THEN (4 ::= (\<lambda>s.1)) ELSE
    (IF (\<lambda>s. s$4 = 1 \<and> s$3 \<ge> Tmax - 1) THEN (4 ::= (\<lambda>s.0)) ELSE skip));
    \<comment> \<open>dynamics\<close>
    (IF (\<lambda>s. s$4 = 0) THEN (x\<acute>= f a 0 & (\<lambda>s. s$2 \<le> - (ln (Tmin/s$3))/a))
    ELSE (x\<acute>= f a L & (\<lambda>s. s$2 \<le> - (ln ((L-Tmax)/(L-s$3)))/a))) )
  INV (\<lambda>s. Tmin \<le>s$1 \<and> s$1 \<le> Tmax \<and> (s$4 = 0 \<or> s$4 = 1)))
  \<lceil>\<lambda>s. Tmin \<le> s$1 \<and> s$1 \<le> Tmax\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>\<lambda>s. Tmin \<le> s $ 1 \<and> s $ 1 \<le> Tmax \<and> s $ 4 = 0\<rceil> \<le> wp (LOOP (2 ::= (\<lambda>s. 0)) ; (3 ::= (\<lambda>s. s $ 1)) ; (IF (\<lambda>s. s $ 4 = 0 \<and> s $ 3 \<le> Tmin + 1) THEN (4 ::= (\<lambda>s. 1)) ELSE IF (\<lambda>s. s $ 4 = 1 \<and> Tmax - 1 \<le> s $ 3) THEN (4 ::= (\<lambda>s. 0)) ELSE skip) ; (IF (\<lambda>s. s $ 4 = 0) THEN x\<acute>= \<lambda>t. f a 0 & \<lambda>s. s $ 2 \<le> - ln (Tmin / s $ 3) / a on \<lambda>s. {t. 0 \<le> t} UNIV @ 0 ELSE x\<acute>= \<lambda>t. f a L & \<lambda>s. s $ 2 \<le> - ln ((L - Tmax) / (L - s $ 3)) / a on \<lambda>s. {t. 0 \<le> t} UNIV @ 0) INV (\<lambda>s. Tmin \<le> s $ 1 \<and> s $ 1 \<le> Tmax \<and> (s $ 4 = 0 \<or> s $ 4 = 1)) ) \<lceil>\<lambda>s. Tmin \<le> s $ 1 \<and> s $ 1 \<le> Tmax\<rceil>
[PROOF STEP]
apply(rule wp_loopI, simp_all add: fbox_temp_dyn[OF assms(1)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>s. Tmin \<le> s $ 1 \<and> s $ 1 \<le> Tmax \<and> (s $ 4 = 0 \<or> s $ 4 = 1) \<longrightarrow> (s $ 4 = 0 \<longrightarrow> s $ 1 \<le> Tmin + 1 \<longrightarrow> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln ((L - Tmax) / (L - s $ 1)) / a)) \<longrightarrow> Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<and> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<le> Tmax)) \<and> (s $ 4 = 0 \<and> s $ 1 \<le> Tmin + 1 \<or> (s $ 4 = 1 \<longrightarrow> Tmax - 1 \<le> s $ 1 \<longrightarrow> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln (Tmin / s $ 1) / a)) \<longrightarrow> Tmin \<le> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<and> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<le> Tmax)) \<and> (s $ 4 = 1 \<and> Tmax - 1 \<le> s $ 1 \<or> (s $ 4 = 0 \<longrightarrow> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln (Tmin / s $ 1) / a)) \<longrightarrow> Tmin \<le> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<and> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<le> Tmax)) \<and> (s $ 4 = 0 \<or> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln ((L - Tmax) / (L - s $ 1)) / a)) \<longrightarrow> Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<and> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<le> Tmax))))
[PROOF STEP]
using temp_dyn_up_real_arith[OF assms(1) _ _ assms(3), of Tmin]
    and temp_dyn_down_real_arith[OF assms(1,2), of _ Tmax]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?t; \<forall>\<tau>\<in>{0..?t}. \<tau> \<le> - (ln ((L - Tmax) / (L - ?T)) / a)\<rbrakk> \<Longrightarrow> L - Tmax \<le> exp (- (a \<cdot> ?t)) \<cdot> (L - ?T)
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?t; \<forall>\<tau>\<in>{0..?t}. \<tau> \<le> - (ln ((L - Tmax) / (L - ?T)) / a)\<rbrakk> \<Longrightarrow> L - exp (- (a \<cdot> ?t)) \<cdot> (L - ?T) \<le> Tmax
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?t; \<forall>\<tau>\<in>{0..?t}. \<tau> \<le> - (ln ((L - Tmax) / (L - ?T)) / a)\<rbrakk> \<Longrightarrow> Tmin \<le> L - exp (- (a \<cdot> ?t)) \<cdot> (L - ?T)
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?t; \<forall>\<tau>\<in>{0..?t}. \<tau> \<le> - (ln (Tmin / ?T) / a)\<rbrakk> \<Longrightarrow> Tmin \<le> exp (- a \<cdot> ?t) \<cdot> ?T
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?t; \<forall>\<tau>\<in>{0..?t}. \<tau> \<le> - (ln (Tmin / ?T) / a)\<rbrakk> \<Longrightarrow> exp (- a \<cdot> ?t) \<cdot> ?T \<le> Tmax

goal (1 subgoal):
 1. \<forall>s. Tmin \<le> s $ 1 \<and> s $ 1 \<le> Tmax \<and> (s $ 4 = 0 \<or> s $ 4 = 1) \<longrightarrow> (s $ 4 = 0 \<longrightarrow> s $ 1 \<le> Tmin + 1 \<longrightarrow> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln ((L - Tmax) / (L - s $ 1)) / a)) \<longrightarrow> Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<and> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<le> Tmax)) \<and> (s $ 4 = 0 \<and> s $ 1 \<le> Tmin + 1 \<or> (s $ 4 = 1 \<longrightarrow> Tmax - 1 \<le> s $ 1 \<longrightarrow> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln (Tmin / s $ 1) / a)) \<longrightarrow> Tmin \<le> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<and> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<le> Tmax)) \<and> (s $ 4 = 1 \<and> Tmax - 1 \<le> s $ 1 \<or> (s $ 4 = 0 \<longrightarrow> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln (Tmin / s $ 1) / a)) \<longrightarrow> Tmin \<le> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<and> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<le> Tmax)) \<and> (s $ 4 = 0 \<or> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln ((L - Tmax) / (L - s $ 1)) / a)) \<longrightarrow> Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<and> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<le> Tmax))))
[PROOF STEP]
by auto


[STATEMENT]
theorem wf_to_dtree: "wf_dtree to_dtree"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_dtree to_dtree
[PROOF STEP]
unfolding to_dtree_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_dtree (to_dtree_aux root)
[PROOF STEP]
using wf_to_dtree_aux
[PROOF STATE]
proof (prove)
using this:
wf_dtree (to_dtree_aux ?r)

goal (1 subgoal):
 1. wf_dtree (to_dtree_aux root)
[PROOF STEP]
by blast


[STATEMENT]
lemma four_block_diag_cong_comp':
  assumes "dim_row A1 = dim_row B1"
  and "dim_col A1 = dim_col B1"
  and "four_block_diag A1 A2 = four_block_diag B1 B2"
shows "A2 = B2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A2 = B2
[PROOF STEP]
proof (rule eq_matI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
 2. dim_row A2 = dim_row B2
 3. dim_col A2 = dim_col B2
[PROOF STEP]
define n where "n=dim_row A1"
[PROOF STATE]
proof (state)
this:
n = dim_row A1

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
 2. dim_row A2 = dim_row B2
 3. dim_col A2 = dim_col B2
[PROOF STEP]
define m where "m = dim_col A1"
[PROOF STATE]
proof (state)
this:
m = dim_col A1

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
 2. dim_row A2 = dim_row B2
 3. dim_col A2 = dim_col B2
[PROOF STEP]
define A where "A = four_block_diag A1 A2"
[PROOF STATE]
proof (state)
this:
A = four_block_diag A1 A2

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
 2. dim_row A2 = dim_row B2
 3. dim_col A2 = dim_col B2
[PROOF STEP]
define B where "B = four_block_diag B1 B2"
[PROOF STATE]
proof (state)
this:
B = four_block_diag B1 B2

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
 2. dim_row A2 = dim_row B2
 3. dim_col A2 = dim_col B2
[PROOF STEP]
show "dim_row A2 = dim_row B2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row A2 = dim_row B2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_row A1 = dim_row B1
dim_col A1 = dim_col B1
four_block_diag A1 A2 = four_block_diag B1 B2

goal (1 subgoal):
 1. dim_row A2 = dim_row B2
[PROOF STEP]
unfolding four_block_mat_def Let_def
[PROOF STATE]
proof (prove)
using this:
dim_row A1 = dim_row B1
dim_col A1 = dim_col B1
Matrix.mat (dim_row A1 + dim_row A2) (dim_col A1 + dim_col A2) (\<lambda>(i, j). if i < dim_row A1 then if j < dim_col A1 then A1 $$ (i, j) else 0\<^sub>m (dim_row A1) (dim_col A2) $$ (i, j - dim_col A1) else if j < dim_col A1 then 0\<^sub>m (dim_row A2) (dim_col A1) $$ (i - dim_row A1, j) else A2 $$ (i - dim_row A1, j - dim_col A1)) = Matrix.mat (dim_row B1 + dim_row B2) (dim_col B1 + dim_col B2) (\<lambda>(i, j). if i < dim_row B1 then if j < dim_col B1 then B1 $$ (i, j) else 0\<^sub>m (dim_row B1) (dim_col B2) $$ (i, j - dim_col B1) else if j < dim_col B1 then 0\<^sub>m (dim_row B2) (dim_col B1) $$ (i - dim_row B1, j) else B2 $$ (i - dim_row B1, j - dim_col B1))

goal (1 subgoal):
 1. dim_row A2 = dim_row B2
[PROOF STEP]
by (metis assms(3) diff_add_inverse index_mat_four_block(2))
[PROOF STATE]
proof (state)
this:
dim_row A2 = dim_row B2

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
 2. dim_col A2 = dim_col B2
[PROOF STEP]
show "dim_col A2 = dim_col B2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col A2 = dim_col B2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_row A1 = dim_row B1
dim_col A1 = dim_col B1
four_block_diag A1 A2 = four_block_diag B1 B2

goal (1 subgoal):
 1. dim_col A2 = dim_col B2
[PROOF STEP]
unfolding four_block_mat_def Let_def
[PROOF STATE]
proof (prove)
using this:
dim_row A1 = dim_row B1
dim_col A1 = dim_col B1
Matrix.mat (dim_row A1 + dim_row A2) (dim_col A1 + dim_col A2) (\<lambda>(i, j). if i < dim_row A1 then if j < dim_col A1 then A1 $$ (i, j) else 0\<^sub>m (dim_row A1) (dim_col A2) $$ (i, j - dim_col A1) else if j < dim_col A1 then 0\<^sub>m (dim_row A2) (dim_col A1) $$ (i - dim_row A1, j) else A2 $$ (i - dim_row A1, j - dim_col A1)) = Matrix.mat (dim_row B1 + dim_row B2) (dim_col B1 + dim_col B2) (\<lambda>(i, j). if i < dim_row B1 then if j < dim_col B1 then B1 $$ (i, j) else 0\<^sub>m (dim_row B1) (dim_col B2) $$ (i, j - dim_col B1) else if j < dim_col B1 then 0\<^sub>m (dim_row B2) (dim_col B1) $$ (i - dim_row B1, j) else B2 $$ (i - dim_row B1, j - dim_col B1))

goal (1 subgoal):
 1. dim_col A2 = dim_col B2
[PROOF STEP]
by (metis assms(3) diff_add_inverse index_mat_four_block(3))
[PROOF STATE]
proof (state)
this:
dim_col A2 = dim_col B2

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
assume "i < dim_row B2" and "j<dim_col B2"
[PROOF STATE]
proof (state)
this:
i < dim_row B2
j < dim_col B2

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
note ij=this
[PROOF STATE]
proof (state)
this:
i < dim_row B2
j < dim_col B2

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
hence "i+n < dim_row A"
[PROOF STATE]
proof (prove)
using this:
i < dim_row B2
j < dim_col B2

goal (1 subgoal):
 1. i + n < dim_row A
[PROOF STEP]
unfolding A_def n_def m_def four_block_mat_def Let_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row B2
j < dim_col B2

goal (1 subgoal):
 1. i + dim_row A1 < dim_row (Matrix.mat (dim_row A1 + dim_row A2) (dim_col A1 + dim_col A2) (\<lambda>(i, j). if i < dim_row A1 then if j < dim_col A1 then A1 $$ (i, j) else 0\<^sub>m (dim_row A1) (dim_col A2) $$ (i, j - dim_col A1) else if j < dim_col A1 then 0\<^sub>m (dim_row A2) (dim_col A1) $$ (i - dim_row A1, j) else A2 $$ (i - dim_row A1, j - dim_col A1)))
[PROOF STEP]
by (simp add: \<open>dim_row A2 = dim_row B2\<close>)
[PROOF STATE]
proof (state)
this:
i + n < dim_row A

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
have "j+m < dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j + m < dim_col A
[PROOF STEP]
unfolding A_def n_def m_def four_block_mat_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j + dim_col A1 < dim_col (Matrix.mat (dim_row A1 + dim_row A2) (dim_col A1 + dim_col A2) (\<lambda>(i, j). if i < dim_row A1 then if j < dim_col A1 then A1 $$ (i, j) else 0\<^sub>m (dim_row A1) (dim_col A2) $$ (i, j - dim_col A1) else if j < dim_col A1 then 0\<^sub>m (dim_row A2) (dim_col A1) $$ (i - dim_row A1, j) else A2 $$ (i - dim_row A1, j - dim_col A1)))
[PROOF STEP]
by (simp add: \<open>dim_col A2 = dim_col B2\<close> ij)
[PROOF STATE]
proof (state)
this:
j + m < dim_col A

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
j + m < dim_col A

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
have "n \<le> i+n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> i + n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n \<le> i + n

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
have "m\<le> j+m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> j + m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m \<le> j + m

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
have "i + n - n = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + n - n = i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i + n - n = i

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
have "j + m - m = j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j + m - m = j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j + m - m = j

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
j + m - m = j

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
note ijeq = this
[PROOF STATE]
proof (state)
this:
j + m - m = j

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
have "A2$$(i,j) = A$$(i+n, j+m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A2 $$ (i, j) = A $$ (i + n, j + m)
[PROOF STEP]
using ijeq
[PROOF STATE]
proof (prove)
using this:
j + m - m = j

goal (1 subgoal):
 1. A2 $$ (i, j) = A $$ (i + n, j + m)
[PROOF STEP]
using A_def \<open>i + n < dim_row A\<close> \<open>j + m < dim_col A\<close> m_def n_def
[PROOF STATE]
proof (prove)
using this:
j + m - m = j
A = four_block_diag A1 A2
i + n < dim_row A
j + m < dim_col A
m = dim_col A1
n = dim_row A1

goal (1 subgoal):
 1. A2 $$ (i, j) = A $$ (i + n, j + m)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
A2 $$ (i, j) = A $$ (i + n, j + m)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A2 $$ (i, j) = A $$ (i + n, j + m)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
have "... = B$$(i+n, j+m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (i + n, j + m) = B $$ (i + n, j + m)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_row A1 = dim_row B1
dim_col A1 = dim_col B1
four_block_diag A1 A2 = four_block_diag B1 B2

goal (1 subgoal):
 1. A $$ (i + n, j + m) = B $$ (i + n, j + m)
[PROOF STEP]
unfolding A_def B_def
[PROOF STATE]
proof (prove)
using this:
dim_row A1 = dim_row B1
dim_col A1 = dim_col B1
four_block_diag A1 A2 = four_block_diag B1 B2

goal (1 subgoal):
 1. four_block_diag A1 A2 $$ (i + n, j + m) = four_block_diag B1 B2 $$ (i + n, j + m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A $$ (i + n, j + m) = B $$ (i + n, j + m)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A $$ (i + n, j + m) = B $$ (i + n, j + m)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
have "... = B2$$(i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B $$ (i + n, j + m) = B2 $$ (i, j)
[PROOF STEP]
using ijeq
[PROOF STATE]
proof (prove)
using this:
j + m - m = j

goal (1 subgoal):
 1. B $$ (i + n, j + m) = B2 $$ (i, j)
[PROOF STEP]
by (metis A_def B_def \<open>i + n < dim_row A\<close> \<open>j + m < dim_col A\<close>
        add_implies_diff assms(1) assms(2) assms(3) index_mat_four_block(1)
        index_mat_four_block(2) index_mat_four_block(3) m_def n_def
        not_add_less2)
[PROOF STATE]
proof (state)
this:
B $$ (i + n, j + m) = B2 $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row B2; j < dim_col B2\<rbrakk> \<Longrightarrow> A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
show "A2$$(i,j) = B2$$(i,j)"
[PROOF STATE]
proof (prove)
using this:
A2 $$ (i, j) = B2 $$ (i, j)

goal (1 subgoal):
 1. A2 $$ (i, j) = B2 $$ (i, j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
A2 $$ (i, j) = B2 $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_list_of_set_bij_betw:
  assumes "finite A"
  shows "bij_betw (\<lambda>n. sorted_list_of_set A ! n) {..<card A} A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((!) (sorted_list_of_set A)) {..<card A} A
[PROOF STEP]
by (rule bij_betw_nth) (fastforce simp add: assms sorted_list_of_set_length)+


[STATEMENT]
lemma inter_iff:
  "a \<in># A \<inter># B \<longleftrightarrow> a \<in># A \<and> a \<in># B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in># A \<inter># B) = (a \<in># A \<and> a \<in># B)
[PROOF STEP]
by simp


[STATEMENT]
lemma admissible_llist_all2 [cont_intro, simp]:
  assumes f: "mcont lub ord lSup (\<sqsubseteq>) (\<lambda>x. f x)"
  and g: "mcont lub ord lSup (\<sqsubseteq>) (\<lambda>x. g x)"
  shows "ccpo.admissible lub ord (\<lambda>x. llist_all2 P (f x) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccpo.admissible lub ord (\<lambda>x. llist_all2 P (f x) (g x))
[PROOF STEP]
proof(rule ccpo.admissibleI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. \<lbrakk>Complete_Partial_Order.chain ord A; A \<noteq> {}; \<forall>x\<in>A. llist_all2 P (f x) (g x)\<rbrakk> \<Longrightarrow> llist_all2 P (f (lub A)) (g (lub A))
[PROOF STEP]
fix Y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. \<lbrakk>Complete_Partial_Order.chain ord A; A \<noteq> {}; \<forall>x\<in>A. llist_all2 P (f x) (g x)\<rbrakk> \<Longrightarrow> llist_all2 P (f (lub A)) (g (lub A))
[PROOF STEP]
assume chain: "Complete_Partial_Order.chain ord Y"
    and Y: "\<forall>x\<in>Y. llist_all2 P (f x) (g x)"
    and "Y \<noteq> {}"
[PROOF STATE]
proof (state)
this:
Complete_Partial_Order.chain ord Y
\<forall>x\<in>Y. llist_all2 P (f x) (g x)
Y \<noteq> {}

goal (1 subgoal):
 1. \<And>A. \<lbrakk>Complete_Partial_Order.chain ord A; A \<noteq> {}; \<forall>x\<in>A. llist_all2 P (f x) (g x)\<rbrakk> \<Longrightarrow> llist_all2 P (f (lub A)) (g (lub A))
[PROOF STEP]
from chain
[PROOF STATE]
proof (chain)
picking this:
Complete_Partial_Order.chain ord Y
[PROOF STEP]
have "Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) ((\<lambda>x. (f x, g x)) ` Y)"
[PROOF STATE]
proof (prove)
using this:
Complete_Partial_Order.chain ord Y

goal (1 subgoal):
 1. Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) ((\<lambda>x. (f x, g x)) ` Y)
[PROOF STEP]
by(rule chain_imageI)(auto intro: mcont_monoD[OF f] mcont_monoD[OF g])
[PROOF STATE]
proof (state)
this:
Complete_Partial_Order.chain (rel_prod (\<sqsubseteq>) (\<sqsubseteq>)) ((\<lambda>x. (f x, g x)) ` Y)

goal (1 subgoal):
 1. \<And>A. \<lbrakk>Complete_Partial_Order.chain ord A; A \<noteq> {}; \<forall>x\<in>A. llist_all2 P (f x) (g x)\<rbrakk> \<Longrightarrow> llist_all2 P (f (lub A)) (g (lub A))
[PROOF STEP]
from llist_all2_lSupI[OF this, of P] chain Y
[PROOF STATE]
proof (chain)
picking this:
\<forall>(xs, ys)\<in>(\<lambda>x. (f x, g x)) ` Y. llist_all2 P xs ys \<Longrightarrow> llist_all2 P (lSup (fst ` (\<lambda>x. (f x, g x)) ` Y)) (lSup (snd ` (\<lambda>x. (f x, g x)) ` Y))
Complete_Partial_Order.chain ord Y
\<forall>x\<in>Y. llist_all2 P (f x) (g x)
[PROOF STEP]
show "llist_all2 P (f (lub Y)) (g (lub Y))"
[PROOF STATE]
proof (prove)
using this:
\<forall>(xs, ys)\<in>(\<lambda>x. (f x, g x)) ` Y. llist_all2 P xs ys \<Longrightarrow> llist_all2 P (lSup (fst ` (\<lambda>x. (f x, g x)) ` Y)) (lSup (snd ` (\<lambda>x. (f x, g x)) ` Y))
Complete_Partial_Order.chain ord Y
\<forall>x\<in>Y. llist_all2 P (f x) (g x)

goal (1 subgoal):
 1. llist_all2 P (f (lub Y)) (g (lub Y))
[PROOF STEP]
using \<open>Y \<noteq> {}\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>(xs, ys)\<in>(\<lambda>x. (f x, g x)) ` Y. llist_all2 P xs ys \<Longrightarrow> llist_all2 P (lSup (fst ` (\<lambda>x. (f x, g x)) ` Y)) (lSup (snd ` (\<lambda>x. (f x, g x)) ` Y))
Complete_Partial_Order.chain ord Y
\<forall>x\<in>Y. llist_all2 P (f x) (g x)
Y \<noteq> {}

goal (1 subgoal):
 1. llist_all2 P (f (lub Y)) (g (lub Y))
[PROOF STEP]
by(simp add: mcont_contD[OF f chain] mcont_contD[OF g chain] image_image)
[PROOF STATE]
proof (state)
this:
llist_all2 P (f (lub Y)) (g (lub Y))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measure_spmf_cong: "measure (measure_spmf p) A = measure (measure_spmf p) B"
  if "A \<inter> set_spmf p = B \<inter> set_spmf p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
have "measure (measure_spmf p) A = measure (measure_spmf p) (A \<inter> set_spmf p) + measure (measure_spmf p) (A - set_spmf p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) (A \<inter> set_spmf p) + Sigma_Algebra.measure (measure_spmf p) (A - set_spmf p)
[PROOF STEP]
by(subst measure_spmf.finite_measure_Union[symmetric])(auto intro: arg_cong2[where f=measure])
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) (A \<inter> set_spmf p) + Sigma_Algebra.measure (measure_spmf p) (A - set_spmf p)

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) (A \<inter> set_spmf p) + Sigma_Algebra.measure (measure_spmf p) (A - set_spmf p)

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
have "measure (measure_spmf p) (A - set_spmf p) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) (A - set_spmf p) = 0
[PROOF STEP]
by(simp add: measure_spmf_zero_iff)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure (measure_spmf p) (A - set_spmf p) = 0

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure (measure_spmf p) (A - set_spmf p) = 0

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
have "0 = measure (measure_spmf p) (B - set_spmf p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = Sigma_Algebra.measure (measure_spmf p) (B - set_spmf p)
[PROOF STEP]
by(simp add: measure_spmf_zero_iff)
[PROOF STATE]
proof (state)
this:
0 = Sigma_Algebra.measure (measure_spmf p) (B - set_spmf p)

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 = Sigma_Algebra.measure (measure_spmf p) (B - set_spmf p)

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
have "measure (measure_spmf p) (A \<inter> set_spmf p) + \<dots> = measure (measure_spmf p) B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) (A \<inter> set_spmf p) + Sigma_Algebra.measure (measure_spmf p) (B - set_spmf p) = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
unfolding that
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) (B \<inter> set_spmf p) + Sigma_Algebra.measure (measure_spmf p) (B - set_spmf p) = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
by(subst measure_spmf.finite_measure_Union[symmetric])(auto intro: arg_cong2[where f=measure])
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure (measure_spmf p) (A \<inter> set_spmf p) + Sigma_Algebra.measure (measure_spmf p) (B - set_spmf p) = Sigma_Algebra.measure (measure_spmf p) B

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B

goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure (measure_spmf p) A = Sigma_Algebra.measure (measure_spmf p) B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem substT_liftT [simp]:
  "k \<le> k' \<Longrightarrow> k' < k + n \<Longrightarrow> (\<up>\<^sub>\<tau> n k T)[k' \<mapsto>\<^sub>\<tau> U]\<^sub>\<tau> = \<up>\<^sub>\<tau> (n - 1) k T"
  "k \<le> k' \<Longrightarrow> k' < k + n \<Longrightarrow> (\<up>\<^sub>r\<^sub>\<tau> n k rT)[k' \<mapsto>\<^sub>\<tau> U]\<^sub>r\<^sub>\<tau> = \<up>\<^sub>r\<^sub>\<tau> (n - 1) k rT"
  "k \<le> k' \<Longrightarrow> k' < k + n \<Longrightarrow> (\<up>\<^sub>f\<^sub>\<tau> n k fT)[k' \<mapsto>\<^sub>\<tau> U]\<^sub>f\<^sub>\<tau> = \<up>\<^sub>f\<^sub>\<tau> (n - 1) k fT"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>k \<le> k'; k' < k + n\<rbrakk> \<Longrightarrow> \<up>\<^sub>\<tau> n k T[k' \<mapsto>\<^sub>\<tau> U]\<^sub>\<tau> = \<up>\<^sub>\<tau> (n - 1) k T) &&& (\<lbrakk>k \<le> k'; k' < k + n\<rbrakk> \<Longrightarrow> \<up>\<^sub>r\<^sub>\<tau> n k rT[k' \<mapsto>\<^sub>\<tau> U]\<^sub>r\<^sub>\<tau> = \<up>\<^sub>r\<^sub>\<tau> (n - 1) k rT) &&& (\<lbrakk>k \<le> k'; k' < k + n\<rbrakk> \<Longrightarrow> \<up>\<^sub>f\<^sub>\<tau> n k fT[k' \<mapsto>\<^sub>\<tau> U]\<^sub>f\<^sub>\<tau> = \<up>\<^sub>f\<^sub>\<tau> (n - 1) k fT)
[PROOF STEP]
by (induct T and rT and fT arbitrary: k k' and k k' and k k'
    rule: liftT.induct liftrT.induct liftfT.induct) simp_all


[STATEMENT]
lemma Fract_eq_zero_iff: "Fract a b = 0 \<longleftrightarrow> a = 0 \<or> b = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Fraction_Field.Fract a b = 0) = (a = (0::'a) \<or> b = (0::'a))
[PROOF STEP]
by (metis (no_types, lifting) Zero_fract_def eq_fract(1) eq_fract(2) mult_eq_0_iff one_neq_zero)


[STATEMENT]
lemma MPair_parts:
     "[| \<lbrace>X,Y\<rbrace> \<in> parts H;
         [| X \<in> parts H; Y \<in> parts H |] ==> P |] ==> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<lbrace>X, Y\<rbrace> \<in> parts H; \<lbrakk>X \<in> parts H; Y \<in> parts H\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by (blast dest: parts.Fst parts.Snd)


[STATEMENT]
lemma upower_inductl: "Q \<sqsubseteq> ((P ;; Q) \<sqinter> R) \<Longrightarrow> Q \<sqsubseteq> P \<^bold>^ n ;; R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q \<sqsubseteq> (P ;; Q) \<sqinter> R \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P n ;; R
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Q \<sqsubseteq> (P ;; Q) \<sqinter> R \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P 0 ;; R
 2. \<And>n. \<lbrakk>Q \<sqsubseteq> (P ;; Q) \<sqinter> R \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P n ;; R; Q \<sqsubseteq> (P ;; Q) \<sqinter> R\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P (Suc n) ;; R
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
Q \<sqsubseteq> (P ;; Q) \<sqinter> R

goal (2 subgoals):
 1. Q \<sqsubseteq> (P ;; Q) \<sqinter> R \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P 0 ;; R
 2. \<And>n. \<lbrakk>Q \<sqsubseteq> (P ;; Q) \<sqinter> R \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P n ;; R; Q \<sqsubseteq> (P ;; Q) \<sqinter> R\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P (Suc n) ;; R
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Q \<sqsubseteq> (P ;; Q) \<sqinter> R
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Q \<sqsubseteq> (P ;; Q) \<sqinter> R

goal (1 subgoal):
 1. Q \<sqsubseteq> power.power II (;;) P 0 ;; R
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
Q \<sqsubseteq> power.power II (;;) P 0 ;; R

goal (1 subgoal):
 1. \<And>n. \<lbrakk>Q \<sqsubseteq> (P ;; Q) \<sqinter> R \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P n ;; R; Q \<sqsubseteq> (P ;; Q) \<sqinter> R\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P (Suc n) ;; R
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Q \<sqsubseteq> (P ;; Q) \<sqinter> R \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P n ;; R; Q \<sqsubseteq> (P ;; Q) \<sqinter> R\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P (Suc n) ;; R
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
Q \<sqsubseteq> (P ;; Q) \<sqinter> R \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P n ;; R
Q \<sqsubseteq> (P ;; Q) \<sqinter> R

goal (1 subgoal):
 1. \<And>n. \<lbrakk>Q \<sqsubseteq> (P ;; Q) \<sqinter> R \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P n ;; R; Q \<sqsubseteq> (P ;; Q) \<sqinter> R\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P (Suc n) ;; R
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Q \<sqsubseteq> (P ;; Q) \<sqinter> R \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P n ;; R
Q \<sqsubseteq> (P ;; Q) \<sqinter> R
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Q \<sqsubseteq> (P ;; Q) \<sqinter> R \<Longrightarrow> Q \<sqsubseteq> power.power II (;;) P n ;; R
Q \<sqsubseteq> (P ;; Q) \<sqinter> R

goal (1 subgoal):
 1. Q \<sqsubseteq> power.power II (;;) P (Suc n) ;; R
[PROOF STEP]
by (auto simp add: upred_semiring.power_Suc, metis (no_types, opaque_lifting) dual_order.trans order_refl seqr_assoc seqr_mono)
[PROOF STATE]
proof (state)
this:
Q \<sqsubseteq> power.power II (;;) P (Suc n) ;; R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fCollect_case_prod [simp]:
  "{|(a, b). P a \<and> Q b|} = fCollect P |\<times>| fCollect Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {|(a, b). P a \<and> Q b|} = fCollect P |\<times>| fCollect Q
[PROOF STEP]
by transfer (auto dest: finite_cartesian_productD1 finite_cartesian_productD2)


[STATEMENT]
lemma disjoint_image: "inj_on f (\<Union>A) \<Longrightarrow> disjoint A \<Longrightarrow> disjoint ((`) f ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f (\<Union> A); disjoint A\<rbrakk> \<Longrightarrow> disjoint ((`) f ` A)
[PROOF STEP]
unfolding inj_on_def disjoint_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>\<Union> A. \<forall>y\<in>\<Union> A. f x = f y \<longrightarrow> x = y; \<forall>a\<in>A. \<forall>b\<in>A. a \<noteq> b \<longrightarrow> a \<inter> b = {}\<rbrakk> \<Longrightarrow> \<forall>a\<in>(`) f ` A. \<forall>b\<in>(`) f ` A. a \<noteq> b \<longrightarrow> a \<inter> b = {}
[PROOF STEP]
by blast


[STATEMENT]
lemma pell_power_Suc: "pell_power z (Suc n) = pell_mul z (pell_power z n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pell_power z (Suc n) = pell_mul z (pell_power z n)
[PROOF STEP]
by (simp add: pell_power_def pell_mul_commutes)


[STATEMENT]
lemma closed_map_paired_continuous_map_right:
   "\<lbrakk>continuous_map X Y f; Hausdorff_space Y\<rbrakk> \<Longrightarrow> closed_map X (prod_topology X Y) (\<lambda>x. (x,f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_map X Y f; Hausdorff_space Y\<rbrakk> \<Longrightarrow> closed_map X (prod_topology X Y) (\<lambda>x. (x, f x))
[PROOF STEP]
by (simp add: continuous_map_imp_closed_graph embedding_map_graph embedding_imp_closed_map)


[STATEMENT]
lemma ndFalse2: "(\<forall>a b c d. (a,b)\<in>A  \<and> (c,d)\<in>B \<longrightarrow> netsDistinct b d) \<Longrightarrow>
                 \<exists>(a, b)\<in>A. b \<in> subnetsOfAdr D \<Longrightarrow>
                 \<exists>(a, b)\<in>B. b \<in> subnetsOfAdr D \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a b c d. (a, b) \<in> A \<and> (c, d) \<in> B \<longrightarrow> netsDistinct b d; \<exists>(a, b)\<in>A. b \<in> subnetsOfAdr D; \<exists>(a, b)\<in>B. b \<in> subnetsOfAdr D\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (auto simp: soadisj)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>\<forall>a b c d. (a, b) \<in> A \<and> (c, d) \<in> B \<longrightarrow> netsDistinct b d; (a, b) \<in> A; b \<in> subnetsOfAdr D; (aa, ba) \<in> B; ba \<in> subnetsOfAdr D\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using soadisj2
[PROOF STATE]
proof (prove)
using this:
\<forall>a x y. x \<in> subnetsOfAdr a \<and> y \<in> subnetsOfAdr a \<longrightarrow> \<not> netsDistinct x y

goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>\<forall>a b c d. (a, b) \<in> A \<and> (c, d) \<in> B \<longrightarrow> netsDistinct b d; (a, b) \<in> A; b \<in> subnetsOfAdr D; (aa, ba) \<in> B; ba \<in> subnetsOfAdr D\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by blast


[STATEMENT]
lemma foo2: "a \<notin> set ps \<Longrightarrow>
             a \<notin> set ss \<Longrightarrow>
             set p = set s \<Longrightarrow>
             p = (a#(ps)) \<Longrightarrow>
             s = (a#ss) \<Longrightarrow>
             set (ps) = set (ss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<notin> set ps; a \<notin> set ss; set p = set s; p = a # ps; s = a # ss\<rbrakk> \<Longrightarrow> set ps = set ss
[PROOF STEP]
by auto


[STATEMENT]
lemma append_simpl2: "i \<ge>(length xs) \<longrightarrow> (xs@ys)!i = (ys!(i- (length xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs \<le> i \<longrightarrow> (xs @ ys) ! i = ys ! (i - length xs)
[PROOF STEP]
using nth_append less_asym  leD
[PROOF STATE]
proof (prove)
using this:
(?xs @ ?ys) ! ?n = (if ?n < length ?xs then ?xs ! ?n else ?ys ! (?n - length ?xs))
\<lbrakk>?x < ?y; \<not> ?P \<Longrightarrow> ?y < ?x\<rbrakk> \<Longrightarrow> ?P
?y \<le> ?x \<Longrightarrow> \<not> ?x < ?y

goal (1 subgoal):
 1. length xs \<le> i \<longrightarrow> (xs @ ys) ! i = ys ! (i - length xs)
[PROOF STEP]
by metis


[STATEMENT]
lemma isLbD: "isLb R S x \<Longrightarrow> y \<in> S \<Longrightarrow> y \<ge> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>isLb R S x; y \<in> S\<rbrakk> \<Longrightarrow> x \<le> y
[PROOF STEP]
by (simp add: isLb_def setge_def)


[STATEMENT]
lemma calc_ideal_points_different:
  assumes "is_poincare_line H"
  shows  "\<exists> i1 \<in> (calc_ideal_points H). \<exists> i2 \<in> (calc_ideal_points H). i1 \<noteq> i2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i1\<in>calc_ideal_points H. \<exists>i2\<in>calc_ideal_points H. i1 \<noteq> i2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H

goal (1 subgoal):
 1. \<exists>i1\<in>calc_ideal_points H. \<exists>i2\<in>calc_ideal_points H. i1 \<noteq> i2
[PROOF STEP]
proof (transfer, transfer)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; is_poincare_line_cmat H; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> \<exists>i1\<in>calc_ideal_points_cmat_cvec H. \<exists>i2\<in>calc_ideal_points_cmat_cvec H. \<not> i1 \<approx>\<^sub>v i2
[PROOF STEP]
fix H
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; is_poincare_line_cmat H; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> \<exists>i1\<in>calc_ideal_points_cmat_cvec H. \<exists>i2\<in>calc_ideal_points_cmat_cvec H. \<not> i1 \<approx>\<^sub>v i2
[PROOF STEP]
assume hh: "hermitean H \<and> H \<noteq> mat_zero" "is_poincare_line_cmat H"
[PROOF STATE]
proof (state)
this:
hermitean H \<and> H \<noteq> mat_zero
is_poincare_line_cmat H

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; is_poincare_line_cmat H; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> \<exists>i1\<in>calc_ideal_points_cmat_cvec H. \<exists>i2\<in>calc_ideal_points_cmat_cvec H. \<not> i1 \<approx>\<^sub>v i2
[PROOF STEP]
obtain A B C D where *: "H = (A, B, C, D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A B C D. H = (A, B, C, D) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases H, auto)
[PROOF STATE]
proof (state)
this:
H = (A, B, C, D)

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; is_poincare_line_cmat H; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> \<exists>i1\<in>calc_ideal_points_cmat_cvec H. \<exists>i2\<in>calc_ideal_points_cmat_cvec H. \<not> i1 \<approx>\<^sub>v i2
[PROOF STEP]
hence "is_real A"
[PROOF STATE]
proof (prove)
using this:
H = (A, B, C, D)

goal (1 subgoal):
 1. is_real A
[PROOF STEP]
using hh hermitean_elems
[PROOF STATE]
proof (prove)
using this:
H = (A, B, C, D)
hermitean H \<and> H \<noteq> mat_zero
is_poincare_line_cmat H
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> is_real ?A
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> is_real ?D
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> ?B = cnj ?C
hermitean (?A, ?B, ?C, ?D) \<Longrightarrow> cnj ?B = ?C

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

goal (1 subgoal):
 1. \<And>H Ha. \<lbrakk>hermitean H \<and> H \<noteq> mat_zero; is_poincare_line_cmat H; is_poincare_line_clmat Ha\<rbrakk> \<Longrightarrow> \<exists>i1\<in>calc_ideal_points_cmat_cvec H. \<exists>i2\<in>calc_ideal_points_cmat_cvec H. \<not> i1 \<approx>\<^sub>v i2
[PROOF STEP]
thus "\<exists>i1\<in>calc_ideal_points_cmat_cvec H. \<exists>i2\<in>calc_ideal_points_cmat_cvec H. \<not> i1 \<approx>\<^sub>v i2"
[PROOF STATE]
proof (prove)
using this:
is_real A

goal (1 subgoal):
 1. \<exists>i1\<in>calc_ideal_points_cmat_cvec H. \<exists>i2\<in>calc_ideal_points_cmat_cvec H. \<not> i1 \<approx>\<^sub>v i2
[PROOF STEP]
using * hh calc_ideal_points_cvec_different[of A B]
[PROOF STATE]
proof (prove)
using this:
is_real A
H = (A, B, C, D)
hermitean H \<and> H \<noteq> mat_zero
is_poincare_line_cmat H
\<lbrakk>(cmod A)\<^sup>2 < (cmod B)\<^sup>2; is_real A\<rbrakk> \<Longrightarrow> \<not> calc_ideal_point1_cvec A B \<approx>\<^sub>v calc_ideal_point2_cvec A B

goal (1 subgoal):
 1. \<exists>i1\<in>calc_ideal_points_cmat_cvec H. \<exists>i2\<in>calc_ideal_points_cmat_cvec H. \<not> i1 \<approx>\<^sub>v i2
[PROOF STEP]
apply (rule_tac x="calc_ideal_point1_cvec A B" in bexI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>is_real A; H = (A, B, C, D); hermitean H \<and> H \<noteq> mat_zero; is_poincare_line_cmat H; \<lbrakk>(cmod A)\<^sup>2 < (cmod B)\<^sup>2; is_real A\<rbrakk> \<Longrightarrow> \<not> calc_ideal_point1_cvec A B \<approx>\<^sub>v calc_ideal_point2_cvec A B\<rbrakk> \<Longrightarrow> \<exists>i2\<in>calc_ideal_points_cmat_cvec H. \<not> calc_ideal_point1_cvec A B \<approx>\<^sub>v i2
 2. \<lbrakk>is_real A; H = (A, B, C, D); hermitean H \<and> H \<noteq> mat_zero; is_poincare_line_cmat H; \<lbrakk>(cmod A)\<^sup>2 < (cmod B)\<^sup>2; is_real A\<rbrakk> \<Longrightarrow> \<not> calc_ideal_point1_cvec A B \<approx>\<^sub>v calc_ideal_point2_cvec A B\<rbrakk> \<Longrightarrow> calc_ideal_point1_cvec A B \<in> calc_ideal_points_cmat_cvec H
[PROOF STEP]
apply (rule_tac x="calc_ideal_point2_cvec A B" in bexI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>is_real A; H = (A, B, C, D); hermitean H \<and> H \<noteq> mat_zero; is_poincare_line_cmat H; \<lbrakk>(cmod A)\<^sup>2 < (cmod B)\<^sup>2; is_real A\<rbrakk> \<Longrightarrow> \<not> calc_ideal_point1_cvec A B \<approx>\<^sub>v calc_ideal_point2_cvec A B\<rbrakk> \<Longrightarrow> \<not> calc_ideal_point1_cvec A B \<approx>\<^sub>v calc_ideal_point2_cvec A B
 2. \<lbrakk>is_real A; H = (A, B, C, D); hermitean H \<and> H \<noteq> mat_zero; is_poincare_line_cmat H; \<lbrakk>(cmod A)\<^sup>2 < (cmod B)\<^sup>2; is_real A\<rbrakk> \<Longrightarrow> \<not> calc_ideal_point1_cvec A B \<approx>\<^sub>v calc_ideal_point2_cvec A B\<rbrakk> \<Longrightarrow> calc_ideal_point2_cvec A B \<in> calc_ideal_points_cmat_cvec H
 3. \<lbrakk>is_real A; H = (A, B, C, D); hermitean H \<and> H \<noteq> mat_zero; is_poincare_line_cmat H; \<lbrakk>(cmod A)\<^sup>2 < (cmod B)\<^sup>2; is_real A\<rbrakk> \<Longrightarrow> \<not> calc_ideal_point1_cvec A B \<approx>\<^sub>v calc_ideal_point2_cvec A B\<rbrakk> \<Longrightarrow> calc_ideal_point1_cvec A B \<in> calc_ideal_points_cmat_cvec H
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>i1\<in>calc_ideal_points_cmat_cvec H. \<exists>i2\<in>calc_ideal_points_cmat_cvec H. \<not> i1 \<approx>\<^sub>v i2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma HOMCollection_Op: "HOMCollection (Op C) X Y = HOMCollection C Y X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HOMCollection (Op C) X Y = HOMCollection C Y X
[PROOF STEP]
by (simp add: HOMCollection_def mapsTo_Op mor2ZF_Op)


[STATEMENT]
theorem sup_loc_length:
  "G \<turnstile> a <=l b \<Longrightarrow> length a = length b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G \<turnstile> a <=l b \<Longrightarrow> length a = length b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. G \<turnstile> a <=l b \<Longrightarrow> length a = length b
[PROOF STEP]
assume G: "G \<turnstile> a <=l b"
[PROOF STATE]
proof (state)
this:
G \<turnstile> a <=l b

goal (1 subgoal):
 1. G \<turnstile> a <=l b \<Longrightarrow> length a = length b
[PROOF STEP]
have "\<forall>b. (G \<turnstile> a <=l b) \<longrightarrow> length a = length b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b. G \<turnstile> a <=l b \<longrightarrow> length a = length b
[PROOF STEP]
by (induct a, auto)
[PROOF STATE]
proof (state)
this:
\<forall>b. G \<turnstile> a <=l b \<longrightarrow> length a = length b

goal (1 subgoal):
 1. G \<turnstile> a <=l b \<Longrightarrow> length a = length b
[PROOF STEP]
with G
[PROOF STATE]
proof (chain)
picking this:
G \<turnstile> a <=l b
\<forall>b. G \<turnstile> a <=l b \<longrightarrow> length a = length b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
G \<turnstile> a <=l b
\<forall>b. G \<turnstile> a <=l b \<longrightarrow> length a = length b

goal (1 subgoal):
 1. length a = length b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
length a = length b

goal:
No subgoals!
[PROOF STEP]
qed