[STATEMENT]
lemma ket_zero_k_decode:
  "k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2^(Suc k)) (\<lambda>k. if k = 0 then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ket_zero_k 0 = Matrix.vec (2 ^ Suc 0) (\<lambda>k. if k = 0 then 1 else 0)
 2. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < n

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ket_zero_k 0 = Matrix.vec (2 ^ Suc 0) (\<lambda>k. if k = 0 then 1 else 0)
 2. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ket_zero_k 0 = Matrix.vec (2 ^ Suc 0) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
apply (rule eq_vecI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (Matrix.vec (2 ^ Suc 0) (\<lambda>k. if k = 0 then 1 else 0)) \<Longrightarrow> ket_zero_k 0 $ i = Matrix.vec (2 ^ Suc 0) (\<lambda>k. if k = 0 then 1 else 0) $ i
 2. dim_vec (ket_zero_k 0) = dim_vec (Matrix.vec (2 ^ Suc 0) (\<lambda>k. if k = 0 then 1 else 0))
[PROOF STEP]
by (auto simp add: ket_zero_def)
[PROOF STATE]
proof (state)
this:
ket_zero_k 0 = Matrix.vec (2 ^ Suc 0) (\<lambda>k. if k = 0 then 1 else 0)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0)
Suc k < n

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0)
Suc k < n
[PROOF STEP]
have k: "k < n"
[PROOF STATE]
proof (prove)
using this:
k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0)
Suc k < n

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

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
have kzkk: "ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if (k = 0) then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
using Suc(1)[OF k]
[PROOF STATE]
proof (prove)
using this:
ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0)

goal (1 subgoal):
 1. ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
have dSk: "ket_zero_k (Suc k) \<in> carrier_vec (2^(Suc (Suc k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ket_zero_k (Suc k) \<in> carrier_vec (2 ^ Suc (Suc k))
[PROOF STEP]
using ket_zero_k_dim[OF Suc(2)]
[PROOF STATE]
proof (prove)
using this:
ket_zero_k (Suc k) \<in> carrier_vec (2 ^ Suc (Suc k))

goal (1 subgoal):
 1. ket_zero_k (Suc k) \<in> carrier_vec (2 ^ Suc (Suc k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ket_zero_k (Suc k) \<in> carrier_vec (2 ^ Suc (Suc k))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
interpret st: partial_state "replicate (Suc (Suc k)) 2" "{0..<Suc k}"
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
interpret st2: partial_state2 dims "{0..<Suc k}" "{Suc k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partial_state2 {0..<Suc k} {Suc k}
[PROOF STEP]
by (unfold_locales, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
have splitset: "({0..<Suc k} \<union> {Suc k}) = {0..<Suc (Suc k)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<Suc k} \<union> {Suc k} = {0..<Suc (Suc k)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<Suc k} \<union> {Suc k} = {0..<Suc (Suc k)}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{0..<Suc k} \<union> {Suc k} = {0..<Suc (Suc k)}
[PROOF STEP]
have st2dims0: "st2.dims0 = replicate (Suc (Suc k)) 2"
[PROOF STATE]
proof (prove)
using this:
{0..<Suc k} \<union> {Suc k} = {0..<Suc (Suc k)}

goal (1 subgoal):
 1. st2.dims0 = replicate (Suc (Suc k)) 2
[PROOF STEP]
unfolding st2.dims0_def st2.vars0_def
[PROOF STATE]
proof (prove)
using this:
{0..<Suc k} \<union> {Suc k} = {0..<Suc (Suc k)}

goal (1 subgoal):
 1. nths dims ({0..<Suc k} \<union> {Suc k}) = replicate (Suc (Suc k)) 2
[PROOF STEP]
using dims_nths_le_n[of "Suc (Suc k)"] Suc
[PROOF STATE]
proof (prove)
using this:
{0..<Suc k} \<union> {Suc k} = {0..<Suc (Suc k)}
Suc (Suc k) \<le> n \<Longrightarrow> nths dims {0..<Suc (Suc k)} = replicate (Suc (Suc k)) 2
k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0)
Suc k < n

goal (1 subgoal):
 1. nths dims ({0..<Suc k} \<union> {Suc k}) = replicate (Suc (Suc k)) 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st2.dims0 = replicate (Suc (Suc k)) 2

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
have "\<And>x. (x \<in> {0..<Suc k} \<Longrightarrow> {y \<in> {0..<Suc (Suc k)}. y < x} = {0..<x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<Suc k} \<Longrightarrow> {y \<in> {0..<Suc (Suc k)}. y < x} = {0..<x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x2 \<in> {0..<Suc k} \<Longrightarrow> {y \<in> {0..<Suc (Suc k)}. y < ?x2} = {0..<?x2}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x2 \<in> {0..<Suc k} \<Longrightarrow> {y \<in> {0..<Suc (Suc k)}. y < ?x2} = {0..<?x2}
[PROOF STEP]
have cardeq: "\<And>x. (x \<in> {0..<Suc k} \<Longrightarrow> card {y \<in> {0..<Suc (Suc k)}. y < x} = card {0..<x})"
[PROOF STATE]
proof (prove)
using this:
?x2 \<in> {0..<Suc k} \<Longrightarrow> {y \<in> {0..<Suc (Suc k)}. y < ?x2} = {0..<?x2}

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<Suc k} \<Longrightarrow> card {y \<in> {0..<Suc (Suc k)}. y < x} = card {0..<x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x2 \<in> {0..<Suc k} \<Longrightarrow> card {y \<in> {0..<Suc (Suc k)}. y < ?x2} = card {0..<?x2}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
have setcong: "\<And>g h I. (\<And>x. (x \<in> I \<Longrightarrow> g x = h x)) \<Longrightarrow> {g x | x. x \<in> I} = {h x | x. x \<in> I}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>g h I. (\<And>x. x \<in> I \<Longrightarrow> g x = h x) \<Longrightarrow> {g x |x. x \<in> I} = {h x |x. x \<in> I}
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(\<And>x. x \<in> ?I2 \<Longrightarrow> ?g2 x = ?h2 x) \<Longrightarrow> {?g2 x |x. x \<in> ?I2} = {?h2 x |x. x \<in> ?I2}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
have "{card {y \<in> {0..<Suc (Suc k)}. y < x} |x. x \<in> {0..<Suc k}} = {card {0..<x} |x. x \<in> {0..<Suc k}} "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {card {y \<in> {0..<Suc (Suc k)}. y < x} |x. x \<in> {0..<Suc k}} = {card {0..<x} |x. x \<in> {0..<Suc k}}
[PROOF STEP]
using setcong[OF cardeq, of "{0..<Suc k}"]
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> {0..<Suc k} \<Longrightarrow> ?x6 x \<in> {0..<Suc k}) \<Longrightarrow> {card {y \<in> {0..<Suc (Suc k)}. y < ?x6 x} |x. x \<in> {0..<Suc k}} = {card {0..<?x6 x} |x. x \<in> {0..<Suc k}}

goal (1 subgoal):
 1. {card {y \<in> {0..<Suc (Suc k)}. y < x} |x. x \<in> {0..<Suc k}} = {card {0..<x} |x. x \<in> {0..<Suc k}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{card {y \<in> {0..<Suc (Suc k)}. y < x} |x. x \<in> {0..<Suc k}} = {card {0..<x} |x. x \<in> {0..<Suc k}}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{card {y \<in> {0..<Suc (Suc k)}. y < x} |x. x \<in> {0..<Suc k}} = {card {0..<x} |x. x \<in> {0..<Suc k}}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
have "\<dots> = {0..<Suc k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {card {0..<x} |x. x \<in> {0..<Suc k}} = {0..<Suc k}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{card {0..<x} |x. x \<in> {0..<Suc k}} = {0..<Suc k}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
{card {y \<in> {0..<Suc (Suc k)}. y < x} |x. x \<in> {0..<Suc k}} = {0..<Suc k}
[PROOF STEP]
have st2vars1': "st2.vars1' = {0..<Suc k}"
[PROOF STATE]
proof (prove)
using this:
{card {y \<in> {0..<Suc (Suc k)}. y < x} |x. x \<in> {0..<Suc k}} = {0..<Suc k}

goal (1 subgoal):
 1. st2.vars1' = {0..<Suc k}
[PROOF STEP]
unfolding st2.vars1'_def st2.vars0_def splitset ind_in_set_def
[PROOF STATE]
proof (prove)
using this:
{card {y \<in> {0..<Suc (Suc k)}. y < x} |x. x \<in> {0..<Suc k}} = {0..<Suc k}

goal (1 subgoal):
 1. (\<lambda>x. card {i \<in> {0..<Suc (Suc k)}. i < x}) ` {0..<Suc k} = {0..<Suc k}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
st2.vars1' = {0..<Suc k}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
have st2pvsttv: "st2.ptensor_vec = st.tensor_vec"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. st2.ptensor_vec = st.tensor_vec
[PROOF STEP]
unfolding st2.ptensor_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partial_state.tensor_vec st2.dims0 st2.vars1' = st.tensor_vec
[PROOF STEP]
using st2dims0 st2vars1'
[PROOF STATE]
proof (prove)
using this:
st2.dims0 = replicate (Suc (Suc k)) 2
st2.vars1' = {0..<Suc k}

goal (1 subgoal):
 1. partial_state.tensor_vec st2.dims0 st2.vars1' = st.tensor_vec
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st2.ptensor_vec = st.tensor_vec

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
have "st.encode1 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. st.encode1 0 = 0
[PROOF STEP]
using encode1_replicate_2[of "Suc k" 0]
[PROOF STATE]
proof (prove)
using this:
st.encode1 0 = 0 mod 2 ^ Suc k

goal (1 subgoal):
 1. st.encode1 0 = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st.encode1 0 = 0

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
st.encode1 0 = 0

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
have "st.encode2 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. st.encode2 0 = 0
[PROOF STEP]
using encode2_replicate_2[of 0 "Suc k"]
[PROOF STATE]
proof (prove)
using this:
0 < 2 ^ Suc (Suc k) \<Longrightarrow> st.encode2 0 = 0 div 2 ^ Suc k

goal (1 subgoal):
 1. st.encode2 0 = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st.encode2 0 = 0

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
st.encode2 0 = 0

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
have  std: "st.d = 2^(Suc (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. st.d = 2 ^ Suc (Suc k)
[PROOF STEP]
unfolding st.d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (replicate (Suc (Suc k)) 2) = 2 ^ Suc (Suc k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st.d = 2 ^ Suc (Suc k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
st.encode1 0 = 0
st.encode2 0 = 0
st.d = 2 ^ Suc (Suc k)
[PROOF STEP]
have kzkk0: "ket_zero_k (Suc k) $ 0 = 1"
[PROOF STATE]
proof (prove)
using this:
st.encode1 0 = 0
st.encode2 0 = 0
st.d = 2 ^ Suc (Suc k)

goal (1 subgoal):
 1. ket_zero_k (Suc k) $ 0 = 1
[PROOF STEP]
unfolding ket_zero_k.simps st2pvsttv st.tensor_vec_def ket_zero_def
[PROOF STATE]
proof (prove)
using this:
st.encode1 0 = 0
st.encode2 0 = 0
st.d = 2 ^ Suc (Suc k)

goal (1 subgoal):
 1. Matrix.vec st.d (\<lambda>i. ket_zero_k k $ st.encode1 i * Matrix.vec 2 (\<lambda>k. if k = 0 then 1 else 0) $ st.encode2 i) $ 0 = 1
[PROOF STEP]
using kzkk
[PROOF STATE]
proof (prove)
using this:
st.encode1 0 = 0
st.encode2 0 = 0
st.d = 2 ^ Suc (Suc k)
ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0)

goal (1 subgoal):
 1. Matrix.vec st.d (\<lambda>i. ket_zero_k k $ st.encode1 i * Matrix.vec 2 (\<lambda>k. if k = 0 then 1 else 0) $ st.encode2 i) $ 0 = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ket_zero_k (Suc k) $ 0 = 1

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
have kzkki: "ket_zero_k (Suc k) $ i = 0" if ine0: "i \<noteq> 0" and ile: "i < 2^(Suc (Suc k))" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
proof (cases "i mod (2 ^ Suc k) \<noteq> 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
 2. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i mod 2 ^ Suc k \<noteq> 0

goal (2 subgoals):
 1. i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
 2. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i mod 2 ^ Suc k \<noteq> 0
[PROOF STEP]
have "ket_zero_k k $ st.encode1 i = 0"
[PROOF STATE]
proof (prove)
using this:
i mod 2 ^ Suc k \<noteq> 0

goal (1 subgoal):
 1. ket_zero_k k $ st.encode1 i = 0
[PROOF STEP]
unfolding kzkk
[PROOF STATE]
proof (prove)
using this:
i mod 2 ^ Suc k \<noteq> 0

goal (1 subgoal):
 1. Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0) $ st.encode1 i = 0
[PROOF STEP]
using encode1_replicate_2[of "Suc k" i] ile
[PROOF STATE]
proof (prove)
using this:
i mod 2 ^ Suc k \<noteq> 0
st.encode1 i = i mod 2 ^ Suc k
i < 2 ^ Suc (Suc k)

goal (1 subgoal):
 1. Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0) $ st.encode1 i = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ket_zero_k k $ st.encode1 i = 0

goal (2 subgoals):
 1. i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
 2. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ket_zero_k k $ st.encode1 i = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ket_zero_k k $ st.encode1 i = 0

goal (1 subgoal):
 1. ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
unfolding ket_zero_k.simps st2pvsttv st.tensor_vec_def ket_zero_def std
[PROOF STATE]
proof (prove)
using this:
ket_zero_k k $ st.encode1 i = 0

goal (1 subgoal):
 1. Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>i. ket_zero_k k $ st.encode1 i * Matrix.vec 2 (\<lambda>k. if k = 0 then 1 else 0) $ st.encode2 i) $ i = 0
[PROOF STEP]
using ile
[PROOF STATE]
proof (prove)
using this:
ket_zero_k k $ st.encode1 i = 0
i < 2 ^ Suc (Suc k)

goal (1 subgoal):
 1. Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>i. ket_zero_k k $ st.encode1 i * Matrix.vec 2 (\<lambda>k. if k = 0 then 1 else 0) $ st.encode2 i) $ i = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ket_zero_k (Suc k) $ i = 0

goal (1 subgoal):
 1. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> i mod 2 ^ Suc k \<noteq> 0

goal (1 subgoal):
 1. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
have "i div (2 ^ Suc k) \<noteq> 0 \<or> i mod (2 ^ Suc k) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i div 2 ^ Suc k \<noteq> 0 \<or> i mod 2 ^ Suc k \<noteq> 0
[PROOF STEP]
using ine0
[PROOF STATE]
proof (prove)
using this:
i \<noteq> 0

goal (1 subgoal):
 1. i div 2 ^ Suc k \<noteq> 0 \<or> i mod 2 ^ Suc k \<noteq> 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
i div 2 ^ Suc k \<noteq> 0 \<or> i mod 2 ^ Suc k \<noteq> 0

goal (1 subgoal):
 1. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i div 2 ^ Suc k \<noteq> 0 \<or> i mod 2 ^ Suc k \<noteq> 0
[PROOF STEP]
have "i div (2 ^ Suc k) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
i div 2 ^ Suc k \<noteq> 0 \<or> i mod 2 ^ Suc k \<noteq> 0

goal (1 subgoal):
 1. i div 2 ^ Suc k \<noteq> 0
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
i div 2 ^ Suc k \<noteq> 0 \<or> i mod 2 ^ Suc k \<noteq> 0
\<not> i mod 2 ^ Suc k \<noteq> 0

goal (1 subgoal):
 1. i div 2 ^ Suc k \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i div 2 ^ Suc k \<noteq> 0

goal (1 subgoal):
 1. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
i div 2 ^ Suc k \<noteq> 0

goal (1 subgoal):
 1. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
have "i div (2 ^ Suc k) < 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i div 2 ^ Suc k < 2
[PROOF STEP]
using ile less_mult_imp_div_less
[PROOF STATE]
proof (prove)
using this:
i < 2 ^ Suc (Suc k)
?m < ?i * ?n \<Longrightarrow> ?m div ?n < ?i

goal (1 subgoal):
 1. i div 2 ^ Suc k < 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i div 2 ^ Suc k < 2

goal (1 subgoal):
 1. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
i div 2 ^ Suc k \<noteq> 0
i div 2 ^ Suc k < 2
[PROOF STEP]
have "i div (2 ^ Suc k) = 1"
[PROOF STATE]
proof (prove)
using this:
i div 2 ^ Suc k \<noteq> 0
i div 2 ^ Suc k < 2

goal (1 subgoal):
 1. i div 2 ^ Suc k = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i div 2 ^ Suc k = 1

goal (1 subgoal):
 1. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i div 2 ^ Suc k = 1
[PROOF STEP]
have "st.encode2 i = 1"
[PROOF STATE]
proof (prove)
using this:
i div 2 ^ Suc k = 1

goal (1 subgoal):
 1. st.encode2 i = 1
[PROOF STEP]
using encode2_replicate_2[of i "Suc k"] ile
[PROOF STATE]
proof (prove)
using this:
i div 2 ^ Suc k = 1
i < 2 ^ Suc (Suc k) \<Longrightarrow> st.encode2 i = i div 2 ^ Suc k
i < 2 ^ Suc (Suc k)

goal (1 subgoal):
 1. st.encode2 i = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st.encode2 i = 1

goal (1 subgoal):
 1. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
st.encode2 i = 1
[PROOF STEP]
have "Matrix.vec 2 (\<lambda>k. if k = 0 then 1 else 0) $ st.encode2 i = 0"
[PROOF STATE]
proof (prove)
using this:
st.encode2 i = 1

goal (1 subgoal):
 1. Matrix.vec 2 (\<lambda>k. if k = 0 then 1::'a else (0::'a)) $ st.encode2 i = (0::'a)
[PROOF STEP]
unfolding kzkk
[PROOF STATE]
proof (prove)
using this:
st.encode2 i = 1

goal (1 subgoal):
 1. Matrix.vec 2 (\<lambda>k. if k = 0 then 1::'a else (0::'a)) $ st.encode2 i = (0::'a)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
Matrix.vec 2 (\<lambda>k. if k = 0 then 1::?'a5 else (0::?'a5)) $ st.encode2 i = (0::?'a5)

goal (1 subgoal):
 1. \<not> i mod 2 ^ Suc k \<noteq> 0 \<Longrightarrow> ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Matrix.vec 2 (\<lambda>k. if k = 0 then 1::?'a5 else (0::?'a5)) $ st.encode2 i = (0::?'a5)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Matrix.vec 2 (\<lambda>k. if k = 0 then 1::?'a5 else (0::?'a5)) $ st.encode2 i = (0::?'a5)

goal (1 subgoal):
 1. ket_zero_k (Suc k) $ i = 0
[PROOF STEP]
unfolding ket_zero_k.simps st2pvsttv st.tensor_vec_def ket_zero_def std
[PROOF STATE]
proof (prove)
using this:
Matrix.vec 2 (\<lambda>k. if k = 0 then 1::?'a5 else (0::?'a5)) $ st.encode2 i = (0::?'a5)

goal (1 subgoal):
 1. Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>i. ket_zero_k k $ st.encode1 i * Matrix.vec 2 (\<lambda>k. if k = 0 then 1 else 0) $ st.encode2 i) $ i = 0
[PROOF STEP]
using ile
[PROOF STATE]
proof (prove)
using this:
Matrix.vec 2 (\<lambda>k. if k = 0 then 1::?'a5 else (0::?'a5)) $ st.encode2 i = (0::?'a5)
i < 2 ^ Suc (Suc k)

goal (1 subgoal):
 1. Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>i. ket_zero_k k $ st.encode1 i * Matrix.vec 2 (\<lambda>k. if k = 0 then 1 else 0) $ st.encode2 i) $ i = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ket_zero_k (Suc k) $ i = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i4 \<noteq> 0; ?i4 < 2 ^ Suc (Suc k)\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) $ ?i4 = 0

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_zero_k k = Matrix.vec (2 ^ Suc k) (\<lambda>k. if k = 0 then 1 else 0); Suc k < n\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)
[PROOF STEP]
apply (rule eq_vecI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)) \<Longrightarrow> ket_zero_k (Suc k) $ i = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0) $ i
 2. dim_vec (ket_zero_k (Suc k)) = dim_vec (Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0))
[PROOF STEP]
subgoal for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_vec (Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)) \<Longrightarrow> ket_zero_k (Suc k) $ i = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0) $ i
[PROOF STEP]
using kzkk0 kzkki
[PROOF STATE]
proof (prove)
using this:
ket_zero_k (Suc k) $ 0 = 1
\<lbrakk>?i4 \<noteq> 0; ?i4 < 2 ^ Suc (Suc k)\<rbrakk> \<Longrightarrow> ket_zero_k (Suc k) $ ?i4 = 0

goal (1 subgoal):
 1. i < dim_vec (Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)) \<Longrightarrow> ket_zero_k (Suc k) $ i = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0) $ i
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (ket_zero_k (Suc k)) = dim_vec (Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0))
[PROOF STEP]
using carrier_vecD[OF dSk]
[PROOF STATE]
proof (prove)
using this:
dim_vec (ket_zero_k (Suc k)) = 2 ^ Suc (Suc k)

goal (1 subgoal):
 1. dim_vec (ket_zero_k (Suc k)) = dim_vec (Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ket_zero_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>k. if k = 0 then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_ffact_nat:
  fixes m :: nat
  shows "(\<Prod>i = 0..<n. m - i) = ffact n m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod ((-) m) {0..<n} = ffact n m
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
 2. \<not> ?P \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
[PROOF STEP]
assume "n \<le> m"
[PROOF STATE]
proof (state)
this:
n \<le> m

goal (2 subgoals):
 1. ?P \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
 2. \<not> ?P \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
[PROOF STEP]
have "inj_on (\<lambda>j. j - 1) {1..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>j. j - 1) {1..n}
[PROOF STEP]
by (force intro: inj_on_diff_nat)
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>j. j - 1) {1..n}

goal (2 subgoals):
 1. ?P \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
 2. \<not> ?P \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>j. j - 1) {1..n}

goal (2 subgoals):
 1. ?P \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
 2. \<not> ?P \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
[PROOF STEP]
have "{0..<n} = (\<lambda>j. j - 1) ` {1..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<n} = (\<lambda>j. j - 1) ` {1..n}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {0..<n} = (\<lambda>j. j - 1) ` {1..n}
[PROOF STEP]
have "i \<in> (\<lambda>j. j - 1) ` {1..n}" if "i \<in> {0..<n}" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> (\<lambda>j. j - 1) ` {1..n}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
i \<in> {0..<n}

goal (1 subgoal):
 1. i \<in> (\<lambda>j. j - 1) ` {1..n}
[PROOF STEP]
by (auto intro: image_eqI[where x="i + 1"])
[PROOF STATE]
proof (state)
this:
?i \<in> {0..<n} \<Longrightarrow> ?i \<in> (\<lambda>j. j - 1) ` {1..n}

goal (1 subgoal):
 1. {0..<n} = (\<lambda>j. j - 1) ` {1..n}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
?i \<in> {0..<n} \<Longrightarrow> ?i \<in> (\<lambda>j. j - 1) ` {1..n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?i \<in> {0..<n} \<Longrightarrow> ?i \<in> (\<lambda>j. j - 1) ` {1..n}

goal (1 subgoal):
 1. {0..<n} = (\<lambda>j. j - 1) ` {1..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<n} = (\<lambda>j. j - 1) ` {1..n}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{0..<n} = (\<lambda>j. j - 1) ` {1..n}

goal (2 subgoals):
 1. ?P \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
 2. \<not> ?P \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj_on (\<lambda>j. j - 1) {1..n}
{0..<n} = (\<lambda>j. j - 1) ` {1..n}
[PROOF STEP]
have "(\<Prod>i = 0..<n. m - i) = (\<Prod>i = 1..n. (m + 1) - i)"
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>j. j - 1) {1..n}
{0..<n} = (\<lambda>j. j - 1) ` {1..n}

goal (1 subgoal):
 1. prod ((-) m) {0..<n} = prod ((-) (m + 1)) {1..n}
[PROOF STEP]
by (auto intro: prod.reindex_cong[where l="\<lambda>i. i - 1"])
[PROOF STATE]
proof (state)
this:
prod ((-) m) {0..<n} = prod ((-) (m + 1)) {1..n}

goal (2 subgoals):
 1. ?P \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
 2. \<not> ?P \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
[PROOF STEP]
from this \<open>n \<le> m\<close>
[PROOF STATE]
proof (chain)
picking this:
prod ((-) m) {0..<n} = prod ((-) (m + 1)) {1..n}
n \<le> m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prod ((-) m) {0..<n} = prod ((-) (m + 1)) {1..n}
n \<le> m

goal (1 subgoal):
 1. prod ((-) m) {0..<n} = ffact n m
[PROOF STEP]
unfolding ffact_def
[PROOF STATE]
proof (prove)
using this:
prod ((-) m) {0..<n} = prod ((-) (m + 1)) {1..n}
n \<le> m

goal (1 subgoal):
 1. prod ((-) m) {0..<n} = pochhammer (m + 1 - of_nat n) n
[PROOF STEP]
by (simp add: pochhammer_prod_rev)
[PROOF STATE]
proof (state)
this:
prod ((-) m) {0..<n} = ffact n m

goal (1 subgoal):
 1. \<not> n \<le> m \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> n \<le> m \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
[PROOF STEP]
assume "\<not> n \<le> m"
[PROOF STATE]
proof (state)
this:
\<not> n \<le> m

goal (1 subgoal):
 1. \<not> n \<le> m \<Longrightarrow> prod ((-) m) {0..<n} = ffact n m
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<not> n \<le> m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> m

goal (1 subgoal):
 1. prod ((-) m) {0..<n} = ffact n m
[PROOF STEP]
by (auto simp add: ffact_nat_triv)
[PROOF STATE]
proof (state)
this:
prod ((-) m) {0..<n} = ffact n m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hermitian_mat_lim_is_hermitian:
  fixes X :: "nat \<Rightarrow> complex mat" and A :: "complex mat" and m :: nat
  assumes limX: "limit_mat X A m" and herX: "\<forall> n. hermitian (X n)"
  shows "hermitian A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitian A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. hermitian A
[PROOF STEP]
have  dimX: "\<forall>n. X n \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. X n \<in> carrier_mat m m
[PROOF STEP]
using limX
[PROOF STATE]
proof (prove)
using this:
limit_mat X A m

goal (1 subgoal):
 1. \<forall>n. X n \<in> carrier_mat m m
[PROOF STEP]
unfolding limit_mat_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. X n \<in> carrier_mat m m \<and> A \<in> carrier_mat m m \<and> (\<forall>i<m. \<forall>j<m. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j))

goal (1 subgoal):
 1. \<forall>n. X n \<in> carrier_mat m m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n. X n \<in> carrier_mat m m

goal (1 subgoal):
 1. hermitian A
[PROOF STEP]
have dimA : "A \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat m m
[PROOF STEP]
using limX
[PROOF STATE]
proof (prove)
using this:
limit_mat X A m

goal (1 subgoal):
 1. A \<in> carrier_mat m m
[PROOF STEP]
unfolding limit_mat_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. X n \<in> carrier_mat m m \<and> A \<in> carrier_mat m m \<and> (\<forall>i<m. \<forall>j<m. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j))

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

goal (1 subgoal):
 1. hermitian A
[PROOF STEP]
from herX
[PROOF STATE]
proof (chain)
picking this:
\<forall>n. hermitian (X n)
[PROOF STEP]
have herXn: "\<forall> n. adjoint (X n) = (X n)"
[PROOF STATE]
proof (prove)
using this:
\<forall>n. hermitian (X n)

goal (1 subgoal):
 1. \<forall>n. adjoint (X n) = X n
[PROOF STEP]
unfolding hermitian_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. adjoint (X n) = X n

goal (1 subgoal):
 1. \<forall>n. adjoint (X n) = X n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n. adjoint (X n) = X n

goal (1 subgoal):
 1. hermitian A
[PROOF STEP]
from limX
[PROOF STATE]
proof (chain)
picking this:
limit_mat X A m
[PROOF STEP]
have limXn: "\<forall>i<m. \<forall>j<m. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
limit_mat X A m

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)
[PROOF STEP]
unfolding limit_mat_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. X n \<in> carrier_mat m m \<and> A \<in> carrier_mat m m \<and> (\<forall>i<m. \<forall>j<m. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j))

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<forall>j<m. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)

goal (1 subgoal):
 1. hermitian A
[PROOF STEP]
have "\<forall>i<m. \<forall>j<m.(adjoint A)$$ (i, j) = A$$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
assume i: "i < m" and j: "j < m"
[PROOF STATE]
proof (state)
this:
i < m
j < m

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
have aij: "(adjoint A)$$ (i, j) = conjugate (A $$ (j,i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint A $$ (i, j) = conjugate (A $$ (j, i))
[PROOF STEP]
using adjoint_eval i j dimA
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < dim_col ?A; ?j < dim_row ?A\<rbrakk> \<Longrightarrow> adjoint ?A $$ (?i, ?j) = conjugate (?A $$ (?j, ?i))
i < m
j < m
A \<in> carrier_mat m m

goal (1 subgoal):
 1. adjoint A $$ (i, j) = conjugate (A $$ (j, i))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
adjoint A $$ (i, j) = conjugate (A $$ (j, i))

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
have ij: "(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)
[PROOF STEP]
using limXn i j
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<forall>j<m. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)
i < m
j < m

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
have ji: "(\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i)
[PROOF STEP]
using limXn i j
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<forall>j<m. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)
i < m
j < m

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i)

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i)
[PROOF STEP]
have "\<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i)

goal (1 subgoal):
 1. \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i) \<Longrightarrow> \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i) \<Longrightarrow> \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
fix r :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i) \<Longrightarrow> \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
assume r : "r > 0"
[PROOF STATE]
proof (state)
this:
0 < r

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i) \<Longrightarrow> \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
have "\<exists>no. \<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>no. \<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r
[PROOF STEP]
using ji r
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i)
0 < r

goal (1 subgoal):
 1. \<exists>no. \<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r
[PROOF STEP]
unfolding  LIMSEQ_def dist_norm
[PROOF STATE]
proof (prove)
using this:
\<forall>r>0. \<exists>no. \<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r
0 < r

goal (1 subgoal):
 1. \<exists>no. \<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i) \<Longrightarrow> \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>no. \<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r
[PROOF STEP]
obtain no where Xji: "\<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r"
[PROOF STATE]
proof (prove)
using this:
\<exists>no. \<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r

goal (1 subgoal):
 1. (\<And>no. \<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i) \<Longrightarrow> \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r
[PROOF STEP]
have "\<forall>n\<ge>no. cmod (conjugate (X n $$ (j, i) - A $$ (j, i))) < r"
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r

goal (1 subgoal):
 1. \<forall>n\<ge>no. cmod (conjugate (X n $$ (j, i) - A $$ (j, i))) < r
[PROOF STEP]
using complex_mod_cnj conjugate_complex_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>no. cmod (X n $$ (j, i) - A $$ (j, i)) < r
cmod (cnj ?z) = cmod ?z
conjugate \<equiv> cnj

goal (1 subgoal):
 1. \<forall>n\<ge>no. cmod (conjugate (X n $$ (j, i) - A $$ (j, i))) < r
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>no. cmod (conjugate (X n $$ (j, i) - A $$ (j, i))) < r

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i) \<Longrightarrow> \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n\<ge>no. cmod (conjugate (X n $$ (j, i) - A $$ (j, i))) < r
[PROOF STEP]
have "\<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r"
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>no. cmod (conjugate (X n $$ (j, i) - A $$ (j, i))) < r

goal (1 subgoal):
 1. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
unfolding dist_norm
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>no. cmod (conjugate (X n $$ (j, i) - A $$ (j, i))) < r

goal (1 subgoal):
 1. \<forall>n\<ge>no. cmod (conjugate (X n $$ (j, i)) - conjugate (A $$ (j, i))) < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i) \<Longrightarrow> \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
have "\<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r"
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r

goal (1 subgoal):
 1. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i) \<Longrightarrow> \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 < ?r2 \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < ?r2

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (j, i)) \<longlonglongrightarrow> A $$ (j, i) \<Longrightarrow> \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < ?r2 \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < ?r2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < ?r2 \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < ?r2

goal (1 subgoal):
 1. \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
have conjX: "(\<lambda>n. conjugate (X n $$ (j, i))) \<longlonglongrightarrow>  conjugate (A $$ (j, i))"
[PROOF STATE]
proof (prove)
using this:
\<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r

goal (1 subgoal):
 1. (\<lambda>n. conjugate (X n $$ (j, i))) \<longlonglongrightarrow> conjugate (A $$ (j, i))
[PROOF STEP]
unfolding LIMSEQ_def
[PROOF STATE]
proof (prove)
using this:
\<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r

goal (1 subgoal):
 1. \<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (conjugate (X n $$ (j, i))) (conjugate (A $$ (j, i))) < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. conjugate (X n $$ (j, i))) \<longlonglongrightarrow> conjugate (A $$ (j, i))

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
from herXn
[PROOF STATE]
proof (chain)
picking this:
\<forall>n. adjoint (X n) = X n
[PROOF STEP]
have "\<forall> n. conjugate (X n $$ (j,i)) = X n$$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
\<forall>n. adjoint (X n) = X n

goal (1 subgoal):
 1. \<forall>n. conjugate (X n $$ (j, i)) = X n $$ (i, j)
[PROOF STEP]
using adjoint_eval i j dimX
[PROOF STATE]
proof (prove)
using this:
\<forall>n. adjoint (X n) = X n
\<lbrakk>?i < dim_col ?A; ?j < dim_row ?A\<rbrakk> \<Longrightarrow> adjoint ?A $$ (?i, ?j) = conjugate (?A $$ (?j, ?i))
i < m
j < m
\<forall>n. X n \<in> carrier_mat m m

goal (1 subgoal):
 1. \<forall>n. conjugate (X n $$ (j, i)) = X n $$ (i, j)
[PROOF STEP]
by (metis adjoint_dim_col carrier_matD(1))
[PROOF STATE]
proof (state)
this:
\<forall>n. conjugate (X n $$ (j, i)) = X n $$ (i, j)

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n. conjugate (X n $$ (j, i)) = X n $$ (i, j)
[PROOF STEP]
have "(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow>  conjugate (A $$ (j, i))"
[PROOF STATE]
proof (prove)
using this:
\<forall>n. conjugate (X n $$ (j, i)) = X n $$ (i, j)

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> conjugate (A $$ (j, i))
[PROOF STEP]
using conjX
[PROOF STATE]
proof (prove)
using this:
\<forall>n. conjugate (X n $$ (j, i)) = X n $$ (i, j)
(\<lambda>n. conjugate (X n $$ (j, i))) \<longlonglongrightarrow> conjugate (A $$ (j, i))

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> conjugate (A $$ (j, i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> conjugate (A $$ (j, i))

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> conjugate (A $$ (j, i))
[PROOF STEP]
have "conjugate (A $$ (j,i)) = A$$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> conjugate (A $$ (j, i))

goal (1 subgoal):
 1. conjugate (A $$ (j, i)) = A $$ (i, j)
[PROOF STEP]
using ij
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> conjugate (A $$ (j, i))
(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)

goal (1 subgoal):
 1. conjugate (A $$ (j, i)) = A $$ (i, j)
[PROOF STEP]
by (simp add: LIMSEQ_unique)
[PROOF STATE]
proof (state)
this:
conjugate (A $$ (j, i)) = A $$ (i, j)

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
conjugate (A $$ (j, i)) = A $$ (i, j)
[PROOF STEP]
have "(adjoint A)$$ (i, j) = A$$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
conjugate (A $$ (j, i)) = A $$ (i, j)

goal (1 subgoal):
 1. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
using adjoint_eval i j
[PROOF STATE]
proof (prove)
using this:
conjugate (A $$ (j, i)) = A $$ (i, j)
\<lbrakk>?i < dim_col ?A; ?j < dim_row ?A\<rbrakk> \<Longrightarrow> adjoint ?A $$ (?i, ?j) = conjugate (?A $$ (?j, ?i))
i < m
j < m

goal (1 subgoal):
 1. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
by (simp add:aij)
[PROOF STATE]
proof (state)
this:
adjoint A $$ (i, j) = A $$ (i, j)

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i2 < m; ?j2 < m\<rbrakk> \<Longrightarrow> adjoint A $$ (?i2, ?j2) = A $$ (?i2, ?j2)

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?i2 < m; ?j2 < m\<rbrakk> \<Longrightarrow> adjoint A $$ (?i2, ?j2) = A $$ (?i2, ?j2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i2 < m; ?j2 < m\<rbrakk> \<Longrightarrow> adjoint A $$ (?i2, ?j2) = A $$ (?i2, ?j2)

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)

goal (1 subgoal):
 1. hermitian A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
[PROOF STEP]
have "hermitian A"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)

goal (1 subgoal):
 1. hermitian A
[PROOF STEP]
using hermitian_def dimA
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<forall>j<m. adjoint A $$ (i, j) = A $$ (i, j)
hermitian ?A = (adjoint ?A = ?A)
A \<in> carrier_mat m m

goal (1 subgoal):
 1. hermitian A
[PROOF STEP]
by (metis adjoint_dim carrier_matD(1) carrier_matD(2) eq_matI)
[PROOF STATE]
proof (state)
this:
hermitian A

goal (1 subgoal):
 1. hermitian A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hermitian A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hermitian A

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inter_line_comm_line:
  assumes "A \<noteq> B"
  shows "inter (line A B) (line C D) = inter (line B A) (line C D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.inter (line A B) (line C D) = local.inter (line B A) (line C D)
[PROOF STEP]
using assms line_comm
[PROOF STATE]
proof (prove)
using this:
A \<noteq> B
?P \<noteq> ?Q \<Longrightarrow> line ?P ?Q = line ?Q ?P

goal (1 subgoal):
 1. local.inter (line A B) (line C D) = local.inter (line B A) (line C D)
[PROOF STEP]
by auto


[STATEMENT]
lemma ilist_i_drop_eq_conv: "(f = g) = (\<forall>n. f \<Up> n = g \<Up> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f = g) = (\<forall>n. f \<Up> n = g \<Up> n)
[PROOF STEP]
apply (rule iffI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. f \<Up> n = g \<Up> n \<Longrightarrow> f = g
[PROOF STEP]
apply (drule_tac x=0 in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<Up> 0 = g \<Up> 0 \<Longrightarrow> f = g
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma one_dim_iso_adjoint[simp]: \<open>cadjoint one_dim_iso = one_dim_iso\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. one_dim_iso\<^sup>\<dagger> = one_dim_iso
[PROOF STEP]
apply (rule cadjoint_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. one_dim_iso x \<bullet>\<^sub>C y = x \<bullet>\<^sub>C one_dim_iso y
[PROOF STEP]
by (simp add: one_dim_iso_def of_complex_def)


[STATEMENT]
lemma continuous_on_max[continuous_intros]:
  fixes f :: "_ \<Rightarrow> 'a::linorder_topology"
  shows "continuous_on S f \<Longrightarrow> continuous_on S g \<Longrightarrow> continuous_on S (\<lambda>x. max (f x) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on S f; continuous_on S g\<rbrakk> \<Longrightarrow> continuous_on S (\<lambda>x. max (f x) (g x))
[PROOF STEP]
by (auto simp: continuous_on_def intro: tendsto_max)


[STATEMENT]
lemma list_all2_append1:
  "list_all2 P (xs @ ys) zs =
  (\<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and>
    list_all2 P xs us \<and> list_all2 P ys vs)" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 P (xs @ ys) zs = (\<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. list_all2 P (xs @ ys) zs \<Longrightarrow> \<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs
 2. \<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs \<Longrightarrow> list_all2 P (xs @ ys) zs
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
list_all2 P (xs @ ys) zs

goal (2 subgoals):
 1. list_all2 P (xs @ ys) zs \<Longrightarrow> \<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs
 2. \<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs \<Longrightarrow> list_all2 P (xs @ ys) zs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
list_all2 P (xs @ ys) zs
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
list_all2 P (xs @ ys) zs

goal (1 subgoal):
 1. \<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs
[PROOF STEP]
apply (rule_tac x = "take (length xs) zs" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 P (xs @ ys) zs \<Longrightarrow> \<exists>vs. zs = take (length xs) zs @ vs \<and> length (take (length xs) zs) = length xs \<and> length vs = length ys \<and> list_all2 P xs (take (length xs) zs) \<and> list_all2 P ys vs
[PROOF STEP]
apply (rule_tac x = "drop (length xs) zs" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 P (xs @ ys) zs \<Longrightarrow> zs = take (length xs) zs @ drop (length xs) zs \<and> length (take (length xs) zs) = length xs \<and> length (drop (length xs) zs) = length ys \<and> list_all2 P xs (take (length xs) zs) \<and> list_all2 P ys (drop (length xs) zs)
[PROOF STEP]
apply (force split: nat_diff_split simp add: list_all2_iff zip_append1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs

goal (1 subgoal):
 1. \<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs \<Longrightarrow> list_all2 P (xs @ ys) zs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs \<Longrightarrow> list_all2 P (xs @ ys) zs
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
\<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs

goal (1 subgoal):
 1. \<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs \<Longrightarrow> list_all2 P (xs @ ys) zs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
\<exists>us vs. zs = us @ vs \<and> length us = length xs \<and> length vs = length ys \<and> list_all2 P xs us \<and> list_all2 P ys vs

goal (1 subgoal):
 1. list_all2 P (xs @ ys) zs
[PROOF STEP]
by (auto simp add: list_all2_iff)
[PROOF STATE]
proof (state)
this:
list_all2 P (xs @ ys) zs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measurable_distr_prob_space:
  assumes f: "f \<in> M \<rightarrow>\<^sub>M N"
  shows "(\<lambda>M'. distr M' N f) \<in> prob_algebra M \<rightarrow>\<^sub>M prob_algebra N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>M'. distr M' N f) \<in> prob_algebra M \<rightarrow>\<^sub>M prob_algebra N
[PROOF STEP]
unfolding prob_algebra_def measurable_restrict_space2_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>M'. distr M' N f) \<in> restrict_space (subprob_algebra M) (Collect prob_space) \<rightarrow>\<^sub>M subprob_algebra N \<and> (\<lambda>M'. distr M' N f) \<in> space (restrict_space (subprob_algebra M) (Collect prob_space)) \<rightarrow> Collect prob_space
[PROOF STEP]
proof (intro conjI measurable_restrict_space1 measurable_distr f)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>M'. distr M' N f) \<in> space (restrict_space (subprob_algebra M) (Collect prob_space)) \<rightarrow> Collect prob_space
[PROOF STEP]
show "(\<lambda>M'. distr M' N f) \<in> space (restrict_space (subprob_algebra M) (Collect prob_space)) \<rightarrow> Collect prob_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>M'. distr M' N f) \<in> space (restrict_space (subprob_algebra M) (Collect prob_space)) \<rightarrow> Collect prob_space
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
f \<in> M \<rightarrow>\<^sub>M N

goal (1 subgoal):
 1. (\<lambda>M'. distr M' N f) \<in> space (restrict_space (subprob_algebra M) (Collect prob_space)) \<rightarrow> Collect prob_space
[PROOF STEP]
by (auto simp: space_restrict_space space_subprob_algebra intro!: prob_space.prob_space_distr)
[PROOF STATE]
proof (state)
this:
(\<lambda>M'. distr M' N f) \<in> space (restrict_space (subprob_algebra M) (Collect prob_space)) \<rightarrow> Collect prob_space

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma max_ext_eq [code]:
  "max_ext R = {(X, Y). finite X \<and> finite Y \<and> Y \<noteq> {} \<and> (\<forall>x. x \<in> X \<longrightarrow> (\<exists>xa \<in> Y. (x, xa) \<in> R))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_ext R = {(X, Y). finite X \<and> finite Y \<and> Y \<noteq> {} \<and> (\<forall>x. x \<in> X \<longrightarrow> (\<exists>xa\<in>Y. (x, xa) \<in> R))}
[PROOF STEP]
by (auto simp add: max_ext.simps)


[STATEMENT]
lemma analz_insert_Nonce [simp]:
     "analz (insert (Nonce N) H) = insert (Nonce N) (analz H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. analz (insert (Nonce N) H) = insert (Nonce N) (analz H)
[PROOF STEP]
apply (rule analz_insert_eq_I)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> analz (insert (Nonce N) H) \<Longrightarrow> x \<in> insert (Nonce N) (analz H)
[PROOF STEP]
apply (erule analz.induct, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma op_ntcf_ntcf_0: "op_ntcf (ntcf_0 \<CC>) = ntcf_0 (op_cat \<CC>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_ntcf (ntcf_0 \<CC>) = ntcf_0 (op_cat \<CC>)
[PROOF STEP]
by
    (
      simp_all add:
        op_ntcf_def ntcf_0_def op_cat_def op_cf_cf_0 cat_0_def
        nt_field_simps dg_field_simps nat_omega_simps
    )


[STATEMENT]
lemma disjunct_set_mset_diff:
  assumes "M \<inter># N = {#}"
  shows "set_mset (M - N) = set_mset M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_mset (M - N) = set_mset M
[PROOF STEP]
proof (rule set_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (x \<in># M - N) = (x \<in># M)
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (x \<in># M - N) = (x \<in># M)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
M \<inter># N = {#}
[PROOF STEP]
have "a \<notin># M \<or> a \<notin># N"
[PROOF STATE]
proof (prove)
using this:
M \<inter># N = {#}

goal (1 subgoal):
 1. a \<notin># M \<or> a \<notin># N
[PROOF STEP]
by (simp add: disjunct_not_in)
[PROOF STATE]
proof (state)
this:
a \<notin># M \<or> a \<notin># N

goal (1 subgoal):
 1. \<And>x. (x \<in># M - N) = (x \<in># M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<notin># M \<or> a \<notin># N
[PROOF STEP]
show "a \<in># M - N \<longleftrightarrow> a \<in># M"
[PROOF STATE]
proof (prove)
using this:
a \<notin># M \<or> a \<notin># N

goal (1 subgoal):
 1. (a \<in># M - N) = (a \<in># M)
[PROOF STEP]
by (auto dest: in_diffD) (simp add: in_diff_count not_in_iff)
[PROOF STATE]
proof (state)
this:
(a \<in># M - N) = (a \<in># M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fmrel_on_fset_fmdom:
  "fmrel_on_fset (fmdom ym) f xm ym \<Longrightarrow>
   k |\<in>| fmdom ym \<Longrightarrow>
   k |\<in>| fmdom xm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fmrel_on_fset (fmdom ym) f xm ym; k |\<in>| fmdom ym\<rbrakk> \<Longrightarrow> k |\<in>| fmdom xm
[PROOF STEP]
by (metis fmdom_notD fmdom_notI fmrel_on_fsetD option.rel_sel)


[STATEMENT]
lemma ce_rel_to_set_inj: "inj ce_rel_to_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj ce_rel_to_set
[PROOF STEP]
proof (rule inj_on_inverseI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> ?g (ce_rel_to_set x) = x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> ?g (ce_rel_to_set x) = x
[PROOF STEP]
assume A: "(x::(nat\<times>nat) set) \<in> UNIV"
[PROOF STATE]
proof (state)
this:
x \<in> UNIV

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> ?g (ce_rel_to_set x) = x
[PROOF STEP]
show "ce_set_to_rel (ce_rel_to_set x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ce_set_to_rel (ce_rel_to_set x) = x
[PROOF STEP]
by (rule ce_rel_lm_1)
[PROOF STATE]
proof (state)
this:
ce_set_to_rel (ce_rel_to_set x) = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem rec2: "rec2 s1 s2 (ctor2 x) = s2 (F2map id (<id, rec1 s1 s2>) (<id, rec2 s1 s2>) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec2 s1 s2 (ctor2 x) = s2 (F2map id <id , rec1 s1 s2> <id , rec2 s1 s2> x)
[PROOF STEP]
unfolding rec1_def rec2_def o_apply fold2 snd_convol'
    convol_expand_snd[OF fst_rec1_pair] convol_expand_snd[OF fst_rec2_pair]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s2 (F2map id (fold1 <\<lambda>x. ctor1 (F1map id fst fst x) , s1> <\<lambda>x. ctor2 (F2map id fst fst x) , s2>) (fold2 <\<lambda>x. ctor1 (F1map id fst fst x) , s1> <\<lambda>x. ctor2 (F2map id fst fst x) , s2>) x) = s2 (F2map id (fold1 <\<lambda>x. ctor1 (F1map id fst fst x) , s1> <\<lambda>x. ctor2 (F2map id fst fst x) , s2>) (fold2 <\<lambda>x. ctor1 (F1map id fst fst x) , s1> <\<lambda>x. ctor2 (F2map id fst fst x) , s2>) x)
[PROOF STEP]
..


[STATEMENT]
lemma Finite_completion:
     "[| finite I;
         !!i. i \<in> I ==> F \<in> (A i) LeadsTo (A' i \<union> C);
         !!i. i \<in> I ==> F \<in> (A' i) Co (A' i \<union> C) |]
      ==> F \<in> (\<Inter>i \<in> I. A i) LeadsTo ((\<Inter>i \<in> I. A' i) \<union> C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<And>i. i \<in> I \<Longrightarrow> F \<in> A i \<longmapsto>w A' i \<union> C; \<And>i. i \<in> I \<Longrightarrow> F \<in> A' i Co A' i \<union> C\<rbrakk> \<Longrightarrow> F \<in> \<Inter> (A ` I) \<longmapsto>w \<Inter> (A' ` I) \<union> C
[PROOF STEP]
by (blast intro: Finite_completion_lemma [THEN mp, THEN mp])


[STATEMENT]
lemma bi_unique_HMA_I [transfer_rule]: "bi_unique HMA_I" "left_unique HMA_I" "right_unique HMA_I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bi_unique HMA_I &&& left_unique HMA_I &&& right_unique HMA_I
[PROOF STEP]
unfolding HMA_I_def bi_unique_def left_unique_def right_unique_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y z. x = Bij_Nat.to_nat y \<longrightarrow> x = Bij_Nat.to_nat z \<longrightarrow> y = z) \<and> (\<forall>x y z. x = Bij_Nat.to_nat z \<longrightarrow> y = Bij_Nat.to_nat z \<longrightarrow> x = y) &&& \<forall>x y z. x = Bij_Nat.to_nat z \<longrightarrow> y = Bij_Nat.to_nat z \<longrightarrow> x = y &&& \<forall>x y z. x = Bij_Nat.to_nat y \<longrightarrow> x = Bij_Nat.to_nat z \<longrightarrow> y = z
[PROOF STEP]
by auto


[STATEMENT]
lemma norm_M: "(vector2_append1 v) \<bullet> (M *v vector2_append1 v) = (norm v)\<^sup>2 - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector2_append1 v \<bullet> (M *v vector2_append1 v) = (norm v)\<^sup>2 - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vector2_append1 v \<bullet> (M *v vector2_append1 v) = (norm v)\<^sup>2 - 1
[PROOF STEP]
have "(norm v)\<^sup>2 = (v$1)\<^sup>2 + (v$2)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm v)\<^sup>2 = (v $ 1)\<^sup>2 + (v $ 2)\<^sup>2
[PROOF STEP]
unfolding norm_vec_def
      and L2_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sqrt (\<Sum>i\<in>UNIV. (norm (v $ i))\<^sup>2))\<^sup>2 = (v $ 1)\<^sup>2 + (v $ 2)\<^sup>2
[PROOF STEP]
by (simp add: sum_2)
[PROOF STATE]
proof (state)
this:
(norm v)\<^sup>2 = (v $ 1)\<^sup>2 + (v $ 2)\<^sup>2

goal (1 subgoal):
 1. vector2_append1 v \<bullet> (M *v vector2_append1 v) = (norm v)\<^sup>2 - 1
[PROOF STEP]
thus "(vector2_append1 v) \<bullet> (M *v vector2_append1 v) = (norm v)\<^sup>2 - 1"
[PROOF STATE]
proof (prove)
using this:
(norm v)\<^sup>2 = (v $ 1)\<^sup>2 + (v $ 2)\<^sup>2

goal (1 subgoal):
 1. vector2_append1 v \<bullet> (M *v vector2_append1 v) = (norm v)\<^sup>2 - 1
[PROOF STEP]
unfolding vector2_append1_def
      and inner_vec_def
      and matrix_vector_mult_def
      and vector_def
      and M_def
      and power2_norm_eq_inner
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>UNIV. v $ i \<bullet> v $ i) = (v $ 1)\<^sup>2 + (v $ 2)\<^sup>2

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [v $ 1, v $ 2, 1] (\<lambda>n x. 0) 1) $ i \<bullet> (\<chi>i. \<Sum>j\<in>UNIV. vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [1, 0, 0] (\<lambda>n x. 0) 1), vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [0, 1, 0] (\<lambda>n x. 0) 1), vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [0, 0, - 1] (\<lambda>n x. 0) 1)] (\<lambda>n x. 0) 1) $ i $ j * vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [v $ 1, v $ 2, 1] (\<lambda>n x. 0) 1) $ j) $ i) = (\<Sum>i\<in>UNIV. v $ i \<bullet> v $ i) - 1
[PROOF STEP]
by (simp add: sum_3 power2_eq_square)
[PROOF STATE]
proof (state)
this:
vector2_append1 v \<bullet> (M *v vector2_append1 v) = (norm v)\<^sup>2 - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "uGraph_from_list_invar L \<Longrightarrow>
  <emp> kruskal_algo L
     <\<lambda>F. \<up> (uGraph_from_list_invar F \<and> set F \<subseteq> set L \<and>
       uGraph.spanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_edges F)
      \<and> (\<forall>F'. uGraph.spanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_edges F')
          \<longrightarrow> set F' \<subseteq> set L \<longrightarrow>  sum (\<lambda>(u,w,v). w) (set F) \<le> sum (\<lambda>(u,w,v). w) (set F')))>\<^sub>t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uGraph_from_list_invar L \<Longrightarrow> <emp> kruskal_algo L <\<lambda>r. \<up> (uGraph_from_list_invar r \<and> set r \<subseteq> set L \<and> uGraph.spanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_edges r) \<and> (\<forall>F'. uGraph.spanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_edges F') \<longrightarrow> set F' \<subseteq> set L \<longrightarrow> (\<Sum>(u, w, v)\<in>set r. w) \<le> (\<Sum>(u, w, v)\<in>set F'. w)))>\<^sub>t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uGraph_from_list_invar L \<Longrightarrow> <emp> kruskal_algo L <\<lambda>r. \<up> (uGraph_from_list_invar r \<and> set r \<subseteq> set L \<and> uGraph.spanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_edges r) \<and> (\<forall>F'. uGraph.spanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_edges F') \<longrightarrow> set F' \<subseteq> set L \<longrightarrow> (\<Sum>(u, w, v)\<in>set r. w) \<le> (\<Sum>(u, w, v)\<in>set F'. w)))>\<^sub>t
[PROOF STEP]
assume a: "uGraph_from_list_invar L"
[PROOF STATE]
proof (state)
this:
uGraph_from_list_invar L

goal (1 subgoal):
 1. uGraph_from_list_invar L \<Longrightarrow> <emp> kruskal_algo L <\<lambda>r. \<up> (uGraph_from_list_invar r \<and> set r \<subseteq> set L \<and> uGraph.spanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_edges r) \<and> (\<forall>F'. uGraph.spanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_edges F') \<longrightarrow> set F' \<subseteq> set L \<longrightarrow> (\<Sum>(u, w, v)\<in>set r. w) \<le> (\<Sum>(u, w, v)\<in>set F'. w)))>\<^sub>t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
uGraph_from_list_invar L
[PROOF STEP]
interpret fromlist L
[PROOF STATE]
proof (prove)
using this:
uGraph_from_list_invar L

goal (1 subgoal):
 1. fromlist L
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. uGraph_from_list_invar L \<Longrightarrow> distinct (map \<alpha> L)
 2. uGraph_from_list_invar L \<Longrightarrow> \<forall>u w v. (u, w, v) \<in> set L \<longrightarrow> u \<noteq> v
[PROOF STEP]
by (auto simp: uGraph_from_list_invar_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uGraph_from_list_invar L \<Longrightarrow> <emp> kruskal_algo L <\<lambda>r. \<up> (uGraph_from_list_invar r \<and> set r \<subseteq> set L \<and> spanningForest (uGraph_from_list_\<alpha>_edges r) \<and> (\<forall>F'. spanningForest (uGraph_from_list_\<alpha>_edges F') \<longrightarrow> set F' \<subseteq> set L \<longrightarrow> (\<Sum>(u, w, v)\<in>set r. w) \<le> (\<Sum>(u, w, v)\<in>set F'. w)))>\<^sub>t
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
uGraph_from_list_invar L
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
uGraph_from_list_invar L

goal (1 subgoal):
 1. <emp> kruskal_algo L <\<lambda>r. \<up> (uGraph_from_list_invar r \<and> set r \<subseteq> set L \<and> spanningForest (uGraph_from_list_\<alpha>_edges r) \<and> (\<forall>F'. spanningForest (uGraph_from_list_\<alpha>_edges F') \<longrightarrow> set F' \<subseteq> set L \<longrightarrow> (\<Sum>(u, w, v)\<in>set r. w) \<le> (\<Sum>(u, w, v)\<in>set F'. w)))>\<^sub>t
[PROOF STEP]
by(sep_auto heap: corr simp: minSpanningForest_def sum_easier)
[PROOF STATE]
proof (state)
this:
<emp> kruskal_algo L <\<lambda>r. \<up> (uGraph_from_list_invar r \<and> set r \<subseteq> set L \<and> spanningForest (uGraph_from_list_\<alpha>_edges r) \<and> (\<forall>F'. spanningForest (uGraph_from_list_\<alpha>_edges F') \<longrightarrow> set F' \<subseteq> set L \<longrightarrow> (\<Sum>(u, w, v)\<in>set r. w) \<le> (\<Sum>(u, w, v)\<in>set F'. w)))>\<^sub>t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Pring_mult_rdistr:
  assumes "a \<in> carrier (Pring R I)"
  assumes "b \<in> carrier (Pring R I)"
  assumes "c \<in> carrier (Pring R I)"
  shows "a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = (a \<otimes>\<^bsub>Pring R I\<^esub> b) \<oplus>\<^bsub>Pring R I\<^esub> (a \<otimes>\<^bsub>Pring R I\<^esub> c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> a \<otimes>\<^bsub>Pring R I\<^esub> c
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> a \<otimes>\<^bsub>Pring R I\<^esub> c
[PROOF STEP]
have "a \<Otimes>\<^sub>p (b \<Oplus> c) = a \<Otimes>\<^sub>p b \<Oplus> (a \<Otimes>\<^sub>p c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<Otimes>\<^sub>p (b \<Oplus> c) = a \<Otimes>\<^sub>p b \<Oplus> (a \<Otimes>\<^sub>p c)
[PROOF STEP]
using P_ring_rdistr[of a b c]
        assms Pring_carrier_coeff
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>carrier_coeff a; carrier_coeff b; carrier_coeff c\<rbrakk> \<Longrightarrow> a \<Otimes>\<^sub>p (b \<Oplus> c) = a \<Otimes>\<^sub>p b \<Oplus> (a \<Otimes>\<^sub>p c)
a \<in> carrier (Pring R I)
b \<in> carrier (Pring R I)
c \<in> carrier (Pring R I)
?a \<in> carrier (Pring R ?I) \<Longrightarrow> carrier_coeff ?a

goal (1 subgoal):
 1. a \<Otimes>\<^sub>p (b \<Oplus> c) = a \<Otimes>\<^sub>p b \<Oplus> (a \<Otimes>\<^sub>p c)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
a \<Otimes>\<^sub>p (b \<Oplus> c) = a \<Otimes>\<^sub>p b \<Oplus> (a \<Otimes>\<^sub>p c)

goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> a \<otimes>\<^bsub>Pring R I\<^esub> c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<Otimes>\<^sub>p (b \<Oplus> c) = a \<Otimes>\<^sub>p b \<Oplus> (a \<Otimes>\<^sub>p c)
[PROOF STEP]
have "a \<Otimes>\<^sub>p (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)"
[PROOF STATE]
proof (prove)
using this:
a \<Otimes>\<^sub>p (b \<Oplus> c) = a \<Otimes>\<^sub>p b \<Oplus> (a \<Otimes>\<^sub>p c)

goal (1 subgoal):
 1. a \<Otimes>\<^sub>p (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)
[PROOF STEP]
using       Pring_add[of I b c] Pring_add[of I "a \<Otimes>\<^sub>p b" "a \<Otimes>\<^sub>p c"]
[PROOF STATE]
proof (prove)
using this:
a \<Otimes>\<^sub>p (b \<Oplus> c) = a \<Otimes>\<^sub>p b \<Oplus> (a \<Otimes>\<^sub>p c)
b \<oplus>\<^bsub>Pring R I\<^esub> c = b \<Oplus> c
a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c) = a \<Otimes>\<^sub>p b \<Oplus> (a \<Otimes>\<^sub>p c)

goal (1 subgoal):
 1. a \<Otimes>\<^sub>p (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<Otimes>\<^sub>p (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)

goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> a \<otimes>\<^bsub>Pring R I\<^esub> c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<Otimes>\<^sub>p (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)
[PROOF STEP]
have "a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = (a \<Otimes>\<^sub>p b) \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)"
[PROOF STATE]
proof (prove)
using this:
a \<Otimes>\<^sub>p (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)

goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)
[PROOF STEP]
using  Pring_mult[of I a "(b \<oplus>\<^bsub>Pring R I\<^esub> c)"]
[PROOF STATE]
proof (prove)
using this:
a \<Otimes>\<^sub>p (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)
a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p (b \<oplus>\<^bsub>Pring R I\<^esub> c)

goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)

goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> a \<otimes>\<^bsub>Pring R I\<^esub> c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)
[PROOF STEP]
have "a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = (a \<otimes>\<^bsub>Pring R I\<^esub> b) \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)"
[PROOF STATE]
proof (prove)
using this:
a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)

goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)
[PROOF STEP]
using Pring_mult[of I a b]
[PROOF STATE]
proof (prove)
using this:
a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<Otimes>\<^sub>p b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)
a \<otimes>\<^bsub>Pring R I\<^esub> b = a \<Otimes>\<^sub>p b

goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)

goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> a \<otimes>\<^bsub>Pring R I\<^esub> c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)

goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> a \<otimes>\<^bsub>Pring R I\<^esub> c
[PROOF STEP]
using Pring_mult[of I a c]
[PROOF STATE]
proof (prove)
using this:
a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> (a \<Otimes>\<^sub>p c)
a \<otimes>\<^bsub>Pring R I\<^esub> c = a \<Otimes>\<^sub>p c

goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> a \<otimes>\<^bsub>Pring R I\<^esub> c
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
a \<otimes>\<^bsub>Pring R I\<^esub> (b \<oplus>\<^bsub>Pring R I\<^esub> c) = a \<otimes>\<^bsub>Pring R I\<^esub> b \<oplus>\<^bsub>Pring R I\<^esub> a \<otimes>\<^bsub>Pring R I\<^esub> c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem I_valid: "valid Iaxiom"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid Iaxiom
[PROOF STEP]
apply(unfold Iaxiom_def valid_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>I \<nu>. is_interp I \<longrightarrow> \<nu> \<in> fml_sem I (([[$\<alpha> vid1**]]Pc pid1 \<rightarrow> [[$\<alpha> vid1]]Pc pid1) \<rightarrow> Pc pid1 \<rightarrow> [[$\<alpha> vid1**]]Pc pid1)
[PROOF STEP]
apply(rule impI | rule allI)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>I \<nu>. is_interp I \<Longrightarrow> \<nu> \<in> fml_sem I (([[$\<alpha> vid1**]]Pc pid1 \<rightarrow> [[$\<alpha> vid1]]Pc pid1) \<rightarrow> Pc pid1 \<rightarrow> [[$\<alpha> vid1**]]Pc pid1)
[PROOF STEP]
apply(simp only: impl_sem)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>I \<nu>. is_interp I \<Longrightarrow> \<nu> \<in> fml_sem I ([[$\<alpha> vid1**]]Pc pid1 \<rightarrow> [[$\<alpha> vid1]]Pc pid1) \<longrightarrow> \<nu> \<in> fml_sem I (Pc pid1) \<longrightarrow> \<nu> \<in> fml_sem I ([[$\<alpha> vid1**]]Pc pid1)
[PROOF STEP]
using I_axiom_lemma
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_interp ?I; ?\<nu> \<in> fml_sem ?I ([[$\<alpha> vid1**]]Pc pid1 \<rightarrow> [[$\<alpha> vid1]]Pc pid1); ?\<nu> \<in> fml_sem ?I (Pc pid1)\<rbrakk> \<Longrightarrow> ?\<nu> \<in> fml_sem ?I ([[$\<alpha> vid1**]]Pc pid1)

goal (1 subgoal):
 1. \<And>I \<nu>. is_interp I \<Longrightarrow> \<nu> \<in> fml_sem I ([[$\<alpha> vid1**]]Pc pid1 \<rightarrow> [[$\<alpha> vid1]]Pc pid1) \<longrightarrow> \<nu> \<in> fml_sem I (Pc pid1) \<longrightarrow> \<nu> \<in> fml_sem I ([[$\<alpha> vid1**]]Pc pid1)
[PROOF STEP]
by blast


[STATEMENT]
lemma path_components_of_subset_singleton:
  "path_components_of X \<subseteq> {S} \<longleftrightarrow>
        path_connected_space X \<and> (topspace X = {} \<or> topspace X = S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
proof (cases "topspace X = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. topspace X = {} \<Longrightarrow> (path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))
 2. topspace X \<noteq> {} \<Longrightarrow> (path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
topspace X = {}

goal (2 subgoals):
 1. topspace X = {} \<Longrightarrow> (path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))
 2. topspace X \<noteq> {} \<Longrightarrow> (path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace X = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
topspace X = {}

goal (1 subgoal):
 1. (path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
by (auto simp: path_components_of_empty_space path_connected_space_topspace_empty)
[PROOF STATE]
proof (state)
this:
(path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))

goal (1 subgoal):
 1. topspace X \<noteq> {} \<Longrightarrow> (path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. topspace X \<noteq> {} \<Longrightarrow> (path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
topspace X \<noteq> {}

goal (1 subgoal):
 1. topspace X \<noteq> {} \<Longrightarrow> (path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
have "(path_components_of X = {S}) \<longleftrightarrow> (path_connected_space X \<and> topspace X = S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (path_components_of X = {S}) = (path_connected_space X \<and> topspace X = S)
[PROOF STEP]
proof (intro iffI conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. path_components_of X = {S} \<Longrightarrow> path_connected_space X
 2. path_components_of X = {S} \<Longrightarrow> topspace X = S
 3. path_connected_space X \<and> topspace X = S \<Longrightarrow> path_components_of X = {S}
[PROOF STEP]
assume L: "path_components_of X = {S}"
[PROOF STATE]
proof (state)
this:
path_components_of X = {S}

goal (3 subgoals):
 1. path_components_of X = {S} \<Longrightarrow> path_connected_space X
 2. path_components_of X = {S} \<Longrightarrow> topspace X = S
 3. path_connected_space X \<and> topspace X = S \<Longrightarrow> path_components_of X = {S}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path_components_of X = {S}
[PROOF STEP]
show "path_connected_space X"
[PROOF STATE]
proof (prove)
using this:
path_components_of X = {S}

goal (1 subgoal):
 1. path_connected_space X
[PROOF STEP]
by (simp add: path_connected_space_iff_components_eq)
[PROOF STATE]
proof (state)
this:
path_connected_space X

goal (2 subgoals):
 1. path_components_of X = {S} \<Longrightarrow> topspace X = S
 2. path_connected_space X \<and> topspace X = S \<Longrightarrow> path_components_of X = {S}
[PROOF STEP]
show "topspace X = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topspace X = S
[PROOF STEP]
by (metis L ccpo_Sup_singleton [of S] Union_path_components_of)
[PROOF STATE]
proof (state)
this:
topspace X = S

goal (1 subgoal):
 1. path_connected_space X \<and> topspace X = S \<Longrightarrow> path_components_of X = {S}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. path_connected_space X \<and> topspace X = S \<Longrightarrow> path_components_of X = {S}
[PROOF STEP]
assume R: "path_connected_space X \<and> topspace X = S"
[PROOF STATE]
proof (state)
this:
path_connected_space X \<and> topspace X = S

goal (1 subgoal):
 1. path_connected_space X \<and> topspace X = S \<Longrightarrow> path_components_of X = {S}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path_connected_space X \<and> topspace X = S
[PROOF STEP]
show "path_components_of X = {S}"
[PROOF STATE]
proof (prove)
using this:
path_connected_space X \<and> topspace X = S

goal (1 subgoal):
 1. path_components_of X = {S}
[PROOF STEP]
using ccpo_Sup_singleton [of S]
[PROOF STATE]
proof (prove)
using this:
path_connected_space X \<and> topspace X = S
\<Union> {S} = S

goal (1 subgoal):
 1. path_components_of X = {S}
[PROOF STEP]
by (metis False all_not_in_conv insert_iff mk_disjoint_insert path_component_in_path_components_of path_connected_space_iff_components_eq path_connected_space_path_component_set)
[PROOF STATE]
proof (state)
this:
path_components_of X = {S}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(path_components_of X = {S}) = (path_connected_space X \<and> topspace X = S)

goal (1 subgoal):
 1. topspace X \<noteq> {} \<Longrightarrow> (path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
topspace X \<noteq> {}
(path_components_of X = {S}) = (path_connected_space X \<and> topspace X = S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
topspace X \<noteq> {}
(path_components_of X = {S}) = (path_connected_space X \<and> topspace X = S)

goal (1 subgoal):
 1. (path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
by (simp add: path_components_of_eq_empty subset_singleton_iff)
[PROOF STATE]
proof (state)
this:
(path_components_of X \<subseteq> {S}) = (path_connected_space X \<and> (topspace X = {} \<or> topspace X = S))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma contractible_Euclidean_space [simp]: "contractible_space (Euclidean_space n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contractible_space (Euclidean_space n)
[PROOF STEP]
using homeomorphic_Euclidean_space_product_topology contractible_space_euclideanreal
    contractible_space_product_topology homeomorphic_space_contractibility
[PROOF STATE]
proof (prove)
using this:
Euclidean_space ?n homeomorphic_space powertop_real {..<?n}
contractible_space euclideanreal
contractible_space (product_topology ?X ?I) = (topspace (product_topology ?X ?I) = {} \<or> (\<forall>i\<in>?I. contractible_space (?X i)))
?X homeomorphic_space ?Y \<Longrightarrow> contractible_space ?X = contractible_space ?Y

goal (1 subgoal):
 1. contractible_space (Euclidean_space n)
[PROOF STEP]
by blast


[STATEMENT]
lemma ref_morph_plus: "us \<in> lists \<langle>G\<rangle>\<^sub>+ \<Longrightarrow> vs \<in> lists \<langle>G\<rangle>\<^sub>+ \<Longrightarrow> refine G (us \<cdot> vs) = refine G us \<cdot> refine G vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>us \<in> lists \<langle>G\<rangle>\<^sub>+; vs \<in> lists \<langle>G\<rangle>\<^sub>+\<rbrakk> \<Longrightarrow> Ref G us \<cdot> vs = (Ref G us) \<cdot> Ref G vs
[PROOF STEP]
unfolding refine_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>us \<in> lists \<langle>G\<rangle>\<^sub>+; vs \<in> lists \<langle>G\<rangle>\<^sub>+\<rbrakk> \<Longrightarrow> concat (map (decompose G) (us \<cdot> vs)) = concat (map (decompose G) us) \<cdot> concat (map (decompose G) vs)
[PROOF STEP]
by simp


[STATEMENT]
lemma ind_valid_graph': "\<And>E'. subgraph (ind E') (ind E) \<Longrightarrow> valid_graph (ind E')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>E'. subgraph \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = E'\<rparr> \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = E\<rparr> \<Longrightarrow> valid_graph \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = E'\<rparr>
[PROOF STEP]
apply(rule ind_valid_graph)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>E'. subgraph \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = E'\<rparr> \<lparr>nodes = fst ` E \<union> (snd \<circ> snd) ` E, edges = E\<rparr> \<Longrightarrow> E' \<subseteq> E
[PROOF STEP]
by(auto simp: subgraph_def)


[STATEMENT]
lemma param_count[param]: "\<lbrakk>single_valued A; single_valued (A\<inverse>)\<rbrakk> \<Longrightarrow> (count,count)\<in>\<langle>A\<rangle>mset_rel \<rightarrow> A \<rightarrow> nat_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>single_valued A; single_valued (A\<inverse>)\<rbrakk> \<Longrightarrow> (count, count) \<in> \<langle>A\<rangle>mset_rel \<rightarrow> A \<rightarrow> nat_rel
[PROOF STEP]
apply (rule rel2pD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>single_valued A; single_valued (A\<inverse>)\<rbrakk> \<Longrightarrow> rel2p (\<langle>A\<rangle>mset_rel \<rightarrow> A \<rightarrow> nat_rel) count count
[PROOF STEP]
apply (simp add: prop2p rel2p)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>right_unique (rel2p A); left_unique (rel2p A)\<rbrakk> \<Longrightarrow> rel_fun (rel_mset (rel2p A)) (rel_fun (rel2p A) (=)) count count
[PROOF STEP]
apply (rule pcr_count)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>right_unique (rel2p A); left_unique (rel2p A)\<rbrakk> \<Longrightarrow> bi_unique (rel2p A)
[PROOF STEP]
apply (simp add: bi_unique_alt_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sum_left: "prod (sum g S) x = sum ((\<lambda>i. prod (g i) x)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum g S ** x = (\<Sum>i\<in>S. g i ** x)
[PROOF STEP]
by (rule additive.sum [OF additive_left])


[STATEMENT]
lemma list_slice2_append_mult: "
  length xs = m * k \<Longrightarrow>
  list_slice2 (xs @ ys) k = list_slice2 xs k @ list_slice2 ys k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = m * k \<Longrightarrow> list_slice2 (xs @ ys) k = list_slice2 xs k @ list_slice2 ys k
[PROOF STEP]
apply (case_tac "k = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>length xs = m * k; k = 0\<rbrakk> \<Longrightarrow> list_slice2 (xs @ ys) k = list_slice2 xs k @ list_slice2 ys k
 2. \<lbrakk>length xs = m * k; k \<noteq> 0\<rbrakk> \<Longrightarrow> list_slice2 (xs @ ys) k = list_slice2 xs k @ list_slice2 ys k
[PROOF STEP]
apply (simp add: list_slice2_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = m * k; k \<noteq> 0\<rbrakk> \<Longrightarrow> list_slice2 (xs @ ys) k = list_slice2 xs k @ list_slice2 ys k
[PROOF STEP]
apply (clarsimp simp: list_slice2_def list_slice_append_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = m * k; 0 < k; 0 < length ys mod k\<rbrakk> \<Longrightarrow> ys \<up> ((m + length ys div k) * k - m * k) = ys \<up> (length ys div k * k)
[PROOF STEP]
apply (simp add: add.commute[of "m * k"] add_mult_distrib)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem relabel_to_front_correct:
  "<emp>
  relabel_to_front el s t
  <\<lambda>
    None \<Rightarrow> \<up>(\<not>ln_invar el \<or> \<not>Network (ln_\<alpha> el) s t)
  | Some (c,am,N,cfi) \<Rightarrow>
      \<up>(c = ln_\<alpha> el \<and> ln_invar el)
    * (\<exists>\<^sub>Acf. asmtx_assn N int_assn cf cfi
          * \<up>(RGraph_Impl c s t N cf
            \<and> Network.isMaxFlow c s t (Network.flow_of_cf c cf)))
    * \<up>(Graph.is_adj_map c am)
  >\<^sub>t
  "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <emp> relabel_to_front el s t <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> ln_invar el \<or> \<not> Network (ln_\<alpha> el) s t) | Some (c, am, N, cfi) \<Rightarrow> \<up> (c = ln_\<alpha> el \<and> ln_invar el) * (\<exists>\<^sub>Acf. asmtx_assn N cap_assn cf cfi * \<up> (RGraph_Impl c s t N cf \<and> Network.isMaxFlow c s t (Network.flow_of_cf c cf))) * \<up> (Graph.is_adj_map c am)>\<^sub>t
[PROOF STEP]
unfolding relabel_to_front_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <emp> case prepareNet el s t of None \<Rightarrow> return None | Some (c, am, N) \<Rightarrow> relabel_to_front_impl_tab_am c s t N am \<bind> (\<lambda>cf. return (Some (c, am, N, cf))) <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> ln_invar el \<or> \<not> Network (ln_\<alpha> el) s t) | Some (c, am, N, cfi) \<Rightarrow> \<up> (c = ln_\<alpha> el \<and> ln_invar el) * (\<exists>\<^sub>Acf. asmtx_assn N cap_assn cf cfi * \<up> (RGraph_Impl c s t N cf \<and> Network.isMaxFlow c s t (Network.flow_of_cf c cf))) * \<up> (Graph.is_adj_map c am)>\<^sub>t
[PROOF STEP]
using prepareNet_correct[of el s t]
[PROOF STATE]
proof (prove)
using this:
case prepareNet el s t of None \<Rightarrow> \<not> ln_invar el \<or> \<not> Network (ln_\<alpha> el) s t | Some (c, adjmap, N) \<Rightarrow> (el, c) \<in> ln_rel \<and> Network c s t \<and> Graph.is_adj_map c adjmap \<and> Graph.V c \<subseteq> {0..<N}

goal (1 subgoal):
 1. <emp> case prepareNet el s t of None \<Rightarrow> return None | Some (c, am, N) \<Rightarrow> relabel_to_front_impl_tab_am c s t N am \<bind> (\<lambda>cf. return (Some (c, am, N, cf))) <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> ln_invar el \<or> \<not> Network (ln_\<alpha> el) s t) | Some (c, am, N, cfi) \<Rightarrow> \<up> (c = ln_\<alpha> el \<and> ln_invar el) * (\<exists>\<^sub>Acf. asmtx_assn N cap_assn cf cfi * \<up> (RGraph_Impl c s t N cf \<and> Network.isMaxFlow c s t (Network.flow_of_cf c cf))) * \<up> (Graph.is_adj_map c am)>\<^sub>t
[PROOF STEP]
by (sep_auto simp: ln_rel_def in_br_conv)