[STATEMENT]
lemma sandwich_tensor:
  fixes a :: \<open>'a::finite ell2 \<Rightarrow>\<^sub>C\<^sub>L 'a ell2\<close> and b :: \<open>'b::finite ell2 \<Rightarrow>\<^sub>C\<^sub>L 'b ell2\<close>
  assumes \<open>unitary a\<close> \<open>unitary b\<close>
  shows "sandwich (a \<otimes>\<^sub>o b) = sandwich a \<otimes>\<^sub>r sandwich b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Misc.sandwich (a \<otimes>\<^sub>o b) = Misc.sandwich a \<otimes>\<^sub>r Misc.sandwich b
[PROOF STEP]
apply (rule tensor_extensionality)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. clinear (Misc.sandwich (a \<otimes>\<^sub>o b))
 2. clinear (Misc.sandwich a \<otimes>\<^sub>r Misc.sandwich b)
 3. \<And>aa ba. Misc.sandwich (a \<otimes>\<^sub>o b) (aa \<otimes>\<^sub>o ba) = (Misc.sandwich a \<otimes>\<^sub>r Misc.sandwich b) (aa \<otimes>\<^sub>o ba)
[PROOF STEP]
by (auto simp: unitary_sandwich_register assms sandwich_def register_tensor_is_register comp_tensor_op tensor_op_adjoint)


[STATEMENT]
lemma d_0: "d 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d 0 = (1::'a)
[PROOF STEP]
by (rule Gramian_determinant_0)


[STATEMENT]
theorem notin_List_update[simp]:
 "\<And>x. a \<notin> set as \<Longrightarrow> List (h(a := y)) x as = List h x as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. a \<notin> set as \<Longrightarrow> List (h(a := y)) x as = List h x as
[PROOF STEP]
apply(induct as)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. a \<notin> set [] \<Longrightarrow> List (h(a := y)) x [] = List h x []
 2. \<And>aa as x. \<lbrakk>\<And>x. a \<notin> set as \<Longrightarrow> List (h(a := y)) x as = List h x as; a \<notin> set (aa # as)\<rbrakk> \<Longrightarrow> List (h(a := y)) x (aa # as) = List h x (aa # as)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa as x. \<lbrakk>\<And>x. a \<notin> set as \<Longrightarrow> List (h(a := y)) x as = List h x as; a \<notin> set (aa # as)\<rbrakk> \<Longrightarrow> List (h(a := y)) x (aa # as) = List h x (aa # as)
[PROOF STEP]
apply(clarsimp simp add:fun_upd_apply)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in is_functor) op_cf_obj_comma_is_functor'[cat_comma_cs_intros]:
  assumes "b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>"
    and "\<AA>' = op_cat (\<FF> \<^sub>C\<^sub>F\<down> b)"
    and "\<BB>' = b \<down>\<^sub>C\<^sub>F (op_cf \<FF>)"
  shows "op_cf_obj_comma \<FF> b : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_cf_obj_comma \<FF> b : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. op_cf_obj_comma \<FF> b : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'
[PROOF STEP]
unfolding assms(2,3)
[PROOF STATE]
proof (prove)
using this:
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. op_cf_obj_comma \<FF> b : op_cat (\<FF> \<^sub>C\<^sub>F\<down> b) \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> b \<down>\<^sub>C\<^sub>F (op_cf \<FF>)
[PROOF STEP]
by (rule op_cf_obj_comma_is_functor)


[STATEMENT]
lemma bset_eq_iff: "A = B \<longleftrightarrow> (\<forall>a. bmember a A = bmember a B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A = B) = (\<forall>a. bmember a A = bmember a B)
[PROOF STEP]
by transfer auto


[STATEMENT]
lemma is_least_r_d_k_path_length_from_r_d :
  assumes "\<exists> k . r_distinguishable_k M q1 q2 k"
  shows "\<exists> t p . is_least_r_d_k_path M q1 q2 (t#p) \<and> length (t#p) = Suc (LEAST k . r_distinguishable_k M q1 q2 k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (LEAST k. r_distinguishable_k M q1 q2 k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (LEAST k. r_distinguishable_k M q1 q2 k)
[PROOF STEP]
let ?k = "LEAST k . r_distinguishable_k M q1 q2 k"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (LEAST k. r_distinguishable_k M q1 q2 k)
[PROOF STEP]
have "r_distinguishable_k M q1 q2 ?k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r_distinguishable_k M q1 q2 (LEAST k. r_distinguishable_k M q1 q2 k)
[PROOF STEP]
using assms LeastI
[PROOF STATE]
proof (prove)
using this:
\<exists>k. r_distinguishable_k M q1 q2 k
?P ?k \<Longrightarrow> ?P (LEAST x. ?P x)

goal (1 subgoal):
 1. r_distinguishable_k M q1 q2 (LEAST k. r_distinguishable_k M q1 q2 k)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
r_distinguishable_k M q1 q2 (LEAST k. r_distinguishable_k M q1 q2 k)

goal (1 subgoal):
 1. \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (LEAST k. r_distinguishable_k M q1 q2 k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r_distinguishable_k M q1 q2 (LEAST k. r_distinguishable_k M q1 q2 k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r_distinguishable_k M q1 q2 (LEAST k. r_distinguishable_k M q1 q2 k)

goal (1 subgoal):
 1. \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (LEAST k. r_distinguishable_k M q1 q2 k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
r_distinguishable_k M q1 q2 (LEAST k. r_distinguishable_k M q1 q2 k)
\<exists>k. r_distinguishable_k M q1 q2 k

goal (1 subgoal):
 1. \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (LEAST k. r_distinguishable_k M q1 q2 k)
[PROOF STEP]
proof (induction ?k arbitrary: q1 q2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>q1 q2. \<lbrakk>0 = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
 2. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = (LEAST a. r_distinguishable_k M q1 q2 a)
r_distinguishable_k M q1 q2 (LEAST a. r_distinguishable_k M q1 q2 a)
\<exists>a. r_distinguishable_k M q1 q2 a

goal (2 subgoals):
 1. \<And>q1 q2. \<lbrakk>0 = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
 2. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 = (LEAST a. r_distinguishable_k M q1 q2 a)
r_distinguishable_k M q1 q2 (LEAST a. r_distinguishable_k M q1 q2 a)
\<exists>a. r_distinguishable_k M q1 q2 a
[PROOF STEP]
have "r_distinguishable_k M q1 q2 0"
[PROOF STATE]
proof (prove)
using this:
0 = (LEAST a. r_distinguishable_k M q1 q2 a)
r_distinguishable_k M q1 q2 (LEAST a. r_distinguishable_k M q1 q2 a)
\<exists>a. r_distinguishable_k M q1 q2 a

goal (1 subgoal):
 1. r_distinguishable_k M q1 q2 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
r_distinguishable_k M q1 q2 0

goal (2 subgoals):
 1. \<And>q1 q2. \<lbrakk>0 = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
 2. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r_distinguishable_k M q1 q2 0
[PROOF STEP]
obtain x where "x \<in> (inputs M)" and "\<not> (\<exists> t1 \<in> transitions M . \<exists> t2 \<in> transitions M . t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2)"
[PROOF STATE]
proof (prove)
using this:
r_distinguishable_k M q1 q2 0

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> FSM.inputs M; \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding r_distinguishable_k.simps
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>FSM.inputs M. \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2)

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> FSM.inputs M; \<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> FSM.inputs M
\<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2)

goal (2 subgoals):
 1. \<And>q1 q2. \<lbrakk>0 = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
 2. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> FSM.inputs M
\<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2)
[PROOF STEP]
have "is_least_r_d_k_path M q1 q2 [((q1,q2),x,0)]"
[PROOF STATE]
proof (prove)
using this:
x \<in> FSM.inputs M
\<not> (\<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2)

goal (1 subgoal):
 1. is_least_r_d_k_path M q1 q2 [((q1, q2), x, 0)]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_least_r_d_k_path M q1 q2 [((q1, q2), x, 0)]

goal (2 subgoals):
 1. \<And>q1 q2. \<lbrakk>0 = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
 2. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_least_r_d_k_path M q1 q2 [((q1, q2), x, 0)]
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
is_least_r_d_k_path M q1 q2 [((q1, q2), x, 0)]

goal (1 subgoal):
 1. \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (LEAST a. r_distinguishable_k M q1 q2 a)
[PROOF STEP]
using "0.hyps"
[PROOF STATE]
proof (prove)
using this:
is_least_r_d_k_path M q1 q2 [((q1, q2), x, 0)]
0 = (LEAST a. r_distinguishable_k M q1 q2 a)

goal (1 subgoal):
 1. \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (LEAST a. r_distinguishable_k M q1 q2 a)
[PROOF STEP]
by (metis length_Cons list.size(3))
[PROOF STATE]
proof (state)
this:
\<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (LEAST a. r_distinguishable_k M q1 q2 a)

goal (1 subgoal):
 1. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
\<lbrakk>k = Least (r_distinguishable_k M ?q1.0 ?q2.0); r_distinguishable_k M ?q1.0 ?q2.0 (Least (r_distinguishable_k M ?q1.0 ?q2.0)); Ex (r_distinguishable_k M ?q1.0 ?q2.0)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M ?q1.0 ?q2.0 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M ?q1.0 ?q2.0))
Suc k = Least (r_distinguishable_k M q1 q2)
r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2))
Ex (r_distinguishable_k M q1 q2)

goal (1 subgoal):
 1. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>k = Least (r_distinguishable_k M ?q1.0 ?q2.0); r_distinguishable_k M ?q1.0 ?q2.0 (Least (r_distinguishable_k M ?q1.0 ?q2.0)); Ex (r_distinguishable_k M ?q1.0 ?q2.0)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M ?q1.0 ?q2.0 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M ?q1.0 ?q2.0))
Suc k = Least (r_distinguishable_k M q1 q2)
r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2))
Ex (r_distinguishable_k M q1 q2)
[PROOF STEP]
have "r_distinguishable_k M q1 q2 (Suc k)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k = Least (r_distinguishable_k M ?q1.0 ?q2.0); r_distinguishable_k M ?q1.0 ?q2.0 (Least (r_distinguishable_k M ?q1.0 ?q2.0)); Ex (r_distinguishable_k M ?q1.0 ?q2.0)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M ?q1.0 ?q2.0 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M ?q1.0 ?q2.0))
Suc k = Least (r_distinguishable_k M q1 q2)
r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2))
Ex (r_distinguishable_k M q1 q2)

goal (1 subgoal):
 1. r_distinguishable_k M q1 q2 (Suc k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
r_distinguishable_k M q1 q2 (Suc k)

goal (1 subgoal):
 1. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
r_distinguishable_k M q1 q2 (Suc k)

goal (1 subgoal):
 1. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
have "\<not> r_distinguishable_k M q1 q2 k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> r_distinguishable_k M q1 q2 k
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k = Least (r_distinguishable_k M ?q1.0 ?q2.0); r_distinguishable_k M ?q1.0 ?q2.0 (Least (r_distinguishable_k M ?q1.0 ?q2.0)); Ex (r_distinguishable_k M ?q1.0 ?q2.0)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M ?q1.0 ?q2.0 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M ?q1.0 ?q2.0))
Suc k = Least (r_distinguishable_k M q1 q2)
r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2))
Ex (r_distinguishable_k M q1 q2)

goal (1 subgoal):
 1. \<not> r_distinguishable_k M q1 q2 k
[PROOF STEP]
by (metis lessI not_less_Least)
[PROOF STATE]
proof (state)
this:
\<not> r_distinguishable_k M q1 q2 k

goal (1 subgoal):
 1. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
r_distinguishable_k M q1 q2 (Suc k)
\<not> r_distinguishable_k M q1 q2 k
[PROOF STEP]
obtain x where "x \<in> (inputs M)" and *: "(\<forall>t1\<in>(transitions M).
           \<forall>t2\<in>(transitions M).
              t_source t1 = q1 \<and>
              t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow>
              r_distinguishable_k M (t_target t1) (t_target t2) k)"
[PROOF STATE]
proof (prove)
using this:
r_distinguishable_k M q1 q2 (Suc k)
\<not> r_distinguishable_k M q1 q2 k

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> FSM.inputs M; \<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding r_distinguishable_k.simps
[PROOF STATE]
proof (prove)
using this:
r_distinguishable_k M q1 q2 k \<or> (\<exists>x\<in>FSM.inputs M. \<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) k)
\<not> r_distinguishable_k M q1 q2 k

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> FSM.inputs M; \<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> FSM.inputs M
\<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) k

goal (1 subgoal):
 1. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
obtain t1 t2 where "t1 \<in> transitions M" and "t2 \<in> transitions M"
                        and "t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2"
                        and "k = (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2; k = (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using r_distinguishable_k_least_next[OF Suc.prems(2) _ \<open>x \<in> (inputs M)\<close> *] Suc.hyps(2)
[PROOF STATE]
proof (prove)
using this:
(LEAST k. r_distinguishable_k M q1 q2 k) = Suc k \<Longrightarrow> \<exists>t1\<in>FSM.transitions M. \<exists>t2\<in>FSM.transitions M. (t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2) \<and> (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k) = k
Suc k = Least (r_distinguishable_k M q1 q2)

goal (1 subgoal):
 1. (\<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M; t2 \<in> FSM.transitions M; t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2; k = (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
t1 \<in> FSM.transitions M
t2 \<in> FSM.transitions M
t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2
k = (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)

goal (1 subgoal):
 1. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t1 \<in> FSM.transitions M
t2 \<in> FSM.transitions M
t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2
k = (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)
[PROOF STEP]
have "r_distinguishable_k M (t_target t1) (t_target t2) (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)"
[PROOF STATE]
proof (prove)
using this:
t1 \<in> FSM.transitions M
t2 \<in> FSM.transitions M
t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2
k = (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)

goal (1 subgoal):
 1. r_distinguishable_k M (t_target t1) (t_target t2) (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
t1 \<in> FSM.transitions M
t2 \<in> FSM.transitions M
t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2
k = (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)
\<forall>t1\<in>FSM.transitions M. \<forall>t2\<in>FSM.transitions M. t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2 \<longrightarrow> r_distinguishable_k M (t_target t1) (t_target t2) k

goal (1 subgoal):
 1. r_distinguishable_k M (t_target t1) (t_target t2) (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
r_distinguishable_k M (t_target t1) (t_target t2) (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)

goal (1 subgoal):
 1. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r_distinguishable_k M (t_target t1) (t_target t2) (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)
[PROOF STEP]
obtain t' p' where "is_least_r_d_k_path M (t_target t1) (t_target t2) (t' # p')"
                        and "length (t' # p') = Suc (Least (r_distinguishable_k M (t_target t1) (t_target t2)))"
[PROOF STATE]
proof (prove)
using this:
r_distinguishable_k M (t_target t1) (t_target t2) (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)

goal (1 subgoal):
 1. (\<And>t' p'. \<lbrakk>is_least_r_d_k_path M (t_target t1) (t_target t2) (t' # p'); length (t' # p') = Suc (Least (r_distinguishable_k M (t_target t1) (t_target t2)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Suc.hyps(1)[OF \<open>k = (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)\<close>]
[PROOF STATE]
proof (prove)
using this:
r_distinguishable_k M (t_target t1) (t_target t2) (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)
\<lbrakk>r_distinguishable_k M (t_target t1) (t_target t2) (Least (r_distinguishable_k M (t_target t1) (t_target t2))); Ex (r_distinguishable_k M (t_target t1) (t_target t2))\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M (t_target t1) (t_target t2) (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M (t_target t1) (t_target t2)))

goal (1 subgoal):
 1. (\<And>t' p'. \<lbrakk>is_least_r_d_k_path M (t_target t1) (t_target t2) (t' # p'); length (t' # p') = Suc (Least (r_distinguishable_k M (t_target t1) (t_target t2)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_least_r_d_k_path M (t_target t1) (t_target t2) (t' # p')
length (t' # p') = Suc (Least (r_distinguishable_k M (t_target t1) (t_target t2)))

goal (1 subgoal):
 1. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_least_r_d_k_path M (t_target t1) (t_target t2) (t' # p')
length (t' # p') = Suc (Least (r_distinguishable_k M (t_target t1) (t_target t2)))
[PROOF STEP]
have "is_least_r_d_k_path M q1 q2 (((q1,q2),x,Suc k)#t'#p')"
[PROOF STATE]
proof (prove)
using this:
is_least_r_d_k_path M (t_target t1) (t_target t2) (t' # p')
length (t' # p') = Suc (Least (r_distinguishable_k M (t_target t1) (t_target t2)))

goal (1 subgoal):
 1. is_least_r_d_k_path M q1 q2 (((q1, q2), x, Suc k) # t' # p')
[PROOF STEP]
using is_least_r_d_k_path.step[OF Suc.hyps(2) \<open>x \<in> (inputs M)\<close> * \<open>t1 \<in> transitions M\<close> \<open>t2 \<in> transitions M\<close> \<open>t_source t1 = q1 \<and> t_source t2 = q2 \<and> t_input t1 = x \<and> t_input t2 = x \<and> t_output t1 = t_output t2\<close>]
[PROOF STATE]
proof (prove)
using this:
is_least_r_d_k_path M (t_target t1) (t_target t2) (t' # p')
length (t' # p') = Suc (Least (r_distinguishable_k M (t_target t1) (t_target t2)))
is_least_r_d_k_path M (t_target t1) (t_target t2) ?p \<Longrightarrow> is_least_r_d_k_path M q1 q2 (((q1, q2), x, Suc k) # ?p)

goal (1 subgoal):
 1. is_least_r_d_k_path M q1 q2 (((q1, q2), x, Suc k) # t' # p')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_least_r_d_k_path M q1 q2 (((q1, q2), x, Suc k) # t' # p')

goal (1 subgoal):
 1. \<And>x q1 q2. \<lbrakk>\<And>q1 q2. \<lbrakk>x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2)); Suc x = Least (r_distinguishable_k M q1 q2); r_distinguishable_k M q1 q2 (Least (r_distinguishable_k M q1 q2)); Ex (r_distinguishable_k M q1 q2)\<rbrakk> \<Longrightarrow> \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))
[PROOF STEP]
by (metis (no_types) Suc.hyps(2) \<open>is_least_r_d_k_path M q1 q2 (((q1, q2), x, Suc k) # t' # p')\<close> \<open>k = (LEAST k. r_distinguishable_k M (t_target t1) (t_target t2) k)\<close> \<open>length (t' # p') = Suc (Least (r_distinguishable_k M (t_target t1) (t_target t2)))\<close> length_Cons)
[PROOF STATE]
proof (state)
this:
\<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (Least (r_distinguishable_k M q1 q2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>t p. is_least_r_d_k_path M q1 q2 (t # p) \<and> length (t # p) = Suc (LEAST k. r_distinguishable_k M q1 q2 k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sumhr_fun_hypnat_eq:
  "(\<forall>r. m \<le> r \<and> r < n \<longrightarrow> f r = g r) \<longrightarrow>
    sumhr (hypnat_of_nat m, hypnat_of_nat n, f) =
    sumhr (hypnat_of_nat m, hypnat_of_nat n, g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>r. m \<le> r \<and> r < n \<longrightarrow> f r = g r) \<longrightarrow> sumhr (hypnat_of_nat m, hypnat_of_nat n, f) = sumhr (hypnat_of_nat m, hypnat_of_nat n, g)
[PROOF STEP]
unfolding sumhr_app
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>r. m \<le> r \<and> r < n \<longrightarrow> f r = g r) \<longrightarrow> (*f2* (\<lambda>m n. sum f {m..<n})) (hypnat_of_nat m) (hypnat_of_nat n) = (*f2* (\<lambda>m n. sum g {m..<n})) (hypnat_of_nat m) (hypnat_of_nat n)
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma (in topology) closure_frontier [simp]:
  "closure (frontier a) = frontier a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (frontier a) = frontier a
[PROOF STEP]
by simp


[STATEMENT]
theorem kingman_theorem_AE_ereal:
  assumes "subcocycle u"
  shows "AE x in M. (\<lambda>n. u n x / n) \<longlonglongrightarrow> subcocycle_avg_ereal u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. (\<lambda>xa. ereal (u xa x / real xa)) \<longlonglongrightarrow> subcocycle_avg_ereal u
[PROOF STEP]
using kingman_theorem_AE_nonergodic_ereal[OF assms] subcocycle_ergodic_lim_avg(1)[OF assms]
[PROOF STATE]
proof (prove)
using this:
AE x in M. (\<lambda>xa. ereal (u xa x / real xa)) \<longlonglongrightarrow> subcocycle_lim_ereal u x
AE x in M. subcocycle_lim_ereal u x = subcocycle_avg_ereal u

goal (1 subgoal):
 1. AE x in M. (\<lambda>xa. ereal (u xa x / real xa)) \<longlonglongrightarrow> subcocycle_avg_ereal u
[PROOF STEP]
by auto


[STATEMENT]
lemma "(255::int) * 255 = 65025"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 255 * 255 = 65025
[PROOF STEP]
by simp


[STATEMENT]
lemma poly2_monom: "poly2 (monom a n) x y = poly a x * y ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly2 (monom a n) x y = poly a x * y ^ n
[PROOF STEP]
by (auto simp: poly_monom poly2_def)


[STATEMENT]
theorem final_correctness:
  "to_omega ` language (drae_dra (draei_drae (ltlc_to_draei \<phi>)))
    = language_ltlc \<phi> \<inter> {w. range w \<subseteq> Pow (atoms_ltlc \<phi>)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_omega ` DRA.language (drae_dra (draei_drae (ltlc_to_draei \<phi>))) = language_ltlc \<phi> \<inter> {w. range w \<subseteq> Pow (atoms_ltlc \<phi>)}
[PROOF STEP]
unfolding ltlc_to_draei_def ltln_to_draei_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_omega ` DRA.language (drae_dra (draei_drae (drai_to_draei (Suc (size (simplify Slow (ltlc_to_ltln \<phi>)))) (dra_to_drai (ltl_to_dra_alphabet (simplify Slow (ltlc_to_ltln \<phi>)) (set (atoms_ltlc_list \<phi>))) (ltl_alphabet (atoms_ltlc_list \<phi>)))))) = language_ltlc \<phi> \<inter> {w. range w \<subseteq> Pow (atoms_ltlc \<phi>)}
[PROOF STEP]
unfolding draei_language_rel[OF ltl_to_dra_alphabet_rel[OF atoms_ltlc_list_distinct] ltl_to_dra_alphabet_nodes_finite valid_def_hm_size]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_omega ` DRA.language (ltl_to_dra_alphabet (simplify Slow (ltlc_to_ltln \<phi>)) (set (atoms_ltlc_list \<phi>))) = language_ltlc \<phi> \<inter> {w. range w \<subseteq> Pow (atoms_ltlc \<phi>)}
[PROOF STEP]
unfolding atoms_ltlc_list_set
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_omega ` DRA.language (ltl_to_dra_alphabet (simplify Slow (ltlc_to_ltln \<phi>)) (atoms_ltlc \<phi>)) = language_ltlc \<phi> \<inter> {w. range w \<subseteq> Pow (atoms_ltlc \<phi>)}
[PROOF STEP]
unfolding ltl_to_dra_alphabet_language[OF ltlc_to_ltln_simplify_atoms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. language_ltln (simplify Slow (ltlc_to_ltln \<phi>)) \<inter> {w. range w \<subseteq> Pow (atoms_ltlc \<phi>)} = language_ltlc \<phi> \<inter> {w. range w \<subseteq> Pow (atoms_ltlc \<phi>)}
[PROOF STEP]
unfolding ltlc_to_ltln_atoms language_ltln_def language_ltlc_def ltlc_to_ltln_semantics simplify_correct
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<xi>. \<xi> \<Turnstile>\<^sub>c \<phi>} \<inter> {w. range w \<subseteq> Pow (atoms_ltlc \<phi>)} = {\<xi>. \<xi> \<Turnstile>\<^sub>c \<phi>} \<inter> {w. range w \<subseteq> Pow (atoms_ltlc \<phi>)}
[PROOF STEP]
..


[STATEMENT]
lemma has_derivative_add[simp, derivative_intros]:
  assumes f: "(f has_derivative f') F"
    and g: "(g has_derivative g') F"
  shows "((\<lambda>x. f x + g x) has_derivative (\<lambda>x. f' x + g' x)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x + g x) has_derivative (\<lambda>x. f' x + g' x)) F
[PROOF STEP]
unfolding has_derivative_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear (\<lambda>x. f' x + g' x) \<and> ((\<lambda>y. (f y + g y - (f (Lim F (\<lambda>x. x)) + g (Lim F (\<lambda>x. x))) - (f' (y - Lim F (\<lambda>x. x)) + g' (y - Lim F (\<lambda>x. x)))) /\<^sub>R norm (y - Lim F (\<lambda>x. x))) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bounded_linear (\<lambda>x. f' x + g' x)
 2. ((\<lambda>y. (f y + g y - (f (Lim F (\<lambda>x. x)) + g (Lim F (\<lambda>x. x))) - (f' (y - Lim F (\<lambda>x. x)) + g' (y - Lim F (\<lambda>x. x)))) /\<^sub>R norm (y - Lim F (\<lambda>x. x))) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
let ?x = "Lim F (\<lambda>x. x)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bounded_linear (\<lambda>x. f' x + g' x)
 2. ((\<lambda>y. (f y + g y - (f (Lim F (\<lambda>x. x)) + g (Lim F (\<lambda>x. x))) - (f' (y - Lim F (\<lambda>x. x)) + g' (y - Lim F (\<lambda>x. x)))) /\<^sub>R norm (y - Lim F (\<lambda>x. x))) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
let ?D = "\<lambda>f f' y. ((f y - f ?x) - f' (y - ?x)) /\<^sub>R norm (y - ?x)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bounded_linear (\<lambda>x. f' x + g' x)
 2. ((\<lambda>y. (f y + g y - (f (Lim F (\<lambda>x. x)) + g (Lim F (\<lambda>x. x))) - (f' (y - Lim F (\<lambda>x. x)) + g' (y - Lim F (\<lambda>x. x)))) /\<^sub>R norm (y - Lim F (\<lambda>x. x))) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
have "((\<lambda>x. ?D f f' x + ?D g g' x) \<longlongrightarrow> (0 + 0)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (f x - f (Lim F (\<lambda>x. x)) - f' (x - Lim F (\<lambda>x. x))) /\<^sub>R norm (x - Lim F (\<lambda>x. x)) + (g x - g (Lim F (\<lambda>x. x)) - g' (x - Lim F (\<lambda>x. x))) /\<^sub>R norm (x - Lim F (\<lambda>x. x))) \<longlongrightarrow> (0::'b) + (0::'b)) F
[PROOF STEP]
using f g
[PROOF STATE]
proof (prove)
using this:
(f has_derivative f') F
(g has_derivative g') F

goal (1 subgoal):
 1. ((\<lambda>x. (f x - f (Lim F (\<lambda>x. x)) - f' (x - Lim F (\<lambda>x. x))) /\<^sub>R norm (x - Lim F (\<lambda>x. x)) + (g x - g (Lim F (\<lambda>x. x)) - g' (x - Lim F (\<lambda>x. x))) /\<^sub>R norm (x - Lim F (\<lambda>x. x))) \<longlongrightarrow> (0::'b) + (0::'b)) F
[PROOF STEP]
by (intro tendsto_add) (auto simp: has_derivative_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (f x - f (Lim F (\<lambda>x. x)) - f' (x - Lim F (\<lambda>x. x))) /\<^sub>R norm (x - Lim F (\<lambda>x. x)) + (g x - g (Lim F (\<lambda>x. x)) - g' (x - Lim F (\<lambda>x. x))) /\<^sub>R norm (x - Lim F (\<lambda>x. x))) \<longlongrightarrow> (0::'b) + (0::'b)) F

goal (2 subgoals):
 1. bounded_linear (\<lambda>x. f' x + g' x)
 2. ((\<lambda>y. (f y + g y - (f (Lim F (\<lambda>x. x)) + g (Lim F (\<lambda>x. x))) - (f' (y - Lim F (\<lambda>x. x)) + g' (y - Lim F (\<lambda>x. x)))) /\<^sub>R norm (y - Lim F (\<lambda>x. x))) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. (f x - f (Lim F (\<lambda>x. x)) - f' (x - Lim F (\<lambda>x. x))) /\<^sub>R norm (x - Lim F (\<lambda>x. x)) + (g x - g (Lim F (\<lambda>x. x)) - g' (x - Lim F (\<lambda>x. x))) /\<^sub>R norm (x - Lim F (\<lambda>x. x))) \<longlongrightarrow> (0::'b) + (0::'b)) F
[PROOF STEP]
show "(?D (\<lambda>x. f x + g x) (\<lambda>x. f' x + g' x) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. (f x - f (Lim F (\<lambda>x. x)) - f' (x - Lim F (\<lambda>x. x))) /\<^sub>R norm (x - Lim F (\<lambda>x. x)) + (g x - g (Lim F (\<lambda>x. x)) - g' (x - Lim F (\<lambda>x. x))) /\<^sub>R norm (x - Lim F (\<lambda>x. x))) \<longlongrightarrow> (0::'b) + (0::'b)) F

goal (1 subgoal):
 1. ((\<lambda>y. (f y + g y - (f (Lim F (\<lambda>x. x)) + g (Lim F (\<lambda>x. x))) - (f' (y - Lim F (\<lambda>x. x)) + g' (y - Lim F (\<lambda>x. x)))) /\<^sub>R norm (y - Lim F (\<lambda>x. x))) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
by (simp add: field_simps scaleR_add_right scaleR_diff_right)
[PROOF STATE]
proof (state)
this:
((\<lambda>y. (f y + g y - (f (Lim F (\<lambda>x. x)) + g (Lim F (\<lambda>x. x))) - (f' (y - Lim F (\<lambda>x. x)) + g' (y - Lim F (\<lambda>x. x)))) /\<^sub>R norm (y - Lim F (\<lambda>x. x))) \<longlongrightarrow> (0::'b)) F

goal (1 subgoal):
 1. bounded_linear (\<lambda>x. f' x + g' x)
[PROOF STEP]
qed (blast intro: bounded_linear_add f g has_derivative_bounded_linear)


[STATEMENT]
lemma succ_eqpoll_cong: "elts a \<approx> elts b \<Longrightarrow> elts (succ(a)) \<approx> elts (succ(b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts a \<approx> elts b \<Longrightarrow> elts (ZFC_in_HOL.succ a) \<approx> elts (ZFC_in_HOL.succ b)
[PROOF STEP]
by (simp add: succ_def insert_eqpoll_cong)


[STATEMENT]
lemma lookup_except_min:
  "lookup (except_min ko xs) k =
        (if (\<forall>k'\<in>fst ` set (fst (list_of_oalist xs)). le ko k k') then 0 else lookup xs k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (except_min ko xs) k = (if \<forall>k'\<in>fst ` set (fst (list_of_oalist xs)). le ko k k' then 0::'b else lookup xs k)
[PROOF STEP]
by (simp add: except_min_def lookup_tl set_sort_oalist_aux oalist_inv_list_of_oalist lookup_reorder)


[STATEMENT]
lemma card_prod_finite:
  fixes C:: "char set" and S::"string set"
  assumes C:"card C \<ge> 1" and S:"card S \<ge> 0"
  shows "card C * card S \<ge> card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card S \<le> card C * card S
[PROOF STEP]
using C S
[PROOF STATE]
proof (prove)
using this:
1 \<le> card C
0 \<le> card S

goal (1 subgoal):
 1. card S \<le> card C * card S
[PROOF STEP]
by auto


[STATEMENT]
lemma max_input_list_cons:
  "max_input_list (a # G) = max (max_input a) (max_input_list G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_input_list (a # G) = max (GExp.max_input a) (max_input_list G)
[PROOF STEP]
apply (cases \<open>max_input a\<close>)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. GExp.max_input a = None \<Longrightarrow> max_input_list (a # G) = max (GExp.max_input a) (max_input_list G)
 2. \<And>aa. GExp.max_input a = Some aa \<Longrightarrow> max_input_list (a # G) = max (GExp.max_input a) (max_input_list G)
[PROOF STEP]
apply (simp_all add: max_input_list_def flip: Max.set_eq_fold)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa. GExp.max_input a = Some aa \<Longrightarrow> Max (insert (Some aa) (GExp.max_input ` set G)) = max (Some aa) (Max (insert None (GExp.max_input ` set G)))
[PROOF STEP]
apply (metis (mono_tags, lifting) List.finite_set Max_insert Max_singleton bot_option_def finite_imageI max.assoc max_bot2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma [simp]: "sgn2 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn2 0 = 1
[PROOF STEP]
by (simp add: sgn2_def)


[STATEMENT]
lemma Rats_sum: "(\<And>x. x \<in> A \<Longrightarrow> f x \<in> \<rat>) \<Longrightarrow> sum f A \<in> \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> f x \<in> \<rat>) \<Longrightarrow> sum f A \<in> \<rat>
[PROOF STEP]
by (induction A rule: infinite_finite_induct) simp_all


[STATEMENT]
lemma iT_Plus_neg_finite_iff: "finite (I \<oplus>- k) = finite I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (I \<oplus>- k) = finite I
[PROOF STEP]
apply (simp add: iT_Plus_neg_image_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<lambda>n. n - k) ` I \<down>\<ge> k) = finite I
[PROOF STEP]
apply (subst inj_on_finite_image_iff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_on (\<lambda>n. n - k) (I \<down>\<ge> k)
 2. finite (I \<down>\<ge> k) = finite I
[PROOF STEP]
apply (metis cut_geE inj_on_diff_nat)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (I \<down>\<ge> k) = finite I
[PROOF STEP]
apply (simp add: nat_cut_ge_finite_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma hfprod_fst_snd[simp]:
    "fst (A *\<^sub>a B) = prod_assn (fst A) (fst B)"
    "snd (A *\<^sub>a B) = prod_assn (snd A) (snd B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (A *\<^sub>a B) = fst A \<times>\<^sub>a fst B &&& snd (A *\<^sub>a B) = snd A \<times>\<^sub>a snd B
[PROOF STEP]
unfolding hfprod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (fst A \<times>\<^sub>a fst B, snd A \<times>\<^sub>a snd B) = fst A \<times>\<^sub>a fst B &&& snd (fst A \<times>\<^sub>a fst B, snd A \<times>\<^sub>a snd B) = snd A \<times>\<^sub>a snd B
[PROOF STEP]
by auto


[STATEMENT]
lemma one_le_mult_iff_hmset[simp]: "1 \<le> m * n \<longleftrightarrow> 1 \<le> m \<and> 1 \<le> n" for m n :: hmultiset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 \<le> m * n) = (1 \<le> m \<and> 1 \<le> n)
[PROOF STEP]
by (metis lt_1_iff_eq_0_hmset mult_eq_0_iff not_le)


[STATEMENT]
lemma nat_not_less:"\<not> (m::nat) < n \<Longrightarrow> n \<le> m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> m < n \<Longrightarrow> n \<le> m
[PROOF STEP]
by (rule contrapos_pp, simp+)


[STATEMENT]
theorem wls_swapEnv_commute:
"\<lbrakk>wlsEnv rho; zs \<noteq> zs' \<or> {x,y} \<inter> {x',y'} = {}\<rbrakk> \<Longrightarrow>
 ((rho &[x \<and> y]_zs) &[x' \<and> y']_zs') = ((rho &[x' \<and> y']_zs') &[x \<and> y]_zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wlsEnv rho; zs \<noteq> zs' \<or> {x, y} \<inter> {x', y'} = {}\<rbrakk> \<Longrightarrow> rho &[x \<and> y]_zs &[x' \<and> y']_zs' = rho &[x' \<and> y']_zs' &[x \<and> y]_zs
[PROOF STEP]
by (intro swapEnv_commute) fastforce+


[STATEMENT]
lemma (in finite_field) card_irred_2:
  "real (card {f. monic_irreducible_poly R f \<and> degree f = 2}) =
    (real (order R)^2 - order R) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
have "x dvd 2 \<Longrightarrow> x = 1 \<or> x = 2" for x :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x dvd 2 \<Longrightarrow> x = 1 \<or> x = 2
[PROOF STEP]
using nat_dvd_not_less[where m="2"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 2; 2 < ?n\<rbrakk> \<Longrightarrow> \<not> ?n dvd 2

goal (1 subgoal):
 1. x dvd 2 \<Longrightarrow> x = 1 \<or> x = 2
[PROOF STEP]
by (metis One_nat_def even_zero gcd_nat.strict_trans2
        less_2_cases nat_neq_iff pos2)
[PROOF STATE]
proof (state)
this:
?x dvd 2 \<Longrightarrow> ?x = 1 \<or> ?x = 2

goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
hence a: "{d. d dvd 2} = {1,2::nat}"
[PROOF STATE]
proof (prove)
using this:
?x dvd 2 \<Longrightarrow> ?x = 1 \<or> ?x = 2

goal (1 subgoal):
 1. {d. d dvd 2} = {1, 2}
[PROOF STEP]
by (auto simp add:set_eq_iff)
[PROOF STATE]
proof (state)
this:
{d. d dvd 2} = {1, 2}

goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
have "2*real (card {f. monic_irreducible_poly R f \<and> degree f = 2})
    = of_int (2* card {f. monic_irreducible_poly R f \<and> degree f = 2})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = real_of_int (int (2 * card {f. m_i_p R f \<and> Polynomials.degree f = 2}))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = real_of_int (int (2 * card {f. m_i_p R f \<and> Polynomials.degree f = 2}))

goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = real_of_int (int (2 * card {f. m_i_p R f \<and> Polynomials.degree f = 2}))

goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
have "... =
    of_int (\<Sum>d | d dvd 2. moebius_mu d * int (order R) ^ (2 div d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (int (2 * card {f. m_i_p R f \<and> Polynomials.degree f = 2})) = real_of_int (\<Sum>d | d dvd 2. moebius_mu d * int (order R) ^ (2 div d))
[PROOF STEP]
by (subst card_irred, auto)
[PROOF STATE]
proof (state)
this:
real_of_int (int (2 * card {f. m_i_p R f \<and> Polynomials.degree f = 2})) = real_of_int (\<Sum>d | d dvd 2. moebius_mu d * int (order R) ^ (2 div d))

goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int (int (2 * card {f. m_i_p R f \<and> Polynomials.degree f = 2})) = real_of_int (\<Sum>d | d dvd 2. moebius_mu d * int (order R) ^ (2 div d))

goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
have "... = order R^2 - int (order R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (\<Sum>d | d dvd 2. moebius_mu d * int (order R) ^ (2 div d)) = real_of_int (int ((order R)\<^sup>2) - int (order R))
[PROOF STEP]
by (subst a, simp)
[PROOF STATE]
proof (state)
this:
real_of_int (\<Sum>d | d dvd 2. moebius_mu d * int (order R) ^ (2 div d)) = real_of_int (int ((order R)\<^sup>2) - int (order R))

goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int (\<Sum>d | d dvd 2. moebius_mu d * int (order R) ^ (2 div d)) = real_of_int (int ((order R)\<^sup>2) - int (order R))

goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
have "... = real (order R)^2 - order R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (int ((order R)\<^sup>2) - int (order R)) = (real (order R))\<^sup>2 - real (order R)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int (int ((order R)\<^sup>2) - int (order R)) = (real (order R))\<^sup>2 - real (order R)

goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 * real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = (real (order R))\<^sup>2 - real (order R)
[PROOF STEP]
have
    "2 * real (card {f. monic_irreducible_poly R f \<and> degree f = 2}) =
    real (order R)^2 - order R"
[PROOF STATE]
proof (prove)
using this:
2 * real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = (real (order R))\<^sup>2 - real (order R)

goal (1 subgoal):
 1. 2 * real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = (real (order R))\<^sup>2 - real (order R)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = (real (order R))\<^sup>2 - real (order R)

goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
2 * real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = (real (order R))\<^sup>2 - real (order R)

goal (1 subgoal):
 1. real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (card {f. m_i_p R f \<and> Polynomials.degree f = 2}) = ((real (order R))\<^sup>2 - real (order R)) / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_outside_subset:
    fixes S :: "'a::real_normed_vector set"
    assumes "closed S"
      shows "closure(outside S) \<subseteq> S \<union> outside S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (outside S) \<subseteq> S \<union> outside S
[PROOF STEP]
by (metis assms closed_open closure_minimal inside_outside open_inside sup_ge2)


[STATEMENT]
lemma gauss_jordan: assumes A: "A \<in> carrier_mat nr nc"
  and B: "B \<in> carrier_mat nr nc2"
  and gauss: "gauss_jordan A B = (C,D)"
  shows "x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)" (is "_ \<Longrightarrow> ?l = ?r")
    "X \<in> carrier_mat nc nc2  \<Longrightarrow> (A * X = B) = (C * X = D)" (is " _ \<Longrightarrow> ?l2 = ?r2")
    "C \<in> carrier_mat nr nc"
    "D \<in> carrier_mat nr nc2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)) &&& (X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D))) &&& C \<in> carrier_mat nr nc &&& D \<in> carrier_mat nr nc2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
 3. C \<in> carrier_mat nr nc
 4. D \<in> carrier_mat nr nc2
[PROOF STEP]
from gauss_jordan_transform[OF A B gauss, unfolded ring_mat_def Units_def, simplified]
[PROOF STATE]
proof (chain)
picking this:
\<exists>P. P \<in> carrier_mat nr nr \<and> (\<exists>x\<in>carrier_mat nr nr. x * P = 1\<^sub>m nr \<and> P * x = 1\<^sub>m nr) \<and> C = P * A \<and> D = P * B
[PROOF STEP]
obtain P Q where P: "P \<in> carrier_mat nr nr" and Q: "Q \<in> carrier_mat nr nr"
    and inv: "Q * P = 1\<^sub>m nr"
    and CPA: "C = P * A"
    and DPB: "D = P * B"
[PROOF STATE]
proof (prove)
using this:
\<exists>P. P \<in> carrier_mat nr nr \<and> (\<exists>x\<in>carrier_mat nr nr. x * P = 1\<^sub>m nr \<and> P * x = 1\<^sub>m nr) \<and> C = P * A \<and> D = P * B

goal (1 subgoal):
 1. (\<And>P Q. \<lbrakk>P \<in> carrier_mat nr nr; Q \<in> carrier_mat nr nr; Q * P = 1\<^sub>m nr; C = P * A; D = P * B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P \<in> carrier_mat nr nr
Q \<in> carrier_mat nr nr
Q * P = 1\<^sub>m nr
C = P * A
D = P * B

goal (4 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
 3. C \<in> carrier_mat nr nc
 4. D \<in> carrier_mat nr nc2
[PROOF STEP]
from CPA P A
[PROOF STATE]
proof (chain)
picking this:
C = P * A
P \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc
[PROOF STEP]
show C: "C \<in> carrier_mat nr nc"
[PROOF STATE]
proof (prove)
using this:
C = P * A
P \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. C \<in> carrier_mat nr nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C \<in> carrier_mat nr nc

goal (3 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
 3. D \<in> carrier_mat nr nc2
[PROOF STEP]
from DPB P B
[PROOF STATE]
proof (chain)
picking this:
D = P * B
P \<in> carrier_mat nr nr
B \<in> carrier_mat nr nc2
[PROOF STEP]
show D: "D \<in> carrier_mat nr nc2"
[PROOF STATE]
proof (prove)
using this:
D = P * B
P \<in> carrier_mat nr nr
B \<in> carrier_mat nr nc2

goal (1 subgoal):
 1. D \<in> carrier_mat nr nc2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
D \<in> carrier_mat nr nc2

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
have "A = 1\<^sub>m nr * A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = 1\<^sub>m nr * A
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. A = 1\<^sub>m nr * A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A = 1\<^sub>m nr * A

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A = 1\<^sub>m nr * A

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
have "\<dots> = Q * C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>m nr * A = Q * C
[PROOF STEP]
unfolding inv[symmetric] CPA
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q * P * A = Q * (P * A)
[PROOF STEP]
using Q P A
[PROOF STATE]
proof (prove)
using this:
Q \<in> carrier_mat nr nr
P \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. Q * P * A = Q * (P * A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1\<^sub>m nr * A = Q * C

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A = Q * C
[PROOF STEP]
have AQC: "A = Q * C"
[PROOF STATE]
proof (prove)
using this:
A = Q * C

goal (1 subgoal):
 1. A = Q * C
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
A = Q * C

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
have "B = 1\<^sub>m nr * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B = 1\<^sub>m nr * B
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat nr nc2

goal (1 subgoal):
 1. B = 1\<^sub>m nr * B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B = 1\<^sub>m nr * B

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B = 1\<^sub>m nr * B

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
have "\<dots> = Q * D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>m nr * B = Q * D
[PROOF STEP]
unfolding inv[symmetric] DPB
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q * P * B = Q * (P * B)
[PROOF STEP]
using Q P B
[PROOF STATE]
proof (prove)
using this:
Q \<in> carrier_mat nr nr
P \<in> carrier_mat nr nr
B \<in> carrier_mat nr nc2

goal (1 subgoal):
 1. Q * P * B = Q * (P * B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1\<^sub>m nr * B = Q * D

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
B = Q * D
[PROOF STEP]
have BQD: "B = Q * D"
[PROOF STATE]
proof (prove)
using this:
B = Q * D

goal (1 subgoal):
 1. B = Q * D
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
B = Q * D

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
B = Q * D

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
assume x: "x \<in> carrier_vec nc"
[PROOF STATE]
proof (state)
this:
x \<in> carrier_vec nc

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
x \<in> carrier_vec nc

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
assume ?l
[PROOF STATE]
proof (state)
this:
A *\<^sub>v x = 0\<^sub>v nr

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
from arg_cong[OF this, of "\<lambda> v. P *\<^sub>v v"] P A x
[PROOF STATE]
proof (chain)
picking this:
P *\<^sub>v (A *\<^sub>v x) = P *\<^sub>v 0\<^sub>v nr
P \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc
x \<in> carrier_vec nc
[PROOF STEP]
have ?r
[PROOF STATE]
proof (prove)
using this:
P *\<^sub>v (A *\<^sub>v x) = P *\<^sub>v 0\<^sub>v nr
P \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc
x \<in> carrier_vec nc

goal (1 subgoal):
 1. C *\<^sub>v x = 0\<^sub>v nr
[PROOF STEP]
unfolding CPA
[PROOF STATE]
proof (prove)
using this:
P *\<^sub>v (A *\<^sub>v x) = P *\<^sub>v 0\<^sub>v nr
P \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc
x \<in> carrier_vec nc

goal (1 subgoal):
 1. P * A *\<^sub>v x = 0\<^sub>v nr
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C *\<^sub>v x = 0\<^sub>v nr

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
A *\<^sub>v x = 0\<^sub>v nr \<Longrightarrow> C *\<^sub>v x = 0\<^sub>v nr

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A *\<^sub>v x = 0\<^sub>v nr \<Longrightarrow> C *\<^sub>v x = 0\<^sub>v nr

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
A *\<^sub>v x = 0\<^sub>v nr \<Longrightarrow> C *\<^sub>v x = 0\<^sub>v nr

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
assume ?r
[PROOF STATE]
proof (state)
this:
C *\<^sub>v x = 0\<^sub>v nr

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
from arg_cong[OF this, of "\<lambda> v. Q *\<^sub>v v"] Q C x
[PROOF STATE]
proof (chain)
picking this:
Q *\<^sub>v (C *\<^sub>v x) = Q *\<^sub>v 0\<^sub>v nr
Q \<in> carrier_mat nr nr
C \<in> carrier_mat nr nc
x \<in> carrier_vec nc
[PROOF STEP]
have ?l
[PROOF STATE]
proof (prove)
using this:
Q *\<^sub>v (C *\<^sub>v x) = Q *\<^sub>v 0\<^sub>v nr
Q \<in> carrier_mat nr nr
C \<in> carrier_mat nr nc
x \<in> carrier_vec nc

goal (1 subgoal):
 1. A *\<^sub>v x = 0\<^sub>v nr
[PROOF STEP]
unfolding AQC
[PROOF STATE]
proof (prove)
using this:
Q *\<^sub>v (C *\<^sub>v x) = Q *\<^sub>v 0\<^sub>v nr
Q \<in> carrier_mat nr nr
C \<in> carrier_mat nr nc
x \<in> carrier_vec nc

goal (1 subgoal):
 1. Q * C *\<^sub>v x = 0\<^sub>v nr
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A *\<^sub>v x = 0\<^sub>v nr

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
C *\<^sub>v x = 0\<^sub>v nr \<Longrightarrow> A *\<^sub>v x = 0\<^sub>v nr

goal (2 subgoals):
 1. x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
 2. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
A *\<^sub>v x = 0\<^sub>v nr \<Longrightarrow> C *\<^sub>v x = 0\<^sub>v nr
C *\<^sub>v x = 0\<^sub>v nr \<Longrightarrow> A *\<^sub>v x = 0\<^sub>v nr
[PROOF STEP]
show "?l = ?r"
[PROOF STATE]
proof (prove)
using this:
A *\<^sub>v x = 0\<^sub>v nr \<Longrightarrow> C *\<^sub>v x = 0\<^sub>v nr
C *\<^sub>v x = 0\<^sub>v nr \<Longrightarrow> A *\<^sub>v x = 0\<^sub>v nr

goal (1 subgoal):
 1. (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
x \<in> carrier_vec nc \<Longrightarrow> (A *\<^sub>v x = 0\<^sub>v nr) = (C *\<^sub>v x = 0\<^sub>v nr)

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
assume X: "X \<in> carrier_mat nc nc2"
[PROOF STATE]
proof (state)
this:
X \<in> carrier_mat nc nc2

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
X \<in> carrier_mat nc nc2

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
assume ?l2
[PROOF STATE]
proof (state)
this:
A * X = B

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
from arg_cong[OF this, of "\<lambda> X. P * X"] P A X
[PROOF STATE]
proof (chain)
picking this:
P * (A * X) = P * B
P \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc
X \<in> carrier_mat nc nc2
[PROOF STEP]
have ?r2
[PROOF STATE]
proof (prove)
using this:
P * (A * X) = P * B
P \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc
X \<in> carrier_mat nc nc2

goal (1 subgoal):
 1. C * X = D
[PROOF STEP]
unfolding CPA DPB
[PROOF STATE]
proof (prove)
using this:
P * (A * X) = P * B
P \<in> carrier_mat nr nr
A \<in> carrier_mat nr nc
X \<in> carrier_mat nc nc2

goal (1 subgoal):
 1. P * A * X = P * B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
C * X = D

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
A * X = B \<Longrightarrow> C * X = D

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A * X = B \<Longrightarrow> C * X = D

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
A * X = B \<Longrightarrow> C * X = D

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
assume ?r2
[PROOF STATE]
proof (state)
this:
C * X = D

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
from arg_cong[OF this, of "\<lambda> X. Q * X"] Q C X
[PROOF STATE]
proof (chain)
picking this:
Q * (C * X) = Q * D
Q \<in> carrier_mat nr nr
C \<in> carrier_mat nr nc
X \<in> carrier_mat nc nc2
[PROOF STEP]
have ?l2
[PROOF STATE]
proof (prove)
using this:
Q * (C * X) = Q * D
Q \<in> carrier_mat nr nr
C \<in> carrier_mat nr nc
X \<in> carrier_mat nc nc2

goal (1 subgoal):
 1. A * X = B
[PROOF STEP]
unfolding AQC BQD
[PROOF STATE]
proof (prove)
using this:
Q * (C * X) = Q * D
Q \<in> carrier_mat nr nr
C \<in> carrier_mat nr nc
X \<in> carrier_mat nc nc2

goal (1 subgoal):
 1. Q * C * X = Q * D
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A * X = B

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
C * X = D \<Longrightarrow> A * X = B

goal (1 subgoal):
 1. X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
A * X = B \<Longrightarrow> C * X = D
C * X = D \<Longrightarrow> A * X = B
[PROOF STEP]
show "?l2 = ?r2"
[PROOF STATE]
proof (prove)
using this:
A * X = B \<Longrightarrow> C * X = D
C * X = D \<Longrightarrow> A * X = B

goal (1 subgoal):
 1. (A * X = B) = (C * X = D)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A * X = B) = (C * X = D)

goal:
No subgoals!
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
X \<in> carrier_mat nc nc2 \<Longrightarrow> (A * X = B) = (C * X = D)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Elem_Elem_PFun: "Elem F (PFun U V) \<Longrightarrow> Elem p F \<Longrightarrow> isOpair p & Elem (Fst p) U & Elem (Snd p) V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Elem F (PFun U V); Elem p F\<rbrakk> \<Longrightarrow> isOpair p \<and> Elem (Fst p) U \<and> Elem (Snd p) V
[PROOF STEP]
apply (simp add: PFun_def Sep Power subset_def, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Elem p F; \<forall>x. Elem x F \<longrightarrow> Elem x (CartProd U V); isFun F\<rbrakk> \<Longrightarrow> isOpair p \<and> Elem (Fst p) U \<and> Elem (Snd p) V
[PROOF STEP]
apply (erule_tac x=p in allE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Elem p F; isFun F; Elem p F \<longrightarrow> Elem p (CartProd U V)\<rbrakk> \<Longrightarrow> isOpair p \<and> Elem (Fst p) U \<and> Elem (Snd p) V
[PROOF STEP]
apply (auto simp add: CartProd isOpair Fst Snd)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in abelian_group) a_coset_join2:
     "\<lbrakk>x \<in> carrier G;  subgroup H (add_monoid G); x\<in>H\<rbrakk> \<Longrightarrow> H +> x = H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier G; subgroup H (add_monoid G); x \<in> H\<rbrakk> \<Longrightarrow> H +> x = H
[PROOF STEP]
by (rule group.coset_join2 [OF a_group,
    folded a_r_coset_def, simplified monoid_record_simps])


[STATEMENT]
lemma eval_power: "x ^ numeral n = x * x ^ pred_numeral n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ numeral n = x * x ^ pred_numeral n
[PROOF STEP]
by (subst numeral_eq_Suc, subst power_Suc) simp


[STATEMENT]
lemma ereal_complete_Inf:
  "\<exists>x. (\<forall>y\<in>S::ereal set. x \<le> y) \<and> (\<forall>z. (\<forall>y\<in>S. z \<le> y) \<longrightarrow> z \<le> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. (\<forall>y\<in>S. x \<le> y) \<and> (\<forall>z. (\<forall>y\<in>S. z \<le> y) \<longrightarrow> z \<le> x)
[PROOF STEP]
using ereal_complete_Sup[of "uminus ` S"]
[PROOF STATE]
proof (prove)
using this:
\<exists>x. (\<forall>y\<in>uminus ` S. y \<le> x) \<and> (\<forall>z. (\<forall>y\<in>uminus ` S. y \<le> z) \<longrightarrow> x \<le> z)

goal (1 subgoal):
 1. \<exists>x. (\<forall>y\<in>S. x \<le> y) \<and> (\<forall>z. (\<forall>y\<in>S. z \<le> y) \<longrightarrow> z \<le> x)
[PROOF STEP]
unfolding ereal_complete_uminus_eq
[PROOF STATE]
proof (prove)
using this:
\<exists>x. Ball S ((\<le>) (- x)) \<and> (\<forall>z. Ball S ((\<le>) z) \<longrightarrow> z \<le> - x)

goal (1 subgoal):
 1. \<exists>x. (\<forall>y\<in>S. x \<le> y) \<and> (\<forall>z. (\<forall>y\<in>S. z \<le> y) \<longrightarrow> z \<le> x)
[PROOF STEP]
by auto


[STATEMENT]
lemma add_to_rbt_comp: "add_to_rbt_comp = ord.add_to_rbt (lt_of_comp c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.add_to_rbt_comp = ord.add_to_rbt (lt_of_comp c)
[PROOF STEP]
unfolding add_to_rbt_comp_def ord.add_to_rbt_def rbt_comp_lookup[OF c] rbt_comp_insert[OF c]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(a, b) t. case ord.rbt_lookup (lt_of_comp c) t a of None \<Rightarrow> ord.rbt_insert (lt_of_comp c) a {b} t | Some X \<Rightarrow> ord.rbt_insert (lt_of_comp c) a (insert b X) t) = (\<lambda>(a, b) t. case ord.rbt_lookup (lt_of_comp c) t a of None \<Rightarrow> ord.rbt_insert (lt_of_comp c) a {b} t | Some X \<Rightarrow> ord.rbt_insert (lt_of_comp c) a (insert b X) t)
[PROOF STEP]
by simp


[STATEMENT]
lemma eint_minus_comm:
"(d::eint) + b - c = d - c + b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d + b - c = d - c + b
[PROOF STEP]
apply(induction c )
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>int. d + b - eint int = d - eint int + b
 2. d + b - \<infinity> = d - \<infinity> + b
[PROOF STEP]
apply (metis add.assoc add_diff_cancel_eint eint.distinct(2) eint_add_cancel_fact)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d + b - \<infinity> = d - \<infinity> + b
[PROOF STEP]
apply(induction d)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>int. eint int + b - \<infinity> = eint int - \<infinity> + b
 2. \<infinity> + b - \<infinity> = \<infinity> - \<infinity> + b
[PROOF STEP]
apply (metis distrib_left eint2_cases eint_minus_distl i1_ne_infinity idiff_infinity_right
           mult_one_left plus_eq_infty_iff_eint sum_infinity_imp_summand_infinity times_eint_simps(3))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<infinity> + b - \<infinity> = \<infinity> - \<infinity> + b
[PROOF STEP]
apply(induction b)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>int. \<infinity> + eint int - \<infinity> = \<infinity> - \<infinity> + eint int
 2. \<infinity> + \<infinity> - \<infinity> = \<infinity> - \<infinity> + \<infinity>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<infinity> + \<infinity> - \<infinity> = \<infinity> - \<infinity> + \<infinity>
[PROOF STEP]
by simp


[STATEMENT]
lemma differentiable_Fourier_convergence_periodic:
  assumes f: "f absolutely_integrable_on {-pi..pi}"
    and fdif: "f differentiable (at t)"
    and periodic: "\<And>x. f(x + 2*pi) = f x"
  shows "(\<lambda>n. (\<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t)) \<longlonglongrightarrow> f t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> f t
[PROOF STEP]
by (rule bi_differentiable_Fourier_convergence_periodic) (auto simp: differentiable_at_withinI assms)


[STATEMENT]
lemma VLambda_vinsert:
  "(\<lambda>a\<in>\<^sub>\<circ>vinsert a A. f a) = (\<lambda>a\<in>\<^sub>\<circ>set {a}. f a) \<union>\<^sub>\<circ> (\<lambda>a\<in>\<^sub>\<circ>A. f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VLambda (vinsert a A) f = VLambda (set {a}) f \<union>\<^sub>\<circ> VLambda A f
[PROOF STEP]
by auto


[STATEMENT]
lemma Ln'_times_of_real:
  "Ln' (of_real x * z) = of_real (ln x) + Ln' z" if "x > 0" "z \<noteq> 0" for z x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln' (complex_of_real x * z) = complex_of_real (ln x) + Ln' z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Ln' (complex_of_real x * z) = complex_of_real (ln x) + Ln' z
[PROOF STEP]
have "Ln' (of_real x * z) = Ln (of_real x * (- \<i> * z)) + \<i> * pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln' (complex_of_real x * z) = Ln (complex_of_real x * (- \<i> * z)) + \<i> * complex_of_real pi / 2
[PROOF STEP]
by (simp add: Ln'_def mult_ac)
[PROOF STATE]
proof (state)
this:
Ln' (complex_of_real x * z) = Ln (complex_of_real x * (- \<i> * z)) + \<i> * complex_of_real pi / 2

goal (1 subgoal):
 1. Ln' (complex_of_real x * z) = complex_of_real (ln x) + Ln' z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Ln' (complex_of_real x * z) = Ln (complex_of_real x * (- \<i> * z)) + \<i> * complex_of_real pi / 2

goal (1 subgoal):
 1. Ln' (complex_of_real x * z) = complex_of_real (ln x) + Ln' z
[PROOF STEP]
have "\<dots> = of_real (ln x) + Ln' z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (complex_of_real x * (- \<i> * z)) + \<i> * complex_of_real pi / 2 = complex_of_real (ln x) + Ln' z
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < x
z \<noteq> 0

goal (1 subgoal):
 1. Ln (complex_of_real x * (- \<i> * z)) + \<i> * complex_of_real pi / 2 = complex_of_real (ln x) + Ln' z
[PROOF STEP]
by (subst Ln_times_of_real) (auto simp: Ln'_def Ln_of_real)
[PROOF STATE]
proof (state)
this:
Ln (complex_of_real x * (- \<i> * z)) + \<i> * complex_of_real pi / 2 = complex_of_real (ln x) + Ln' z

goal (1 subgoal):
 1. Ln' (complex_of_real x * z) = complex_of_real (ln x) + Ln' z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Ln' (complex_of_real x * z) = complex_of_real (ln x) + Ln' z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Ln' (complex_of_real x * z) = complex_of_real (ln x) + Ln' z

goal (1 subgoal):
 1. Ln' (complex_of_real x * z) = complex_of_real (ln x) + Ln' z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Ln' (complex_of_real x * z) = complex_of_real (ln x) + Ln' z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Qp_nonzero_nat_pow:
  assumes "x \<in> carrier Q\<^sub>p"
  assumes "n > 0"
  assumes "x[^](n::nat) \<in> nonzero Q\<^sub>p"
  shows "x \<in> nonzero Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p
[PROOF STEP]
using Frac_nonzero_nat_pow Q\<^sub>p_def assms(1) assms(2) assms(3)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier (Frac Z\<^sub>p); 0 < ?n; ?x [^]\<^bsub>Frac Z\<^sub>p\<^esub> ?n \<in> nonzero (Frac Z\<^sub>p)\<rbrakk> \<Longrightarrow> ?x \<in> nonzero (Frac Z\<^sub>p)
Q\<^sub>p \<equiv> Frac Z\<^sub>p
x \<in> carrier Q\<^sub>p
0 < n
x [^] n \<in> nonzero Q\<^sub>p

goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p
[PROOF STEP]
by blast


[STATEMENT]
theorem double_dual_iso: "double_dual_iso \<in> iso G (Characters (Characters G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. double_dual_iso \<in> Group.iso G (Characters (Characters G))
[PROOF STEP]
proof (rule isoI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. double_dual_iso \<in> hom G (Characters (Characters G))
 2. bij_betw double_dual_iso (carrier G) (carrier (Characters (Characters G)))
[PROOF STEP]
interpret G': finite_comm_group "Characters G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_comm_group (Characters G)
[PROOF STEP]
by (rule finite_comm_group_Characters)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. double_dual_iso \<in> hom G (Characters (Characters G))
 2. bij_betw double_dual_iso (carrier G) (carrier (Characters (Characters G)))
[PROOF STEP]
interpret G'': finite_comm_group "Characters (Characters G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_comm_group (Characters (Characters G))
[PROOF STEP]
by (rule G'.finite_comm_group_Characters)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. double_dual_iso \<in> hom G (Characters (Characters G))
 2. bij_betw double_dual_iso (carrier G) (carrier (Characters (Characters G)))
[PROOF STEP]
show hom: "double_dual_iso \<in> hom G (Characters (Characters G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. double_dual_iso \<in> hom G (Characters (Characters G))
[PROOF STEP]
by (rule homI) (auto simp: carrier_Characters characters_def)
[PROOF STATE]
proof (state)
this:
double_dual_iso \<in> hom G (Characters (Characters G))

goal (1 subgoal):
 1. bij_betw double_dual_iso (carrier G) (carrier (Characters (Characters G)))
[PROOF STEP]
show "bij_betw double_dual_iso (carrier G) (carrier (Characters (Characters G)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw double_dual_iso (carrier G) (carrier (Characters (Characters G)))
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on double_dual_iso (carrier G) \<and> double_dual_iso ` carrier G = carrier (Characters (Characters G))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on double_dual_iso (carrier G)
 2. double_dual_iso ` carrier G = carrier (Characters (Characters G))
[PROOF STEP]
show "inj_on double_dual_iso (carrier G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on double_dual_iso (carrier G)
[PROOF STEP]
by (fact inj_double_dual_iso)
[PROOF STATE]
proof (state)
this:
inj_on double_dual_iso (carrier G)

goal (1 subgoal):
 1. double_dual_iso ` carrier G = carrier (Characters (Characters G))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. double_dual_iso ` carrier G = carrier (Characters (Characters G))
[PROOF STEP]
show "double_dual_iso ` carrier G = carrier (Characters (Characters G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. double_dual_iso ` carrier G = carrier (Characters (Characters G))
[PROOF STEP]
proof (rule card_subset_eq)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite (carrier (Characters (Characters G)))
 2. double_dual_iso ` carrier G \<subseteq> carrier (Characters (Characters G))
 3. card (double_dual_iso ` carrier G) = card (carrier (Characters (Characters G)))
[PROOF STEP]
show "finite (carrier (Characters (Characters G)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (carrier (Characters (Characters G)))
[PROOF STEP]
by (fact G''.fin)
[PROOF STATE]
proof (state)
this:
finite (carrier (Characters (Characters G)))

goal (2 subgoals):
 1. double_dual_iso ` carrier G \<subseteq> carrier (Characters (Characters G))
 2. card (double_dual_iso ` carrier G) = card (carrier (Characters (Characters G)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. double_dual_iso ` carrier G \<subseteq> carrier (Characters (Characters G))
 2. card (double_dual_iso ` carrier G) = card (carrier (Characters (Characters G)))
[PROOF STEP]
have "card (carrier (Characters (Characters G))) = card (carrier G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier (Characters (Characters G))) = card (carrier G)
[PROOF STEP]
by (simp add: carrier_Characters G'.card_characters card_characters order_def)
[PROOF STATE]
proof (state)
this:
card (carrier (Characters (Characters G))) = card (carrier G)

goal (2 subgoals):
 1. double_dual_iso ` carrier G \<subseteq> carrier (Characters (Characters G))
 2. card (double_dual_iso ` carrier G) = card (carrier (Characters (Characters G)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (carrier (Characters (Characters G))) = card (carrier G)

goal (2 subgoals):
 1. double_dual_iso ` carrier G \<subseteq> carrier (Characters (Characters G))
 2. card (double_dual_iso ` carrier G) = card (carrier (Characters (Characters G)))
[PROOF STEP]
have "\<dots> = card (double_dual_iso ` carrier G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier G) = card (double_dual_iso ` carrier G)
[PROOF STEP]
by (intro card_image [symmetric] inj_double_dual_iso)
[PROOF STATE]
proof (state)
this:
card (carrier G) = card (double_dual_iso ` carrier G)

goal (2 subgoals):
 1. double_dual_iso ` carrier G \<subseteq> carrier (Characters (Characters G))
 2. card (double_dual_iso ` carrier G) = card (carrier (Characters (Characters G)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (carrier (Characters (Characters G))) = card (double_dual_iso ` carrier G)
[PROOF STEP]
show "card (double_dual_iso ` carrier G) =
                      card (carrier (Characters (Characters G)))"
[PROOF STATE]
proof (prove)
using this:
card (carrier (Characters (Characters G))) = card (double_dual_iso ` carrier G)

goal (1 subgoal):
 1. card (double_dual_iso ` carrier G) = card (carrier (Characters (Characters G)))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
card (double_dual_iso ` carrier G) = card (carrier (Characters (Characters G)))

goal (1 subgoal):
 1. double_dual_iso ` carrier G \<subseteq> carrier (Characters (Characters G))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. double_dual_iso ` carrier G \<subseteq> carrier (Characters (Characters G))
[PROOF STEP]
show "double_dual_iso ` carrier G \<subseteq> carrier (Characters (Characters G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. double_dual_iso ` carrier G \<subseteq> carrier (Characters (Characters G))
[PROOF STEP]
using hom
[PROOF STATE]
proof (prove)
using this:
double_dual_iso \<in> hom G (Characters (Characters G))

goal (1 subgoal):
 1. double_dual_iso ` carrier G \<subseteq> carrier (Characters (Characters G))
[PROOF STEP]
by (auto simp: hom_def)
[PROOF STATE]
proof (state)
this:
double_dual_iso ` carrier G \<subseteq> carrier (Characters (Characters G))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
double_dual_iso ` carrier G = carrier (Characters (Characters G))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bij_betw double_dual_iso (carrier G) (carrier (Characters (Characters G)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ennreal_eq_1[simp]: "ennreal x = 1 \<longleftrightarrow> x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ennreal x = 1) = (x = 1)
[PROOF STEP]
by (cases "0 \<le> x") (auto simp: ennreal_neg simp flip: ennreal_1)


[STATEMENT]
lemma stc_Infinitesimal: "x \<in> Infinitesimal \<Longrightarrow> stc x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> Infinitesimal \<Longrightarrow> stc x = 0
[PROOF STEP]
by (simp add: stc_unique mem_infmal_iff)


[STATEMENT]
lemma subset_minus_empty: "A\<subseteq>B \<Longrightarrow> A-B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> A - B = {}
[PROOF STEP]
by auto


[STATEMENT]
lemma (in ceuclidean_space) ceuclidean_representation: "(\<Sum>b\<in>CBasis. cinner b x *\<^sub>C b) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b\<in>CBasis. (b \<bullet>\<^sub>C x) *\<^sub>C b) = x
[PROOF STEP]
unfolding ceuclidean_representation_sum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b\<in>CBasis. b \<bullet>\<^sub>C x = cnj (x \<bullet>\<^sub>C b)
[PROOF STEP]
using local.cinner_commute
[PROOF STATE]
proof (prove)
using this:
?x \<bullet>\<^sub>C ?y = cnj (?y \<bullet>\<^sub>C ?x)

goal (1 subgoal):
 1. \<forall>b\<in>CBasis. b \<bullet>\<^sub>C x = cnj (x \<bullet>\<^sub>C b)
[PROOF STEP]
by blast


[STATEMENT]
lemma iSince_prev: "\<lbrakk> finite I; I \<noteq> {} \<rbrakk> \<Longrightarrow>
  (P t'. t' \<S> t I. Q t) =
  (Q (Max I) \<or> (P (Max I) \<and> (P t'. t' \<S> t (I \<down>< Max I). Q t)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> (P t'. t' \<S> t I. Q t) = (Q (Max I) \<or> P (Max I) \<and> (P t'. t' \<S> t I \<down>< Max I. Q t))
[PROOF STEP]
apply (case_tac "Q (Max I)")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite I; I \<noteq> {}; Q (Max I)\<rbrakk> \<Longrightarrow> (P t'. t' \<S> t I. Q t) = (Q (Max I) \<or> P (Max I) \<and> (P t'. t' \<S> t I \<down>< Max I. Q t))
 2. \<lbrakk>finite I; I \<noteq> {}; \<not> Q (Max I)\<rbrakk> \<Longrightarrow> (P t'. t' \<S> t I. Q t) = (Q (Max I) \<or> P (Max I) \<and> (P t'. t' \<S> t I \<down>< Max I. Q t))
[PROOF STEP]
apply (simp add: Max_imp_iSince)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}; \<not> Q (Max I)\<rbrakk> \<Longrightarrow> (P t'. t' \<S> t I. Q t) = (Q (Max I) \<or> P (Max I) \<and> (P t'. t' \<S> t I \<down>< Max I. Q t))
[PROOF STEP]
apply (simp add: iSince_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}; \<not> Q (Max I)\<rbrakk> \<Longrightarrow> (\<diamond> t I. Q t \<and> (\<box> t' I \<down>> t. P t')) = (P (Max I) \<and> (\<diamond> t I \<down>< Max I. Q t \<and> iAll (I \<down>< Max I \<down>> t) P))
[PROOF STEP]
apply (frule Max_in, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}; \<not> Q (Max I); Max I \<in> I\<rbrakk> \<Longrightarrow> (\<diamond> t I. Q t \<and> (\<box> t' I \<down>> t. P t')) = (P (Max I) \<and> (\<diamond> t I \<down>< Max I. Q t \<and> iAll (I \<down>< Max I \<down>> t) P))
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma apply_cltn2_abs_in_S:
  assumes "v \<noteq> 0"
  shows "apply_cltn2 (proj2_abs v) C \<in> S
  \<longleftrightarrow> v \<bullet> (cltn2_rep C ** M ** transpose (cltn2_rep C) *v v) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (apply_cltn2 (proj2_abs v) C \<in> S) = (v \<bullet> (cltn2_rep C ** M ** Finite_Cartesian_Product.transpose (cltn2_rep C) *v v) = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (apply_cltn2 (proj2_abs v) C \<in> S) = (v \<bullet> (cltn2_rep C ** M ** Finite_Cartesian_Product.transpose (cltn2_rep C) *v v) = 0)
[PROOF STEP]
have "invertible (cltn2_rep C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (cltn2_rep C)
[PROOF STEP]
by (rule cltn2_rep_invertible)
[PROOF STATE]
proof (state)
this:
invertible (cltn2_rep C)

goal (1 subgoal):
 1. (apply_cltn2 (proj2_abs v) C \<in> S) = (v \<bullet> (cltn2_rep C ** M ** Finite_Cartesian_Product.transpose (cltn2_rep C) *v v) = 0)
[PROOF STEP]
with \<open>v \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
v \<noteq> 0
invertible (cltn2_rep C)
[PROOF STEP]
have "apply_cltn2 (proj2_abs v) (cltn2_abs (cltn2_rep C)) \<in> S
    \<longleftrightarrow> v \<bullet> (cltn2_rep C ** M ** transpose (cltn2_rep C) *v v) = 0"
[PROOF STATE]
proof (prove)
using this:
v \<noteq> 0
invertible (cltn2_rep C)

goal (1 subgoal):
 1. (apply_cltn2 (proj2_abs v) (cltn2_abs (cltn2_rep C)) \<in> S) = (v \<bullet> (cltn2_rep C ** M ** Finite_Cartesian_Product.transpose (cltn2_rep C) *v v) = 0)
[PROOF STEP]
by (rule apply_cltn2_abs_abs_in_S)
[PROOF STATE]
proof (state)
this:
(apply_cltn2 (proj2_abs v) (cltn2_abs (cltn2_rep C)) \<in> S) = (v \<bullet> (cltn2_rep C ** M ** Finite_Cartesian_Product.transpose (cltn2_rep C) *v v) = 0)

goal (1 subgoal):
 1. (apply_cltn2 (proj2_abs v) C \<in> S) = (v \<bullet> (cltn2_rep C ** M ** Finite_Cartesian_Product.transpose (cltn2_rep C) *v v) = 0)
[PROOF STEP]
thus "apply_cltn2 (proj2_abs v) C \<in> S
    \<longleftrightarrow> v \<bullet> (cltn2_rep C ** M ** transpose (cltn2_rep C) *v v) = 0"
[PROOF STATE]
proof (prove)
using this:
(apply_cltn2 (proj2_abs v) (cltn2_abs (cltn2_rep C)) \<in> S) = (v \<bullet> (cltn2_rep C ** M ** Finite_Cartesian_Product.transpose (cltn2_rep C) *v v) = 0)

goal (1 subgoal):
 1. (apply_cltn2 (proj2_abs v) C \<in> S) = (v \<bullet> (cltn2_rep C ** M ** Finite_Cartesian_Product.transpose (cltn2_rep C) *v v) = 0)
[PROOF STEP]
by (simp add: cltn2_abs_rep)
[PROOF STATE]
proof (state)
this:
(apply_cltn2 (proj2_abs v) C \<in> S) = (v \<bullet> (cltn2_rep C ** M ** Finite_Cartesian_Product.transpose (cltn2_rep C) *v v) = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vrestr_same_emeasure_f:
  assumes "f \<in> measure_preserving M M"
          "A \<in> sets M"
  shows "emeasure M (f--`A) = emeasure M A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (f --` A) = emeasure M A
[PROOF STEP]
by (metis (mono_tags, lifting) assms measure_preserving_def mem_Collect_eq sets.Int_space_eq2 vimage_restr_def)