[STATEMENT]
lemma card_convert_triangle_rep_bound:
  fixes G :: "ugraph" and t :: real
  assumes "X \<subseteq> uverts G" and "Y \<subseteq> uverts G" and "Z \<subseteq> uverts G" and fin: "finite (uverts G)"
and wf: "uwellformed G"
  assumes "card {(x,y,z) \<in> X \<times> Y \<times> Z . (triangle_in_graph x y z G)} \<ge> t"
  shows "card (triangle_set G) \<ge> 1/6 *t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card (triangle_set G))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card (triangle_set G))
[PROOF STEP]
define t' where "t' \<equiv> card {(x,y,z) \<in> X \<times> Y \<times> Z . (triangle_in_graph x y z G)}"
[PROOF STATE]
proof (state)
this:
t' \<equiv> card {(x, y, z). (x, y, z) \<in> X \<times> Y \<times> Z \<and> triangle_in_graph x y z G}

goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card (triangle_set G))
[PROOF STEP]
have "t' \<ge> t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<le> real t'
[PROOF STEP]
using assms t'_def
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> uverts G
Y \<subseteq> uverts G
Z \<subseteq> uverts G
finite (uverts G)
uwellformed G
t \<le> real (card {(x, y, z). (x, y, z) \<in> X \<times> Y \<times> Z \<and> triangle_in_graph x y z G})
t' \<equiv> card {(x, y, z). (x, y, z) \<in> X \<times> Y \<times> Z \<and> triangle_in_graph x y z G}

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

goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card (triangle_set G))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<le> real t'
[PROOF STEP]
have tgt: "1/6 * t' \<ge> 1/6 * t"
[PROOF STATE]
proof (prove)
using this:
t \<le> real t'

goal (1 subgoal):
 1. 1 / 6 * t \<le> 1 / 6 * real t'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / 6 * t \<le> 1 / 6 * real t'

goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card (triangle_set G))
[PROOF STEP]
have "card (triangle_set G) \<ge> 1/6 *t'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 6 * real t' \<le> real (card (triangle_set G))
[PROOF STEP]
using t'_def card_convert_triangle_rep assms
[PROOF STATE]
proof (prove)
using this:
t' \<equiv> card {(x, y, z). (x, y, z) \<in> X \<times> Y \<times> Z \<and> triangle_in_graph x y z G}
\<lbrakk>?X \<subseteq> uverts ?G; ?Y \<subseteq> uverts ?G; ?Z \<subseteq> uverts ?G; finite (uverts ?G); uwellformed ?G\<rbrakk> \<Longrightarrow> 1 / 6 * real (card {(x, y, z). (x, y, z) \<in> ?X \<times> ?Y \<times> ?Z \<and> triangle_in_graph x y z ?G}) \<le> real (card (triangle_set ?G))
X \<subseteq> uverts G
Y \<subseteq> uverts G
Z \<subseteq> uverts G
finite (uverts G)
uwellformed G
t \<le> real (card {(x, y, z). (x, y, z) \<in> X \<times> Y \<times> Z \<and> triangle_in_graph x y z G})

goal (1 subgoal):
 1. 1 / 6 * real t' \<le> real (card (triangle_set G))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / 6 * real t' \<le> real (card (triangle_set G))

goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card (triangle_set G))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
1 / 6 * real t' \<le> real (card (triangle_set G))

goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card (triangle_set G))
[PROOF STEP]
using tgt
[PROOF STATE]
proof (prove)
using this:
1 / 6 * real t' \<le> real (card (triangle_set G))
1 / 6 * t \<le> 1 / 6 * real t'

goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card (triangle_set G))
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
1 / 6 * t \<le> real (card (triangle_set G))

goal:
No subgoals!
[PROOF STEP]
qed


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

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

goal (1 subgoal):
 1. t1_space (prod_topology X Y) = (topspace (prod_topology X Y) = {} \<or> t1_space X \<and> t1_space Y)
[PROOF STEP]
by (auto simp: t1_space_empty)
[PROOF STATE]
proof (state)
this:
t1_space (prod_topology X Y) = (topspace (prod_topology X Y) = {} \<or> t1_space X \<and> t1_space Y)

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

goal (1 subgoal):
 1. topspace (prod_topology X Y) \<noteq> {} \<Longrightarrow> t1_space (prod_topology X Y) = (topspace (prod_topology X Y) = {} \<or> t1_space X \<and> t1_space Y)
[PROOF STEP]
have eq: "{(x,y)} = {x} \<times> {y}" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, y)} = {x} \<times> {y}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{(?x1, ?y1)} = {?x1} \<times> {?y1}

goal (1 subgoal):
 1. topspace (prod_topology X Y) \<noteq> {} \<Longrightarrow> t1_space (prod_topology X Y) = (topspace (prod_topology X Y) = {} \<or> t1_space X \<and> t1_space Y)
[PROOF STEP]
have "t1_space (prod_topology X Y) \<longleftrightarrow> (t1_space X \<and> t1_space Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t1_space (prod_topology X Y) = (t1_space X \<and> t1_space Y)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
topspace (prod_topology X Y) \<noteq> {}

goal (1 subgoal):
 1. t1_space (prod_topology X Y) = (t1_space X \<and> t1_space Y)
[PROOF STEP]
by (force simp: t1_space_closedin_singleton closedin_prod_Times_iff eq simp del: insert_Times_insert)
[PROOF STATE]
proof (state)
this:
t1_space (prod_topology X Y) = (t1_space X \<and> t1_space Y)

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

goal (1 subgoal):
 1. t1_space (prod_topology X Y) = (topspace (prod_topology X Y) = {} \<or> t1_space X \<and> t1_space Y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
t1_space (prod_topology X Y) = (topspace (prod_topology X Y) = {} \<or> t1_space X \<and> t1_space Y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_real_derivative_powr:
  assumes "z > 0"
  shows "((\<lambda>z. z powr r) has_real_derivative r * z powr (r - 1)) (at z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>z. z powr r) has_real_derivative r * z powr (r - 1)) (at z)
[PROOF STEP]
proof (subst DERIV_cong_ev[OF refl _ refl])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in nhds z. x powr r = ?g x
 2. (?g has_real_derivative r * z powr (r - 1)) (at z)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < z
[PROOF STEP]
have "eventually (\<lambda>z. z \<noteq> 0) (nhds z)"
[PROOF STATE]
proof (prove)
using this:
0 < z

goal (1 subgoal):
 1. \<forall>\<^sub>F z in nhds z. z \<noteq> 0
[PROOF STEP]
by (intro t1_space_nhds) auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F z in nhds z. z \<noteq> 0

goal (2 subgoals):
 1. \<forall>\<^sub>F x in nhds z. x powr r = ?g x
 2. (?g has_real_derivative r * z powr (r - 1)) (at z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F z in nhds z. z \<noteq> 0
[PROOF STEP]
show "eventually (\<lambda>z. z powr r = exp (r * ln z)) (nhds z)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F z in nhds z. z \<noteq> 0

goal (1 subgoal):
 1. \<forall>\<^sub>F z in nhds z. z powr r = exp (r * ln z)
[PROOF STEP]
unfolding powr_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F z in nhds z. z \<noteq> 0

goal (1 subgoal):
 1. \<forall>\<^sub>F z in nhds z. (if z = 0 then 0 else exp (r * ln z)) = exp (r * ln z)
[PROOF STEP]
by eventually_elim simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F z in nhds z. z powr r = exp (r * ln z)

goal (1 subgoal):
 1. ((\<lambda>z. exp (r * ln z)) has_real_derivative r * z powr (r - 1)) (at z)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < z
[PROOF STEP]
show "((\<lambda>z. exp (r * ln z)) has_real_derivative r * z powr (r - 1)) (at z)"
[PROOF STATE]
proof (prove)
using this:
0 < z

goal (1 subgoal):
 1. ((\<lambda>z. exp (r * ln z)) has_real_derivative r * z powr (r - 1)) (at z)
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: powr_def field_simps exp_diff)
[PROOF STATE]
proof (state)
this:
((\<lambda>z. exp (r * ln z)) has_real_derivative r * z powr (r - 1)) (at z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma choose_rising_sum:
  "(\<Sum>j\<le>m. ((n + j) choose n)) = ((n + m + 1) choose (n + 1))"
  "(\<Sum>j\<le>m. ((n + j) choose n)) = ((n + m + 1) choose m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose (n + 1) &&& (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose (n + 1)
 2. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
show "(\<Sum>j\<le>m. ((n + j) choose n)) = ((n + m + 1) choose (n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose (n + 1)
[PROOF STEP]
by (induct m) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose (n + 1)

goal (1 subgoal):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose (n + 1)

goal (1 subgoal):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
have "\<dots> = (n + m + 1) choose m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n + m + 1 choose (n + 1) = n + m + 1 choose m
[PROOF STEP]
by (subst binomial_symmetric) simp_all
[PROOF STATE]
proof (state)
this:
n + m + 1 choose (n + 1) = n + m + 1 choose m

goal (1 subgoal):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
show "(\<Sum>j\<le>m. ((n + j) choose n)) = (n + m + 1) choose m"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m

goal (1 subgoal):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fbox_fdia_demorgan: "( |R] (f::'b \<Rightarrow> 'c::complete_boolean_algebra) x) = - |R\<rangle> (\<lambda>y. -f y) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |R] f x = -  |R\<rangle> (\<lambda>y. - f y) x
[PROOF STEP]
apply (simp add: fbox_def fdia_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>{f y |y. (x, y) \<in> R} = - \<Squnion>{- f y |y. (x, y) \<in> R}
[PROOF STEP]
apply (rule antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<Sqinter>{f y |y. (x, y) \<in> R} \<le> - \<Squnion>{- f y |y. (x, y) \<in> R}
 2. - \<Squnion>{- f y |y. (x, y) \<in> R} \<le> \<Sqinter>{f y |y. (x, y) \<in> R}
[PROOF STEP]
apply (simp add: uminus_Sup)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<Sqinter>{f y |y. (x, y) \<in> R} \<le> \<Sqinter>(uminus ` {- f y |y. (x, y) \<in> R})
 2. - \<Squnion>{- f y |y. (x, y) \<in> R} \<le> \<Sqinter>{f y |y. (x, y) \<in> R}
[PROOF STEP]
apply (rule INF_greatest; rule Inf_lower)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. xa \<in> {- f y |y. (x, y) \<in> R} \<Longrightarrow> - xa \<in> {f y |y. (x, y) \<in> R}
 2. - \<Squnion>{- f y |y. (x, y) \<in> R} \<le> \<Sqinter>{f y |y. (x, y) \<in> R}
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<Squnion>{- f y |y. (x, y) \<in> R} \<le> \<Sqinter>{f y |y. (x, y) \<in> R}
[PROOF STEP]
apply (rule Inf_greatest)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {f y |y. (x, y) \<in> R} \<Longrightarrow> - \<Squnion>{- f y |y. (x, y) \<in> R} \<le> xa
[PROOF STEP]
by (simp add: Sup_upper compl_le_swap2)


[STATEMENT]
lemma enumerate_1:"\<lbrakk>\<forall>j \<le> (n::nat). f j \<in> A; \<forall>j \<le> (m::nat). g j \<in> A;
     inj_on f {i. i \<le> n}; inj_on g {j. j \<le> m}; f `{j. j \<le> n} = A;
     g ` {j. j \<le> m} = A \<rbrakk> \<Longrightarrow> n = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>j\<le>n. f j \<in> A; \<forall>j\<le>m. g j \<in> A; inj_on f {i. i \<le> n}; inj_on g {j. j \<le> m}; f ` {j. j \<le> n} = A; g ` {j. j \<le> m} = A\<rbrakk> \<Longrightarrow> n = m
[PROOF STEP]
apply (frule card_image[of f "{i. i \<le> n}"],
       frule card_image[of g "{i. i \<le> m}"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>j\<le>n. f j \<in> A; \<forall>j\<le>m. g j \<in> A; inj_on f {i. i \<le> n}; inj_on g {j. j \<le> m}; f ` {j. j \<le> n} = A; g ` {j. j \<le> m} = A; card (f ` {i. i \<le> n}) = card {i. i \<le> n}; card (g ` {i. i \<le> m}) = card {i. i \<le> m}\<rbrakk> \<Longrightarrow> n = m
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lim_mono:
  fixes X Y :: "nat \<Rightarrow> 'a::linorder_topology"
  assumes "\<And>n. N \<le> n \<Longrightarrow> X n \<le> Y n"
    and "X \<longlonglongrightarrow> x"
    and "Y \<longlonglongrightarrow> y"
  shows "x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
N \<le> ?n \<Longrightarrow> X ?n \<le> Y ?n

goal (1 subgoal):
 1. x \<le> y
[PROOF STEP]
by (intro LIMSEQ_le[OF assms(2,3)]) auto


[STATEMENT]
lemma nat_interval_union:
  assumes \<open>m \<le> n\<close>
    shows \<open>{i::nat. i \<le> n \<and> P i}
         = {i::nat. i \<le> m \<and> P i} \<union> {i::nat. m < i \<and> i \<le> n \<and> P i}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i \<le> n \<and> P i} = {i. i \<le> m \<and> P i} \<union> {i. m < i \<and> i \<le> n \<and> P i}
[PROOF STEP]
using assms le_cases nat_less_le
[PROOF STATE]
proof (prove)
using this:
m \<le> n
\<lbrakk>?x \<le> ?y \<Longrightarrow> ?P; ?y \<le> ?x \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
(?m < ?n) = (?m \<le> ?n \<and> ?m \<noteq> ?n)

goal (1 subgoal):
 1. {i. i \<le> n \<and> P i} = {i. i \<le> m \<and> P i} \<union> {i. m < i \<and> i \<le> n \<and> P i}
[PROOF STEP]
by auto


[STATEMENT]
theorem time_mergesort_tm_bigo:
  "(\<lambda>xs. time (mergesort_tm f xs)) \<in> O[length going_to at_top]((\<lambda>n. n * ln n) o length)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (time (mergesort_tm f x))) \<in> O[length going_to sequentially]((\<lambda>n. real n * ln (real n)) \<circ> length)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. real (time (mergesort_tm f x))) \<in> O[length going_to sequentially]((\<lambda>n. real n * ln (real n)) \<circ> length)
[PROOF STEP]
have 0: "\<And>xs. time (mergesort_tm f xs) \<le> (mergesort_recurrence o length) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. real (time (mergesort_tm f xs)) \<le> (mergesort_recurrence \<circ> length) xs
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. real (time (mergesort_tm f xs)) \<le> mergesort_recurrence (length xs)
[PROOF STEP]
using time_mergesort_conv_mergesort_recurrence
[PROOF STATE]
proof (prove)
using this:
real (time (mergesort_tm ?f ?xs)) \<le> mergesort_recurrence (length ?xs)

goal (1 subgoal):
 1. \<And>xs. real (time (mergesort_tm f xs)) \<le> mergesort_recurrence (length xs)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
real (time (mergesort_tm f ?xs)) \<le> (mergesort_recurrence \<circ> length) ?xs

goal (1 subgoal):
 1. (\<lambda>x. real (time (mergesort_tm f x))) \<in> O[length going_to sequentially]((\<lambda>n. real n * ln (real n)) \<circ> length)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (time (mergesort_tm f x))) \<in> O[length going_to sequentially]((\<lambda>n. real n * ln (real n)) \<circ> length)
[PROOF STEP]
using bigo_measure_trans[OF 0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>mergesort_recurrence \<in> O(?f); \<And>x. x \<in> ?A \<Longrightarrow> 0 \<le> real (time (mergesort_tm f x))\<rbrakk> \<Longrightarrow> (\<lambda>x. real (time (mergesort_tm f x))) \<in> O[length going_to sequentially within ?A](?f \<circ> length)

goal (1 subgoal):
 1. (\<lambda>x. real (time (mergesort_tm f x))) \<in> O[length going_to sequentially]((\<lambda>n. real n * ln (real n)) \<circ> length)
[PROOF STEP]
by (simp add: bigthetaD1 mergesort_recurrence)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (time (mergesort_tm f x))) \<in> O[length going_to sequentially]((\<lambda>n. real n * ln (real n)) \<circ> length)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma disjoint_orbits:
  assumes "A \<in> orbits f" and "B \<in> orbits f" and "A \<noteq> B"
  shows "A \<inter> B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
using \<open>A \<in> orbits f\<close>
[PROOF STATE]
proof (prove)
using this:
A \<in> orbits f

goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
apply cases
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>A = orbit f a; a \<in> affected f\<rbrakk> \<Longrightarrow> A \<inter> B = {}
[PROOF STEP]
using \<open>B \<in> orbits f\<close>
[PROOF STATE]
proof (prove)
using this:
B \<in> orbits f

goal (1 subgoal):
 1. \<And>a. \<lbrakk>A = orbit f a; a \<in> affected f\<rbrakk> \<Longrightarrow> A \<inter> B = {}
[PROOF STEP]
apply cases
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a aa. \<lbrakk>A = orbit f a; a \<in> affected f; B = orbit f aa; aa \<in> affected f\<rbrakk> \<Longrightarrow> A \<inter> B = {}
[PROOF STEP]
using \<open>A \<noteq> B\<close>
[PROOF STATE]
proof (prove)
using this:
A \<noteq> B

goal (1 subgoal):
 1. \<And>a aa. \<lbrakk>A = orbit f a; a \<in> affected f; B = orbit f aa; aa \<in> affected f\<rbrakk> \<Longrightarrow> A \<inter> B = {}
[PROOF STEP]
apply (simp_all add: orbit_disjoint)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem dual_Sup [iff?]:
    "is_Sup (dual ` A) (dual inf) = is_Inf A inf"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_Sup (dual ` A) (dual inf) = is_Inf A inf
[PROOF STEP]
by (simp add: is_Inf_def is_Sup_def dual_all [symmetric] dual_leq)


[STATEMENT]
lemma llength_lmirror_aux: "llength (lmirror_aux acc xs) = 2 * llength xs + llength acc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llength (lmirror_aux acc xs) = 2 * llength xs + llength acc
[PROOF STEP]
apply(coinduction arbitrary: acc xs rule: enat_coinduct)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>acc xs. (llength (lmirror_aux acc xs) = 0) = (2 * llength xs + llength acc = 0) \<and> (llength (lmirror_aux acc xs) \<noteq> 0 \<longrightarrow> 2 * llength xs + llength acc \<noteq> 0 \<longrightarrow> (\<exists>acca xsa. epred (llength (lmirror_aux acc xs)) = llength (lmirror_aux acca xsa) \<and> epred (2 * llength xs + llength acc) = 2 * llength xsa + llength acca) \<or> epred (llength (lmirror_aux acc xs)) = epred (2 * llength xs + llength acc))
[PROOF STEP]
apply(auto simp add: iadd_is_0 epred_iadd1 mult_2 epred_llength ltl_lmirror_aux iadd_Suc_right)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>acc xs. \<lbrakk>\<not> lnull xs; llength (lmirror_aux (LCons (lhd xs) acc) (ltl xs)) \<noteq> llength (ltl xs) + llength xs + llength acc\<rbrakk> \<Longrightarrow> \<exists>acca xsa. llength (lmirror_aux (LCons (lhd xs) acc) (ltl xs)) = llength (lmirror_aux acca xsa) \<and> llength (ltl xs) + llength xs + llength acc = llength xsa + llength xsa + llength acca
[PROOF STEP]
apply(rule exI conjI refl)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>acc xs. \<lbrakk>\<not> lnull xs; llength (lmirror_aux (LCons (lhd xs) acc) (ltl xs)) \<noteq> llength (ltl xs) + llength xs + llength acc\<rbrakk> \<Longrightarrow> llength (ltl xs) + llength xs + llength acc = llength (ltl xs) + llength (ltl xs) + llength (LCons (lhd xs) acc)
[PROOF STEP]
apply(simp add: iadd_Suc_right llength_ltl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>acc xs. \<lbrakk>\<not> lnull xs; llength (lmirror_aux (LCons (lhd xs) acc) (ltl xs)) \<noteq> epred (llength xs) + llength xs + llength acc\<rbrakk> \<Longrightarrow> epred (llength xs) + llength xs + llength acc = eSuc (epred (llength xs) + epred (llength xs) + llength acc)
[PROOF STEP]
by (metis (opaque_lifting, no_types) add.commute epred_llength iadd_Suc_right lhd_LCons_ltl llength_LCons)


[STATEMENT]
lemma is_zero_row_JNF_multrow[simp]:
  fixes A::"'a::comm_ring_1 mat"
  assumes "i<dim_row A"
  shows "is_zero_row_JNF i (multrow j (- 1) A) = is_zero_row_JNF i A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row_JNF i (multrow j (- (1::'a)) A) = is_zero_row_JNF i A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row A

goal (1 subgoal):
 1. is_zero_row_JNF i (multrow j (- (1::'a)) A) = is_zero_row_JNF i A
[PROOF STEP]
unfolding is_zero_row_JNF_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row A

goal (1 subgoal):
 1. (\<forall>ja<dim_col (multrow j (- (1::'a)) A). multrow j (- (1::'a)) A $$ (i, ja) = (0::'a)) = (\<forall>j<dim_col A. A $$ (i, j) = (0::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma list_eq_sum [simp]:
  fixes xs::"real list"
  shows "\<Sum>:(list_eq xs m) = (m * (real (length (list_eq xs m))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (list_eq xs m) = m * real (length (list_eq xs m))
[PROOF STEP]
apply (induct_tac xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sum_list (list_eq [] m) = m * real (length (list_eq [] m))
 2. \<And>a list. sum_list (list_eq list m) = m * real (length (list_eq list m)) \<Longrightarrow> sum_list (list_eq (a # list) m) = m * real (length (list_eq (a # list) m))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a list. sum_list (list_eq list m) = m * real (length (list_eq list m)) \<Longrightarrow> sum_list (list_eq (a # list) m) = m * real (length (list_eq (a # list) m))
[PROOF STEP]
apply (simp add:field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma zeta_conv_hurwitz_zeta_multiplication:
  fixes k a :: nat and s :: complex
  assumes "k > 0" "s \<noteq> 1"
  shows   "k powr s * zeta s = (\<Sum>n=1..k. hurwitz_zeta (n / k) s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat k powr s * zeta s = (\<Sum>n = 1..k. hurwitz_zeta (real n / real k) s)
[PROOF STEP]
using perzeta_conv_hurwitz_zeta_multiplication[of k s 0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < k; s \<noteq> 1\<rbrakk> \<Longrightarrow> of_nat k powr s * perzeta (real_of_int 0 / real k) s = (\<Sum>n = 1..k. exp (complex_of_real (2 * pi * real n * real_of_int 0 / real k) * \<i>) * hurwitz_zeta (real n / real k) s)

goal (1 subgoal):
 1. of_nat k powr s * zeta s = (\<Sum>n = 1..k. hurwitz_zeta (real n / real k) s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < k; s \<noteq> 1\<rbrakk> \<Longrightarrow> of_nat k powr s * perzeta (real_of_int 0 / real k) s = (\<Sum>n = 1..k. exp (complex_of_real (2 * pi * real n * real_of_int 0 / real k) * \<i>) * hurwitz_zeta (real n / real k) s)
0 < k
s \<noteq> 1

goal (1 subgoal):
 1. of_nat k powr s * zeta s = (\<Sum>n = 1..k. hurwitz_zeta (real n / real k) s)
[PROOF STEP]
by (simp add: perzeta_int)


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

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


[STATEMENT]
lemma nn_integral_neg_binomial_pmf_real:
  assumes p: "p \<in> {0<..1}"
  shows "nn_integral (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (n * (1 - p) / p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p)
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integral\<^sup>N (measure_pmf (neg_binomial_pmf 0 p)) of_nat = ennreal (real 0 * (1 - p) / p)
 2. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. integral\<^sup>N (measure_pmf (neg_binomial_pmf 0 p)) of_nat = ennreal (real 0 * (1 - p) / p)
 2. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (neg_binomial_pmf 0 p)) of_nat = ennreal (real 0 * (1 - p) / p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (neg_binomial_pmf 0 p)) of_nat = ennreal (real 0 * (1 - p) / p)

goal (1 subgoal):
 1. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p)

goal (1 subgoal):
 1. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
have "nn_integral (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat =
        nn_integral (measure_pmf (geometric_pmf p)) of_nat +
        nn_integral (measure_pmf (neg_binomial_pmf n p)) of_nat"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = integral\<^sup>N (measure_pmf (geometric_pmf p)) of_nat + integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat
[PROOF STEP]
by (simp add: neg_binomial_pmf_Suc case_prod_unfold nn_integral_add nn_integral_pair_pmf')
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = integral\<^sup>N (measure_pmf (geometric_pmf p)) of_nat + integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat

goal (1 subgoal):
 1. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = integral\<^sup>N (measure_pmf (geometric_pmf p)) of_nat + integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat

goal (1 subgoal):
 1. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
have "nn_integral (measure_pmf (geometric_pmf p)) of_nat = ennreal ((1-p) / p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (geometric_pmf p)) of_nat = ennreal ((1 - p) / p)
[PROOF STEP]
unfolding ennreal_of_nat_eq_real_of_nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ i. ennreal (real i) \<partial>measure_pmf (geometric_pmf p) = ennreal ((1 - p) / p)
[PROOF STEP]
using expectation_geometric_pmf[OF p] integrable_real_geometric_pmf[OF p]
[PROOF STATE]
proof (prove)
using this:
measure_pmf.expectation (geometric_pmf p) real = (1 - p) / p
integrable (measure_pmf (geometric_pmf p)) real

goal (1 subgoal):
 1. \<integral>\<^sup>+ i. ennreal (real i) \<partial>measure_pmf (geometric_pmf p) = ennreal ((1 - p) / p)
[PROOF STEP]
by (subst nn_integral_eq_integral) auto
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (geometric_pmf p)) of_nat = ennreal ((1 - p) / p)

goal (1 subgoal):
 1. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (geometric_pmf p)) of_nat = ennreal ((1 - p) / p)

goal (1 subgoal):
 1. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
have "nn_integral (measure_pmf (neg_binomial_pmf n p)) of_nat = n * (1 - p) / p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p)
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
p \<in> {0<..1}

goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p)
[PROOF STEP]
by (subst Suc.IH)
       (auto simp: ennreal_of_nat_eq_real_of_nat ennreal_mult simp flip: divide_ennreal ennreal_minus)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p)

goal (1 subgoal):
 1. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p)

goal (1 subgoal):
 1. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
have "ennreal ((1 - p) / p) + ennreal (real n * (1 - p) / p) =
             ennreal ((1-p) / p + real n * (1 - p) / p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal ((1 - p) / p) + ennreal (real n * (1 - p) / p) = ennreal ((1 - p) / p + real n * (1 - p) / p)
[PROOF STEP]
by (intro ennreal_plus [symmetric] divide_nonneg_pos mult_nonneg_nonneg) (use p in auto)
[PROOF STATE]
proof (state)
this:
ennreal ((1 - p) / p) + ennreal (real n * (1 - p) / p) = ennreal ((1 - p) / p + real n * (1 - p) / p)

goal (1 subgoal):
 1. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal ((1 - p) / p) + ennreal (real n * (1 - p) / p) = ennreal ((1 - p) / p + real n * (1 - p) / p)

goal (1 subgoal):
 1. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
have "(1-p) / p + real n * (1 - p) / p = real (Suc n) * (1 - p) / p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - p) / p + real n * (1 - p) / p = real (Suc n) * (1 - p) / p
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
p \<in> {0<..1}

goal (1 subgoal):
 1. (1 - p) / p + real n * (1 - p) / p = real (Suc n) * (1 - p) / p
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
(1 - p) / p + real n * (1 - p) / p = real (Suc n) * (1 - p) / p

goal (1 subgoal):
 1. \<And>n. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p) \<Longrightarrow> integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)

goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)
[PROOF STEP]
by (simp add: ennreal_of_nat_eq_real_of_nat)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (neg_binomial_pmf (Suc n) p)) of_nat = ennreal (real (Suc n) * (1 - p) / p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma op_norm_le_transpose: "\<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>transpose A\<parallel>\<^sub>o\<^sub>p" for A :: "real^'n^'n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
have obs:"\<forall>x. \<parallel>x\<parallel> = 1 \<longrightarrow> (\<parallel>A *v x\<parallel>) \<le> sqrt ((\<parallel>transpose A ** A\<parallel>\<^sub>o\<^sub>p)) * (\<parallel>x\<parallel>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. \<parallel>x\<parallel> = 1 \<longrightarrow> \<parallel>A *v x\<parallel> \<le> sqrt (\<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>
[PROOF STEP]
using norm_matrix_vec_mult_le_transpose
[PROOF STATE]
proof (prove)
using this:
\<parallel>?x\<parallel> = 1 \<Longrightarrow> \<parallel>?A *v ?x\<parallel> \<le> sqrt (\<parallel>Finite_Cartesian_Product.transpose ?A ** ?A\<parallel>\<^sub>o\<^sub>p) * \<parallel>?x\<parallel>

goal (1 subgoal):
 1. \<forall>x. \<parallel>x\<parallel> = 1 \<longrightarrow> \<parallel>A *v x\<parallel> \<le> sqrt (\<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x. \<parallel>x\<parallel> = 1 \<longrightarrow> \<parallel>A *v x\<parallel> \<le> sqrt (\<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>

goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
have "(\<parallel>A\<parallel>\<^sub>o\<^sub>p) \<le> sqrt ((\<parallel>transpose A ** A\<parallel>\<^sub>o\<^sub>p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> sqrt (\<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p)
[PROOF STEP]
using obs
[PROOF STATE]
proof (prove)
using this:
\<forall>x. \<parallel>x\<parallel> = 1 \<longrightarrow> \<parallel>A *v x\<parallel> \<le> sqrt (\<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p) * \<parallel>x\<parallel>

goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> sqrt (\<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p)
[PROOF STEP]
apply(unfold op_norm_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. \<parallel>x\<parallel> = 1 \<longrightarrow> \<parallel>A *v x\<parallel> \<le> sqrt (Sup {\<parallel>Finite_Cartesian_Product.transpose A ** A *v x\<parallel> |x. \<parallel>x\<parallel> = 1}) * \<parallel>x\<parallel> \<Longrightarrow> Sup {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<le> sqrt (Sup {\<parallel>Finite_Cartesian_Product.transpose A ** A *v x\<parallel> |x. \<parallel>x\<parallel> = 1})
[PROOF STEP]
by (rule cSup_least[OF op_norm_set_proptys(3)]) clarsimp
[PROOF STATE]
proof (state)
this:
\<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> sqrt (\<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p)

goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
hence "((\<parallel>A\<parallel>\<^sub>o\<^sub>p))\<^sup>2 \<le> (\<parallel>transpose A ** A\<parallel>\<^sub>o\<^sub>p)"
[PROOF STATE]
proof (prove)
using this:
\<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> sqrt (\<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p)

goal (1 subgoal):
 1. (\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> \<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
using power_mono[of "(\<parallel>A\<parallel>\<^sub>o\<^sub>p)" _ 2] op_norm_ge_0
[PROOF STATE]
proof (prove)
using this:
\<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> sqrt (\<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p)
\<lbrakk>\<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> ?b; 0 \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p\<rbrakk> \<Longrightarrow> (\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> ?b\<^sup>2
0 \<le> \<parallel>?A\<parallel>\<^sub>o\<^sub>p

goal (1 subgoal):
 1. (\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> \<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
by (metis not_le real_less_lsqrt)
[PROOF STATE]
proof (state)
this:
(\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> \<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p

goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> \<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p

goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
have "... \<le> (\<parallel>transpose A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>A\<parallel>\<^sub>o\<^sub>p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p \<le> (\<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>A\<parallel>\<^sub>o\<^sub>p)
[PROOF STEP]
using op_norm_matrix_matrix_mult_le
[PROOF STATE]
proof (prove)
using this:
\<parallel>?A ** ?B\<parallel>\<^sub>o\<^sub>p \<le> (\<parallel>?A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>?B\<parallel>\<^sub>o\<^sub>p)

goal (1 subgoal):
 1. \<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p \<le> (\<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>A\<parallel>\<^sub>o\<^sub>p)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<parallel>Finite_Cartesian_Product.transpose A ** A\<parallel>\<^sub>o\<^sub>p \<le> (\<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>A\<parallel>\<^sub>o\<^sub>p)

goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> (\<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>A\<parallel>\<^sub>o\<^sub>p)
[PROOF STEP]
have "((\<parallel>A\<parallel>\<^sub>o\<^sub>p))\<^sup>2 \<le> (\<parallel>transpose A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>A\<parallel>\<^sub>o\<^sub>p)"
[PROOF STATE]
proof (prove)
using this:
(\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> (\<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>A\<parallel>\<^sub>o\<^sub>p)

goal (1 subgoal):
 1. (\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> (\<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>A\<parallel>\<^sub>o\<^sub>p)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> (\<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>A\<parallel>\<^sub>o\<^sub>p)

goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
thus "(\<parallel>A\<parallel>\<^sub>o\<^sub>p) \<le> (\<parallel>transpose A\<parallel>\<^sub>o\<^sub>p)"
[PROOF STATE]
proof (prove)
using this:
(\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> (\<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>A\<parallel>\<^sub>o\<^sub>p)

goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
using sq_le_cancel[of "(\<parallel>A\<parallel>\<^sub>o\<^sub>p)"] op_norm_ge_0
[PROOF STATE]
proof (prove)
using this:
(\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> (\<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p) * (\<parallel>A\<parallel>\<^sub>o\<^sub>p)
\<lbrakk>0 \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p; 0 \<le> ?b; (\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> ?b * (\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<rbrakk> \<Longrightarrow> \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> ?b
\<lbrakk>0 \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p; 0 \<le> ?b; (\<parallel>A\<parallel>\<^sub>o\<^sub>p)\<^sup>2 \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) * ?b\<rbrakk> \<Longrightarrow> \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> ?b
0 \<le> \<parallel>?A\<parallel>\<^sub>o\<^sub>p

goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> \<parallel>Finite_Cartesian_Product.transpose A\<parallel>\<^sub>o\<^sub>p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ceiling_correct: "of_int \<lceil>x\<rceil> - 1 < x \<and> x \<le> of_int \<lceil>x\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int \<lceil>x\<rceil> - (1::'a) < x \<and> x \<le> of_int \<lceil>x\<rceil>
[PROOF STEP]
unfolding ceiling_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (- \<lfloor>- x\<rfloor>) - (1::'a) < x \<and> x \<le> of_int (- \<lfloor>- x\<rfloor>)
[PROOF STEP]
using floor_correct [of "- x"]
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>- x\<rfloor> \<le> - x \<and> - x < of_int (\<lfloor>- x\<rfloor> + 1)

goal (1 subgoal):
 1. of_int (- \<lfloor>- x\<rfloor>) - (1::'a) < x \<and> x \<le> of_int (- \<lfloor>- x\<rfloor>)
[PROOF STEP]
by (simp add: le_minus_iff)


[STATEMENT]
lemma log_of_power_less: "\<lbrakk> m < b ^ n; b > 1; m > 0 \<rbrakk> \<Longrightarrow> log b (real m) < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>real m < b ^ n; 1 < b; 0 < m\<rbrakk> \<Longrightarrow> log b (real m) < real n
[PROOF STEP]
by (simp add: log_less_iff powr_realpow)


[STATEMENT]
lemma (in deutsch) deutsch_algo_result [simp]:
  shows "deutsch_algo = \<psi>\<^sub>3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deutsch_algo = Tensor.mat_of_cols_list 4 (map (map complex_of_real) [[real (1 - f 0) / (2 * sqrt 2) - real (f 0) / (2 * sqrt 2) + real (1 - f 1) / (2 * sqrt 2) - real (f 1) / (2 * sqrt 2), real (f 0) / (2 * sqrt 2) - real (1 - f 0) / (2 * sqrt 2) + (real (f 1) / (2 * sqrt 2) - real (1 - f 1) / (2 * sqrt 2)), real (1 - f 0) / (2 * sqrt 2) - real (f 0) / (2 * sqrt 2) - real (1 - f 1) / (2 * sqrt 2) + real (f 1) / (2 * sqrt 2), real (f 0) / (2 * sqrt 2) - real (1 - f 0) / (2 * sqrt 2) - real (f 1) / (2 * sqrt 2) + real (1 - f 1) / (2 * sqrt 2)]])
[PROOF STEP]
using deutsch_algo_def H_on_ket_zero H_on_ket_one \<psi>\<^sub>0_to_\<psi>\<^sub>1 \<psi>\<^sub>1_to_\<psi>\<^sub>2 \<psi>\<^sub>2_to_\<psi>\<^sub>3
[PROOF STATE]
proof (prove)
using this:
deutsch_algo \<equiv> (H \<Otimes> Quantum.Id 1) * (U\<^sub>f * (H * |Deutsch.zero\<rangle> \<Otimes> H * |Deutsch.one\<rangle>))
H * |Deutsch.zero\<rangle> = Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]])
H * |Deutsch.one\<rangle> = Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, - 1 / sqrt 2]])
Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]) \<Otimes> Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, - 1 / sqrt 2]]) = \<psi>\<^sub>1
U\<^sub>f * \<psi>\<^sub>1 = Tensor.mat_of_cols_list 4 (map (map complex_of_real) [[real (1 - f 0) / 2 - real (f 0) / 2, real (f 0) / 2 - real (1 - f 0) / 2, real (1 - f 1) / 2 - real (f 1) / 2, real (f 1) / 2 - real (1 - f 1) / 2]])
(H \<Otimes> Quantum.Id 1) * Tensor.mat_of_cols_list 4 (map (map complex_of_real) [[real (1 - f 0) / 2 - real (f 0) / 2, real (f 0) / 2 - real (1 - f 0) / 2, real (1 - f 1) / 2 - real (f 1) / 2, real (f 1) / 2 - real (1 - f 1) / 2]]) = Tensor.mat_of_cols_list 4 (map (map complex_of_real) [[real (1 - f 0) / (2 * sqrt 2) - real (f 0) / (2 * sqrt 2) + real (1 - f 1) / (2 * sqrt 2) - real (f 1) / (2 * sqrt 2), real (f 0) / (2 * sqrt 2) - real (1 - f 0) / (2 * sqrt 2) + (real (f 1) / (2 * sqrt 2) - real (1 - f 1) / (2 * sqrt 2)), real (1 - f 0) / (2 * sqrt 2) - real (f 0) / (2 * sqrt 2) - real (1 - f 1) / (2 * sqrt 2) + real (f 1) / (2 * sqrt 2), real (f 0) / (2 * sqrt 2) - real (1 - f 0) / (2 * sqrt 2) - real (f 1) / (2 * sqrt 2) + real (1 - f 1) / (2 * sqrt 2)]])

goal (1 subgoal):
 1. deutsch_algo = Tensor.mat_of_cols_list 4 (map (map complex_of_real) [[real (1 - f 0) / (2 * sqrt 2) - real (f 0) / (2 * sqrt 2) + real (1 - f 1) / (2 * sqrt 2) - real (f 1) / (2 * sqrt 2), real (f 0) / (2 * sqrt 2) - real (1 - f 0) / (2 * sqrt 2) + (real (f 1) / (2 * sqrt 2) - real (1 - f 1) / (2 * sqrt 2)), real (1 - f 0) / (2 * sqrt 2) - real (f 0) / (2 * sqrt 2) - real (1 - f 1) / (2 * sqrt 2) + real (f 1) / (2 * sqrt 2), real (f 0) / (2 * sqrt 2) - real (1 - f 0) / (2 * sqrt 2) - real (f 1) / (2 * sqrt 2) + real (1 - f 1) / (2 * sqrt 2)]])
[PROOF STEP]
by simp


[STATEMENT]
lemma eventually_floor_eq:
  fixes f::"'a \<Rightarrow> 'b::{order_topology,floor_ceiling}"
  assumes f: "(f \<longlongrightarrow> l) F"
    and l: "l \<notin> \<int>"
  shows "\<forall>\<^sub>F x in F. floor (f x) = floor l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. \<lfloor>f x\<rfloor> = \<lfloor>l\<rfloor>
[PROOF STEP]
using eventually_floor_less[OF assms] eventually_less_ceiling[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. of_int \<lfloor>l\<rfloor> < f x
\<forall>\<^sub>F x in F. f x < of_int \<lceil>l\<rceil>

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. \<lfloor>f x\<rfloor> = \<lfloor>l\<rfloor>
[PROOF STEP]
by eventually_elim (meson floor_less_iff less_ceiling_iff not_less_iff_gr_or_eq)


[STATEMENT]
theorem dual_sup [iff?]:
    "is_sup (dual x) (dual y) (dual inf) = is_inf x y inf"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_sup (dual x) (dual y) (dual inf) = is_inf x y inf
[PROOF STEP]
by (simp add: is_inf_def is_sup_def dual_all [symmetric] dual_leq)


[STATEMENT]
lemma unitary_col_norm:
  assumes "unitary U"
and "U\<in> carrier_mat n n"
  and "i < n"
shows "\<parallel>Matrix.col U i\<parallel> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel> = 1
[PROOF STEP]
using assms unitary_col_norm_square cpx_vec_length_inner_prod
    inner_prod_csqrt
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.unitary U
U \<in> carrier_mat n n
i < n
\<lbrakk>Complex_Matrix.unitary ?U; ?U \<in> carrier_mat ?n ?n; ?i < ?n\<rbrakk> \<Longrightarrow> \<parallel>Matrix.col ?U ?i\<parallel>\<^sup>2 = 1
complex_of_real (\<parallel>?v\<parallel>\<^sup>2) = \<langle>?v|?v\<rangle>
csqrt \<langle>?v|?v\<rangle> = complex_of_real \<parallel>?v\<parallel>

goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel> = 1
[PROOF STEP]
by (metis csqrt_1 of_real_eq_1_iff)


[STATEMENT]
lemma integrable_on_powr2_from_0:
  fixes a c :: real
  assumes a_pos: "a > 0" and a_neq_1: "a \<noteq> 1" and c_nneg: "c \<ge> 0"
  shows "(\<lambda>x. a.^x) integrable_on {0..c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (.^) a integrable_on {0..c}
[PROOF STEP]
using has_integral_powr2_from_0[OF assms]
[PROOF STATE]
proof (prove)
using this:
((.^) a has_integral (a .^ c - 1) / ln a) {0..c}

goal (1 subgoal):
 1. (.^) a integrable_on {0..c}
[PROOF STEP]
unfolding integrable_on_def
[PROOF STATE]
proof (prove)
using this:
((.^) a has_integral (a .^ c - 1) / ln a) {0..c}

goal (1 subgoal):
 1. \<exists>y. ((.^) a has_integral y) {0..c}
[PROOF STEP]
by blast


[STATEMENT]
lemma four_block_carrier_mat[simp]:
  "A \<in> carrier_mat nr1 nc1 \<Longrightarrow> D \<in> carrier_mat nr2 nc2 \<Longrightarrow>
  four_block_mat A B C D \<in> carrier_mat (nr1 + nr2) (nc1 + nc2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat nr1 nc1; D \<in> carrier_mat nr2 nc2\<rbrakk> \<Longrightarrow> four_block_mat A B C D \<in> carrier_mat (nr1 + nr2) (nc1 + nc2)
[PROOF STEP]
unfolding carrier_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> {m. dim_row m = nr1 \<and> dim_col m = nc1}; D \<in> {m. dim_row m = nr2 \<and> dim_col m = nc2}\<rbrakk> \<Longrightarrow> four_block_mat A B C D \<in> {m. dim_row m = nr1 + nr2 \<and> dim_col m = nc1 + nc2}
[PROOF STEP]
by auto


[STATEMENT]
lemma arccos_le_mono: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> \<bar>y\<bar> \<le> 1 \<Longrightarrow> arccos x \<le> arccos y \<longleftrightarrow> y \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<bar>x\<bar> \<le> 1; \<bar>y\<bar> \<le> 1\<rbrakk> \<Longrightarrow> (arccos x \<le> arccos y) = (y \<le> x)
[PROOF STEP]
using arccos_less_mono [of y x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<bar>y\<bar> \<le> 1; \<bar>x\<bar> \<le> 1\<rbrakk> \<Longrightarrow> (arccos y < arccos x) = (x < y)

goal (1 subgoal):
 1. \<lbrakk>\<bar>x\<bar> \<le> 1; \<bar>y\<bar> \<le> 1\<rbrakk> \<Longrightarrow> (arccos x \<le> arccos y) = (y \<le> x)
[PROOF STEP]
by (simp add: not_le [symmetric])


[STATEMENT]
lemma boundedUn: "bounded (A Un B) = (bounded A & bounded B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (A \<union> B) = (bounded A \<and> bounded B)
[PROOF STEP]
apply(auto simp add: bounded_def boundedByUn)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>N Na. \<lbrakk>boundedBy N A; boundedBy Na B\<rbrakk> \<Longrightarrow> \<exists>N. boundedBy N A \<and> boundedBy N B
[PROOF STEP]
apply(rule_tac x="N+Na" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>N Na. \<lbrakk>boundedBy N A; boundedBy Na B\<rbrakk> \<Longrightarrow> boundedBy (N + Na) A \<and> boundedBy (N + Na) B
[PROOF STEP]
apply(blast intro: boundedByAdd1 boundedByAdd2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem (in linear_map) rank_nullity:
  assumes fd: "V.fin_dim"
  shows "(vectorspace.dim K (W.vs imT)) + (vectorspace.dim K (V.vs kerT)) = V.dim"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim K (W.vs imT) + vectorspace.dim K (V.vs kerT) = V.dim
[PROOF STEP]
by (rule rank_nullity_main[OF fd])


[STATEMENT]
lemma quantum_payoff_simp:
  fixes x y:: real
  shows "3 * (cmod (complex_of_real (sin x) * complex_of_real (cos y)))\<^sup>2 +
         (cmod (complex_of_real (cos x) * complex_of_real (cos y)))\<^sup>2 =
         2 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + (cos y)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 * (cmod (complex_of_real (sin x) * complex_of_real (cos y)))\<^sup>2 + (cmod (complex_of_real (cos x) * complex_of_real (cos y)))\<^sup>2 = 2 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + (cos y)\<^sup>2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 3 * (cmod (complex_of_real (sin x) * complex_of_real (cos y)))\<^sup>2 + (cmod (complex_of_real (cos x) * complex_of_real (cos y)))\<^sup>2 = 2 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + (cos y)\<^sup>2
[PROOF STEP]
have "3 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + (cos x)\<^sup>2 * (cos y)\<^sup>2 =
        (2 * (sin x)\<^sup>2 * (cos y)\<^sup>2) + ((sin x)\<^sup>2 + (cos x)\<^sup>2) * (cos y)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + (cos x)\<^sup>2 * (cos y)\<^sup>2 = 2 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + ((sin x)\<^sup>2 + (cos x)\<^sup>2) * (cos y)\<^sup>2
[PROOF STEP]
by (auto simp add: algebra_simps simp del: sin_cos_squared_add2)
[PROOF STATE]
proof (state)
this:
3 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + (cos x)\<^sup>2 * (cos y)\<^sup>2 = 2 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + ((sin x)\<^sup>2 + (cos x)\<^sup>2) * (cos y)\<^sup>2

goal (1 subgoal):
 1. 3 * (cmod (complex_of_real (sin x) * complex_of_real (cos y)))\<^sup>2 + (cmod (complex_of_real (cos x) * complex_of_real (cos y)))\<^sup>2 = 2 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + (cos y)\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
3 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + (cos x)\<^sup>2 * (cos y)\<^sup>2 = 2 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + ((sin x)\<^sup>2 + (cos x)\<^sup>2) * (cos y)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
3 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + (cos x)\<^sup>2 * (cos y)\<^sup>2 = 2 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + ((sin x)\<^sup>2 + (cos x)\<^sup>2) * (cos y)\<^sup>2

goal (1 subgoal):
 1. 3 * (cmod (complex_of_real (sin x) * complex_of_real (cos y)))\<^sup>2 + (cmod (complex_of_real (cos x) * complex_of_real (cos y)))\<^sup>2 = 2 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + (cos y)\<^sup>2
[PROOF STEP]
by (simp add: cmod_real_prod_squared power_mult_distrib)
[PROOF STATE]
proof (state)
this:
3 * (cmod (complex_of_real (sin x) * complex_of_real (cos y)))\<^sup>2 + (cmod (complex_of_real (cos x) * complex_of_real (cos y)))\<^sup>2 = 2 * (sin x)\<^sup>2 * (cos y)\<^sup>2 + (cos y)\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma top_ccsubspace_code[code]:
  \<comment> \<open>Code equation for \<^term>\<open>top\<close>, the subspace containing everything.
      Top is represented as the span of the standard basis vectors.\<close>
  "(top::'a ccsubspace) =
      (let n = length (canonical_basis :: 'a::onb_enum list) in SPAN (unit_vecs n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<top> = (let n = length canonical_basis in SPAN (unit_vecs n))
[PROOF STEP]
unfolding SPAN_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<top> = (let n = length canonical_basis; na = length canonical_basis in ccspan (basis_enum_of_vec ` Set.filter (\<lambda>v. dim_vec v = na) (set (unit_vecs n))))
[PROOF STEP]
apply (simp only: index_unit_vec Let_def map_filter_map_filter filter_set image_set map_map_filter
      map_filter_map o_def unit_vecs_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<top> = ccspan (set (List.map_filter (\<lambda>x. if length canonical_basis = length canonical_basis then Some (basis_enum_of_vec (unit_vec (length canonical_basis) x)) else None) [0..<length canonical_basis]))
[PROOF STEP]
apply (simp add: basis_enum_of_vec_unit_vec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<top> = ccspan ((!) canonical_basis ` {0..<length canonical_basis})
[PROOF STEP]
apply (subst nth_image)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length canonical_basis \<le> length canonical_basis
 2. \<top> = ccspan (set (take (length canonical_basis) canonical_basis))
[PROOF STEP]
by auto


[STATEMENT]
lemma sin_pi_half [simp]: "sin(pi/2) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (pi / 2) = 1
[PROOF STEP]
using sin_cos_squared_add2 [where x = "pi/2"]
[PROOF STATE]
proof (prove)
using this:
(cos (pi / 2))\<^sup>2 + (sin (pi / 2))\<^sup>2 = 1

goal (1 subgoal):
 1. sin (pi / 2) = 1
[PROOF STEP]
using sin_gt_zero_02 [OF pi_half_gt_zero pi_half_less_two]
[PROOF STATE]
proof (prove)
using this:
(cos (pi / 2))\<^sup>2 + (sin (pi / 2))\<^sup>2 = 1
0 < sin (pi / 2)

goal (1 subgoal):
 1. sin (pi / 2) = 1
[PROOF STEP]
by (simp add: power2_eq_1_iff)


[STATEMENT]
lemma job_dist_lower_bound_makespan:
  assumes "lb T A j"
  shows "(\<Sum>x \<in> {1..j}. t x) / m \<le> makespan T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (sum t {1..j}) / real m \<le> real (makespan T)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (sum t {1..j}) / real m \<le> real (makespan T)
[PROOF STEP]
have "(\<Sum>x \<in> {1..j}. t x) \<le> m * makespan T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum t {1..j} \<le> m * makespan T
[PROOF STEP]
using assms lb_impl_job_sum[symmetric]
      and sum_le_card_Max[of "{1..m}"] m_gt_0
[PROOF STATE]
proof (prove)
using this:
lb T A j
lb ?T ?A ?j \<Longrightarrow> sum t {1..?j} = sum ?T {1..m}
\<lbrakk>finite {1..m}; {1..m} \<noteq> {}\<rbrakk> \<Longrightarrow> sum ?f {1..m} \<le> card {1..m} * Max (?f ` {1..m})
0 < m

goal (1 subgoal):
 1. sum t {1..j} \<le> m * makespan T
[PROOF STEP]
by (simp add: makespan_def')
[PROOF STATE]
proof (state)
this:
sum t {1..j} \<le> m * makespan T

goal (1 subgoal):
 1. real (sum t {1..j}) / real m \<le> real (makespan T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sum t {1..j} \<le> m * makespan T
[PROOF STEP]
have "real (\<Sum>x \<in> {1..j}. t x) \<le> real m * real (makespan T)"
[PROOF STATE]
proof (prove)
using this:
sum t {1..j} \<le> m * makespan T

goal (1 subgoal):
 1. real (sum t {1..j}) \<le> real m * real (makespan T)
[PROOF STEP]
using of_nat_mono
[PROOF STATE]
proof (prove)
using this:
sum t {1..j} \<le> m * makespan T
?i \<le> ?j \<Longrightarrow> of_nat ?i \<le> of_nat ?j

goal (1 subgoal):
 1. real (sum t {1..j}) \<le> real m * real (makespan T)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
real (sum t {1..j}) \<le> real m * real (makespan T)

goal (1 subgoal):
 1. real (sum t {1..j}) / real m \<le> real (makespan T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (sum t {1..j}) \<le> real m * real (makespan T)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (sum t {1..j}) \<le> real m * real (makespan T)

goal (1 subgoal):
 1. real (sum t {1..j}) / real m \<le> real (makespan T)
[PROOF STEP]
by (simp add: field_simps m_gt_0)
[PROOF STATE]
proof (state)
this:
real (sum t {1..j}) / real m \<le> real (makespan T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_less_0_iff:
  fixes f :: "_ \<Rightarrow> 'a :: {comm_monoid_add,ordered_ab_group_add}"
  shows "finite A \<Longrightarrow> (\<And>i. i \<in> A \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> 0 < (\<Sum>i\<in>A. f i) \<longleftrightarrow> (\<exists>i\<in>A. 0 < f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; \<And>i. i \<in> A \<Longrightarrow> (0::'a) \<le> f i\<rbrakk> \<Longrightarrow> ((0::'a) < sum f A) = (\<exists>i\<in>A. (0::'a) < f i)
[PROOF STEP]
using sum_nonneg[of A f] sum_eq_0_iff[of A f]
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> A \<Longrightarrow> (0::'a) \<le> f x) \<Longrightarrow> (0::'a) \<le> sum f A
\<lbrakk>finite A; \<And>i. i \<in> A \<Longrightarrow> (0::'a) \<le> f i\<rbrakk> \<Longrightarrow> (sum f A = (0::'a)) = (\<forall>i\<in>A. f i = (0::'a))

goal (1 subgoal):
 1. \<lbrakk>finite A; \<And>i. i \<in> A \<Longrightarrow> (0::'a) \<le> f i\<rbrakk> \<Longrightarrow> ((0::'a) < sum f A) = (\<exists>i\<in>A. (0::'a) < f i)
[PROOF STEP]
by (simp add: less_le)


[STATEMENT]
lemma product_partition:
  assumes "partition_on A P" and "\<And>p. p \<in> P \<Longrightarrow> finite p"
  shows "card A = (\<Sum>p\<in>P. card p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A = sum card P
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
partition_on A P
?p \<in> P \<Longrightarrow> finite ?p

goal (1 subgoal):
 1. card A = sum card P
[PROOF STEP]
unfolding partition_on_def
[PROOF STATE]
proof (prove)
using this:
\<Union> P = A \<and> disjoint P \<and> {} \<notin> P
?p \<in> P \<Longrightarrow> finite ?p

goal (1 subgoal):
 1. card A = sum card P
[PROOF STEP]
by (meson card_Union_disjoint)


[STATEMENT]
lemma card_singletons:
  assumes "finite S" shows "card {{v} | v. v \<in> S} = card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {{v} |v. v \<in> S} = card S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. card {{v} |v. v \<in> S} = card S
[PROOF STEP]
proof (induct S rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card {{v} |v. v \<in> {}} = card {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. card {{v} |v. v \<in> {}} = card {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {{v} |v. v \<in> {}} = card {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {{v} |v. v \<in> {}} = card {}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
card {{v} |v. v \<in> F} = card F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
card {{v} |v. v \<in> F} = card F
[PROOF STEP]
have disj: "{{x}} \<inter> {{v} |v. v \<in> F} = {}"
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
card {{v} |v. v \<in> F} = card F

goal (1 subgoal):
 1. {{x}} \<inter> {{v} |v. v \<in> F} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{{x}} \<inter> {{v} |v. v \<in> F} = {}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
have "{{v} |v. v \<in> insert x F} = ({{x}} \<union> {{v} |v. v \<in> F})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {{v} |v. v \<in> insert x F} = {{x}} \<union> {{v} |v. v \<in> F}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{{v} |v. v \<in> insert x F} = {{x}} \<union> {{v} |v. v \<in> F}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{{v} |v. v \<in> insert x F} = {{x}} \<union> {{v} |v. v \<in> F}
[PROOF STEP]
have "card {{v} |v. v \<in> insert x F} = card ({{x}} \<union> {{v} |v. v \<in> F})"
[PROOF STATE]
proof (prove)
using this:
{{v} |v. v \<in> insert x F} = {{x}} \<union> {{v} |v. v \<in> F}

goal (1 subgoal):
 1. card {{v} |v. v \<in> insert x F} = card ({{x}} \<union> {{v} |v. v \<in> F})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {{v} |v. v \<in> insert x F} = card ({{x}} \<union> {{v} |v. v \<in> F})

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {{v} |v. v \<in> insert x F} = card ({{x}} \<union> {{v} |v. v \<in> F})

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
have "... = card {{x}} + card {{v} |v. v \<in> F}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({{x}} \<union> {{v} |v. v \<in> F}) = card {{x}} + card {{v} |v. v \<in> F}
[PROOF STEP]
using card_Un_disjoint disj assms finite_subset
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; finite ?B; ?A \<inter> ?B = {}\<rbrakk> \<Longrightarrow> card (?A \<union> ?B) = card ?A + card ?B
{{x}} \<inter> {{v} |v. v \<in> F} = {}
finite S
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. card ({{x}} \<union> {{v} |v. v \<in> F}) = card {{x}} + card {{v} |v. v \<in> F}
[PROOF STEP]
using insert.hyps(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; finite ?B; ?A \<inter> ?B = {}\<rbrakk> \<Longrightarrow> card (?A \<union> ?B) = card ?A + card ?B
{{x}} \<inter> {{v} |v. v \<in> F} = {}
finite S
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
finite F

goal (1 subgoal):
 1. card ({{x}} \<union> {{v} |v. v \<in> F}) = card {{x}} + card {{v} |v. v \<in> F}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
card ({{x}} \<union> {{v} |v. v \<in> F}) = card {{x}} + card {{v} |v. v \<in> F}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ({{x}} \<union> {{v} |v. v \<in> F}) = card {{x}} + card {{v} |v. v \<in> F}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
have "... = 1 + card {{v} |v. v \<in> F}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {{x}} + card {{v} |v. v \<in> F} = 1 + card {{v} |v. v \<in> F}
[PROOF STEP]
using is_singleton_altdef
[PROOF STATE]
proof (prove)
using this:
is_singleton ?A = (card ?A = 1)

goal (1 subgoal):
 1. card {{x}} + card {{v} |v. v \<in> F} = 1 + card {{v} |v. v \<in> F}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {{x}} + card {{v} |v. v \<in> F} = 1 + card {{v} |v. v \<in> F}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {{x}} + card {{v} |v. v \<in> F} = 1 + card {{v} |v. v \<in> F}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
have "... = 1 + card F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + card {{v} |v. v \<in> F} = 1 + card F
[PROOF STEP]
using insert.hyps
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
card {{v} |v. v \<in> F} = card F

goal (1 subgoal):
 1. 1 + card {{v} |v. v \<in> F} = 1 + card F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 + card {{v} |v. v \<in> F} = 1 + card F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card {{v} |v. v \<in> F} = card F\<rbrakk> \<Longrightarrow> card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {{v} |v. v \<in> insert x F} = 1 + card F
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card {{v} |v. v \<in> insert x F} = 1 + card F

goal (1 subgoal):
 1. card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
using insert.hyps(1) insert.hyps(2)
[PROOF STATE]
proof (prove)
using this:
card {{v} |v. v \<in> insert x F} = 1 + card F
finite F
x \<notin> F

goal (1 subgoal):
 1. card {{v} |v. v \<in> insert x F} = card (insert x F)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
card {{v} |v. v \<in> insert x F} = card (insert x F)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma binomial_symmetric:
  assumes kn: "k \<le> n"
  shows "n choose k = n choose (n - k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose k = n choose (n - k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n choose k = n choose (n - k)
[PROOF STEP]
have kn': "n - k \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n - k \<le> n
[PROOF STEP]
using kn
[PROOF STATE]
proof (prove)
using this:
k \<le> n

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

goal (1 subgoal):
 1. n choose k = n choose (n - k)
[PROOF STEP]
from binomial_fact_lemma[OF kn] binomial_fact_lemma[OF kn']
[PROOF STATE]
proof (chain)
picking this:
fact k * fact (n - k) * (n choose k) = fact n
fact (n - k) * fact (n - (n - k)) * (n choose (n - k)) = fact n
[PROOF STEP]
have "fact k * fact (n - k) * (n choose k) = fact (n - k) * fact (n - (n - k)) * (n choose (n - k))"
[PROOF STATE]
proof (prove)
using this:
fact k * fact (n - k) * (n choose k) = fact n
fact (n - k) * fact (n - (n - k)) * (n choose (n - k)) = fact n

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

goal (1 subgoal):
 1. n choose k = n choose (n - k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fact k * fact (n - k) * (n choose k) = fact (n - k) * fact (n - (n - k)) * (n choose (n - k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fact k * fact (n - k) * (n choose k) = fact (n - k) * fact (n - (n - k)) * (n choose (n - k))

goal (1 subgoal):
 1. n choose k = n choose (n - k)
[PROOF STEP]
using kn
[PROOF STATE]
proof (prove)
using this:
fact k * fact (n - k) * (n choose k) = fact (n - k) * fact (n - (n - k)) * (n choose (n - k))
k \<le> n

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma borel_sigma_sets_Ioc: "borel = sigma UNIV (range (\<lambda>(a, b). {a <.. b::real}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. borel = sigma UNIV (range (\<lambda>(a, b). {a<..b}))
[PROOF STEP]
proof (rule borel_eq_sigmaI5[OF borel_eq_atMost])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. {..a} \<in> sets (sigma UNIV (range (\<lambda>(a, b). {a<..b})))
 2. \<And>a b. {a<..b} \<in> sets borel
[PROOF STEP]
fix i :: real
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. {..a} \<in> sets (sigma UNIV (range (\<lambda>(a, b). {a<..b})))
 2. \<And>a b. {a<..b} \<in> sets borel
[PROOF STEP]
have "{..i} = (\<Union>j::nat. {-j <.. i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..i} = (\<Union>x. {- real x<..i})
[PROOF STEP]
by (auto simp: minus_less_iff reals_Archimedean2)
[PROOF STATE]
proof (state)
this:
{..i} = (\<Union>x. {- real x<..i})

goal (2 subgoals):
 1. \<And>a. {..a} \<in> sets (sigma UNIV (range (\<lambda>(a, b). {a<..b})))
 2. \<And>a b. {a<..b} \<in> sets borel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{..i} = (\<Union>x. {- real x<..i})

goal (2 subgoals):
 1. \<And>a. {..a} \<in> sets (sigma UNIV (range (\<lambda>(a, b). {a<..b})))
 2. \<And>a b. {a<..b} \<in> sets borel
[PROOF STEP]
have "\<dots> \<in> sets (sigma UNIV (range (\<lambda>(i, j). {i<..j})))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x. {- real x<..i}) \<in> sets (sigma UNIV (range (\<lambda>(i, j). {i<..j})))
[PROOF STEP]
by (intro sets.countable_nat_UN) auto
[PROOF STATE]
proof (state)
this:
(\<Union>x. {- real x<..i}) \<in> sets (sigma UNIV (range (\<lambda>(i, j). {i<..j})))

goal (2 subgoals):
 1. \<And>a. {..a} \<in> sets (sigma UNIV (range (\<lambda>(a, b). {a<..b})))
 2. \<And>a b. {a<..b} \<in> sets borel
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
{..i} \<in> sets (sigma UNIV (range (\<lambda>(i, j). {i<..j})))
[PROOF STEP]
show "{..i} \<in> sets (sigma UNIV (range (\<lambda>(i, j). {i<..j})))"
[PROOF STATE]
proof (prove)
using this:
{..i} \<in> sets (sigma UNIV (range (\<lambda>(i, j). {i<..j})))

goal (1 subgoal):
 1. {..i} \<in> sets (sigma UNIV (range (\<lambda>(i, j). {i<..j})))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
{..i} \<in> sets (sigma UNIV (range (\<lambda>(i, j). {i<..j})))

goal (1 subgoal):
 1. \<And>a b. {a<..b} \<in> sets borel
[PROOF STEP]
qed simp


[STATEMENT]
lemma dim_kernel_zero_jordan_block_pow:
  "kernel.dim n ((jordan_block n (0 :: 'a)) ^\<^sub>m k) = min k n" (is "kernel.dim _ ?A = ?c")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
have A: "?A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jordan_block n (0::'a) ^\<^sub>m k \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jordan_block n (0::'a) ^\<^sub>m k \<in> carrier_mat n n

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
hence dim: "dim_row ?A = n"
[PROOF STATE]
proof (prove)
using this:
jordan_block n (0::'a) ^\<^sub>m k \<in> carrier_mat n n

goal (1 subgoal):
 1. dim_row (jordan_block n (0::'a) ^\<^sub>m k) = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row (jordan_block n (0::'a) ^\<^sub>m k) = n

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
let ?f = "\<lambda> i. min (k + i) n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
have piv: "pivot_fun ?A ?f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pivot_fun (jordan_block n (0::'a) ^\<^sub>m k) (\<lambda>i. min (k + i) n) n
[PROOF STEP]
unfolding jordan_block_zero_pow
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pivot_fun (mat n n (\<lambda>(i, j). if i \<le> j \<and> j - i = k then 1::'a else (0::'a))) (\<lambda>i. min (k + i) n) n
[PROOF STEP]
by (intro pivot_funI, auto)
[PROOF STATE]
proof (state)
this:
pivot_fun (jordan_block n (0::'a) ^\<^sub>m k) (\<lambda>i. min (k + i) n) n

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
hence row: "row_echelon_form ?A"
[PROOF STATE]
proof (prove)
using this:
pivot_fun (jordan_block n (0::'a) ^\<^sub>m k) (\<lambda>i. min (k + i) n) n

goal (1 subgoal):
 1. row_echelon_form (jordan_block n (0::'a) ^\<^sub>m k)
[PROOF STEP]
unfolding row_echelon_form_def
[PROOF STATE]
proof (prove)
using this:
pivot_fun (jordan_block n (0::'a) ^\<^sub>m k) (\<lambda>i. min (k + i) n) n

goal (1 subgoal):
 1. \<exists>f. pivot_fun (jordan_block n (0::'a) ^\<^sub>m k) f (dim_col (jordan_block n (0::'a) ^\<^sub>m k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_echelon_form (jordan_block n (0::'a) ^\<^sub>m k)

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
from find_base_vectors(5-6)[OF row A]
[PROOF STATE]
proof (chain)
picking this:
length (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k)) = card {i. i < n \<and> row (jordan_block n (0::'a) ^\<^sub>m k) i \<noteq> 0\<^sub>v n}
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = n - card {i. i < n \<and> row (jordan_block n (0::'a) ^\<^sub>m k) i \<noteq> 0\<^sub>v n}
[PROOF STEP]
have "kernel.dim n ?A = n - length (map fst (pivot_positions ?A))"
[PROOF STATE]
proof (prove)
using this:
length (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k)) = card {i. i < n \<and> row (jordan_block n (0::'a) ^\<^sub>m k) i \<noteq> 0\<^sub>v n}
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = n - card {i. i < n \<and> row (jordan_block n (0::'a) ^\<^sub>m k) i \<noteq> 0\<^sub>v n}

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = n - length (map fst (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = n - length (map fst (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k)))

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = n - length (map fst (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k)))

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
have "length (map fst (pivot_positions ?A)) = card (fst ` set (pivot_positions ?A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map fst (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k))) = card (fst ` set (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k)))
[PROOF STEP]
by (subst distinct_card[OF pivot_positions(2)[OF A piv], symmetric], simp)
[PROOF STATE]
proof (state)
this:
length (map fst (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k))) = card (fst ` set (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k)))

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (map fst (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k))) = card (fst ` set (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k)))

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
have "fst ` set (pivot_positions ?A) = { 0 ..< (n - ?c)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst ` set (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k)) = {0..<n - min k n}
[PROOF STEP]
unfolding pivot_positions(1)[OF A piv]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst ` {(i, min (k + i) n) |i. i < n \<and> min (k + i) n \<noteq> n} = {0..<n - min k n}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
fst ` set (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k)) = {0..<n - min k n}

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fst ` set (pivot_positions (jordan_block n (0::'a) ^\<^sub>m k)) = {0..<n - min k n}

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
have "card \<dots> = n - ?c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {0..<n - min k n} = n - min k n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {0..<n - min k n} = n - min k n

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = n - (n - min k n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = n - (n - min k n)

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Gcd_minors_dvd_diag_PAQ:
  fixes P A Q::"'a::{semiring_Gcd,comm_ring_1} mat"
 assumes A: "A \<in> carrier_mat m n"
    and P: "P \<in> carrier_mat m m"
    and Q: "Q \<in> carrier_mat n n"
    and SNF: "Smith_normal_form_mat (P*A*Q)"
    and k: "k\<le>min m n"
  shows "Gcd (minors A k) dvd (\<Prod>i=0..<k. (P * A * Q) $$ (i,i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd (minors A k) dvd (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Gcd (minors A k) dvd (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i))
[PROOF STEP]
have "Gcd (minors A k) dvd Gcd (minors (P * A * Q) k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd (minors A k) dvd Gcd (minors (P * A * Q) k)
[PROOF STEP]
by (rule Gcd_minors_A_dvd_Gcd_minors_PAQ[OF A P Q])
[PROOF STATE]
proof (state)
this:
Gcd (minors A k) dvd Gcd (minors (P * A * Q) k)

goal (1 subgoal):
 1. Gcd (minors A k) dvd (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Gcd (minors A k) dvd Gcd (minors (P * A * Q) k)

goal (1 subgoal):
 1. Gcd (minors A k) dvd (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i))
[PROOF STEP]
have "... dvd (\<Prod>i=0..<k. (P*A*Q) $$ (i,i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd (minors (P * A * Q) k) dvd (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i))
[PROOF STEP]
by (rule Gcd_minors_dvd_diagonal[OF _ SNF k], insert P A Q, auto)
[PROOF STATE]
proof (state)
this:
Gcd (minors (P * A * Q) k) dvd (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i))

goal (1 subgoal):
 1. Gcd (minors A k) dvd (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Gcd (minors A k) dvd (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Gcd (minors A k) dvd (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i))

goal (1 subgoal):
 1. Gcd (minors A k) dvd (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Gcd (minors A k) dvd (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vector_sub_project_orthogonal_proj:
  fixes b x :: "'a::euclidean_space"
  shows "inner b (x - proj x b) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<bullet> (x - proj x b) = 0
[PROOF STEP]
using vector_sub_project_orthogonal
[PROOF STATE]
proof (prove)
using this:
?b \<bullet> (?x - (?b \<bullet> ?x / (?b \<bullet> ?b)) *\<^sub>R ?b) = 0

goal (1 subgoal):
 1. b \<bullet> (x - proj x b) = 0
[PROOF STEP]
unfolding proj_def inner_commute[of x b]
[PROOF STATE]
proof (prove)
using this:
?b \<bullet> (?x - (?b \<bullet> ?x / (?b \<bullet> ?b)) *\<^sub>R ?b) = 0

goal (1 subgoal):
 1. b \<bullet> (x - (b \<bullet> x / (b \<bullet> b)) *\<^sub>R b) = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma dim_left_null_space_space_iarray[code_unfold]:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}"
  shows "vec.dim (left_null_space A) = nrows_iarray (matrix_to_iarray A) - rank_iarray (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (left_null_space A) = nrows_iarray (matrix_to_iarray A) - rank_iarray (matrix_to_iarray A)
[PROOF STEP]
unfolding dim_left_null_space nrows_eq_card_rows matrix_to_iarray_rank dimension_vector
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('rows) - rank_iarray (matrix_to_iarray A) = CARD('rows) - rank_iarray (matrix_to_iarray A)
[PROOF STEP]
by auto


[STATEMENT]
lemma closure_aff_dim [simp]:
  fixes S :: "'n::euclidean_space set"
  shows "aff_dim (closure S) = aff_dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (closure S) = aff_dim S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aff_dim (closure S) = aff_dim S
[PROOF STEP]
have "aff_dim S \<le> aff_dim (closure S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S \<le> aff_dim (closure S)
[PROOF STEP]
using aff_dim_subset closure_subset
[PROOF STATE]
proof (prove)
using this:
?S \<subseteq> ?T \<Longrightarrow> aff_dim ?S \<le> aff_dim ?T
?S \<subseteq> closure ?S

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim (closure S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
aff_dim S \<le> aff_dim (closure S)

goal (1 subgoal):
 1. aff_dim (closure S) = aff_dim S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
aff_dim S \<le> aff_dim (closure S)

goal (1 subgoal):
 1. aff_dim (closure S) = aff_dim S
[PROOF STEP]
have "aff_dim (closure S) \<le> aff_dim (affine hull S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (closure S) \<le> aff_dim (affine hull S)
[PROOF STEP]
using aff_dim_subset closure_affine_hull
[PROOF STATE]
proof (prove)
using this:
?S \<subseteq> ?T \<Longrightarrow> aff_dim ?S \<le> aff_dim ?T
closure ?S \<subseteq> affine hull ?S

goal (1 subgoal):
 1. aff_dim (closure S) \<le> aff_dim (affine hull S)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
aff_dim (closure S) \<le> aff_dim (affine hull S)

goal (1 subgoal):
 1. aff_dim (closure S) = aff_dim S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
aff_dim (closure S) \<le> aff_dim (affine hull S)

goal (1 subgoal):
 1. aff_dim (closure S) = aff_dim S
[PROOF STEP]
have "aff_dim (affine hull S) = aff_dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull S) = aff_dim S
[PROOF STEP]
using aff_dim_affine_hull
[PROOF STATE]
proof (prove)
using this:
aff_dim (affine hull ?S) = aff_dim ?S

goal (1 subgoal):
 1. aff_dim (affine hull S) = aff_dim S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull S) = aff_dim S

goal (1 subgoal):
 1. aff_dim (closure S) = aff_dim S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
aff_dim S \<le> aff_dim (closure S)
aff_dim (closure S) \<le> aff_dim (affine hull S)
aff_dim (affine hull S) = aff_dim S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
aff_dim S \<le> aff_dim (closure S)
aff_dim (closure S) \<le> aff_dim (affine hull S)
aff_dim (affine hull S) = aff_dim S

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Cauchy_Schwarz_eq2_iff:
  "\<bar>inner x y\<bar> = norm x * norm y \<longleftrightarrow> ((\<exists>k. x = k *\<^sub>R y) \<or> y = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>x \<bullet> y\<bar> = norm x * norm y) = ((\<exists>k. x = k *\<^sub>R y) \<or> y = (0::'a))
[PROOF STEP]
using Cauchy_Schwarz_eq_iff[of x y]
[PROOF STATE]
proof (prove)
using this:
((x \<bullet> y)\<^sup>2 = x \<bullet> x * (y \<bullet> y)) = ((\<exists>k. x = k *\<^sub>R y) \<or> y = (0::'a))

goal (1 subgoal):
 1. (\<bar>x \<bullet> y\<bar> = norm x * norm y) = ((\<exists>k. x = k *\<^sub>R y) \<or> y = (0::'a))
[PROOF STEP]
by (subst power_eq_iff_eq_base[symmetric, where n = 2])
     (simp_all add: dot_square_norm power_mult_distrib)


[STATEMENT]
lemma transpose_matrix_minus: "transpose_matrix (-(A::('a::group_add) matrix)) = - transpose_matrix (A::'a matrix)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose_matrix (- A) = - transpose_matrix A
[PROOF STEP]
by (simp add: minus_matrix_def transpose_apply_matrix)


[STATEMENT]
lemma card_union': "(finite s) \<and> (finite t) \<and> (disjnt s t) \<Longrightarrow> (card (s \<union> t) = card s + card t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite s \<and> finite t \<and> disjnt s t \<Longrightarrow> card (s \<union> t) = card s + card t
[PROOF STEP]
by (simp add: card_Un_disjoint disjnt_def)


[STATEMENT]
lemma dim_null_space[code_unfold]:
  fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
  shows "vec.dim (null_space A) = (vec.dimension TYPE('a) TYPE('cols)) - rank (A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (null_space A) = finite_dimensional_vector_space.dimension cart_basis - rank A
[PROOF STEP]
apply (rule add_implies_diff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (null_space A) + rank A = finite_dimensional_vector_space.dimension cart_basis
[PROOF STEP]
using rank_nullity_theorem_matrices
[PROOF STATE]
proof (prove)
using this:
ncols ?A = vec.dim (null_space ?A) + vec.dim (col_space ?A)

goal (1 subgoal):
 1. vec.dim (null_space A) + rank A = finite_dimensional_vector_space.dimension cart_basis
[PROOF STEP]
unfolding rank_eq_dim_col_space[of A]
[PROOF STATE]
proof (prove)
using this:
ncols ?A = vec.dim (null_space ?A) + vec.dim (col_space ?A)

goal (1 subgoal):
 1. vec.dim (null_space A) + vec.dim (col_space A) = finite_dimensional_vector_space.dimension cart_basis
[PROOF STEP]
unfolding dimension_vector ncols_def
[PROOF STATE]
proof (prove)
using this:
CARD(?'cols) = vec.dim (null_space ?A) + vec.dim (col_space ?A)

goal (1 subgoal):
 1. vec.dim (null_space A) + vec.dim (col_space A) = CARD('cols)
[PROOF STEP]
..


[STATEMENT]
lemma matrix_vector_right_distrib_minus:
  fixes A::"'a::{ring_1}^'n^'m"
  shows "A *v (b - c) = (A *v b) - (A *v c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v (b - c) = A *v b - A *v c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A *v (b - c) = A *v b - A *v c
[PROOF STEP]
have "A *v (b - c) = A *v (b + - c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v (b - c) = A *v (b + - c)
[PROOF STEP]
by (metis diff_minus_eq_add minus_minus)
[PROOF STATE]
proof (state)
this:
A *v (b - c) = A *v (b + - c)

goal (1 subgoal):
 1. A *v (b - c) = A *v b - A *v c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A *v (b - c) = A *v (b + - c)

goal (1 subgoal):
 1. A *v (b - c) = A *v b - A *v c
[PROOF STEP]
have "... = (A *v b) + (A *v (- c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v (b + - c) = A *v b + A *v - c
[PROOF STEP]
unfolding matrix_vector_right_distrib
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v b + A *v - c = A *v b + A *v - c
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
A *v (b + - c) = A *v b + A *v - c

goal (1 subgoal):
 1. A *v (b - c) = A *v b - A *v c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A *v (b + - c) = A *v b + A *v - c

goal (1 subgoal):
 1. A *v (b - c) = A *v b - A *v c
[PROOF STEP]
have "... = (A *v b) - (A *v c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v b + A *v - c = A *v b - A *v c
[PROOF STEP]
by (metis (no_types, opaque_lifting) add.commute add_minus_cancel
        matrix_vector_right_distrib uminus_add_conv_diff)
[PROOF STATE]
proof (state)
this:
A *v b + A *v - c = A *v b - A *v c

goal (1 subgoal):
 1. A *v (b - c) = A *v b - A *v c
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A *v (b - c) = A *v b - A *v c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A *v (b - c) = A *v b - A *v c

goal (1 subgoal):
 1. A *v (b - c) = A *v b - A *v c
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
A *v (b - c) = A *v b - A *v c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zipWithS_fix_ind_lemma:
  fixes P Q :: "nat \<Rightarrow> nat \<Rightarrow> bool"
  assumes P_0: "\<And>j. P 0 j" and P_Suc: "\<And>i j. P i j \<Longrightarrow> Q i j \<Longrightarrow> P (Suc i) j"
  assumes Q_0: "\<And>i. Q i 0" and Q_Suc: "\<And>i j. P i j \<Longrightarrow> Q i j \<Longrightarrow> Q i (Suc j)"
  shows "P i j \<and> Q i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P i j \<and> Q i j
[PROOF STEP]
apply (induct n \<equiv> "i + j" arbitrary: i j)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i j. 0 = i + j \<Longrightarrow> P i j \<and> Q i j
 2. \<And>n i j. \<lbrakk>\<And>i j. n = i + j \<Longrightarrow> P i j \<and> Q i j; Suc n = i + j\<rbrakk> \<Longrightarrow> P i j \<and> Q i j
[PROOF STEP]
apply (simp add: P_0 Q_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n i j. \<lbrakk>\<And>i j. n = i + j \<Longrightarrow> P i j \<and> Q i j; Suc n = i + j\<rbrakk> \<Longrightarrow> P i j \<and> Q i j
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n i j. \<lbrakk>\<And>i j. n = i + j \<Longrightarrow> P i j \<and> Q i j; Suc n = i + j\<rbrakk> \<Longrightarrow> P i j
 2. \<And>n i j. \<lbrakk>\<And>i j. n = i + j \<Longrightarrow> P i j \<and> Q i j; Suc n = i + j\<rbrakk> \<Longrightarrow> Q i j
[PROOF STEP]
apply (case_tac i, simp add: P_0, simp add: P_Suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n i j. \<lbrakk>\<And>i j. n = i + j \<Longrightarrow> P i j \<and> Q i j; Suc n = i + j\<rbrakk> \<Longrightarrow> Q i j
[PROOF STEP]
apply (case_tac j, simp add: Q_0, simp add: Q_Suc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma complex_quadratic_equation_monic_roots:
  fixes \<xi> :: complex
  assumes "\<xi> = (-b + ccsqrt(b\<^sup>2 - 4*c)) / 2 \<or>
           \<xi> = (-b - ccsqrt(b\<^sup>2 - 4*c)) / 2"
  shows  "\<xi>\<^sup>2 + b * \<xi> + c = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<xi>\<^sup>2 + b * \<xi> + c = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * c)) / 2 \<or> \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * c)) / 2

goal (1 subgoal):
 1. \<xi>\<^sup>2 + b * \<xi> + c = 0
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * c)) / 2 \<Longrightarrow> \<xi>\<^sup>2 + b * \<xi> + c = 0
 2. \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * c)) / 2 \<Longrightarrow> \<xi>\<^sup>2 + b * \<xi> + c = 0
[PROOF STEP]
assume *: "\<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * c)) / 2"
[PROOF STATE]
proof (state)
this:
\<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * c)) / 2

goal (2 subgoals):
 1. \<xi> = (- b + ccsqrt (b\<^sup>2 - 4 * c)) / 2 \<Longrightarrow> \<xi>\<^sup>2 + b * \<xi> + c = 0
 2. \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * c)) / 2 \<Longrightarrow> \<xi>\<^sup>2 + b * \<xi> + c = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<xi>\<^sup>2 + b * \<xi> + c = 0
[PROOF STEP]
by ((subst *)+) (subst power_divide, subst power2_sum, simp add: field_simps, simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
\<xi>\<^sup>2 + b * \<xi> + c = 0

goal (1 subgoal):
 1. \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * c)) / 2 \<Longrightarrow> \<xi>\<^sup>2 + b * \<xi> + c = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * c)) / 2 \<Longrightarrow> \<xi>\<^sup>2 + b * \<xi> + c = 0
[PROOF STEP]
assume *: "\<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * c)) / 2"
[PROOF STATE]
proof (state)
this:
\<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * c)) / 2

goal (1 subgoal):
 1. \<xi> = (- b - ccsqrt (b\<^sup>2 - 4 * c)) / 2 \<Longrightarrow> \<xi>\<^sup>2 + b * \<xi> + c = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<xi>\<^sup>2 + b * \<xi> + c = 0
[PROOF STEP]
by ((subst *)+, subst power_divide, subst power2_diff, simp add: field_simps, simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
\<xi>\<^sup>2 + b * \<xi> + c = 0

goal:
No subgoals!
[PROOF STEP]
qed