[STATEMENT]
theorem harry_sum_closed_form: "harry_sum n = n * (n + 1) * 2 ^ n div 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harry_sum n = n * (n + 1) * 2 ^ n div 4
[PROOF STEP]
using harry_sum_closed_form_aux[of n]
[PROOF STATE]
proof (prove)
using this:
4 * harry_sum n = n * (n + 1) * 2 ^ n

goal (1 subgoal):
 1. harry_sum n = n * (n + 1) * 2 ^ n div 4
[PROOF STEP]
by simp


[STATEMENT]
lemma cos_tan_half: "cos x \<noteq>0 \<Longrightarrow>  cos (2*x) = (1 - (tan x)^2) / (1+ (tan x)^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x \<noteq> (0::'a) \<Longrightarrow> cos ((2::'a) * x) = ((1::'a) - (tan x)\<^sup>2) / ((1::'a) + (tan x)\<^sup>2)
[PROOF STEP]
unfolding cos_double tan_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x \<noteq> (0::'a) \<Longrightarrow> (cos x)\<^sup>2 - (sin x)\<^sup>2 = ((1::'a) - (sin x / cos x)\<^sup>2) / ((1::'a) + (sin x / cos x)\<^sup>2)
[PROOF STEP]
by (auto simp add:field_simps )


[STATEMENT]
theorem exp_times_self_eq_iff:
  "w * exp w = x \<longleftrightarrow> x \<ge> -exp (-1) \<and> (w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w * exp w = x) = (- exp (- 1) \<le> x \<and> (w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x))
[PROOF STEP]
using exp_times_self_eqD[of w x]
[PROOF STATE]
proof (prove)
using this:
w * exp w = x \<Longrightarrow> - exp (- 1) \<le> x
w * exp w = x \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x

goal (1 subgoal):
 1. (w * exp w = x) = (- exp (- 1) \<le> x \<and> (w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x))
[PROOF STEP]
by (auto simp: Lambert_W_times_exp_self Lambert_W'_times_exp_self)


[STATEMENT]
lemma mat_kernel: assumes "A \<in> carrier_mat nr nc"
  shows "mat_kernel A = {v. v \<in> carrier_vec nc \<and> A *\<^sub>v v = 0\<^sub>v nr}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_kernel A = {v \<in> carrier_vec nc. A *\<^sub>v v = 0\<^sub>v nr}
[PROOF STEP]
unfolding mat_kernel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {v \<in> carrier_vec (dim_col A). A *\<^sub>v v = 0\<^sub>v (dim_row A)} = {v \<in> carrier_vec nc. A *\<^sub>v v = 0\<^sub>v nr}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. {v \<in> carrier_vec (dim_col A). A *\<^sub>v v = 0\<^sub>v (dim_row A)} = {v \<in> carrier_vec nc. A *\<^sub>v v = 0\<^sub>v nr}
[PROOF STEP]
by auto


[STATEMENT]
lemma arsinh_minus_real [simp]: "arsinh (-x::real) = -arsinh x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
have "arsinh (-x) = ln (sqrt (x\<^sup>2 + 1) - x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arsinh (- x) = ln (sqrt (x\<^sup>2 + 1) - x)
[PROOF STEP]
by (simp add: arsinh_real_def)
[PROOF STATE]
proof (state)
this:
arsinh (- x) = ln (sqrt (x\<^sup>2 + 1) - x)

goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arsinh (- x) = ln (sqrt (x\<^sup>2 + 1) - x)

goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
have "sqrt (x^2 + 1) - x = inverse (sqrt (x^2 + 1) + x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x\<^sup>2 + 1) - x = inverse (sqrt (x\<^sup>2 + 1) + x)
[PROOF STEP]
using arsinh_real_aux[of x]
[PROOF STATE]
proof (prove)
using this:
0 < x + sqrt (x\<^sup>2 + 1)

goal (1 subgoal):
 1. sqrt (x\<^sup>2 + 1) - x = inverse (sqrt (x\<^sup>2 + 1) + x)
[PROOF STEP]
by (simp add: field_split_simps algebra_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
sqrt (x\<^sup>2 + 1) - x = inverse (sqrt (x\<^sup>2 + 1) + x)

goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt (x\<^sup>2 + 1) - x = inverse (sqrt (x\<^sup>2 + 1) + x)

goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
have "ln \<dots> = -arsinh x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (inverse (sqrt (x\<^sup>2 + 1) + x)) = - arsinh x
[PROOF STEP]
using arsinh_real_aux[of x]
[PROOF STATE]
proof (prove)
using this:
0 < x + sqrt (x\<^sup>2 + 1)

goal (1 subgoal):
 1. ln (inverse (sqrt (x\<^sup>2 + 1) + x)) = - arsinh x
[PROOF STEP]
by (simp add: arsinh_real_def ln_inverse)
[PROOF STATE]
proof (state)
this:
ln (inverse (sqrt (x\<^sup>2 + 1) + x)) = - arsinh x

goal (1 subgoal):
 1. arsinh (- x) = - arsinh x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
arsinh (- x) = - arsinh x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
arsinh (- x) = - arsinh x

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diag_mat_mul_diag_ele:
  fixes A B :: "complex mat"
  assumes dimA: "A \<in> carrier_mat n n" and dimB: "B \<in> carrier_mat n n"
    and dA: "diagonal_mat A" and dB: "diagonal_mat B"
  shows "\<forall>i<n. (A*B) $$ (i,i) = A$$(i, i) * B$$(i, i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<n. (A * B) $$ (i, i) = A $$ (i, i) * B $$ (i, i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i<n. (A * B) $$ (i, i) = A $$ (i, i) * B $$ (i, i)
[PROOF STEP]
have AB: "A * B = mat n n (\<lambda>(i,j). if i = j then (A$$(i, i)) * (B$$(i, i)) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
[PROOF STEP]
using diag_mat_mult_diag_mat[of A n B] dimA dimB dA dB
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A \<in> carrier_mat n n; B \<in> carrier_mat n n; diagonal_mat A; diagonal_mat B\<rbrakk> \<Longrightarrow> A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
A \<in> carrier_mat n n
B \<in> carrier_mat n n
diagonal_mat A
diagonal_mat B

goal (1 subgoal):
 1. A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)

goal (1 subgoal):
 1. \<forall>i<n. (A * B) $$ (i, i) = A $$ (i, i) * B $$ (i, i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)

goal (1 subgoal):
 1. \<forall>i<n. (A * B) $$ (i, i) = A $$ (i, i) * B $$ (i, i)
[PROOF STEP]
using AB
[PROOF STATE]
proof (prove)
using this:
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)

goal (1 subgoal):
 1. \<forall>i<n. (A * B) $$ (i, i) = A $$ (i, i) * B $$ (i, i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<n. (A * B) $$ (i, i) = A $$ (i, i) * B $$ (i, i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma orthogonal_matrix_fst_QR_decomposition:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  assumes r: "rank A = ncols A"
  shows "transpose (fst (QR_decomposition A)) ** (fst (QR_decomposition A)) = mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A) = mat 1
[PROOF STEP]
proof (unfold vec_eq_iff, clarify, unfold mat_1_fun, auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ ia $ ia = 1
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
define Q where "Q = fst (QR_decomposition A)"
[PROOF STATE]
proof (state)
this:
Q = fst (QR_decomposition A)

goal (2 subgoals):
 1. \<And>ia. (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ ia $ ia = 1
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
have n: "\<forall>i. norm (column i Q) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. norm (column i Q) = 1
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. norm (column i (fst (QR_decomposition A))) = 1
[PROOF STEP]
using norm_columns_fst_QR_decomposition[OF r]
[PROOF STATE]
proof (prove)
using this:
norm (column ?i (fst (QR_decomposition A))) = 1

goal (1 subgoal):
 1. \<forall>i. norm (column i (fst (QR_decomposition A))) = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i. norm (column i Q) = 1

goal (2 subgoals):
 1. \<And>ia. (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ ia $ ia = 1
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
have c: "card (columns Q) = ncols A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (columns Q) = ncols A
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (columns (fst (QR_decomposition A))) = ncols A
[PROOF STEP]
by (metis full_rank_imp_is_basis2 independent_columns_fst_QR_decomposition r)
[PROOF STATE]
proof (state)
this:
card (columns Q) = ncols A

goal (2 subgoals):
 1. \<And>ia. (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ ia $ ia = 1
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
have p: "pairwise orthogonal (columns Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise orthogonal (columns Q)
[PROOF STEP]
by (metis Q_def orthogonal_fst_QR_decomposition)
[PROOF STATE]
proof (state)
this:
pairwise orthogonal (columns Q)

goal (2 subgoals):
 1. \<And>ia. (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ ia $ ia = 1
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
fix ia
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ ia $ ia = 1
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
have "(transpose Q ** Q) $ ia $ ia = column ia Q \<bullet> column ia Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Finite_Cartesian_Product.transpose Q ** Q) $ ia $ ia = column ia Q \<bullet> column ia Q
[PROOF STEP]
unfolding matrix_matrix_mult_inner_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row ia (Finite_Cartesian_Product.transpose Q) \<bullet> column ia Q = column ia Q \<bullet> column ia Q
[PROOF STEP]
unfolding row_transpose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column ia Q \<bullet> column ia Q = column ia Q \<bullet> column ia Q
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(Finite_Cartesian_Product.transpose Q ** Q) $ ia $ ia = column ia Q \<bullet> column ia Q

goal (2 subgoals):
 1. \<And>ia. (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ ia $ ia = 1
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Finite_Cartesian_Product.transpose Q ** Q) $ ia $ ia = column ia Q \<bullet> column ia Q

goal (2 subgoals):
 1. \<And>ia. (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ ia $ ia = 1
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
have "... = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column ia Q \<bullet> column ia Q = 1
[PROOF STEP]
using n norm_eq_1
[PROOF STATE]
proof (prove)
using this:
\<forall>i. norm (column i Q) = 1
(norm ?x = 1) = (?x \<bullet> ?x = 1)

goal (1 subgoal):
 1. column ia Q \<bullet> column ia Q = 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
column ia Q \<bullet> column ia Q = 1

goal (2 subgoals):
 1. \<And>ia. (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ ia $ ia = 1
 2. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(Finite_Cartesian_Product.transpose Q ** Q) $ ia $ ia = 1
[PROOF STEP]
show "(transpose Q ** Q) $ ia $ ia = 1"
[PROOF STATE]
proof (prove)
using this:
(Finite_Cartesian_Product.transpose Q ** Q) $ ia $ ia = 1

goal (1 subgoal):
 1. (Finite_Cartesian_Product.transpose Q ** Q) $ ia $ ia = 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(Finite_Cartesian_Product.transpose Q ** Q) $ ia $ ia = 1

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
assume i_not_ia: "i \<noteq> ia"
[PROOF STATE]
proof (state)
this:
i \<noteq> ia

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
have column_i_not_ia: "column i Q \<noteq> column ia Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i Q \<noteq> column ia Q
[PROOF STEP]
proof (rule ccontr, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. column i Q = column ia Q \<Longrightarrow> False
[PROOF STEP]
assume col_i_ia: "column i Q = column ia Q"
[PROOF STATE]
proof (state)
this:
column i Q = column ia Q

goal (1 subgoal):
 1. column i Q = column ia Q \<Longrightarrow> False
[PROOF STEP]
have rw: "(\<lambda>i. column i Q)` (UNIV-{ia}) = {column i Q|i. i\<noteq>ia}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. column i Q) ` (UNIV - {ia}) = {column i Q |i. i \<noteq> ia}
[PROOF STEP]
unfolding columns_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. column i Q) ` (UNIV - {ia}) = {column i Q |i. i \<noteq> ia}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. column i Q) ` (UNIV - {ia}) = {column i Q |i. i \<noteq> ia}

goal (1 subgoal):
 1. column i Q = column ia Q \<Longrightarrow> False
[PROOF STEP]
have "card (columns Q) = card ({column i Q|i. i\<noteq>ia})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (columns Q) = card {column i Q |i. i \<noteq> ia}
[PROOF STEP]
by (rule bij_betw_same_card[of id], unfold bij_betw_def columns_def, auto, metis col_i_ia i_not_ia)
[PROOF STATE]
proof (state)
this:
card (columns Q) = card {column i Q |i. i \<noteq> ia}

goal (1 subgoal):
 1. column i Q = column ia Q \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (columns Q) = card {column i Q |i. i \<noteq> ia}

goal (1 subgoal):
 1. column i Q = column ia Q \<Longrightarrow> False
[PROOF STEP]
have "... = card ((\<lambda>i. column i Q)` (UNIV-{ia}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {column i Q |i. i \<noteq> ia} = card ((\<lambda>i. column i Q) ` (UNIV - {ia}))
[PROOF STEP]
unfolding rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {column i Q |i. i \<noteq> ia} = card {column i Q |i. i \<noteq> ia}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
card {column i Q |i. i \<noteq> ia} = card ((\<lambda>i. column i Q) ` (UNIV - {ia}))

goal (1 subgoal):
 1. column i Q = column ia Q \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {column i Q |i. i \<noteq> ia} = card ((\<lambda>i. column i Q) ` (UNIV - {ia}))

goal (1 subgoal):
 1. column i Q = column ia Q \<Longrightarrow> False
[PROOF STEP]
have "... \<le> card (UNIV - {ia})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>i. column i Q) ` (UNIV - {ia})) \<le> card (UNIV - {ia})
[PROOF STEP]
by (metis card_image_le finite_code)
[PROOF STATE]
proof (state)
this:
card ((\<lambda>i. column i Q) ` (UNIV - {ia})) \<le> card (UNIV - {ia})

goal (1 subgoal):
 1. column i Q = column ia Q \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((\<lambda>i. column i Q) ` (UNIV - {ia})) \<le> card (UNIV - {ia})

goal (1 subgoal):
 1. column i Q = column ia Q \<Longrightarrow> False
[PROOF STEP]
have "... < CARD ('n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (UNIV - {ia}) < CARD('n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (UNIV - {ia}) < CARD('n)

goal (1 subgoal):
 1. column i Q = column ia Q \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (columns Q) < CARD('n)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
card (columns Q) < CARD('n)

goal (1 subgoal):
 1. False
[PROOF STEP]
using c
[PROOF STATE]
proof (prove)
using this:
card (columns Q) < CARD('n)
card (columns Q) = ncols A

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
card (columns Q) < CARD('n)
card (columns Q) = CARD('n)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
column i Q \<noteq> column ia Q

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
hence oia: "orthogonal (column i Q) (column ia Q)"
[PROOF STATE]
proof (prove)
using this:
column i Q \<noteq> column ia Q

goal (1 subgoal):
 1. orthogonal (column i Q) (column ia Q)
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
column i Q \<noteq> column ia Q
pairwise orthogonal (columns Q)

goal (1 subgoal):
 1. orthogonal (column i Q) (column ia Q)
[PROOF STEP]
unfolding pairwise_def
[PROOF STATE]
proof (prove)
using this:
column i Q \<noteq> column ia Q
\<forall>x\<in>columns Q. \<forall>y\<in>columns Q. x \<noteq> y \<longrightarrow> orthogonal x y

goal (1 subgoal):
 1. orthogonal (column i Q) (column ia Q)
[PROOF STEP]
unfolding columns_def
[PROOF STATE]
proof (prove)
using this:
column i Q \<noteq> column ia Q
\<forall>x\<in>{column i Q |i. i \<in> UNIV}. \<forall>y\<in>{column i Q |i. i \<in> UNIV}. x \<noteq> y \<longrightarrow> orthogonal x y

goal (1 subgoal):
 1. orthogonal (column i Q) (column ia Q)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
orthogonal (column i Q) (column ia Q)

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
have "(transpose Q ** Q) $ i $ ia = column i Q \<bullet> column ia Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Finite_Cartesian_Product.transpose Q ** Q) $ i $ ia = column i Q \<bullet> column ia Q
[PROOF STEP]
unfolding matrix_matrix_mult_inner_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row i (Finite_Cartesian_Product.transpose Q) \<bullet> column ia Q = column i Q \<bullet> column ia Q
[PROOF STEP]
unfolding row_transpose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i Q \<bullet> column ia Q = column i Q \<bullet> column ia Q
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(Finite_Cartesian_Product.transpose Q ** Q) $ i $ ia = column i Q \<bullet> column ia Q

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Finite_Cartesian_Product.transpose Q ** Q) $ i $ ia = column i Q \<bullet> column ia Q

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i Q \<bullet> column ia Q = 0
[PROOF STEP]
using oia
[PROOF STATE]
proof (prove)
using this:
orthogonal (column i Q) (column ia Q)

goal (1 subgoal):
 1. column i Q \<bullet> column ia Q = 0
[PROOF STEP]
unfolding orthogonal_def
[PROOF STATE]
proof (prove)
using this:
column i Q \<bullet> column ia Q = 0

goal (1 subgoal):
 1. column i Q \<bullet> column ia Q = 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
column i Q \<bullet> column ia Q = 0

goal (1 subgoal):
 1. \<And>i ia. i \<noteq> ia \<Longrightarrow> (Finite_Cartesian_Product.transpose (fst (QR_decomposition A)) ** fst (QR_decomposition A)) $ i $ ia = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(Finite_Cartesian_Product.transpose Q ** Q) $ i $ ia = 0
[PROOF STEP]
show "(transpose Q ** Q) $ i $ ia = 0"
[PROOF STATE]
proof (prove)
using this:
(Finite_Cartesian_Product.transpose Q ** Q) $ i $ ia = 0

goal (1 subgoal):
 1. (Finite_Cartesian_Product.transpose Q ** Q) $ i $ ia = 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(Finite_Cartesian_Product.transpose Q ** Q) $ i $ ia = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scalar_left_mono: assumes
  "u \<in> carrier_vec n" "v \<in> carrier_vec n" "w \<in> carrier_vec n"
  and "\<And> i. i < n \<Longrightarrow> u $ i \<ge> v $ i"
  and "\<And> i. i < n \<Longrightarrow> w $ i \<ge> (0 :: 'a :: ordered_semiring_0)"
  shows "u \<bullet> w \<ge> v \<bullet> w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<bullet> w \<le> u \<bullet> w
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec w. v $ i * w $ i) \<le> (\<Sum>i = 0..<dim_vec w. u $ i * w $ i)
[PROOF STEP]
by (intro sum_mono_ge times_left_mono, insert assms, auto)


[STATEMENT]
lemma char_matrix_jordan_block: "char_matrix (jordan_block n a) b = (jordan_block n (a - b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_matrix (jordan_block n a) b = jordan_block n (a - b)
[PROOF STEP]
unfolding char_matrix_def jordan_block_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i = j then a else if Suc i = j then 1::'b else (0::'b)) + - b \<cdot>\<^sub>m 1\<^sub>m (dim_row (mat n n (\<lambda>(i, j). if i = j then a else if Suc i = j then 1::'b else (0::'b)))) = mat n n (\<lambda>(i, j). if i = j then a - b else if Suc i = j then 1::'b else (0::'b))
[PROOF STEP]
by auto


[STATEMENT]
theorem "\<Gamma>\<turnstile> \<lbrace>True\<rbrace>
           \<acute>S :== 0;; \<acute>I :== 1;;
           WHILE \<acute>I \<noteq> n
           INV \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
           DO
             \<acute>S :== \<acute>S + \<acute>I;;
             \<acute>I :== \<acute>I + 1
           OD
          \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n INV \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace> DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n INV \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace> DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
let ?sum = "\<lambda>k. SUMM j<k. j"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n INV \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace> DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
let ?inv = "\<lambda>s i. s = ?sum i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n INV \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace> DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n INV \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace> DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
proof vcg
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. True \<Longrightarrow> 0 = (SUMM j<1. j)
 2. \<And>I S. \<lbrakk>S = (SUMM j<I. j); I \<noteq> n\<rbrakk> \<Longrightarrow> S + I = (SUMM j<I + 1. j)
 3. \<And>I S. \<lbrakk>S = (SUMM j<I. j); \<not> I \<noteq> n\<rbrakk> \<Longrightarrow> S = (SUMM j<n. j)
[PROOF STEP]
show "?inv 0 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = (SUMM j<1. j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 = (SUMM j<1. j)

goal (2 subgoals):
 1. \<And>I S. \<lbrakk>S = (SUMM j<I. j); I \<noteq> n\<rbrakk> \<Longrightarrow> S + I = (SUMM j<I + 1. j)
 2. \<And>I S. \<lbrakk>S = (SUMM j<I. j); \<not> I \<noteq> n\<rbrakk> \<Longrightarrow> S = (SUMM j<n. j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>I S. \<lbrakk>S = (SUMM j<I. j); I \<noteq> n\<rbrakk> \<Longrightarrow> S + I = (SUMM j<I + 1. j)
 2. \<And>I S. \<lbrakk>S = (SUMM j<I. j); \<not> I \<noteq> n\<rbrakk> \<Longrightarrow> S = (SUMM j<n. j)
[PROOF STEP]
fix i s
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>I S. \<lbrakk>S = (SUMM j<I. j); I \<noteq> n\<rbrakk> \<Longrightarrow> S + I = (SUMM j<I + 1. j)
 2. \<And>I S. \<lbrakk>S = (SUMM j<I. j); \<not> I \<noteq> n\<rbrakk> \<Longrightarrow> S = (SUMM j<n. j)
[PROOF STEP]
assume "?inv s i" "i \<noteq> n"
[PROOF STATE]
proof (state)
this:
s = (SUMM j<i. j)
i \<noteq> n

goal (2 subgoals):
 1. \<And>I S. \<lbrakk>S = (SUMM j<I. j); I \<noteq> n\<rbrakk> \<Longrightarrow> S + I = (SUMM j<I + 1. j)
 2. \<And>I S. \<lbrakk>S = (SUMM j<I. j); \<not> I \<noteq> n\<rbrakk> \<Longrightarrow> S = (SUMM j<n. j)
[PROOF STEP]
thus "?inv (s + i) (i + 1)"
[PROOF STATE]
proof (prove)
using this:
s = (SUMM j<i. j)
i \<noteq> n

goal (1 subgoal):
 1. s + i = (SUMM j<i + 1. j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
s + i = (SUMM j<i + 1. j)

goal (1 subgoal):
 1. \<And>I S. \<lbrakk>S = (SUMM j<I. j); \<not> I \<noteq> n\<rbrakk> \<Longrightarrow> S = (SUMM j<n. j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>I S. \<lbrakk>S = (SUMM j<I. j); \<not> I \<noteq> n\<rbrakk> \<Longrightarrow> S = (SUMM j<n. j)
[PROOF STEP]
fix i s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>I S. \<lbrakk>S = (SUMM j<I. j); \<not> I \<noteq> n\<rbrakk> \<Longrightarrow> S = (SUMM j<n. j)
[PROOF STEP]
assume x: "?inv s i" "\<not> i \<noteq> n"
[PROOF STATE]
proof (state)
this:
s = (SUMM j<i. j)
\<not> i \<noteq> n

goal (1 subgoal):
 1. \<And>I S. \<lbrakk>S = (SUMM j<I. j); \<not> I \<noteq> n\<rbrakk> \<Longrightarrow> S = (SUMM j<n. j)
[PROOF STEP]
thus "s = ?sum n"
[PROOF STATE]
proof (prove)
using this:
s = (SUMM j<i. j)
\<not> i \<noteq> n

goal (1 subgoal):
 1. s = (SUMM j<n. j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
s = (SUMM j<n. j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n INV \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace> DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trace_matrix_sum_linear:
  fixes f :: "nat \<Rightarrow> complex mat"
  shows "(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = sum (\<lambda>k. trace (f k)) {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k))
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>k. k < 0 \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f 0) = (\<Sum>k = 0..<0. trace (f k))
 2. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k)); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
?k < 0 \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (2 subgoals):
 1. (\<And>k. k < 0 \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f 0) = (\<Sum>k = 0..<0. trace (f k))
 2. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k)); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (matrix_sum d f 0) = (\<Sum>k = 0..<0. trace (f k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (matrix_sum d f 0) = (\<Sum>k = 0..<0. trace (f k))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k)); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k)); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k))
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k)); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k))
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d
[PROOF STEP]
have "\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k))
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d

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

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k)); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d
[PROOF STEP]
have ds: "matrix_sum d f n \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
using this:
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d f n \<in> carrier_mat d d
[PROOF STEP]
using matrix_sum_dim
[PROOF STATE]
proof (prove)
using this:
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d
(\<And>k. k < ?n \<Longrightarrow> ?f k \<in> carrier_mat ?d ?d) \<Longrightarrow> matrix_sum ?d ?f ?n \<in> carrier_mat ?d ?d

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

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k)); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
have "trace (matrix_sum d f (Suc n)) = trace (f n) + trace (matrix_sum d f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (matrix_sum d f (Suc n)) = trace (f n) + trace (matrix_sum d f n)
[PROOF STEP]
unfolding matrix_sum.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (f n + matrix_sum d f n) = trace (f n) + trace (matrix_sum d f n)
[PROOF STEP]
apply (mat_assoc d)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. matrix_sum d f n \<in> carrier_mat d d
 2. f n \<in> carrier_mat d d
[PROOF STEP]
using ds Suc
[PROOF STATE]
proof (prove)
using this:
matrix_sum d f n \<in> carrier_mat d d
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k))
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (2 subgoals):
 1. matrix_sum d f n \<in> carrier_mat d d
 2. f n \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (matrix_sum d f (Suc n)) = trace (f n) + trace (matrix_sum d f n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k)); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (matrix_sum d f (Suc n)) = trace (f n) + trace (matrix_sum d f n)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k)); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
have "\<dots> = sum (trace \<circ> f) {0..<n} + (trace \<circ> f) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (f n) + trace (matrix_sum d f n) = sum (trace \<circ> f) {0..<n} + (trace \<circ> f) n
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k))
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. trace (f n) + trace (matrix_sum d f n) = sum (trace \<circ> f) {0..<n} + (trace \<circ> f) n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (f n) + trace (matrix_sum d f n) = sum (trace \<circ> f) {0..<n} + (trace \<circ> f) n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k)); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (f n) + trace (matrix_sum d f n) = sum (trace \<circ> f) {0..<n} + (trace \<circ> f) n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k)); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
have "\<dots> = sum (trace \<circ> f) {0..<Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (trace \<circ> f) {0..<n} + (trace \<circ> f) n = sum (trace \<circ> f) {0..<Suc n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum (trace \<circ> f) {0..<n} + (trace \<circ> f) n = sum (trace \<circ> f) {0..<Suc n}

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> trace (matrix_sum d f n) = (\<Sum>k = 0..<n. trace (f k)); \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
trace (matrix_sum d f (Suc n)) = sum (trace \<circ> f) {0..<Suc n}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
trace (matrix_sum d f (Suc n)) = sum (trace \<circ> f) {0..<Suc n}

goal (1 subgoal):
 1. trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (matrix_sum d f (Suc n)) = (\<Sum>k = 0..<Suc n. trace (f k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arg_complex_of_real_times_i_negative [simp]:
  assumes "k < 0"
  shows "Arg (cor k * \<i>) = - pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (cor k * \<i>) = - pi / 2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Arg (cor k * \<i>) = - pi / 2
[PROOF STEP]
have "sin (Arg (Complex 0 k)) < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (Arg (Complex 0 k)) < 0
[PROOF STEP]
using \<open>k < 0\<close> rcis_cmod_Arg[of "Complex 0 k"] Im_rcis[of "cmod (Complex 0 k)" "Arg (Complex 0 k)"]
[PROOF STATE]
proof (prove)
using this:
k < 0
rcis (cmod (Complex 0 k)) (Arg (Complex 0 k)) = Complex 0 k
Im (rcis (cmod (Complex 0 k)) (Arg (Complex 0 k))) = cmod (Complex 0 k) * sin (Arg (Complex 0 k))

goal (1 subgoal):
 1. sin (Arg (Complex 0 k)) < 0
[PROOF STEP]
by (metis complex.sel(2) mult_less_0_iff norm_not_less_zero)
[PROOF STATE]
proof (state)
this:
sin (Arg (Complex 0 k)) < 0

goal (1 subgoal):
 1. Arg (cor k * \<i>) = - pi / 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sin (Arg (Complex 0 k)) < 0

goal (1 subgoal):
 1. Arg (cor k * \<i>) = - pi / 2
[PROOF STEP]
using assms is_imag_arg2[of "cor k * \<i>"]
[PROOF STATE]
proof (prove)
using this:
sin (Arg (Complex 0 k)) < 0
k < 0
\<lbrakk>is_imag (cor k * \<i>); cor k * \<i> \<noteq> 0\<rbrakk> \<Longrightarrow> Arg (cor k * \<i>) = pi / 2 \<or> Arg (cor k * \<i>) = - pi / 2

goal (1 subgoal):
 1. Arg (cor k * \<i>) = - pi / 2
[PROOF STEP]
using Arg_zero complex_of_real_i[of k]
[PROOF STATE]
proof (prove)
using this:
sin (Arg (Complex 0 k)) < 0
k < 0
\<lbrakk>is_imag (cor k * \<i>); cor k * \<i> \<noteq> 0\<rbrakk> \<Longrightarrow> Arg (cor k * \<i>) = pi / 2 \<or> Arg (cor k * \<i>) = - pi / 2
Arg 0 = 0
cor k * \<i> = Complex 0 k

goal (1 subgoal):
 1. Arg (cor k * \<i>) = - pi / 2
[PROOF STEP]
by (smt complex.sel(1) sin_pi_half sin_zero)
[PROOF STATE]
proof (state)
this:
Arg (cor k * \<i>) = - pi / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma suminf_ln_real:
  fixes f :: "nat \<Rightarrow> real"
  assumes f: "convergent_prod f" and 0: "\<And>x. f x > 0"
  shows "suminf (\<lambda>i. ln (f i)) = ln (prodinf f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. ln (f i)) = ln (prodinf f)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i. ln (f i)) = ln (prodinf f)
[PROOF STEP]
have "f has_prod prodinf f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f has_prod prodinf f
[PROOF STEP]
by (simp add: f has_prod_iff)
[PROOF STATE]
proof (state)
this:
f has_prod prodinf f

goal (1 subgoal):
 1. (\<Sum>i. ln (f i)) = ln (prodinf f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f has_prod prodinf f
[PROOF STEP]
have "raw_has_prod f 0 (prodinf f)"
[PROOF STATE]
proof (prove)
using this:
f has_prod prodinf f

goal (1 subgoal):
 1. raw_has_prod f 0 (prodinf f)
[PROOF STEP]
by (metis "0" has_prod_def less_irrefl)
[PROOF STATE]
proof (state)
this:
raw_has_prod f 0 (prodinf f)

goal (1 subgoal):
 1. (\<Sum>i. ln (f i)) = ln (prodinf f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
raw_has_prod f 0 (prodinf f)
[PROOF STEP]
have "(\<lambda>i. ln (f i)) sums ln (prodinf f)"
[PROOF STATE]
proof (prove)
using this:
raw_has_prod f 0 (prodinf f)

goal (1 subgoal):
 1. (\<lambda>i. ln (f i)) sums ln (prodinf f)
[PROOF STEP]
using "0" has_prod_imp_sums_ln_real
[PROOF STATE]
proof (prove)
using this:
raw_has_prod f 0 (prodinf f)
0 < f ?x
\<lbrakk>raw_has_prod ?f 0 ?p; \<And>x. 0 < ?f x\<rbrakk> \<Longrightarrow> (\<lambda>i. ln (?f i)) sums ln ?p

goal (1 subgoal):
 1. (\<lambda>i. ln (f i)) sums ln (prodinf f)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>i. ln (f i)) sums ln (prodinf f)

goal (1 subgoal):
 1. (\<Sum>i. ln (f i)) = ln (prodinf f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. ln (f i)) sums ln (prodinf f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. ln (f i)) sums ln (prodinf f)

goal (1 subgoal):
 1. (\<Sum>i. ln (f i)) = ln (prodinf f)
[PROOF STEP]
by (rule sums_unique [symmetric])
[PROOF STATE]
proof (state)
this:
(\<Sum>i. ln (f i)) = ln (prodinf f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cindex_polyE_rec:
  fixes p q::"real poly"
  assumes "a < b" "coprime p q"
  shows "cindex_polyE a b q p  = cross_alt q p a b/2  +  cindex_polyE a b (- (p mod q)) q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b q p = real_of_int (cross_alt q p a b) / 2 + cindex_polyE a b (- (p mod q)) q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_polyE a b q p = real_of_int (cross_alt q p a b) / 2 + cindex_polyE a b (- (p mod q)) q
[PROOF STEP]
note cindex_polyE_inverse_add_cross[OF assms]
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2

goal (1 subgoal):
 1. cindex_polyE a b q p = real_of_int (cross_alt q p a b) / 2 + cindex_polyE a b (- (p mod q)) q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2

goal (1 subgoal):
 1. cindex_polyE a b q p = real_of_int (cross_alt q p a b) / 2 + cindex_polyE a b (- (p mod q)) q
[PROOF STEP]
have "cindex_polyE a b (- (p mod q)) q = - cindex_polyE a b p q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE a b (- (p mod q)) q = - cindex_polyE a b p q
[PROOF STEP]
using cindex_polyE_mod cindex_polyE_smult_1[of a b "-1"]
[PROOF STATE]
proof (prove)
using this:
cindex_polyE ?a ?b ?q ?p = cindex_polyE ?a ?b (?q mod ?p) ?p
cindex_polyE a b (smult (- 1) ?q) ?p = sgn (- 1) * cindex_polyE a b ?q ?p

goal (1 subgoal):
 1. cindex_polyE a b (- (p mod q)) q = - cindex_polyE a b p q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cindex_polyE a b (- (p mod q)) q = - cindex_polyE a b p q

goal (1 subgoal):
 1. cindex_polyE a b q p = real_of_int (cross_alt q p a b) / 2 + cindex_polyE a b (- (p mod q)) q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
cindex_polyE a b (- (p mod q)) q = - cindex_polyE a b p q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cindex_polyE a b q p + cindex_polyE a b p q = real_of_int (cross_alt p q a b) / 2
cindex_polyE a b (- (p mod q)) q = - cindex_polyE a b p q

goal (1 subgoal):
 1. cindex_polyE a b q p = real_of_int (cross_alt q p a b) / 2 + cindex_polyE a b (- (p mod q)) q
[PROOF STEP]
by (auto simp add:field_simps cross_alt_poly_commute)
[PROOF STATE]
proof (state)
this:
cindex_polyE a b q p = real_of_int (cross_alt q p a b) / 2 + cindex_polyE a b (- (p mod q)) q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fInf_unfold: "(f::nat \<Rightarrow> 'a) 0 \<sqinter> (\<Sqinter>n. f (Suc n)) = (\<Sqinter>n. f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) = \<Sqinter> range f
[PROOF STEP]
apply (intro order.antisym inf_greatest)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) \<le> \<Sqinter> range f
 2. \<Sqinter> range f \<le> f 0
 3. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
apply (rule Inf_greatest, safe)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x n. n \<in> UNIV \<Longrightarrow> f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) \<le> f n
 2. \<Sqinter> range f \<le> f 0
 3. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
apply (case_tac n)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x n. \<lbrakk>n \<in> UNIV; n = 0\<rbrakk> \<Longrightarrow> f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) \<le> f n
 2. \<And>x n nat. \<lbrakk>n \<in> UNIV; n = Suc nat\<rbrakk> \<Longrightarrow> f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) \<le> f n
 3. \<Sqinter> range f \<le> f 0
 4. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n nat. n = Suc nat \<Longrightarrow> f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) \<le> f (Suc nat)
 2. \<Sqinter> range f \<le> f 0
 3. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
using Inf_lower inf.coboundedI2
[PROOF STATE]
proof (prove)
using this:
?x \<in> ?A \<Longrightarrow> \<Sqinter> ?A \<le> ?x
?b \<le> ?c \<Longrightarrow> ?a \<sqinter> ?b \<le> ?c

goal (3 subgoals):
 1. \<And>n nat. n = Suc nat \<Longrightarrow> f 0 \<sqinter> (\<Sqinter>n. f (Suc n)) \<le> f (Suc nat)
 2. \<Sqinter> range f \<le> f 0
 3. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<Sqinter> range f \<le> f 0
 2. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
apply (simp add: Inf_lower)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> range f \<le> (\<Sqinter>n. f (Suc n))
[PROOF STEP]
by (auto intro: Inf_mono)


[STATEMENT]
lemma det_dim_2: assumes A: "A \<in> carrier_mat n n"
  and n: "n = 2"
shows "Determinant.det A = A $$ (0,0) * A $$ (1,1) - A $$ (0,1) * A $$ (1,0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det A = A $$ (0, 0) * A $$ (1, 1) - A $$ (0, 1) * A $$ (1, 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det A = A $$ (0, 0) * A $$ (1, 1) - A $$ (0, 1) * A $$ (1, 0)
[PROOF STEP]
have set: "(\<Sum>i<(2 :: nat). f i) = f 0 + f 1" for f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<2} = f 0 + f 1
[PROOF STEP]
by (subst sum.cong[of _ "{0,1}" f f], auto)
[PROOF STATE]
proof (state)
this:
sum ?f1 {..<2} = ?f1 0 + ?f1 1

goal (1 subgoal):
 1. Determinant.det A = A $$ (0, 0) * A $$ (1, 1) - A $$ (0, 1) * A $$ (1, 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det A = A $$ (0, 0) * A $$ (1, 1) - A $$ (0, 1) * A $$ (1, 0)
[PROOF STEP]
apply (subst laplace_expansion_column[OF A[unfolded n], of 0], insert A n,
      auto simp: cofactor_def mat_delete_def set)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat 2 2; n = 2\<rbrakk> \<Longrightarrow> A $$ (0, 0) * Determinant.det (Matrix.mat (Suc 0) (Suc 0) (\<lambda>(i', j'). A $$ (Suc i', Suc j'))) - A $$ (Suc 0, 0) * Determinant.det (Matrix.mat (Suc 0) (Suc 0) (\<lambda>(i', j'). A $$ (if i' = 0 then i' else Suc i', Suc j'))) = A $$ (0, 0) * A $$ (Suc 0, Suc 0) - A $$ (0, Suc 0) * A $$ (Suc 0, 0)
[PROOF STEP]
apply (subst (1 2) det_dim_1, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Determinant.det A = A $$ (0, 0) * A $$ (1, 1) - A $$ (0, 1) * A $$ (1, 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vec_of_list_dot_rewrite:
  assumes "length xs = length ys"
  shows "vec_of_list xs \<bullet> vec_of_list ys =
    sum_list (map2 (*) xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_list xs \<bullet> vec_of_list ys = sum_list (map2 (*) xs ys)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = length ys

goal (1 subgoal):
 1. vec_of_list xs \<bullet> vec_of_list ys = sum_list (map2 (*) xs ys)
[PROOF STEP]
proof (induction xs arbitrary:ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ys. length [] = length ys \<Longrightarrow> vec_of_list [] \<bullet> vec_of_list ys = sum_list (map2 (*) [] ys)
 2. \<And>a xs ys. \<lbrakk>\<And>ys. length xs = length ys \<Longrightarrow> vec_of_list xs \<bullet> vec_of_list ys = sum_list (map2 (*) xs ys); length (a # xs) = length ys\<rbrakk> \<Longrightarrow> vec_of_list (a # xs) \<bullet> vec_of_list ys = sum_list (map2 (*) (a # xs) ys)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
length [] = length ys

goal (2 subgoals):
 1. \<And>ys. length [] = length ys \<Longrightarrow> vec_of_list [] \<bullet> vec_of_list ys = sum_list (map2 (*) [] ys)
 2. \<And>a xs ys. \<lbrakk>\<And>ys. length xs = length ys \<Longrightarrow> vec_of_list xs \<bullet> vec_of_list ys = sum_list (map2 (*) xs ys); length (a # xs) = length ys\<rbrakk> \<Longrightarrow> vec_of_list (a # xs) \<bullet> vec_of_list ys = sum_list (map2 (*) (a # xs) ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length [] = length ys
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length [] = length ys

goal (1 subgoal):
 1. vec_of_list [] \<bullet> vec_of_list ys = sum_list (map2 (*) [] ys)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_of_list [] \<bullet> vec_of_list ys = sum_list (map2 (*) [] ys)

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. length xs = length ys \<Longrightarrow> vec_of_list xs \<bullet> vec_of_list ys = sum_list (map2 (*) xs ys); length (a # xs) = length ys\<rbrakk> \<Longrightarrow> vec_of_list (a # xs) \<bullet> vec_of_list ys = sum_list (map2 (*) (a # xs) ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. length xs = length ys \<Longrightarrow> vec_of_list xs \<bullet> vec_of_list ys = sum_list (map2 (*) xs ys); length (a # xs) = length ys\<rbrakk> \<Longrightarrow> vec_of_list (a # xs) \<bullet> vec_of_list ys = sum_list (map2 (*) (a # xs) ys)
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
length xs = length ?ys \<Longrightarrow> vec_of_list xs \<bullet> vec_of_list ?ys = sum_list (map2 (*) xs ?ys)
length (a # xs) = length ys

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. length xs = length ys \<Longrightarrow> vec_of_list xs \<bullet> vec_of_list ys = sum_list (map2 (*) xs ys); length (a # xs) = length ys\<rbrakk> \<Longrightarrow> vec_of_list (a # xs) \<bullet> vec_of_list ys = sum_list (map2 (*) (a # xs) ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length xs = length ?ys \<Longrightarrow> vec_of_list xs \<bullet> vec_of_list ?ys = sum_list (map2 (*) xs ?ys)
length (a # xs) = length ys
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length xs = length ?ys \<Longrightarrow> vec_of_list xs \<bullet> vec_of_list ?ys = sum_list (map2 (*) xs ?ys)
length (a # xs) = length ys

goal (1 subgoal):
 1. vec_of_list (a # xs) \<bullet> vec_of_list ys = sum_list (map2 (*) (a # xs) ys)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>ys. length xs = length ys \<Longrightarrow> vec_of_list xs \<bullet> vec_of_list ys = sum_list (map2 (*) xs ys); Suc (length xs) = length ys\<rbrakk> \<Longrightarrow> vCons a (vec_of_list xs) \<bullet> vec_of_list ys = sum_list (map2 (*) (a # xs) ys)
[PROOF STEP]
by (smt (verit, best) Suc_length_conv list.simps(9) old.prod.case scalar_prod_vCons sum_list.Cons vec_of_list_Cons zip_Cons_Cons)
[PROOF STATE]
proof (state)
this:
vec_of_list (a # xs) \<bullet> vec_of_list ys = sum_list (map2 (*) (a # xs) ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Join_Un: "\<Squnion>(A \<union> B) = \<Squnion>A \<squnion> \<Squnion>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion>(A \<union> B) = \<Squnion>A \<squnion> \<Squnion>B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Squnion>(A \<union> B) = \<Squnion>A \<squnion> \<Squnion>B
[PROOF STEP]
have "dual (\<Squnion>(A \<union> B)) = \<Sqinter>(dual ` A \<union> dual ` B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dual (\<Squnion>(A \<union> B)) = \<Sqinter>(dual ` A \<union> dual ` B)
[PROOF STEP]
by (simp only: dual_Join image_Un)
[PROOF STATE]
proof (state)
this:
dual (\<Squnion>(A \<union> B)) = \<Sqinter>(dual ` A \<union> dual ` B)

goal (1 subgoal):
 1. \<Squnion>(A \<union> B) = \<Squnion>A \<squnion> \<Squnion>B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dual (\<Squnion>(A \<union> B)) = \<Sqinter>(dual ` A \<union> dual ` B)

goal (1 subgoal):
 1. \<Squnion>(A \<union> B) = \<Squnion>A \<squnion> \<Squnion>B
[PROOF STEP]
have "\<dots> = \<Sqinter>(dual ` A) \<sqinter> \<Sqinter>(dual ` B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>(dual ` A \<union> dual ` B) = \<Sqinter>dual ` A \<sqinter> \<Sqinter>dual ` B
[PROOF STEP]
by (rule Meet_Un)
[PROOF STATE]
proof (state)
this:
\<Sqinter>(dual ` A \<union> dual ` B) = \<Sqinter>dual ` A \<sqinter> \<Sqinter>dual ` B

goal (1 subgoal):
 1. \<Squnion>(A \<union> B) = \<Squnion>A \<squnion> \<Squnion>B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sqinter>(dual ` A \<union> dual ` B) = \<Sqinter>dual ` A \<sqinter> \<Sqinter>dual ` B

goal (1 subgoal):
 1. \<Squnion>(A \<union> B) = \<Squnion>A \<squnion> \<Squnion>B
[PROOF STEP]
have "\<dots> = dual (\<Squnion>A \<squnion> \<Squnion>B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>dual ` A \<sqinter> \<Sqinter>dual ` B = dual (\<Squnion>A \<squnion> \<Squnion>B)
[PROOF STEP]
by (simp only: dual_join dual_Join)
[PROOF STATE]
proof (state)
this:
\<Sqinter>dual ` A \<sqinter> \<Sqinter>dual ` B = dual (\<Squnion>A \<squnion> \<Squnion>B)

goal (1 subgoal):
 1. \<Squnion>(A \<union> B) = \<Squnion>A \<squnion> \<Squnion>B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dual (\<Squnion>(A \<union> B)) = dual (\<Squnion>A \<squnion> \<Squnion>B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dual (\<Squnion>(A \<union> B)) = dual (\<Squnion>A \<squnion> \<Squnion>B)

goal (1 subgoal):
 1. \<Squnion>(A \<union> B) = \<Squnion>A \<squnion> \<Squnion>B
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<Squnion>(A \<union> B) = \<Squnion>A \<squnion> \<Squnion>B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma jordan_block_poly_bound:
  assumes i: "i < n" and j: "j < n" and a: "norm a = 1"
  shows "norm ((jordan_block n a ^\<^sub>m k) $$ (i,j)) \<le> 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> 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> max 1 (real k ^ (n - 1))
[PROOF STEP]
from jordan_block_bound[OF i j, of k, unfolded a]
[PROOF STATE]
proof (chain)
picking this:
norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> 1 ^ (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> 1 ^ (k + i - j) * max 1 (real k ^ (n - 1))

goal (1 subgoal):
 1. norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> 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> max 1 (real k ^ (n - 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_cos_nx:
   "integral {-pi..pi} (\<lambda>x. cos(x * real_of_int n)) = (if n = 0 then 2 * pi else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {- pi..pi} (\<lambda>x. cos (x * real_of_int n)) = (if n = 0 then 2 * pi else 0)
[PROOF STEP]
using has_integral_cos_nx [of n]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. cos (real_of_int n * x)) has_integral (if n = 0 then 2 * pi else 0)) {- pi..pi}

goal (1 subgoal):
 1. integral {- pi..pi} (\<lambda>x. cos (x * real_of_int n)) = (if n = 0 then 2 * pi else 0)
[PROOF STEP]
by (force simp: mult.commute)


[STATEMENT]
lemma collinear_det:
  assumes "\<not> collinear z1 z2 z3"
  shows "det2 (z3 - z1) (cnj (z3 - z1)) (z1 - z2) (cnj (z1 - z2)) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det2 (z3 - z1) (cnj (z3 - z1)) (z1 - z2) (cnj (z1 - z2)) \<noteq> 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det2 (z3 - z1) (cnj (z3 - z1)) (z1 - z2) (cnj (z1 - z2)) \<noteq> 0
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<not> collinear z1 z2 z3
[PROOF STEP]
have "((z3 - z1) / (z2 - z1)) - cnj ((z3 - z1) / (z2 - z1)) \<noteq> 0" "z2 \<noteq> z1"
[PROOF STATE]
proof (prove)
using this:
\<not> collinear z1 z2 z3

goal (1 subgoal):
 1. (z3 - z1) / (z2 - z1) - cnj ((z3 - z1) / (z2 - z1)) \<noteq> 0 &&& z2 \<noteq> z1
[PROOF STEP]
unfolding collinear_def
[PROOF STATE]
proof (prove)
using this:
\<not> (z1 = z2 \<or> is_real ((z3 - z1) / (z2 - z1)))

goal (1 subgoal):
 1. (z3 - z1) / (z2 - z1) - cnj ((z3 - z1) / (z2 - z1)) \<noteq> 0 &&& z2 \<noteq> z1
[PROOF STEP]
using Complex_Im_express_cnj[of "(z3 - z1) / (z2 - z1)"]
[PROOF STATE]
proof (prove)
using this:
\<not> (z1 = z2 \<or> is_real ((z3 - z1) / (z2 - z1)))
Complex 0 (Im ((z3 - z1) / (z2 - z1))) = ((z3 - z1) / (z2 - z1) - cnj ((z3 - z1) / (z2 - z1))) / 2

goal (1 subgoal):
 1. (z3 - z1) / (z2 - z1) - cnj ((z3 - z1) / (z2 - z1)) \<noteq> 0 &&& z2 \<noteq> z1
[PROOF STEP]
by (auto simp add: Complex_eq)
[PROOF STATE]
proof (state)
this:
(z3 - z1) / (z2 - z1) - cnj ((z3 - z1) / (z2 - z1)) \<noteq> 0
z2 \<noteq> z1

goal (1 subgoal):
 1. det2 (z3 - z1) (cnj (z3 - z1)) (z1 - z2) (cnj (z1 - z2)) \<noteq> 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(z3 - z1) / (z2 - z1) - cnj ((z3 - z1) / (z2 - z1)) \<noteq> 0
z2 \<noteq> z1

goal (1 subgoal):
 1. det2 (z3 - z1) (cnj (z3 - z1)) (z1 - z2) (cnj (z1 - z2)) \<noteq> 0
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
det2 (z3 - z1) (cnj (z3 - z1)) (z1 - z2) (cnj (z1 - z2)) \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trace_smult:
  assumes "A \<in> carrier_mat n n"
  shows "trace (c \<cdot>\<^sub>m A) = c * trace A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (c \<cdot>\<^sub>m A) = c * trace A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. trace (c \<cdot>\<^sub>m A) = c * trace A
[PROOF STEP]
have "trace (c \<cdot>\<^sub>m A) = (\<Sum>i = 0..<dim_row A. c * A $$ (i, i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (c \<cdot>\<^sub>m A) = (\<Sum>i = 0..<dim_row A. c * A $$ (i, i))
[PROOF STEP]
unfolding trace_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row (c \<cdot>\<^sub>m A). (c \<cdot>\<^sub>m A) $$ (i, i)) = (\<Sum>i = 0..<dim_row A. c * A $$ (i, i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row (c \<cdot>\<^sub>m A). (c \<cdot>\<^sub>m A) $$ (i, i)) = (\<Sum>i = 0..<dim_row A. c * A $$ (i, i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (c \<cdot>\<^sub>m A) = (\<Sum>i = 0..<dim_row A. c * A $$ (i, i))

goal (1 subgoal):
 1. trace (c \<cdot>\<^sub>m A) = c * trace A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (c \<cdot>\<^sub>m A) = (\<Sum>i = 0..<dim_row A. c * A $$ (i, i))

goal (1 subgoal):
 1. trace (c \<cdot>\<^sub>m A) = c * trace A
[PROOF STEP]
have "\<dots> = c * (\<Sum>i = 0..<dim_row A. A $$ (i, i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. c * A $$ (i, i)) = c * (\<Sum>i = 0..<dim_row A. A $$ (i, i))
[PROOF STEP]
by (simp add: sum_distrib_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_row A. c * A $$ (i, i)) = c * (\<Sum>i = 0..<dim_row A. A $$ (i, i))

goal (1 subgoal):
 1. trace (c \<cdot>\<^sub>m A) = c * trace A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_row A. c * A $$ (i, i)) = c * (\<Sum>i = 0..<dim_row A. A $$ (i, i))

goal (1 subgoal):
 1. trace (c \<cdot>\<^sub>m A) = c * trace A
[PROOF STEP]
have "\<dots> = c * trace A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * (\<Sum>i = 0..<dim_row A. A $$ (i, i)) = c * trace A
[PROOF STEP]
unfolding trace_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * (\<Sum>i = 0..<dim_row A. A $$ (i, i)) = c * (\<Sum>i = 0..<dim_row A. A $$ (i, i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c * (\<Sum>i = 0..<dim_row A. A $$ (i, i)) = c * trace A

goal (1 subgoal):
 1. trace (c \<cdot>\<^sub>m A) = c * trace A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
trace (c \<cdot>\<^sub>m A) = c * (\<Sum>i = 0..<dim_row A. A $$ (i, i))
c * (\<Sum>i = 0..<dim_row A. A $$ (i, i)) = c * trace A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
trace (c \<cdot>\<^sub>m A) = c * (\<Sum>i = 0..<dim_row A. A $$ (i, i))
c * (\<Sum>i = 0..<dim_row A. A $$ (i, i)) = c * trace A

goal (1 subgoal):
 1. trace (c \<cdot>\<^sub>m A) = c * trace A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (c \<cdot>\<^sub>m A) = c * trace A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem fib_mult_eq_sum_nat: "fib (Suc n) * fib n = (\<Sum>k \<in> {..n}. fib k * fib k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib (Suc n) * fib n = (\<Sum>k\<le>n. fib k * fib k)
[PROOF STEP]
by (induct n rule: nat.induct) (auto simp add:  field_simps)


[STATEMENT]
lemma real_sqrt_one [simp]: "sqrt 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt 1 = 1
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root 2 1 = 1
[PROOF STEP]
by (rule real_root_one [OF pos2])


[STATEMENT]
lemma jumpF_tan_comp:
  "jumpF (f o tan) (at_right x) = (if cos x = 0
      then jumpF f at_bot else jumpF f (at_right (tan x)))"
  "jumpF (f o tan) (at_left x) = (if cos x =0
      then jumpF f at_top else jumpF f (at_left (tan x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF (f \<circ> tan) (at_right x) = (if cos x = 0 then jumpF f at_bot else jumpF f (at_right (tan x))) &&& jumpF (f \<circ> tan) (at_left x) = (if cos x = 0 then jumpF f at_top else jumpF f (at_left (tan x)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. jumpF (f \<circ> tan) (at_right x) = (if cos x = 0 then jumpF f at_bot else jumpF f (at_right (tan x)))
 2. jumpF (f \<circ> tan) (at_left x) = (if cos x = 0 then jumpF f at_top else jumpF f (at_left (tan x)))
[PROOF STEP]
have "filtermap (f \<circ> tan) (at_right x) =
      (if cos x = 0 then filtermap f at_bot else filtermap f (at_right (tan x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap (f \<circ> tan) (at_right x) = (if cos x = 0 then filtermap f at_bot else filtermap f (at_right (tan x)))
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap (\<lambda>x. f (tan x)) (at_right x) = (if cos x = 0 then filtermap f at_bot else filtermap f (at_right (tan x)))
[PROOF STEP]
apply (subst filtermap_filtermap[of f tan,symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap f (filtermap tan (at_right x)) = (if cos x = 0 then filtermap f at_bot else filtermap f (at_right (tan x)))
[PROOF STEP]
using filtermap_tan_at_right_inf filtermap_tan_at_right
[PROOF STATE]
proof (prove)
using this:
cos ?a = 0 \<Longrightarrow> filtermap tan (at_right ?a) = at_bot
cos ?a \<noteq> 0 \<Longrightarrow> filtermap tan (at_right ?a) = at_right (tan ?a)

goal (1 subgoal):
 1. filtermap f (filtermap tan (at_right x)) = (if cos x = 0 then filtermap f at_bot else filtermap f (at_right (tan x)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filtermap (f \<circ> tan) (at_right x) = (if cos x = 0 then filtermap f at_bot else filtermap f (at_right (tan x)))

goal (2 subgoals):
 1. jumpF (f \<circ> tan) (at_right x) = (if cos x = 0 then jumpF f at_bot else jumpF f (at_right (tan x)))
 2. jumpF (f \<circ> tan) (at_left x) = (if cos x = 0 then jumpF f at_top else jumpF f (at_left (tan x)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
filtermap (f \<circ> tan) (at_right x) = (if cos x = 0 then filtermap f at_bot else filtermap f (at_right (tan x)))
[PROOF STEP]
show "jumpF (f o tan) (at_right x) = (if cos x = 0
          then jumpF f at_bot else jumpF f (at_right (tan x)))"
[PROOF STATE]
proof (prove)
using this:
filtermap (f \<circ> tan) (at_right x) = (if cos x = 0 then filtermap f at_bot else filtermap f (at_right (tan x)))

goal (1 subgoal):
 1. jumpF (f \<circ> tan) (at_right x) = (if cos x = 0 then jumpF f at_bot else jumpF f (at_right (tan x)))
[PROOF STEP]
unfolding jumpF_def filterlim_def
[PROOF STATE]
proof (prove)
using this:
filtermap (f \<circ> tan) (at_right x) = (if cos x = 0 then filtermap f at_bot else filtermap f (at_right (tan x)))

goal (1 subgoal):
 1. (if filtermap (f \<circ> tan) (at_right x) \<le> at_top then 1 / 2 else if filtermap (f \<circ> tan) (at_right x) \<le> at_bot then - 1 / 2 else 0) = (if cos x = 0 then if filtermap f at_bot \<le> at_top then 1 / 2 else if filtermap f at_bot \<le> at_bot then - 1 / 2 else 0 else if filtermap f (at_right (tan x)) \<le> at_top then 1 / 2 else if filtermap f (at_right (tan x)) \<le> at_bot then - 1 / 2 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF (f \<circ> tan) (at_right x) = (if cos x = 0 then jumpF f at_bot else jumpF f (at_right (tan x)))

goal (1 subgoal):
 1. jumpF (f \<circ> tan) (at_left x) = (if cos x = 0 then jumpF f at_top else jumpF f (at_left (tan x)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jumpF (f \<circ> tan) (at_left x) = (if cos x = 0 then jumpF f at_top else jumpF f (at_left (tan x)))
[PROOF STEP]
have "filtermap (f \<circ> tan) (at_left x) =
      (if cos x = 0 then filtermap f at_top else filtermap f (at_left (tan x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap (f \<circ> tan) (at_left x) = (if cos x = 0 then filtermap f at_top else filtermap f (at_left (tan x)))
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap (\<lambda>x. f (tan x)) (at_left x) = (if cos x = 0 then filtermap f at_top else filtermap f (at_left (tan x)))
[PROOF STEP]
apply (subst filtermap_filtermap[of f tan,symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap f (filtermap tan (at_left x)) = (if cos x = 0 then filtermap f at_top else filtermap f (at_left (tan x)))
[PROOF STEP]
using filtermap_tan_at_left_inf filtermap_tan_at_left
[PROOF STATE]
proof (prove)
using this:
cos ?a = 0 \<Longrightarrow> filtermap tan (at_left ?a) = at_top
cos ?a \<noteq> 0 \<Longrightarrow> filtermap tan (at_left ?a) = at_left (tan ?a)

goal (1 subgoal):
 1. filtermap f (filtermap tan (at_left x)) = (if cos x = 0 then filtermap f at_top else filtermap f (at_left (tan x)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filtermap (f \<circ> tan) (at_left x) = (if cos x = 0 then filtermap f at_top else filtermap f (at_left (tan x)))

goal (1 subgoal):
 1. jumpF (f \<circ> tan) (at_left x) = (if cos x = 0 then jumpF f at_top else jumpF f (at_left (tan x)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
filtermap (f \<circ> tan) (at_left x) = (if cos x = 0 then filtermap f at_top else filtermap f (at_left (tan x)))
[PROOF STEP]
show "jumpF (f o tan) (at_left x) = (if cos x = 0
          then jumpF f at_top else jumpF f (at_left (tan x)))"
[PROOF STATE]
proof (prove)
using this:
filtermap (f \<circ> tan) (at_left x) = (if cos x = 0 then filtermap f at_top else filtermap f (at_left (tan x)))

goal (1 subgoal):
 1. jumpF (f \<circ> tan) (at_left x) = (if cos x = 0 then jumpF f at_top else jumpF f (at_left (tan x)))
[PROOF STEP]
unfolding jumpF_def filterlim_def
[PROOF STATE]
proof (prove)
using this:
filtermap (f \<circ> tan) (at_left x) = (if cos x = 0 then filtermap f at_top else filtermap f (at_left (tan x)))

goal (1 subgoal):
 1. (if filtermap (f \<circ> tan) (at_left x) \<le> at_top then 1 / 2 else if filtermap (f \<circ> tan) (at_left x) \<le> at_bot then - 1 / 2 else 0) = (if cos x = 0 then if filtermap f at_top \<le> at_top then 1 / 2 else if filtermap f at_top \<le> at_bot then - 1 / 2 else 0 else if filtermap f (at_left (tan x)) \<le> at_top then 1 / 2 else if filtermap f (at_left (tan x)) \<le> at_bot then - 1 / 2 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF (f \<circ> tan) (at_left x) = (if cos x = 0 then jumpF f at_top else jumpF f (at_left (tan x)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smallo_imp_eventually_sgn:
  fixes f g :: "real \<Rightarrow> real"
  assumes "g \<in> o(f)"
  shows   "eventually (\<lambda>x. sgn (f x + g x) = sgn (f x)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. sgn (f x + g x) = sgn (f x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. sgn (f x + g x) = sgn (f x)
[PROOF STEP]
have "0 < (1/2 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < 1 / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. sgn (f x + g x) = sgn (f x)
[PROOF STEP]
from landau_o.smallD[OF assms, OF this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. norm (g x) \<le> 1 / 2 * norm (f x)
[PROOF STEP]
have "eventually (\<lambda>x. \<bar>g x\<bar> \<le> 1/2 * \<bar>f x\<bar>) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. norm (g x) \<le> 1 / 2 * norm (f x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>g x\<bar> \<le> 1 / 2 * \<bar>f x\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. \<bar>g x\<bar> \<le> 1 / 2 * \<bar>f x\<bar>

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. sgn (f x + g x) = sgn (f x)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. \<bar>g x\<bar> \<le> 1 / 2 * \<bar>f x\<bar>

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. sgn (f x + g x) = sgn (f x)
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<bar>g x\<bar> \<le> 1 / 2 * \<bar>f x\<bar> \<Longrightarrow> sgn (f x + g x) = sgn (f x)
[PROOF STEP]
case (elim x)
[PROOF STATE]
proof (state)
this:
\<bar>g x\<bar> \<le> 1 / 2 * \<bar>f x\<bar>

goal (1 subgoal):
 1. \<And>x. \<bar>g x\<bar> \<le> 1 / 2 * \<bar>f x\<bar> \<Longrightarrow> sgn (f x + g x) = sgn (f x)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<bar>g x\<bar> \<le> 1 / 2 * \<bar>f x\<bar>

goal (1 subgoal):
 1. sgn (f x + g x) = sgn (f x)
[PROOF STEP]
by (cases "f x" "0::real" rule: linorder_cases;
          cases "f x + g x" "0::real" rule: linorder_cases) simp_all
[PROOF STATE]
proof (state)
this:
sgn (f x + g x) = sgn (f x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. sgn (f x + g x) = sgn (f x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fermat_little:
  assumes "prime (P :: nat)"
  shows "[x^P = x] (mod P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x ^ P = x] (mod P)
[PROOF STEP]
proof(cases "P dvd x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
 2. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
P dvd x

goal (2 subgoals):
 1. P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
 2. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
hence "x mod P = 0"
[PROOF STATE]
proof (prove)
using this:
P dvd x

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

goal (2 subgoals):
 1. P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
 2. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x mod P = 0

goal (2 subgoals):
 1. P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
 2. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
have "x ^ P mod P = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ P mod P = 0
[PROOF STEP]
by (simp add: True assms prime_dvd_power_nat_iff prime_gt_0_nat)
[PROOF STATE]
proof (state)
this:
x ^ P mod P = 0

goal (2 subgoals):
 1. P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
 2. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x mod P = 0
x ^ P mod P = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x mod P = 0
x ^ P mod P = 0

goal (1 subgoal):
 1. [x ^ P = x] (mod P)
[PROOF STEP]
by (simp add: cong_def)
[PROOF STATE]
proof (state)
this:
[x ^ P = x] (mod P)

goal (1 subgoal):
 1. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> P dvd x

goal (1 subgoal):
 1. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
hence "[x ^ (P - 1) = 1] (mod P)"
[PROOF STATE]
proof (prove)
using this:
\<not> P dvd x

goal (1 subgoal):
 1. [x ^ (P - 1) = 1] (mod P)
[PROOF STEP]
using fermat_theorem assms
[PROOF STATE]
proof (prove)
using this:
\<not> P dvd x
\<lbrakk>prime ?p; \<not> ?p dvd ?a\<rbrakk> \<Longrightarrow> [?a ^ (?p - 1) = 1] (mod ?p)
prime P

goal (1 subgoal):
 1. [x ^ (P - 1) = 1] (mod P)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[x ^ (P - 1) = 1] (mod P)

goal (1 subgoal):
 1. \<not> P dvd x \<Longrightarrow> [x ^ P = x] (mod P)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[x ^ (P - 1) = 1] (mod P)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[x ^ (P - 1) = 1] (mod P)

goal (1 subgoal):
 1. [x ^ P = x] (mod P)
[PROOF STEP]
by (metis assms cong_def diff_diff_cancel diff_is_0_eq' diff_zero mod_mult_right_eq power_eq_if power_one_right prime_ge_1_nat zero_le_one)
[PROOF STATE]
proof (state)
this:
[x ^ P = x] (mod P)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infsum_Re:
  assumes "f summable_on M"
  shows "infsum (\<lambda>x. Re (f x)) M = Re (infsum f M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>M. Re (f x)) = Re (infsum f M)
[PROOF STEP]
apply (rule infsum_comm_additive[where f=Re, unfolded o_def])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. additive Re
 2. isCont Re (infsum f M)
 3. f summable_on M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f summable_on M

goal (3 subgoals):
 1. additive Re
 2. isCont Re (infsum f M)
 3. f summable_on M
[PROOF STEP]
by (auto intro!: additive.intro)


[STATEMENT]
lemma emeasure_lborel_cbox_cart_eq:
  fixes a b :: "real ^ ('n :: finite)"
  shows "emeasure lborel (cbox a b) = ennreal (\<Prod>i \<in> UNIV. max 0 ((b - a) $ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel (cbox a b) = ennreal (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure lborel (cbox a b) = ennreal (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))
[PROOF STEP]
have "emeasure lborel (cbox a b) = ennreal (\<Prod>e\<in>Basis. max 0 ((b - a) \<bullet> e))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel (cbox a b) = ennreal (\<Prod>e\<in>Basis. max 0 ((b - a) \<bullet> e))
[PROOF STEP]
unfolding emeasure_lborel_cbox_eq'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (\<Prod>e\<in>Basis. max 0 ((b - a) \<bullet> e)) = ennreal (\<Prod>e\<in>Basis. max 0 ((b - a) \<bullet> e))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
emeasure lborel (cbox a b) = ennreal (\<Prod>e\<in>Basis. max 0 ((b - a) \<bullet> e))

goal (1 subgoal):
 1. emeasure lborel (cbox a b) = ennreal (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure lborel (cbox a b) = ennreal (\<Prod>e\<in>Basis. max 0 ((b - a) \<bullet> e))

goal (1 subgoal):
 1. emeasure lborel (cbox a b) = ennreal (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))
[PROOF STEP]
have "(Basis :: (real ^ 'n) set) = range (\<lambda>k. axis k 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Basis = range (\<lambda>k. axis k 1)
[PROOF STEP]
unfolding Basis_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i. \<Union>u\<in>Basis. {axis i u}) = range (\<lambda>k. axis k 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Basis = range (\<lambda>k. axis k 1)

goal (1 subgoal):
 1. emeasure lborel (cbox a b) = ennreal (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Basis = range (\<lambda>k. axis k 1)

goal (1 subgoal):
 1. emeasure lborel (cbox a b) = ennreal (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))
[PROOF STEP]
have "(\<Prod>e\<in>\<dots>. max 0 ((b - a) \<bullet> e)) = (\<Prod> i \<in> UNIV . max 0 ((b - a) $ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>e\<in>range (\<lambda>k. axis k 1). max 0 ((b - a) \<bullet> e)) = (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))
[PROOF STEP]
by (subst prod.reindex) (auto intro!: inj_axis simp: algebra_simps inner_axis)
[PROOF STATE]
proof (state)
this:
(\<Prod>e\<in>range (\<lambda>k. axis k 1). max 0 ((b - a) \<bullet> e)) = (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))

goal (1 subgoal):
 1. emeasure lborel (cbox a b) = ennreal (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure lborel (cbox a b) = ennreal (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure lborel (cbox a b) = ennreal (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))

goal (1 subgoal):
 1. emeasure lborel (cbox a b) = ennreal (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure lborel (cbox a b) = ennreal (\<Prod>i\<in>UNIV. max 0 ((b - a) $ i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma null_space_eq_solution_set:
shows "null_space A = solution_set A 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. null_space A = solution_set A 0
[PROOF STEP]
unfolding null_space_def solution_set_def is_solution_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. A *v x = 0} = {x. A *v x = 0}
[PROOF STEP]
..


[STATEMENT]
lemma eval_fds_mult:
  fixes s :: "'a :: {nat_power, real_normed_field, banach, second_countable_topology}"
  assumes "fds_abs_converges f s" "fds_abs_converges g s"
  shows   "eval_fds (f * g) s = eval_fds f s * eval_fds g s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fds (f * g) s = eval_fds f s * eval_fds g s
[PROOF STEP]
using suminf_dirichlet_prod[OF _ _ assms[unfolded fds_abs_converges_def]]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>fds_nth f 0 = (0::'a); fds_nth g 0 = (0::'a)\<rbrakk> \<Longrightarrow> (\<Sum>n. dirichlet_prod (fds_nth f) (fds_nth g) n / nat_power n s) = (\<Sum>n. fds_nth f n / nat_power n s) * (\<Sum>n. fds_nth g n / nat_power n s)

goal (1 subgoal):
 1. eval_fds (f * g) s = eval_fds f s * eval_fds g s
[PROOF STEP]
by (simp_all add: eval_fds_def fds_nth_mult)


[STATEMENT]
lemma max_all_edges_between:
  assumes "finite X" "finite Y"
  shows "card (all_edges_between X Y) \<le> card X * card Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_edges_between X Y) \<le> card X * card Y
[PROOF STEP]
by (metis assms card_mono finite_SigmaI all_edges_between_subset card_cartesian_product)


[STATEMENT]
lemma sum_list_map_filter_sum: fixes f :: "'a \<Rightarrow> 'b :: comm_monoid_add"
  shows "sum_list (map f (filter g xs)) + sum_list (map f (filter (Not o g) xs)) = sum_list (map f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map f (filter g xs)) + sum_list (map f (filter (Not \<circ> g) xs)) = sum_list (map f xs)
[PROOF STEP]
by (induct xs, auto simp: ac_simps)


[STATEMENT]
lemma concat_length_le:
  fixes g :: "nat \<Rightarrow> real"
  assumes "\<forall> x \<in> set xs . real (length (f x)) \<le> g x"
  shows "length (concat (map f xs)) \<le> (\<Sum>x\<leftarrow>xs. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (length (concat (map f xs))) \<le> sum_list (map g xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set xs. real (length (f x)) \<le> g x

goal (1 subgoal):
 1. real (length (concat (map f xs))) \<le> sum_list (map g xs)
[PROOF STEP]
by (induction xs) force+


[STATEMENT]
lemma norm_square_vec_eq: "norm x ^ 2 = (\<Sum>i\<in>UNIV. x $ i ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm x)\<^sup>2 = (\<Sum>i\<in>UNIV. (x $ i)\<^sup>2)
[PROOF STEP]
by (auto simp: norm_vec_def L2_set_def intro!: sum_nonneg)


[STATEMENT]
lemma not_list_ex_equals_list_all_not: "(\<not>list_ex P xs) = list_all (\<lambda>x. \<not>P x) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> list_ex P xs) = list_all (\<lambda>x. \<not> P x) xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<not> list_ex P xs) = list_all (\<lambda>x. \<not> P x) xs
[PROOF STEP]
have "(\<not>list_ex P xs) = (\<not>Bex (set xs) P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> list_ex P xs) = (\<not> Bex (set xs) P)
[PROOF STEP]
using list_ex_iff
[PROOF STATE]
proof (prove)
using this:
list_ex ?P ?xs = Bex (set ?xs) ?P

goal (1 subgoal):
 1. (\<not> list_ex P xs) = (\<not> Bex (set xs) P)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<not> list_ex P xs) = (\<not> Bex (set xs) P)

goal (1 subgoal):
 1. (\<not> list_ex P xs) = list_all (\<lambda>x. \<not> P x) xs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<not> list_ex P xs) = (\<not> Bex (set xs) P)

goal (1 subgoal):
 1. (\<not> list_ex P xs) = list_all (\<lambda>x. \<not> P x) xs
[PROOF STEP]
have "\<dots> = Ball (set xs) (\<lambda>x. \<not>P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> Bex (set xs) P) = (\<forall>x\<in>set xs. \<not> P x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<not> Bex (set xs) P) = (\<forall>x\<in>set xs. \<not> P x)

goal (1 subgoal):
 1. (\<not> list_ex P xs) = list_all (\<lambda>x. \<not> P x) xs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<not> list_ex P xs) = (\<forall>x\<in>set xs. \<not> P x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<not> list_ex P xs) = (\<forall>x\<in>set xs. \<not> P x)

goal (1 subgoal):
 1. (\<not> list_ex P xs) = list_all (\<lambda>x. \<not> P x) xs
[PROOF STEP]
by (simp add: Ball_set_list_all)
[PROOF STATE]
proof (state)
this:
(\<not> list_ex P xs) = list_all (\<lambda>x. \<not> P x) xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Polygamma_real_strict_mono:
  assumes "x > 0" "x < (y::real)" "even n"
  shows   "Polygamma n x < Polygamma n y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polygamma n x < Polygamma n y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Polygamma n x < Polygamma n y
[PROOF STEP]
have "\<exists>\<xi>. x < \<xi> \<and> \<xi> < y \<and> Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<xi>>x. \<xi> < y \<and> Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x
x < y
even n

goal (1 subgoal):
 1. \<exists>\<xi>>x. \<xi> < y \<and> Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>
[PROOF STEP]
by (intro MVT2 derivative_intros impI allI) (auto elim!: nonpos_Ints_cases)
[PROOF STATE]
proof (state)
this:
\<exists>\<xi>>x. \<xi> < y \<and> Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>

goal (1 subgoal):
 1. Polygamma n x < Polygamma n y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>\<xi>>x. \<xi> < y \<and> Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>
[PROOF STEP]
obtain \<xi>
    where \<xi>: "x < \<xi>" "\<xi> < y"
      and Polygamma: "Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>"
[PROOF STATE]
proof (prove)
using this:
\<exists>\<xi>>x. \<xi> < y \<and> Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>

goal (1 subgoal):
 1. (\<And>\<xi>. \<lbrakk>x < \<xi>; \<xi> < y; Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x < \<xi>
\<xi> < y
Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>

goal (1 subgoal):
 1. Polygamma n x < Polygamma n y
[PROOF STEP]
note Polygamma
[PROOF STATE]
proof (state)
this:
Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>

goal (1 subgoal):
 1. Polygamma n x < Polygamma n y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>

goal (1 subgoal):
 1. Polygamma n x < Polygamma n y
[PROOF STEP]
from \<xi> assms
[PROOF STATE]
proof (chain)
picking this:
x < \<xi>
\<xi> < y
0 < x
x < y
even n
[PROOF STEP]
have "(y - x) * Polygamma (Suc n) \<xi> > 0"
[PROOF STATE]
proof (prove)
using this:
x < \<xi>
\<xi> < y
0 < x
x < y
even n

goal (1 subgoal):
 1. 0 < (y - x) * Polygamma (Suc n) \<xi>
[PROOF STEP]
by (intro mult_pos_pos Polygamma_real_odd_pos) (auto elim!: nonpos_Ints_cases)
[PROOF STATE]
proof (state)
this:
0 < (y - x) * Polygamma (Suc n) \<xi>

goal (1 subgoal):
 1. Polygamma n x < Polygamma n y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 < Polygamma n y - Polygamma n x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < Polygamma n y - Polygamma n x

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ring_hom_uminus:
  assumes "ring S"
  assumes "f \<in> (ring_hom S R)"
  assumes "a \<in> carrier S"
  shows "f (\<ominus>\<^bsub>S\<^esub> a) = \<ominus> (f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (\<ominus>\<^bsub>S\<^esub> a) = \<ominus> f a
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f (\<ominus>\<^bsub>S\<^esub> a) = \<ominus> f a
[PROOF STEP]
have "f (a \<ominus>\<^bsub>S\<^esub> a) = (f a) \<oplus> f (\<ominus>\<^bsub>S\<^esub> a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (a \<ominus>\<^bsub>S\<^esub> a) = f a \<oplus> f (\<ominus>\<^bsub>S\<^esub> a)
[PROOF STEP]
unfolding a_minus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (a \<oplus>\<^bsub>S\<^esub> \<ominus>\<^bsub>S\<^esub> a) = f a \<oplus> f (\<ominus>\<^bsub>S\<^esub> a)
[PROOF STEP]
by (simp add: assms(1) assms(2) assms(3) ring.ring_simprules(3) ring_hom_add)
[PROOF STATE]
proof (state)
this:
f (a \<ominus>\<^bsub>S\<^esub> a) = f a \<oplus> f (\<ominus>\<^bsub>S\<^esub> a)

goal (1 subgoal):
 1. f (\<ominus>\<^bsub>S\<^esub> a) = \<ominus> f a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f (a \<ominus>\<^bsub>S\<^esub> a) = f a \<oplus> f (\<ominus>\<^bsub>S\<^esub> a)
[PROOF STEP]
have "(f a) \<oplus> f (\<ominus>\<^bsub>S\<^esub> a) = \<zero> "
[PROOF STATE]
proof (prove)
using this:
f (a \<ominus>\<^bsub>S\<^esub> a) = f a \<oplus> f (\<ominus>\<^bsub>S\<^esub> a)

goal (1 subgoal):
 1. f a \<oplus> f (\<ominus>\<^bsub>S\<^esub> a) = \<zero>
[PROOF STEP]
by (metis R.ring_axioms a_minus_def assms(1) assms(2) assms(3)
        ring.ring_simprules(16) ring_hom_zero)
[PROOF STATE]
proof (state)
this:
f a \<oplus> f (\<ominus>\<^bsub>S\<^esub> a) = \<zero>

goal (1 subgoal):
 1. f (\<ominus>\<^bsub>S\<^esub> a) = \<ominus> f a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f a \<oplus> f (\<ominus>\<^bsub>S\<^esub> a) = \<zero>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f a \<oplus> f (\<ominus>\<^bsub>S\<^esub> a) = \<zero>

goal (1 subgoal):
 1. f (\<ominus>\<^bsub>S\<^esub> a) = \<ominus> f a
[PROOF STEP]
by (metis (no_types, lifting) R.add.m_comm R.minus_equality assms(1)
        assms(2) assms(3) ring.ring_simprules(3) ring_hom_closed)
[PROOF STATE]
proof (state)
this:
f (\<ominus>\<^bsub>S\<^esub> a) = \<ominus> f a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powr_real_of_int:
  "x > 0 \<Longrightarrow> x powr real_of_int n = (if n \<ge> 0 then x ^ nat n else inverse (x ^ nat (- n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> x powr real_of_int n = (if 0 \<le> n then x ^ nat n else inverse (x ^ nat (- n)))
[PROOF STEP]
using powr_realpow[of x "nat n"] powr_realpow[of x "nat (-n)"]
[PROOF STATE]
proof (prove)
using this:
0 < x \<Longrightarrow> x powr real (nat n) = x ^ nat n
0 < x \<Longrightarrow> x powr real (nat (- n)) = x ^ nat (- n)

goal (1 subgoal):
 1. 0 < x \<Longrightarrow> x powr real_of_int n = (if 0 \<le> n then x ^ nat n else inverse (x ^ nat (- n)))
[PROOF STEP]
by (auto simp: field_simps powr_minus)


[STATEMENT]
lemma pderiv_power_Suc: "pderiv (p ^ Suc n) = smult (of_nat (Suc n)) (p ^ n) * pderiv p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pderiv (p ^ Suc n) = smult (of_nat (Suc n)) (p ^ n) * pderiv p
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pderiv (p ^ Suc 0) = smult (of_nat (Suc 0)) (p ^ 0) * pderiv p
 2. \<And>n. pderiv (p ^ Suc n) = smult (of_nat (Suc n)) (p ^ n) * pderiv p \<Longrightarrow> pderiv (p ^ Suc (Suc n)) = smult (of_nat (Suc (Suc n))) (p ^ Suc n) * pderiv p
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
pderiv (p ^ Suc n) = smult (of_nat (Suc n)) (p ^ n) * pderiv p

goal (2 subgoals):
 1. pderiv (p ^ Suc 0) = smult (of_nat (Suc 0)) (p ^ 0) * pderiv p
 2. \<And>n. pderiv (p ^ Suc n) = smult (of_nat (Suc n)) (p ^ n) * pderiv p \<Longrightarrow> pderiv (p ^ Suc (Suc n)) = smult (of_nat (Suc (Suc n))) (p ^ Suc n) * pderiv p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pderiv (p ^ Suc n) = smult (of_nat (Suc n)) (p ^ n) * pderiv p
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
pderiv (p ^ Suc n) = smult (of_nat (Suc n)) (p ^ n) * pderiv p

goal (1 subgoal):
 1. pderiv (p ^ Suc (Suc n)) = smult (of_nat (Suc (Suc n))) (p ^ Suc n) * pderiv p
[PROOF STEP]
by (simp add: pderiv_mult smult_add_left algebra_simps)
[PROOF STATE]
proof (state)
this:
pderiv (p ^ Suc (Suc n)) = smult (of_nat (Suc (Suc n))) (p ^ Suc n) * pderiv p

goal (1 subgoal):
 1. pderiv (p ^ Suc 0) = smult (of_nat (Suc 0)) (p ^ 0) * pderiv p
[PROOF STEP]
qed auto


[STATEMENT]
lemma lnorm_triangle_fun:
  assumes f: "f \<in> lspace M p" and g: "g \<in> lspace M p" and "p \<ge> 1"
  shows "lnorm M p (f + g) \<le> lnorm M p f + lnorm M p g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lnorm M p (f + g) \<le> lnorm M p f + lnorm M p g
[PROOF STEP]
using lnorm_triangle [OF assms]
[PROOF STATE]
proof (prove)
using this:
lnorm M p (\<lambda>x. f x + g x) \<le> lnorm M p f + lnorm M p g

goal (1 subgoal):
 1. lnorm M p (f + g) \<le> lnorm M p f + lnorm M p g
[PROOF STEP]
by (simp add: plus_fun_def)


[STATEMENT]
lemma homeomorphic_space_prod_topology:
   "\<lbrakk>X homeomorphic_space X''; Y homeomorphic_space Y'\<rbrakk>
        \<Longrightarrow> prod_topology X Y homeomorphic_space prod_topology X'' Y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X homeomorphic_space X''; Y homeomorphic_space Y'\<rbrakk> \<Longrightarrow> prod_topology X Y homeomorphic_space prod_topology X'' Y'
[PROOF STEP]
using homeomorphic_maps_prod
[PROOF STATE]
proof (prove)
using this:
homeomorphic_maps (prod_topology ?X ?Y) (prod_topology ?X' ?Y') (\<lambda>(x, y). (?f x, ?g y)) (\<lambda>(x, y). (?f' x, ?g' y)) = (topspace (prod_topology ?X ?Y) = {} \<and> topspace (prod_topology ?X' ?Y') = {} \<or> homeomorphic_maps ?X ?X' ?f ?f' \<and> homeomorphic_maps ?Y ?Y' ?g ?g')

goal (1 subgoal):
 1. \<lbrakk>X homeomorphic_space X''; Y homeomorphic_space Y'\<rbrakk> \<Longrightarrow> prod_topology X Y homeomorphic_space prod_topology X'' Y'
[PROOF STEP]
unfolding homeomorphic_space_def
[PROOF STATE]
proof (prove)
using this:
homeomorphic_maps (prod_topology ?X ?Y) (prod_topology ?X' ?Y') (\<lambda>(x, y). (?f x, ?g y)) (\<lambda>(x, y). (?f' x, ?g' y)) = (topspace (prod_topology ?X ?Y) = {} \<and> topspace (prod_topology ?X' ?Y') = {} \<or> homeomorphic_maps ?X ?X' ?f ?f' \<and> homeomorphic_maps ?Y ?Y' ?g ?g')

goal (1 subgoal):
 1. \<lbrakk>\<exists>f g. homeomorphic_maps X X'' f g; \<exists>f g. homeomorphic_maps Y Y' f g\<rbrakk> \<Longrightarrow> \<exists>f g. homeomorphic_maps (prod_topology X Y) (prod_topology X'' Y') f g
[PROOF STEP]
by blast


[STATEMENT]
lemma mod_2_is_both_even_or_odd:
  "((even i \<and> even j) \<or> (odd i \<and> odd j)) \<longleftrightarrow> (i mod 2 = j mod 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (even i \<and> even j \<or> odd i \<and> odd j) = (i mod (2::'a) = j mod (2::'a))
[PROOF STEP]
by (metis even_iff_mod_2_eq_zero odd_iff_mod_2_eq_one)


[STATEMENT]
lemma rewrite_sum_of_powers:
  assumes p: "(p::nat)>1"
  shows "\<Sum> ((^) p ` {0..n}) = (\<Sum> i = 0 .. n . p^i)" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> ((^) p ` {0..n}) = sum ((^) p) {0..n}
[PROOF STEP]
by (metis inj_on_def p power_inject_exp sum.reindex_cong)


[STATEMENT]
lemma sum_pair_less_iff:
  "sum (\<lambda>((k::nat),m). a k * b m * c (k + m)) {(k,m). k + m \<le> n} =
    sum (\<lambda>s. sum (\<lambda>i. a i * b (s - i) * c s) {0..s}) {0..n}"
  (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(k, m)\<in>{(k, m). k + m \<le> n}. a k * b m * c (k + m)) = (\<Sum>s = 0..n. \<Sum>i = 0..s. a i * b (s - i) * c s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>(k, m)\<in>{(k, m). k + m \<le> n}. a k * b m * c (k + m)) = (\<Sum>s = 0..n. \<Sum>i = 0..s. a i * b (s - i) * c s)
[PROOF STEP]
have th0: "{(k, m). k + m \<le> n} = (\<Union>s\<in>{0..n}. \<Union>i\<in>{0..s}. {(i, s - i)})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(k, m). k + m \<le> n} = (\<Union>s\<in>{0..n}. \<Union>i\<in>{0..s}. {(i, s - i)})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{(k, m). k + m \<le> n} = (\<Union>s\<in>{0..n}. \<Union>i\<in>{0..s}. {(i, s - i)})

goal (1 subgoal):
 1. (\<Sum>(k, m)\<in>{(k, m). k + m \<le> n}. a k * b m * c (k + m)) = (\<Sum>s = 0..n. \<Sum>i = 0..s. a i * b (s - i) * c s)
[PROOF STEP]
show "?l = ?r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(k, m)\<in>{(k, m). k + m \<le> n}. a k * b m * c (k + m)) = (\<Sum>s = 0..n. \<Sum>i = 0..s. a i * b (s - i) * c s)
[PROOF STEP]
unfolding th0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(k, m)\<in>(\<Union>s\<in>{0..n}. \<Union>i\<in>{0..s}. {(i, s - i)}). a k * b m * c (k + m)) = (\<Sum>s = 0..n. \<Sum>i = 0..s. a i * b (s - i) * c s)
[PROOF STEP]
by (simp add: sum.UNION_disjoint eq_diff_iff disjoint_iff)
[PROOF STATE]
proof (state)
this:
(\<Sum>(k, m)\<in>{(k, m). k + m \<le> n}. a k * b m * c (k + m)) = (\<Sum>s = 0..n. \<Sum>i = 0..s. a i * b (s - i) * c s)

goal:
No subgoals!
[PROOF STEP]
qed