[STATEMENT]
lemma single_nz_val_unit_vec:
  fixes v::"'a::{monoid_mult,times,zero_neq_one,mult_zero}"
  shows "v \<cdot>\<^sub>v (unit_vec n i) = single_nz_val n i v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<cdot>\<^sub>v unit_vec n i = single_nz_val n i v
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. ia < dim_vec (single_nz_val n i v) \<Longrightarrow> (v \<cdot>\<^sub>v unit_vec n i) $ ia = single_nz_val n i v $ ia
 2. dim_vec (v \<cdot>\<^sub>v unit_vec n i) = dim_vec (single_nz_val n i v)
[PROOF STEP]
show *: "dim_vec (v \<cdot>\<^sub>v unit_vec n i) = dim_vec (single_nz_val n i v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (v \<cdot>\<^sub>v unit_vec n i) = dim_vec (single_nz_val n i v)
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
dim_vec (v \<cdot>\<^sub>v unit_vec n i) = dim_vec (single_nz_val n i v)

goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (single_nz_val n i v) \<Longrightarrow> (v \<cdot>\<^sub>v unit_vec n i) $ ia = single_nz_val n i v $ ia
[PROOF STEP]
fix ia
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (single_nz_val n i v) \<Longrightarrow> (v \<cdot>\<^sub>v unit_vec n i) $ ia = single_nz_val n i v $ ia
[PROOF STEP]
assume "ia < dim_vec (single_nz_val n i v)"
[PROOF STATE]
proof (state)
this:
ia < dim_vec (single_nz_val n i v)

goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (single_nz_val n i v) \<Longrightarrow> (v \<cdot>\<^sub>v unit_vec n i) $ ia = single_nz_val n i v $ ia
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ia < dim_vec (single_nz_val n i v)
[PROOF STEP]
show "(v \<cdot>\<^sub>v unit_vec n i) $ ia = single_nz_val n i v $ ia"
[PROOF STATE]
proof (prove)
using this:
ia < dim_vec (single_nz_val n i v)

goal (1 subgoal):
 1. (v \<cdot>\<^sub>v unit_vec n i) $ ia = single_nz_val n i v $ ia
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
ia < dim_vec (single_nz_val n i v)
dim_vec (v \<cdot>\<^sub>v unit_vec n i) = dim_vec (single_nz_val n i v)

goal (1 subgoal):
 1. (v \<cdot>\<^sub>v unit_vec n i) $ ia = single_nz_val n i v $ ia
[PROOF STEP]
by (simp add: unit_vec_def)
[PROOF STATE]
proof (state)
this:
(v \<cdot>\<^sub>v unit_vec n i) $ ia = single_nz_val n i v $ ia

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Bseq_isLub: "\<And>X :: nat \<Rightarrow> real. Bseq X \<Longrightarrow> \<exists>U. isLub (UNIV::real set) {x. \<exists>n. X n = x} U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>X. Bseq X \<Longrightarrow> \<exists>U. isLub UNIV {x. \<exists>n. X n = x} U
[PROOF STEP]
by (blast intro: reals_complete Bseq_isUb)


[STATEMENT]
lemma mono_downclosed:
  fixes f :: "'a::order \<Rightarrow> 'b::order"
  assumes "mono f"
  shows "\<forall>Y. downclosed_set Y \<longrightarrow> downclosed_set (f -` Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>Y. downclosed_set Y \<longrightarrow> downclosed_set (f -` Y)
[PROOF STEP]
by (simp add: assms downclosed_set_iff monoD)


[STATEMENT]
lemma fcompose_poly:
  assumes "poly q2 x\<noteq>0"
  shows "poly p (poly q1 x/poly q2 x) = poly (fcompose p q1 q2) x / poly (q2^(degree p)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p (poly q1 x / poly q2 x) = poly (fcompose p q1 q2) x / poly (q2 ^ degree p) x
[PROOF STEP]
apply (induct p)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. poly 0 (poly q1 x / poly q2 x) = poly (fcompose 0 q1 q2) x / poly (q2 ^ degree 0) x
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; poly p (poly q1 x / poly q2 x) = poly (fcompose p q1 q2) x / poly (q2 ^ degree p) x\<rbrakk> \<Longrightarrow> poly (pCons a p) (poly q1 x / poly q2 x) = poly (fcompose (pCons a p) q1 q2) x / poly (q2 ^ degree (pCons a p)) x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
poly q2 x \<noteq> (0::'a)

goal (2 subgoals):
 1. poly 0 (poly q1 x / poly q2 x) = poly (fcompose 0 q1 q2) x / poly (q2 ^ degree 0) x
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; poly p (poly q1 x / poly q2 x) = poly (fcompose p q1 q2) x / poly (q2 ^ degree p) x\<rbrakk> \<Longrightarrow> poly (pCons a p) (poly q1 x / poly q2 x) = poly (fcompose (pCons a p) q1 q2) x / poly (q2 ^ degree (pCons a p)) x
[PROOF STEP]
by (simp_all add:fcompose_pCons field_simps)


[STATEMENT]
lemma ccSUP_subset_mono:
  "countable B \<Longrightarrow> A \<subseteq> B \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> f x \<le> g x) \<Longrightarrow> (SUP x\<in>A. f x) \<le> (SUP x\<in>B. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>countable B; A \<subseteq> B; \<And>x. x \<in> A \<Longrightarrow> f x \<le> g x\<rbrakk> \<Longrightarrow> Sup (f ` A) \<le> Sup (g ` B)
[PROOF STEP]
by (blast intro: ccSUP_mono countable_subset dest: subsetD)


[STATEMENT]
theorem powerset_enum_distinct_elem: "distinct xs \<Longrightarrow> ys \<in> set (powerset_enum xs) \<Longrightarrow> distinct ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; ys \<in> set (powerset_enum xs)\<rbrakk> \<Longrightarrow> distinct ys
[PROOF STEP]
using filter_bool_list_distinct
[PROOF STATE]
proof (prove)
using this:
distinct ?xs \<Longrightarrow> distinct (filter_bool_list ?bs ?xs)

goal (1 subgoal):
 1. \<lbrakk>distinct xs; ys \<in> set (powerset_enum xs)\<rbrakk> \<Longrightarrow> distinct ys
[PROOF STEP]
by auto


[STATEMENT]
lemma pos_prod_sum_le:
  fixes c :: "'a::linordered_field"
  assumes "c > 0"
  shows "c * x + t \<le> 0 \<equiv> x \<le> (- 1 / c) * t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * x + t \<le> (0::'a) \<equiv> x \<le> - (1::'a) / c * t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c * x + t \<le> (0::'a) \<equiv> x \<le> - (1::'a) / c * t
[PROOF STEP]
have "c * x + t \<le> 0 \<longleftrightarrow> c * x \<le> - t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c * x + t \<le> (0::'a)) = (c * x \<le> - t)
[PROOF STEP]
by (subst le_iff_diff_le_0 [of "c*x" "-t"]) simp
[PROOF STATE]
proof (state)
this:
(c * x + t \<le> (0::'a)) = (c * x \<le> - t)

goal (1 subgoal):
 1. c * x + t \<le> (0::'a) \<equiv> x \<le> - (1::'a) / c * t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(c * x + t \<le> (0::'a)) = (c * x \<le> - t)

goal (1 subgoal):
 1. c * x + t \<le> (0::'a) \<equiv> x \<le> - (1::'a) / c * t
[PROOF STEP]
have "\<dots> \<longleftrightarrow> - t / c \<ge> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c * x \<le> - t) = (x \<le> - t / c)
[PROOF STEP]
by (simp only: pos_le_divide_eq[OF \<open>c > 0\<close>] algebra_simps)
[PROOF STATE]
proof (state)
this:
(c * x \<le> - t) = (x \<le> - t / c)

goal (1 subgoal):
 1. c * x + t \<le> (0::'a) \<equiv> x \<le> - (1::'a) / c * t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(c * x \<le> - t) = (x \<le> - t / c)

goal (1 subgoal):
 1. c * x + t \<le> (0::'a) \<equiv> x \<le> - (1::'a) / c * t
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (- 1 / c) * t \<ge> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> - t / c) = (x \<le> - (1::'a) / c * t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x \<le> - t / c) = (x \<le> - (1::'a) / c * t)

goal (1 subgoal):
 1. c * x + t \<le> (0::'a) \<equiv> x \<le> - (1::'a) / c * t
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(c * x + t \<le> (0::'a)) = (x \<le> - (1::'a) / c * t)
[PROOF STEP]
show "PROP ?thesis"
[PROOF STATE]
proof (prove)
using this:
(c * x + t \<le> (0::'a)) = (x \<le> - (1::'a) / c * t)

goal (1 subgoal):
 1. c * x + t \<le> (0::'a) \<equiv> x \<le> - (1::'a) / c * t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * x + t \<le> (0::'a) \<equiv> x \<le> - (1::'a) / c * t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_plus_leq_norm_prod: \<open>norm (a + b) \<le> sqrt 2 * norm (a, b)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (a + b) \<le> sqrt 2 * norm (a, b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (a + b) \<le> sqrt 2 * norm (a, b)
[PROOF STEP]
have \<open>(norm (a + b))\<^sup>2 \<le> (norm a + norm b)\<^sup>2\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm (a + b))\<^sup>2 \<le> (norm a + norm b)\<^sup>2
[PROOF STEP]
using norm_triangle_ineq
[PROOF STATE]
proof (prove)
using this:
norm (?x + ?y) \<le> norm ?x + norm ?y

goal (1 subgoal):
 1. (norm (a + b))\<^sup>2 \<le> (norm a + norm b)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(norm (a + b))\<^sup>2 \<le> (norm a + norm b)\<^sup>2

goal (1 subgoal):
 1. norm (a + b) \<le> sqrt 2 * norm (a, b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(norm (a + b))\<^sup>2 \<le> (norm a + norm b)\<^sup>2

goal (1 subgoal):
 1. norm (a + b) \<le> sqrt 2 * norm (a, b)
[PROOF STEP]
have \<open>\<dots> \<le> 2 * ((norm a)\<^sup>2 + (norm b)\<^sup>2)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm a + norm b)\<^sup>2 \<le> 2 * ((norm a)\<^sup>2 + (norm b)\<^sup>2)
[PROOF STEP]
by (smt (verit, best) power2_sum sum_squares_bound)
[PROOF STATE]
proof (state)
this:
(norm a + norm b)\<^sup>2 \<le> 2 * ((norm a)\<^sup>2 + (norm b)\<^sup>2)

goal (1 subgoal):
 1. norm (a + b) \<le> sqrt 2 * norm (a, b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(norm a + norm b)\<^sup>2 \<le> 2 * ((norm a)\<^sup>2 + (norm b)\<^sup>2)

goal (1 subgoal):
 1. norm (a + b) \<le> sqrt 2 * norm (a, b)
[PROOF STEP]
have \<open>\<dots> \<le> (sqrt 2 * norm (a, b))\<^sup>2\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * ((norm a)\<^sup>2 + (norm b)\<^sup>2) \<le> (sqrt 2 * norm (a, b))\<^sup>2
[PROOF STEP]
by (auto simp: power_mult_distrib norm_prod_def simp del: power_mono_iff)
[PROOF STATE]
proof (state)
this:
2 * ((norm a)\<^sup>2 + (norm b)\<^sup>2) \<le> (sqrt 2 * norm (a, b))\<^sup>2

goal (1 subgoal):
 1. norm (a + b) \<le> sqrt 2 * norm (a, b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(norm (a + b))\<^sup>2 \<le> (sqrt 2 * norm (a, b))\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(norm (a + b))\<^sup>2 \<le> (sqrt 2 * norm (a, b))\<^sup>2

goal (1 subgoal):
 1. norm (a + b) \<le> sqrt 2 * norm (a, b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (a + b) \<le> sqrt 2 * norm (a, b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma singleton_appends_dotP [simp]: "dim_vec x = dim_vec y \<Longrightarrow> (x @\<^sub>v [v]\<^sub>v) \<bullet> (y @\<^sub>v [w]\<^sub>v) = x \<bullet> y + v * w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec x = dim_vec y \<Longrightarrow> (x @\<^sub>v [v]\<^sub>v) \<bullet> (y @\<^sub>v [w]\<^sub>v) = x \<bullet> y + v * w
[PROOF STEP]
using scalar_prod_append[of x "dim_vec x" "[v]\<^sub>v" 1 y "[w]\<^sub>v"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<in> carrier_vec (dim_vec x); [v]\<^sub>v \<in> carrier_vec 1; y \<in> carrier_vec (dim_vec x); [w]\<^sub>v \<in> carrier_vec 1\<rbrakk> \<Longrightarrow> (x @\<^sub>v [v]\<^sub>v) \<bullet> (y @\<^sub>v [w]\<^sub>v) = x \<bullet> y + [v]\<^sub>v \<bullet> [w]\<^sub>v

goal (1 subgoal):
 1. dim_vec x = dim_vec y \<Longrightarrow> (x @\<^sub>v [v]\<^sub>v) \<bullet> (y @\<^sub>v [w]\<^sub>v) = x \<bullet> y + v * w
[PROOF STEP]
by (metis carrier_dim_vec singletons_dotP vec_carrier)


[STATEMENT]
theorem ratio_test_divergence:
  fixes f :: "nat \<Rightarrow> real"
  assumes pos_f: "eventually (\<lambda>n. f n > 0) sequentially"
  defines "l \<equiv> limsup (\<lambda>n. ereal (f n / f (Suc n)))"
  assumes l: "l < 1"
  shows   "\<not>summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> summable f
[PROOF STEP]
proof (rule kummers_test_divergence[OF pos_f])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<forall>\<^sub>F n in sequentially. 0 < ?p n
 2. \<not> summable (\<lambda>n. inverse (?p n))
 3. limsup (\<lambda>n. ereal (?p n * f n / f (Suc n) - ?p (Suc n))) < 0
[PROOF STEP]
have "limsup (\<lambda>n. ereal (f n / f (Suc n) - 1)) + 1 = l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (f n / f (Suc n) - 1)) + 1 = l
[PROOF STEP]
by (subst Limsup_add_ereal_right[symmetric]) (simp_all add: minus_ereal_def l_def one_ereal_def)
[PROOF STATE]
proof (state)
this:
limsup (\<lambda>n. ereal (f n / f (Suc n) - 1)) + 1 = l

goal (3 subgoals):
 1. \<forall>\<^sub>F n in sequentially. 0 < ?p n
 2. \<not> summable (\<lambda>n. inverse (?p n))
 3. limsup (\<lambda>n. ereal (?p n * f n / f (Suc n) - ?p (Suc n))) < 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
limsup (\<lambda>n. ereal (f n / f (Suc n) - 1)) + 1 = l

goal (3 subgoals):
 1. \<forall>\<^sub>F n in sequentially. 0 < ?p n
 2. \<not> summable (\<lambda>n. inverse (?p n))
 3. limsup (\<lambda>n. ereal (?p n * f n / f (Suc n) - ?p (Suc n))) < 0
[PROOF STEP]
note l
[PROOF STATE]
proof (state)
this:
l < 1

goal (3 subgoals):
 1. \<forall>\<^sub>F n in sequentially. 0 < ?p n
 2. \<not> summable (\<lambda>n. inverse (?p n))
 3. limsup (\<lambda>n. ereal (?p n * f n / f (Suc n) - ?p (Suc n))) < 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
limsup (\<lambda>n. ereal (f n / f (Suc n) - 1)) + 1 < 1
[PROOF STEP]
show "limsup (\<lambda>n. ereal (1 * f n / f (Suc n) - 1)) < 0"
[PROOF STATE]
proof (prove)
using this:
limsup (\<lambda>n. ereal (f n / f (Suc n) - 1)) + 1 < 1

goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (1 * f n / f (Suc n) - 1)) < 0
[PROOF STEP]
by (cases "limsup (\<lambda>n. ereal (1 * f n / f (Suc n) - 1))") simp_all
[PROOF STATE]
proof (state)
this:
limsup (\<lambda>n. ereal (1 * f n / f (Suc n) - 1)) < 0

goal (2 subgoals):
 1. \<forall>\<^sub>F n in sequentially. 0 < 1
 2. \<not> summable (\<lambda>n. inverse 1)
[PROOF STEP]
qed (simp_all add: summable_const_iff)


[STATEMENT]
lemma dot_norm_neg: "inner x y = (((norm x)\<^sup>2 + (norm y)\<^sup>2) - (norm (x - y))\<^sup>2) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner x y = ((norm x)\<^sup>2 + (norm y)\<^sup>2 - (norm (x - y))\<^sup>2) / 2
[PROOF STEP]
by (simp only: power2_norm_eq_inner inner_simps inner_commute)
    (auto simp add: algebra_simps)


[STATEMENT]
lemma bounded_minus_comp:
  "bounded (f ` S) \<Longrightarrow> bounded (g ` S) \<Longrightarrow> bounded ((\<lambda>x. f x - g x) ` S)"
  for f g::"'a \<Rightarrow> 'b::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bounded (f ` S); bounded (g ` S)\<rbrakk> \<Longrightarrow> bounded ((\<lambda>x. f x - g x) ` S)
[PROOF STEP]
using bounded_plus_comp[of "f" S "\<lambda>x. - g x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>bounded (f ` S); bounded ((\<lambda>x. - g x) ` S)\<rbrakk> \<Longrightarrow> bounded ((\<lambda>x. f x + - g x) ` S)

goal (1 subgoal):
 1. \<lbrakk>bounded (f ` S); bounded (g ` S)\<rbrakk> \<Longrightarrow> bounded ((\<lambda>x. f x - g x) ` S)
[PROOF STEP]
by auto


[STATEMENT]
lemma mtx_hOsc_diagonalizable:
  fixes a b :: real
  defines "\<iota>\<^sub>1 \<equiv> (b - sqrt (b^2+4*a))/2" and "\<iota>\<^sub>2 \<equiv> (b + sqrt (b^2+4*a))/2"
  assumes "b\<^sup>2 + a * 4 > 0" and "a \<noteq> 0"
  shows "A a b = P (-\<iota>\<^sub>2/a) (-\<iota>\<^sub>1/a) * (\<d>\<i>\<a>\<g> i. if i = 1 then \<iota>\<^sub>1 else \<iota>\<^sub>2) * (P (-\<iota>\<^sub>2/a) (-\<iota>\<^sub>1/a))\<^sup>-\<^sup>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A a b = P (- \<iota>\<^sub>2 / a) (- \<iota>\<^sub>1 / a) * (\<d>\<i>\<a>\<g> i. if i = 1 then \<iota>\<^sub>1 else \<iota>\<^sub>2) * P (- \<iota>\<^sub>2 / a) (- \<iota>\<^sub>1 / a)\<^sup>-\<^sup>1
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A a b = P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a) * (\<d>\<i>\<a>\<g> i. if i = 1 then (b - sqrt (b\<^sup>2 + 4 * a)) / 2 else (b + sqrt (b\<^sup>2 + 4 * a)) / 2) * P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a)\<^sup>-\<^sup>1
[PROOF STEP]
apply(subst inv_mtx_chB_hOsc)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. - ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a \<noteq> - ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a
 2. A a b = P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a) * (\<d>\<i>\<a>\<g> i. if i = 1 then (b - sqrt (b\<^sup>2 + 4 * a)) / 2 else (b + sqrt (b\<^sup>2 + 4 * a)) / 2) * (1 / (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a - - ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a)) *\<^sub>R mtx [[1, - (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a)], [- 1, - ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a]]
[PROOF STEP]
using assms(3,4)
[PROOF STATE]
proof (prove)
using this:
0 < b\<^sup>2 + a * 4
a \<noteq> 0

goal (2 subgoals):
 1. - ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a \<noteq> - ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a
 2. A a b = P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a) * (\<d>\<i>\<a>\<g> i. if i = 1 then (b - sqrt (b\<^sup>2 + 4 * a)) / 2 else (b + sqrt (b\<^sup>2 + 4 * a)) / 2) * (1 / (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a - - ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a)) *\<^sub>R mtx [[1, - (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a)], [- 1, - ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a]]
[PROOF STEP]
apply(simp_all add: diag2_eq[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < b\<^sup>2 + a * 4; a \<noteq> 0\<rbrakk> \<Longrightarrow> A a b = (1 / ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a) - (b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) *\<^sub>R (P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) * diag2 ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) * mtx [[1, (b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a)], [- 1, - ((b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))]])
[PROOF STEP]
unfolding sq_mtx_times_eq sq_mtx_scaleR_eq UNIV_2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < b\<^sup>2 + a * 4; a \<noteq> 0\<rbrakk> \<Longrightarrow> A a b = to_mtx (\<chi>i j. (1 / ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a) - (b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) *\<^sub>R to_mtx (\<chi>i j. \<Sum>k\<in>insert 1 (skip 2). to_mtx (\<chi>i j. \<Sum>k\<in>insert 1 (skip 2). P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) $$ i $ k * diag2 ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) $$ k $ j) $$ i $ k * mtx [[1, (b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a)], [- 1, - ((b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))]] $$ k $ j) $$ i $ j)
[PROOF STEP]
apply(subst sq_mtx_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < b\<^sup>2 + a * 4; a \<noteq> 0\<rbrakk> \<Longrightarrow> \<forall>i j. A a b $$ i $ j = to_mtx (\<chi>i j. (1 / ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a) - (b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) *\<^sub>R to_mtx (\<chi>i j. \<Sum>k\<in>insert 1 (skip 2). to_mtx (\<chi>i j. \<Sum>k\<in>insert 1 (skip 2). P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) $$ i $ k * diag2 ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) $$ k $ j) $$ i $ k * mtx [[1, (b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a)], [- 1, - ((b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))]] $$ k $ j) $$ i $ j) $$ i $ j
[PROOF STEP]
using exhaust_2 assms
[PROOF STATE]
proof (prove)
using this:
?x = 1 \<or> ?x = 2
\<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2
\<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2
0 < b\<^sup>2 + a * 4
a \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>0 < b\<^sup>2 + a * 4; a \<noteq> 0\<rbrakk> \<Longrightarrow> \<forall>i j. A a b $$ i $ j = to_mtx (\<chi>i j. (1 / ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a) - (b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) *\<^sub>R to_mtx (\<chi>i j. \<Sum>k\<in>insert 1 (skip 2). to_mtx (\<chi>i j. \<Sum>k\<in>insert 1 (skip 2). P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) $$ i $ k * diag2 ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) $$ k $ j) $$ i $ k * mtx [[1, (b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a)], [- 1, - ((b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))]] $$ k $ j) $$ i $ j) $$ i $ j
[PROOF STEP]
by (auto simp: field_simps, auto simp: field_power_simps)


[STATEMENT]
lemma bigtheta_const_ln_powr' [landau_simp]:
  "0 < a \<Longrightarrow> (\<lambda>x::real. ln (x * a) powr p) \<in> \<Theta>(\<lambda>x. ln x powr p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a \<Longrightarrow> (\<lambda>x. ln (x * a) powr p) \<in> \<Theta>(\<lambda>x. ln x powr p)
[PROOF STEP]
by (subst mult.commute) (rule bigtheta_const_ln_powr)


[STATEMENT]
lemma power_Carmichael_eq_1:
  assumes "n > 1" "coprime n x"
  shows   "[x ^ Carmichael n = 1] (mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x ^ Carmichael n = 1] (mod n)
[PROOF STEP]
using ord_dvd_Carmichael[of n x] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < n; coprime n x\<rbrakk> \<Longrightarrow> ord n x dvd Carmichael n
1 < n
coprime n x

goal (1 subgoal):
 1. [x ^ Carmichael n = 1] (mod n)
[PROOF STEP]
by (auto simp: ord_divides')


[STATEMENT]
lemma dirichlet_prod_neutral_intro:
  fixes S :: "nat \<Rightarrow> complex" and f :: "nat \<Rightarrow> nat \<Rightarrow> complex"
  defines "S \<equiv> (\<lambda>(n::nat). (\<Sum>k | k \<in> {1..n} \<and> coprime k n. (f k n)))"
  shows "S(n) = (\<Sum>k \<in> {1..n}. f k n * dirichlet_prod_neutral (gcd k n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
let ?g = "\<lambda>k. (f k n)* (dirichlet_prod_neutral (gcd k n))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
have zeros: "\<forall>k \<in> {1..n} - {k. k \<in> {1..n} \<and> coprime k n}. ?g k = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>k\<in>{1..n} - {k \<in> {1..n}. coprime k n}. f k n * dirichlet_prod_neutral (gcd k n) = 0
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. k \<in> {1..n} - {k \<in> {1..n}. coprime k n} \<Longrightarrow> f k n * dirichlet_prod_neutral (gcd k n) = 0
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. k \<in> {1..n} - {k \<in> {1..n}. coprime k n} \<Longrightarrow> f k n * dirichlet_prod_neutral (gcd k n) = 0
[PROOF STEP]
assume "k \<in> {1..n} - {k \<in> {1..n}. coprime k n}"
[PROOF STATE]
proof (state)
this:
k \<in> {1..n} - {k \<in> {1..n}. coprime k n}

goal (1 subgoal):
 1. \<And>k. k \<in> {1..n} - {k \<in> {1..n}. coprime k n} \<Longrightarrow> f k n * dirichlet_prod_neutral (gcd k n) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<in> {1..n} - {k \<in> {1..n}. coprime k n}
[PROOF STEP]
show "(f k n) * dirichlet_prod_neutral (gcd k n) = 0"
[PROOF STATE]
proof (prove)
using this:
k \<in> {1..n} - {k \<in> {1..n}. coprime k n}

goal (1 subgoal):
 1. f k n * dirichlet_prod_neutral (gcd k n) = 0
[PROOF STEP]
by (simp add: dirichlet_prod_neutral_def[of "gcd k n"] split: if_splits,presburger)
[PROOF STATE]
proof (state)
this:
f k n * dirichlet_prod_neutral (gcd k n) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>k\<in>{1..n} - {k \<in> {1..n}. coprime k n}. f k n * dirichlet_prod_neutral (gcd k n) = 0

goal (1 subgoal):
 1. S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
have "S n = (\<Sum>k | k \<in> {1..n} \<and> coprime k n. (f k n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S n = (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n)
[PROOF STEP]
by (simp add: S_def)
[PROOF STATE]
proof (state)
this:
S n = (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n)

goal (1 subgoal):
 1. S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
S n = (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n)

goal (1 subgoal):
 1. S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
have "\<dots> = sum ?g {k. k \<in> {1..n} \<and> coprime k n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n) = (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
by (simp add: dirichlet_prod_neutral_def split: if_splits)
[PROOF STATE]
proof (state)
this:
(\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n) = (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n * dirichlet_prod_neutral (gcd k n))

goal (1 subgoal):
 1. S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n) = (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n * dirichlet_prod_neutral (gcd k n))

goal (1 subgoal):
 1. S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
have "\<dots> = sum ?g {1..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
by (intro sum.mono_neutral_left, auto simp add: zeros)
[PROOF STATE]
proof (state)
this:
(\<Sum>k | k \<in> {1..n} \<and> coprime k n. f k n * dirichlet_prod_neutral (gcd k n)) = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))

goal (1 subgoal):
 1. S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))

goal (1 subgoal):
 1. S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S n = (\<Sum>k = 1..n. f k n * dirichlet_prod_neutral (gcd k n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma twice_tm_even[simp]: "2 * (length twice_tm div 2) = length twice_tm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (length twice_tm div 2) = length twice_tm
[PROOF STEP]
using length_twice_tm_even
[PROOF STATE]
proof (prove)
using this:
is_even (length twice_tm)

goal (1 subgoal):
 1. 2 * (length twice_tm div 2) = length twice_tm
[PROOF STEP]
by arith


[STATEMENT]
lemma subsets_smash_property:
  fixes subsets1 subsets2 :: "nat list list"
  fixes n:: "nat"
  shows "\<forall> (elem :: nat list). (List.member (subsets_smash n subsets1 subsets2) elem) \<longrightarrow>
    (\<exists> (elem1::nat list). \<exists> (elem2::nat list).
      (elem1 \<in> set(subsets1) \<and> elem2 \<in> set(subsets2) \<and> elem = (elem1 @ ((map ((+) n) elem2)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = elem1 @ map ((+) n) elem2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = elem1 @ map ((+) n) elem2)
[PROOF STEP]
let ?new_subsets = "(map (map ((+) n)) subsets2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = elem1 @ map ((+) n) elem2)
[PROOF STEP]
(* a slightly unorthodox use of signs_smash, but it closes the proof *)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = elem1 @ map ((+) n) elem2)
[PROOF STEP]
have "subsets_smash n subsets1 subsets2 = signs_smash subsets1 ?new_subsets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subsets_smash n subsets1 subsets2 = signs_smash subsets1 (map (map ((+) n)) subsets2)
[PROOF STEP]
unfolding subsets_smash_def signs_smash_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (map (\<lambda>l1. map (\<lambda>l2. l1 @ map ((+) n) l2) subsets2) subsets1) = concat (map (\<lambda>l1. map ((@) l1) (map (map ((+) n)) subsets2)) subsets1)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (map (\<lambda>l1. map (\<lambda>l2. l1 @ map ((+) n) l2) subsets2) subsets1) = concat (map (\<lambda>l1. map ((@) l1 \<circ> map ((+) n)) subsets2) subsets1)
[PROOF STEP]
by (simp add: comp_def)
[PROOF STATE]
proof (state)
this:
subsets_smash n subsets1 subsets2 = signs_smash subsets1 (map (map ((+) n)) subsets2)

goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = elem1 @ map ((+) n) elem2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subsets_smash n subsets1 subsets2 = signs_smash subsets1 (map (map ((+) n)) subsets2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subsets_smash n subsets1 subsets2 = signs_smash subsets1 (map (map ((+) n)) subsets2)

goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = elem1 @ map ((+) n) elem2)
[PROOF STEP]
by (smt imageE in_set_member set_map signs_smash_property_set)
[PROOF STATE]
proof (state)
this:
\<forall>elem. List.member (subsets_smash n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = elem1 @ map ((+) n) elem2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma predtrans_empty:
  assumes "mono (\<tau> :: 'a set \<Rightarrow> 'a set)"
  shows "\<forall> i. (\<tau> ^^ i) ({}) \<subseteq> (\<tau> ^^(i + 1))({})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. (\<tau> ^^ i) {} \<subseteq> (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
using assms funpow_decreasing le_add1
[PROOF STATE]
proof (prove)
using this:
mono \<tau>
\<lbrakk>?m \<le> ?n; mono ?f\<rbrakk> \<Longrightarrow> (?f ^^ ?m) bot \<le> (?f ^^ ?n) bot
?n \<le> ?n + ?m

goal (1 subgoal):
 1. \<forall>i. (\<tau> ^^ i) {} \<subseteq> (\<tau> ^^ (i + 1)) {}
[PROOF STEP]
by blast


[STATEMENT]
lemma Gcd_fin_eq_Gcd [simp]:
  "Gcd\<^sub>f\<^sub>i\<^sub>n A = Gcd A" if "finite A" for A :: "'a set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd\<^sub>f\<^sub>i\<^sub>n A = Gcd A
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. Gcd\<^sub>f\<^sub>i\<^sub>n A = Gcd A
[PROOF STEP]
by induct simp_all


[STATEMENT]
lemma mat_extension_id:
  "mat_extension (1\<^sub>m d1) = 1\<^sub>m d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_extension (1\<^sub>m d1) = 1\<^sub>m d
[PROOF STEP]
unfolding mat_extension_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_mat (1\<^sub>m d1) (1\<^sub>m d2) = 1\<^sub>m d
[PROOF STEP]
by (rule tensor_mat_id)


[STATEMENT]
lemma measure_Un3:
  assumes "A \<in> fmeasurable M" "B \<in> fmeasurable M"
  shows "measure M (A \<union> B) = measure M A + measure M B - measure M (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B)
[PROOF STEP]
have "measure M (A \<union> B) = measure M A + measure M (B - A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M (B - A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> fmeasurable M
B \<in> fmeasurable M

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M (B - A)
[PROOF STEP]
by (rule measure_Un2)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M (B - A)

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M (B - A)

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B)
[PROOF STEP]
have "B - A = B - (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B - A = B - A \<inter> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B - A = B - A \<inter> B

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B - A = B - A \<inter> B

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B)
[PROOF STEP]
have "measure M (B - (A \<inter> B)) = measure M B - measure M (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (B - A \<inter> B) = Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> fmeasurable M
B \<in> fmeasurable M

goal (1 subgoal):
 1. Sigma_Algebra.measure M (B - A \<inter> B) = Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B)
[PROOF STEP]
by (intro measure_Diff) (auto simp: fmeasurable_def)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (B - A \<inter> B) = Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B)

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + (Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + (Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B))

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B - Sigma_Algebra.measure M (A \<inter> B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma jordan_block_bound:
  assumes i: "i < n" and j: "j < n"
  shows "norm ((jordan_block n a ^\<^sub>m k) $$ (i,j))
    \<le> norm a ^ (k + i - j) * max 1 (of_nat k ^ (n - 1))"
    (is "?lhs \<le> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
have id: "(jordan_block n a ^\<^sub>m k) $$ (i,j) = (if i \<le> j then of_nat (k choose (j - i)) * a ^ (k + i - j) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (jordan_block n a ^\<^sub>m k) $$ (i, j) = (if i \<le> j then of_nat (k choose (j - i)) * a ^ (k + i - j) else (0::'a))
[PROOF STEP]
unfolding jordan_block_pow
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (k choose (j - i)) * a ^ (k + i - j) else (0::'a)) $$ (i, j) = (if i \<le> j then of_nat (k choose (j - i)) * a ^ (k + i - j) else (0::'a))
[PROOF STEP]
using i j
[PROOF STATE]
proof (prove)
using this:
i < n
j < n

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (k choose (j - i)) * a ^ (k + i - j) else (0::'a)) $$ (i, j) = (if i \<le> j then of_nat (k choose (j - i)) * a ^ (k + i - j) else (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(jordan_block n a ^\<^sub>m k) $$ (i, j) = (if i \<le> j then of_nat (k choose (j - i)) * a ^ (k + i - j) else (0::'a))

goal (1 subgoal):
 1. norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
from i j
[PROOF STATE]
proof (chain)
picking this:
i < n
j < n
[PROOF STEP]
have diff: "j - i \<le> n - 1"
[PROOF STATE]
proof (prove)
using this:
i < n
j < n

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

goal (1 subgoal):
 1. norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
proof (cases "i \<le> j")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
 2. \<not> i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> i \<le> j

goal (2 subgoals):
 1. i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
 2. \<not> i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> i \<le> j

goal (1 subgoal):
 1. norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
using this:
\<not> i \<le> j

goal (1 subgoal):
 1. norm (if i \<le> j then of_nat (k choose (j - i)) * a ^ (k + i - j) else (0::'a)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))

goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i \<le> j

goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
hence "?lhs = norm (of_nat (k choose (j - i)) * a ^ (k + i - j))"
[PROOF STATE]
proof (prove)
using this:
i \<le> j

goal (1 subgoal):
 1. norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) = norm (of_nat (k choose (j - i)) * a ^ (k + i - j))
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
using this:
i \<le> j

goal (1 subgoal):
 1. norm (if i \<le> j then of_nat (k choose (j - i)) * a ^ (k + i - j) else (0::'a)) = norm (of_nat (k choose (j - i)) * a ^ (k + i - j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) = norm (of_nat (k choose (j - i)) * a ^ (k + i - j))

goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) = norm (of_nat (k choose (j - i)) * a ^ (k + i - j))

goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
have "\<dots> \<le> norm (of_nat (k choose (j - i)) :: 'a) * norm (a ^ (k + i - j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (of_nat (k choose (j - i)) * a ^ (k + i - j)) \<le> norm (of_nat (k choose (j - i))) * norm (a ^ (k + i - j))
[PROOF STEP]
by (rule norm_mult_ineq)
[PROOF STATE]
proof (state)
this:
norm (of_nat (k choose (j - i)) * a ^ (k + i - j)) \<le> norm (of_nat (k choose (j - i))) * norm (a ^ (k + i - j))

goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (of_nat (k choose (j - i)) * a ^ (k + i - j)) \<le> norm (of_nat (k choose (j - i))) * norm (a ^ (k + i - j))

goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
have "\<dots> \<le> (max 1 (of_nat k ^ (n - 1))) * norm a ^ (k + i - j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (of_nat (k choose (j - i))) * norm (a ^ (k + i - j)) \<le> max 1 (real k ^ (n - 1)) * norm a ^ (k + i - j)
[PROOF STEP]
proof (rule mult_mono[OF _ norm_power_ineq _ norm_ge_zero])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. norm (of_nat (k choose (j - i))) \<le> max 1 (real k ^ (n - 1))
 2. 0 \<le> max 1 (real k ^ (n - 1))
[PROOF STEP]
have "k choose (j - i) \<le> max 1 (k ^ (n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k choose (j - i) \<le> max 1 (k ^ (n - 1))
[PROOF STEP]
by (rule choose_poly_bound[OF diff])
[PROOF STATE]
proof (state)
this:
k choose (j - i) \<le> max 1 (k ^ (n - 1))

goal (2 subgoals):
 1. norm (of_nat (k choose (j - i))) \<le> max 1 (real k ^ (n - 1))
 2. 0 \<le> max 1 (real k ^ (n - 1))
[PROOF STEP]
hence "norm (of_nat (k choose (j - i)) :: 'a) \<le> of_nat (max 1 (k ^ (n - 1)))"
[PROOF STATE]
proof (prove)
using this:
k choose (j - i) \<le> max 1 (k ^ (n - 1))

goal (1 subgoal):
 1. norm (of_nat (k choose (j - i))) \<le> real (max 1 (k ^ (n - 1)))
[PROOF STEP]
unfolding norm_of_nat of_nat_le_iff
[PROOF STATE]
proof (prove)
using this:
k choose (j - i) \<le> max 1 (k ^ (n - 1))

goal (1 subgoal):
 1. k choose (j - i) \<le> max 1 (k ^ (n - 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (of_nat (k choose (j - i))) \<le> real (max 1 (k ^ (n - 1)))

goal (2 subgoals):
 1. norm (of_nat (k choose (j - i))) \<le> max 1 (real k ^ (n - 1))
 2. 0 \<le> max 1 (real k ^ (n - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (of_nat (k choose (j - i))) \<le> real (max 1 (k ^ (n - 1)))

goal (2 subgoals):
 1. norm (of_nat (k choose (j - i))) \<le> max 1 (real k ^ (n - 1))
 2. 0 \<le> max 1 (real k ^ (n - 1))
[PROOF STEP]
have "\<dots> = max 1 (of_nat k ^ (n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (max 1 (k ^ (n - 1))) = max 1 (real k ^ (n - 1))
[PROOF STEP]
by (metis max_def of_nat_1 of_nat_le_iff of_nat_power)
[PROOF STATE]
proof (state)
this:
real (max 1 (k ^ (n - 1))) = max 1 (real k ^ (n - 1))

goal (2 subgoals):
 1. norm (of_nat (k choose (j - i))) \<le> max 1 (real k ^ (n - 1))
 2. 0 \<le> max 1 (real k ^ (n - 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (of_nat (k choose (j - i))) \<le> max 1 (real k ^ (n - 1))
[PROOF STEP]
show "norm (of_nat (k choose (j - i)) :: 'a) \<le> max 1 (real_of_nat k ^ (n - 1))"
[PROOF STATE]
proof (prove)
using this:
norm (of_nat (k choose (j - i))) \<le> max 1 (real k ^ (n - 1))

goal (1 subgoal):
 1. norm (of_nat (k choose (j - i))) \<le> max 1 (real k ^ (n - 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (of_nat (k choose (j - i))) \<le> max 1 (real k ^ (n - 1))

goal (1 subgoal):
 1. 0 \<le> max 1 (real k ^ (n - 1))
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
norm (of_nat (k choose (j - i))) * norm (a ^ (k + i - j)) \<le> max 1 (real k ^ (n - 1)) * norm a ^ (k + i - j)

goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (of_nat (k choose (j - i))) * norm (a ^ (k + i - j)) \<le> max 1 (real k ^ (n - 1)) * norm a ^ (k + i - j)

goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max 1 (real k ^ (n - 1)) * norm a ^ (k + i - j) = norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
max 1 (real k ^ (n - 1)) * norm a ^ (k + i - j) = norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))

goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))

goal (1 subgoal):
 1. norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> norm a ^ (k + i - j) * max 1 (real k ^ (n - 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nonzero_inverse_scaleC_distrib:
  "a \<noteq> 0 \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> inverse (scaleC a x) = scaleC (inverse a) (inverse x)"
  for x :: "'a::complex_div_algebra"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<noteq> 0; x \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> inverse (a *\<^sub>C x) = inverse x /\<^sub>C a
[PROOF STEP]
by (rule inverse_unique) simp


[STATEMENT]
lemma add_scalar_prod_distrib: assumes v: "v\<^sub>1 \<in> carrier_vec n" "v\<^sub>2 \<in> carrier_vec n" "v\<^sub>3 \<in> carrier_vec n"
  shows "(v\<^sub>1 + v\<^sub>2) \<bullet> v\<^sub>3 = v\<^sub>1 \<bullet> v\<^sub>3 + v\<^sub>2 \<bullet> v\<^sub>3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v\<^sub>1 + v\<^sub>2) \<bullet> v\<^sub>3 = v\<^sub>1 \<bullet> v\<^sub>3 + v\<^sub>2 \<bullet> v\<^sub>3
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (v\<^sub>1 + v\<^sub>2) \<bullet> v\<^sub>3 = v\<^sub>1 \<bullet> v\<^sub>3 + v\<^sub>2 \<bullet> v\<^sub>3
[PROOF STEP]
have "(\<Sum>i\<in>{0..<dim_vec v\<^sub>3}. (v\<^sub>1 + v\<^sub>2) $ i * v\<^sub>3 $ i) = (\<Sum>i\<in>{0..<dim_vec v\<^sub>3}. v\<^sub>1 $ i * v\<^sub>3 $ i + v\<^sub>2 $ i * v\<^sub>3 $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec v\<^sub>3. (v\<^sub>1 + v\<^sub>2) $ i * v\<^sub>3 $ i) = (\<Sum>i = 0..<dim_vec v\<^sub>3. v\<^sub>1 $ i * v\<^sub>3 $ i + v\<^sub>2 $ i * v\<^sub>3 $ i)
[PROOF STEP]
by (rule sum.cong, insert v, auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_vec v\<^sub>3. (v\<^sub>1 + v\<^sub>2) $ i * v\<^sub>3 $ i) = (\<Sum>i = 0..<dim_vec v\<^sub>3. v\<^sub>1 $ i * v\<^sub>3 $ i + v\<^sub>2 $ i * v\<^sub>3 $ i)

goal (1 subgoal):
 1. (v\<^sub>1 + v\<^sub>2) \<bullet> v\<^sub>3 = v\<^sub>1 \<bullet> v\<^sub>3 + v\<^sub>2 \<bullet> v\<^sub>3
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<dim_vec v\<^sub>3. (v\<^sub>1 + v\<^sub>2) $ i * v\<^sub>3 $ i) = (\<Sum>i = 0..<dim_vec v\<^sub>3. v\<^sub>1 $ i * v\<^sub>3 $ i + v\<^sub>2 $ i * v\<^sub>3 $ i)

goal (1 subgoal):
 1. (v\<^sub>1 + v\<^sub>2) \<bullet> v\<^sub>3 = v\<^sub>1 \<bullet> v\<^sub>3 + v\<^sub>2 \<bullet> v\<^sub>3
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<dim_vec v\<^sub>3. (v\<^sub>1 + v\<^sub>2) $ i * v\<^sub>3 $ i) = (\<Sum>i = 0..<dim_vec v\<^sub>3. v\<^sub>1 $ i * v\<^sub>3 $ i + v\<^sub>2 $ i * v\<^sub>3 $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec v\<^sub>3. (v\<^sub>1 + v\<^sub>2) $ i * v\<^sub>3 $ i) = (\<Sum>i = 0..<dim_vec v\<^sub>3. v\<^sub>1 $ i * v\<^sub>3 $ i) + (\<Sum>i = 0..<dim_vec v\<^sub>3. v\<^sub>2 $ i * v\<^sub>3 $ i)
[PROOF STEP]
using v
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<dim_vec v\<^sub>3. (v\<^sub>1 + v\<^sub>2) $ i * v\<^sub>3 $ i) = (\<Sum>i = 0..<dim_vec v\<^sub>3. v\<^sub>1 $ i * v\<^sub>3 $ i + v\<^sub>2 $ i * v\<^sub>3 $ i)
v\<^sub>1 \<in> carrier_vec n
v\<^sub>2 \<in> carrier_vec n
v\<^sub>3 \<in> carrier_vec n

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec v\<^sub>3. (v\<^sub>1 + v\<^sub>2) $ i * v\<^sub>3 $ i) = (\<Sum>i = 0..<dim_vec v\<^sub>3. v\<^sub>1 $ i * v\<^sub>3 $ i) + (\<Sum>i = 0..<dim_vec v\<^sub>3. v\<^sub>2 $ i * v\<^sub>3 $ i)
[PROOF STEP]
by (auto simp: sum.distrib)
[PROOF STATE]
proof (state)
this:
(v\<^sub>1 + v\<^sub>2) \<bullet> v\<^sub>3 = v\<^sub>1 \<bullet> v\<^sub>3 + v\<^sub>2 \<bullet> v\<^sub>3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ordstNS_trans:
"ordstNS X Y \<Longrightarrow> ordstNS Y Z \<Longrightarrow> ordstNS X Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ordstNS X Y; ordstNS Y Z\<rbrakk> \<Longrightarrow> ordstNS X Z
[PROOF STEP]
by (metis ordstNS_def ordst_trans)


[STATEMENT]
lemma d_IN_add: "d_IN (\<lambda>e. f e + g e) x = d_IN f x + d_IN g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d_IN (\<lambda>e. f e + g e) x = d_IN f x + d_IN g x
[PROOF STEP]
unfolding d_IN_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ xa. f (xa, x) + g (xa, x)) = (\<Sum>\<^sup>+ xa. f (xa, x)) + (\<Sum>\<^sup>+ xa. g (xa, x))
[PROOF STEP]
by(simp add: nn_integral_add)


[STATEMENT]
theorem involution_dom_card_sum :
  assumes "involution_on A \<phi>"
      and "finite A"
    shows "card A = card (fixpoints_on A \<phi>) +
                    2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
have eq: "{x \<in> preimg_img_on A \<phi>. card x = Suc 0} \<inter>
           {x \<in> preimg_img_on A \<phi>. card x = 2} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> preimg_img_on A \<phi>. card x = Suc 0} \<inter> {x \<in> preimg_img_on A \<phi>. card x = 2} = {}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
{x \<in> preimg_img_on A \<phi>. card x = Suc 0} \<inter> {x \<in> preimg_img_on A \<phi>. card x = 2} = {}

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
have f1 : "finite {x \<in> preimg_img_on A \<phi>. card x = 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x \<in> preimg_img_on A \<phi>. card x = 1}
[PROOF STEP]
by (simp add: assms preimg_img_on_finite)
[PROOF STATE]
proof (state)
this:
finite {x \<in> preimg_img_on A \<phi>. card x = 1}

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
have f2 : "finite {x \<in> preimg_img_on A \<phi>. card x = 2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
by (simp add: assms preimg_img_on_finite)
[PROOF STATE]
proof (state)
this:
finite {x \<in> preimg_img_on A \<phi>. card x = 2}

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
have "card A = card (\<Union>(preimg_img_on A \<phi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A = card (\<Union> (preimg_img_on A \<phi>))
[PROOF STEP]
by (metis assms(1) involution_on_def preimg_img_on_Union)
[PROOF STATE]
proof (state)
this:
card A = card (\<Union> (preimg_img_on A \<phi>))

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card A = card (\<Union> (preimg_img_on A \<phi>))

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
have "... = sum card (preimg_img_on A \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union> (preimg_img_on A \<phi>)) = sum card (preimg_img_on A \<phi>)
[PROOF STEP]
by (metis assms(1) card_Union_disjoint card_eq_0_iff not_one_le_zero preimg_img_on_card
        preimg_img_on_disjoint)
[PROOF STATE]
proof (state)
this:
card (\<Union> (preimg_img_on A \<phi>)) = sum card (preimg_img_on A \<phi>)

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (\<Union> (preimg_img_on A \<phi>)) = sum card (preimg_img_on A \<phi>)

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
have "... = sum card ({x \<in> preimg_img_on A \<phi>. card x = 1} \<union>
                             {x \<in> preimg_img_on A \<phi>. card x = 2})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum card (preimg_img_on A \<phi>) = sum card ({x \<in> preimg_img_on A \<phi>. card x = 1} \<union> {x \<in> preimg_img_on A \<phi>. card x = 2})
[PROOF STEP]
by (metis preimg_img_on_eq)
[PROOF STATE]
proof (state)
this:
sum card (preimg_img_on A \<phi>) = sum card ({x \<in> preimg_img_on A \<phi>. card x = 1} \<union> {x \<in> preimg_img_on A \<phi>. card x = 2})

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum card (preimg_img_on A \<phi>) = sum card ({x \<in> preimg_img_on A \<phi>. card x = 1} \<union> {x \<in> preimg_img_on A \<phi>. card x = 2})

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
have "... = sum card {x \<in> preimg_img_on A \<phi>. card x = 1} +
                   sum card {x \<in> preimg_img_on A \<phi>. card x = 2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum card ({x \<in> preimg_img_on A \<phi>. card x = 1} \<union> {x \<in> preimg_img_on A \<phi>. card x = 2}) = sum card {x \<in> preimg_img_on A \<phi>. card x = 1} + sum card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
by (metis (no_types, lifting) Collect_cong One_nat_def eq f1 f2 sum.union_disjoint)
[PROOF STATE]
proof (state)
this:
sum card ({x \<in> preimg_img_on A \<phi>. card x = 1} \<union> {x \<in> preimg_img_on A \<phi>. card x = 2}) = sum card {x \<in> preimg_img_on A \<phi>. card x = 1} + sum card {x \<in> preimg_img_on A \<phi>. card x = 2}

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum card ({x \<in> preimg_img_on A \<phi>. card x = 1} \<union> {x \<in> preimg_img_on A \<phi>. card x = 2}) = sum card {x \<in> preimg_img_on A \<phi>. card x = 1} + sum card {x \<in> preimg_img_on A \<phi>. card x = 2}

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
have "... = card (fixpoints_on A \<phi>) +
                   2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum card {x \<in> preimg_img_on A \<phi>. card x = 1} + sum card {x \<in> preimg_img_on A \<phi>. card x = 2} = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
by(simp add: fixpoints_on_card_eq)
[PROOF STATE]
proof (state)
this:
sum card {x \<in> preimg_img_on A \<phi>. card x = 1} + sum card {x \<in> preimg_img_on A \<phi>. card x = 2} = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}

goal (1 subgoal):
 1. card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card A = card (fixpoints_on A \<phi>) + 2 * card {x \<in> preimg_img_on A \<phi>. card x = 2}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma totient_mult_coprime:
  assumes "coprime m n"
  shows   "totient (m * n) = totient m * totient n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient (m * n) = totient m * totient n
[PROOF STEP]
proof (cases "m > 1 \<and> n > 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 < m \<and> 1 < n \<Longrightarrow> totient (m * n) = totient m * totient n
 2. \<not> (1 < m \<and> 1 < n) \<Longrightarrow> totient (m * n) = totient m * totient n
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
1 < m \<and> 1 < n

goal (2 subgoals):
 1. 1 < m \<and> 1 < n \<Longrightarrow> totient (m * n) = totient m * totient n
 2. \<not> (1 < m \<and> 1 < n) \<Longrightarrow> totient (m * n) = totient m * totient n
[PROOF STEP]
hence mn: "m > 1" "n > 1"
[PROOF STATE]
proof (prove)
using this:
1 < m \<and> 1 < n

goal (1 subgoal):
 1. 1 < m &&& 1 < n
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
1 < m
1 < n

goal (2 subgoals):
 1. 1 < m \<and> 1 < n \<Longrightarrow> totient (m * n) = totient m * totient n
 2. \<not> (1 < m \<and> 1 < n) \<Longrightarrow> totient (m * n) = totient m * totient n
[PROOF STEP]
have "totient (m * n) = card (totatives (m * n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient (m * n) = card (totatives (m * n))
[PROOF STEP]
by (simp add: totient_def)
[PROOF STATE]
proof (state)
this:
totient (m * n) = card (totatives (m * n))

goal (2 subgoals):
 1. 1 < m \<and> 1 < n \<Longrightarrow> totient (m * n) = totient m * totient n
 2. \<not> (1 < m \<and> 1 < n) \<Longrightarrow> totient (m * n) = totient m * totient n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
totient (m * n) = card (totatives (m * n))

goal (2 subgoals):
 1. 1 < m \<and> 1 < n \<Longrightarrow> totient (m * n) = totient m * totient n
 2. \<not> (1 < m \<and> 1 < n) \<Longrightarrow> totient (m * n) = totient m * totient n
[PROOF STEP]
have "\<dots> = card (totatives m \<times> totatives n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (totatives (m * n)) = card (totatives m \<times> totatives n)
[PROOF STEP]
using bij_betw_totatives [OF mn \<open>coprime m n\<close>]
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>x. (x mod m, x mod n)) (totatives (m * n)) (totatives m \<times> totatives n)

goal (1 subgoal):
 1. card (totatives (m * n)) = card (totatives m \<times> totatives n)
[PROOF STEP]
by (rule bij_betw_same_card)
[PROOF STATE]
proof (state)
this:
card (totatives (m * n)) = card (totatives m \<times> totatives n)

goal (2 subgoals):
 1. 1 < m \<and> 1 < n \<Longrightarrow> totient (m * n) = totient m * totient n
 2. \<not> (1 < m \<and> 1 < n) \<Longrightarrow> totient (m * n) = totient m * totient n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (totatives (m * n)) = card (totatives m \<times> totatives n)

goal (2 subgoals):
 1. 1 < m \<and> 1 < n \<Longrightarrow> totient (m * n) = totient m * totient n
 2. \<not> (1 < m \<and> 1 < n) \<Longrightarrow> totient (m * n) = totient m * totient n
[PROOF STEP]
have "\<dots> = totient m * totient n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (totatives m \<times> totatives n) = totient m * totient n
[PROOF STEP]
by (simp add: totient_def)
[PROOF STATE]
proof (state)
this:
card (totatives m \<times> totatives n) = totient m * totient n

goal (2 subgoals):
 1. 1 < m \<and> 1 < n \<Longrightarrow> totient (m * n) = totient m * totient n
 2. \<not> (1 < m \<and> 1 < n) \<Longrightarrow> totient (m * n) = totient m * totient n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
totient (m * n) = totient m * totient n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
totient (m * n) = totient m * totient n

goal (1 subgoal):
 1. totient (m * n) = totient m * totient n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
totient (m * n) = totient m * totient n

goal (1 subgoal):
 1. \<not> (1 < m \<and> 1 < n) \<Longrightarrow> totient (m * n) = totient m * totient n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (1 < m \<and> 1 < n) \<Longrightarrow> totient (m * n) = totient m * totient n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (1 < m \<and> 1 < n)

goal (1 subgoal):
 1. \<not> (1 < m \<and> 1 < n) \<Longrightarrow> totient (m * n) = totient m * totient n
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
coprime m n
\<not> (1 < m \<and> 1 < n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coprime m n
\<not> (1 < m \<and> 1 < n)

goal (1 subgoal):
 1. totient (m * n) = totient m * totient n
[PROOF STEP]
by (cases m; cases n) auto
[PROOF STATE]
proof (state)
this:
totient (m * n) = totient m * totient n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma retract_of_Times:
   "\<lbrakk>S retract_of s'; T retract_of t'\<rbrakk> \<Longrightarrow> (S \<times> T) retract_of (s' \<times> t')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S retract_of s'; T retract_of t'\<rbrakk> \<Longrightarrow> S \<times> T retract_of s' \<times> t'
[PROOF STEP]
apply (simp add: retract_of_def retraction_def Sigma_mono, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r ra. \<lbrakk>S \<subseteq> s'; T \<subseteq> t'; continuous_on s' r; continuous_on t' ra; r ` s' \<subseteq> S; \<forall>x\<in>S. r x = x; ra ` t' \<subseteq> T; \<forall>x\<in>T. ra x = x\<rbrakk> \<Longrightarrow> \<exists>r. continuous_on (s' \<times> t') r \<and> r ` (s' \<times> t') \<subseteq> S \<times> T \<and> (\<forall>x\<in>S. \<forall>y\<in>T. r (x, y) = (x, y))
[PROOF STEP]
apply (rename_tac f g)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>S \<subseteq> s'; T \<subseteq> t'; continuous_on s' f; continuous_on t' g; f ` s' \<subseteq> S; \<forall>x\<in>S. f x = x; g ` t' \<subseteq> T; \<forall>x\<in>T. g x = x\<rbrakk> \<Longrightarrow> \<exists>r. continuous_on (s' \<times> t') r \<and> r ` (s' \<times> t') \<subseteq> S \<times> T \<and> (\<forall>x\<in>S. \<forall>y\<in>T. r (x, y) = (x, y))
[PROOF STEP]
apply (rule_tac x="\<lambda>z. ((f \<circ> fst) z, (g \<circ> snd) z)" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>S \<subseteq> s'; T \<subseteq> t'; continuous_on s' f; continuous_on t' g; f ` s' \<subseteq> S; \<forall>x\<in>S. f x = x; g ` t' \<subseteq> T; \<forall>x\<in>T. g x = x\<rbrakk> \<Longrightarrow> continuous_on (s' \<times> t') (\<lambda>z. ((f \<circ> fst) z, (g \<circ> snd) z)) \<and> (\<lambda>z. ((f \<circ> fst) z, (g \<circ> snd) z)) ` (s' \<times> t') \<subseteq> S \<times> T \<and> (\<forall>x\<in>S. \<forall>y\<in>T. ((f \<circ> fst) (x, y), (g \<circ> snd) (x, y)) = (x, y))
[PROOF STEP]
apply (rule conjI continuous_intros | erule continuous_on_subset | force)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma real_binomial_eq_mult_binomial_Suc:
  assumes "k \<le> n"
  shows "real(n choose k) = (n + 1 - k) / (n + 1) * (Suc n choose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (n choose k) = (real n + 1 - real k) / (real n + 1) * real (Suc n choose k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> n

goal (1 subgoal):
 1. real (n choose k) = (real n + 1 - real k) / (real n + 1) * real (Suc n choose k)
[PROOF STEP]
by (simp add: of_nat_binomial_eq_mult_binomial_Suc [of k n] add.commute of_nat_diff)


[STATEMENT]
theorem sum_of_powers:
  "(\<Sum>k\<le>n::nat. (real k) ^ m) = (bernpoly (Suc m) (n + 1) - bernpoly (Suc m) 0) / (m + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k ^ m) = (bernpoly (Suc m) (real n + 1) - bernpoly (Suc m) 0) / (real m + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k ^ m) = (bernpoly (Suc m) (real n + 1) - bernpoly (Suc m) 0) / (real m + 1)
[PROOF STEP]
from diff_bernpoly[of "Suc m", simplified]
[PROOF STATE]
proof (chain)
picking this:
bernpoly (Suc m) (?x + 1) - bernpoly (Suc m) ?x = (1 + real m) * ?x ^ m
[PROOF STEP]
have "(m + (1::real)) * (\<Sum>k\<le>n. (real k) ^ m) = (\<Sum>k\<le>n. bernpoly (Suc m) (real k + 1) - bernpoly (Suc m) (real k))"
[PROOF STATE]
proof (prove)
using this:
bernpoly (Suc m) (?x + 1) - bernpoly (Suc m) ?x = (1 + real m) * ?x ^ m

goal (1 subgoal):
 1. (real m + 1) * (\<Sum>k\<le>n. real k ^ m) = (\<Sum>k\<le>n. bernpoly (Suc m) (real k + 1) - bernpoly (Suc m) (real k))
[PROOF STEP]
by (auto simp add: sum_distrib_left intro!: sum.cong)
[PROOF STATE]
proof (state)
this:
(real m + 1) * (\<Sum>k\<le>n. real k ^ m) = (\<Sum>k\<le>n. bernpoly (Suc m) (real k + 1) - bernpoly (Suc m) (real k))

goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k ^ m) = (bernpoly (Suc m) (real n + 1) - bernpoly (Suc m) 0) / (real m + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(real m + 1) * (\<Sum>k\<le>n. real k ^ m) = (\<Sum>k\<le>n. bernpoly (Suc m) (real k + 1) - bernpoly (Suc m) (real k))

goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k ^ m) = (bernpoly (Suc m) (real n + 1) - bernpoly (Suc m) 0) / (real m + 1)
[PROOF STEP]
have "... = (\<Sum>k\<le>n. bernpoly (Suc m) (real (k + 1)) - bernpoly (Suc m) (real k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. bernpoly (Suc m) (real k + 1) - bernpoly (Suc m) (real k)) = (\<Sum>k\<le>n. bernpoly (Suc m) (real (k + 1)) - bernpoly (Suc m) (real k))
[PROOF STEP]
by (simp add: add_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. bernpoly (Suc m) (real k + 1) - bernpoly (Suc m) (real k)) = (\<Sum>k\<le>n. bernpoly (Suc m) (real (k + 1)) - bernpoly (Suc m) (real k))

goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k ^ m) = (bernpoly (Suc m) (real n + 1) - bernpoly (Suc m) 0) / (real m + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. bernpoly (Suc m) (real k + 1) - bernpoly (Suc m) (real k)) = (\<Sum>k\<le>n. bernpoly (Suc m) (real (k + 1)) - bernpoly (Suc m) (real k))

goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k ^ m) = (bernpoly (Suc m) (real n + 1) - bernpoly (Suc m) 0) / (real m + 1)
[PROOF STEP]
have "... = bernpoly (Suc m) (n + 1) - bernpoly (Suc m) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. bernpoly (Suc m) (real (k + 1)) - bernpoly (Suc m) (real k)) = bernpoly (Suc m) (real (n + 1)) - bernpoly (Suc m) 0
[PROOF STEP]
by (simp only: sum_diff[where f="\<lambda>k. bernpoly (Suc m) (real k)"]) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. bernpoly (Suc m) (real (k + 1)) - bernpoly (Suc m) (real k)) = bernpoly (Suc m) (real (n + 1)) - bernpoly (Suc m) 0

goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k ^ m) = (bernpoly (Suc m) (real n + 1) - bernpoly (Suc m) 0) / (real m + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(real m + 1) * (\<Sum>k\<le>n. real k ^ m) = bernpoly (Suc m) (real (n + 1)) - bernpoly (Suc m) 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(real m + 1) * (\<Sum>k\<le>n. real k ^ m) = bernpoly (Suc m) (real (n + 1)) - bernpoly (Suc m) 0

goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k ^ m) = (bernpoly (Suc m) (real n + 1) - bernpoly (Suc m) 0) / (real m + 1)
[PROOF STEP]
by (auto simp add: field_simps intro!: eq_divide_imp)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. real k ^ m) = (bernpoly (Suc m) (real n + 1) - bernpoly (Suc m) 0) / (real m + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_descending_Cons: "sorted_descending (x#xs) \<longleftrightarrow> sorted_descending xs \<and> (\<forall>y\<in>set xs. y \<le> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_descending (x # xs) = (sorted_descending xs \<and> (\<forall>y\<in>set xs. y \<le> x))
[PROOF STEP]
by(induction xs) auto


[STATEMENT]
lemma "pi / 4 = (4::real) * arctan (1 / 5) - arctan (1 / 239)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi / 4 = 4 * arctan (1 / 5) - arctan (1 / 239)
[PROOF STEP]
by machin


[STATEMENT]
lemma prod_gcd_lcm_nat: "m * n = gcd m n * lcm m n"
  for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m * n = gcd m n * lcm m n
[PROOF STEP]
by (simp add: lcm_gcd)


[STATEMENT]
lemma det_echelon_form_of_euclidean_iarrays[code]:
  fixes A::"'a::{euclidean_ring_gcd}^'n::{mod_type}^'n::{mod_type}"
  shows "det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2
  in 1 div (fst A')
  * prod_list (map (\<lambda>i. (snd A') !! i !! i) [0..<nrows_iarray (matrix_to_iarray A)]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
let ?f="(\<lambda>i. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
have "prod_list (map ?f [0..<nrows_iarray (matrix_to_iarray A)])
    = prod ?f (set [0..<nrows_iarray (matrix_to_iarray A)])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i) = (\<Prod>i\<in>set [0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i)
[PROOF STEP]
by (metis (mono_tags, lifting) distinct_upt prod.distinct_set_conv_list)
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i) = (\<Prod>i\<in>set [0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i)

goal (1 subgoal):
 1. det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i) = (\<Prod>i\<in>set [0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i)

goal (1 subgoal):
 1. det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
have "... = prod (\<lambda>i. snd (echelon_form_of_det A euclid_ext2) $ i $ i) (UNIV:: 'n set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i\<in>set [0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i) = (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i)
[PROOF STEP]
proof (rule prod.reindex_cong[of "to_nat::('n=>nat)"])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. inj mod_type_class.to_nat
 2. set [0..<nrows_iarray (matrix_to_iarray A)] = range mod_type_class.to_nat
 3. \<And>x. x \<in> UNIV \<Longrightarrow> snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (echelon_form_of_det A euclid_ext2) $ x $ x
[PROOF STEP]
show "inj (to_nat::('n=>nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj mod_type_class.to_nat
[PROOF STEP]
by (metis strict_mono_imp_inj_on strict_mono_to_nat)
[PROOF STATE]
proof (state)
this:
inj mod_type_class.to_nat

goal (2 subgoals):
 1. set [0..<nrows_iarray (matrix_to_iarray A)] = range mod_type_class.to_nat
 2. \<And>x. x \<in> UNIV \<Longrightarrow> snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (echelon_form_of_det A euclid_ext2) $ x $ x
[PROOF STEP]
show "set [0..<nrows_iarray (matrix_to_iarray A)] = range (to_nat::'n=>nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set [0..<nrows_iarray (matrix_to_iarray A)] = range mod_type_class.to_nat
[PROOF STEP]
unfolding nrows_eq_card_rows
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set [0..<CARD('n)] = range mod_type_class.to_nat
[PROOF STEP]
using bij_to_nat[where ?'a='n]
[PROOF STATE]
proof (prove)
using this:
bij_betw mod_type_class.to_nat UNIV {0..<CARD('n)}

goal (1 subgoal):
 1. set [0..<CARD('n)] = range mod_type_class.to_nat
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj mod_type_class.to_nat \<and> range mod_type_class.to_nat = {0..<CARD('n)}

goal (1 subgoal):
 1. set [0..<CARD('n)] = range mod_type_class.to_nat
[PROOF STEP]
unfolding atLeast0LessThan atLeast_upt
[PROOF STATE]
proof (prove)
using this:
inj mod_type_class.to_nat \<and> range mod_type_class.to_nat = set [0..<CARD('n)]

goal (1 subgoal):
 1. set [0..<CARD('n)] = range mod_type_class.to_nat
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set [0..<nrows_iarray (matrix_to_iarray A)] = range mod_type_class.to_nat

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (echelon_form_of_det A euclid_ext2) $ x $ x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (echelon_form_of_det A euclid_ext2) $ x $ x
[PROOF STEP]
show "snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! to_nat x !! to_nat x
      = snd (echelon_form_of_det A euclid_ext2) $ x $ x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (echelon_form_of_det A euclid_ext2) $ x $ x
[PROOF STEP]
unfolding matrix_to_iarray_echelon_form_of_det[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (snd (echelon_form_of_det A euclid_ext2)) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (echelon_form_of_det A euclid_ext2) $ x $ x
[PROOF STEP]
unfolding matrix_to_iarray_nth
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (echelon_form_of_det A euclid_ext2) $ x $ x = snd (echelon_form_of_det A euclid_ext2) $ x $ x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! mod_type_class.to_nat x !! mod_type_class.to_nat x = snd (echelon_form_of_det A euclid_ext2) $ x $ x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>set [0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i) = (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i)

goal (1 subgoal):
 1. det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i) = (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i)
[PROOF STEP]
have *:"prod_list (map (\<lambda>i. snd (echelon_form_of_det_iarrays
    (matrix_to_iarray A) euclid_ext2) !! i !! i) [0..<nrows_iarray (matrix_to_iarray A)]) =
    (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i)"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i) = (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i)

goal (1 subgoal):
 1. (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i) = (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i) = (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i)

goal (1 subgoal):
 1. det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
have "det A = 1 div (fst (echelon_form_of_det A euclid_ext2))
    * prod (\<lambda>i. snd (echelon_form_of_det A euclid_ext2) $ i $ i) (UNIV:: 'n set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (1::'a) div fst (echelon_form_of_det A euclid_ext2) * (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i)
[PROOF STEP]
unfolding det_echelon_form_of_euclidean
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) div fst (echelon_form_of_det A euclid_ext2) * (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i) = (1::'a) div fst (echelon_form_of_det A euclid_ext2) * (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
det A = (1::'a) div fst (echelon_form_of_det A euclid_ext2) * (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i)

goal (1 subgoal):
 1. det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det A = (1::'a) div fst (echelon_form_of_det A euclid_ext2) * (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i)

goal (1 subgoal):
 1. det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
have "... = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2
    in 1 div (fst A')
    * prod_list (map (\<lambda>i. (snd A') !! i !! i) [0..<nrows_iarray (matrix_to_iarray A)]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) div fst (echelon_form_of_det A euclid_ext2) * (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i) = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) div fst (echelon_form_of_det A euclid_ext2) * (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i) = (1::'a) div fst (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) !! i !! i)
[PROOF STEP]
unfolding * fst_echelon_form_of_det
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) div fst (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) * (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i) = (1::'a) div fst (echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2) * (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(1::'a) div fst (echelon_form_of_det A euclid_ext2) * (\<Prod>i\<in>UNIV. snd (echelon_form_of_det A euclid_ext2) $ i $ i) = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))

goal (1 subgoal):
 1. det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))

goal (1 subgoal):
 1. det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det A = (let A' = echelon_form_of_det_iarrays (matrix_to_iarray A) euclid_ext2 in (1::'a) div fst A' * (\<Prod>i\<leftarrow>[0..<nrows_iarray (matrix_to_iarray A)]. snd A' !! i !! i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma deriv_deriv_real_sqrt':
  assumes "x > 0"
  shows "deriv (\<lambda>x. inverse (sqrt x) / 2) x = - inverse ((sqrt x)^3)/4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. inverse (sqrt x) / 2) x = - inverse (sqrt x ^ 3) / 4
[PROOF STEP]
by (simp add: DERIV_imp_deriv assms has_real_derivative_inverse_sqrt)


[STATEMENT]
lemma adjugate_transpose: "adjugate (transpose A) = transpose (adjugate A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjugate (Square_Matrix.transpose A) = Square_Matrix.transpose (adjugate A)
[PROOF STEP]
by (simp add: adjugate_def cofactor_transpose)


[STATEMENT]
lemma mat_exp_law_mult: "mat_pow (n*m) M = mat_pow n (mat_pow m M)" (is "?P n")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_pow (n * m) M = mat_pow n (mat_pow m M)
[PROOF STEP]
apply (induction n, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. mat_pow (n * m) M = mat_pow n (mat_pow m M) \<Longrightarrow> mat_pow (m + n * m) M = mat (mat_11 (mat_pow m M) * mat_11 (mat_pow n (mat_pow m M)) + mat_12 (mat_pow m M) * mat_21 (mat_pow n (mat_pow m M))) (mat_11 (mat_pow m M) * mat_12 (mat_pow n (mat_pow m M)) + mat_12 (mat_pow m M) * mat_22 (mat_pow n (mat_pow m M))) (mat_21 (mat_pow m M) * mat_11 (mat_pow n (mat_pow m M)) + mat_22 (mat_pow m M) * mat_21 (mat_pow n (mat_pow m M))) (mat_21 (mat_pow m M) * mat_12 (mat_pow n (mat_pow m M)) + mat_22 (mat_pow m M) * mat_22 (mat_pow n (mat_pow m M)))
[PROOF STEP]
using mat_exp_law
[PROOF STATE]
proof (prove)
using this:
mat_mul (mat_pow ?n ?M) (mat_pow ?m ?M) = mat_pow (?n + ?m) ?M

goal (1 subgoal):
 1. \<And>n. mat_pow (n * m) M = mat_pow n (mat_pow m M) \<Longrightarrow> mat_pow (m + n * m) M = mat (mat_11 (mat_pow m M) * mat_11 (mat_pow n (mat_pow m M)) + mat_12 (mat_pow m M) * mat_21 (mat_pow n (mat_pow m M))) (mat_11 (mat_pow m M) * mat_12 (mat_pow n (mat_pow m M)) + mat_12 (mat_pow m M) * mat_22 (mat_pow n (mat_pow m M))) (mat_21 (mat_pow m M) * mat_11 (mat_pow n (mat_pow m M)) + mat_22 (mat_pow m M) * mat_21 (mat_pow n (mat_pow m M))) (mat_21 (mat_pow m M) * mat_12 (mat_pow n (mat_pow m M)) + mat_22 (mat_pow m M) * mat_22 (mat_pow n (mat_pow m M)))
[PROOF STEP]
by (metis mat_mul.simps)


[STATEMENT]
lemma lub_unique: "\<lbrakk>S \<subseteq> A; isLub S cl x; isLub S cl L\<rbrakk> \<Longrightarrow> x = L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> A; isLub S cl x; isLub S cl L\<rbrakk> \<Longrightarrow> x = L
[PROOF STEP]
by (rule antisymE) (auto simp add: isLub_def r_def)


[STATEMENT]
lemma AND_mod: "x AND (2 ^ n - 1) = x mod 2 ^ n" for x :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x AND 2 ^ n - 1 = x mod 2 ^ n
[PROOF STEP]
by (simp flip: mask_eq_exp_minus_1 take_bit_eq_mask take_bit_eq_mod)


[STATEMENT]
lemma iMin_insert_remove: "
  iMin (insert n I) =
  (if I - {n} = {} then n else min n (iMin (I - {n})))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. iMin (insert n I) = (if I - {n} = {} then n else min n (iMin (I - {n})))
[PROOF STEP]
by (metis iMin_insert iMin_singleton insert_Diff_single)


[STATEMENT]
lemma top_power_ennreal: "top ^ n = (if n = 0 then 1 else top :: ennreal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. top ^ n = (if n = 0 then 1 else top)
[PROOF STEP]
by (induction n) (simp_all add: ennreal_mult_eq_top_iff)


[STATEMENT]
lemma ln_Lambert_W:
  assumes "x > 0"
  shows   "ln (Lambert_W x) = ln x - Lambert_W x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (Lambert_W x) = ln x - Lambert_W x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (Lambert_W x) = ln x - Lambert_W x
[PROOF STEP]
have "-exp (-1) \<le> (0 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - exp (- 1) \<le> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- exp (- 1) \<le> 0

goal (1 subgoal):
 1. ln (Lambert_W x) = ln x - Lambert_W x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- exp (- 1) \<le> 0

goal (1 subgoal):
 1. ln (Lambert_W x) = ln x - Lambert_W x
[PROOF STEP]
have "\<dots> < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
0 < x

goal (1 subgoal):
 1. ln (Lambert_W x) = ln x - Lambert_W x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
- exp (- 1) < x
[PROOF STEP]
have x: "x > -exp(-1)"
[PROOF STATE]
proof (prove)
using this:
- exp (- 1) < x

goal (1 subgoal):
 1. - exp (- 1) < x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
- exp (- 1) < x

goal (1 subgoal):
 1. ln (Lambert_W x) = ln x - Lambert_W x
[PROOF STEP]
have "exp (ln (Lambert_W x)) = exp (ln x - Lambert_W x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (ln (Lambert_W x)) = exp (ln x - Lambert_W x)
[PROOF STEP]
using assms x
[PROOF STATE]
proof (prove)
using this:
0 < x
- exp (- 1) < x

goal (1 subgoal):
 1. exp (ln (Lambert_W x)) = exp (ln x - Lambert_W x)
[PROOF STEP]
by (subst exp_diff) (auto simp: exp_Lambert_W)
[PROOF STATE]
proof (state)
this:
exp (ln (Lambert_W x)) = exp (ln x - Lambert_W x)

goal (1 subgoal):
 1. ln (Lambert_W x) = ln x - Lambert_W x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
exp (ln (Lambert_W x)) = exp (ln x - Lambert_W x)

goal (1 subgoal):
 1. ln (Lambert_W x) = ln x - Lambert_W x
[PROOF STEP]
by (subst (asm) exp_inj_iff)
[PROOF STATE]
proof (state)
this:
ln (Lambert_W x) = ln x - Lambert_W x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem eval_fps_eqD:
  fixes f g :: "complex fps"
  assumes "fps_conv_radius f > 0" "fps_conv_radius g > 0"
  assumes "eventually (\<lambda>z. eval_fps f z = eval_fps g z) (nhds 0)"
  shows   "f = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = g
[PROOF STEP]
proof (rule fps_ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. fps_nth f n = fps_nth g n
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. fps_nth f n = fps_nth g n
[PROOF STEP]
have "fps_nth f n = (deriv ^^ n) (eval_fps f) 0 / fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_nth f n = (deriv ^^ n) (eval_fps f) 0 / fact n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < fps_conv_radius f
0 < fps_conv_radius g
\<forall>\<^sub>F z in nhds 0. eval_fps f z = eval_fps g z

goal (1 subgoal):
 1. fps_nth f n = (deriv ^^ n) (eval_fps f) 0 / fact n
[PROOF STEP]
by (intro fps_nth_conv_deriv)
[PROOF STATE]
proof (state)
this:
fps_nth f n = (deriv ^^ n) (eval_fps f) 0 / fact n

goal (1 subgoal):
 1. \<And>n. fps_nth f n = fps_nth g n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fps_nth f n = (deriv ^^ n) (eval_fps f) 0 / fact n

goal (1 subgoal):
 1. \<And>n. fps_nth f n = fps_nth g n
[PROOF STEP]
have "(deriv ^^ n) (eval_fps f) 0 = (deriv ^^ n) (eval_fps g) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv ^^ n) (eval_fps f) 0 = (deriv ^^ n) (eval_fps g) 0
[PROOF STEP]
by (intro higher_deriv_cong_ev refl assms)
[PROOF STATE]
proof (state)
this:
(deriv ^^ n) (eval_fps f) 0 = (deriv ^^ n) (eval_fps g) 0

goal (1 subgoal):
 1. \<And>n. fps_nth f n = fps_nth g n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(deriv ^^ n) (eval_fps f) 0 = (deriv ^^ n) (eval_fps g) 0

goal (1 subgoal):
 1. \<And>n. fps_nth f n = fps_nth g n
[PROOF STEP]
have "\<dots> / fact n = fps_nth g n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv ^^ n) (eval_fps g) 0 / fact n = fps_nth g n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < fps_conv_radius f
0 < fps_conv_radius g
\<forall>\<^sub>F z in nhds 0. eval_fps f z = eval_fps g z

goal (1 subgoal):
 1. (deriv ^^ n) (eval_fps g) 0 / fact n = fps_nth g n
[PROOF STEP]
by (intro fps_nth_conv_deriv [symmetric])
[PROOF STATE]
proof (state)
this:
(deriv ^^ n) (eval_fps g) 0 / fact n = fps_nth g n

goal (1 subgoal):
 1. \<And>n. fps_nth f n = fps_nth g n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fps_nth f n = fps_nth g n
[PROOF STEP]
show "fps_nth f n = fps_nth g n"
[PROOF STATE]
proof (prove)
using this:
fps_nth f n = fps_nth g n

goal (1 subgoal):
 1. fps_nth f n = fps_nth g n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fps_nth f n = fps_nth g n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Max_Image_distrib:
  includes no_floatarith_notation
  assumes "finite X" "X \<noteq> {}"
  shows "Max ((\<lambda>x. max (f1 x) (f2 x)) ` X) = max (Max (f1 ` X)) (Max (f2 ` X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MAX x\<in>X. max (f1 x) (f2 x)) = max (Max (f1 ` X)) (Max (f2 ` X))
[PROOF STEP]
apply (rule Max_eqI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite ((\<lambda>x. max (f1 x) (f2 x)) ` X)
 2. \<And>y. y \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X \<Longrightarrow> y \<le> max (Max (f1 ` X)) (Max (f2 ` X))
 3. max (Max (f1 ` X)) (Max (f2 ` X)) \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<lambda>x. max (f1 x) (f2 x)) ` X)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X
X \<noteq> {}

goal (1 subgoal):
 1. finite ((\<lambda>x. max (f1 x) (f2 x)) ` X)
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y. y \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X \<Longrightarrow> y \<le> max (Max (f1 ` X)) (Max (f2 ` X))
 2. max (Max (f1 ` X)) (Max (f2 ` X)) \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X
[PROOF STEP]
subgoal for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X \<Longrightarrow> y \<le> max (Max (f1 ` X)) (Max (f2 ` X))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X
X \<noteq> {}

goal (1 subgoal):
 1. y \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X \<Longrightarrow> y \<le> max (Max (f1 ` X)) (Max (f2 ` X))
[PROOF STEP]
by (force intro: max.coboundedI1 max.coboundedI2 Max_ge)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (Max (f1 ` X)) (Max (f2 ` X)) \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (Max (f1 ` X)) (Max (f2 ` X)) \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. max (Max (f1 ` X)) (Max (f2 ` X)) \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X
[PROOF STEP]
have "Max (f1 ` X) \<in> f1 ` X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (f1 ` X) \<in> f1 ` X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X
X \<noteq> {}

goal (1 subgoal):
 1. Max (f1 ` X) \<in> f1 ` X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max (f1 ` X) \<in> f1 ` X

goal (1 subgoal):
 1. max (Max (f1 ` X)) (Max (f2 ` X)) \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Max (f1 ` X) \<in> f1 ` X
[PROOF STEP]
obtain x1 where x1: "x1 \<in> X" "Max (f1 ` X) = f1 x1"
[PROOF STATE]
proof (prove)
using this:
Max (f1 ` X) \<in> f1 ` X

goal (1 subgoal):
 1. (\<And>x1. \<lbrakk>x1 \<in> X; Max (f1 ` X) = f1 x1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x1 \<in> X
Max (f1 ` X) = f1 x1

goal (1 subgoal):
 1. max (Max (f1 ` X)) (Max (f2 ` X)) \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X
[PROOF STEP]
have "Max (f2 ` X) \<in> f2 ` X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (f2 ` X) \<in> f2 ` X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X
X \<noteq> {}

goal (1 subgoal):
 1. Max (f2 ` X) \<in> f2 ` X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max (f2 ` X) \<in> f2 ` X

goal (1 subgoal):
 1. max (Max (f1 ` X)) (Max (f2 ` X)) \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Max (f2 ` X) \<in> f2 ` X
[PROOF STEP]
obtain x2 where x2: "x2 \<in> X" "Max (f2 ` X) = f2 x2"
[PROOF STATE]
proof (prove)
using this:
Max (f2 ` X) \<in> f2 ` X

goal (1 subgoal):
 1. (\<And>x2. \<lbrakk>x2 \<in> X; Max (f2 ` X) = f2 x2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x2 \<in> X
Max (f2 ` X) = f2 x2

goal (1 subgoal):
 1. max (Max (f1 ` X)) (Max (f2 ` X)) \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (Max (f1 ` X)) (Max (f2 ` X)) \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X
[PROOF STEP]
apply (rule image_eqI[where x="if f1 x1 \<le> f2 x2 then x2 else x1"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. max (Max (f1 ` X)) (Max (f2 ` X)) = max (f1 (if f1 x1 \<le> f2 x2 then x2 else x1)) (f2 (if f1 x1 \<le> f2 x2 then x2 else x1))
 2. (if f1 x1 \<le> f2 x2 then x2 else x1) \<in> X
[PROOF STEP]
using x1 x2 assms
[PROOF STATE]
proof (prove)
using this:
x1 \<in> X
Max (f1 ` X) = f1 x1
x2 \<in> X
Max (f2 ` X) = f2 x2
finite X
X \<noteq> {}

goal (2 subgoals):
 1. max (Max (f1 ` X)) (Max (f2 ` X)) = max (f1 (if f1 x1 \<le> f2 x2 then x2 else x1)) (f2 (if f1 x1 \<le> f2 x2 then x2 else x1))
 2. (if f1 x1 \<le> f2 x2 then x2 else x1) \<in> X
[PROOF STEP]
apply (auto simp: max_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>x1 \<in> X; Max (f1 ` X) = f1 x1; x2 \<in> X; Max (f2 ` X) = f2 x2; finite X; x \<in> X; f1 x1 \<le> f2 x2; \<not> f1 x2 \<le> f2 x2\<rbrakk> \<Longrightarrow> f2 x2 = f1 x2
 2. \<And>x. \<lbrakk>x1 \<in> X; Max (f1 ` X) = f1 x1; x2 \<in> X; Max (f2 ` X) = f2 x2; finite X; x \<in> X; \<not> f1 x1 \<le> f2 x2; f1 x1 \<le> f2 x1\<rbrakk> \<Longrightarrow> f1 x1 = f2 x1
[PROOF STEP]
apply (metis Max_ge dual_order.trans finite_imageI image_eqI assms(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x1 \<in> X; Max (f1 ` X) = f1 x1; x2 \<in> X; Max (f2 ` X) = f2 x2; finite X; x \<in> X; \<not> f1 x1 \<le> f2 x2; f1 x1 \<le> f2 x1\<rbrakk> \<Longrightarrow> f1 x1 = f2 x1
[PROOF STEP]
apply (metis Max_ge dual_order.trans finite_imageI image_eqI assms(1))
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
max (Max (f1 ` X)) (Max (f2 ` X)) \<in> (\<lambda>x. max (f1 x) (f2 x)) ` X

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma absolutely_integrable_mult_Dirichlet_kernel_reflected_part2:
  assumes f: "f absolutely_integrable_on {-pi..pi}"
    and periodic: "\<And>x. f(x + 2*pi) = f x" and "d \<le> pi"
  shows "(\<lambda>x. Dirichlet_kernel n x * (f(t+x) + f(t-x))) absolutely_integrable_on {0..d}"
        "(\<lambda>x. Dirichlet_kernel n x * ((f(t+x) + f(t-x)) - c)) absolutely_integrable_on {0..d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. Dirichlet_kernel n x * (f (t + x) + f (t - x))) absolutely_integrable_on {0..d} &&& (\<lambda>x. Dirichlet_kernel n x * (f (t + x) + f (t - x) - c)) absolutely_integrable_on {0..d}
[PROOF STEP]
using absolutely_integrable_mult_Dirichlet_kernel_reflected_part assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f absolutely_integrable_on {- pi..pi}; \<And>x. ?f (x + 2 * pi) = ?f x; ?d \<le> pi\<rbrakk> \<Longrightarrow> (\<lambda>x. Dirichlet_kernel ?n x * ?f (?t + x)) absolutely_integrable_on {0..?d}
\<lbrakk>?f absolutely_integrable_on {- pi..pi}; \<And>x. ?f (x + 2 * pi) = ?f x; ?d \<le> pi\<rbrakk> \<Longrightarrow> (\<lambda>x. Dirichlet_kernel ?n x * ?f (?t - x)) absolutely_integrable_on {0..?d}
\<lbrakk>?f absolutely_integrable_on {- pi..pi}; \<And>x. ?f (x + 2 * pi) = ?f x; ?d \<le> pi\<rbrakk> \<Longrightarrow> (\<lambda>x. Dirichlet_kernel ?n x * ?c) absolutely_integrable_on {0..?d}
f absolutely_integrable_on {- pi..pi}
f (?x + 2 * pi) = f ?x
d \<le> pi

goal (1 subgoal):
 1. (\<lambda>x. Dirichlet_kernel n x * (f (t + x) + f (t - x))) absolutely_integrable_on {0..d} &&& (\<lambda>x. Dirichlet_kernel n x * (f (t + x) + f (t - x) - c)) absolutely_integrable_on {0..d}
[PROOF STEP]
by (simp_all add: distrib_left right_diff_distrib)