[STATEMENT]
lemma filterlim_at_infinity_divide_iff:
  fixes f::"'a \<Rightarrow> 'b::real_normed_field"
  assumes "(f \<longlongrightarrow> c) F" "c\<noteq>0"
  shows "(LIM x F. f x / g x :> at_infinity) \<longleftrightarrow> (LIM x F. g x :> at 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LIM x F. f x / g x :> at_infinity) = filterlim g (at (0::'b)) F
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. LIM x F. f x / g x :> at_infinity \<Longrightarrow> filterlim g (at (0::'b)) F
 2. filterlim g (at (0::'b)) F \<Longrightarrow> LIM x F. f x / g x :> at_infinity
[PROOF STEP]
assume asm:"LIM x F. f x / g x :> at_infinity"
[PROOF STATE]
proof (state)
this:
LIM x F. f x / g x :> at_infinity

goal (2 subgoals):
 1. LIM x F. f x / g x :> at_infinity \<Longrightarrow> filterlim g (at (0::'b)) F
 2. filterlim g (at (0::'b)) F \<Longrightarrow> LIM x F. f x / g x :> at_infinity
[PROOF STEP]
have "LIM x F. inverse (f x) * (f x / g x) :> at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x F. inverse (f x) * (f x / g x) :> at_infinity
[PROOF STEP]
apply (rule tendsto_mult_filterlim_at_infinity[of _ "inverse c", OF _ _ asm])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((\<lambda>x. inverse (f x)) \<longlongrightarrow> inverse c) F
 2. inverse c \<noteq> (0::'b)
[PROOF STEP]
by (auto simp add: assms(1) assms(2) tendsto_inverse)
[PROOF STATE]
proof (state)
this:
LIM x F. inverse (f x) * (f x / g x) :> at_infinity

goal (2 subgoals):
 1. LIM x F. f x / g x :> at_infinity \<Longrightarrow> filterlim g (at (0::'b)) F
 2. filterlim g (at (0::'b)) F \<Longrightarrow> LIM x F. f x / g x :> at_infinity
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LIM x F. inverse (f x) * (f x / g x) :> at_infinity
[PROOF STEP]
have "LIM x F. inverse (g x) :> at_infinity"
[PROOF STATE]
proof (prove)
using this:
LIM x F. inverse (f x) * (f x / g x) :> at_infinity

goal (1 subgoal):
 1. LIM x F. inverse (g x) :> at_infinity
[PROOF STEP]
apply (elim filterlim_mono_eventually)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. at_infinity \<le> at_infinity
 2. F \<le> F
 3. \<forall>\<^sub>F x in F. inverse (f x) * (f x / g x) = inverse (g x)
[PROOF STEP]
using eventually_times_inverse_1[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. inverse (f x) * f x = (1::'b)

goal (3 subgoals):
 1. at_infinity \<le> at_infinity
 2. F \<le> F
 3. \<forall>\<^sub>F x in F. inverse (f x) * (f x / g x) = inverse (g x)
[PROOF STEP]
by (auto elim:eventually_mono simp add:field_simps)
[PROOF STATE]
proof (state)
this:
LIM x F. inverse (g x) :> at_infinity

goal (2 subgoals):
 1. LIM x F. f x / g x :> at_infinity \<Longrightarrow> filterlim g (at (0::'b)) F
 2. filterlim g (at (0::'b)) F \<Longrightarrow> LIM x F. f x / g x :> at_infinity
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LIM x F. inverse (g x) :> at_infinity
[PROOF STEP]
show "filterlim g (at 0) F"
[PROOF STATE]
proof (prove)
using this:
LIM x F. inverse (g x) :> at_infinity

goal (1 subgoal):
 1. filterlim g (at (0::'b)) F
[PROOF STEP]
using filterlim_inverse_at_iff[symmetric]
[PROOF STATE]
proof (prove)
using this:
LIM x F. inverse (g x) :> at_infinity
filterlim ?g at_infinity ?F = (LIM x ?F. inverse (?g x) :> at (0::?'b))

goal (1 subgoal):
 1. filterlim g (at (0::'b)) F
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
filterlim g (at (0::'b)) F

goal (1 subgoal):
 1. filterlim g (at (0::'b)) F \<Longrightarrow> LIM x F. f x / g x :> at_infinity
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filterlim g (at (0::'b)) F \<Longrightarrow> LIM x F. f x / g x :> at_infinity
[PROOF STEP]
assume "filterlim g (at 0) F"
[PROOF STATE]
proof (state)
this:
filterlim g (at (0::'b)) F

goal (1 subgoal):
 1. filterlim g (at (0::'b)) F \<Longrightarrow> LIM x F. f x / g x :> at_infinity
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
filterlim g (at (0::'b)) F
[PROOF STEP]
have "filterlim (\<lambda>x. inverse (g x)) at_infinity F"
[PROOF STATE]
proof (prove)
using this:
filterlim g (at (0::'b)) F

goal (1 subgoal):
 1. LIM x F. inverse (g x) :> at_infinity
[PROOF STEP]
using filterlim_compose filterlim_inverse_at_infinity
[PROOF STATE]
proof (prove)
using this:
filterlim g (at (0::'b)) F
\<lbrakk>filterlim ?g ?F3.0 ?F2.0; filterlim ?f ?F2.0 ?F1.0\<rbrakk> \<Longrightarrow> LIM x ?F1.0. ?g (?f x) :> ?F3.0
filterlim inverse at_infinity (at (0::?'a))

goal (1 subgoal):
 1. LIM x F. inverse (g x) :> at_infinity
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
LIM x F. inverse (g x) :> at_infinity

goal (1 subgoal):
 1. filterlim g (at (0::'b)) F \<Longrightarrow> LIM x F. f x / g x :> at_infinity
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LIM x F. inverse (g x) :> at_infinity
[PROOF STEP]
have "LIM x F. f x * inverse (g x) :> at_infinity"
[PROOF STATE]
proof (prove)
using this:
LIM x F. inverse (g x) :> at_infinity

goal (1 subgoal):
 1. LIM x F. f x * inverse (g x) :> at_infinity
[PROOF STEP]
using tendsto_mult_filterlim_at_infinity[OF assms, of "\<lambda>x. inverse(g x)"]
[PROOF STATE]
proof (prove)
using this:
LIM x F. inverse (g x) :> at_infinity
LIM x F. inverse (g x) :> at_infinity \<Longrightarrow> LIM x F. f x * inverse (g x) :> at_infinity

goal (1 subgoal):
 1. LIM x F. f x * inverse (g x) :> at_infinity
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
LIM x F. f x * inverse (g x) :> at_infinity

goal (1 subgoal):
 1. filterlim g (at (0::'b)) F \<Longrightarrow> LIM x F. f x / g x :> at_infinity
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LIM x F. f x * inverse (g x) :> at_infinity
[PROOF STEP]
show "LIM x F. f x / g x :> at_infinity"
[PROOF STATE]
proof (prove)
using this:
LIM x F. f x * inverse (g x) :> at_infinity

goal (1 subgoal):
 1. LIM x F. f x / g x :> at_infinity
[PROOF STEP]
by (simp add: divide_inverse)
[PROOF STATE]
proof (state)
this:
LIM x F. f x / g x :> at_infinity

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rtos_i_mod_r_2:"\<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0\<rbrakk> \<Longrightarrow> rtos r s i mod r = i div s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0\<rbrakk> \<Longrightarrow> rtos r s i mod r = i div s
[PROOF STEP]
apply (simp add:rtos_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0\<rbrakk> \<Longrightarrow> i < r * s \<longrightarrow> i div s mod r = i div s
[PROOF STEP]
apply (frule le_less_trans [of "i" "r * s - Suc 0" "r * s"], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i < r * s\<rbrakk> \<Longrightarrow> i < r * s \<longrightarrow> i div s mod r = i div s
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i < r * s\<rbrakk> \<Longrightarrow> i div s mod r = i div s
[PROOF STEP]
apply (frule_tac  r = r and s = s and l = i in div_Tr2, assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i < r * s\<rbrakk> \<Longrightarrow> i < s * r
 2. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i < r * s; i div s \<le> r - Suc 0\<rbrakk> \<Longrightarrow> i div s mod r = i div s
[PROOF STEP]
apply (simp add:mult.commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i < r * s; i div s \<le> r - Suc 0\<rbrakk> \<Longrightarrow> i div s mod r = i div s
[PROOF STEP]
apply (subgoal_tac "i div s < r")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i < r * s; i div s \<le> r - Suc 0; i div s < r\<rbrakk> \<Longrightarrow> i div s mod r = i div s
 2. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i < r * s; i div s \<le> r - Suc 0\<rbrakk> \<Longrightarrow> i div s < r
[PROOF STEP]
apply (rule rfn_tool20, assumption+, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i < r * s; i div s \<le> r - Suc 0; i div s < r\<rbrakk> \<Longrightarrow> i div s < r
 2. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i < r * s; i div s \<le> r - Suc 0\<rbrakk> \<Longrightarrow> i div s < r
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i < r * s; i div s \<le> r - Suc 0\<rbrakk> \<Longrightarrow> i div s < r
[PROOF STEP]
apply (rule le_less_trans, assumption+, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma integrable_abs[simp, intro]:
  fixes f :: "'a \<Rightarrow> real"
  assumes [measurable]: "integrable M f" shows "integrable M (\<lambda>x. \<bar>f x\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. \<bar>f x\<bar>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
integrable M f

goal (1 subgoal):
 1. integrable M (\<lambda>x. \<bar>f x\<bar>)
[PROOF STEP]
by (rule integrable_bound) auto


[STATEMENT]
lemma rcis_times_2pi[simp]: "rcis r (of_nat n * 2 * pi) = of_real r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rcis r (real n * 2 * pi) = complex_of_real r
[PROOF STEP]
unfolding rcis_def cis_times_2pi
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real r * 1 = complex_of_real r
[PROOF STEP]
by simp


[STATEMENT]
lemma wlp_while_split:
  assumes wc: "well_com (While M S)" and qpP: "is_quantum_predicate P"
  shows "wlp (While M S) P = adjoint (M 0) * P * (M 0) + adjoint (M 1) * (wlp S (wlp (While M S) P)) * (M 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * 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. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * 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. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
define M0 where "M0 = M 0"
[PROOF STATE]
proof (state)
this:
M0 = M 0

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
define M1 where "M1 = M 1"
[PROOF STATE]
proof (state)
this:
M1 = M 1

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * 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. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * 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. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
define DS where "DS = denote S"
[PROOF STATE]
proof (state)
this:
DS = denote S

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * 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. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * 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. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * 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. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * 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. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have dP: "P \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<in> carrier_mat d d
[PROOF STEP]
using qpP is_quantum_predicate_def
[PROOF STATE]
proof (prove)
using this:
is_quantum_predicate P
is_quantum_predicate ?P = (?P \<in> carrier_mat d d \<and> positive ?P \<and> ?P \<le>\<^sub>L 1\<^sub>m d)

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

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have qpWP: "is_quantum_predicate (wlp (While M S) P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_quantum_predicate (wlp (While M S) P)
[PROOF STEP]
using qpP wc wlp_close[OF wc qpP]
[PROOF STATE]
proof (prove)
using this:
is_quantum_predicate P
well_com (While M S)
is_quantum_predicate (wlp (While M S) P)

goal (1 subgoal):
 1. is_quantum_predicate (wlp (While M S) P)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_quantum_predicate (wlp (While M S) P)

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_quantum_predicate (wlp (While M S) P)
[PROOF STEP]
have "is_quantum_predicate (wlp S (wlp (While M S) P))"
[PROOF STATE]
proof (prove)
using this:
is_quantum_predicate (wlp (While M S) P)

goal (1 subgoal):
 1. is_quantum_predicate (wlp S (wlp (While M S) P))
[PROOF STEP]
using wc wlp_close[OF wcs]
[PROOF STATE]
proof (prove)
using this:
is_quantum_predicate (wlp (While M S) P)
well_com (While M S)
is_quantum_predicate ?P \<Longrightarrow> is_quantum_predicate (wlp S ?P)

goal (1 subgoal):
 1. is_quantum_predicate (wlp S (wlp (While M S) P))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_quantum_predicate (wlp S (wlp (While M S) P))

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_quantum_predicate (wlp S (wlp (While M S) P))
[PROOF STEP]
have dWWP: "(wlp S (wlp (While M S) P)) \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
using this:
is_quantum_predicate (wlp S (wlp (While M S) P))

goal (1 subgoal):
 1. wlp S (wlp (While M S) P) \<in> carrier_mat d d
[PROOF STEP]
using is_quantum_predicate_def
[PROOF STATE]
proof (prove)
using this:
is_quantum_predicate (wlp S (wlp (While M S) P))
is_quantum_predicate ?P = (?P \<in> carrier_mat d d \<and> positive ?P \<and> ?P \<le>\<^sub>L 1\<^sub>m d)

goal (1 subgoal):
 1. wlp S (wlp (While M S) P) \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
wlp S (wlp (While M S) P) \<in> carrier_mat d d

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have dWP: "(wlp (While M S) P) \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wlp (While M S) P \<in> carrier_mat d d
[PROOF STEP]
using qpWP is_quantum_predicate_def
[PROOF STATE]
proof (prove)
using this:
is_quantum_predicate (wlp (While M S) P)
is_quantum_predicate ?P = (?P \<in> carrier_mat d d \<and> positive ?P \<and> ?P \<le>\<^sub>L 1\<^sub>m d)

goal (1 subgoal):
 1. wlp (While M S) P \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
wlp (While M S) P \<in> carrier_mat d d

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
wlp (While M S) P \<in> carrier_mat d d

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

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * 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. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have dsM1r: "M1 * \<rho> * adjoint M1 \<in> density_states"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M1 * \<rho> * adjoint M1 \<in> density_states
[PROOF STEP]
unfolding density_states_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M1 * \<rho> * adjoint M1 \<in> {\<rho> \<in> carrier_mat d d. partial_density_operator \<rho>}
[PROOF STEP]
using pdo_close_under_measurement[OF dM1 dr pdor] M1leq dM1 dr
[PROOF STATE]
proof (prove)
using this:
adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d \<Longrightarrow> partial_density_operator (M1 * \<rho> * adjoint M1)
adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d
M1 \<in> carrier_mat d d
\<rho> \<in> carrier_mat d d

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

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M1 * \<rho> * adjoint M1 \<in> density_states
[PROOF STEP]
have dsDSM1r: "DS (M1 * \<rho> * adjoint M1) \<in> density_states"
[PROOF STATE]
proof (prove)
using this:
M1 * \<rho> * adjoint M1 \<in> density_states

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

goal (1 subgoal):
 1. denote S (M1 * \<rho> * adjoint M1) \<in> {\<rho> \<in> carrier_mat d d. partial_density_operator \<rho>}
[PROOF STEP]
using denote_dim_pdo[OF wcs]
[PROOF STATE]
proof (prove)
using this:
M1 * \<rho> * adjoint M1 \<in> {\<rho> \<in> carrier_mat d d. partial_density_operator \<rho>}
\<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> {\<rho> \<in> carrier_mat d d. partial_density_operator \<rho>}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
DS (M1 * \<rho> * adjoint M1) \<in> density_states

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * 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. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have dDWDSM1r: "DW (DS (M1 * \<rho> * adjoint M1)) \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. DW (DS (M1 * \<rho> * adjoint M1)) \<in> carrier_mat d d
[PROOF STEP]
unfolding DW_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. denote (While M S) (DS (M1 * \<rho> * adjoint M1)) \<in> carrier_mat d d
[PROOF STEP]
using denote_dim[OF wc] dsDSM1r density_states_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<rho> \<in> carrier_mat d d; partial_density_operator ?\<rho>\<rbrakk> \<Longrightarrow> denote (While M S) ?\<rho> \<in> carrier_mat d d
DS (M1 * \<rho> * adjoint M1) \<in> density_states
density_states = {\<rho> \<in> carrier_mat d d. partial_density_operator \<rho>}

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

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have eq2: "trace ((wlp (While M S) P) * DS (M1 * \<rho> * adjoint M1))
          = trace (P * (DW (DS (M1 * \<rho> * adjoint M1)))) + trace (DS (M1 * \<rho> * adjoint M1)) - trace (DW (DS (M1 * \<rho> * adjoint M1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (wlp (While M S) P * DS (M1 * \<rho> * adjoint M1)) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace (DS (M1 * \<rho> * adjoint M1)) - trace (DW (DS (M1 * \<rho> * adjoint M1)))
[PROOF STEP]
unfolding DW_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (wlp (While M S) P * DS (M1 * \<rho> * adjoint M1)) = trace (P * denote (While M S) (DS (M1 * \<rho> * adjoint M1))) + trace (DS (M1 * \<rho> * adjoint M1)) - trace (denote (While M S) (DS (M1 * \<rho> * adjoint M1)))
[PROOF STEP]
using wlp_soundness[OF wc qpP] dsDSM1r
[PROOF STATE]
proof (prove)
using this:
\<forall>\<rho>\<in>density_states. trace (wlp (While M S) P * \<rho>) = trace (P * denote (While M S) \<rho>) + trace \<rho> - trace (denote (While M S) \<rho>)
DS (M1 * \<rho> * adjoint M1) \<in> density_states

goal (1 subgoal):
 1. trace (wlp (While M S) P * DS (M1 * \<rho> * adjoint M1)) = trace (P * denote (While M S) (DS (M1 * \<rho> * adjoint M1))) + trace (DS (M1 * \<rho> * adjoint M1)) - trace (denote (While M S) (DS (M1 * \<rho> * adjoint M1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (wlp (While M S) P * DS (M1 * \<rho> * adjoint M1)) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace (DS (M1 * \<rho> * adjoint M1)) - trace (DW (DS (M1 * \<rho> * adjoint M1)))

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have eq3: "trace (M1 * \<rho> * adjoint M1) = trace \<rho> - trace (M0 * \<rho> * adjoint M0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (M1 * \<rho> * adjoint M1) = trace \<rho> - trace (M0 * \<rho> * adjoint M0)
[PROOF STEP]
unfolding M0_def M1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (M 1 * \<rho> * adjoint (M 1)) = trace \<rho> - trace (M 0 * \<rho> * adjoint (M 0))
[PROOF STEP]
using m trace_measurement2[OF m dr] dr
[PROOF STATE]
proof (prove)
using this:
measurement d 2 M
trace (M 0 * \<rho> * adjoint (M 0)) + trace (M 1 * \<rho> * adjoint (M 1)) = trace \<rho>
\<rho> \<in> carrier_mat d d

goal (1 subgoal):
 1. trace (M 1 * \<rho> * adjoint (M 1)) = trace \<rho> - trace (M 0 * \<rho> * adjoint (M 0))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
trace (M1 * \<rho> * adjoint M1) = trace \<rho> - trace (M0 * \<rho> * adjoint M0)

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have "trace (adjoint M1 * (wlp S (wlp (While M S) P)) * M1 * \<rho>)
          = trace ((wlp S (wlp (While M S) P)) * (M1 * \<rho> * adjoint M1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (wlp S (wlp (While M S) P) * (M1 * \<rho> * adjoint M1))
[PROOF STEP]
using dWWP dM1 dr
[PROOF STATE]
proof (prove)
using this:
wlp S (wlp (While M S) P) \<in> carrier_mat d d
M1 \<in> carrier_mat d d
\<rho> \<in> carrier_mat d d

goal (1 subgoal):
 1. trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (wlp S (wlp (While M S) P) * (M1 * \<rho> * adjoint M1))
[PROOF STEP]
by (mat_assoc d)
[PROOF STATE]
proof (state)
this:
trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (wlp S (wlp (While M S) P) * (M1 * \<rho> * adjoint M1))

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (wlp S (wlp (While M S) P) * (M1 * \<rho> * adjoint M1))

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have "\<dots> = trace ((wlp (While M S) P) * DS (M1 * \<rho> * adjoint M1))
                  + trace (M1 * \<rho> * adjoint M1) - trace (DS (M1 * \<rho> * adjoint M1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (wlp S (wlp (While M S) P) * (M1 * \<rho> * adjoint M1)) = trace (wlp (While M S) P * DS (M1 * \<rho> * adjoint M1)) + trace (M1 * \<rho> * adjoint M1) - trace (DS (M1 * \<rho> * adjoint M1))
[PROOF STEP]
unfolding DS_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (wlp S (wlp (While M S) P) * (M1 * \<rho> * adjoint M1)) = trace (wlp (While M S) P * denote S (M1 * \<rho> * adjoint M1)) + trace (M1 * \<rho> * adjoint M1) - trace (denote S (M1 * \<rho> * adjoint M1))
[PROOF STEP]
using wlp_soundness[OF wcs qpWP] dsM1r
[PROOF STATE]
proof (prove)
using this:
\<forall>\<rho>\<in>density_states. trace (wlp S (wlp (While M S) P) * \<rho>) = trace (wlp (While M S) P * denote S \<rho>) + trace \<rho> - trace (denote S \<rho>)
M1 * \<rho> * adjoint M1 \<in> density_states

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

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (wlp S (wlp (While M S) P) * (M1 * \<rho> * adjoint M1)) = trace (wlp (While M S) P * DS (M1 * \<rho> * adjoint M1)) + trace (M1 * \<rho> * adjoint M1) - trace (DS (M1 * \<rho> * adjoint M1))

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have "\<dots> = trace (P * (DW (DS (M1 * \<rho> * adjoint M1))))
                  + trace (M1 * \<rho> * adjoint M1)  - trace (DW (DS (M1 * \<rho> * adjoint M1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (wlp (While M S) P * DS (M1 * \<rho> * adjoint M1)) + trace (M1 * \<rho> * adjoint M1) - trace (DS (M1 * \<rho> * adjoint M1)) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace (M1 * \<rho> * adjoint M1) - trace (DW (DS (M1 * \<rho> * adjoint M1)))
[PROOF STEP]
using eq2
[PROOF STATE]
proof (prove)
using this:
trace (wlp (While M S) P * DS (M1 * \<rho> * adjoint M1)) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace (DS (M1 * \<rho> * adjoint M1)) - trace (DW (DS (M1 * \<rho> * adjoint M1)))

goal (1 subgoal):
 1. trace (wlp (While M S) P * DS (M1 * \<rho> * adjoint M1)) + trace (M1 * \<rho> * adjoint M1) - trace (DS (M1 * \<rho> * adjoint M1)) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace (M1 * \<rho> * adjoint M1) - trace (DW (DS (M1 * \<rho> * adjoint M1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (wlp (While M S) P * DS (M1 * \<rho> * adjoint M1)) + trace (M1 * \<rho> * adjoint M1) - trace (DS (M1 * \<rho> * adjoint M1)) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace (M1 * \<rho> * adjoint M1) - trace (DW (DS (M1 * \<rho> * adjoint M1)))

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (wlp (While M S) P * DS (M1 * \<rho> * adjoint M1)) + trace (M1 * \<rho> * adjoint M1) - trace (DS (M1 * \<rho> * adjoint M1)) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace (M1 * \<rho> * adjoint M1) - trace (DW (DS (M1 * \<rho> * adjoint M1)))

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have "\<dots> = trace (P * (DW (DS (M1 * \<rho> * adjoint M1)))) + trace \<rho> - (trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace (M1 * \<rho> * adjoint M1) - trace (DW (DS (M1 * \<rho> * adjoint M1))) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace \<rho> - (trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))))
[PROOF STEP]
using eq3
[PROOF STATE]
proof (prove)
using this:
trace (M1 * \<rho> * adjoint M1) = trace \<rho> - trace (M0 * \<rho> * adjoint M0)

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

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace \<rho> - (trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))))
[PROOF STEP]
have eq4: "trace (adjoint M1 * (wlp S (wlp (While M S) P)) * M1 * \<rho>)
      = trace (P * (DW (DS (M1 * \<rho> * adjoint M1)))) + trace \<rho> - (trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))))"
[PROOF STATE]
proof (prove)
using this:
trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace \<rho> - (trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))))

goal (1 subgoal):
 1. trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace \<rho> - (trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace \<rho> - (trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))))

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have "trace (adjoint M0 * P * M0 * \<rho>) + trace (P * (DW (DS (M1 * \<rho> * adjoint M1))))
      = trace (P * ((M0 * \<rho> * adjoint M0) + (DW (DS (M1 * \<rho> * adjoint M1)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (adjoint M0 * P * M0 * \<rho>) + trace (P * DW (DS (M1 * \<rho> * adjoint M1))) = trace (P * (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))))
[PROOF STEP]
using dP dr dM0 dDWDSM1r
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier_mat d d
\<rho> \<in> carrier_mat d d
M0 \<in> carrier_mat d d
DW (DS (M1 * \<rho> * adjoint M1)) \<in> carrier_mat d d

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

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (adjoint M0 * P * M0 * \<rho>) + trace (P * DW (DS (M1 * \<rho> * adjoint M1))) = trace (P * (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))))

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have "\<dots> = trace (P * (DW \<rho>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (P * (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1)))) = trace (P * DW \<rho>)
[PROOF STEP]
unfolding DW_def M0_def M1_def DS_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (P * (M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1))))) = trace (P * denote (While M S) \<rho>)
[PROOF STEP]
using denote_while_split[OF wc dsr]
[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. trace (P * (M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1))))) = trace (P * denote (While M S) \<rho>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (P * (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1)))) = trace (P * DW \<rho>)

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
trace (adjoint M0 * P * M0 * \<rho>) + trace (P * DW (DS (M1 * \<rho> * adjoint M1))) = trace (P * DW \<rho>)
[PROOF STEP]
have eq5: "trace (adjoint M0 * P * M0 * \<rho>) + trace (P * (DW (DS (M1 * \<rho> * adjoint M1)))) = trace (P * (DW \<rho>))"
[PROOF STATE]
proof (prove)
using this:
trace (adjoint M0 * P * M0 * \<rho>) + trace (P * DW (DS (M1 * \<rho> * adjoint M1))) = trace (P * DW \<rho>)

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

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

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

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))) = trace (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1)))

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have "\<dots> = trace (DW \<rho>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))) = trace (DW \<rho>)
[PROOF STEP]
unfolding DW_def DS_def M0_def M1_def denote_while_split[OF wc dsr]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (M 0 * \<rho> * adjoint (M 0) + denote (While M S) (denote S (M 1 * \<rho> * adjoint (M 1)))) = trace (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:
trace (M0 * \<rho> * adjoint M0 + DW (DS (M1 * \<rho> * adjoint M1))) = trace (DW \<rho>)

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))) = trace (DW \<rho>)
[PROOF STEP]
have eq6: "trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))) = trace (DW \<rho>)"
[PROOF STATE]
proof (prove)
using this:
trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))) = trace (DW \<rho>)

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

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
from eq5 eq4 eq6
[PROOF STATE]
proof (chain)
picking this:
trace (adjoint M0 * P * M0 * \<rho>) + trace (P * DW (DS (M1 * \<rho> * adjoint M1))) = trace (P * DW \<rho>)
trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace \<rho> - (trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))))
trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))) = trace (DW \<rho>)
[PROOF STEP]
have
      eq7: "trace (adjoint M0 * P * M0 * \<rho>) + trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>)
      = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)"
[PROOF STATE]
proof (prove)
using this:
trace (adjoint M0 * P * M0 * \<rho>) + trace (P * DW (DS (M1 * \<rho> * adjoint M1))) = trace (P * DW \<rho>)
trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (P * DW (DS (M1 * \<rho> * adjoint M1))) + trace \<rho> - (trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))))
trace (M0 * \<rho> * adjoint M0) + trace (DW (DS (M1 * \<rho> * adjoint M1))) = trace (DW \<rho>)

goal (1 subgoal):
 1. trace (adjoint M0 * P * M0 * \<rho>) + trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (adjoint M0 * P * M0 * \<rho>) + trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have eq8: "trace (adjoint M0 * P * M0 * \<rho>) + trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>)
      = trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (adjoint M0 * P * M0 * \<rho>) + trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>)
[PROOF STEP]
using dM0 dM1 dr dP dWWP
[PROOF STATE]
proof (prove)
using this:
M0 \<in> carrier_mat d d
M1 \<in> carrier_mat d d
\<rho> \<in> carrier_mat d d
P \<in> carrier_mat d d
wlp S (wlp (While M S) P) \<in> carrier_mat d d

goal (1 subgoal):
 1. trace (adjoint M0 * P * M0 * \<rho>) + trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>)
[PROOF STEP]
by (mat_assoc d)
[PROOF STATE]
proof (state)
this:
trace (adjoint M0 * P * M0 * \<rho>) + trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>)

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
from eq7 eq8
[PROOF STATE]
proof (chain)
picking this:
trace (adjoint M0 * P * M0 * \<rho>) + trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)
trace (adjoint M0 * P * M0 * \<rho>) + trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>)
[PROOF STEP]
have
      eq9: "trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)"
[PROOF STATE]
proof (prove)
using this:
trace (adjoint M0 * P * M0 * \<rho>) + trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)
trace (adjoint M0 * P * M0 * \<rho>) + trace (adjoint M1 * wlp S (wlp (While M S) P) * M1 * \<rho>) = trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>)

goal (1 subgoal):
 1. trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
have eq10: "trace ((wlp (While M S) P) * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (wlp (While M S) P * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)
[PROOF STEP]
unfolding DW_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (wlp (While M S) P * \<rho>) = trace (P * denote (While M S) \<rho>) + trace \<rho> - trace (denote (While M S) \<rho>)
[PROOF STEP]
using wlp_soundness[OF wc qpP] dsr
[PROOF STATE]
proof (prove)
using this:
\<forall>\<rho>\<in>density_states. trace (wlp (While M S) P * \<rho>) = trace (P * denote (While M S) \<rho>) + trace \<rho> - trace (denote (While M S) \<rho>)
\<rho> \<in> density_states

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

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
with eq9
[PROOF STATE]
proof (chain)
picking this:
trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)
trace (wlp (While M S) P * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)
[PROOF STEP]
have "trace ((wlp (While M S) P) * \<rho>) = trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>)"
[PROOF STATE]
proof (prove)
using this:
trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)
trace (wlp (While M S) P * \<rho>) = trace (P * DW \<rho>) + trace \<rho> - trace (DW \<rho>)

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

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?\<rho>2 \<in> density_states \<Longrightarrow> trace (wlp (While M S) P * ?\<rho>2) = trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * ?\<rho>2)

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?\<rho>2 \<in> density_states \<Longrightarrow> trace (wlp (While M S) P * ?\<rho>2) = trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * ?\<rho>2)
[PROOF STEP]
have "(wlp (While M S) P) = (adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1)"
[PROOF STATE]
proof (prove)
using this:
?\<rho>2 \<in> density_states \<Longrightarrow> trace (wlp (While M S) P * ?\<rho>2) = trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * ?\<rho>2)

goal (1 subgoal):
 1. wlp (While M S) P = adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1
[PROOF STEP]
using trace_pdo_eq_imp_eq[OF dWP, of "adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1"]
      dM0 dP dM1 dWWP density_states_def
[PROOF STATE]
proof (prove)
using this:
?\<rho>2 \<in> density_states \<Longrightarrow> trace (wlp (While M S) P * ?\<rho>2) = trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * ?\<rho>2)
\<lbrakk>adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1 \<in> carrier_mat d d; \<And>\<rho>. \<lbrakk>\<rho> \<in> carrier_mat d d; partial_density_operator \<rho>\<rbrakk> \<Longrightarrow> trace (wlp (While M S) P * \<rho>) = trace ((adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1) * \<rho>)\<rbrakk> \<Longrightarrow> wlp (While M S) P = adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1
M0 \<in> carrier_mat d d
P \<in> carrier_mat d d
M1 \<in> carrier_mat d d
wlp S (wlp (While M S) P) \<in> carrier_mat d d
density_states = {\<rho> \<in> carrier_mat d d. partial_density_operator \<rho>}

goal (1 subgoal):
 1. wlp (While M S) P = adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
wlp (While M S) P = adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
wlp (While M S) P = adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
wlp (While M S) P = adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
using M0_def M1_def
[PROOF STATE]
proof (prove)
using this:
wlp (While M S) P = adjoint M0 * P * M0 + adjoint M1 * wlp S (wlp (While M S) P) * M1
M0 = M 0
M1 = M 1

goal (1 subgoal):
 1. wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
wlp (While M S) P = adjoint (M 0) * P * M 0 + adjoint (M 1) * wlp S (wlp (While M S) P) * M 1

goal:
No subgoals!
[PROOF STEP]
qed


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


[STATEMENT]
theorem tensor_compose_condn:
assumes wf1:"mat nr nc ((A1\<circ>A2)\<otimes>(B1\<circ>B2))"
   and wf2:"mat nr nc ((A1 \<otimes> B1)\<circ>(A2 \<otimes> B2))"
   and wf3:"\<forall>j<nc.\<forall>i<nr.(((A1 \<circ> A2)\<otimes>(B1 \<circ>B2))!j!i
                              = ((A1 \<otimes> B1)\<circ>(A2 \<otimes> B2))!j!i)"
 shows "((A1 \<circ> A2) \<otimes> (B1 \<circ> B2))
                              = ((A1 \<otimes> B1)\<circ>(A2 \<otimes> B2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A1 \<circ> A2 \<otimes> B1 \<circ> B2 = (A1 \<otimes> B1) \<circ> (A2 \<otimes> B2)
[PROOF STEP]
using application wf1 wf2 wf3
[PROOF STATE]
proof (prove)
using this:
\<forall>m1 m2. mat ?nr ?nc m1 \<and> mat ?nr ?nc m2 \<and> (\<forall>j<?nc. \<forall>i<?nr. m1 ! j ! i = m2 ! j ! i) \<longrightarrow> m1 = m2
mat nr nc (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
mat nr nc ((A1 \<otimes> B1) \<circ> (A2 \<otimes> B2))
\<forall>j<nc. \<forall>i<nr. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = ((A1 \<otimes> B1) \<circ> (A2 \<otimes> B2)) ! j ! i

goal (1 subgoal):
 1. A1 \<circ> A2 \<otimes> B1 \<circ> B2 = (A1 \<otimes> B1) \<circ> (A2 \<otimes> B2)
[PROOF STEP]
by blast


[STATEMENT]
lemma not_lt_iff_ge_zmset: "\<not> x < y \<longleftrightarrow> x \<ge> y" for x y :: "'a zmultiset"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> x < y) = (y \<le> x)
[PROOF STEP]
by (unfold less_eq_zmultiset_def, transfer, auto simp: equiv_zmset_def algebra_simps)


[STATEMENT]
lemma frequently_at_top_elim:
  fixes P Q::"'a::linorder \<Rightarrow> bool"
  assumes "\<exists>\<^sub>Fx in at_top. P x"
  assumes "\<And>i. P i \<Longrightarrow> \<exists>j>i. Q j"
  shows "\<exists>\<^sub>Fx in at_top. Q x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frequently Q at_top
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
frequently P at_top
P ?i \<Longrightarrow> \<exists>j>?i. Q j

goal (1 subgoal):
 1. frequently Q at_top
[PROOF STEP]
unfolding frequently_def eventually_at_top_linorder
[PROOF STATE]
proof (prove)
using this:
\<nexists>N. \<forall>n\<ge>N. \<not> P n
P ?i \<Longrightarrow> \<exists>j>?i. Q j

goal (1 subgoal):
 1. \<nexists>N. \<forall>n\<ge>N. \<not> Q n
[PROOF STEP]
by (meson leD le_cases less_le_trans)


[STATEMENT]
lemma H_inv [simp]:
  "H * H = 1\<^sub>m 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H * H = 1\<^sub>m 2
[PROOF STEP]
apply(simp add: H_def times_mat_def one_mat_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat 2 2 (\<lambda>(i, j). row (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 1 else if i = 0 then 1 else - 1)) i \<bullet> col (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 1 else if i = 0 then 1 else - 1)) j) = mat 2 2 (\<lambda>(i, j). if i = j then 1 else 0)
[PROOF STEP]
apply(rule cong_mat)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 2 = 2
 2. 2 = 2
 3. \<And>i j. \<lbrakk>i < 2; j < 2\<rbrakk> \<Longrightarrow> (case (i, j) of (i, j) \<Rightarrow> row (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 1 else if i = 0 then 1 else - 1)) i \<bullet> col (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 1 else if i = 0 then 1 else - 1)) j) = (case (i, j) of (i, j) \<Rightarrow> if i = j then 1 else 0)
[PROOF STEP]
by(auto simp: scalar_prod_def complex_eqI)


[STATEMENT]
lemma insert_at_index_pow_not_car:
  assumes "k \<le>n"
  assumes "length x = n"
  assumes "(insert_at_index x a k) \<in> carrier (R\<^bsup>Suc n\<^esup>)"
  shows "x \<in> carrier (R\<^bsup>n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier (R\<^bsup>n\<^esup>)
[PROOF STEP]
apply(rule cartesian_power_car_memI')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length x = n
 2. \<And>i. i < n \<Longrightarrow> x ! i \<in> carrier R
[PROOF STEP]
apply (simp add: assms(2))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> x ! i \<in> carrier R
[PROOF STEP]
by (metis Suc_mono assms(1) assms(2) assms(3)
      cartesian_power_car_memE' insert_at_index_eq'
      insert_at_index_eq'' leI less_SucI)


[STATEMENT]
lemma ordinal_times_0 [simp]: "x * 0 = (0::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * 0 = 0
[PROOF STEP]
by (simp add: times_ordinal_def)


[STATEMENT]
lemma butlast_tl: "butlast (tl xs) = tl (butlast xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butlast (tl xs) = tl (butlast xs)
[PROOF STEP]
by (induct xs) simp_all


[STATEMENT]
lemma Qp_ev_one:
  assumes "a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  shows "Qp_ev \<one>\<^bsub>Q\<^sub>p[\<X>\<^bsub>n\<^esub>]\<^esub> a = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_at_point Q\<^sub>p a \<one>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> = \<one>
[PROOF STEP]
unfolding coord_ring_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_at_point Q\<^sub>p a \<one>\<^bsub>Pring Q\<^sub>p {..<n}\<^esub> = \<one>
[PROOF STEP]
by (metis Qp.Pring_one eval_at_point_const Qp.one_closed assms)


[STATEMENT]
lemma carrier_one_zero: "(carrier R = {\<zero>}) = (\<one> = \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (carrier R = {\<zero>}) = (\<one> = \<zero>)
[PROOF STEP]
using one_zeroD
[PROOF STATE]
proof (prove)
using this:
\<one> = \<zero> \<Longrightarrow> carrier R = {\<zero>}

goal (1 subgoal):
 1. (carrier R = {\<zero>}) = (\<one> = \<zero>)
[PROOF STEP]
by blast


[STATEMENT]
lemma interval_integral_Icc:
  fixes a b :: real
  shows "a \<le> b \<Longrightarrow> (LBINT x=a..b. f x) = (LBINT x : {a..b}. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> interval_lebesgue_integral lborel (ereal a) (ereal b) f = set_lebesgue_integral lborel {a..b} f
[PROOF STEP]
by (auto intro!: set_integral_discrete_difference[where X="{a, b}"]
           simp add: interval_lebesgue_integral_def)


[STATEMENT]
lemma set_btree_inorder: "set (inorder t) = set_btree t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (inorder t) = set_btree t
[PROOF STEP]
apply(induction t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. set (inorder Leaf) = set_btree Leaf
 2. \<And>x1 t. \<lbrakk>\<And>x1a x1aa. \<lbrakk>x1a \<in> set x1; x1aa \<in> Basic_BNFs.fsts x1a\<rbrakk> \<Longrightarrow> set (inorder x1aa) = set_btree x1aa; set (inorder t) = set_btree t\<rbrakk> \<Longrightarrow> set (inorder (Node x1 t)) = set_btree (Node x1 t)
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in Ring) npOne: " npow R (1\<^sub>r) n = 1\<^sub>r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>r^\<^bsup>R n\<^esup> = 1\<^sub>r
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 1\<^sub>r^\<^bsup>R 0\<^esup> = 1\<^sub>r
 2. \<And>n. 1\<^sub>r^\<^bsup>R n\<^esup> = 1\<^sub>r \<Longrightarrow> 1\<^sub>r^\<^bsup>R Suc n\<^esup> = 1\<^sub>r
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. 1\<^sub>r^\<^bsup>R n\<^esup> = 1\<^sub>r \<Longrightarrow> 1\<^sub>r^\<^bsup>R Suc n\<^esup> = 1\<^sub>r
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. 1\<^sub>r^\<^bsup>R n\<^esup> = 1\<^sub>r \<Longrightarrow> 1\<^sub>r \<cdot>\<^sub>r 1\<^sub>r = 1\<^sub>r
[PROOF STEP]
apply (rule ring_r_one, simp add:ring_one)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma reachable_extend_eq: "reachable (extend h F) = extend_set h (reachable F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reachable (extend h F) = extend_set h (reachable F)
[PROOF STEP]
apply (unfold extend_set_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reachable (extend h F) = h ` (reachable F \<times> UNIV)
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. reachable (extend h F) \<subseteq> h ` (reachable F \<times> UNIV)
 2. h ` (reachable F \<times> UNIV) \<subseteq> reachable (extend h F)
[PROOF STEP]
apply (force intro: h_f_g_eq [symmetric] dest!: reachable_extend_f, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x a b. \<lbrakk>a \<in> reachable F; b \<in> UNIV\<rbrakk> \<Longrightarrow> h (a, b) \<in> reachable (extend h F)
[PROOF STEP]
apply (erule reachable.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x a b s. \<lbrakk>b \<in> UNIV; s \<in> Init F\<rbrakk> \<Longrightarrow> h (s, b) \<in> reachable (extend h F)
 2. \<And>x a b act s s'. \<lbrakk>b \<in> UNIV; act \<in> Acts F; s \<in> reachable F; h (s, b) \<in> reachable (extend h F); (s, s') \<in> act\<rbrakk> \<Longrightarrow> h (s', b) \<in> reachable (extend h F)
[PROOF STEP]
apply (force intro: reachable.intros)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma periodic_set_cos_linear:
  assumes "a\<noteq>0" "c\<noteq>0"
  shows "periodic_set (roots (\<lambda>x. a*cos (x/c) + b)) (2*c*pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. periodic_set (roots (\<lambda>x. a * cos (x / c) + b)) (2 * c * pi)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. periodic_set (roots (\<lambda>x. a * cos (x / c) + b)) (2 * c * pi)
[PROOF STEP]
define B where "B = { c*arccos (- b / a), - c*arccos (- b / a)}"
[PROOF STATE]
proof (state)
this:
B = {c * arccos (- b / a), - c * arccos (- b / a)}

goal (1 subgoal):
 1. periodic_set (roots (\<lambda>x. a * cos (x / c) + b)) (2 * c * pi)
[PROOF STEP]
have "\<exists>b\<in>B. \<exists>k::int. x = b + k * (2*c*pi)"
    when "x\<in>roots (\<lambda>x. a * cos (x/c) + b)" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
define C1 where "C1 = (\<exists>k::int. x = c*arccos (- b / a) + k * (2*c*pi))"
[PROOF STATE]
proof (state)
this:
C1 = (\<exists>xa. x = c * arccos (- b / a) + real_of_int xa * (2 * c * pi))

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
define C2 where "C2 = (\<exists>k::int. x = - c*arccos (- b / a) + k * (2*c*pi))"
[PROOF STATE]
proof (state)
this:
C2 = (\<exists>xa. x = - c * arccos (- b / a) + real_of_int xa * (2 * c * pi))

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
have "cos (x/c) = - b/a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x / c) = - b / a
[PROOF STEP]
using that \<open>a\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> roots (\<lambda>x. a * cos (x / c) + b)
a \<noteq> 0

goal (1 subgoal):
 1. cos (x / c) = - b / a
[PROOF STEP]
unfolding roots_within_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {x \<in> UNIV. a * cos (x / c) + b = 0}
a \<noteq> 0

goal (1 subgoal):
 1. cos (x / c) = - b / a
[PROOF STEP]
by (auto simp add:field_simps)
[PROOF STATE]
proof (state)
this:
cos (x / c) = - b / a

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cos (x / c) = - b / a
[PROOF STEP]
have "C1 \<or> C2"
[PROOF STATE]
proof (prove)
using this:
cos (x / c) = - b / a

goal (1 subgoal):
 1. C1 \<or> C2
[PROOF STEP]
unfolding cos_eq_arccos_Ex ex_disj_distrib C1_def C2_def
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> - b / a \<and> - b / a \<le> 1 \<and> ((\<exists>xa. x / c = arccos (- b / a) + 2 * real_of_int xa * pi) \<or> (\<exists>xa. x / c = - arccos (- b / a) + 2 * real_of_int xa * pi))

goal (1 subgoal):
 1. (\<exists>xa. x = c * arccos (- b / a) + real_of_int xa * (2 * c * pi)) \<or> (\<exists>xa. x = - c * arccos (- b / a) + real_of_int xa * (2 * c * pi))
[PROOF STEP]
using \<open>c\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> - b / a \<and> - b / a \<le> 1 \<and> ((\<exists>xa. x / c = arccos (- b / a) + 2 * real_of_int xa * pi) \<or> (\<exists>xa. x / c = - arccos (- b / a) + 2 * real_of_int xa * pi))
c \<noteq> 0

goal (1 subgoal):
 1. (\<exists>xa. x = c * arccos (- b / a) + real_of_int xa * (2 * c * pi)) \<or> (\<exists>xa. x = - c * arccos (- b / a) + real_of_int xa * (2 * c * pi))
[PROOF STEP]
apply (auto simp add:divide_simps)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>c \<noteq> 0; if 0 < a then - 1 * a \<le> - b else if a < 0 then - b \<le> - 1 * a else - 1 \<le> 0; if 0 < a then - 1 * a \<le> b else if a < 0 then b \<le> - 1 * a else - 1 \<le> 0; \<forall>x. (arccos (- (b / a)) + 2 * real_of_int xa * pi) * c \<noteq> real_of_int x * (2 * c * pi) - c * arccos (- (b / a)); x = (arccos (- (b / a)) + 2 * real_of_int xa * pi) * c\<rbrakk> \<Longrightarrow> \<exists>x. (arccos (- (b / a)) + 2 * real_of_int xa * pi) * c = c * arccos (- (b / a)) + real_of_int x * (2 * c * pi)
 2. \<And>xa. \<lbrakk>c \<noteq> 0; if 0 < a then - 1 * a \<le> - b else if a < 0 then - b \<le> - 1 * a else - 1 \<le> 0; if 0 < a then - 1 * a \<le> b else if a < 0 then b \<le> - 1 * a else - 1 \<le> 0; \<forall>x. (2 * real_of_int xa * pi - arccos (- (b / a))) * c \<noteq> real_of_int x * (2 * c * pi) - c * arccos (- (b / a)); x = (2 * real_of_int xa * pi - arccos (- (b / a))) * c\<rbrakk> \<Longrightarrow> \<exists>x. (2 * real_of_int xa * pi - arccos (- (b / a))) * c = c * arccos (- (b / a)) + real_of_int x * (2 * c * pi)
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
C1 \<or> C2

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
C1 \<or> C2

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
have ?thesis when C1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
C1

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
unfolding C1_def B_def
[PROOF STATE]
proof (prove)
using this:
\<exists>xa. x = c * arccos (- b / a) + real_of_int xa * (2 * c * pi)

goal (1 subgoal):
 1. \<exists>b\<in>{c * arccos (- b / a), - c * arccos (- b / a)}. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
C1 \<Longrightarrow> \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
C1 \<Longrightarrow> \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
have ?thesis when C2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
C2

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
unfolding C2_def B_def
[PROOF STATE]
proof (prove)
using this:
\<exists>xa. x = - c * arccos (- b / a) + real_of_int xa * (2 * c * pi)

goal (1 subgoal):
 1. \<exists>b\<in>{c * arccos (- b / a), - c * arccos (- b / a)}. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
C2 \<Longrightarrow> \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
C1 \<or> C2
C1 \<Longrightarrow> \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
C2 \<Longrightarrow> \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
C1 \<or> C2
C1 \<Longrightarrow> \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
C2 \<Longrightarrow> \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> roots (\<lambda>x. a * cos (x / c) + b) \<Longrightarrow> \<exists>b\<in>B. \<exists>x. ?x = b + real_of_int x * (2 * c * pi)

goal (1 subgoal):
 1. periodic_set (roots (\<lambda>x. a * cos (x / c) + b)) (2 * c * pi)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?x \<in> roots (\<lambda>x. a * cos (x / c) + b) \<Longrightarrow> \<exists>b\<in>B. \<exists>x. ?x = b + real_of_int x * (2 * c * pi)

goal (1 subgoal):
 1. periodic_set (roots (\<lambda>x. a * cos (x / c) + b)) (2 * c * pi)
[PROOF STEP]
have "finite B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite B
[PROOF STEP]
unfolding B_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {c * arccos (- b / a), - c * arccos (- b / a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite B

goal (1 subgoal):
 1. periodic_set (roots (\<lambda>x. a * cos (x / c) + b)) (2 * c * pi)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?x \<in> roots (\<lambda>x. a * cos (x / c) + b) \<Longrightarrow> \<exists>b\<in>B. \<exists>x. ?x = b + real_of_int x * (2 * c * pi)
finite B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x \<in> roots (\<lambda>x. a * cos (x / c) + b) \<Longrightarrow> \<exists>b\<in>B. \<exists>x. ?x = b + real_of_int x * (2 * c * pi)
finite B

goal (1 subgoal):
 1. periodic_set (roots (\<lambda>x. a * cos (x / c) + b)) (2 * c * pi)
[PROOF STEP]
unfolding periodic_set_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> roots (\<lambda>x. a * cos (x / c) + b) \<Longrightarrow> \<exists>b\<in>B. \<exists>x. ?x = b + real_of_int x * (2 * c * pi)
finite B

goal (1 subgoal):
 1. \<exists>B. finite B \<and> (\<forall>x\<in>roots (\<lambda>x. a * cos (x / c) + b). \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (2 * c * pi))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
periodic_set (roots (\<lambda>x. a * cos (x / c) + b)) (2 * c * pi)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Corps) val_exp_ring:"\<lbrakk> valuation K v; x \<in> carrier K; x \<noteq> \<zero>\<rbrakk>
           \<Longrightarrow> (int n) *\<^sub>a (v x) = v (x^\<^bsup>K n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; x \<in> carrier K; x \<noteq> \<zero>\<rbrakk> \<Longrightarrow> int n *\<^sub>a v x = v (x^\<^bsup>K n\<^esup>)
[PROOF STEP]
apply (cut_tac field_is_ring,
       induct_tac n, simp add:Ring.ring_r_one, simp add:value_of_one)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>valuation K v; x \<in> carrier K; x \<noteq> \<zero>; Ring K; int n *\<^sub>a v x = v (x^\<^bsup>K n\<^esup>)\<rbrakk> \<Longrightarrow> int (Suc n) *\<^sub>a v x = v (x^\<^bsup>K Suc n\<^esup>)
[PROOF STEP]
apply (drule sym, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>valuation K v; x \<in> carrier K; x \<noteq> \<zero>; Ring K; v (x^\<^bsup>K n\<^esup>) = int n *\<^sub>a v x\<rbrakk> \<Longrightarrow> (1 + int n) *\<^sub>a v x = v (x^\<^bsup>K n\<^esup> \<cdot>\<^sub>r x)
[PROOF STEP]
apply (subst val_t2p[of v _ x], assumption+,
       rule Ring.npClose, assumption+,
       frule val_nonzero_z[of v x], assumption+,
              erule exE, simp add:asprod_mult a_zpz,
       simp add: distrib_right)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in group) int_pow_diff:
  "x \<in> carrier G \<Longrightarrow> x [^] (n - m :: int) = x [^] n \<otimes> inv (x [^] m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier G \<Longrightarrow> x [^] (n - m) = x [^] n \<otimes> inv (x [^] m)
[PROOF STEP]
by(simp only: diff_conv_add_uminus int_pow_mult int_pow_neg)


[STATEMENT]
lemma funcset_carrier:
  "\<lbrakk> f \<in> carrier X \<rightarrow> carrier Y; x \<in> carrier X \<rbrakk> \<Longrightarrow> f x \<in> carrier Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> carrier X \<rightarrow> carrier Y; x \<in> carrier X\<rbrakk> \<Longrightarrow> f x \<in> carrier Y
[PROOF STEP]
by (fact funcset_mem)


[STATEMENT]
lemma Arg2pi_unique: "\<lbrakk>of_real r * exp(\<i> * of_real a) = z; 0 < r; 0 \<le> a; a < 2*pi\<rbrakk> \<Longrightarrow> Arg2pi z = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>complex_of_real r * exp (\<i> * complex_of_real a) = z; 0 < r; 0 \<le> a; a < 2 * pi\<rbrakk> \<Longrightarrow> Arg2pi z = a
[PROOF STEP]
by (rule Arg2pi_unique_lemma [unfolded is_Arg_def, OF _ Arg2pi_eq]) (use Arg2pi [of z] in \<open>auto simp: norm_mult\<close>)


[STATEMENT]
lemma coplanar_5 :
  assumes "rk {A, B, C} = 3" and "rk {B, C, \<alpha>} = 2" and "rk {A, C, \<beta>} = 2"
  shows "rk {A, B, C, \<alpha>, \<beta>} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B, C, \<alpha>, \<beta>} = 3
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rk {A, B, C, \<alpha>, \<beta>} = 3
[PROOF STEP]
have f1:"rk {A, B, C, \<alpha>} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B, C, \<alpha>} = 3
[PROOF STEP]
using coplanar_4
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>rk {?A, ?B, ?C} = 3; rk {?B, ?C, ?\<alpha>} = 2\<rbrakk> \<Longrightarrow> rk {?A, ?B, ?C, ?\<alpha>} = 3

goal (1 subgoal):
 1. rk {A, B, C, \<alpha>} = 3
[PROOF STEP]
by (smt One_nat_def Un_assoc Un_commute add.commute add_Suc_right assms(1) assms(2) insert_is_Un
        le_antisym matroid_ax_2_alt numeral_2_eq_2 numeral_3_eq_3 one_add_one)
[PROOF STATE]
proof (state)
this:
rk {A, B, C, \<alpha>} = 3

goal (1 subgoal):
 1. rk {A, B, C, \<alpha>, \<beta>} = 3
[PROOF STEP]
have f2:"rk {A, B, C, \<beta>} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B, C, \<beta>} = 3
[PROOF STEP]
using coplanar_4_bis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>rk {?A, ?B, ?C} = 3; rk {?A, ?C, ?\<beta>} = 2\<rbrakk> \<Longrightarrow> rk {?A, ?B, ?C, ?\<beta>} = 3

goal (1 subgoal):
 1. rk {A, B, C, \<beta>} = 3
[PROOF STEP]
by (smt One_nat_def Un_assoc Un_commute add.commute add_Suc_right assms(1) assms(3) insert_is_Un
        le_antisym matroid_ax_2_alt numeral_2_eq_2 numeral_3_eq_3 one_add_one)
[PROOF STATE]
proof (state)
this:
rk {A, B, C, \<beta>} = 3

goal (1 subgoal):
 1. rk {A, B, C, \<alpha>, \<beta>} = 3
[PROOF STEP]
from f1 and f2
[PROOF STATE]
proof (chain)
picking this:
rk {A, B, C, \<alpha>} = 3
rk {A, B, C, \<beta>} = 3
[PROOF STEP]
show "rk {A, B, C, \<alpha>, \<beta>} = 3"
[PROOF STATE]
proof (prove)
using this:
rk {A, B, C, \<alpha>} = 3
rk {A, B, C, \<beta>} = 3

goal (1 subgoal):
 1. rk {A, B, C, \<alpha>, \<beta>} = 3
[PROOF STEP]
using matroid_ax_3_alt'
[PROOF STATE]
proof (prove)
using this:
rk {A, B, C, \<alpha>} = 3
rk {A, B, C, \<beta>} = 3
rk (?X \<union> {?y}) = rk (?X \<union> {?z}) \<longrightarrow> rk (?X \<union> {?z}) = rk ?X \<longrightarrow> rk ?X = rk (?X \<union> {?y, ?z})

goal (1 subgoal):
 1. rk {A, B, C, \<alpha>, \<beta>} = 3
[PROOF STEP]
by (metis Un_assoc assms(1) insert_is_Un)
[PROOF STATE]
proof (state)
this:
rk {A, B, C, \<alpha>, \<beta>} = 3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma four_block_mat_adjoint:
  fixes A B C D :: "'a::conjugatable_field mat"
  assumes dim: "A \<in> carrier_mat nr1 nc1" "B \<in> carrier_mat nr1 nc2"
  "C \<in> carrier_mat nr2 nc1" "D \<in> carrier_mat nr2 nc2"
  shows "adjoint (four_block_mat A B C D)
    = four_block_mat (adjoint A) (adjoint C) (adjoint B) (adjoint D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint (four_block_mat A B C D) = four_block_mat (adjoint A) (adjoint C) (adjoint B) (adjoint D)
[PROOF STEP]
by (rule eq_matI, insert dim, auto simp add: adjoint_eval)


[STATEMENT]
lemma add_smult_distrib_left_mat: assumes "A \<in> carrier_mat nr nc" "B \<in> carrier_mat nr nc"
  shows "k \<cdot>\<^sub>m (A + B) = (k :: 'a :: semiring) \<cdot>\<^sub>m A + k \<cdot>\<^sub>m B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<cdot>\<^sub>m (A + B) = k \<cdot>\<^sub>m A + k \<cdot>\<^sub>m B
[PROOF STEP]
by (rule eq_matI, insert assms, auto simp: field_simps)


[STATEMENT]
lemma le_sqrt_iff: "x \<ge> 0 \<Longrightarrow> x \<le> sqrt y \<longleftrightarrow> x^2 \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> (x \<le> sqrt y) = (x\<^sup>2 \<le> y)
[PROOF STEP]
using real_sqrt_le_iff[of "x^2" y]
[PROOF STATE]
proof (prove)
using this:
(sqrt (x\<^sup>2) \<le> sqrt y) = (x\<^sup>2 \<le> y)

goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> (x \<le> sqrt y) = (x\<^sup>2 \<le> y)
[PROOF STEP]
by (simp del: real_sqrt_le_iff)


[STATEMENT]
lemma invertibleD[simp]:
  assumes "invertible A"
  shows "A\<^sup>-\<^sup>1 ** A = mat 1" and "A ** A\<^sup>-\<^sup>1 = mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A\<^sup>-\<^sup>1 ** A = mat (1::'a) &&& A ** A\<^sup>-\<^sup>1 = mat (1::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
invertible A

goal (1 subgoal):
 1. A\<^sup>-\<^sup>1 ** A = mat (1::'a) &&& A ** A\<^sup>-\<^sup>1 = mat (1::'a)
[PROOF STEP]
unfolding matrix_inv_def invertible_def
[PROOF STATE]
proof (prove)
using this:
\<exists>A'. A ** A' = mat (1::'a) \<and> A' ** A = mat (1::'a)

goal (1 subgoal):
 1. (SOME A'. A ** A' = mat (1::'a) \<and> A' ** A = mat (1::'a)) ** A = mat (1::'a) &&& A ** (SOME A'. A ** A' = mat (1::'a) \<and> A' ** A = mat (1::'a)) = mat (1::'a)
[PROOF STEP]
by (simp_all add: verit_sko_ex')


[STATEMENT]
lemma hidden_sqrt_two_squared_cpx: "complex_of_real (sqrt 2) * (complex_of_real (sqrt 2) * x) / 4 = x/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (sqrt 2) * (complex_of_real (sqrt 2) * x) / 4 = x / 2
[PROOF STEP]
using sqrt_two_squared_cpx
[PROOF STATE]
proof (prove)
using this:
complex_of_real (sqrt 2) * complex_of_real (sqrt 2) = 2

goal (1 subgoal):
 1. complex_of_real (sqrt 2) * (complex_of_real (sqrt 2) * x) / 4 = x / 2
[PROOF STEP]
by (auto simp add: algebra_simps)


[STATEMENT]
lemma sparse_row_mult_spmat:
  "sorted_spmat A \<Longrightarrow> sorted_spvec B \<Longrightarrow>
   sparse_row_matrix (mult_spmat A B) = (sparse_row_matrix A) * (sparse_row_matrix B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted_spmat A; sorted_spvec B\<rbrakk> \<Longrightarrow> sparse_row_matrix (mult_spmat A B) = sparse_row_matrix A * sparse_row_matrix B
[PROOF STEP]
apply (induct A)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>sorted_spmat []; sorted_spvec B\<rbrakk> \<Longrightarrow> sparse_row_matrix (mult_spmat [] B) = sparse_row_matrix [] * sparse_row_matrix B
 2. \<And>a A. \<lbrakk>\<lbrakk>sorted_spmat A; sorted_spvec B\<rbrakk> \<Longrightarrow> sparse_row_matrix (mult_spmat A B) = sparse_row_matrix A * sparse_row_matrix B; sorted_spmat (a # A); sorted_spvec B\<rbrakk> \<Longrightarrow> sparse_row_matrix (mult_spmat (a # A) B) = sparse_row_matrix (a # A) * sparse_row_matrix B
[PROOF STEP]
apply (auto simp add: sparse_row_matrix_cons sparse_row_mult_spvec_spmat algebra_simps move_matrix_mult)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma [code_pred_inline]:
  "((A::bool) \<noteq> (B::bool)) = ((A \<and> \<not> B) \<or> (B \<and> \<not> A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<noteq> B) = (A \<and> \<not> B \<or> B \<and> \<not> A)
[PROOF STEP]
by fast


[STATEMENT]
lemma less_funI:
  assumes "\<exists>c>0. \<exists>n. \<forall>m>n. f m \<le> c * g m"
    and "\<And>c n. c > 0 \<Longrightarrow> \<exists>m>n. c * f m < g m"
  shows "f \<prec> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<prec> g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<exists>c>0. \<exists>n. \<forall>m>n. f m \<le> c * g m
0 < ?c \<Longrightarrow> \<exists>m>?n. ?c * f m < g m

goal (1 subgoal):
 1. f \<prec> g
[PROOF STEP]
unfolding less_fun_def less_eq_fun_def linorder_not_less [symmetric]
[PROOF STATE]
proof (prove)
using this:
\<exists>c>0. \<exists>n. \<forall>m>n. \<not> c * g m < f m
0 < ?c \<Longrightarrow> \<exists>m>?n. ?c * f m < g m

goal (1 subgoal):
 1. (\<exists>c>0. \<exists>n. \<forall>m>n. \<not> c * g m < f m) \<and> \<not> (\<exists>c>0. \<exists>n. \<forall>m>n. \<not> c * f m < g m)
[PROOF STEP]
by blast


[STATEMENT]
lemma sum_emeasure:
  "F`I \<subseteq> sets M \<Longrightarrow> disjoint_family_on F I \<Longrightarrow> finite I \<Longrightarrow>
    (\<Sum>i\<in>I. emeasure M (F i)) = emeasure M (\<Union>i\<in>I. F i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F ` I \<subseteq> sets M; disjoint_family_on F I; finite I\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>I. emeasure M (F i)) = emeasure M (\<Union> (F ` I))
[PROOF STEP]
by (metis sets.additive_sum emeasure_positive emeasure_additive)


[STATEMENT]
lemma csucc_lt_csucc_iff: "\<lbrakk>Card \<kappa>'; Card \<kappa>\<rbrakk> \<Longrightarrow> (csucc \<kappa>' < csucc \<kappa>) = (\<kappa>' < \<kappa>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Card \<kappa>'; Card \<kappa>\<rbrakk> \<Longrightarrow> (csucc \<kappa>' < csucc \<kappa>) = (\<kappa>' < \<kappa>)
[PROOF STEP]
by (metis Card_csucc Card_is_Ord Card_lt_csucc_iff Ord_not_less)


[STATEMENT]
lemma vector_derivative_chain_at_general:
  assumes "f differentiable at x" "g field_differentiable at (f x)"
  shows "vector_derivative (g \<circ> f) (at x) = vector_derivative f (at x) * deriv g (f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative (g \<circ> f) (at x) = vector_derivative f (at x) * deriv g (f x)
[PROOF STEP]
apply (rule vector_derivative_at [OF field_vector_diff_chain_at])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (f has_vector_derivative vector_derivative f (at x)) (at x)
 2. (g has_field_derivative deriv g (f x)) (at (f x))
[PROOF STEP]
using assms vector_derivative_works
[PROOF STATE]
proof (prove)
using this:
f differentiable at x
g field_differentiable at (f x)
(?f differentiable ?net) = (?f has_vector_derivative vector_derivative ?f ?net) ?net

goal (2 subgoals):
 1. (f has_vector_derivative vector_derivative f (at x)) (at x)
 2. (g has_field_derivative deriv g (f x)) (at (f x))
[PROOF STEP]
by (auto simp: field_differentiable_derivI)


[STATEMENT]
lemma vcard_sup: "vcard (x \<squnion> y) \<le> vcard x \<oplus> vcard y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard (x \<squnion> y) \<le> vcard x \<oplus> vcard y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vcard (x \<squnion> y) \<le> vcard x \<oplus> vcard y
[PROOF STEP]
have "elts (x \<squnion> y) \<lesssim> elts (x \<Uplus> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts (x \<squnion> y) \<lesssim> elts (x \<Uplus> y)
[PROOF STEP]
unfolding lepoll_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. inj_on f (elts (x \<squnion> y)) \<and> f ` elts (x \<squnion> y) \<subseteq> elts (x \<Uplus> y)
[PROOF STEP]
proof (intro exI conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on ?f (elts (x \<squnion> y))
 2. ?f ` elts (x \<squnion> y) \<subseteq> elts (x \<Uplus> y)
[PROOF STEP]
let ?f = "\<lambda>z. if z \<in> elts x then Inl z else Inr z"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on ?f (elts (x \<squnion> y))
 2. ?f ` elts (x \<squnion> y) \<subseteq> elts (x \<Uplus> y)
[PROOF STEP]
show "inj_on ?f (elts (x \<squnion> y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>z. if z \<in> elts x then ZFC_Cardinals.Inl z else ZFC_Cardinals.Inr z) (elts (x \<squnion> y))
[PROOF STEP]
by (simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>z. if z \<in> elts x then ZFC_Cardinals.Inl z else ZFC_Cardinals.Inr z) (elts (x \<squnion> y))

goal (1 subgoal):
 1. (\<lambda>z. if z \<in> elts x then ZFC_Cardinals.Inl z else ZFC_Cardinals.Inr z) ` elts (x \<squnion> y) \<subseteq> elts (x \<Uplus> y)
[PROOF STEP]
show "?f ` elts (x \<squnion> y) \<subseteq> elts (x \<Uplus> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>z. if z \<in> elts x then ZFC_Cardinals.Inl z else ZFC_Cardinals.Inr z) ` elts (x \<squnion> y) \<subseteq> elts (x \<Uplus> y)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<lambda>z. if z \<in> elts x then ZFC_Cardinals.Inl z else ZFC_Cardinals.Inr z) ` elts (x \<squnion> y) \<subseteq> elts (x \<Uplus> y)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
elts (x \<squnion> y) \<lesssim> elts (x \<Uplus> y)

goal (1 subgoal):
 1. vcard (x \<squnion> y) \<le> vcard x \<oplus> vcard y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
elts (x \<squnion> y) \<lesssim> elts (x \<Uplus> y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
elts (x \<squnion> y) \<lesssim> elts (x \<Uplus> y)

goal (1 subgoal):
 1. vcard (x \<squnion> y) \<le> vcard x \<oplus> vcard y
[PROOF STEP]
using cadd_ac
[PROOF STATE]
proof (prove)
using this:
elts (x \<squnion> y) \<lesssim> elts (x \<Uplus> y)
?i \<oplus> ?j \<oplus> ?k = ?i \<oplus> (?j \<oplus> ?k)
?i \<oplus> ?j = ?j \<oplus> ?i
?j \<oplus> (?i \<oplus> ?k) = ?i \<oplus> (?j \<oplus> ?k)

goal (1 subgoal):
 1. vcard (x \<squnion> y) \<le> vcard x \<oplus> vcard y
[PROOF STEP]
by (metis cadd_def cardinal_cong cardinal_idem lepoll_imp_Card_le vsum_0_eqpoll)
[PROOF STATE]
proof (state)
this:
vcard (x \<squnion> y) \<le> vcard x \<oplus> vcard y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIMSEQ_incseq_SUP:
  fixes X :: "nat \<Rightarrow> 'a::{conditionally_complete_linorder,linorder_topology}"
  assumes u: "bdd_above (range X)"
    and X: "incseq X"
  shows "X \<longlonglongrightarrow> (SUP i. X i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<longlonglongrightarrow> Sup (range X)
[PROOF STEP]
by (rule order_tendstoI)
    (auto simp: eventually_sequentially u less_cSUP_iff
      intro: X[THEN incseqD] less_le_trans cSUP_lessD[OF u])


[STATEMENT]
lemma mat_row_last_dim[simp]:
  "dim_row (mat_row_last A n) = n"
  "dim_col (mat_row_last A n) = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat_row_last A n) = n &&& dim_col (mat_row_last A n) = dim_col A
[PROOF STEP]
unfolding mat_row_last_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat n (dim_col A) (\<lambda>(i, j). A $$ (dim_row A - n + i, j))) = n &&& dim_col (mat n (dim_col A) (\<lambda>(i, j). A $$ (dim_row A - n + i, j))) = dim_col A
[PROOF STEP]
by simp_all


[STATEMENT]
lemma hcomplexpow_i_squared [simp]: "iii\<^sup>2 = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. iii\<^sup>2 = - 1
[PROOF STEP]
by transfer (rule power2_i)


[STATEMENT]
lemma continuous_closed_preimage_constant:
  fixes f :: "_ \<Rightarrow> 'b::t1_space"
  shows "continuous_on S f \<Longrightarrow> closed S \<Longrightarrow> closed {x \<in> S. f x = a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on S f; closed S\<rbrakk> \<Longrightarrow> closed {x \<in> S. f x = a}
[PROOF STEP]
using continuous_closed_preimage[of S f "{a}"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on S f; closed S; closed {a}\<rbrakk> \<Longrightarrow> closed (S \<inter> f -` {a})

goal (1 subgoal):
 1. \<lbrakk>continuous_on S f; closed S\<rbrakk> \<Longrightarrow> closed {x \<in> S. f x = a}
[PROOF STEP]
by (simp add: vimage_def Collect_conj_eq)


[STATEMENT]
lemma (in domain) irreducible_mult_imp_irreducible:
  "\<lbrakk> a \<in> carrier R - { \<zero> }; irreducible (mult_of R) a \<rbrakk> \<Longrightarrow> irreducible R a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R - {\<zero>}; irreducible (Ring_Divisibility.mult_of R) a\<rbrakk> \<Longrightarrow> irreducible R a
[PROOF STEP]
unfolding irreducible_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R - {\<zero>}; a \<notin> Units (Ring_Divisibility.mult_of R) \<and> (\<forall>b\<in>carrier (Ring_Divisibility.mult_of R). properfactor (Ring_Divisibility.mult_of R) b a \<longrightarrow> b \<in> Units (Ring_Divisibility.mult_of R))\<rbrakk> \<Longrightarrow> a \<notin> Units R \<and> (\<forall>b\<in>carrier R. properfactor R b a \<longrightarrow> b \<in> Units R)
[PROOF STEP]
using properfactor_imp_properfactor_mult properfactor_divides
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> carrier R - {\<zero>}; ?b \<in> carrier R; properfactor R ?b ?a\<rbrakk> \<Longrightarrow> properfactor (Ring_Divisibility.mult_of R) ?b ?a
properfactor R ?a ?b \<Longrightarrow> ?a divides ?b

goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R - {\<zero>}; a \<notin> Units (Ring_Divisibility.mult_of R) \<and> (\<forall>b\<in>carrier (Ring_Divisibility.mult_of R). properfactor (Ring_Divisibility.mult_of R) b a \<longrightarrow> b \<in> Units (Ring_Divisibility.mult_of R))\<rbrakk> \<Longrightarrow> a \<notin> Units R \<and> (\<forall>b\<in>carrier R. properfactor R b a \<longrightarrow> b \<in> Units R)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma Times_mset_empty[simp]: "A \<times># B = {#} \<longleftrightarrow> A = {#} \<or> B = {#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<times># B = {#}) = (A = {#} \<or> B = {#})
[PROOF STEP]
by (auto simp: Sigma_mset_empty_iff)


[STATEMENT]
lemma fps_conv_radius_sin [simp]:
  fixes c :: "'a :: {banach, real_normed_field, field_char_0}"
  shows "fps_conv_radius (fps_sin c) = \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_conv_radius (fps_sin c) = \<infinity>
[PROOF STEP]
proof (cases "c = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
 2. c \<noteq> (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'a)

goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
 2. c \<noteq> (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
[PROOF STEP]
have "\<infinity> = conv_radius (\<lambda>n. of_real (sin_coeff n) :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<infinity> = conv_radius (\<lambda>n. of_real (sin_coeff n))
[PROOF STEP]
proof (rule sym, rule conv_radius_inftyI'', rule summable_norm_cancel, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>z. summable (\<lambda>n. norm (of_real (sin_coeff n) * z ^ n))
[PROOF STEP]
case (1 z)
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>z. summable (\<lambda>n. norm (of_real (sin_coeff n) * z ^ n))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. norm (of_real (sin_coeff n) * z ^ n))
[PROOF STEP]
using summable_norm_sin[of z]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. norm (sin_coeff n *\<^sub>R z ^ n))

goal (1 subgoal):
 1. summable (\<lambda>n. norm (of_real (sin_coeff n) * z ^ n))
[PROOF STEP]
by (simp add: norm_mult)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. norm (of_real (sin_coeff n) * z ^ n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<infinity> = conv_radius (\<lambda>n. of_real (sin_coeff n))

goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
 2. c \<noteq> (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<infinity> = conv_radius (\<lambda>n. of_real (sin_coeff n))

goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
 2. c \<noteq> (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
[PROOF STEP]
have "\<dots> / norm c = conv_radius (\<lambda>n. c ^ n * of_real (sin_coeff n) :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conv_radius (\<lambda>n. of_real (sin_coeff n)) / ereal (norm c) = conv_radius (\<lambda>n. c ^ n * of_real (sin_coeff n))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. conv_radius (\<lambda>n. of_real (sin_coeff n)) / ereal (norm c) = conv_radius (\<lambda>n. c ^ n * of_real (sin_coeff n))
[PROOF STEP]
by (subst conv_radius_mult_power) auto
[PROOF STATE]
proof (state)
this:
conv_radius (\<lambda>n. of_real (sin_coeff n)) / ereal (norm c) = conv_radius (\<lambda>n. c ^ n * of_real (sin_coeff n))

goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
 2. c \<noteq> (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
conv_radius (\<lambda>n. of_real (sin_coeff n)) / ereal (norm c) = conv_radius (\<lambda>n. c ^ n * of_real (sin_coeff n))

goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
 2. c \<noteq> (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
[PROOF STEP]
have "\<dots> = fps_conv_radius (fps_sin c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conv_radius (\<lambda>n. c ^ n * of_real (sin_coeff n)) = fps_conv_radius (fps_sin c)
[PROOF STEP]
unfolding fps_conv_radius_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conv_radius (\<lambda>n. c ^ n * of_real (sin_coeff n)) = conv_radius (fps_nth (fps_sin c))
[PROOF STEP]
by (rule conv_radius_cong_weak) (auto simp add: fps_sin_def sin_coeff_def)
[PROOF STATE]
proof (state)
this:
conv_radius (\<lambda>n. c ^ n * of_real (sin_coeff n)) = fps_conv_radius (fps_sin c)

goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
 2. c \<noteq> (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<infinity> / ereal (norm c) = fps_conv_radius (fps_sin c)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<infinity> / ereal (norm c) = fps_conv_radius (fps_sin c)

goal (1 subgoal):
 1. fps_conv_radius (fps_sin c) = \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_conv_radius (fps_sin c) = \<infinity>

goal (1 subgoal):
 1. c = (0::'a) \<Longrightarrow> fps_conv_radius (fps_sin c) = \<infinity>
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma numeral_eq_of_nat: "(numeral a::ennreal) = of_nat (numeral a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. numeral a = of_nat (numeral a)
[PROOF STEP]
by simp


[STATEMENT]
lemma fst_closed_segment[simp]: "fst ` closed_segment a b = closed_segment (fst a) (fst b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst ` closed_segment a b = closed_segment (fst a) (fst b)
[PROOF STEP]
by (force simp: closed_segment_def)


[STATEMENT]
lemma fetch_bef_erase_a_b[simp]:
  "\<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk>
   \<Longrightarrow>  (fetch (mopup_a n @ shift mopup_b (2 * n)) s Bk) = (R, s + 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> \<Longrightarrow> fetch (mopup_a n @ shift mopup_b (2 * n)) s Bk = (R, s + 2)
[PROOF STEP]
apply(subgoal_tac "\<exists> q. s = 2*q + 1", auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>q. \<lbrakk>Suc (2 * q) \<le> 2 * n; s = Suc (2 * q)\<rbrakk> \<Longrightarrow> (mopup_a n @ shift mopup_b (2 * n)) ! (4 * q) = (R, Suc (Suc (Suc (2 * q))))
 2. \<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> \<Longrightarrow> \<exists>q. s = Suc (2 * q)
[PROOF STEP]
apply(subgoal_tac "length (mopup_a n) = 4*n")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>q. \<lbrakk>Suc (2 * q) \<le> 2 * n; s = Suc (2 * q); length (mopup_a n) = 4 * n\<rbrakk> \<Longrightarrow> (mopup_a n @ shift mopup_b (2 * n)) ! (4 * q) = (R, Suc (Suc (Suc (2 * q))))
 2. \<And>q. \<lbrakk>Suc (2 * q) \<le> 2 * n; s = Suc (2 * q)\<rbrakk> \<Longrightarrow> length (mopup_a n) = 4 * n
 3. \<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> \<Longrightarrow> \<exists>q. s = Suc (2 * q)
[PROOF STEP]
apply(auto simp: nth_append)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>q. \<lbrakk>Suc (2 * q) \<le> 2 * n; s = Suc (2 * q)\<rbrakk> \<Longrightarrow> mopup_a n ! (4 * q) = (R, Suc (Suc (Suc (2 * q))))
 2. \<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> \<Longrightarrow> \<exists>q. s = Suc (2 * q)
[PROOF STEP]
apply(subgoal_tac "mopup_a n ! (4 * q + 0) =
                       mopup_a (Suc q) ! ((4 * q + 0))",
      simp add: nth_append)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>q. \<lbrakk>Suc (2 * q) \<le> 2 * n; s = Suc (2 * q)\<rbrakk> \<Longrightarrow> mopup_a n ! (4 * q + 0) = mopup_a (Suc q) ! (4 * q + 0)
 2. \<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> \<Longrightarrow> \<exists>q. s = Suc (2 * q)
[PROOF STEP]
apply(rule mopup_a_nth, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < s; s \<le> 2 * n; s mod 2 = Suc 0\<rbrakk> \<Longrightarrow> \<exists>q. s = Suc (2 * q)
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma tensor_of_H_values [simp]:
  fixes n i j:: nat
  assumes "i < dim_row (H^\<^sub>\<otimes> n)" and "j < dim_col (H^\<^sub>\<otimes> n)"
  shows "(H^\<^sub>\<otimes> n) $$ (i,j) = (-1)^(i \<cdot>\<^bsub>n\<^esub> j)/(sqrt 2)^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i, j) = complex_of_real ((- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))
j < dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))

goal (1 subgoal):
 1. Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i, j) = complex_of_real ((- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)
[PROOF STEP]
by simp


[STATEMENT]
lemma mod_2_Suc_iff:
  "x mod 2 = Suc 0 \<longleftrightarrow> x = Suc (2 * (x div 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x mod 2 = Suc 0) = (x = Suc (2 * (x div 2)))
[PROOF STEP]
by presburger+