[STATEMENT]
lemma (in cpx_sq_mat)  trace_sum_mat:
  fixes A::"'b \<Rightarrow> complex Matrix.mat"
  shows "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> (A i)\<in> fc_mats) \<Longrightarrow>
  Complex_Matrix.trace (sum_mat A I) = (\<Sum> i\<in> I. Complex_Matrix.trace (A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<And>i. i \<in> I \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (local.sum_mat A I) = (\<Sum>i\<in>I. Complex_Matrix.trace (A i))
[PROOF STEP]
unfolding sum_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<And>i. i \<in> I \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A I) = (\<Sum>i\<in>I. Complex_Matrix.trace (A i))
[PROOF STEP]
proof (induct rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A {}) = (\<Sum>i\<in>{}. Complex_Matrix.trace (A i))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
?i1 \<in> {} \<Longrightarrow> A ?i1 \<in> fc_mats

goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A {}) = (\<Sum>i\<in>{}. Complex_Matrix.trace (A i))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i1 \<in> {} \<Longrightarrow> A ?i1 \<in> fc_mats
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> {} \<Longrightarrow> A ?i1 \<in> fc_mats

goal (1 subgoal):
 1. Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A {}) = (\<Sum>i\<in>{}. Complex_Matrix.trace (A i))
[PROOF STEP]
using trace_zero dim_eq
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> {} \<Longrightarrow> A ?i1 \<in> fc_mats
Complex_Matrix.trace (0\<^sub>m ?n ?n) = (0::?'a)
dimR = dimC

goal (1 subgoal):
 1. Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A {}) = (\<Sum>i\<in>{}. Complex_Matrix.trace (A i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A {}) = (\<Sum>i\<in>{}. Complex_Matrix.trace (A i))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
(\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i))
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
have "Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) =
    Complex_Matrix.trace (A x + sum_with (+) (0\<^sub>m dimR dimC) A F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = Complex_Matrix.trace (A x + sum_with (+) (0\<^sub>m dimR dimC) A F)
[PROOF STEP]
using sum_with_insert[of A x F] insert
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A x \<in> fc_mats; A ` F \<subseteq> fc_mats; finite F; x \<notin> F\<rbrakk> \<Longrightarrow> sum_with (+) (0\<^sub>m dimR dimC) A (insert x F) = A x + sum_with (+) (0\<^sub>m dimR dimC) A F
finite F
x \<notin> F
(\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i))
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats

goal (1 subgoal):
 1. Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = Complex_Matrix.trace (A x + sum_with (+) (0\<^sub>m dimR dimC) A F)
[PROOF STEP]
by (simp add: image_subset_iff dim_eq)
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = Complex_Matrix.trace (A x + sum_with (+) (0\<^sub>m dimR dimC) A F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = Complex_Matrix.trace (A x + sum_with (+) (0\<^sub>m dimR dimC) A F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
have "... = Complex_Matrix.trace (A x) +
    Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (A x + sum_with (+) (0\<^sub>m dimR dimC) A F) = Complex_Matrix.trace (A x) + Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F)
[PROOF STEP]
using trace_add square_mats insert
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>square_mat ?A; square_mat ?B; dim_row ?A = dim_row ?B\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (?A + ?B) = Complex_Matrix.trace ?A + Complex_Matrix.trace ?B
?A \<in> fc_mats \<Longrightarrow> square_mat ?A
finite F
x \<notin> F
(\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i))
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats

goal (1 subgoal):
 1. Complex_Matrix.trace (A x + sum_with (+) (0\<^sub>m dimR dimC) A F) = Complex_Matrix.trace (A x) + Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F)
[PROOF STEP]
by (metis carrier_matD(1) fc_mats_carrier image_subset_iff insert_iff sum_with_mem)
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (A x + sum_with (+) (0\<^sub>m dimR dimC) A F) = Complex_Matrix.trace (A x) + Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (A x + sum_with (+) (0\<^sub>m dimR dimC) A F) = Complex_Matrix.trace (A x) + Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
have "... = Complex_Matrix.trace (A x) + (\<Sum> i\<in> F. Complex_Matrix.trace (A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (A x) + Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = Complex_Matrix.trace (A x) + (\<Sum>i\<in>F. Complex_Matrix.trace (A i))
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
(\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i))
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats

goal (1 subgoal):
 1. Complex_Matrix.trace (A x) + Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = Complex_Matrix.trace (A x) + (\<Sum>i\<in>F. Complex_Matrix.trace (A i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (A x) + Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = Complex_Matrix.trace (A x) + (\<Sum>i\<in>F. Complex_Matrix.trace (A i))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (A x) + Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = Complex_Matrix.trace (A x) + (\<Sum>i\<in>F. Complex_Matrix.trace (A i))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
have "... = (\<Sum> i\<in> (insert x F). Complex_Matrix.trace (A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (A x) + (\<Sum>i\<in>F. Complex_Matrix.trace (A i)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
using sum_with_insert[of A x F] insert
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A x \<in> fc_mats; A ` F \<subseteq> fc_mats; finite F; x \<notin> F\<rbrakk> \<Longrightarrow> sum_with (+) (0\<^sub>m dimR dimC) A (insert x F) = A x + sum_with (+) (0\<^sub>m dimR dimC) A F
finite F
x \<notin> F
(\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i))
?i1 \<in> insert x F \<Longrightarrow> A ?i1 \<in> fc_mats

goal (1 subgoal):
 1. Complex_Matrix.trace (A x) + (\<Sum>i\<in>F. Complex_Matrix.trace (A i)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
by (simp add: image_subset_iff)
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (A x) + (\<Sum>i\<in>F. Complex_Matrix.trace (A i)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A F) = (\<Sum>i\<in>F. Complex_Matrix.trace (A i)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> fc_mats\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))

goal (1 subgoal):
 1. Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (sum_with (+) (0\<^sub>m dimR dimC) A (insert x F)) = (\<Sum>i\<in>insert x F. Complex_Matrix.trace (A i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_of_vec_0[simp]: "poly_of_vec (0\<^sub>v n) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_of_vec (0\<^sub>v n) = 0
[PROOF STEP]
unfolding poly_of_vec_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<dim_vec (0\<^sub>v n). monom (0\<^sub>v n $ (dim_vec (0\<^sub>v n) - Suc i)) i) = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma \<Delta>\<Phi>_pass1: assumes "hs \<noteq> []" "no_Emptys hs"
  shows "\<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (size_hps hs) - length hs + 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
have "sum_ub hs \<le> 2 * log 2 (size_hps hs) - length hs + 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_ub hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hs \<noteq> []
no_Emptys hs

goal (1 subgoal):
 1. sum_ub hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
by (induct hs rule: sum_ub.induct) (auto dest: no_Empty_ge0)
[PROOF STATE]
proof (state)
this:
sum_ub hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2

goal (1 subgoal):
 1. \<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_ub hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2

goal (1 subgoal):
 1. \<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
using \<Delta>\<Phi>_pass1_sum_ub[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
sum_ub hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
\<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> sum_ub hs

goal (1 subgoal):
 1. \<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma swap_sandwich: "swap = sandwich Uswap"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swap = Misc.sandwich Uswap
[PROOF STEP]
apply (rule tensor_extensionality)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. clinear swap
 2. clinear (Misc.sandwich Uswap)
 3. \<And>a b. swap (a \<otimes>\<^sub>o b) = Misc.sandwich Uswap (a \<otimes>\<^sub>o b)
[PROOF STEP]
apply (auto simp: sandwich_def)[2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. swap (a \<otimes>\<^sub>o b) = Misc.sandwich Uswap (a \<otimes>\<^sub>o b)
[PROOF STEP]
apply (rule tensor_ell2_extensionality)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b s t. swap (a \<otimes>\<^sub>o b) *\<^sub>V s \<otimes>\<^sub>s t = Misc.sandwich Uswap (a \<otimes>\<^sub>o b) *\<^sub>V s \<otimes>\<^sub>s t
[PROOF STEP]
by (simp add: sandwich_def cblinfun_apply_cblinfun_compose tensor_op_ell2)


[STATEMENT]
lemma (in Ring) ring_distrib1:"\<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R \<rbrakk>
                 \<Longrightarrow> x \<cdot>\<^sub>r (y \<plusminus> z) = x \<cdot>\<^sub>r y \<plusminus> x \<cdot>\<^sub>r z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r (y \<plusminus> z) = x \<cdot>\<^sub>r y \<plusminus> x \<cdot>\<^sub>r z
[PROOF STEP]
by (simp add:rg_distrib)


[STATEMENT]
lemma admits_diagonal_reduction_imp_exists_algorithm_is_SNF_all:
  assumes "(\<forall>(A::'a::comm_ring_1 mat) \<in> carrier_mat m n. admits_diagonal_reduction A)"
  shows" (\<exists>algorithm. \<forall>(A::'a mat) \<in> carrier_mat m n. is_SNF A (algorithm A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>algorithm. \<forall>A\<in>carrier_mat m n. is_SNF A (algorithm A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>algorithm. \<forall>A\<in>carrier_mat m n. is_SNF A (algorithm A)
[PROOF STEP]
let ?algorithm = "\<lambda>A. SOME (P, S, Q). is_SNF A (P,S,Q)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>algorithm. \<forall>A\<in>carrier_mat m n. is_SNF A (algorithm A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>algorithm. \<forall>A\<in>carrier_mat m n. is_SNF A (algorithm A)
[PROOF STEP]
by (rule exI[of _ ?algorithm]) (metis (no_types, lifting)
        admits_diagonal_reduction_imp_exists_algorithm_is_SNF assms case_prod_beta prod.collapse someI)
[PROOF STATE]
proof (state)
this:
\<exists>algorithm. \<forall>A\<in>carrier_mat m n. is_SNF A (algorithm A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma l8_14_2_2:
  assumes "A B Perp C D" and
    "\<forall> Y. (Col Y A B \<and> Col Y C D) \<longrightarrow> X = Y"
  shows "X PerpAt A B C D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X PerpAt A B C D
[PROOF STEP]
by (metis Tarski_neutral_dimensionless.PerpAt_def Tarski_neutral_dimensionless.Perp_def Tarski_neutral_dimensionless_axioms assms(1) assms(2))


[STATEMENT]
lemma closed_halfspace_le: "closed {x. inner a x \<le> b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x. a \<bullet> x \<le> b}
[PROOF STEP]
by (simp add: closed_Collect_le continuous_on_inner)


[STATEMENT]
lemma sets_embed_eq_vimage_algebra:
  assumes "inj_on f (space M)"
  shows "sets (embed_measure M f) = sets (vimage_algebra (f`space M) (the_inv_into (space M) f) M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (embed_measure M f) = sets (vimage_algebra (f ` space M) (the_inv_into (space M) f) M)
[PROOF STEP]
by (auto simp: sets_embed_measure'[OF assms] Pi_iff the_inv_into_f_f assms sets_vimage_algebra2 Setcompr_eq_image
           dest: sets.sets_into_space
           intro!: image_cong the_inv_into_vimage[symmetric])


[STATEMENT]
lemma lessThan_induct:
     "[| !!m::nat. F \<in> (A \<inter> f-`{m}) leadsTo ((A \<inter> f-`{..<m}) \<union> B) |]
      ==> F \<in> A leadsTo B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>m. F \<in> A \<inter> f -` {m} \<longmapsto> A \<inter> f -` {..<m} \<union> B) \<Longrightarrow> F \<in> A \<longmapsto> B
[PROOF STEP]
apply (rule wf_less_than [THEN leadsTo_wf_induct])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>m. F \<in> A \<inter> f -` {m} \<longmapsto> A \<inter> f -` {..<m} \<union> B) \<Longrightarrow> \<forall>m. F \<in> A \<inter> ?f -` {m} \<longmapsto> A \<inter> ?f -` less_than\<inverse> `` {m} \<union> B
[PROOF STEP]
apply (simp (no_asm_simp))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>m. F \<in> A \<inter> f -` {m} \<longmapsto> A \<inter> f -` {..<m} \<union> B) \<Longrightarrow> \<forall>m. F \<in> A \<inter> ?f -` {m} \<longmapsto> A \<inter> ?f -` {..<m} \<union> B
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in landau_symbol) ev_eq_trans2:
  "eventually (\<lambda>x. f x = f' x) F \<Longrightarrow> (\<lambda>x. g x (f' x)) \<in> L F (h) \<Longrightarrow> (\<lambda>x. g x (f x)) \<in> L F (h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>\<^sub>F x in F. f x = f' x; (\<lambda>x. g x (f' x)) \<in> L F h\<rbrakk> \<Longrightarrow> (\<lambda>x. g x (f x)) \<in> L F h
[PROOF STEP]
by (rule bigtheta_trans2[OF bigthetaI_cong]) (auto elim!: eventually_mono)


[STATEMENT]
lemma lemma_seq_point_gt_ex:
  "\<lbrakk> (\<lambda>n. of_rat (r n)) \<longlonglongrightarrow> (x::real); y < x \<rbrakk>
   \<Longrightarrow> \<exists>(m::nat).  y < of_rat(r m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>n. real_of_rat (r n)) \<longlonglongrightarrow> x; y < x\<rbrakk> \<Longrightarrow> \<exists>m. y < real_of_rat (r m)
[PROOF STEP]
by (metis convergent_def limI lim_le not_less)


[STATEMENT]
lemma pi_approx_128:
  "abs (pi - 1069028584064966747859680373161870783301 / 2^128) \<le> inverse (2^128)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>pi - 1069028584064966747859680373161870783301 / 2 ^ 128\<bar> \<le> inverse (2 ^ 128)
[PROOF STEP]
by (rule approx_coarsen[OF pi_approx_54_decimals]) simp


[STATEMENT]
lemma HFinite_FreeUltrafilterNat_iff:
  "star_n X \<in> HFinite \<longleftrightarrow> (\<exists>u. eventually (\<lambda>n. norm (X n) < u) \<U>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (star_n X \<in> HFinite) = (\<exists>u. \<forall>\<^sub>F n in \<U>. norm (X n) < u)
[PROOF STEP]
using FreeUltrafilterNat_HFinite HFinite_FreeUltrafilterNat
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in \<U>. norm (?X n) < ?u \<Longrightarrow> star_n ?X \<in> HFinite
star_n ?X \<in> HFinite \<Longrightarrow> \<exists>u. \<forall>\<^sub>F n in \<U>. norm (?X n) < u

goal (1 subgoal):
 1. (star_n X \<in> HFinite) = (\<exists>u. \<forall>\<^sub>F n in \<U>. norm (X n) < u)
[PROOF STEP]
by blast


[STATEMENT]
lemma qbs_closed3_dest[simp]:
  fixes P::"real \<Rightarrow> nat" and Fi :: "nat \<Rightarrow> real \<Rightarrow> _"
  assumes "\<And>i. P -` {i} \<in> sets real_borel"
      and "\<And>i. Fi i \<in> qbs_Mx X"
    shows "(\<lambda>r. Fi (P r) r) \<in> qbs_Mx X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>r. Fi (P r) r) \<in> qbs_Mx X
[PROOF STEP]
using assms qbs_decomp[of X]
[PROOF STATE]
proof (prove)
using this:
P -` {?i} \<in> sets real_borel
Fi ?i \<in> qbs_Mx X
(qbs_space X, qbs_Mx X) \<in> {(X, Mx). is_quasi_borel X Mx}

goal (1 subgoal):
 1. (\<lambda>r. Fi (P r) r) \<in> qbs_Mx X
[PROOF STEP]
by (auto simp add: is_quasi_borel_def qbs_closed3_def)


[STATEMENT]
lemma bij_betw_prime_powers:
  "bij_betw (\<lambda>g. \<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ g p) ({p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV)
     {m. 0 < m \<and> prime_factors m \<subseteq> {..(n::nat)}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (\<lambda>g. \<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ g p) ({p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV) {m. 0 < m \<and> prime_factors m \<subseteq> {..n}}
[PROOF STEP]
proof (rule bij_betwI[of _ _ _ "(\<lambda>m p. if p \<le> n \<and> prime p then multiplicity p m else undefined)"],
         goal_cases)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (\<lambda>g. \<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ g p) \<in> ({p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV) \<rightarrow> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}}
 2. (\<lambda>m p. if p \<le> n \<and> prime p then multiplicity p m else undefined) \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<rightarrow> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV
 3. \<And>x. x \<in> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV \<Longrightarrow> (\<lambda>p. if p \<le> n \<and> prime p then multiplicity p (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ x p) else undefined) = x
 4. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (4 subgoals):
 1. (\<lambda>g. \<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ g p) \<in> ({p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV) \<rightarrow> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}}
 2. (\<lambda>m p. if p \<le> n \<and> prime p then multiplicity p m else undefined) \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<rightarrow> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV
 3. \<And>x. x \<in> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV \<Longrightarrow> (\<lambda>p. if p \<le> n \<and> prime p then multiplicity p (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ x p) else undefined) = x
 4. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>g. \<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ g p) \<in> ({p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV) \<rightarrow> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}}
[PROOF STEP]
by (rule prime_power_product_in_Pi)
[PROOF STATE]
proof (state)
this:
(\<lambda>g. \<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ g p) \<in> ({p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV) \<rightarrow> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}}

goal (3 subgoals):
 1. (\<lambda>m p. if p \<le> n \<and> prime p then multiplicity p m else undefined) \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<rightarrow> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV
 2. \<And>x. x \<in> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV \<Longrightarrow> (\<lambda>p. if p \<le> n \<and> prime p then multiplicity p (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ x p) else undefined) = x
 3. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<lambda>m p. if p \<le> n \<and> prime p then multiplicity p m else undefined) \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<rightarrow> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV
 2. \<And>x. x \<in> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV \<Longrightarrow> (\<lambda>p. if p \<le> n \<and> prime p then multiplicity p (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ x p) else undefined) = x
 3. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:

goal (3 subgoals):
 1. (\<lambda>m p. if p \<le> n \<and> prime p then multiplicity p m else undefined) \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<rightarrow> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV
 2. \<And>x. x \<in> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV \<Longrightarrow> (\<lambda>p. if p \<le> n \<and> prime p then multiplicity p (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ x p) else undefined) = x
 3. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m p. if p \<le> n \<and> prime p then multiplicity p m else undefined) \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<rightarrow> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV
[PROOF STEP]
by (auto split: if_splits)
[PROOF STATE]
proof (state)
this:
(\<lambda>m p. if p \<le> n \<and> prime p then multiplicity p m else undefined) \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<rightarrow> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV

goal (2 subgoals):
 1. \<And>x. x \<in> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV \<Longrightarrow> (\<lambda>p. if p \<le> n \<and> prime p then multiplicity p (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ x p) else undefined) = x
 2. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV \<Longrightarrow> (\<lambda>p. if p \<le> n \<and> prime p then multiplicity p (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ x p) else undefined) = x
 2. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
case (3 f)
[PROOF STATE]
proof (state)
this:
f \<in> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV

goal (2 subgoals):
 1. \<And>x. x \<in> {p. p \<le> n \<and> prime p} \<rightarrow>\<^sub>E UNIV \<Longrightarrow> (\<lambda>p. if p \<le> n \<and> prime p then multiplicity p (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ x p) else undefined) = x
 2. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. if p \<le> n \<and> prime p then multiplicity p (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f
[PROOF STEP]
proof (rule ext, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. (if p \<le> n \<and> prime p then multiplicity p (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f p
[PROOF STEP]
case (1 q)
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>p. (if p \<le> n \<and> prime p then multiplicity p (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f p
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
[PROOF STEP]
proof (cases "q \<le> n \<and> prime q")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. q \<le> n \<and> prime q \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
 2. \<not> (q \<le> n \<and> prime q) \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
q \<le> n \<and> prime q

goal (2 subgoals):
 1. q \<le> n \<and> prime q \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
 2. \<not> (q \<le> n \<and> prime q) \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
[PROOF STEP]
hence "multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) =
               (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. multiplicity q (x ^ f x))"
[PROOF STATE]
proof (prove)
using this:
q \<le> n \<and> prime q

goal (1 subgoal):
 1. multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) = (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. multiplicity q (x ^ f x))
[PROOF STEP]
by (subst prime_elem_multiplicity_prod_distrib) auto
[PROOF STATE]
proof (state)
this:
multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) = (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. multiplicity q (x ^ f x))

goal (2 subgoals):
 1. q \<le> n \<and> prime q \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
 2. \<not> (q \<le> n \<and> prime q) \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) = (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. multiplicity q (x ^ f x))

goal (2 subgoals):
 1. q \<le> n \<and> prime q \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
 2. \<not> (q \<le> n \<and> prime q) \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. if x = q then f q else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. multiplicity q (x ^ f x)) = (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. if x = q then f q else 0)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
q \<le> n \<and> prime q

goal (1 subgoal):
 1. (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. multiplicity q (x ^ f x)) = (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. if x = q then f q else 0)
[PROOF STEP]
by (intro sum.cong refl) (auto simp: multiplicity_distinct_prime_power)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{p. p \<le> n \<and> prime p}. multiplicity q (x ^ f x)) = (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. if x = q then f q else 0)

goal (2 subgoals):
 1. q \<le> n \<and> prime q \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
 2. \<not> (q \<le> n \<and> prime q) \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{p. p \<le> n \<and> prime p}. multiplicity q (x ^ f x)) = (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. if x = q then f q else 0)

goal (2 subgoals):
 1. q \<le> n \<and> prime q \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
 2. \<not> (q \<le> n \<and> prime q) \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
[PROOF STEP]
have "\<dots> = f q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. if x = q then f q else 0) = f q
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
q \<le> n \<and> prime q

goal (1 subgoal):
 1. (\<Sum>x\<in>{p. p \<le> n \<and> prime p}. if x = q then f q else 0) = f q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{p. p \<le> n \<and> prime p}. if x = q then f q else 0) = f q

goal (2 subgoals):
 1. q \<le> n \<and> prime q \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
 2. \<not> (q \<le> n \<and> prime q) \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) = f q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) = f q

goal (1 subgoal):
 1. (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) = f q
q \<le> n \<and> prime q

goal (1 subgoal):
 1. (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q

goal (1 subgoal):
 1. \<not> (q \<le> n \<and> prime q) \<Longrightarrow> (if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q
[PROOF STEP]
qed (insert 3, force+)
[PROOF STATE]
proof (state)
this:
(if q \<le> n \<and> prime q then multiplicity q (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>p. if p \<le> n \<and> prime p then multiplicity p (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ f p) else undefined) = f

goal (1 subgoal):
 1. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
case (4 m)
[PROOF STATE]
proof (state)
this:
m \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}}

goal (1 subgoal):
 1. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
have "(\<Prod>p | p \<le> n \<and> prime p. p ^ (if p \<le> n \<and> prime p then multiplicity p m else undefined)) =
          (\<Prod>p\<in>prime_factors m. p ^ multiplicity p m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p m else undefined)) = (\<Prod>p\<in>prime_factors m. p ^ multiplicity p m)
[PROOF STEP]
proof (rule prod.mono_neutral_cong)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. finite (prime_factors m)
 2. finite {p. p \<le> n \<and> prime p}
 3. \<And>i. i \<in> prime_factors m - {p. p \<le> n \<and> prime p} \<Longrightarrow> i ^ multiplicity i m = 1
 4. \<And>i. i \<in> {p. p \<le> n \<and> prime p} - prime_factors m \<Longrightarrow> i ^ (if i \<le> n \<and> prime i then multiplicity i m else undefined) = 1
 5. \<And>x. x \<in> {p. p \<le> n \<and> prime p} \<inter> prime_factors m \<Longrightarrow> x ^ (if x \<le> n \<and> prime x then multiplicity x m else undefined) = x ^ multiplicity x m
[PROOF STEP]
show "finite (prime_factors m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (prime_factors m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (prime_factors m)

goal (4 subgoals):
 1. finite {p. p \<le> n \<and> prime p}
 2. \<And>i. i \<in> prime_factors m - {p. p \<le> n \<and> prime p} \<Longrightarrow> i ^ multiplicity i m = 1
 3. \<And>i. i \<in> {p. p \<le> n \<and> prime p} - prime_factors m \<Longrightarrow> i ^ (if i \<le> n \<and> prime i then multiplicity i m else undefined) = 1
 4. \<And>x. x \<in> {p. p \<le> n \<and> prime p} \<inter> prime_factors m \<Longrightarrow> x ^ (if x \<le> n \<and> prime x then multiplicity x m else undefined) = x ^ multiplicity x m
[PROOF STEP]
qed (insert 4, auto simp: prime_factors_multiplicity)
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p m else undefined)) = (\<Prod>p\<in>prime_factors m. p ^ multiplicity p m)

goal (1 subgoal):
 1. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p m else undefined)) = (\<Prod>p\<in>prime_factors m. p ^ multiplicity p m)

goal (1 subgoal):
 1. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
from 4
[PROOF STATE]
proof (chain)
picking this:
m \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}}
[PROOF STEP]
have "\<dots> = m"
[PROOF STATE]
proof (prove)
using this:
m \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}}

goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors m. p ^ multiplicity p m) = m
[PROOF STEP]
by (intro prime_factorization_nat [symmetric]) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors m. p ^ multiplicity p m) = m

goal (1 subgoal):
 1. \<And>y. y \<in> {m. 0 < m \<and> prime_factors m \<subseteq> {..n}} \<Longrightarrow> (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p y else undefined)) = y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p m else undefined)) = m
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p m else undefined)) = m

goal (1 subgoal):
 1. (\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p m else undefined)) = m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>{p. p \<le> n \<and> prime p}. p ^ (if p \<le> n \<and> prime p then multiplicity p m else undefined)) = m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "(\<exists>x. P\<longrightarrow>Q(x))  =  (P \<longrightarrow> (\<exists>x. Q(x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. P \<longrightarrow> Q x) = (P \<longrightarrow> (\<exists>x. Q x))
[PROOF STEP]
by blast


[STATEMENT]
lemma "(x + y < z) = (x < z - (y::real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y < z) = (x < z - y)
[PROOF STEP]
by arith


[STATEMENT]
lemma step_consistent [simp]:
  "\<lbrakk>\<And>states. invar (states :: 'a states) \<Longrightarrow>  P (step states) = P states; invar states\<rbrakk>
   \<Longrightarrow> P states = P ((step ^^n) states)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>states. invar states \<Longrightarrow> P (step states) = P states; invar states\<rbrakk> \<Longrightarrow> P states = P ((step ^^ n) states)
[PROOF STEP]
by(induction n arbitrary: states)
    (auto simp: States_Proof.invar_step funpow_swap1)


[STATEMENT]
lemma test_distr_1 :
  assumes "is_test x"
    and "is_test y"
  shows "x ; z \<cdot> y ; z = (x \<cdot> y) ; z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ; z \<cdot> y ; z = (x \<cdot> y) ; z
[PROOF STEP]
proof (rule order.antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x ; z \<cdot> y ; z \<le> (x \<cdot> y) ; z
 2. (x \<cdot> y) ; z \<le> x ; z \<cdot> y ; z
[PROOF STEP]
have "x ; z \<cdot> y ; z \<le> x ; 1 \<cdot> y ; z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ; z \<cdot> y ; z \<le> x ; 1 \<cdot> y ; z
[PROOF STEP]
by (metis inf_top_left meet_iso mult_subdistl)
[PROOF STATE]
proof (state)
this:
x ; z \<cdot> y ; z \<le> x ; 1 \<cdot> y ; z

goal (2 subgoals):
 1. x ; z \<cdot> y ; z \<le> (x \<cdot> y) ; z
 2. (x \<cdot> y) ; z \<le> x ; z \<cdot> y ; z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x ; z \<cdot> y ; z \<le> x ; 1 \<cdot> y ; z

goal (2 subgoals):
 1. x ; z \<cdot> y ; z \<le> (x \<cdot> y) ; z
 2. (x \<cdot> y) ; z \<le> x ; z \<cdot> y ; z
[PROOF STEP]
have "\<dots> = x ; y ; z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ; 1 \<cdot> y ; z = x ; y ; z
[PROOF STEP]
by (metis assms(1) mult.assoc test_1)
[PROOF STATE]
proof (state)
this:
x ; 1 \<cdot> y ; z = x ; y ; z

goal (2 subgoals):
 1. x ; z \<cdot> y ; z \<le> (x \<cdot> y) ; z
 2. (x \<cdot> y) ; z \<le> x ; z \<cdot> y ; z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x ; z \<cdot> y ; z \<le> x ; y ; z
[PROOF STEP]
show "x ; z \<cdot> y ; z \<le> (x \<cdot> y) ; z"
[PROOF STATE]
proof (prove)
using this:
x ; z \<cdot> y ; z \<le> x ; y ; z

goal (1 subgoal):
 1. x ; z \<cdot> y ; z \<le> (x \<cdot> y) ; z
[PROOF STEP]
by (metis assms test_comp_eq_mult)
[PROOF STATE]
proof (state)
this:
x ; z \<cdot> y ; z \<le> (x \<cdot> y) ; z

goal (1 subgoal):
 1. (x \<cdot> y) ; z \<le> x ; z \<cdot> y ; z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x \<cdot> y) ; z \<le> x ; z \<cdot> y ; z
[PROOF STEP]
show "(x \<cdot> y) ; z \<le> x ; z \<cdot> y ; z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<cdot> y) ; z \<le> x ; z \<cdot> y ; z
[PROOF STEP]
by (metis mult_subdistr_var)
[PROOF STATE]
proof (state)
this:
(x \<cdot> y) ; z \<le> x ; z \<cdot> y ; z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compact_simplex: "n simplex S \<Longrightarrow> compact S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n simplex S \<Longrightarrow> compact S
[PROOF STEP]
unfolding simplex
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>C. finite C \<and> \<not> affine_dependent C \<and> int (card C) = n + 1 \<and> S = convex hull C \<Longrightarrow> compact S
[PROOF STEP]
using finite_imp_compact_convex_hull
[PROOF STATE]
proof (prove)
using this:
finite ?S \<Longrightarrow> compact (convex hull ?S)

goal (1 subgoal):
 1. \<exists>C. finite C \<and> \<not> affine_dependent C \<and> int (card C) = n + 1 \<and> S = convex hull C \<Longrightarrow> compact S
[PROOF STEP]
by blast


[STATEMENT]
lemma dgrad_p_set_closed_snd_crit_pair:
  assumes "dickson_grading d" and "p \<in> dgrad_p_set d m" and "q \<in> dgrad_p_set d m"
  shows "snd (crit_pair p q) \<in> dgrad_p_set d m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (crit_pair p q) \<in> dgrad_p_set d m
[PROOF STEP]
by (simp add: crit_pair_swap[of p q], rule dgrad_p_set_closed_fst_crit_pair, fact+)


[STATEMENT]
lemma eval_ternary_And_comm: "eval_ternary_And t1 t2 = eval_ternary_And t2 t1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_ternary_And t1 t2 = eval_ternary_And t2 t1
[PROOF STEP]
by (cases t1 t2 rule: ternaryvalue.exhaust[case_product ternaryvalue.exhaust]) auto


[STATEMENT]
lemma ex_f: "\<exists>f :: 'p mod_ring poly. u = #v * #w + smult (of_nat q) (#f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. u = #v * #w + Polynomial.smult (of_nat q) (#f)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f. u = #v * #w + Polynomial.smult (of_nat q) (#f)
[PROOF STEP]
from uvw
[PROOF STATE]
proof (chain)
picking this:
#u = v * w
[PROOF STEP]
have "(#(u - #v * #w) :: 'q mod_ring poly) = 0"
[PROOF STATE]
proof (prove)
using this:
#u = v * w

goal (1 subgoal):
 1. #(u - #v * #w) = 0
[PROOF STEP]
by (auto simp:hom_distribs)
[PROOF STATE]
proof (state)
this:
#(u - #v * #w) = 0

goal (1 subgoal):
 1. \<exists>f. u = #v * #w + Polynomial.smult (of_nat q) (#f)
[PROOF STEP]
from rebase_pq_to_q.rebase_poly_eq_0_imp_ex_smult[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>p'. (u - #v * #w = 0) = (p' = 0) \<and> degree p' \<le> degree (u - #v * #w) \<and> u - #v * #w = Polynomial.smult (of_nat CARD('q)) (#p')
[PROOF STEP]
obtain f :: "'p mod_ring poly" where "u - #v * #w = smult (of_nat q) (#f)"
[PROOF STATE]
proof (prove)
using this:
\<exists>p'. (u - #v * #w = 0) = (p' = 0) \<and> degree p' \<le> degree (u - #v * #w) \<and> u - #v * #w = Polynomial.smult (of_nat CARD('q)) (#p')

goal (1 subgoal):
 1. (\<And>f. u - #v * #w = Polynomial.smult (of_nat q) (#f) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
u - #v * #w = Polynomial.smult (of_nat q) (#f)

goal (1 subgoal):
 1. \<exists>f. u = #v * #w + Polynomial.smult (of_nat q) (#f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u - #v * #w = Polynomial.smult (of_nat q) (#f)
[PROOF STEP]
have "u = #v * #w + smult (of_nat q) (#f)"
[PROOF STATE]
proof (prove)
using this:
u - #v * #w = Polynomial.smult (of_nat q) (#f)

goal (1 subgoal):
 1. u = #v * #w + Polynomial.smult (of_nat q) (#f)
[PROOF STEP]
by (metis add_diff_cancel_left' add_diff_eq)
[PROOF STATE]
proof (state)
this:
u = #v * #w + Polynomial.smult (of_nat q) (#f)

goal (1 subgoal):
 1. \<exists>f. u = #v * #w + Polynomial.smult (of_nat q) (#f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u = #v * #w + Polynomial.smult (of_nat q) (#f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u = #v * #w + Polynomial.smult (of_nat q) (#f)

goal (1 subgoal):
 1. \<exists>f. u = #v * #w + Polynomial.smult (of_nat q) (#f)
[PROOF STEP]
by (intro exI[of _ f], auto)
[PROOF STATE]
proof (state)
this:
\<exists>f. u = #v * #w + Polynomial.smult (of_nat q) (#f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma emeasure_lborel_Ioc[simp]:
  assumes [simp]: "l \<le> u"
  shows "emeasure lborel {l <.. u} = ennreal (u - l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel {l<..u} = ennreal (u - l)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure lborel {l<..u} = ennreal (u - l)
[PROOF STEP]
have "emeasure lborel {l <.. u} = emeasure lborel {l .. u}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel {l<..u} = emeasure lborel {l..u}
[PROOF STEP]
using AE_lborel_singleton[of u] AE_lborel_singleton[of l]
[PROOF STATE]
proof (prove)
using this:
AE x in lborel. x \<noteq> u
AE x in lborel. x \<noteq> l

goal (1 subgoal):
 1. emeasure lborel {l<..u} = emeasure lborel {l..u}
[PROOF STEP]
by (intro emeasure_eq_AE) auto
[PROOF STATE]
proof (state)
this:
emeasure lborel {l<..u} = emeasure lborel {l..u}

goal (1 subgoal):
 1. emeasure lborel {l<..u} = ennreal (u - l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
emeasure lborel {l<..u} = emeasure lborel {l..u}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure lborel {l<..u} = emeasure lborel {l..u}

goal (1 subgoal):
 1. emeasure lborel {l<..u} = ennreal (u - l)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
emeasure lborel {l<..u} = ennreal (u - l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma main_step_aux2_R:
  fixes qs:: "real poly list"
  assumes is_not_const: "check_all_const_deg qs = False"
  shows "set (find_consistent_signs_R qs) =  consistent_sign_vectors_R qs UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (find_consistent_signs_R qs) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (find_consistent_signs_R qs) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
have poly_f_is: "poly_f qs = (pderiv (prod_list_var qs)) * (prod_list_var qs)* ([:-(crb (prod_list_var qs)),1:]) * ([:(crb (prod_list_var qs)),1:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_f qs = pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]
[PROOF STEP]
using is_not_const
[PROOF STATE]
proof (prove)
using this:
check_all_const_deg qs = False

goal (1 subgoal):
 1. poly_f qs = pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]
[PROOF STEP]
unfolding poly_f_def
[PROOF STATE]
proof (prove)
using this:
check_all_const_deg qs = False

goal (1 subgoal):
 1. (if check_all_const_deg qs = True then [:0, 1:] else pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]) = pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_f qs = pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]

goal (1 subgoal):
 1. set (find_consistent_signs_R qs) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
let ?p = "(pderiv (prod_list_var qs)) * (prod_list_var qs)*  ([:-(crb (prod_list_var qs)),1:]) * ([:(crb (prod_list_var qs)),1:])"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (find_consistent_signs_R qs) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
let ?S = "characterize_root_list_p (pderiv (prod_list_var qs) * (prod_list_var qs) *  ([:-(crb (prod_list_var qs)),1:]) * ([:(crb (prod_list_var qs)),1:]))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (find_consistent_signs_R qs) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
have "set (remdups
          (map (signs_at qs) ?S))
      = consistent_sign_vectors_R qs (set ?S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (remdups (map (signs_at qs) (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))) = consistent_sign_vectors_R qs (set (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))
[PROOF STEP]
unfolding signs_at_def squash_def consistent_sign_vectors_R_def consistent_sign_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (remdups (map (\<lambda>x. map ((\<lambda>x. if 0 < x then 1 else if x < 0 then - 1 else 0) \<circ> (\<lambda>q. poly q x)) qs) (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))) = (\<lambda>x. map (\<lambda>q. if 0 < poly q x then 1 else if poly q x = 0 then 0 else - 1) qs) ` set (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]))
[PROOF STEP]
by (smt (verit, best) comp_apply map_eq_conv set_map set_remdups)
[PROOF STATE]
proof (state)
this:
set (remdups (map (signs_at qs) (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))) = consistent_sign_vectors_R qs (set (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))

goal (1 subgoal):
 1. set (find_consistent_signs_R qs) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (remdups (map (signs_at qs) (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))) = consistent_sign_vectors_R qs (set (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))
[PROOF STEP]
have "set (characterize_consistent_signs_at_roots ?p qs) = consistent_sign_vectors_R qs UNIV"
[PROOF STATE]
proof (prove)
using this:
set (remdups (map (signs_at qs) (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))) = consistent_sign_vectors_R qs (set (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))

goal (1 subgoal):
 1. set (characterize_consistent_signs_at_roots (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]) qs) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
unfolding characterize_consistent_signs_at_roots_def
[PROOF STATE]
proof (prove)
using this:
set (remdups (map (signs_at qs) (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))) = consistent_sign_vectors_R qs (set (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))

goal (1 subgoal):
 1. set (remdups (map (signs_at qs) (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
using assms all_sample_points_prop[of qs]
[PROOF STATE]
proof (prove)
using this:
set (remdups (map (signs_at qs) (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))) = consistent_sign_vectors_R qs (set (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))
check_all_const_deg qs = False
\<lbrakk>check_all_const_deg qs = False; ?S = characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])\<rbrakk> \<Longrightarrow> consistent_sign_vectors_R qs UNIV = consistent_sign_vectors_R qs (set ?S)

goal (1 subgoal):
 1. set (remdups (map (signs_at qs) (characterize_root_list_p (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:])))) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (characterize_consistent_signs_at_roots (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]) qs) = consistent_sign_vectors_R qs UNIV

goal (1 subgoal):
 1. set (find_consistent_signs_R qs) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (characterize_consistent_signs_at_roots (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]) qs) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set (characterize_consistent_signs_at_roots (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]) qs) = consistent_sign_vectors_R qs UNIV

goal (1 subgoal):
 1. set (find_consistent_signs_R qs) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
unfolding find_consistent_signs_R_def
[PROOF STATE]
proof (prove)
using this:
set (characterize_consistent_signs_at_roots (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]) qs) = consistent_sign_vectors_R qs UNIV

goal (1 subgoal):
 1. set (find_consistent_signs_at_roots_R (poly_f qs) qs) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
using find_consistent_signs_at_roots_R poly_f_is poly_f_nonzero[of qs]
[PROOF STATE]
proof (prove)
using this:
set (characterize_consistent_signs_at_roots (pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]) qs) = consistent_sign_vectors_R qs UNIV
?p \<noteq> 0 \<Longrightarrow> set (find_consistent_signs_at_roots_R ?p ?qs) = set (characterize_consistent_signs_at_roots ?p ?qs)
poly_f qs = pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]
poly_f qs \<noteq> 0

goal (1 subgoal):
 1. set (find_consistent_signs_at_roots_R (poly_f qs) qs) = consistent_sign_vectors_R qs UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (find_consistent_signs_R qs) = consistent_sign_vectors_R qs UNIV

goal:
No subgoals!
[PROOF STEP]
qed