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

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> ket_plus_k 0 = Matrix.vec (2 ^ Suc 0) (\<lambda>l. 1 / csqrt (2 ^ Suc 0))
 2. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. ket_plus_k 0 = Matrix.vec (2 ^ Suc 0) (\<lambda>l. 1 / csqrt (2 ^ Suc 0))
[PROOF STEP]
unfolding ket_plus_k.simps ket_plus_def
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. Matrix.vec 2 (\<lambda>k. 1 / csqrt 2) = Matrix.vec (2 ^ Suc 0) (\<lambda>l. 1 / csqrt (2 ^ Suc 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ket_plus_k 0 = Matrix.vec (2 ^ Suc 0) (\<lambda>l. 1 / csqrt (2 ^ Suc 0))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k))
Suc k < n

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

goal (1 subgoal):
 1. ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
have dSk: "ket_plus_k (Suc k) \<in> carrier_vec (2^(Suc (Suc k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ket_plus_k (Suc k) \<in> carrier_vec (2 ^ Suc (Suc k))
[PROOF STEP]
using ket_plus_k_dim[OF Suc(2)]
[PROOF STATE]
proof (prove)
using this:
ket_plus_k (Suc k) \<in> carrier_vec (2 ^ Suc (Suc k))

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

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k))
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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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 blast
[PROOF STATE]
proof (state)
this:
st2.vars1' = {0..<Suc k}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
have "csqrt (2 ^ (Suc k)) = complex_of_real (sqrt (2 ^ (Suc k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. csqrt (2 ^ Suc k) = complex_of_real (sqrt (2 ^ Suc k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
csqrt (2 ^ Suc k) = complex_of_real (sqrt (2 ^ Suc k))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
csqrt (2 ^ Suc k) = complex_of_real (sqrt (2 ^ Suc k))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
have "complex_of_real (sqrt (2 ^ (Suc k))) * complex_of_real (sqrt 2) = complex_of_real (sqrt (2 ^ (Suc (Suc k))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (sqrt (2 ^ Suc k)) * complex_of_real (sqrt 2) = complex_of_real (sqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
by (metis of_real_mult power_Suc power_commutes real_sqrt_power)
[PROOF STATE]
proof (state)
this:
complex_of_real (sqrt (2 ^ Suc k)) * complex_of_real (sqrt 2) = complex_of_real (sqrt (2 ^ Suc (Suc k)))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
csqrt (2 ^ Suc k) = complex_of_real (sqrt (2 ^ Suc k))
complex_of_real (sqrt (2 ^ Suc k)) * complex_of_real (sqrt 2) = complex_of_real (sqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
have "csqrt (2 ^ (Suc k)) * csqrt 2 = csqrt (2 ^ (Suc (Suc k)))"
[PROOF STATE]
proof (prove)
using this:
csqrt (2 ^ Suc k) = complex_of_real (sqrt (2 ^ Suc k))
complex_of_real (sqrt (2 ^ Suc k)) * complex_of_real (sqrt 2) = complex_of_real (sqrt (2 ^ Suc (Suc k)))

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

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
csqrt (2 ^ Suc k) * csqrt 2 = csqrt (2 ^ Suc (Suc k))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
have "1 / csqrt (2 ^ Suc k) * 1 / csqrt 2 = 1 / (csqrt (2 ^ (Suc k)) * csqrt 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / csqrt (2 ^ Suc k) * 1 / csqrt 2 = 1 / (csqrt (2 ^ Suc k) * csqrt 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / csqrt (2 ^ Suc k) * 1 / csqrt 2 = 1 / (csqrt (2 ^ Suc k) * csqrt 2)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
csqrt (2 ^ Suc k) * csqrt 2 = csqrt (2 ^ Suc (Suc k))
1 / csqrt (2 ^ Suc k) * 1 / csqrt 2 = 1 / (csqrt (2 ^ Suc k) * csqrt 2)
[PROOF STEP]
have csqrt2p :"1 / csqrt (2 ^ Suc k) * 1 / csqrt 2 = 1 / (csqrt (2 ^ (Suc (Suc k))))"
[PROOF STATE]
proof (prove)
using this:
csqrt (2 ^ Suc k) * csqrt 2 = csqrt (2 ^ Suc (Suc k))
1 / csqrt (2 ^ Suc k) * 1 / csqrt 2 = 1 / (csqrt (2 ^ Suc k) * csqrt 2)

goal (1 subgoal):
 1. 1 / csqrt (2 ^ Suc k) * 1 / csqrt 2 = 1 / csqrt (2 ^ Suc (Suc k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / csqrt (2 ^ Suc k) * 1 / csqrt 2 = 1 / csqrt (2 ^ Suc (Suc k))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
have nthsSSk2: "nths (replicate (Suc (Suc k)) 2) {0..<Suc k} = replicate (Suc k) 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths (replicate (Suc (Suc k)) (2::'a)) {0..<Suc k} = replicate (Suc k) (2::'a)
[PROOF STEP]
unfolding nths_replicate[of "Suc (Suc k)" 2 "{0..<Suc k}"]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. replicate (card {i. i < Suc (Suc k) \<and> i \<in> {0..<Suc k}}) (2::'a) = replicate (Suc k) (2::'a)
[PROOF STEP]
by (smt Collect_cong \<open>{card {0..<x} |x. x \<in> {0..<Suc k}} = {0..<Suc k}\<close> atLeastLessThan_iff card_atLeastLessThan diff_zero less_SucI)
[PROOF STATE]
proof (state)
this:
nths (replicate (Suc (Suc k)) (2::?'a5)) {0..<Suc k} = replicate (Suc k) (2::?'a5)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nths (replicate (Suc (Suc k)) (2::?'a5)) {0..<Suc k} = replicate (Suc k) (2::?'a5)
[PROOF STEP]
have std1: "st.d1 = 2^(Suc k)"
[PROOF STATE]
proof (prove)
using this:
nths (replicate (Suc (Suc k)) (2::?'a5)) {0..<Suc k} = replicate (Suc k) (2::?'a5)

goal (1 subgoal):
 1. st.d1 = 2 ^ Suc k
[PROOF STEP]
unfolding st.d1_def st.dims1_def nthsSSk2
[PROOF STATE]
proof (prove)
using this:
replicate (Suc k) (2::?'a5) = replicate (Suc k) (2::?'a5)

goal (1 subgoal):
 1. prod_list (replicate (Suc k) 2) = 2 ^ Suc k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st.d1 = 2 ^ Suc k

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
have "{i. i < Suc (Suc k) \<and> i \<in> {Suc k..}} = {Suc k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < Suc (Suc k) \<and> i \<in> {Suc k..}} = {Suc k}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{i. i < Suc (Suc k) \<and> i \<in> {Suc k..}} = {Suc k}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{i. i < Suc (Suc k) \<and> i \<in> {Suc k..}} = {Suc k}
[PROOF STEP]
have "nths (replicate (Suc (Suc k)) 2) ({Suc k..}) = replicate 1 2"
[PROOF STATE]
proof (prove)
using this:
{i. i < Suc (Suc k) \<and> i \<in> {Suc k..}} = {Suc k}

goal (1 subgoal):
 1. nths (replicate (Suc (Suc k)) (2::'a)) {Suc k..} = replicate 1 (2::'a)
[PROOF STEP]
unfolding nths_replicate
[PROOF STATE]
proof (prove)
using this:
{i. i < Suc (Suc k) \<and> i \<in> {Suc k..}} = {Suc k}

goal (1 subgoal):
 1. replicate (card {i. i < Suc (Suc k) \<and> i \<in> {Suc k..}}) (2::'a) = replicate 1 (2::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nths (replicate (Suc (Suc k)) (2::?'a6)) {Suc k..} = replicate 1 (2::?'a6)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
nths (replicate (Suc (Suc k)) (2::?'a6)) {Suc k..} = replicate 1 (2::?'a6)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
have "(- {0..<Suc k}) = {Suc k..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - {0..<Suc k} = {Suc k..}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- {0..<Suc k} = {Suc k..}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
nths (replicate (Suc (Suc k)) (2::?'a6)) {Suc k..} = replicate 1 (2::?'a6)
- {0..<Suc k} = {Suc k..}
[PROOF STEP]
have nthsSSk2c: "nths (replicate (Suc (Suc k)) 2) (- {0..<Suc k}) = replicate 1 2"
[PROOF STATE]
proof (prove)
using this:
nths (replicate (Suc (Suc k)) (2::?'a6)) {Suc k..} = replicate 1 (2::?'a6)
- {0..<Suc k} = {Suc k..}

goal (1 subgoal):
 1. nths (replicate (Suc (Suc k)) (2::'a)) (- {0..<Suc k}) = replicate 1 (2::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nths (replicate (Suc (Suc k)) (2::?'a7)) (- {0..<Suc k}) = replicate 1 (2::?'a7)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
have std2: "st.d2 = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. st.d2 = 2
[PROOF STEP]
unfolding st.d2_def st.dims2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (nths (replicate (Suc (Suc k)) 2) (- {0..<Suc k})) = 2
[PROOF STEP]
apply (subst nthsSSk2c)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (replicate 1 2) = 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st.d2 = 2

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
have "st.encode1 i < st.d1" if "i < st.d" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. st.encode1 i < st.d1
[PROOF STEP]
using that st.encode1_lt[OF that]
[PROOF STATE]
proof (prove)
using this:
i < st.d
st.encode1 i < st.d1

goal (1 subgoal):
 1. st.encode1 i < st.d1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i7 < st.d \<Longrightarrow> st.encode1 ?i7 < st.d1

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i7 < st.d \<Longrightarrow> st.encode1 ?i7 < st.d1
[PROOF STEP]
have kpkki: "ket_plus_k k $ st.encode1 i = 1 / csqrt (2^(Suc k))" if "i < st.d" for i
[PROOF STATE]
proof (prove)
using this:
?i7 < st.d \<Longrightarrow> st.encode1 ?i7 < st.d1

goal (1 subgoal):
 1. ket_plus_k k $ st.encode1 i = 1 / csqrt (2 ^ Suc k)
[PROOF STEP]
unfolding kpkk std1
[PROOF STATE]
proof (prove)
using this:
?i7 < st.d \<Longrightarrow> st.encode1 ?i7 < 2 ^ Suc k

goal (1 subgoal):
 1. Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)) $ st.encode1 i = 1 / csqrt (2 ^ Suc k)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
?i7 < st.d \<Longrightarrow> st.encode1 ?i7 < 2 ^ Suc k
i < st.d

goal (1 subgoal):
 1. Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)) $ st.encode1 i = 1 / csqrt (2 ^ Suc k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i7 < st.d \<Longrightarrow> ket_plus_k k $ st.encode1 ?i7 = 1 / csqrt (2 ^ Suc k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
have "st.encode2 i < st.d2" if "i < st.d" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. st.encode2 i < st.d2
[PROOF STEP]
using that st.encode2_lt[OF that]
[PROOF STATE]
proof (prove)
using this:
i < st.d
st.encode2 i < st.d2

goal (1 subgoal):
 1. st.encode2 i < st.d2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i7 < st.d \<Longrightarrow> st.encode2 ?i7 < st.d2

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i7 < st.d \<Longrightarrow> st.encode2 ?i7 < st.d2
[PROOF STEP]
have kpi: "ket_plus $ st.encode2 i = 1 / csqrt 2" if "i < st.d" for i
[PROOF STATE]
proof (prove)
using this:
?i7 < st.d \<Longrightarrow> st.encode2 ?i7 < st.d2

goal (1 subgoal):
 1. ket_plus $ st.encode2 i = 1 / csqrt 2
[PROOF STEP]
unfolding ket_plus_def std2
[PROOF STATE]
proof (prove)
using this:
?i7 < st.d \<Longrightarrow> st.encode2 ?i7 < 2

goal (1 subgoal):
 1. Matrix.vec 2 (\<lambda>k. 1 / csqrt 2) $ st.encode2 i = 1 / csqrt 2
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
?i7 < st.d \<Longrightarrow> st.encode2 ?i7 < 2
i < st.d

goal (1 subgoal):
 1. Matrix.vec 2 (\<lambda>k. 1 / csqrt 2) $ st.encode2 i = 1 / csqrt 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i7 < st.d \<Longrightarrow> ket_plus $ st.encode2 ?i7 = 1 / csqrt 2

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
have kzkki: "ket_plus_k (Suc k) $ i = 1 / (csqrt (2 ^ (Suc (Suc k))))" if "i < st.d" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ket_plus_k (Suc k) $ i = 1 / csqrt (2 ^ Suc (Suc k))
[PROOF STEP]
unfolding ket_plus_k.simps st2pvsttv st.tensor_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.vec st.d (\<lambda>i. ket_plus_k k $ st.encode1 i * ket_plus $ st.encode2 i) $ i = 1 / csqrt (2 ^ Suc (Suc k))
[PROOF STEP]
using csqrt2p kpkki kpi that
[PROOF STATE]
proof (prove)
using this:
1 / csqrt (2 ^ Suc k) * 1 / csqrt 2 = 1 / csqrt (2 ^ Suc (Suc k))
?i7 < st.d \<Longrightarrow> ket_plus_k k $ st.encode1 ?i7 = 1 / csqrt (2 ^ Suc k)
?i7 < st.d \<Longrightarrow> ket_plus $ st.encode2 ?i7 = 1 / csqrt 2
i < st.d

goal (1 subgoal):
 1. Matrix.vec st.d (\<lambda>i. ket_plus_k k $ st.encode1 i * ket_plus $ st.encode2 i) $ i = 1 / csqrt (2 ^ Suc (Suc k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i7 < st.d \<Longrightarrow> ket_plus_k (Suc k) $ ?i7 = 1 / csqrt (2 ^ Suc (Suc k))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> ket_plus_k k = Matrix.vec (2 ^ Suc k) (\<lambda>l. 1 / csqrt (2 ^ Suc k)); Suc k < n\<rbrakk> \<Longrightarrow> ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))
[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>l. 1 / csqrt (2 ^ Suc (Suc k)))) \<Longrightarrow> ket_plus_k (Suc k) $ i = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k))) $ i
 2. dim_vec (ket_plus_k (Suc k)) = dim_vec (Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k))))
[PROOF STEP]
subgoal for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_vec (Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))) \<Longrightarrow> ket_plus_k (Suc k) $ i = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k))) $ i
[PROOF STEP]
using kzkki
[PROOF STATE]
proof (prove)
using this:
?i7 < st.d \<Longrightarrow> ket_plus_k (Suc k) $ ?i7 = 1 / csqrt (2 ^ Suc (Suc k))

goal (1 subgoal):
 1. i < dim_vec (Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))) \<Longrightarrow> ket_plus_k (Suc k) $ i = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k))) $ i
[PROOF STEP]
unfolding std
[PROOF STATE]
proof (prove)
using this:
?i7 < 2 ^ Suc (Suc k) \<Longrightarrow> ket_plus_k (Suc k) $ ?i7 = 1 / csqrt (2 ^ Suc (Suc k))

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

goal (1 subgoal):
 1. dim_vec (ket_plus_k (Suc k)) = dim_vec (Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ket_plus_k (Suc k) = Matrix.vec (2 ^ Suc (Suc k)) (\<lambda>l. 1 / csqrt (2 ^ Suc (Suc k)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "has_max ((f :: 'b \<Rightarrow> real) ` X) \<longleftrightarrow> has_arg_max f X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_max (f ` X) = has_arg_max f X
[PROOF STEP]
unfolding has_max_def has_arg_max_def is_arg_max_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x\<in>f ` X. \<forall>x'\<in>f ` X. x' \<le> x) = (\<exists>x. x \<in> X \<and> (\<nexists>y. y \<in> X \<and> f x < f y))
[PROOF STEP]
using not_less
[PROOF STATE]
proof (prove)
using this:
(\<not> ?x < ?y) = (?y \<le> ?x)

goal (1 subgoal):
 1. (\<exists>x\<in>f ` X. \<forall>x'\<in>f ` X. x' \<le> x) = (\<exists>x. x \<in> X \<and> (\<nexists>y. y \<in> X \<and> f x < f y))
[PROOF STEP]
by (auto dest!: leD simp: not_less)


[STATEMENT]
lemma biQuots_simps [simp]:
  shows "biQuots [] [] A = A"
  and   "biQuots (a#as) (b#bs) A = biQuots as bs (biQuot a b A)"
  and   "\<lbrakk>length s1 = length t1; length s2 = length t2\<rbrakk> \<Longrightarrow>
    biQuots (s1 @ s2) (t1 @ t2) A = biQuots s2 t2 (biQuots s1 t1 A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. biQuots [] [] A = A &&& biQuots (a # as) (b # bs) A = biQuots as bs (biQuot a b A) &&& (\<lbrakk>length s1 = length t1; length s2 = length t2\<rbrakk> \<Longrightarrow> biQuots (s1 @ s2) (t1 @ t2) A = biQuots s2 t2 (biQuots s1 t1 A))
[PROOF STEP]
unfolding biQuots_def biQuot_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {zs. [] @ zs @ rev [] \<in> A} = A &&& {zs. (a # as) @ zs @ rev (b # bs) \<in> A} = {zs. as @ zs @ rev bs \<in> {xs. a # xs @ [b] \<in> A}} &&& (\<lbrakk>length s1 = length t1; length s2 = length t2\<rbrakk> \<Longrightarrow> {zs. (s1 @ s2) @ zs @ rev (t1 @ t2) \<in> A} = {zs. s2 @ zs @ rev t2 \<in> {zs. s1 @ zs @ rev t1 \<in> A}})
[PROOF STEP]
by auto


[STATEMENT]
lemma continuous_map_prod_snd:
  "i \<in> I \<Longrightarrow> continuous_map (prod_topology X (product_topology (\<lambda>i. Y) I)) Y (\<lambda>x. snd x i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> I \<Longrightarrow> continuous_map (prod_topology X (product_topology (\<lambda>i. Y) I)) Y (\<lambda>x. snd x i)
[PROOF STEP]
using continuous_map_componentwise_UNIV continuous_map_snd
[PROOF STATE]
proof (prove)
using this:
continuous_map ?X (product_topology ?Y UNIV) ?f = (\<forall>k. continuous_map ?X (?Y k) (\<lambda>x. ?f x k))
continuous_map (prod_topology ?X ?Y) ?Y snd

goal (1 subgoal):
 1. i \<in> I \<Longrightarrow> continuous_map (prod_topology X (product_topology (\<lambda>i. Y) I)) Y (\<lambda>x. snd x i)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma finite_enumerate_in_set: "\<lbrakk>finite S; n < card S\<rbrakk> \<Longrightarrow> enumerate S n \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S n \<in> S
[PROOF STEP]
proof (induction n arbitrary: S)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S. \<lbrakk>finite S; 0 < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S 0 \<in> S
 2. \<And>n S. \<lbrakk>\<And>S. \<lbrakk>finite S; n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S n \<in> S; finite S; Suc n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S (Suc n) \<in> S
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
finite S
0 < card S

goal (2 subgoals):
 1. \<And>S. \<lbrakk>finite S; 0 < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S 0 \<in> S
 2. \<And>n S. \<lbrakk>\<And>S. \<lbrakk>finite S; n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S n \<in> S; finite S; Suc n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S (Suc n) \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite S
0 < card S
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite S
0 < card S

goal (1 subgoal):
 1. wellorder_class.enumerate S 0 \<in> S
[PROOF STEP]
by (metis all_not_in_conv card.empty enumerate.simps(1) not_less0 wellorder_Least_lemma(1))
[PROOF STATE]
proof (state)
this:
wellorder_class.enumerate S 0 \<in> S

goal (1 subgoal):
 1. \<And>n S. \<lbrakk>\<And>S. \<lbrakk>finite S; n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S n \<in> S; finite S; Suc n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S (Suc n) \<in> S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n S. \<lbrakk>\<And>S. \<lbrakk>finite S; n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S n \<in> S; finite S; Suc n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S (Suc n) \<in> S
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>finite ?S; n < card ?S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate ?S n \<in> ?S
finite S
Suc n < card S

goal (1 subgoal):
 1. \<And>n S. \<lbrakk>\<And>S. \<lbrakk>finite S; n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S n \<in> S; finite S; Suc n < card S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S (Suc n) \<in> S
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wellorder_class.enumerate S (Suc n) \<in> S
[PROOF STEP]
using Suc.prems Suc.IH [of "S - {LEAST n. n \<in> S}"]
[PROOF STATE]
proof (prove)
using this:
finite S
Suc n < card S
\<lbrakk>finite (S - {LEAST n. n \<in> S}); n < card (S - {LEAST n. n \<in> S})\<rbrakk> \<Longrightarrow> wellorder_class.enumerate (S - {LEAST n. n \<in> S}) n \<in> S - {LEAST n. n \<in> S}

goal (1 subgoal):
 1. wellorder_class.enumerate S (Suc n) \<in> S
[PROOF STEP]
apply (simp add: enumerate.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; Suc n < card S; n < card (S - {LEAST n. n \<in> S}) \<Longrightarrow> wellorder_class.enumerate (S - {LEAST n. n \<in> S}) n \<in> S \<and> wellorder_class.enumerate (S - {LEAST n. n \<in> S}) n \<noteq> (LEAST n. n \<in> S)\<rbrakk> \<Longrightarrow> wellorder_class.enumerate (S - {LEAST n. n \<in> S}) n \<in> S
[PROOF STEP]
by (metis Diff_empty Diff_insert0 Suc_lessD card.remove less_Suc_eq)
[PROOF STATE]
proof (state)
this:
wellorder_class.enumerate S (Suc n) \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma span_eq: "span S = span T \<longleftrightarrow> S \<subseteq> span T \<and> T \<subseteq> span S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (span S = span T) = (S \<subseteq> span T \<and> T \<subseteq> span S)
[PROOF STEP]
by (metis span_minimal span_subspace span_superset subspace_span)


[STATEMENT]
lemma Ord_odiff_le_odiff: "\<lbrakk>x \<le> y; Ord x; Ord y\<rbrakk> \<Longrightarrow> odiff x \<alpha> \<le> odiff y \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y; Ord x; Ord y\<rbrakk> \<Longrightarrow> odiff x \<alpha> \<le> odiff y \<alpha>
[PROOF STEP]
by (simp add: odiff_le_odiff vle_iff_le_Ord)


[STATEMENT]
lemma [simp]:
  fixes f :: "'a \<Rightarrow> 'a"
  shows lnull_funpow_lmap: "lnull ((lmap f ^^ n) xs) \<longleftrightarrow> lnull xs"
  and lhd_funpow_lmap: "\<not> lnull xs \<Longrightarrow> lhd ((lmap f ^^ n) xs) = (f ^^ n) (lhd xs)"
  and ltl_funpow_lmap: "\<not> lnull xs \<Longrightarrow> ltl ((lmap f ^^ n) xs) = (lmap f ^^ n) (ltl xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lnull ((lmap f ^^ n) xs) = lnull xs &&& (\<not> lnull xs \<Longrightarrow> lhd ((lmap f ^^ n) xs) = (f ^^ n) (lhd xs)) &&& (\<not> lnull xs \<Longrightarrow> ltl ((lmap f ^^ n) xs) = (lmap f ^^ n) (ltl xs))
[PROOF STEP]
by(induct n) simp_all


[STATEMENT]
lemma succ_tran_empty: "\<lbrakk> wf_graph G; v \<notin> (fst ` edges G) \<rbrakk> \<Longrightarrow> succ_tran G v = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_graph G; v \<notin> fst ` edges G\<rbrakk> \<Longrightarrow> succ_tran G v = {}
[PROOF STEP]
unfolding succ_tran_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_graph G; v \<notin> fst ` edges G\<rbrakk> \<Longrightarrow> {e2. (v, e2) \<in> (edges G)\<^sup>+} = {}
[PROOF STEP]
using image_iff tranclD
[PROOF STATE]
proof (prove)
using this:
(?z \<in> ?f ` ?A) = (\<exists>x\<in>?A. ?z = ?f x)
(?x, ?y) \<in> ?R\<^sup>+ \<Longrightarrow> \<exists>z. (?x, z) \<in> ?R \<and> (z, ?y) \<in> ?R\<^sup>*

goal (1 subgoal):
 1. \<lbrakk>wf_graph G; v \<notin> fst ` edges G\<rbrakk> \<Longrightarrow> {e2. (v, e2) \<in> (edges G)\<^sup>+} = {}
[PROOF STEP]
by fastforce


[STATEMENT]
lemma ordered_map_keys:
  assumes "finite S" "is_map S"
  shows "map fst (ordered_map S) = sorted_list_of_set (fst ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map fst (ordered_map S) = sorted_list_of_set (fst ` S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. map fst (ordered_map S) = sorted_list_of_set (fst ` S)
[PROOF STEP]
have "fst (get_map S z) = z" if "z \<in> fst ` S" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (get_map S z) = z
[PROOF STEP]
using assms that
[PROOF STATE]
proof (prove)
using this:
finite S
is_map S
z \<in> fst ` S

goal (1 subgoal):
 1. fst (get_map S z) = z
[PROOF STEP]
by (fastforce simp: get_map_elem)
[PROOF STATE]
proof (state)
this:
?z \<in> fst ` S \<Longrightarrow> fst (get_map S ?z) = ?z

goal (1 subgoal):
 1. map fst (ordered_map S) = sorted_list_of_set (fst ` S)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?z \<in> fst ` S \<Longrightarrow> fst (get_map S ?z) = ?z

goal (1 subgoal):
 1. map fst (ordered_map S) = sorted_list_of_set (fst ` S)
[PROOF STEP]
have "set (sorted_list_of_set (fst ` S)) = fst ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (sorted_list_of_set (fst ` S)) = fst ` S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
is_map S

goal (1 subgoal):
 1. set (sorted_list_of_set (fst ` S)) = fst ` S
[PROOF STEP]
by (force simp: sorted_list_of_set)
[PROOF STATE]
proof (state)
this:
set (sorted_list_of_set (fst ` S)) = fst ` S

goal (1 subgoal):
 1. map fst (ordered_map S) = sorted_list_of_set (fst ` S)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?z \<in> fst ` S \<Longrightarrow> fst (get_map S ?z) = ?z
set (sorted_list_of_set (fst ` S)) = fst ` S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?z \<in> fst ` S \<Longrightarrow> fst (get_map S ?z) = ?z
set (sorted_list_of_set (fst ` S)) = fst ` S

goal (1 subgoal):
 1. map fst (ordered_map S) = sorted_list_of_set (fst ` S)
[PROOF STEP]
unfolding ordered_map_def
[PROOF STATE]
proof (prove)
using this:
?z \<in> fst ` S \<Longrightarrow> fst (get_map S ?z) = ?z
set (sorted_list_of_set (fst ` S)) = fst ` S

goal (1 subgoal):
 1. map fst (map (get_map S) (sorted_list_of_set (fst ` S))) = sorted_list_of_set (fst ` S)
[PROOF STEP]
by (metis (no_types, lifting) map_idI map_map o_apply)
[PROOF STATE]
proof (state)
this:
map fst (ordered_map S) = sorted_list_of_set (fst ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Corps) field_tOp_commute:"\<lbrakk>x \<in> carrier K; y \<in> carrier K\<rbrakk>
                                \<Longrightarrow> x \<cdot>\<^sub>r y  =  y \<cdot>\<^sub>r x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier K; y \<in> carrier K\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r y = y \<cdot>\<^sub>r x
[PROOF STEP]
apply (cut_tac field_is_ring)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier K; y \<in> carrier K; Ring K\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r y = y \<cdot>\<^sub>r x
[PROOF STEP]
apply (simp add:Ring.ring_tOp_commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma add_node_correct: "FiniteGraph.add_node v (list_graph_to_graph G) = list_graph_to_graph (add_node v G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FiniteGraph.add_node v (list_graph_to_graph G) = list_graph_to_graph (FiniteListGraph.add_node v G)
[PROOF STEP]
unfolding FiniteGraph.add_node_def list_graph_to_graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lparr>nodes = {v} \<union> nodes \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr>, edges = edges \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr>\<rparr> = \<lparr>nodes = set (nodesL (FiniteListGraph.add_node v G)), edges = set (edgesL (FiniteListGraph.add_node v G))\<rparr>
[PROOF STEP]
by (simp add: add_node_set_edges add_node_set_nodes)


[STATEMENT]
lemma \<pi>_upper_bound:
  assumes "x \<ge> (4 :: real)"
  shows   "\<pi> x < ln 4 * x / ln x  +  8 * ln 2 * x / ln x ^ 2  +  2 / ln 2 * sqrt x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> x < ln 4 * x / ln x + 8 * ln 2 * x / (ln x)\<^sup>2 + 2 / ln 2 * sqrt x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<pi> x < ln 4 * x / ln x + 8 * ln 2 * x / (ln x)\<^sup>2 + 2 / ln 2 * sqrt x
[PROOF STEP]
define ub where "ub = 2 / ln 2 * sqrt x + 8 * ln 2 * x / ln x ^ 2"
[PROOF STATE]
proof (state)
this:
ub = 2 / ln 2 * sqrt x + 8 * ln 2 * x / (ln x)\<^sup>2

goal (1 subgoal):
 1. \<pi> x < ln 4 * x / ln x + 8 * ln 2 * x / (ln x)\<^sup>2 + 2 / ln 2 * sqrt x
[PROOF STEP]
have "\<pi> x \<le> \<theta> x / ln x + ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> x \<le> \<theta> x / ln x + ub
[PROOF STEP]
using \<pi>_\<theta>_bound[of x] assms
[PROOF STATE]
proof (prove)
using this:
4 \<le> x \<Longrightarrow> \<pi> x - \<theta> x / ln x \<in> {0..2 / ln 2 * sqrt x + 8 * ln 2 * x / (ln x)\<^sup>2}
4 \<le> x

goal (1 subgoal):
 1. \<pi> x \<le> \<theta> x / ln x + ub
[PROOF STEP]
unfolding ub_def
[PROOF STATE]
proof (prove)
using this:
4 \<le> x \<Longrightarrow> \<pi> x - \<theta> x / ln x \<in> {0..2 / ln 2 * sqrt x + 8 * ln 2 * x / (ln x)\<^sup>2}
4 \<le> x

goal (1 subgoal):
 1. \<pi> x \<le> \<theta> x / ln x + (2 / ln 2 * sqrt x + 8 * ln 2 * x / (ln x)\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<pi> x \<le> \<theta> x / ln x + ub

goal (1 subgoal):
 1. \<pi> x < ln 4 * x / ln x + 8 * ln 2 * x / (ln x)\<^sup>2 + 2 / ln 2 * sqrt x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<pi> x \<le> \<theta> x / ln x + ub

goal (1 subgoal):
 1. \<pi> x < ln 4 * x / ln x + 8 * ln 2 * x / (ln x)\<^sup>2 + 2 / ln 2 * sqrt x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
4 \<le> x
[PROOF STEP]
have "\<theta> x / ln x < ln 4 * x / ln x"
[PROOF STATE]
proof (prove)
using this:
4 \<le> x

goal (1 subgoal):
 1. \<theta> x / ln x < ln 4 * x / ln x
[PROOF STEP]
by (intro \<theta>_upper_bound divide_strict_right_mono) auto
[PROOF STATE]
proof (state)
this:
\<theta> x / ln x < ln 4 * x / ln x

goal (1 subgoal):
 1. \<pi> x < ln 4 * x / ln x + 8 * ln 2 * x / (ln x)\<^sup>2 + 2 / ln 2 * sqrt x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x < y \<Longrightarrow> x + ub < y + ub) \<Longrightarrow> \<pi> x < ln 4 * x / ln x + ub
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x < y \<Longrightarrow> x + ub < y + ub) \<Longrightarrow> \<pi> x < ln 4 * x / ln x + ub

goal (1 subgoal):
 1. \<pi> x < ln 4 * x / ln x + 8 * ln 2 * x / (ln x)\<^sup>2 + 2 / ln 2 * sqrt x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x < y \<Longrightarrow> x + ub < y + ub) \<Longrightarrow> \<pi> x < ln 4 * x / ln x + ub
4 \<le> x

goal (1 subgoal):
 1. \<pi> x < ln 4 * x / ln x + 8 * ln 2 * x / (ln x)\<^sup>2 + 2 / ln 2 * sqrt x
[PROOF STEP]
by (simp add: algebra_simps ub_def)
[PROOF STATE]
proof (state)
this:
\<pi> x < ln 4 * x / ln x + 8 * ln 2 * x / (ln x)\<^sup>2 + 2 / ln 2 * sqrt x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma b_least_aux2: "\<lbrakk>y<x; (f x y) \<noteq> 0\<rbrakk> \<Longrightarrow> (b_least f x) = (Least (%y. (f x y) \<noteq> 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y < x; f x y \<noteq> 0\<rbrakk> \<Longrightarrow> b_least f x = (LEAST y. f x y \<noteq> 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>y < x; f x y \<noteq> 0\<rbrakk> \<Longrightarrow> b_least f x = (LEAST y. f x y \<noteq> 0)
[PROOF STEP]
assume A1: "y < x" and A2: "f x y \<noteq> 0"
[PROOF STATE]
proof (state)
this:
y < x
f x y \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>y < x; f x y \<noteq> 0\<rbrakk> \<Longrightarrow> b_least f x = (LEAST y. f x y \<noteq> 0)
[PROOF STEP]
from A1 A2
[PROOF STATE]
proof (chain)
picking this:
y < x
f x y \<noteq> 0
[PROOF STEP]
have S1: "b_least f x < x"
[PROOF STATE]
proof (prove)
using this:
y < x
f x y \<noteq> 0

goal (1 subgoal):
 1. b_least f x < x
[PROOF STEP]
by (rule nz_impl_b_least_less)
[PROOF STATE]
proof (state)
this:
b_least f x < x

goal (1 subgoal):
 1. \<lbrakk>y < x; f x y \<noteq> 0\<rbrakk> \<Longrightarrow> b_least f x = (LEAST y. f x y \<noteq> 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
b_least f x < x

goal (1 subgoal):
 1. b_least f x = (LEAST y. f x y \<noteq> 0)
[PROOF STEP]
by (rule b_least_less_impl_eq)
[PROOF STATE]
proof (state)
this:
b_least f x = (LEAST y. f x y \<noteq> 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Urysohn_local:
  assumes US: "closedin (top_of_set U) S"
      and UT: "closedin (top_of_set U) T"
      and "S \<inter> T = {}"
  obtains f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
    where "continuous_on U f"
          "\<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b"
          "\<And>x. x \<in> S \<Longrightarrow> f x = a"
          "\<And>x. x \<in> T \<Longrightarrow> f x = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>continuous_on U f; \<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b; \<And>x. x \<in> S \<Longrightarrow> f x = a; \<And>x. x \<in> T \<Longrightarrow> f x = b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (cases "a = b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>f. \<lbrakk>continuous_on U f; \<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b; \<And>x. x \<in> S \<Longrightarrow> f x = a; \<And>x. x \<in> T \<Longrightarrow> f x = b\<rbrakk> \<Longrightarrow> thesis; a = b\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>f. \<lbrakk>continuous_on U f; \<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b; \<And>x. x \<in> S \<Longrightarrow> f x = a; \<And>x. x \<in> T \<Longrightarrow> f x = b\<rbrakk> \<Longrightarrow> thesis; a \<noteq> b\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = b

goal (2 subgoals):
 1. \<lbrakk>\<And>f. \<lbrakk>continuous_on U f; \<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b; \<And>x. x \<in> S \<Longrightarrow> f x = a; \<And>x. x \<in> T \<Longrightarrow> f x = b\<rbrakk> \<Longrightarrow> thesis; a = b\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>f. \<lbrakk>continuous_on U f; \<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b; \<And>x. x \<in> S \<Longrightarrow> f x = a; \<And>x. x \<in> T \<Longrightarrow> f x = b\<rbrakk> \<Longrightarrow> thesis; a \<noteq> b\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = b

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (rule_tac f = "\<lambda>x. b" in that) (auto)
[PROOF STATE]
proof (state)
this:
thesis

goal (1 subgoal):
 1. \<lbrakk>\<And>f. \<lbrakk>continuous_on U f; \<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b; \<And>x. x \<in> S \<Longrightarrow> f x = a; \<And>x. x \<in> T \<Longrightarrow> f x = b\<rbrakk> \<Longrightarrow> thesis; a \<noteq> b\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>f. \<lbrakk>continuous_on U f; \<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b; \<And>x. x \<in> S \<Longrightarrow> f x = a; \<And>x. x \<in> T \<Longrightarrow> f x = b\<rbrakk> \<Longrightarrow> thesis; a \<noteq> b\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> b

goal (1 subgoal):
 1. \<lbrakk>\<And>f. \<lbrakk>continuous_on U f; \<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b; \<And>x. x \<in> S \<Longrightarrow> f x = a; \<And>x. x \<in> T \<Longrightarrow> f x = b\<rbrakk> \<Longrightarrow> thesis; a \<noteq> b\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b

goal (1 subgoal):
 1. thesis
[PROOF STEP]
apply (rule Urysohn_local_strong [OF assms])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. \<lbrakk>continuous_on U f; \<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b; \<And>x. x \<in> U \<Longrightarrow> (f x = a) = (x \<in> S); \<And>x. x \<in> U \<Longrightarrow> (f x = b) = (x \<in> T)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
apply (erule that, assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>f x. \<lbrakk>\<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b; \<And>x. x \<in> U \<Longrightarrow> (f x = a) = (x \<in> S); \<And>x. x \<in> U \<Longrightarrow> (f x = b) = (x \<in> T); x \<in> S\<rbrakk> \<Longrightarrow> f x = a
 2. \<And>f x. \<lbrakk>\<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b; \<And>x. x \<in> U \<Longrightarrow> (f x = a) = (x \<in> S); \<And>x. x \<in> U \<Longrightarrow> (f x = b) = (x \<in> T); x \<in> T\<rbrakk> \<Longrightarrow> f x = b
[PROOF STEP]
apply (meson US closedin_singleton closedin_trans)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f x. \<lbrakk>\<And>x. x \<in> U \<Longrightarrow> f x \<in> closed_segment a b; \<And>x. x \<in> U \<Longrightarrow> (f x = a) = (x \<in> S); \<And>x. x \<in> U \<Longrightarrow> (f x = b) = (x \<in> T); x \<in> T\<rbrakk> \<Longrightarrow> f x = b
[PROOF STEP]
apply (meson UT closedin_singleton closedin_trans)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ordIso_Fpow_mono:
assumes "r \<le>o r'"
shows "|Fpow(Field r)| \<le>o |Fpow(Field r')|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |Fpow (Field r)| \<le>o |Fpow (Field r')|
[PROOF STEP]
using assms card_of_mono2 card_of_Fpow_mono
[PROOF STATE]
proof (prove)
using this:
r \<le>o r'
?r \<le>o ?r' \<Longrightarrow> |Field ?r| \<le>o |Field ?r'|
|?A| \<le>o |?B| \<Longrightarrow> |Fpow ?A| \<le>o |Fpow ?B|

goal (1 subgoal):
 1. |Fpow (Field r)| \<le>o |Fpow (Field r')|
[PROOF STEP]
by blast


[STATEMENT]
lemma Nset_1_1:"(k \<le> Suc 0) = (k = 0 \<or> k = Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (k \<le> Suc 0) = (k = 0 \<or> k = Suc 0)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. k \<le> Suc 0 \<Longrightarrow> k = 0 \<or> k = Suc 0
 2. k = 0 \<or> k = Suc 0 \<Longrightarrow> k \<le> Suc 0
[PROOF STEP]
apply (case_tac "k = 0", simp+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k = 0 \<or> k = Suc 0 \<Longrightarrow> k \<le> Suc 0
[PROOF STEP]
apply (erule disjE, simp+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma good_card_imp_finite : "of_nat (card A) \<noteq> (0::'a::semiring_1) \<Longrightarrow> finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (card A) \<noteq> (0::'a) \<Longrightarrow> finite A
[PROOF STEP]
using card_ge_0_finite[of A]
[PROOF STATE]
proof (prove)
using this:
0 < card A \<Longrightarrow> finite A

goal (1 subgoal):
 1. of_nat (card A) \<noteq> (0::'a) \<Longrightarrow> finite A
[PROOF STEP]
by fastforce


[STATEMENT]
lemma compos_aI_surj:"\<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; g \<in> aHom B A;
                      compos A g f = aI\<^bsub>A\<^esub>\<rbrakk> \<Longrightarrow> surjec\<^bsub>B,A\<^esub> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; g \<in> aHom B A; compos A g f = aI\<^bsub>A\<^esub>\<rbrakk> \<Longrightarrow> surjec\<^bsub>B,A\<^esub> g
[PROOF STEP]
apply (simp add:surjec_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; g \<in> aHom B A; compos A g f = aI\<^bsub>A\<^esub>\<rbrakk> \<Longrightarrow> surj_to g (carrier B) (carrier A)
[PROOF STEP]
apply (rule surj_to_test[of "g" "carrier B" "carrier A"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; g \<in> aHom B A; compos A g f = aI\<^bsub>A\<^esub>\<rbrakk> \<Longrightarrow> g \<in> carrier B \<rightarrow> carrier A
 2. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; g \<in> aHom B A; compos A g f = aI\<^bsub>A\<^esub>\<rbrakk> \<Longrightarrow> \<forall>b\<in>carrier A. \<exists>a\<in>carrier B. g a = b
[PROOF STEP]
apply (simp add:aHom_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; g \<in> aHom B A; compos A g f = aI\<^bsub>A\<^esub>\<rbrakk> \<Longrightarrow> \<forall>b\<in>carrier A. \<exists>a\<in>carrier B. g a = b
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; g \<in> aHom B A; compos A g f = aI\<^bsub>A\<^esub>; b \<in> carrier A\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier B. g a = b
[PROOF STEP]
apply (subgoal_tac "compos A g f b = aI\<^bsub>A\<^esub> b",
        thin_tac "compos A g f = aI\<^bsub>A\<^esub>")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; g \<in> aHom B A; b \<in> carrier A; compos A g f b = aI\<^bsub>A\<^esub> b\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier B. g a = b
 2. \<And>b. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; g \<in> aHom B A; compos A g f = aI\<^bsub>A\<^esub>; b \<in> carrier A\<rbrakk> \<Longrightarrow> compos A g f b = aI\<^bsub>A\<^esub> b
[PROOF STEP]
apply (simp add:compos_def compose_def ag_idmap_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; g \<in> aHom B A; b \<in> carrier A; g (f b) = b\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier B. g a = b
 2. \<And>b. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; g \<in> aHom B A; compos A g f = aI\<^bsub>A\<^esub>; b \<in> carrier A\<rbrakk> \<Longrightarrow> compos A g f b = aI\<^bsub>A\<^esub> b
[PROOF STEP]
apply (frule_tac a = b in aHom_mem[of "A" "B" "f"], assumption+, blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; g \<in> aHom B A; compos A g f = aI\<^bsub>A\<^esub>; b \<in> carrier A\<rbrakk> \<Longrightarrow> compos A g f b = aI\<^bsub>A\<^esub> b
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fds_euler_product_LIMSEQ':
  fixes f :: "'a :: {nat_power, real_normed_field, banach, second_countable_topology} fds"
  assumes "completely_multiplicative_function (fds_nth f)" and "fds_abs_converges f s"
  shows   "(\<lambda>n. \<Prod>p\<le>n. if prime p then inverse (1 - fds_nth f p / nat_power p s) else 1) \<longlonglongrightarrow>
             eval_fds f s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - fds_nth f p / nat_power p s) else (1::'a)) \<longlonglongrightarrow> eval_fds f s
[PROOF STEP]
unfolding eval_fds_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Prod>p\<le>n. if prime p then inverse ((1::'a) - fds_nth f p / nat_power p s) else (1::'a)) \<longlonglongrightarrow> (\<Sum>n. fds_nth f n / nat_power n s)
[PROOF STEP]
proof (rule euler_product_LIMSEQ')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. summable (\<lambda>n. norm (fds_nth f n / nat_power n s))
 2. completely_multiplicative_function (\<lambda>p. fds_nth f p / nat_power p s)
[PROOF STEP]
show "completely_multiplicative_function (\<lambda>n. fds_nth f n / nat_power n s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. completely_multiplicative_function (\<lambda>n. fds_nth f n / nat_power n s)
[PROOF STEP]
by (rule completely_multiplicative_function_divide_nat_power) fact+
[PROOF STATE]
proof (state)
this:
completely_multiplicative_function (\<lambda>n. fds_nth f n / nat_power n s)

goal (1 subgoal):
 1. summable (\<lambda>n. norm (fds_nth f n / nat_power n s))
[PROOF STEP]
qed (insert assms, auto simp: fds_abs_converges_def)


[STATEMENT]
lemma (in prob_space) standard_normal_distributed_variance:
  "distributed M lborel X std_normal_density \<Longrightarrow> variance X = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel X (\<lambda>x. ennreal (std_normal_density x)) \<Longrightarrow> expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = 1
[PROOF STEP]
using normal_distributed_variance[of 1 X 0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 1; distributed M lborel X (\<lambda>x. ennreal (std_normal_density x))\<rbrakk> \<Longrightarrow> expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = 1\<^sup>2

goal (1 subgoal):
 1. distributed M lborel X (\<lambda>x. ennreal (std_normal_density x)) \<Longrightarrow> expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma ivl_integral_diff:
  "f integrable_on (closed_segment s t) \<Longrightarrow> g integrable_on (closed_segment s t) \<Longrightarrow>
    ivl_integral s t (\<lambda>x. f x - g x) = ivl_integral s t f - ivl_integral s t g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f integrable_on closed_segment s t; g integrable_on closed_segment s t\<rbrakk> \<Longrightarrow> ivl_integral s t (\<lambda>x. f x - g x) = ivl_integral s t f - ivl_integral s t g
[PROOF STEP]
using Henstock_Kurzweil_Integration.integral_diff[of f "closed_segment s t" g]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f integrable_on closed_segment s t; g integrable_on closed_segment s t\<rbrakk> \<Longrightarrow> integral (closed_segment s t) (\<lambda>x. f x - g x) = integral (closed_segment s t) f - integral (closed_segment s t) g

goal (1 subgoal):
 1. \<lbrakk>f integrable_on closed_segment s t; g integrable_on closed_segment s t\<rbrakk> \<Longrightarrow> ivl_integral s t (\<lambda>x. f x - g x) = ivl_integral s t f - ivl_integral s t g
[PROOF STEP]
by (auto simp: ivl_integral_def closed_segment_eq_real_ivl split: if_split_asm)


[STATEMENT]
lemma LIMSEQ_divide_realpow_zero: "1 < x \<Longrightarrow> (\<lambda>n. a / (x ^ n) :: real) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < x \<Longrightarrow> (\<lambda>n. a / x ^ n) \<longlonglongrightarrow> 0
[PROOF STEP]
by (rule tendsto_divide_0 [OF tendsto_const filterlim_realpow_sequentially_gt1]) simp


[STATEMENT]
lemma image_diff_disjoint_image_Int: "
  \<lbrakk> f ` (A - B) \<inter> f ` B = {} \<rbrakk> \<Longrightarrow>
  f ` (A \<inter> B) = f ` A \<inter> f ` B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` (A - B) \<inter> f ` B = {} \<Longrightarrow> f ` (A \<inter> B) = f ` A \<inter> f ` B
[PROOF STEP]
apply (rule set_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. f ` (A - B) \<inter> f ` B = {} \<Longrightarrow> (x \<in> f ` (A \<inter> B)) = (x \<in> f ` A \<inter> f ` B)
[PROOF STEP]
apply (simp add: image_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. f ` (A - B) \<inter> f ` B = {} \<Longrightarrow> (\<exists>xa\<in>A \<inter> B. x = f xa) = ((\<exists>xa\<in>A. x = f xa) \<and> (\<exists>xa\<in>B. x = f xa))
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma list_before_rel_alt: "list_before_rel l = { (l!i, l!j) | i j. i<j \<and> j<length l }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_before_rel l = {(l ! i, l ! j) |i j. i < j \<and> j < length l}
[PROOF STEP]
unfolding list_before_rel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(a, b). \<exists>l1 l2 l3. l = l1 @ a # l2 @ b # l3} = {(l ! i, l ! j) |i j. i < j \<and> j < length l}
[PROOF STEP]
apply (rule; clarsimp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b l1 l2 l3. l = l1 @ a # l2 @ b # l3 \<Longrightarrow> \<exists>i. a = (l1 @ a # l2 @ b # l3) ! i \<and> (\<exists>j. b = (l1 @ a # l2 @ b # l3) ! j \<and> i < j \<and> j < Suc (Suc (length l1 + (length l2 + length l3))))
 2. \<And>i j. \<lbrakk>i < j; j < length l\<rbrakk> \<Longrightarrow> \<exists>l1 l2 l3. l = l1 @ l ! i # l2 @ l ! j # l3
[PROOF STEP]
subgoal for a b l1 l2 l3
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l = l1 @ a # l2 @ b # l3 \<Longrightarrow> \<exists>i. a = (l1 @ a # l2 @ b # l3) ! i \<and> (\<exists>j. b = (l1 @ a # l2 @ b # l3) ! j \<and> i < j \<and> j < Suc (Suc (length l1 + (length l2 + length l3))))
[PROOF STEP]
apply (rule exI[of _ "length l1"]; simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l = l1 @ a # l2 @ b # l3 \<Longrightarrow> \<exists>j. b = (l1 @ a # l2 @ b # l3) ! j \<and> length l1 < j \<and> j < Suc (Suc (length l1 + (length l2 + length l3)))
[PROOF STEP]
apply (rule exI[of _ "length l1 + Suc (length l2)"]; auto simp: nth_append)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < j; j < length l\<rbrakk> \<Longrightarrow> \<exists>l1 l2 l3. l = l1 @ l ! i # l2 @ l ! j # l3
[PROOF STEP]
subgoal for i j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < j; j < length l\<rbrakk> \<Longrightarrow> \<exists>l1 l2 l3. l = l1 @ l ! i # l2 @ l ! j # l3
[PROOF STEP]
apply (rule exI[of _ "take i l"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < j; j < length l\<rbrakk> \<Longrightarrow> \<exists>l2 l3. l = take i l @ l ! i # l2 @ l ! j # l3
[PROOF STEP]
apply (rule exI[of _ "drop (Suc i) (take j l)"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < j; j < length l\<rbrakk> \<Longrightarrow> \<exists>l3. l = take i l @ l ! i # drop (Suc i) (take j l) @ l ! j # l3
[PROOF STEP]
apply (rule exI[of _ "drop (Suc j) l"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < j; j < length l\<rbrakk> \<Longrightarrow> l = take i l @ l ! i # drop (Suc i) (take j l) @ l ! j # drop (Suc j) l
[PROOF STEP]
by (simp add: Cons_nth_drop_Suc drop_take_drop_unsplit)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma coeff_subresultant_0_0_resultant: "coeff (subresultant 0 f g) 0 = resultant f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (subresultant 0 f g) 0 = resultant f g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeff (subresultant 0 f g) 0 = resultant f g
[PROOF STEP]
let ?M = "transpose_mat (subresultant'_mat 0 0 f g)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeff (subresultant 0 f g) 0 = resultant f g
[PROOF STEP]
have "det (subresultant'_mat 0 0 f g) = det ?M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (subresultant'_mat 0 0 f g) = det (subresultant'_mat 0 0 f g)\<^sup>T
[PROOF STEP]
by (subst det_transpose, auto simp: subresultant'_mat_def Let_def)
[PROOF STATE]
proof (state)
this:
det (subresultant'_mat 0 0 f g) = det (subresultant'_mat 0 0 f g)\<^sup>T

goal (1 subgoal):
 1. coeff (subresultant 0 f g) 0 = resultant f g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (subresultant'_mat 0 0 f g) = det (subresultant'_mat 0 0 f g)\<^sup>T

goal (1 subgoal):
 1. coeff (subresultant 0 f g) 0 = resultant f g
[PROOF STEP]
have "?M = sylvester_mat f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (subresultant'_mat 0 0 f g)\<^sup>T = sylvester_mat f g
[PROOF STEP]
by (rule subresultant'_mat_sylvester_mat)
[PROOF STATE]
proof (state)
this:
(subresultant'_mat 0 0 f g)\<^sup>T = sylvester_mat f g

goal (1 subgoal):
 1. coeff (subresultant 0 f g) 0 = resultant f g
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (subresultant'_mat 0 0 f g) = det (sylvester_mat f g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det (subresultant'_mat 0 0 f g) = det (sylvester_mat f g)

goal (1 subgoal):
 1. coeff (subresultant 0 f g) 0 = resultant f g
[PROOF STEP]
by (simp add: coeff_subresultant resultant_def)
[PROOF STATE]
proof (state)
this:
coeff (subresultant 0 f g) 0 = resultant f g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_power_int [continuous_intros]:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_div_algebra"
  assumes "continuous_on s f" and "\<forall>x\<in>s. f x \<noteq> 0"
  shows "continuous_on s (\<lambda>x. power_int (f x) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s (\<lambda>x. f x powi n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_on s f
\<forall>x\<in>s. f x \<noteq> (0::'b)

goal (1 subgoal):
 1. continuous_on s (\<lambda>x. f x powi n)
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s)
\<forall>x\<in>s. f x \<noteq> (0::'b)

goal (1 subgoal):
 1. \<forall>x\<in>s. ((\<lambda>x. f x powi n) \<longlongrightarrow> f x powi n) (at x within s)
[PROOF STEP]
by (blast intro: tendsto_power_int)


[STATEMENT]
lemma conjugate_in_unit_disc_compl [simp]:
  assumes "z \<in> unit_disc_compl"
  shows "conjugate z \<in> unit_disc_compl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate z \<in> unit_disc_compl
[PROOF STEP]
using conjugate_unit_disc_compl
[PROOF STATE]
proof (prove)
using this:
conjugate ` unit_disc_compl = unit_disc_compl

goal (1 subgoal):
 1. conjugate z \<in> unit_disc_compl
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
conjugate ` unit_disc_compl = unit_disc_compl
z \<in> unit_disc_compl

goal (1 subgoal):
 1. conjugate z \<in> unit_disc_compl
[PROOF STEP]
by blast


[STATEMENT]
lemma sin_zero_lemma:
  assumes "0 \<le> x" "sin x = 0"
  shows "\<exists>n::nat. even n \<and> x = real n * (pi/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. even n \<and> x = real n * (pi / 2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>n. even n \<and> x = real n * (pi / 2)
[PROOF STEP]
obtain n where "odd n" and n: "x + pi/2 = of_nat n * (pi/2)" "n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. \<lbrakk>odd n; x + pi / 2 = real n * (pi / 2); 0 < n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using cos_zero_lemma [of "x + pi/2"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> x + pi / 2; cos (x + pi / 2) = 0\<rbrakk> \<Longrightarrow> \<exists>n. odd n \<and> x + pi / 2 = real n * (pi / 2)
0 \<le> x
sin x = 0

goal (1 subgoal):
 1. (\<And>n. \<lbrakk>odd n; x + pi / 2 = real n * (pi / 2); 0 < n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: cos_add)
[PROOF STATE]
proof (state)
this:
odd n
x + pi / 2 = real n * (pi / 2)
0 < n

goal (1 subgoal):
 1. \<exists>n. even n \<and> x = real n * (pi / 2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
odd n
x + pi / 2 = real n * (pi / 2)
0 < n
[PROOF STEP]
have "x = real (n - 1) * (pi / 2)"
[PROOF STATE]
proof (prove)
using this:
odd n
x + pi / 2 = real n * (pi / 2)
0 < n

goal (1 subgoal):
 1. x = real (n - 1) * (pi / 2)
[PROOF STEP]
by (simp add: algebra_simps of_nat_diff)
[PROOF STATE]
proof (state)
this:
x = real (n - 1) * (pi / 2)

goal (1 subgoal):
 1. \<exists>n. even n \<and> x = real n * (pi / 2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = real (n - 1) * (pi / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = real (n - 1) * (pi / 2)

goal (1 subgoal):
 1. \<exists>n. even n \<and> x = real n * (pi / 2)
[PROOF STEP]
by (simp add: \<open>odd n\<close>)
[PROOF STATE]
proof (state)
this:
\<exists>n. even n \<and> x = real n * (pi / 2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linear_bounded_pos:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
  assumes lf: "linear f"
 obtains B where "B > 0" "\<And>x. norm (f x) \<le> B * norm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>x. norm (f x) \<le> B * norm x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>x. norm (f x) \<le> B * norm x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "\<exists>B > 0. \<forall>x. norm (f x) \<le> norm x * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B>0. \<forall>x. norm (f x) \<le> norm x * B
[PROOF STEP]
using lf
[PROOF STATE]
proof (prove)
using this:
linear f

goal (1 subgoal):
 1. \<exists>B>0. \<forall>x. norm (f x) \<le> norm x * B
[PROOF STEP]
unfolding linear_conv_bounded_linear
[PROOF STATE]
proof (prove)
using this:
bounded_linear f

goal (1 subgoal):
 1. \<exists>B>0. \<forall>x. norm (f x) \<le> norm x * B
[PROOF STEP]
by (rule bounded_linear.pos_bounded)
[PROOF STATE]
proof (state)
this:
\<exists>B>0. \<forall>x. norm (f x) \<le> norm x * B

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>x. norm (f x) \<le> B * norm x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < ?B; \<And>x. norm (f x) \<le> ?B * norm x\<rbrakk> \<Longrightarrow> thesis
\<exists>B>0. \<forall>x. norm (f x) \<le> norm x * B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?B; \<And>x. norm (f x) \<le> ?B * norm x\<rbrakk> \<Longrightarrow> thesis
\<exists>B>0. \<forall>x. norm (f x) \<le> norm x * B

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (auto simp: mult.commute)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma binomial_strict_mono:
  assumes "k < k'" "2*k' \<le> n"
  shows   "n choose k < n choose k'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose k < n choose k'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n choose k < n choose k'
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
k < k'
2 * k' \<le> n
[PROOF STEP]
have "k \<le> k' - 1"
[PROOF STATE]
proof (prove)
using this:
k < k'
2 * k' \<le> n

goal (1 subgoal):
 1. k \<le> k' - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k \<le> k' - 1

goal (1 subgoal):
 1. n choose k < n choose k'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
k \<le> k' - 1

goal (1 subgoal):
 1. n choose k < n choose k'
[PROOF STEP]
proof (induction rule: inc_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n choose (k' - 1) < n choose k'
 2. \<And>na. \<lbrakk>k \<le> na; na < k' - 1; n choose Suc na < n choose k'\<rbrakk> \<Longrightarrow> n choose na < n choose k'
[PROOF STEP]
case base
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. n choose (k' - 1) < n choose k'
 2. \<And>na. \<lbrakk>k \<le> na; na < k' - 1; n choose Suc na < n choose k'\<rbrakk> \<Longrightarrow> n choose na < n choose k'
[PROOF STEP]
with assms binomial_less_binomial_Suc[of "k' - 1" n]
[PROOF STATE]
proof (chain)
picking this:
k < k'
2 * k' \<le> n
k' - 1 < n div 2 \<Longrightarrow> n choose (k' - 1) < n choose Suc (k' - 1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
k < k'
2 * k' \<le> n
k' - 1 < n div 2 \<Longrightarrow> n choose (k' - 1) < n choose Suc (k' - 1)

goal (1 subgoal):
 1. n choose (k' - 1) < n choose k'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n choose (k' - 1) < n choose k'

goal (1 subgoal):
 1. \<And>na. \<lbrakk>k \<le> na; na < k' - 1; n choose Suc na < n choose k'\<rbrakk> \<Longrightarrow> n choose na < n choose k'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>k \<le> na; na < k' - 1; n choose Suc na < n choose k'\<rbrakk> \<Longrightarrow> n choose na < n choose k'
[PROOF STEP]
case (step k)
[PROOF STATE]
proof (state)
this:
k \<le> k
k < k' - 1
n choose Suc k < n choose k'

goal (1 subgoal):
 1. \<And>na. \<lbrakk>k \<le> na; na < k' - 1; n choose Suc na < n choose k'\<rbrakk> \<Longrightarrow> n choose na < n choose k'
[PROOF STEP]
from step.prems step.hyps assms
[PROOF STATE]
proof (chain)
picking this:
k \<le> k
k < k' - 1
k < k'
2 * k' \<le> n
[PROOF STEP]
have "n choose k < n choose (Suc k)"
[PROOF STATE]
proof (prove)
using this:
k \<le> k
k < k' - 1
k < k'
2 * k' \<le> n

goal (1 subgoal):
 1. n choose k < n choose Suc k
[PROOF STEP]
by (intro binomial_less_binomial_Suc) simp_all
[PROOF STATE]
proof (state)
this:
n choose k < n choose Suc k

goal (1 subgoal):
 1. \<And>na. \<lbrakk>k \<le> na; na < k' - 1; n choose Suc na < n choose k'\<rbrakk> \<Longrightarrow> n choose na < n choose k'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n choose k < n choose Suc k

goal (1 subgoal):
 1. \<And>na. \<lbrakk>k \<le> na; na < k' - 1; n choose Suc na < n choose k'\<rbrakk> \<Longrightarrow> n choose na < n choose k'
[PROOF STEP]
have "\<dots> < n choose k'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose Suc k < n choose k'
[PROOF STEP]
by (rule step.IH)
[PROOF STATE]
proof (state)
this:
n choose Suc k < n choose k'

goal (1 subgoal):
 1. \<And>na. \<lbrakk>k \<le> na; na < k' - 1; n choose Suc na < n choose k'\<rbrakk> \<Longrightarrow> n choose na < n choose k'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
n choose k < n choose k'
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
n choose k < n choose k'

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
n choose k < n choose k'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma numeral_list_last_is_Oc: "(nl::nat list) \<noteq> [] \<Longrightarrow> last (<nl>) = Oc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nl \<noteq> [] \<Longrightarrow> last (<nl>) = Oc
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nl \<noteq> [] \<Longrightarrow> last (<nl>) = Oc
[PROOF STEP]
assume A: "(nl::nat list) \<noteq> []"
[PROOF STATE]
proof (state)
this:
nl \<noteq> []

goal (1 subgoal):
 1. nl \<noteq> [] \<Longrightarrow> last (<nl>) = Oc
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nl \<noteq> []
[PROOF STEP]
have "<nl> = <rev (rev nl)>"
[PROOF STATE]
proof (prove)
using this:
nl \<noteq> []

goal (1 subgoal):
 1. <nl> = <rev (rev nl)>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
<nl> = <rev (rev nl)>

goal (1 subgoal):
 1. nl \<noteq> [] \<Longrightarrow> last (<nl>) = Oc
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
<nl> = <rev (rev nl)>

goal (1 subgoal):
 1. nl \<noteq> [] \<Longrightarrow> last (<nl>) = Oc
[PROOF STEP]
have "... = rev (<rev nl>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <rev (rev nl)> = rev (<rev nl>)
[PROOF STEP]
by (auto simp add: rev_numeral_list)
[PROOF STATE]
proof (state)
this:
<rev (rev nl)> = rev (<rev nl>)

goal (1 subgoal):
 1. nl \<noteq> [] \<Longrightarrow> last (<nl>) = Oc
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
<nl> = rev (<rev nl>)
[PROOF STEP]
have "<nl> = rev (<rev nl>)"
[PROOF STATE]
proof (prove)
using this:
<nl> = rev (<rev nl>)

goal (1 subgoal):
 1. <nl> = rev (<rev nl>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
<nl> = rev (<rev nl>)

goal (1 subgoal):
 1. nl \<noteq> [] \<Longrightarrow> last (<nl>) = Oc
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
<nl> = rev (<rev nl>)

goal (1 subgoal):
 1. nl \<noteq> [] \<Longrightarrow> last (<nl>) = Oc
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
nl \<noteq> []
[PROOF STEP]
have "hd (<rev nl>) = Oc"
[PROOF STATE]
proof (prove)
using this:
nl \<noteq> []

goal (1 subgoal):
 1. hd (<rev nl>) = Oc
[PROOF STEP]
by (auto simp add: numeral_list_head_is_Oc)
[PROOF STATE]
proof (state)
this:
hd (<rev nl>) = Oc

goal (1 subgoal):
 1. nl \<noteq> [] \<Longrightarrow> last (<nl>) = Oc
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
nl \<noteq> []
hd (<rev nl>) = Oc
[PROOF STEP]
have "last (rev (<rev nl>)) = Oc"
[PROOF STATE]
proof (prove)
using this:
nl \<noteq> []
hd (<rev nl>) = Oc

goal (1 subgoal):
 1. last (rev (<rev nl>)) = Oc
[PROOF STEP]
by (simp add: last_rev)
[PROOF STATE]
proof (state)
this:
last (rev (<rev nl>)) = Oc

goal (1 subgoal):
 1. nl \<noteq> [] \<Longrightarrow> last (<nl>) = Oc
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
<nl> = rev (<rev nl>)
last (rev (<rev nl>)) = Oc
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
<nl> = rev (<rev nl>)
last (rev (<rev nl>)) = Oc

goal (1 subgoal):
 1. last (<nl>) = Oc
[PROOF STEP]
by (simp add: \<open>last (rev (<rev nl>)) = Oc\<close>)
[PROOF STATE]
proof (state)
this:
last (<nl>) = Oc

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma q11_upto_def: "q11 = (\<lambda>k. k\<^sup>2 mod 11) ` {..<11}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q11 = (\<lambda>k. k\<^sup>2 mod 11) ` {..<11}
[PROOF STEP]
by (simp add: q11_def lessThan_nat_numeral lessThan_Suc insert_commute)


[STATEMENT]
lemma cong_diff_iff_cong_0_nat:
  "[a - b = 0] (mod m) \<longleftrightarrow> [a = b] (mod m)" if "a \<ge> b" for a b :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a - b = 0] (mod m) = [a = b] (mod m)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
b \<le> a

goal (1 subgoal):
 1. [a - b = 0] (mod m) = [a = b] (mod m)
[PROOF STEP]
by (simp add: cong_0_iff) (simp add: cong_def mod_eq_dvd_iff_nat)


[STATEMENT]
lemma scalar_prod_last: assumes "length v1 = length v2"
  shows "scalar_prod (v1 @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod v1 v2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scalar_prod (v1 @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod v1 v2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2

goal (1 subgoal):
 1. scalar_prod (v1 @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod v1 v2
[PROOF STEP]
proof (induct v1 arbitrary: v2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>v2. length [] = length v2 \<Longrightarrow> scalar_prod ([] @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod [] v2
 2. \<And>a v1 v2. \<lbrakk>\<And>v2. length v1 = length v2 \<Longrightarrow> scalar_prod (v1 @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod v1 v2; length (a # v1) = length v2\<rbrakk> \<Longrightarrow> scalar_prod ((a # v1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (a # v1) v2
[PROOF STEP]
case (Cons y1 w1)
[PROOF STATE]
proof (state)
this:
length w1 = length ?v2.1 \<Longrightarrow> scalar_prod (w1 @ [x1]) (?v2.1 @ [x2]) = x1 * x2 + scalar_prod w1 ?v2.1
length (y1 # w1) = length v2

goal (2 subgoals):
 1. \<And>v2. length [] = length v2 \<Longrightarrow> scalar_prod ([] @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod [] v2
 2. \<And>a v1 v2. \<lbrakk>\<And>v2. length v1 = length v2 \<Longrightarrow> scalar_prod (v1 @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod v1 v2; length (a # v1) = length v2\<rbrakk> \<Longrightarrow> scalar_prod ((a # v1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (a # v1) v2
[PROOF STEP]
from Cons(2)
[PROOF STATE]
proof (chain)
picking this:
length (y1 # w1) = length v2
[PROOF STEP]
obtain y2 w2 where v2: "v2 = Cons y2 w2" and len: "length w1 = length w2"
[PROOF STATE]
proof (prove)
using this:
length (y1 # w1) = length v2

goal (1 subgoal):
 1. (\<And>y2 w2. \<lbrakk>v2 = y2 # w2; length w1 = length w2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases v2, auto)
[PROOF STATE]
proof (state)
this:
v2 = y2 # w2
length w1 = length w2

goal (2 subgoals):
 1. \<And>v2. length [] = length v2 \<Longrightarrow> scalar_prod ([] @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod [] v2
 2. \<And>a v1 v2. \<lbrakk>\<And>v2. length v1 = length v2 \<Longrightarrow> scalar_prod (v1 @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod v1 v2; length (a # v1) = length v2\<rbrakk> \<Longrightarrow> scalar_prod ((a # v1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (a # v1) v2
[PROOF STEP]
from Cons(1)[OF len]
[PROOF STATE]
proof (chain)
picking this:
scalar_prod (w1 @ [x1]) (w2 @ [x2]) = x1 * x2 + scalar_prod w1 w2
[PROOF STEP]
have rec: "scalar_prod (w1 @ [x1]) (w2 @ [x2]) = x1 * x2 + scalar_prod w1 w2"
[PROOF STATE]
proof (prove)
using this:
scalar_prod (w1 @ [x1]) (w2 @ [x2]) = x1 * x2 + scalar_prod w1 w2

goal (1 subgoal):
 1. scalar_prod (w1 @ [x1]) (w2 @ [x2]) = x1 * x2 + scalar_prod w1 w2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
scalar_prod (w1 @ [x1]) (w2 @ [x2]) = x1 * x2 + scalar_prod w1 w2

goal (2 subgoals):
 1. \<And>v2. length [] = length v2 \<Longrightarrow> scalar_prod ([] @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod [] v2
 2. \<And>a v1 v2. \<lbrakk>\<And>v2. length v1 = length v2 \<Longrightarrow> scalar_prod (v1 @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod v1 v2; length (a # v1) = length v2\<rbrakk> \<Longrightarrow> scalar_prod ((a # v1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (a # v1) v2
[PROOF STEP]
have "scalar_prod ((y1 # w1) @ [x1]) (v2 @ [x2]) =
    (y1 * y2 + x1 * x2) + scalar_prod w1 w2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scalar_prod ((y1 # w1) @ [x1]) (v2 @ [x2]) = y1 * y2 + x1 * x2 + scalar_prod w1 w2
[PROOF STEP]
by (simp add: scalar_prod_cons v2 rec add.assoc)
[PROOF STATE]
proof (state)
this:
scalar_prod ((y1 # w1) @ [x1]) (v2 @ [x2]) = y1 * y2 + x1 * x2 + scalar_prod w1 w2

goal (2 subgoals):
 1. \<And>v2. length [] = length v2 \<Longrightarrow> scalar_prod ([] @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod [] v2
 2. \<And>a v1 v2. \<lbrakk>\<And>v2. length v1 = length v2 \<Longrightarrow> scalar_prod (v1 @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod v1 v2; length (a # v1) = length v2\<rbrakk> \<Longrightarrow> scalar_prod ((a # v1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (a # v1) v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
scalar_prod ((y1 # w1) @ [x1]) (v2 @ [x2]) = y1 * y2 + x1 * x2 + scalar_prod w1 w2

goal (2 subgoals):
 1. \<And>v2. length [] = length v2 \<Longrightarrow> scalar_prod ([] @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod [] v2
 2. \<And>a v1 v2. \<lbrakk>\<And>v2. length v1 = length v2 \<Longrightarrow> scalar_prod (v1 @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod v1 v2; length (a # v1) = length v2\<rbrakk> \<Longrightarrow> scalar_prod ((a # v1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (a # v1) v2
[PROOF STEP]
have "\<dots> = (x1 * x2 + y1 * y2) + scalar_prod w1 w2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y1 * y2 + x1 * x2 + scalar_prod w1 w2 = x1 * x2 + y1 * y2 + scalar_prod w1 w2
[PROOF STEP]
using add.commute[of "x1 * x2"]
[PROOF STATE]
proof (prove)
using this:
x1 * x2 + ?b = ?b + x1 * x2

goal (1 subgoal):
 1. y1 * y2 + x1 * x2 + scalar_prod w1 w2 = x1 * x2 + y1 * y2 + scalar_prod w1 w2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y1 * y2 + x1 * x2 + scalar_prod w1 w2 = x1 * x2 + y1 * y2 + scalar_prod w1 w2

goal (2 subgoals):
 1. \<And>v2. length [] = length v2 \<Longrightarrow> scalar_prod ([] @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod [] v2
 2. \<And>a v1 v2. \<lbrakk>\<And>v2. length v1 = length v2 \<Longrightarrow> scalar_prod (v1 @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod v1 v2; length (a # v1) = length v2\<rbrakk> \<Longrightarrow> scalar_prod ((a # v1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (a # v1) v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
y1 * y2 + x1 * x2 + scalar_prod w1 w2 = x1 * x2 + y1 * y2 + scalar_prod w1 w2

goal (2 subgoals):
 1. \<And>v2. length [] = length v2 \<Longrightarrow> scalar_prod ([] @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod [] v2
 2. \<And>a v1 v2. \<lbrakk>\<And>v2. length v1 = length v2 \<Longrightarrow> scalar_prod (v1 @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod v1 v2; length (a # v1) = length v2\<rbrakk> \<Longrightarrow> scalar_prod ((a # v1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (a # v1) v2
[PROOF STEP]
have "\<dots> = x1 * x2 + (scalar_prod (y1 # w1) v2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x1 * x2 + y1 * y2 + scalar_prod w1 w2 = x1 * x2 + scalar_prod (y1 # w1) v2
[PROOF STEP]
by (simp add: add.assoc scalar_prod_cons v2)
[PROOF STATE]
proof (state)
this:
x1 * x2 + y1 * y2 + scalar_prod w1 w2 = x1 * x2 + scalar_prod (y1 # w1) v2

goal (2 subgoals):
 1. \<And>v2. length [] = length v2 \<Longrightarrow> scalar_prod ([] @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod [] v2
 2. \<And>a v1 v2. \<lbrakk>\<And>v2. length v1 = length v2 \<Longrightarrow> scalar_prod (v1 @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod v1 v2; length (a # v1) = length v2\<rbrakk> \<Longrightarrow> scalar_prod ((a # v1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (a # v1) v2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
scalar_prod ((y1 # w1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (y1 # w1) v2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
scalar_prod ((y1 # w1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (y1 # w1) v2

goal (1 subgoal):
 1. scalar_prod ((y1 # w1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (y1 # w1) v2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
scalar_prod ((y1 # w1) @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod (y1 # w1) v2

goal (1 subgoal):
 1. \<And>v2. length [] = length v2 \<Longrightarrow> scalar_prod ([] @ [x1]) (v2 @ [x2]) = x1 * x2 + scalar_prod [] v2
[PROOF STEP]
qed (simp add: scalar_prodI_def)


[STATEMENT]
lemma Tn_nn_integral_preserving:
  fixes f :: "'a \<Rightarrow> ennreal"
  assumes "f \<in> borel_measurable M"
  shows "(\<integral>\<^sup>+x. f((T^^n) x) \<partial>M) = (\<integral>\<^sup>+x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f ((T ^^ n) x) \<partial>M = integral\<^sup>N M f
[PROOF STEP]
using measure_preserving_preserves_nn_integral[OF Tn_measure_preserving assms(1)]
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>N M f = \<integral>\<^sup>+ x. f ((T ^^ ?n1) x) \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f ((T ^^ n) x) \<partial>M = integral\<^sup>N M f
[PROOF STEP]
by auto


[STATEMENT]
lemma convergent_eq_Cauchy:
  fixes S :: "nat \<Rightarrow> 'a::complete_space"
  shows "(\<exists>l. (S \<longlongrightarrow> l) sequentially) \<longleftrightarrow> Cauchy S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>l. S \<longlonglongrightarrow> l) = Cauchy S
[PROOF STEP]
unfolding Cauchy_convergent_iff convergent_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>l. S \<longlonglongrightarrow> l) = (\<exists>L. S \<longlonglongrightarrow> L)
[PROOF STEP]
..


[STATEMENT]
lemma sum_outgoing_alt_flow:
  fixes g :: "edge \<Rightarrow> 'capacity"
  assumes "u\<in>V"
  shows "(\<Sum>e\<in>outgoing u. f e) = (\<Sum>v\<in>V. f (u,v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (outgoing u) = (\<Sum>v\<in>V. f (u, v))
[PROOF STEP]
apply (subst sum_outgoing_alt)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<forall>e. (0::'capacity) \<le> f e \<and> f e \<le> c e
 2. u \<in> V
 3. (\<Sum>ua\<in>V. f (u, ua)) = (\<Sum>v\<in>V. f (u, v))
[PROOF STEP]
using assms capacity_const
[PROOF STATE]
proof (prove)
using this:
u \<in> V
\<forall>e. (0::'capacity) \<le> f e \<and> f e \<le> c e

goal (3 subgoals):
 1. \<forall>e. (0::'capacity) \<le> f e \<and> f e \<le> c e
 2. u \<in> V
 3. (\<Sum>ua\<in>V. f (u, ua)) = (\<Sum>v\<in>V. f (u, v))
[PROOF STEP]
by auto


[STATEMENT]
lemma comm_monoidI:
  fixes G (structure)
  assumes m_closed:
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y \<in> carrier G"
    and one_closed: "\<one> \<in> carrier G"
    and m_assoc:
      "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
      (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
    and l_one: "!!x. x \<in> carrier G ==> \<one> \<otimes> x = x"
    and m_comm:
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y = y \<otimes> x"
  shows "comm_monoid G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.comm_monoid G
[PROOF STEP]
using l_one
[PROOF STATE]
proof (prove)
using this:
?x \<in> carrier G \<Longrightarrow> \<one> \<otimes> ?x = ?x

goal (1 subgoal):
 1. Group.comm_monoid G
[PROOF STEP]
by (auto intro!: comm_monoid.intro comm_monoid_axioms.intro monoid.intro
             intro: assms simp: m_closed one_closed m_comm)


[STATEMENT]
theorem allActT:  "\<turnstile> (\<forall>x. \<box>[F x]_v) = (\<box>[(\<forall>x. F x)]_v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> (\<forall>x. \<box>[F x]_v) = \<box>[(\<forall>x. F x)]_v
[PROOF STEP]
by (force simp: action_def)


[STATEMENT]
lemma Sup_iter_unfold: "x ^ 0 \<squnion> (\<Squnion>n. x ^ (Suc n)) = (\<Squnion>n. x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ 0 \<squnion> (\<Squnion>n. x ^ Suc n) = \<Squnion> range ((^) x)
[PROOF STEP]
using fSup_unfold
[PROOF STATE]
proof (prove)
using this:
?f 0 \<squnion> (\<Squnion>n. ?f (Suc n)) = \<Squnion> range ?f

goal (1 subgoal):
 1. x ^ 0 \<squnion> (\<Squnion>n. x ^ Suc n) = \<Squnion> range ((^) x)
[PROOF STEP]
by presburger


[STATEMENT]
lemma norm_le_componentwise:
   "(\<And>b. b \<in> Basis \<Longrightarrow> abs(inner x b) \<le> abs(inner y b)) \<Longrightarrow> norm x \<le> norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. b \<in> Basis \<Longrightarrow> \<bar>inner x b\<bar> \<le> \<bar>inner y b\<bar>) \<Longrightarrow> norm x \<le> norm y
[PROOF STEP]
by (auto simp: norm_le euclidean_inner [of x x] euclidean_inner [of y y] abs_le_square_iff power2_eq_square intro!: sum_mono)


[STATEMENT]
lemma lem2:
  fixes f :: "'a \<Rightarrow> 'b::field"
  shows "(\<Sum>x\<in>A. f x * (g x * a)) = a * (\<Sum>x\<in>A. f x * g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>A. f x * (g x * a)) = a * (\<Sum>x\<in>A. f x * g x)
[PROOF STEP]
by (simp add: sum_distrib_left field_simps)


[STATEMENT]
lemma bin_last_def:
  "(odd :: int \<Rightarrow> bool) w \<longleftrightarrow> w mod 2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd w = (w mod 2 = 1)
[PROOF STEP]
by (fact odd_iff_mod_2_eq_one)


[STATEMENT]
lemma in_q11_code: "x mod 11 \<in> q11 \<longleftrightarrow> IArray.sub q11_array (x mod 11)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x mod 11 \<in> q11) = q11_array !! (x mod 11)
[PROOF STEP]
by (subst sub_q11_array) auto


[STATEMENT]
lemma fimage_eq_imp_fcomp:
  assumes "f `\<^sub>\<bullet> A = g `\<^sub>\<bullet> B"
  shows "(h \<circ>\<^sub>\<bullet> f) `\<^sub>\<bullet> A = (h \<circ>\<^sub>\<bullet> g) `\<^sub>\<bullet> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (h \<circ>\<^sub>\<bullet> f) `\<^sub>\<bullet> A = (h \<circ>\<^sub>\<bullet> g) `\<^sub>\<bullet> B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f `\<^sub>\<bullet> A = g `\<^sub>\<bullet> B

goal (1 subgoal):
 1. (h \<circ>\<^sub>\<bullet> f) `\<^sub>\<bullet> A = (h \<circ>\<^sub>\<bullet> g) `\<^sub>\<bullet> B
[PROOF STEP]
by (metis fcomp_fimage)


[STATEMENT]
lemma connected_component_idemp:
  "connected_component_set (connected_component_set S x) x = connected_component_set S x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected_component_set (connected_component_set S x) x = connected_component_set S x
[PROOF STEP]
apply (rule subset_antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. connected_component_set (connected_component_set S x) x \<subseteq> connected_component_set S x
 2. connected_component_set S x \<subseteq> connected_component_set (connected_component_set S x) x
[PROOF STEP]
apply (simp add: connected_component_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected_component_set S x \<subseteq> connected_component_set (connected_component_set S x) x
[PROOF STEP]
apply (metis connected_component_eq_empty connected_component_maximal
      connected_component_refl_eq connected_connected_component mem_Collect_eq set_eq_subset)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma frechet_derivative_fst:
  "frechet_derivative (\<lambda>x. fst (f x)) (at x) = (\<lambda>xa. fst (frechet_derivative f (at x) xa))"
  if "(f differentiable at x)"
  for f::"_\<Rightarrow>(_::real_normed_vector \<times> _::real_normed_vector)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frechet_derivative (\<lambda>x. fst (f x)) (at x) = (\<lambda>xa. fst (frechet_derivative f (at x) xa))
[PROOF STEP]
apply (rule frechet_derivative_at')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. fst (f x)) has_derivative (\<lambda>xa. fst (frechet_derivative f (at x) xa))) (at x)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
f differentiable at x

goal (1 subgoal):
 1. ((\<lambda>x. fst (f x)) has_derivative (\<lambda>xa. fst (frechet_derivative f (at x) xa))) (at x)
[PROOF STEP]
by (auto intro!: derivative_eq_intros frechet_derivative_worksI)


[STATEMENT]
lemma lemVecPlusAssoc:
  shows "u \<oplus> (v \<oplus> w) = (u \<oplus> v) \<oplus> w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<oplus> v \<oplus> w = (u \<oplus> v) \<oplus> w
[PROOF STEP]
by (simp add: add.assoc)


[STATEMENT]
lemma prime_multiplicity_le_imp_dvd:
  assumes "x \<noteq> 0" "y \<noteq> 0"
  shows   "x dvd y \<longleftrightarrow> (\<forall>p. prime p \<longrightarrow> multiplicity p x \<le> multiplicity p y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x dvd y) = (\<forall>p. prime p \<longrightarrow> multiplicity p x \<le> multiplicity p y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)
y \<noteq> (0::'a)

goal (1 subgoal):
 1. (x dvd y) = (\<forall>p. prime p \<longrightarrow> multiplicity p x \<le> multiplicity p y)
[PROOF STEP]
by (auto intro: multiplicity_le_imp_dvd dvd_imp_multiplicity_le)


[STATEMENT]
lemma lsum_append:
"lsum f (al @ bl) = lsum f al + lsum f bl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lsum f (al @ bl) = lsum f al + lsum f bl
[PROOF STEP]
unfolding lsum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map f (al @ bl)) = sum_list (map f al) + sum_list (map f bl)
[PROOF STEP]
by auto


[STATEMENT]
lemma WHILEIT_weaken:
  assumes IW: "\<And>x. I x \<Longrightarrow> I' x"
  shows "WHILEIT I' b f x \<le> WHILEIT I b f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. WHILEIT I' b f x \<le> WHILEIT I b f x
[PROOF STEP]
unfolding WHILEIT_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. REC\<^sub>T (WHILEI_body bind return I' b f) x \<le> REC\<^sub>T (WHILEI_body bind return I b f) x
[PROOF STEP]
apply (rule RECT_mono_ref[OF WHILEI_body_trimono])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>D x. WHILEI_body bind return I' b f D x \<le> WHILEI_body bind return I b f D x
[PROOF STEP]
apply (auto simp add: WHILEI_body_def dest: IW)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done