[STATEMENT]
lemma multiplicity_prime_elem_times_other:
  assumes "prime_elem p" "\<not>p dvd q"
  shows   "multiplicity p (q * x) = multiplicity p x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (q * x) = multiplicity p x
[PROOF STEP]
proof (cases "x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = (0::'a) \<Longrightarrow> multiplicity p (q * x) = multiplicity p x
 2. x \<noteq> (0::'a) \<Longrightarrow> multiplicity p (q * x) = multiplicity p x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> (0::'a)

goal (2 subgoals):
 1. x = (0::'a) \<Longrightarrow> multiplicity p (q * x) = multiplicity p x
 2. x \<noteq> (0::'a) \<Longrightarrow> multiplicity p (q * x) = multiplicity p x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (q * x) = multiplicity p x
[PROOF STEP]
proof (rule multiplicity_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p ^ multiplicity p x dvd q * x
 2. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
have "1 * p ^ multiplicity p x dvd q * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) * p ^ multiplicity p x dvd q * x
[PROOF STEP]
by (intro mult_dvd_mono multiplicity_dvd) simp_all
[PROOF STATE]
proof (state)
this:
(1::'a) * p ^ multiplicity p x dvd q * x

goal (2 subgoals):
 1. p ^ multiplicity p x dvd q * x
 2. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
thus "p ^ multiplicity p x dvd q * x"
[PROOF STATE]
proof (prove)
using this:
(1::'a) * p ^ multiplicity p x dvd q * x

goal (1 subgoal):
 1. p ^ multiplicity p x dvd q * x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p ^ multiplicity p x dvd q * x

goal (1 subgoal):
 1. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
define n where "n = multiplicity p x"
[PROOF STATE]
proof (state)
this:
n = multiplicity p x

goal (1 subgoal):
 1. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime_elem p
\<not> p dvd q
[PROOF STEP]
have "\<not>is_unit p"
[PROOF STATE]
proof (prove)
using this:
prime_elem p
\<not> p dvd q

goal (1 subgoal):
 1. \<not> is_unit p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<not> is_unit p

goal (1 subgoal):
 1. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
from multiplicity_decompose'[OF False this]
[PROOF STATE]
proof (chain)
picking this:
(\<And>y. \<lbrakk>x = p ^ multiplicity p x * y; \<not> p dvd y\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain y where y [folded n_def]: "x = p ^ multiplicity p x * y" "\<not> p dvd y"
[PROOF STATE]
proof (prove)
using this:
(\<And>y. \<lbrakk>x = p ^ multiplicity p x * y; \<not> p dvd y\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>x = p ^ multiplicity p x * y; \<not> p dvd y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x = p ^ n * y
\<not> p dvd y

goal (1 subgoal):
 1. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
from y
[PROOF STATE]
proof (chain)
picking this:
x = p ^ n * y
\<not> p dvd y
[PROOF STEP]
have "p ^ Suc n dvd q * x \<longleftrightarrow> p ^ n * p dvd p ^ n * (q * y)"
[PROOF STATE]
proof (prove)
using this:
x = p ^ n * y
\<not> p dvd y

goal (1 subgoal):
 1. (p ^ Suc n dvd q * x) = (p ^ n * p dvd p ^ n * (q * y))
[PROOF STEP]
by (simp add: mult_ac)
[PROOF STATE]
proof (state)
this:
(p ^ Suc n dvd q * x) = (p ^ n * p dvd p ^ n * (q * y))

goal (1 subgoal):
 1. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(p ^ Suc n dvd q * x) = (p ^ n * p dvd p ^ n * (q * y))

goal (1 subgoal):
 1. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime_elem p
\<not> p dvd q
[PROOF STEP]
have "\<dots> \<longleftrightarrow> p dvd q * y"
[PROOF STATE]
proof (prove)
using this:
prime_elem p
\<not> p dvd q

goal (1 subgoal):
 1. (p ^ n * p dvd p ^ n * (q * y)) = (p dvd q * y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(p ^ n * p dvd p ^ n * (q * y)) = (p dvd q * y)

goal (1 subgoal):
 1. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(p ^ n * p dvd p ^ n * (q * y)) = (p dvd q * y)

goal (1 subgoal):
 1. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
have "\<dots> \<longleftrightarrow> p dvd q \<or> p dvd y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p dvd q * y) = (p dvd q \<or> p dvd y)
[PROOF STEP]
by (rule prime_elem_dvd_mult_iff) fact+
[PROOF STATE]
proof (state)
this:
(p dvd q * y) = (p dvd q \<or> p dvd y)

goal (1 subgoal):
 1. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(p dvd q * y) = (p dvd q \<or> p dvd y)

goal (1 subgoal):
 1. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
from assms y
[PROOF STATE]
proof (chain)
picking this:
prime_elem p
\<not> p dvd q
x = p ^ n * y
\<not> p dvd y
[PROOF STEP]
have "\<dots> \<longleftrightarrow> False"
[PROOF STATE]
proof (prove)
using this:
prime_elem p
\<not> p dvd q
x = p ^ n * y
\<not> p dvd y

goal (1 subgoal):
 1. (p dvd q \<or> p dvd y) = False
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(p dvd q \<or> p dvd y) = False

goal (1 subgoal):
 1. \<not> p ^ Suc (multiplicity p x) dvd q * x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(p ^ Suc n dvd q * x) = False
[PROOF STEP]
show "\<not>(p ^ Suc n dvd q * x)"
[PROOF STATE]
proof (prove)
using this:
(p ^ Suc n dvd q * x) = False

goal (1 subgoal):
 1. \<not> p ^ Suc n dvd q * x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> p ^ Suc n dvd q * x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
multiplicity p (q * x) = multiplicity p x

goal (1 subgoal):
 1. x = (0::'a) \<Longrightarrow> multiplicity p (q * x) = multiplicity p x
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma (in ordered_cancel_comm_monoid_diff) sum_list_update:
  "k < size xs \<Longrightarrow> sum_list (xs[k := x]) = sum_list xs + x - xs ! k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < length xs \<Longrightarrow> sum_list (xs[k := x]) = sum_list xs + x - xs ! k
[PROOF STEP]
apply(induction xs arbitrary:k)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>k. k < length [] \<Longrightarrow> sum_list ([][k := x]) = sum_list [] + x - [] ! k
 2. \<And>a xs k. \<lbrakk>\<And>k. k < length xs \<Longrightarrow> sum_list (xs[k := x]) = sum_list xs + x - xs ! k; k < length (a # xs)\<rbrakk> \<Longrightarrow> sum_list ((a # xs)[k := x]) = sum_list (a # xs) + x - (a # xs) ! k
[PROOF STEP]
apply (auto simp: add_ac split: nat.split)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs x2. \<lbrakk>\<And>k. k < length xs \<Longrightarrow> sum_list (xs[k := x]) = x + sum_list xs - xs ! k; x2 < length xs\<rbrakk> \<Longrightarrow> a + (x + sum_list xs - xs ! x2) = a + (x + sum_list xs) - xs ! x2
[PROOF STEP]
apply(drule elem_le_sum_list)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs x2. \<lbrakk>\<And>k. k < length xs \<Longrightarrow> sum_list (xs[k := x]) = x + sum_list xs - xs ! k; xs ! x2 \<le> sum_list xs\<rbrakk> \<Longrightarrow> a + (x + sum_list xs - xs ! x2) = a + (x + sum_list xs) - xs ! x2
[PROOF STEP]
by (simp add: local.add_diff_assoc local.add_increasing)


[STATEMENT]
lemma map_eq_replicate_imp_list_all_const:
  "map f xs = replicate n x \<Longrightarrow> n = length xs \<Longrightarrow> list_all (\<lambda>y. f y = x) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>map f xs = replicate n x; n = length xs\<rbrakk> \<Longrightarrow> list_all (\<lambda>y. f y = x) xs
[PROOF STEP]
by (induction xs arbitrary: n) simp_all


[STATEMENT]
lemma HORun_eq:
  "HORun A rho HOs =
   (  HOinitConfig A (rho 0)
    \<and> (\<forall>r. HOnextConfig A r (rho r) (HOs r) (rho (Suc r))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HORun A rho HOs = (HOinitConfig A (rho 0) \<and> (\<forall>r. HOnextConfig A r (rho r) (HOs r) (rho (Suc r))))
[PROOF STEP]
by (auto simp: HORun_def SHORun_eq HOnextConfig_def)


[STATEMENT]
lemma Lower_memI:
  fixes L (structure)
  shows "\<lbrakk>!! y. y \<in> A \<Longrightarrow> x \<sqsubseteq> y; x \<in> carrier L\<rbrakk> \<Longrightarrow> x \<in> Lower L A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>y. y \<in> A \<Longrightarrow> x \<sqsubseteq> y; x \<in> carrier L\<rbrakk> \<Longrightarrow> x \<in> Lower L A
[PROOF STEP]
by (unfold Lower_def) blast


[STATEMENT]
lemma upto_enum_red':
  assumes lt: "1 \<le> X"
  shows "[(0::'a :: len word) .e. X - 1] =  map of_nat [0 ..< unat X]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0 .e. X - 1] = map word_of_nat [0..<unat X]
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [0 .e. X - 1] = map word_of_nat [0..<unat X]
[PROOF STEP]
have lt': "unat X < 2 ^ LENGTH('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unat X < 2 ^ LENGTH('a)
[PROOF STEP]
by (rule unat_lt2p)
[PROOF STATE]
proof (state)
this:
unat X < 2 ^ LENGTH('a)

goal (1 subgoal):
 1. [0 .e. X - 1] = map word_of_nat [0..<unat X]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0 .e. X - 1] = map word_of_nat [0..<unat X]
[PROOF STEP]
apply (subst upto_enum_red)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map toEnum [fromEnum 0..<Suc (fromEnum (X - 1))] = map word_of_nat [0..<unat X]
[PROOF STEP]
apply (simp del: upt.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map toEnum [0..<Suc (unat (X - 1))] = map word_of_nat [0..<unat X]
[PROOF STEP]
apply (subst Suc_unat_diff_1 [OF lt])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map toEnum [0..<unat X] = map word_of_nat [0..<unat X]
[PROOF STEP]
apply (rule map_cong [OF refl])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> set [0..<unat X] \<Longrightarrow> toEnum x = word_of_nat x
[PROOF STEP]
apply (rule toEnum_of_nat)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> set [0..<unat X] \<Longrightarrow> x < 2 ^ LENGTH('a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x < unat X \<Longrightarrow> x < 2 ^ LENGTH('a)
[PROOF STEP]
apply (erule order_less_trans [OF _ lt'])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
[0 .e. X - 1] = map word_of_nat [0..<unat X]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ltake_llast[simp]:
    assumes "enat k < llength w"
    shows "llast (ltake (enat (Suc k)) w) = w ?! k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llast (ltake (enat (Suc k)) w) = w ?! k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. llast (ltake (enat (Suc k)) w) = w ?! k
[PROOF STEP]
have 1: "llength (ltake (enat (Suc k)) w) = eSuc (enat k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llength (ltake (enat (Suc k)) w) = eSuc (enat k)
[PROOF STEP]
using min.absorb_iff1 assms
[PROOF STATE]
proof (prove)
using this:
(?a \<le> ?b) = (min ?a ?b = ?a)
enat k < llength w

goal (1 subgoal):
 1. llength (ltake (enat (Suc k)) w) = eSuc (enat k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
llength (ltake (enat (Suc k)) w) = eSuc (enat k)

goal (1 subgoal):
 1. llast (ltake (enat (Suc k)) w) = w ?! k
[PROOF STEP]
have "llast (ltake (enat (Suc k)) w) = ltake (enat (Suc k)) w ?! k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llast (ltake (enat (Suc k)) w) = ltake (enat (Suc k)) w ?! k
[PROOF STEP]
using llast_conv_lnth 1
[PROOF STATE]
proof (prove)
using this:
llength ?xs = eSuc (enat ?n) \<Longrightarrow> llast ?xs = ?xs ?! ?n
llength (ltake (enat (Suc k)) w) = eSuc (enat k)

goal (1 subgoal):
 1. llast (ltake (enat (Suc k)) w) = ltake (enat (Suc k)) w ?! k
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
llast (ltake (enat (Suc k)) w) = ltake (enat (Suc k)) w ?! k

goal (1 subgoal):
 1. llast (ltake (enat (Suc k)) w) = w ?! k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
llast (ltake (enat (Suc k)) w) = ltake (enat (Suc k)) w ?! k

goal (1 subgoal):
 1. llast (ltake (enat (Suc k)) w) = w ?! k
[PROOF STEP]
have "\<dots> = w ?! k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltake (enat (Suc k)) w ?! k = w ?! k
[PROOF STEP]
by (rule lnth_ltake, simp)
[PROOF STATE]
proof (state)
this:
ltake (enat (Suc k)) w ?! k = w ?! k

goal (1 subgoal):
 1. llast (ltake (enat (Suc k)) w) = w ?! k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
llast (ltake (enat (Suc k)) w) = w ?! k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
llast (ltake (enat (Suc k)) w) = w ?! k

goal (1 subgoal):
 1. llast (ltake (enat (Suc k)) w) = w ?! k
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
llast (ltake (enat (Suc k)) w) = w ?! k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lim_const_over_n [tendsto_intros]:
  fixes a :: "'a::real_normed_field"
  shows "(\<lambda>n. a / of_nat n) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. a / of_nat n) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
using tendsto_mult [OF tendsto_const [of a] lim_1_over_n]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. a * ((1::'a) / of_nat x)) \<longlonglongrightarrow> a * (0::'a)

goal (1 subgoal):
 1. (\<lambda>n. a / of_nat n) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
by simp


[STATEMENT]
lemma leaves_conc: "leaves (Node (ls@rs) t) = leaves_list ls @ leaves_list rs @ leaves t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. leaves (Node (ls @ rs) t) = leaves_list ls @ leaves_list rs @ leaves t
[PROOF STEP]
apply(induction ls)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. leaves (Node ([] @ rs) t) = leaves_list [] @ leaves_list rs @ leaves t
 2. \<And>a ls. leaves (Node (ls @ rs) t) = leaves_list ls @ leaves_list rs @ leaves t \<Longrightarrow> leaves (Node ((a # ls) @ rs) t) = leaves_list (a # ls) @ leaves_list rs @ leaves t
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma expands_to_exp_real:
  "(f expands_to (F :: real)) basis \<Longrightarrow> ((\<lambda>x. exp (f x)) expands_to exp F) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f expands_to F) basis \<Longrightarrow> ((\<lambda>x. exp (f x)) expands_to exp F) basis
[PROOF STEP]
by (auto simp: expands_to.simps is_expansion_real.simps elim: eventually_mono)


[STATEMENT]
lemma all_nstri_imp_mul_nstri:
  assumes "\<forall>i<length ys. snd (f (xs ! i) (ys ! i))"
    and "length xs = length ys"
  shows "snd (mul_ext f xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (mul_ext f xs ys)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. snd (mul_ext f xs ys)
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<length ys. snd (f (xs ! i) (ys ! i))
[PROOF STEP]
have "\<forall>i. i < length ys \<longrightarrow> (xs ! i, ys ! i) \<in> {(x,y). snd (f x y)}"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length ys. snd (f (xs ! i) (ys ! i))

goal (1 subgoal):
 1. \<forall>i<length ys. (xs ! i, ys ! i) \<in> {(x, y). snd (f x y)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>i<length ys. (xs ! i, ys ! i) \<in> {(x, y). snd (f x y)}

goal (1 subgoal):
 1. snd (mul_ext f xs ys)
[PROOF STEP]
from all_ns_ns_mul_ext[OF assms(2) this]
[PROOF STATE]
proof (chain)
picking this:
(mset xs, mset ys) \<in> ns_mul_ext {(x, y). snd (f x y)} ?s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(mset xs, mset ys) \<in> ns_mul_ext {(x, y). snd (f x y)} ?s

goal (1 subgoal):
 1. snd (mul_ext f xs ys)
[PROOF STEP]
by (simp add: mul_ext_def)
[PROOF STATE]
proof (state)
this:
snd (mul_ext f xs ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linorder_transfer[transfer_rule]:
  assumes [transfer_rule]: "bi_unique A" "right_total A"
  shows
    "((A ===> A ===> (=)) ===> (A ===> A ===> (=)) ===> (=))
      (linorder_ow (Collect (Domainp A))) class.linorder"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((A ===> A ===> (=)) ===> (A ===> A ===> (=)) ===> (=)) (linorder_ow (Collect (Domainp A))) class.linorder
[PROOF STEP]
unfolding
    linorder_ow_def class.linorder_def
    linorder_ow_axioms_def class.linorder_axioms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((A ===> A ===> (=)) ===> (A ===> A ===> (=)) ===> (=)) (\<lambda>le ls. order_ow (Collect (Domainp A)) le ls \<and> (\<forall>x y. x \<in> Collect (Domainp A) \<longrightarrow> y \<in> Collect (Domainp A) \<longrightarrow> le x y \<or> le y x)) (\<lambda>less_eq less. class.order less_eq less \<and> (\<forall>x y. less_eq x y \<or> less_eq y x))
[PROOF STEP]
apply transfer_prover_start
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. Transfer.Rel ((=) ===> (=) ===> ?Rj15) ?ad15 (\<or>)
 2. Transfer.Rel ((A ===> ?Rj15) ===> ?Ri15) ?ac15 All
 3. Transfer.Rel ((A ===> ?Ri15) ===> ?Rg15) ?ab15 All
 4. Transfer.Rel ((A ===> A ===> (=)) ===> (A ===> A ===> (=)) ===> ?Rf15) ?aa15 class.order
 5. Transfer.Rel (?Rf15 ===> ?Rg15 ===> (=)) ?a15 (\<and>)
 6. (\<lambda>le ls. order_ow (Collect (Domainp A)) le ls \<and> (\<forall>x y. x \<in> Collect (Domainp A) \<longrightarrow> y \<in> Collect (Domainp A) \<longrightarrow> le x y \<or> le y x)) = (\<lambda>less_eq less. ?a15 (?aa15 less_eq less) (?ab15 (\<lambda>x. ?ac15 (\<lambda>y. ?ad15 (less_eq x y) (less_eq y x)))))
[PROOF STEP]
apply transfer_step+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>le ls. order_ow (Collect (Domainp A)) le ls \<and> (\<forall>x y. x \<in> Collect (Domainp A) \<longrightarrow> y \<in> Collect (Domainp A) \<longrightarrow> le x y \<or> le y x)) = (\<lambda>less_eq less. order_ow (Collect (Domainp A)) less_eq less \<and> (\<forall>x\<in>Collect (Domainp A). \<forall>y\<in>Collect (Domainp A). less_eq x y \<or> less_eq y x))
[PROOF STEP]
by simp


[STATEMENT]
lemma board_exec_leq: "(i,j) \<in> board_exec n m \<longleftrightarrow> 1 \<le> i \<and> i \<le> int n \<and> 1 \<le> j \<and> j \<le> int m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((i, j) \<in> board_exec n m) = (1 \<le> i \<and> i \<le> int n \<and> 1 \<le> j \<and> j \<le> int m)
[PROOF STEP]
using board_exec_aux_leq_mem row_exec_leq
[PROOF STATE]
proof (prove)
using this:
((?i, ?j) \<in> board_exec_aux ?k ?M) = (1 \<le> ?i \<and> ?i \<le> int ?k \<and> ?j \<in> ?M)
(?j \<in> row_exec ?m) = (1 \<le> ?j \<and> ?j \<le> int ?m)

goal (1 subgoal):
 1. ((i, j) \<in> board_exec n m) = (1 \<le> i \<and> i \<le> int n \<and> 1 \<le> j \<and> j \<le> int m)
[PROOF STEP]
by auto


[STATEMENT]
lemma cnj_compat_eqv:
assumes "\<phi>1 \<in> fmla" and "\<phi>2 \<in> fmla" and "\<chi>1 \<in> fmla" and "\<chi>2 \<in> fmla"
assumes "prv (eqv \<phi>1 \<phi>2)" and "prv (eqv \<chi>1 \<chi>2)"
shows "prv (eqv (cnj \<phi>1 \<chi>1) (cnj \<phi>2 \<chi>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (eqv (cnj \<phi>1 \<chi>1) (cnj \<phi>2 \<chi>2))
[PROOF STEP]
using assms prv_imp_mp imp_cnj_compat_eqv
[PROOF STATE]
proof (prove)
using this:
\<phi>1 \<in> fmla
\<phi>2 \<in> fmla
\<chi>1 \<in> fmla
\<chi>2 \<in> fmla
prv (eqv \<phi>1 \<phi>2)
prv (eqv \<chi>1 \<chi>2)
\<lbrakk>?\<phi> \<in> fmla; ?\<chi> \<in> fmla; prv (imp ?\<phi> ?\<chi>); prv ?\<phi>\<rbrakk> \<Longrightarrow> prv ?\<chi>
\<lbrakk>?\<phi>1.0 \<in> fmla; ?\<phi>2.0 \<in> fmla; ?\<chi>1.0 \<in> fmla; ?\<chi>2.0 \<in> fmla\<rbrakk> \<Longrightarrow> prv (imp (eqv ?\<phi>1.0 ?\<phi>2.0) (imp (eqv ?\<chi>1.0 ?\<chi>2.0) (eqv (cnj ?\<phi>1.0 ?\<chi>1.0) (cnj ?\<phi>2.0 ?\<chi>2.0))))

goal (1 subgoal):
 1. prv (eqv (cnj \<phi>1 \<chi>1) (cnj \<phi>2 \<chi>2))
[PROOF STEP]
by (metis eqv imp cnj)


[STATEMENT]
lemma avl_split_max:
  "\<lbrakk> avl t; t \<noteq> Leaf \<rbrakk> \<Longrightarrow>
  avl (fst (split_max t)) \<and>
  height t \<in> {height(fst (split_max t)), height(fst (split_max t)) + 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>avl t; t \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> avl (fst (split_max t)) \<and> height t \<in> {height (fst (split_max t)), height (fst (split_max t)) + 1}
[PROOF STEP]
by(induct t rule: split_max_induct)
  (auto simp: balL_def node_def max_absorb2 split!: prod.split if_split tree.split)


[STATEMENT]
lemma chain_fun_ordD:
  assumes "Complete_Partial_Order.chain (fun_ord le) Y"
  shows "Complete_Partial_Order.chain le ((\<lambda>f. f x) ` Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complete_Partial_Order.chain le ((\<lambda>f. f x) ` Y)
[PROOF STEP]
by(rule chainI)(auto dest: chainD[OF assms] simp add: fun_ord_def)


[STATEMENT]
lemma face_of_imp_subset: "T face_of S \<Longrightarrow> T \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T face_of S \<Longrightarrow> T \<subseteq> S
[PROOF STEP]
unfolding face_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T \<subseteq> S \<and> convex T \<and> (\<forall>a\<in>S. \<forall>b\<in>S. \<forall>x\<in>T. x \<in> open_segment a b \<longrightarrow> a \<in> T \<and> b \<in> T) \<Longrightarrow> T \<subseteq> S
[PROOF STEP]
by blast


[STATEMENT]
lemma index_swaps_size: "distinct s \<Longrightarrow>
  index s q \<le> index (swaps sws s) q + length sws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct s \<Longrightarrow> index s q \<le> index (swaps sws s) q + length sws
[PROOF STEP]
apply(induction sws arbitrary: s)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>s. distinct s \<Longrightarrow> index s q \<le> index (swaps [] s) q + length []
 2. \<And>a sws s. \<lbrakk>\<And>s. distinct s \<Longrightarrow> index s q \<le> index (swaps sws s) q + length sws; distinct s\<rbrakk> \<Longrightarrow> index s q \<le> index (swaps (a # sws) s) q + length (a # sws)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a sws s. \<lbrakk>\<And>s. distinct s \<Longrightarrow> index s q \<le> index (swaps sws s) q + length sws; distinct s\<rbrakk> \<Longrightarrow> index s q \<le> index (swaps (a # sws) s) q + length (a # sws)
[PROOF STEP]
apply (fastforce simp: swap_def index_swap_if_distinct index_nth_id)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma denote_while_split:
  assumes wc: "well_com (While M S)" and dsr: "\<rho> \<in> density_states"
  shows "denote (While M S) \<rho> = (M 0) * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have m: "measurement d 2 M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measurement d 2 M
[PROOF STEP]
using wc
[PROOF STATE]
proof (prove)
using this:
well_com (While M S)

goal (1 subgoal):
 1. measurement d 2 M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
measurement d 2 M

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have wcs: "well_com S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. well_com S
[PROOF STEP]
using wc
[PROOF STATE]
proof (prove)
using this:
well_com (While M S)

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

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
define M0 where "M0 = M 0"
[PROOF STATE]
proof (state)
this:
M0 = M 0

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
define M1 where "M1 = M 1"
[PROOF STATE]
proof (state)
this:
M1 = M 1

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have dM0: "M0 \<in> carrier_mat d d" and dM1: "M1 \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M0 \<in> carrier_mat d d &&& M1 \<in> carrier_mat d d
[PROOF STEP]
using m measurement_def M0_def M1_def
[PROOF STATE]
proof (prove)
using this:
measurement d 2 M
measurement ?d ?n ?M = ((\<forall>j<?n. ?M j \<in> carrier_mat ?d ?d) \<and> matrix_sum ?d (\<lambda>j. adjoint (?M j) * ?M j) ?n = 1\<^sub>m ?d)
M0 = M 0
M1 = M 1

goal (1 subgoal):
 1. M0 \<in> carrier_mat d d &&& M1 \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M0 \<in> carrier_mat d d
M1 \<in> carrier_mat d d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have M1leq: "adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d
[PROOF STEP]
using measurement_le_one_mat m M1_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>measurement ?d ?n ?f; ?j < ?n\<rbrakk> \<Longrightarrow> adjoint (?f ?j) * ?f ?j \<le>\<^sub>L 1\<^sub>m ?d
measurement d 2 M
M1 = M 1

goal (1 subgoal):
 1. adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
define DS where "DS = denote S"
[PROOF STATE]
proof (state)
this:
DS = denote S

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
define D0 where "D0 = denote_while_n M0 M1 DS"
[PROOF STATE]
proof (state)
this:
D0 = denote_while_n M0 M1 DS

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
define D1 where "D1 = denote_while_n_comp M0 M1 DS"
[PROOF STATE]
proof (state)
this:
D1 = denote_while_n_comp M0 M1 DS

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
define D where "D = denote_while_n_iter M0 M1 DS"
[PROOF STATE]
proof (state)
this:
D = denote_while_n_iter M0 M1 DS

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
define DW where "DW \<rho> = denote (While M S) \<rho>" for \<rho>
[PROOF STATE]
proof (state)
this:
DW ?\<rho> = denote (While M S) ?\<rho>

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
DW ?\<rho> = denote (While M S) ?\<rho>

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
fix \<rho>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
assume dsr: "\<rho> \<in> density_states"
[PROOF STATE]
proof (state)
this:
\<rho> \<in> density_states

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<rho> \<in> density_states
[PROOF STEP]
have dr: "\<rho> \<in> carrier_mat d d" and pdor: "partial_density_operator \<rho>"
[PROOF STATE]
proof (prove)
using this:
\<rho> \<in> density_states

goal (1 subgoal):
 1. \<rho> \<in> carrier_mat d d &&& partial_density_operator \<rho>
[PROOF STEP]
using density_states_def
[PROOF STATE]
proof (prove)
using this:
\<rho> \<in> density_states
density_states = {\<rho> \<in> carrier_mat d d. partial_density_operator \<rho>}

goal (1 subgoal):
 1. \<rho> \<in> carrier_mat d d &&& partial_density_operator \<rho>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<rho> \<in> carrier_mat d d
partial_density_operator \<rho>

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have pdoDkr: "\<And>k. partial_density_operator (D k \<rho>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. partial_density_operator (D k \<rho>)
[PROOF STEP]
unfolding D_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. partial_density_operator (denote_while_n_iter M0 M1 DS k \<rho>)
[PROOF STEP]
using pdo_denote_while_n_iter[OF dr pdor dM1 M1leq]
      denote_partial_density_operator[OF wcs] denote_dim[OF wcs, folded DS_def]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>\<rho>. \<rho> \<in> carrier_mat d d \<and> partial_density_operator \<rho> \<Longrightarrow> partial_density_operator (?DS \<rho>); \<And>\<rho>. \<rho> \<in> carrier_mat d d \<and> partial_density_operator \<rho> \<Longrightarrow> ?DS \<rho> \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> partial_density_operator (denote_while_n_iter ?M0.0 M1 ?DS ?n \<rho>)
\<lbrakk>partial_density_operator ?\<rho>; ?\<rho> \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> partial_density_operator (denote S ?\<rho>)
\<lbrakk>?\<rho> \<in> carrier_mat d d; partial_density_operator ?\<rho>\<rbrakk> \<Longrightarrow> DS ?\<rho> \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>k. partial_density_operator (denote_while_n_iter M0 M1 DS k \<rho>)
[PROOF STEP]
apply (fold DS_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<And>DS M0 n. \<lbrakk>\<And>\<rho>. \<rho> \<in> carrier_mat d d \<and> partial_density_operator \<rho> \<Longrightarrow> partial_density_operator (DS \<rho>); \<And>\<rho>. \<rho> \<in> carrier_mat d d \<and> partial_density_operator \<rho> \<Longrightarrow> DS \<rho> \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> partial_density_operator (denote_while_n_iter M0 M1 DS n \<rho>); \<And>\<rho>. \<lbrakk>partial_density_operator \<rho>; \<rho> \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> partial_density_operator (DS \<rho>); \<And>\<rho>. \<lbrakk>\<rho> \<in> carrier_mat d d; partial_density_operator \<rho>\<rbrakk> \<Longrightarrow> DS \<rho> \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> partial_density_operator (denote_while_n_iter M0 M1 DS k \<rho>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
partial_density_operator (D ?k \<rho>)

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
partial_density_operator (D ?k \<rho>)
[PROOF STEP]
have pDkr: "\<And>k. positive (D k \<rho>)"
[PROOF STATE]
proof (prove)
using this:
partial_density_operator (D ?k \<rho>)

goal (1 subgoal):
 1. \<And>k. positive (D k \<rho>)
[PROOF STEP]
unfolding partial_density_operator_def
[PROOF STATE]
proof (prove)
using this:
positive (D ?k \<rho>) \<and> trace (D ?k \<rho>) \<le> 1

goal (1 subgoal):
 1. \<And>k. positive (D k \<rho>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
positive (D ?k \<rho>)

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have dDkr: "\<And>k. D k \<rho> \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. D k \<rho> \<in> carrier_mat d d
[PROOF STEP]
using denote_while_n_iter_dim[OF dr pdor dM1 M1leq denote_dim_pdo[OF wcs, folded DS_def], of id M0, simplified, folded D_def]
[PROOF STATE]
proof (prove)
using this:
D ?n \<rho> \<in> carrier_mat d d \<and> partial_density_operator (D ?n \<rho>)

goal (1 subgoal):
 1. \<And>k. D k \<rho> \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
D ?k \<rho> \<in> carrier_mat d d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
D ?k \<rho> \<in> carrier_mat d d
[PROOF STEP]
have dD0kr: "\<And>k. D0 k \<rho> \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
using this:
D ?k \<rho> \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>k. D0 k \<rho> \<in> carrier_mat d d
[PROOF STEP]
unfolding D0_def denote_while_n.simps
[PROOF STATE]
proof (prove)
using this:
D ?k \<rho> \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>k. M0 * denote_while_n_iter M0 M1 DS k \<rho> * adjoint M0 \<in> carrier_mat d d
[PROOF STEP]
apply (fold D_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. (\<And>k. D k \<rho> \<in> carrier_mat d d) \<Longrightarrow> M0 * D k \<rho> * adjoint M0 \<in> carrier_mat d d
[PROOF STEP]
using dM0
[PROOF STATE]
proof (prove)
using this:
M0 \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>k. (\<And>k. D k \<rho> \<in> carrier_mat d d) \<Longrightarrow> M0 * D k \<rho> * adjoint M0 \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
D0 ?k \<rho> \<in> carrier_mat d d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?\<rho>'3 \<in> density_states \<Longrightarrow> D0 ?k ?\<rho>'3 \<in> carrier_mat d d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
note dD0k = this
[PROOF STATE]
proof (state)
this:
?\<rho>'3 \<in> density_states \<Longrightarrow> D0 ?k ?\<rho>'3 \<in> carrier_mat d d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have "matrix_sum d (\<lambda>k. D0 k \<rho>) k \<in> carrier_mat d d" if dsr: "\<rho> \<in> density_states" for \<rho> k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. D0 k \<rho>) k \<in> carrier_mat d d
[PROOF STEP]
using matrix_sum_dim[OF dD0k, of _ "\<lambda>k. \<rho>" id, OF dsr] dsr
[PROOF STATE]
proof (prove)
using this:
matrix_sum d (\<lambda>k. D0 (id k) \<rho>) ?n \<in> carrier_mat d d
\<rho> \<in> density_states

goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. D0 k \<rho>) k \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?\<rho> \<in> density_states \<Longrightarrow> matrix_sum d (\<lambda>k. D0 k ?\<rho>) ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?\<rho> \<in> density_states \<Longrightarrow> matrix_sum d (\<lambda>k. D0 k ?\<rho>) ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have "matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k) = (D0 0 \<rho>) + matrix_sum d (\<lambda>k. D0 (Suc k) \<rho>) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k) = D0 0 \<rho> + matrix_sum d (\<lambda>k. D0 (Suc k) \<rho>) k
[PROOF STEP]
using matrix_sum_shift_Suc[of _ "\<lambda>k. D0 k \<rho>"] dD0k[OF dsr]
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < Suc ?n \<Longrightarrow> D0 k \<rho> \<in> carrier_mat ?d ?d) \<Longrightarrow> matrix_sum ?d (\<lambda>k. D0 k \<rho>) (Suc ?n) = D0 0 \<rho> + matrix_sum ?d (\<lambda>k. D0 (Suc k) \<rho>) ?n
D0 ?k \<rho> \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k) = D0 0 \<rho> + matrix_sum d (\<lambda>k. D0 (Suc k) \<rho>) k
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k) = D0 0 \<rho> + matrix_sum d (\<lambda>k. D0 (Suc k) \<rho>) k

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k) = D0 0 \<rho> + matrix_sum d (\<lambda>k. D0 (Suc k) \<rho>) k

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have "\<dots> = M0 * \<rho> * adjoint M0 + matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D0 0 \<rho> + matrix_sum d (\<lambda>k. D0 (Suc k) \<rho>) k = M0 * \<rho> * adjoint M0 + matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))) k
[PROOF STEP]
unfolding D0_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. denote_while_n M0 M1 DS 0 \<rho> + matrix_sum d (\<lambda>k. denote_while_n M0 M1 DS (Suc k) \<rho>) k = M0 * \<rho> * adjoint M0 + matrix_sum d (\<lambda>k. denote_while_n M0 M1 DS k (DS (M1 * \<rho> * adjoint M1))) k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
D0 0 \<rho> + matrix_sum d (\<lambda>k. D0 (Suc k) \<rho>) k = M0 * \<rho> * adjoint M0 + matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))) k

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k) = M0 * \<rho> * adjoint M0 + matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))) k
[PROOF STEP]
have "matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k) = M0 * \<rho> * adjoint M0 + matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))) k"
[PROOF STATE]
proof (prove)
using this:
matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k) = M0 * \<rho> * adjoint M0 + matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))) k

goal (1 subgoal):
 1. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k) = M0 * \<rho> * adjoint M0 + matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))) k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k) = M0 * \<rho> * adjoint M0 + matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))) k

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc ?k2) = M0 * \<rho> * adjoint M0 + matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))) ?k2

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
note eqk = this
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc ?k2) = M0 * \<rho> * adjoint M0 + matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))) ?k2

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have dr: "\<rho> \<in> carrier_mat d d" and pdor: "partial_density_operator \<rho>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<rho> \<in> carrier_mat d d &&& partial_density_operator \<rho>
[PROOF STEP]
using density_states_def dsr
[PROOF STATE]
proof (prove)
using this:
density_states = {\<rho> \<in> carrier_mat d d. partial_density_operator \<rho>}
\<rho> \<in> density_states

goal (1 subgoal):
 1. \<rho> \<in> carrier_mat d d &&& partial_density_operator \<rho>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<rho> \<in> carrier_mat d d
partial_density_operator \<rho>

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<rho> \<in> carrier_mat d d
partial_density_operator \<rho>
[PROOF STEP]
have "M1 * \<rho> * adjoint M1 \<in> carrier_mat d d" and "partial_density_operator (M1 * \<rho> * adjoint M1)"
[PROOF STATE]
proof (prove)
using this:
\<rho> \<in> carrier_mat d d
partial_density_operator \<rho>

goal (1 subgoal):
 1. M1 * \<rho> * adjoint M1 \<in> carrier_mat d d &&& partial_density_operator (M1 * \<rho> * adjoint M1)
[PROOF STEP]
using dM1 dr pdo_close_under_measurement[OF dM1 dr pdor M1leq]
[PROOF STATE]
proof (prove)
using this:
\<rho> \<in> carrier_mat d d
partial_density_operator \<rho>
M1 \<in> carrier_mat d d
\<rho> \<in> carrier_mat d d
partial_density_operator (M1 * \<rho> * adjoint M1)

goal (1 subgoal):
 1. M1 * \<rho> * adjoint M1 \<in> carrier_mat d d &&& partial_density_operator (M1 * \<rho> * adjoint M1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M1 * \<rho> * adjoint M1 \<in> carrier_mat d d
partial_density_operator (M1 * \<rho> * adjoint M1)

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M1 * \<rho> * adjoint M1 \<in> carrier_mat d d
partial_density_operator (M1 * \<rho> * adjoint M1)
[PROOF STEP]
have dSM1r: "(DS (M1 * \<rho> * adjoint M1)) \<in> carrier_mat d d" and pdoSM1r: "partial_density_operator (DS (M1 * \<rho> * adjoint M1))"
[PROOF STATE]
proof (prove)
using this:
M1 * \<rho> * adjoint M1 \<in> carrier_mat d d
partial_density_operator (M1 * \<rho> * adjoint M1)

goal (1 subgoal):
 1. DS (M1 * \<rho> * adjoint M1) \<in> carrier_mat d d &&& partial_density_operator (DS (M1 * \<rho> * adjoint M1))
[PROOF STEP]
unfolding DS_def
[PROOF STATE]
proof (prove)
using this:
M1 * \<rho> * adjoint M1 \<in> carrier_mat d d
partial_density_operator (M1 * \<rho> * adjoint M1)

goal (1 subgoal):
 1. denote S (M1 * \<rho> * adjoint M1) \<in> carrier_mat d d &&& partial_density_operator (denote S (M1 * \<rho> * adjoint M1))
[PROOF STEP]
using denote_dim_pdo[OF wcs]
[PROOF STATE]
proof (prove)
using this:
M1 * \<rho> * adjoint M1 \<in> carrier_mat d d
partial_density_operator (M1 * \<rho> * adjoint M1)
\<lbrakk>?\<rho> \<in> carrier_mat d d; partial_density_operator ?\<rho>\<rbrakk> \<Longrightarrow> denote S ?\<rho> \<in> carrier_mat d d \<and> partial_density_operator (denote S ?\<rho>)

goal (1 subgoal):
 1. denote S (M1 * \<rho> * adjoint M1) \<in> carrier_mat d d &&& partial_density_operator (denote S (M1 * \<rho> * adjoint M1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
DS (M1 * \<rho> * adjoint M1) \<in> carrier_mat d d
partial_density_operator (DS (M1 * \<rho> * adjoint M1))

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have "limit_mat (matrix_sum d (\<lambda>k. D0 k \<rho>)) (DW \<rho>) d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limit_mat (matrix_sum d (\<lambda>k. D0 k \<rho>)) (DW \<rho>) d
[PROOF STEP]
unfolding M0_def M1_def D0_def DS_def DW_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limit_mat (matrix_sum d (\<lambda>k. denote_while_n (M 0) (M 1) (denote S) k \<rho>)) (denote (While M S) \<rho>) d
[PROOF STEP]
using limit_mat_denote_while_n[OF wc dr pdor]
[PROOF STATE]
proof (prove)
using this:
limit_mat (matrix_sum d (\<lambda>k. denote_while_n (M 0) (M 1) (denote S) k \<rho>)) (denote (While M S) \<rho>) d

goal (1 subgoal):
 1. limit_mat (matrix_sum d (\<lambda>k. denote_while_n (M 0) (M 1) (denote S) k \<rho>)) (denote (While M S) \<rho>) d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
limit_mat (matrix_sum d (\<lambda>k. D0 k \<rho>)) (DW \<rho>) d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
limit_mat (matrix_sum d (\<lambda>k. D0 k \<rho>)) (DW \<rho>) d
[PROOF STEP]
have liml: "limit_mat (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) (DW \<rho>) d"
[PROOF STATE]
proof (prove)
using this:
limit_mat (matrix_sum d (\<lambda>k. D0 k \<rho>)) (DW \<rho>) d

goal (1 subgoal):
 1. limit_mat (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) (DW \<rho>) d
[PROOF STEP]
using limit_mat_ignore_initial_segment[of "matrix_sum d (\<lambda>k. D0 k \<rho>)" "DW \<rho>" d 1]
[PROOF STATE]
proof (prove)
using this:
limit_mat (matrix_sum d (\<lambda>k. D0 k \<rho>)) (DW \<rho>) d
limit_mat (matrix_sum d (\<lambda>k. D0 k \<rho>)) (DW \<rho>) d \<Longrightarrow> limit_mat (\<lambda>n. matrix_sum d (\<lambda>k. D0 k \<rho>) (n + 1)) (DW \<rho>) d

goal (1 subgoal):
 1. limit_mat (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) (DW \<rho>) d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
limit_mat (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) (DW \<rho>) d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have dM0r: "M0 * \<rho> * adjoint M0 \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M0 * \<rho> * adjoint M0 \<in> carrier_mat d d
[PROOF STEP]
using dM0 dr
[PROOF STATE]
proof (prove)
using this:
M0 \<in> carrier_mat d d
\<rho> \<in> carrier_mat d d

goal (1 subgoal):
 1. M0 * \<rho> * adjoint M0 \<in> carrier_mat d d
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
M0 * \<rho> * adjoint M0 \<in> carrier_mat d d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have "limit_mat (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1)))) (DW (DS (M1 * \<rho> * adjoint M1))) d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limit_mat (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1)))) (DW (DS (M1 * \<rho> * adjoint M1))) d
[PROOF STEP]
using limit_mat_denote_while_n[OF wc dSM1r pdoSM1r]
[PROOF STATE]
proof (prove)
using this:
limit_mat (matrix_sum d (\<lambda>k. denote_while_n (M 0) (M 1) (denote S) k (DS (M1 * \<rho> * adjoint M1)))) (denote (While M S) (DS (M1 * \<rho> * adjoint M1))) d

goal (1 subgoal):
 1. limit_mat (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1)))) (DW (DS (M1 * \<rho> * adjoint M1))) d
[PROOF STEP]
unfolding M0_def M1_def D0_def DS_def DW_def
[PROOF STATE]
proof (prove)
using this:
limit_mat (matrix_sum d (\<lambda>k. denote_while_n (M 0) (M 1) (denote S) k (denote S (M 1 * \<rho> * adjoint (M 1))))) (denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))) d

goal (1 subgoal):
 1. limit_mat (matrix_sum d (\<lambda>k. denote_while_n (M 0) (M 1) (denote S) k (denote S (M 1 * \<rho> * adjoint (M 1))))) (denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))) d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
limit_mat (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1)))) (DW (DS (M1 * \<rho> * adjoint M1))) d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
limit_mat (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1)))) (DW (DS (M1 * \<rho> * adjoint M1))) d
[PROOF STEP]
have
    limr: "limit_mat
      (mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1)))))
      (M0 * \<rho> * adjoint M0 + (DW (DS (M1 * \<rho> * adjoint M1))))
      d"
[PROOF STATE]
proof (prove)
using this:
limit_mat (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1)))) (DW (DS (M1 * \<rho> * adjoint M1))) d

goal (1 subgoal):
 1. limit_mat (mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))))) (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))) d
[PROOF STEP]
using mat_add_limit[OF dM0r]
[PROOF STATE]
proof (prove)
using this:
limit_mat (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1)))) (DW (DS (M1 * \<rho> * adjoint M1))) d
limit_mat ?X ?A d \<Longrightarrow> limit_mat (mat_add_seq (M0 * \<rho> * adjoint M0) ?X) (M0 * \<rho> * adjoint M0 + ?A) d

goal (1 subgoal):
 1. limit_mat (mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))))) (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))) d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
limit_mat (mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))))) (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))) d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
limit_mat (mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))))) (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))) d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
have
    "(\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k))
     = (mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) = mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))))
[PROOF STEP]
using eqk mat_add_seq_def
[PROOF STATE]
proof (prove)
using this:
matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc ?k2) = M0 * \<rho> * adjoint M0 + matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))) ?k2
mat_add_seq ?A ?X = (\<lambda>n. ?A + ?X n)

goal (1 subgoal):
 1. (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) = mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) = mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))))

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
limit_mat (mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))))) (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))) d
(\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) = mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))))
[PROOF STEP]
have
    "limit_mat
      (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k))
      (M0 * \<rho> * adjoint M0 + (DW (DS (M1 * \<rho> * adjoint M1))))
      d"
[PROOF STATE]
proof (prove)
using this:
limit_mat (mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))))) (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))) d
(\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) = mat_add_seq (M0 * \<rho> * adjoint M0) (matrix_sum d (\<lambda>k. D0 k (DS (M1 * \<rho> * adjoint M1))))

goal (1 subgoal):
 1. limit_mat (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))) d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
limit_mat (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))) d

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
with liml limit_mat_unique
[PROOF STATE]
proof (chain)
picking this:
limit_mat (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) (DW \<rho>) d
\<lbrakk>limit_mat ?X ?A ?m; limit_mat ?X ?B ?m\<rbrakk> \<Longrightarrow> ?A = ?B
limit_mat (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))) d
[PROOF STEP]
have
    "DW \<rho> = (M0 * \<rho> * adjoint M0 + (DW (DS (M1 * \<rho> * adjoint M1))))"
[PROOF STATE]
proof (prove)
using this:
limit_mat (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) (DW \<rho>) d
\<lbrakk>limit_mat ?X ?A ?m; limit_mat ?X ?B ?m\<rbrakk> \<Longrightarrow> ?A = ?B
limit_mat (\<lambda>k. matrix_sum d (\<lambda>k. D0 k \<rho>) (Suc k)) (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))) d

goal (1 subgoal):
 1. DW \<rho> = M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
DW \<rho> = M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
DW \<rho> = M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
DW \<rho> = M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
unfolding DW_def M0_def M1_def DS_def
[PROOF STATE]
proof (prove)
using this:
denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))

goal (1 subgoal):
 1. denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
denote (While M S) \<rho> = M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isomorphic_to_zero_right : "W = 0 \<Longrightarrow> V = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W = 0 \<Longrightarrow> V = 0
[PROOF STEP]
using isomorphic_sym FGModuleIso.isomorphic_to_zero_left
[PROOF STATE]
proof (prove)
using this:
\<exists>T. FGModuleIso G (\<star>) W (\<cdot>) T V
\<lbrakk>FGModuleIso ?G ?smult ?V ?smult' ?T ?W; ?V = 0\<rbrakk> \<Longrightarrow> ?W = 0

goal (1 subgoal):
 1. W = 0 \<Longrightarrow> V = 0
[PROOF STEP]
by fast


[STATEMENT]
lemma n_inter_num_one: "finite b1 \<Longrightarrow> finite b2 \<Longrightarrow> b1 |\<inter>|\<^sub>1 b2 = b1 |\<inter>| b2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite b1; finite b2\<rbrakk> \<Longrightarrow> (b1 |\<inter>|\<^sub>1 b2) = b1 |\<inter>| b2
[PROOF STEP]
using n_intersect_number_def intersection_number_def card_Pow_filter_one
[PROOF STATE]
proof (prove)
using this:
?b1.0 |\<inter>|\<^sub>?n ?b2.0 \<equiv> card {x \<in> Pow (?b1.0 \<inter> ?b2.0). card x = ?n}
?b1.0 |\<inter>| ?b2.0 \<equiv> card (?b1.0 \<inter> ?b2.0)
finite ?A \<Longrightarrow> card {x \<in> Pow ?A. card x = 1} = card ?A

goal (1 subgoal):
 1. \<lbrakk>finite b1; finite b2\<rbrakk> \<Longrightarrow> (b1 |\<inter>|\<^sub>1 b2) = b1 |\<inter>| b2
[PROOF STEP]
by (metis (full_types) finite_Int)


[STATEMENT]
lemma LLL_factorization_primitive: assumes "LLL_factorization f = fs"
  "square_free f"
  "0 < degree f"
  "primitive f"
shows "f = prod_list fs \<and> (\<forall>fi\<in>set fs. irreducible fi \<and> 0 < degree fi \<and> primitive fi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = prod_list fs \<and> (\<forall>fi\<in>set fs. irreducible fi \<and> 0 < degree fi \<and> primitive fi)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
LLL_factorization f = fs

goal (1 subgoal):
 1. f = prod_list fs \<and> (\<forall>fi\<in>set fs. irreducible fi \<and> 0 < degree fi \<and> primitive fi)
[PROOF STEP]
by (intro int_poly_factorization_algorithm_irreducible[of one_lattice_LLL_factorization,
      OF _ assms(2-)], transfer, auto)


[STATEMENT]
lemma Worder_ord_equivTr:"\<lbrakk>Worder S; Worder T\<rbrakk> \<Longrightarrow>
       ord_equiv S T = (\<exists>f. ord_isom S T f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Worder S; Worder T\<rbrakk> \<Longrightarrow> ord_equiv S T = (\<exists>f. ord_isom S T f)
[PROOF STEP]
by (frule Worder.Order[of "S"], frule Worder.Order[of "T"],
    simp add:ord_equiv_def)


[STATEMENT]
lemma complete_eq_closed:
  fixes S :: "('a::complete_space) set"
  shows "complete S \<longleftrightarrow> closed S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complete S = closed S
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. complete S \<Longrightarrow> closed S
 2. closed S \<Longrightarrow> complete S
[PROOF STEP]
assume "closed S"
[PROOF STATE]
proof (state)
this:
closed S

goal (2 subgoals):
 1. complete S \<Longrightarrow> closed S
 2. closed S \<Longrightarrow> complete S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
closed S
[PROOF STEP]
show "complete S"
[PROOF STATE]
proof (prove)
using this:
closed S

goal (1 subgoal):
 1. complete S
[PROOF STEP]
using subset_UNIV complete_UNIV
[PROOF STATE]
proof (prove)
using this:
closed S
?A \<subseteq> UNIV
complete UNIV

goal (1 subgoal):
 1. complete S
[PROOF STEP]
by (rule complete_closed_subset)
[PROOF STATE]
proof (state)
this:
complete S

goal (1 subgoal):
 1. complete S \<Longrightarrow> closed S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. complete S \<Longrightarrow> closed S
[PROOF STEP]
assume "complete S"
[PROOF STATE]
proof (state)
this:
complete S

goal (1 subgoal):
 1. complete S \<Longrightarrow> closed S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
complete S
[PROOF STEP]
show "closed S"
[PROOF STATE]
proof (prove)
using this:
complete S

goal (1 subgoal):
 1. closed S
[PROOF STEP]
by (rule complete_imp_closed)
[PROOF STATE]
proof (state)
this:
closed S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma column_leading_coefficient_component_eq:
  fixes A::"'a::{field}^'m::{mod_type}^'n::{finite,one,plus,ord}"
  assumes rref_A: "reduced_row_echelon_form A"
  and v: "v \<in> {column (LEAST n. A $ i $ n \<noteq> 0) A |i. row i A \<noteq> 0}"
  and vx: "v $ x \<noteq> 0"
  and vy: "v $ y \<noteq> 0"
  shows "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
obtain b where b: "v = column (LEAST n. A $ b $ n \<noteq> 0) A" and row_b: "row b A \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. \<lbrakk>v = column (LEAST n. A $ b $ n \<noteq> (0::'a)) A; row b A \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using v
[PROOF STATE]
proof (prove)
using this:
v \<in> {column (LEAST n. A $ i $ n \<noteq> (0::'a)) A |i. row i A \<noteq> 0}

goal (1 subgoal):
 1. (\<And>b. \<lbrakk>v = column (LEAST n. A $ b $ n \<noteq> (0::'a)) A; row b A \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
v = column (LEAST n. A $ b $ n \<noteq> (0::'a)) A
row b A \<noteq> 0

goal (1 subgoal):
 1. x = y
[PROOF STEP]
have vb_not_zero: "v $ b \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v $ b \<noteq> (0::'a)
[PROOF STEP]
unfolding b column_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i. A $ i $ (LEAST n. A $ b $ n \<noteq> (0::'a))) $ b \<noteq> (0::'a)
[PROOF STEP]
by (auto, metis is_zero_row_eq_row_zero row_b rref_A rref_condition2 zero_neq_one)
[PROOF STATE]
proof (state)
this:
v $ b \<noteq> (0::'a)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
have b_eq_x: "b = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b = x
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<noteq> x \<Longrightarrow> False
[PROOF STEP]
assume b_not_x: "b\<noteq>x"
[PROOF STATE]
proof (state)
this:
b \<noteq> x

goal (1 subgoal):
 1. b \<noteq> x \<Longrightarrow> False
[PROOF STEP]
have "A $ x $ (LEAST n. A $ b $ n \<noteq> 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ x $ (LEAST n. A $ b $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
by (rule rref_condition4_explicit[OF rref_A _ b_not_x], simp add: is_zero_row_eq_row_zero row_b)
[PROOF STATE]
proof (state)
this:
A $ x $ (LEAST n. A $ b $ n \<noteq> (0::'a)) = (0::'a)

goal (1 subgoal):
 1. b \<noteq> x \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
A $ x $ (LEAST n. A $ b $ n \<noteq> (0::'a)) = (0::'a)

goal (1 subgoal):
 1. False
[PROOF STEP]
using vx
[PROOF STATE]
proof (prove)
using this:
A $ x $ (LEAST n. A $ b $ n \<noteq> (0::'a)) = (0::'a)
v $ x \<noteq> (0::'a)

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding b column_def
[PROOF STATE]
proof (prove)
using this:
A $ x $ (LEAST n. A $ b $ n \<noteq> (0::'a)) = (0::'a)
(\<chi>i. A $ i $ (LEAST n. A $ b $ n \<noteq> (0::'a))) $ x \<noteq> (0::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b = x

goal (1 subgoal):
 1. x = y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
b = x

goal (1 subgoal):
 1. x = y
[PROOF STEP]
have b_eq_y: "b = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b = y
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<noteq> y \<Longrightarrow> False
[PROOF STEP]
assume b_not_y: "b\<noteq>y"
[PROOF STATE]
proof (state)
this:
b \<noteq> y

goal (1 subgoal):
 1. b \<noteq> y \<Longrightarrow> False
[PROOF STEP]
have "A $ y $ (LEAST n. A $ b $ n \<noteq> 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ y $ (LEAST n. A $ b $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
by (rule rref_condition4_explicit[OF rref_A _ b_not_y], simp add: is_zero_row_eq_row_zero row_b)
[PROOF STATE]
proof (state)
this:
A $ y $ (LEAST n. A $ b $ n \<noteq> (0::'a)) = (0::'a)

goal (1 subgoal):
 1. b \<noteq> y \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
A $ y $ (LEAST n. A $ b $ n \<noteq> (0::'a)) = (0::'a)

goal (1 subgoal):
 1. False
[PROOF STEP]
using vy
[PROOF STATE]
proof (prove)
using this:
A $ y $ (LEAST n. A $ b $ n \<noteq> (0::'a)) = (0::'a)
v $ y \<noteq> (0::'a)

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding b column_def
[PROOF STATE]
proof (prove)
using this:
A $ y $ (LEAST n. A $ b $ n \<noteq> (0::'a)) = (0::'a)
(\<chi>i. A $ i $ (LEAST n. A $ b $ n \<noteq> (0::'a))) $ y \<noteq> (0::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b = y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
b = x
b = y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b = x
b = y

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

goal:
No subgoals!
[PROOF STEP]
qed