[STATEMENT]
lemma QR_decomposition_mult:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  assumes r: "rank A = ncols A"
  shows "A = (fst (QR_decomposition A)) ** (snd (QR_decomposition A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = fst (QR_decomposition A) ** snd (QR_decomposition A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A = fst (QR_decomposition A) ** snd (QR_decomposition A)
[PROOF STEP]
have "\<forall>b. column b A = column b ((fst (QR_decomposition A)) ** (snd (QR_decomposition A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b. column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))
[PROOF STEP]
proof (clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))
[PROOF STEP]
have "(fst (QR_decomposition A) ** snd (QR_decomposition A))
      =  (\<chi> i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (QR_decomposition A) ** snd (QR_decomposition A) = (\<chi>i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A))
[PROOF STEP]
unfolding matrix_matrix_mult_def R_Qi_Aj
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A)) = (\<chi>i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fst (QR_decomposition A) ** snd (QR_decomposition A) = (\<chi>i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A))

goal (1 subgoal):
 1. \<And>b. column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))
[PROOF STEP]
hence "column b ((fst (QR_decomposition A) ** snd (QR_decomposition A))) =
      column b ((\<chi> i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A)))"
[PROOF STATE]
proof (prove)
using this:
fst (QR_decomposition A) ** snd (QR_decomposition A) = (\<chi>i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A))

goal (1 subgoal):
 1. column b (fst (QR_decomposition A) ** snd (QR_decomposition A)) = column b (\<chi>i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column b (fst (QR_decomposition A) ** snd (QR_decomposition A)) = column b (\<chi>i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A))

goal (1 subgoal):
 1. \<And>b. column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column b (fst (QR_decomposition A) ** snd (QR_decomposition A)) = column b (\<chi>i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A))

goal (1 subgoal):
 1. \<And>b. column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))
[PROOF STEP]
have "... = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. (x \<bullet> column b A) *\<^sub>R x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column b (\<chi>i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. (x \<bullet> column b A) *\<^sub>R x)
[PROOF STEP]
proof (subst column_def, subst vec_eq_iff, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ i)
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ i)
[PROOF STEP]
define f where "f i = column i (fst (QR_decomposition A))" for i
[PROOF STATE]
proof (state)
this:
f ?i = column ?i (fst (QR_decomposition A))

goal (1 subgoal):
 1. \<And>i. (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ i)
[PROOF STEP]
define g where "g x = (THE i. x = column i (fst (QR_decomposition A)))" for x
[PROOF STATE]
proof (state)
this:
g ?x = (THE i. ?x = column i (fst (QR_decomposition A)))

goal (1 subgoal):
 1. \<And>i. (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ i)
[PROOF STEP]
have f_eq: "f`UNIV = {column i (fst (QR_decomposition A)) |i. i\<in>UNIV}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range f = {column i (fst (QR_decomposition A)) |i. i \<in> UNIV}
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range (\<lambda>i. column i (fst (QR_decomposition A))) = {column i (fst (QR_decomposition A)) |i. i \<in> UNIV}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
range f = {column i (fst (QR_decomposition A)) |i. i \<in> UNIV}

goal (1 subgoal):
 1. \<And>i. (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ i)
[PROOF STEP]
have inj_f: "inj f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj f
[PROOF STEP]
by (metis inj_on_def f_def column_eq_fst_QR_decomposition r)
[PROOF STATE]
proof (state)
this:
inj f

goal (1 subgoal):
 1. \<And>i. (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ i)
[PROOF STEP]
have "(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a)
        = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i\<in>UNIV}. x \<bullet> column b A * x $ a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)
[PROOF STEP]
let ?c= "{column i (fst (QR_decomposition A)) |i. i\<in>UNIV}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)
[PROOF STEP]
let ?d= "{column i (fst (QR_decomposition A)) |i. i\<le>b}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)
[PROOF STEP]
let ?f = "{column i (fst (QR_decomposition A)) |i. i>b}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)
[PROOF STEP]
have set_rw: "?c = ?d \<union> ?f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {column i (fst (QR_decomposition A)) |i. i \<in> UNIV} = {column i (fst (QR_decomposition A)) |i. i \<le> b} \<union> {column i (fst (QR_decomposition A)) |i. b < i}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{column i (fst (QR_decomposition A)) |i. i \<in> UNIV} = {column i (fst (QR_decomposition A)) |i. i \<le> b} \<union> {column i (fst (QR_decomposition A)) |i. b < i}

goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)
[PROOF STEP]
have "(\<Sum>x\<in>?c. x \<bullet> column b A * x $ a)
          = (\<Sum>x\<in>(?d \<union> ?f). x \<bullet> column b A * x $ a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b} \<union> {column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a)
[PROOF STEP]
using set_rw
[PROOF STATE]
proof (prove)
using this:
{column i (fst (QR_decomposition A)) |i. i \<in> UNIV} = {column i (fst (QR_decomposition A)) |i. i \<le> b} \<union> {column i (fst (QR_decomposition A)) |i. b < i}

goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b} \<union> {column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b} \<union> {column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a)

goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b} \<union> {column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a)

goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)
[PROOF STEP]
have "... = (\<Sum>x\<in>?d. x \<bullet> column b A * x $ a) + (\<Sum>x\<in>?f. x \<bullet> column b A * x $ a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b} \<union> {column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) + (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a)
[PROOF STEP]
by (rule sum.union_disjoint, auto, metis f_def inj_eq inj_f not_le)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b} \<union> {column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) + (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a)

goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b} \<union> {column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) + (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a)

goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)
[PROOF STEP]
have "... = (\<Sum>x\<in>?d. x \<bullet> column b A * x $ a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) + (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a)
[PROOF STEP]
using sums_columns_Q_0[OF r]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. ?b < i}. x \<bullet> column ?b A * x $ ?a) = 0

goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) + (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) + (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. b < i}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a)

goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a)

goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)

goal (1 subgoal):
 1. \<And>i. (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a)

goal (1 subgoal):
 1. \<And>i. (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ i)
[PROOF STEP]
have "... = (\<Sum>x\<in>f`UNIV. x \<bullet> column b A * x $ a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>range f. x \<bullet> column b A * x $ a)
[PROOF STEP]
using f_eq
[PROOF STATE]
proof (prove)
using this:
range f = {column i (fst (QR_decomposition A)) |i. i \<in> UNIV}

goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>range f. x \<bullet> column b A * x $ a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>range f. x \<bullet> column b A * x $ a)

goal (1 subgoal):
 1. \<And>i. (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<in> UNIV}. x \<bullet> column b A * x $ a) = (\<Sum>x\<in>range f. x \<bullet> column b A * x $ a)

goal (1 subgoal):
 1. \<And>i. (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ i)
[PROOF STEP]
have "... = (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ a $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>range f. x \<bullet> column b A * x $ a) = (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ a $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A))
[PROOF STEP]
unfolding sum.reindex[OF inj_f]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>x. x \<bullet> column b A * x $ a) \<circ> f) UNIV = (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ a $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A))
[PROOF STEP]
unfolding f_def column_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>x. x \<bullet> (\<chi>i. A $ i $ b) * x $ a) \<circ> (\<lambda>i. \<chi>ia. fst (QR_decomposition A) $ ia $ i)) UNIV = (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ a $ k * ((\<chi>i. fst (QR_decomposition A) $ i $ k) \<bullet> (\<chi>i. A $ i $ b)))
[PROOF STEP]
by (rule sum.cong, simp_all)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>range f. x \<bullet> column b A * x $ a) = (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ a $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A))

goal (1 subgoal):
 1. \<And>i. (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ a $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A))
[PROOF STEP]
show " (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ a $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) =
        (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a) = (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ a $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A))

goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ a $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>UNIV. fst (QR_decomposition A) $ a $ k * (column k (fst (QR_decomposition A)) \<bullet> column b A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. x \<bullet> column b A * x $ a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
column b (\<chi>i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. (x \<bullet> column b A) *\<^sub>R x)

goal (1 subgoal):
 1. \<And>b. column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column b (\<chi>i j. \<Sum>k\<in>UNIV. fst (QR_decomposition A) $ i $ k * (column k (fst (QR_decomposition A)) \<bullet> column j A)) = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. (x \<bullet> column b A) *\<^sub>R x)

goal (1 subgoal):
 1. \<And>b. column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))
[PROOF STEP]
have "... = column b A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. (x \<bullet> column b A) *\<^sub>R x) = column b A
[PROOF STEP]
using column_QR_decomposition2[OF r]
[PROOF STATE]
proof (prove)
using this:
column ?k A = (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> ?k}. (x \<bullet> column ?k A) *\<^sub>R x)

goal (1 subgoal):
 1. (\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. (x \<bullet> column b A) *\<^sub>R x) = column b A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i (fst (QR_decomposition A)) |i. i \<le> b}. (x \<bullet> column b A) *\<^sub>R x) = column b A

goal (1 subgoal):
 1. \<And>b. column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
column b (fst (QR_decomposition A) ** snd (QR_decomposition A)) = column b A
[PROOF STEP]
show "column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))"
[PROOF STATE]
proof (prove)
using this:
column b (fst (QR_decomposition A) ** snd (QR_decomposition A)) = column b A

goal (1 subgoal):
 1. column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>b. column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))

goal (1 subgoal):
 1. A = fst (QR_decomposition A) ** snd (QR_decomposition A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>b. column b A = column b (fst (QR_decomposition A) ** snd (QR_decomposition A))

goal (1 subgoal):
 1. A = fst (QR_decomposition A) ** snd (QR_decomposition A)
[PROOF STEP]
unfolding column_def vec_eq_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>b i. (\<chi>i. A $ i $ b) $ i = (\<chi>i. (fst (QR_decomposition A) ** snd (QR_decomposition A)) $ i $ b) $ i

goal (1 subgoal):
 1. \<forall>i ia. A $ i $ ia = (fst (QR_decomposition A) ** snd (QR_decomposition A)) $ i $ ia
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A = fst (QR_decomposition A) ** snd (QR_decomposition A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma absolutely_integrable_cos_product:
  assumes "f absolutely_integrable_on {-pi..pi}"
  shows "(\<lambda>x. cos(k * x) * f x) absolutely_integrable_on {-pi..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. cos (k * x) * f x) absolutely_integrable_on {- pi..pi}
[PROOF STEP]
proof (rule absolutely_integrable_bounded_measurable_product_real)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (\<lambda>x. cos (k * x)) \<in> borel_measurable (lebesgue_on {- pi..pi})
 2. {- pi..pi} \<in> sets lebesgue
 3. bounded ((\<lambda>x. cos (k * x)) ` {- pi..pi})
 4. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
show "(\<lambda>x. cos (k * x)) \<in> borel_measurable (lebesgue_on {-pi..pi})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. cos (k * x)) \<in> borel_measurable (lebesgue_on {- pi..pi})
[PROOF STEP]
by (metis borel_measurable_integrable integrable_cos_cx mult_commute_abs)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. cos (k * x)) \<in> borel_measurable (lebesgue_on {- pi..pi})

goal (3 subgoals):
 1. {- pi..pi} \<in> sets lebesgue
 2. bounded ((\<lambda>x. cos (k * x)) ` {- pi..pi})
 3. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
show "bounded ((\<lambda>x. cos (k * x)) ` {-pi..pi})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded ((\<lambda>x. cos (k * x)) ` {- pi..pi})
[PROOF STEP]
by (metis (mono_tags, lifting) abs_cos_le_one bounded_iff imageE real_norm_def)
[PROOF STATE]
proof (state)
this:
bounded ((\<lambda>x. cos (k * x)) ` {- pi..pi})

goal (2 subgoals):
 1. {- pi..pi} \<in> sets lebesgue
 2. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
qed (auto simp: assms)


[STATEMENT]
lemma matrix_mult_sum:
  "(A::'a::comm_semiring_1^'n^'m) *v x = sum (\<lambda>i. (x$i) *s column i A) (UNIV:: 'n set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v x = (\<Sum>i\<in>UNIV. x $ i *s column i A)
[PROOF STEP]
by (simp add: matrix_vector_mult_def vec_eq_iff column_def mult.commute)


[STATEMENT]
lemma arcsin_arccos_sqrt_neg: "-1 \<le> x \<Longrightarrow> x \<le> 0 \<Longrightarrow> arcsin x = -arccos(sqrt(1 - x\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> x; x \<le> 0\<rbrakk> \<Longrightarrow> arcsin x = - arccos (sqrt (1 - x\<^sup>2))
[PROOF STEP]
using arcsin_arccos_sqrt_pos [of "-x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> - x; - x \<le> 1\<rbrakk> \<Longrightarrow> arcsin (- x) = arccos (sqrt (1 - (- x)\<^sup>2))

goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> x; x \<le> 0\<rbrakk> \<Longrightarrow> arcsin x = - arccos (sqrt (1 - x\<^sup>2))
[PROOF STEP]
by (simp add: arcsin_minus)


[STATEMENT]
theorem thales:
  fixes A B C :: "'a :: real_inner"
  assumes "dist B (midpoint A C) = dist A C / 2"
  shows   "orthogonal (A - B) (C - B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal (A - B) (C - B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orthogonal (A - B) (C - B)
[PROOF STEP]
have "dist A C ^ 2 = dist B (midpoint A C) ^ 2 * 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist A C)\<^sup>2 = (dist B (midpoint A C))\<^sup>2 * 4
[PROOF STEP]
by (subst assms) (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
(dist A C)\<^sup>2 = (dist B (midpoint A C))\<^sup>2 * 4

goal (1 subgoal):
 1. orthogonal (A - B) (C - B)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(dist A C)\<^sup>2 = (dist B (midpoint A C))\<^sup>2 * 4

goal (1 subgoal):
 1. orthogonal (A - B) (C - B)
[PROOF STEP]
by (auto simp: orthogonal_def dist_norm power2_norm_eq_inner midpoint_def
                   algebra_simps inner_commute)
[PROOF STATE]
proof (state)
this:
orthogonal (A - B) (C - B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linear_homeomorphism_image:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "linear f" "inj f"
  obtains g where "homeomorphism (f ` S) S g f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. homeomorphism (f ` S) S g f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>g. homeomorphism (f ` S) S g f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain g where "linear g" "g \<circ> f = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>linear g; g \<circ> f = id\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms linear_injective_left_inverse
[PROOF STATE]
proof (prove)
using this:
linear f
inj f
\<lbrakk>linear ?f; inj ?f\<rbrakk> \<Longrightarrow> \<exists>g. linear g \<and> g \<circ> ?f = id

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>linear g; g \<circ> f = id\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
linear g
g \<circ> f = id

goal (1 subgoal):
 1. (\<And>g. homeomorphism (f ` S) S g f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
linear g
g \<circ> f = id
[PROOF STEP]
have "homeomorphism (f ` S) S g f"
[PROOF STATE]
proof (prove)
using this:
linear g
g \<circ> f = id

goal (1 subgoal):
 1. homeomorphism (f ` S) S g f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
linear g
g \<circ> f = id
linear f
inj f

goal (1 subgoal):
 1. homeomorphism (f ` S) S g f
[PROOF STEP]
unfolding homeomorphism_def
[PROOF STATE]
proof (prove)
using this:
linear g
g \<circ> f = id
linear f
inj f

goal (1 subgoal):
 1. (\<forall>x\<in>f ` S. f (g x) = x) \<and> g ` f ` S = S \<and> continuous_on (f ` S) g \<and> (\<forall>y\<in>S. g (f y) = y) \<and> f ` S = f ` S \<and> continuous_on S f
[PROOF STEP]
by (auto simp: eq_id_iff [symmetric] image_comp linear_conv_bounded_linear linear_continuous_on)
[PROOF STATE]
proof (state)
this:
homeomorphism (f ` S) S g f

goal (1 subgoal):
 1. (\<And>g. homeomorphism (f ` S) S g f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
homeomorphism (f ` S) S g f
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
using this:
homeomorphism (f ` S) S g f

goal (1 subgoal):
 1. thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma minus_zero_vec_eq:
  fixes v::"'a::{ab_group_add} Matrix.vec"
  assumes "dim_vec v = n"
  and "dim_vec w = n"
  and "v - w = 0\<^sub>v n"
shows "v = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v = w
[PROOF STEP]
have "v = v - w + w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = v - w + w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_vec v = n
dim_vec w = n
v - w = 0\<^sub>v n

goal (1 subgoal):
 1. v = v - w + w
[PROOF STEP]
by (metis carrier_vec_dim_vec comm_add_vec left_zero_vec
        minus_add_minus_vec minus_cancel_vec uminus_eq_vec
        zero_minus_vec)
[PROOF STATE]
proof (state)
this:
v = v - w + w

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

goal (1 subgoal):
 1. v = w
[PROOF STEP]
have "... = 0\<^sub>v n + w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v - w + w = 0\<^sub>v n + w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_vec v = n
dim_vec w = n
v - w = 0\<^sub>v n

goal (1 subgoal):
 1. v - w + w = 0\<^sub>v n + w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
v - w + w = 0\<^sub>v n + w

goal (1 subgoal):
 1. v = w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
v - w + w = 0\<^sub>v n + w

goal (1 subgoal):
 1. v = w
[PROOF STEP]
have "... = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>v n + w = w
[PROOF STEP]
using assms left_zero_vec[of w n]
[PROOF STATE]
proof (prove)
using this:
dim_vec v = n
dim_vec w = n
v - w = 0\<^sub>v n
w \<in> carrier_vec n \<Longrightarrow> 0\<^sub>v n + w = w

goal (1 subgoal):
 1. 0\<^sub>v n + w = w
[PROOF STEP]
by (metis carrier_vec_dim_vec)
[PROOF STATE]
proof (state)
this:
0\<^sub>v n + w = w

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

goal (1 subgoal):
 1. v = w
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
v = w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ordered_map_list_all:
  assumes "finite S" "is_map S"
  shows "list_all P (ordered_map S) = Ball S P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all P (ordered_map S) = Ball S P
[PROOF STEP]
unfolding list_all_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ball (set (ordered_map S)) P = Ball S P
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
is_map S

goal (1 subgoal):
 1. Ball (set (ordered_map S)) P = Ball S P
[PROOF STEP]
by (simp add: ordered_map_set_eq)


[STATEMENT]
lemma take_drop: "take n (drop m xs) = drop m (take (n + m) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take n (drop m xs) = drop m (take (n + m) xs)
[PROOF STEP]
proof (induct m arbitrary: xs n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs n. take n (drop 0 xs) = drop 0 (take (n + 0) xs)
 2. \<And>m xs n. (\<And>xs n. take n (drop m xs) = drop m (take (n + m) xs)) \<Longrightarrow> take n (drop (Suc m) xs) = drop (Suc m) (take (n + Suc m) xs)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>xs n. take n (drop 0 xs) = drop 0 (take (n + 0) xs)
 2. \<And>m xs n. (\<And>xs n. take n (drop m xs) = drop m (take (n + m) xs)) \<Longrightarrow> take n (drop (Suc m) xs) = drop (Suc m) (take (n + Suc m) xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take n (drop 0 xs) = drop 0 (take (n + 0) xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
take n (drop 0 xs) = drop 0 (take (n + 0) xs)

goal (1 subgoal):
 1. \<And>m xs n. (\<And>xs n. take n (drop m xs) = drop m (take (n + m) xs)) \<Longrightarrow> take n (drop (Suc m) xs) = drop (Suc m) (take (n + Suc m) xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m xs n. (\<And>xs n. take n (drop m xs) = drop m (take (n + m) xs)) \<Longrightarrow> take n (drop (Suc m) xs) = drop (Suc m) (take (n + Suc m) xs)
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
take ?n (drop m_ ?xs) = drop m_ (take (?n + m_) ?xs)

goal (1 subgoal):
 1. \<And>m xs n. (\<And>xs n. take n (drop m xs) = drop m (take (n + m) xs)) \<Longrightarrow> take n (drop (Suc m) xs) = drop (Suc m) (take (n + Suc m) xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
take ?n (drop m_ ?xs) = drop m_ (take (?n + m_) ?xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
take ?n (drop m_ ?xs) = drop m_ (take (?n + m_) ?xs)

goal (1 subgoal):
 1. take n (drop (Suc m_) xs) = drop (Suc m_) (take (n + Suc m_) xs)
[PROOF STEP]
by (cases xs; cases n) simp_all
[PROOF STATE]
proof (state)
this:
take n (drop (Suc m_) xs) = drop (Suc m_) (take (n + Suc m_) xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma op_norm_le_sum_column: "\<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)" for A :: "real^'n^'m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
proof(unfold op_norm_def, rule cSup_least[OF op_norm_set_proptys(3)], clarsimp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. \<parallel>xa\<parallel> = 1 \<Longrightarrow> \<parallel>A *v xa\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
fix x :: "real^'n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. \<parallel>xa\<parallel> = 1 \<Longrightarrow> \<parallel>A *v xa\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
assume x_def:"\<parallel>x\<parallel> = 1"
[PROOF STATE]
proof (state)
this:
\<parallel>x\<parallel> = 1

goal (1 subgoal):
 1. \<And>xa. \<parallel>xa\<parallel> = 1 \<Longrightarrow> \<parallel>A *v xa\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
hence x_hyp:"\<And>i. \<parallel>x $ i\<parallel> \<le> 1"
[PROOF STATE]
proof (prove)
using this:
\<parallel>x\<parallel> = 1

goal (1 subgoal):
 1. \<And>i. \<parallel>x $ i\<parallel> \<le> 1
[PROOF STEP]
by (simp add: norm_bound_component_le_cart)
[PROOF STATE]
proof (state)
this:
\<parallel>x $ ?i\<parallel> \<le> 1

goal (1 subgoal):
 1. \<And>xa. \<parallel>xa\<parallel> = 1 \<Longrightarrow> \<parallel>A *v xa\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
have "(\<parallel>A *v x\<parallel>) = \<parallel>(\<Sum>i\<in>UNIV. x $ i *s column i A)\<parallel>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A *v x\<parallel> = \<parallel>\<Sum>i\<in>UNIV. x $ i *s column i A\<parallel>
[PROOF STEP]
by(subst matrix_mult_sum[of A], simp)
[PROOF STATE]
proof (state)
this:
\<parallel>A *v x\<parallel> = \<parallel>\<Sum>i\<in>UNIV. x $ i *s column i A\<parallel>

goal (1 subgoal):
 1. \<And>xa. \<parallel>xa\<parallel> = 1 \<Longrightarrow> \<parallel>A *v xa\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<parallel>A *v x\<parallel> = \<parallel>\<Sum>i\<in>UNIV. x $ i *s column i A\<parallel>

goal (1 subgoal):
 1. \<And>xa. \<parallel>xa\<parallel> = 1 \<Longrightarrow> \<parallel>A *v xa\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
have "... \<le> (\<Sum>i\<in>UNIV. \<parallel>x $ i *s column i A\<parallel>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>\<Sum>i\<in>UNIV. x $ i *s column i A\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>x $ i *s column i A\<parallel>)
[PROOF STEP]
by (simp add: sum_norm_le)
[PROOF STATE]
proof (state)
this:
\<parallel>\<Sum>i\<in>UNIV. x $ i *s column i A\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>x $ i *s column i A\<parallel>)

goal (1 subgoal):
 1. \<And>xa. \<parallel>xa\<parallel> = 1 \<Longrightarrow> \<parallel>A *v xa\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<parallel>\<Sum>i\<in>UNIV. x $ i *s column i A\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>x $ i *s column i A\<parallel>)

goal (1 subgoal):
 1. \<And>xa. \<parallel>xa\<parallel> = 1 \<Longrightarrow> \<parallel>A *v xa\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
have "... = (\<Sum>i\<in>UNIV. (\<parallel>x $ i\<parallel>) * (\<parallel>column i A\<parallel>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. \<parallel>x $ i *s column i A\<parallel>) = (\<Sum>i\<in>UNIV. \<parallel>x $ i\<parallel> * \<parallel>column i A\<parallel>)
[PROOF STEP]
by (simp add: mult_norm_matrix_sgn_eq)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. \<parallel>x $ i *s column i A\<parallel>) = (\<Sum>i\<in>UNIV. \<parallel>x $ i\<parallel> * \<parallel>column i A\<parallel>)

goal (1 subgoal):
 1. \<And>xa. \<parallel>xa\<parallel> = 1 \<Longrightarrow> \<parallel>A *v xa\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. \<parallel>x $ i *s column i A\<parallel>) = (\<Sum>i\<in>UNIV. \<parallel>x $ i\<parallel> * \<parallel>column i A\<parallel>)

goal (1 subgoal):
 1. \<And>xa. \<parallel>xa\<parallel> = 1 \<Longrightarrow> \<parallel>A *v xa\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
have "... \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. \<parallel>x $ i\<parallel> * \<parallel>column i A\<parallel>) \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
using x_hyp
[PROOF STATE]
proof (prove)
using this:
\<parallel>x $ ?i\<parallel> \<le> 1

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. \<parallel>x $ i\<parallel> * \<parallel>column i A\<parallel>) \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
by (simp add: mult_left_le_one_le sum_mono)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. \<parallel>x $ i\<parallel> * \<parallel>column i A\<parallel>) \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)

goal (1 subgoal):
 1. \<And>xa. \<parallel>xa\<parallel> = 1 \<Longrightarrow> \<parallel>A *v xa\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<parallel>A *v x\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
show "\<parallel>A *v x\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)"
[PROOF STATE]
proof (prove)
using this:
\<parallel>A *v x\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)

goal (1 subgoal):
 1. \<parallel>A *v x\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<parallel>A *v x\<parallel> \<le> (\<Sum>i\<in>UNIV. \<parallel>column i A\<parallel>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma double_sum_split_case:
  assumes "finite A"
  shows "(\<Sum> i \<in> A . (\<Sum> j \<in> A . f i j)) = (\<Sum> i \<in> A . (f i i)) + (\<Sum> i \<in> A . (\<Sum> j \<in> (A - {i}) . f i j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>A. sum (f i) A) = (\<Sum>i\<in>A. f i i) + (\<Sum>i\<in>A. sum (f i) (A - {i}))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>A. sum (f i) A) = (\<Sum>i\<in>A. f i i) + (\<Sum>i\<in>A. sum (f i) (A - {i}))
[PROOF STEP]
have "\<And> i. i \<in> A \<Longrightarrow> (\<Sum> j \<in> A . f i j) = f i i + (\<Sum> j \<in> (A - {i}) . f i j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> sum (f i) A = f i i + sum (f i) (A - {i})
[PROOF STEP]
using sum.remove assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; ?x \<in> ?A\<rbrakk> \<Longrightarrow> sum ?g ?A = ?g ?x + sum ?g (?A - {?x})
finite A

goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> sum (f i) A = f i i + sum (f i) (A - {i})
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
?i1 \<in> A \<Longrightarrow> sum (f ?i1) A = f ?i1 ?i1 + sum (f ?i1) (A - {?i1})

goal (1 subgoal):
 1. (\<Sum>i\<in>A. sum (f i) A) = (\<Sum>i\<in>A. f i i) + (\<Sum>i\<in>A. sum (f i) (A - {i}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i1 \<in> A \<Longrightarrow> sum (f ?i1) A = f ?i1 ?i1 + sum (f ?i1) (A - {?i1})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> A \<Longrightarrow> sum (f ?i1) A = f ?i1 ?i1 + sum (f ?i1) (A - {?i1})

goal (1 subgoal):
 1. (\<Sum>i\<in>A. sum (f i) A) = (\<Sum>i\<in>A. f i i) + (\<Sum>i\<in>A. sum (f i) (A - {i}))
[PROOF STEP]
by (simp add: sum.distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>A. sum (f i) A) = (\<Sum>i\<in>A. f i i) + (\<Sum>i\<in>A. sum (f i) (A - {i}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma det_four_block_mat_lower_left_zero: fixes A1 :: "'a :: idom mat"
  assumes A1: "A1 \<in> carrier_mat n n"
  and A2: "A2 \<in> carrier_mat n m" and A30: "A3 = 0\<^sub>m m n"
  and A4: "A4 \<in> carrier_mat m m"
shows "det (four_block_mat A1 A2 A3 A4) = det A1 * det A4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (four_block_mat A1 A2 A3 A4) = det A1 * det A4
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (four_block_mat A1 A2 A3 A4) = det A1 * det A4
[PROOF STEP]
have A3: "A3 \<in> carrier_mat m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A3 \<in> carrier_mat m n
[PROOF STEP]
using A30
[PROOF STATE]
proof (prove)
using this:
A3 = 0\<^sub>m m n

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

goal (1 subgoal):
 1. det (four_block_mat A1 A2 A3 A4) = det A1 * det A4
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (four_block_mat A1 A2 A3 A4) = det A1 * det A4
[PROOF STEP]
apply (subst det_transpose[OF four_block_carrier_mat[OF A1 A4], symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (four_block_mat A1 A2 A3 A4)\<^sup>T = det A1 * det A4
[PROOF STEP]
apply (subst transpose_four_block_mat[OF A1 A2 A3 A4])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (four_block_mat A1\<^sup>T A3\<^sup>T A2\<^sup>T A4\<^sup>T) = det A1 * det A4
[PROOF STEP]
apply (subst det_four_block_mat_upper_right_zero[of _ n _ m],
        insert A1 A2 A30 A4, auto simp: det_transpose)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
det (four_block_mat A1 A2 A3 A4) = det A1 * det A4

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma absolutely_integrable_mult_Fejer_kernel_reflected_part5:
  assumes f: "f absolutely_integrable_on {-pi..pi}"
    and periodic: "\<And>x. f(x + 2*pi) = f x" and "d \<le> pi"
  shows "(\<lambda>x. Fejer_kernel n x * ((f(t + x) + f(t - x)) - c)) absolutely_integrable_on {0..d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. Fejer_kernel n x * (f (t + x) + f (t - x) - c)) absolutely_integrable_on {0..d}
[PROOF STEP]
unfolding distrib_left right_diff_distrib
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. Fejer_kernel n x * f (t + x) + Fejer_kernel n x * f (t - x) - Fejer_kernel n x * c) absolutely_integrable_on {0..d}
[PROOF STEP]
by (intro set_integral_add set_integral_diff absolutely_integrable_on_const
      absolutely_integrable_mult_Fejer_kernel_reflected_part1 absolutely_integrable_mult_Fejer_kernel_reflected_part2 assms, auto)


[STATEMENT]
lemma continuous_sgn:
  fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
  assumes "continuous F f"
    and "f (Lim F (\<lambda>x. x)) \<noteq> 0"
  shows "continuous F (\<lambda>x. sgn (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F (\<lambda>x. sgn (f x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous F f
f (Lim F (\<lambda>x. x)) \<noteq> (0::'b)

goal (1 subgoal):
 1. continuous F (\<lambda>x. sgn (f x))
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F
f (Lim F (\<lambda>x. x)) \<noteq> (0::'b)

goal (1 subgoal):
 1. ((\<lambda>x. sgn (f x)) \<longlongrightarrow> sgn (f (Lim F (\<lambda>x. x)))) F
[PROOF STEP]
by (rule tendsto_sgn)


[STATEMENT]
lemma ringhom1:"\<lbrakk> Ring A; Ring R; x \<in> carrier A; y \<in> carrier A;
                    f \<in> rHom A R \<rbrakk> \<Longrightarrow> f (x \<plusminus>\<^bsub>A\<^esub> y) = (f x) \<plusminus>\<^bsub>R\<^esub> (f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; x \<in> carrier A; y \<in> carrier A; f \<in> rHom A R\<rbrakk> \<Longrightarrow> f (x \<plusminus>\<^bsub>A\<^esub> y) = f x \<plusminus>\<^bsub>R\<^esub> f y
[PROOF STEP]
apply (simp add:rHom_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; x \<in> carrier A; y \<in> carrier A; f \<in> aHom A R \<and> (\<forall>x\<in>carrier A. \<forall>y\<in>carrier A. f (x \<cdot>\<^sub>r\<^bsub>A\<^esub> y) = f x \<cdot>\<^sub>r\<^bsub>R\<^esub> f y) \<and> f 1\<^sub>r\<^bsub>A\<^esub> = 1\<^sub>r\<^bsub>R\<^esub>\<rbrakk> \<Longrightarrow> f (x \<plusminus>\<^bsub>A\<^esub> y) = f x \<plusminus>\<^bsub>R\<^esub> f y
[PROOF STEP]
apply (erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; x \<in> carrier A; y \<in> carrier A; f \<in> aHom A R; (\<forall>x\<in>carrier A. \<forall>y\<in>carrier A. f (x \<cdot>\<^sub>r\<^bsub>A\<^esub> y) = f x \<cdot>\<^sub>r\<^bsub>R\<^esub> f y) \<and> f 1\<^sub>r\<^bsub>A\<^esub> = 1\<^sub>r\<^bsub>R\<^esub>\<rbrakk> \<Longrightarrow> f (x \<plusminus>\<^bsub>A\<^esub> y) = f x \<plusminus>\<^bsub>R\<^esub> f y
[PROOF STEP]
apply (frule Ring.ring_is_ag [of "A"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; x \<in> carrier A; y \<in> carrier A; f \<in> aHom A R; (\<forall>x\<in>carrier A. \<forall>y\<in>carrier A. f (x \<cdot>\<^sub>r\<^bsub>A\<^esub> y) = f x \<cdot>\<^sub>r\<^bsub>R\<^esub> f y) \<and> f 1\<^sub>r\<^bsub>A\<^esub> = 1\<^sub>r\<^bsub>R\<^esub>; aGroup A\<rbrakk> \<Longrightarrow> f (x \<plusminus>\<^bsub>A\<^esub> y) = f x \<plusminus>\<^bsub>R\<^esub> f y
[PROOF STEP]
apply (frule Ring.ring_is_ag [of "R"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; x \<in> carrier A; y \<in> carrier A; f \<in> aHom A R; (\<forall>x\<in>carrier A. \<forall>y\<in>carrier A. f (x \<cdot>\<^sub>r\<^bsub>A\<^esub> y) = f x \<cdot>\<^sub>r\<^bsub>R\<^esub> f y) \<and> f 1\<^sub>r\<^bsub>A\<^esub> = 1\<^sub>r\<^bsub>R\<^esub>; aGroup A; aGroup R\<rbrakk> \<Longrightarrow> f (x \<plusminus>\<^bsub>A\<^esub> y) = f x \<plusminus>\<^bsub>R\<^esub> f y
[PROOF STEP]
apply (rule aHom_add, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nth_mset_commute_mono:
  assumes "mono f"
  assumes "k < size M"
  shows "f (nth_mset k M) = nth_mset k (image_mset f M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (nth_mset k M) = nth_mset k (image_mset f M)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f (nth_mset k M) = nth_mset k (image_mset f M)
[PROOF STEP]
have a:"k < length (sorted_list_of_multiset M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < length (sorted_list_of_multiset M)
[PROOF STEP]
by (metis assms(2) mset_sorted_list_of_multiset size_mset)
[PROOF STATE]
proof (state)
this:
k < length (sorted_list_of_multiset M)

goal (1 subgoal):
 1. f (nth_mset k M) = nth_mset k (image_mset f M)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (nth_mset k M) = nth_mset k (image_mset f M)
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
k < length (sorted_list_of_multiset M)

goal (1 subgoal):
 1. f (nth_mset k M) = nth_mset k (image_mset f M)
[PROOF STEP]
by (simp add:nth_mset_def sorted_list_of_multiset_image_commute[OF assms(1)])
[PROOF STATE]
proof (state)
this:
f (nth_mset k M) = nth_mset k (image_mset f M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_combine_tagged_division_topdown:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  assumes "f integrable_on cbox a b"
    and "p tagged_division_of (cbox a b)"
  shows "integral (cbox a b) f = sum (\<lambda>(x,k). integral k f) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (cbox a b) f = (\<Sum>(x, k)\<in>p. integral k f)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f integrable_on cbox a b
p tagged_division_of cbox a b

goal (1 subgoal):
 1. integral (cbox a b) f = (\<Sum>(x, k)\<in>p. integral k f)
[PROOF STEP]
by (auto intro: integral_unique [OF has_integral_combine_tagged_division_topdown])


[STATEMENT]
lemma spectrum_char_poly_root:
  fixes A::"complex Matrix.mat"
  assumes "A\<in> carrier_mat n n"
and "k \<in> spectrum A"
shows "poly (char_poly A) k = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (char_poly A) k = 0
[PROOF STEP]
using eigvals_poly_length[of A n] assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n \<Longrightarrow> char_poly A = (\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) \<and> length (eigvals A) = dim_row A
A \<in> carrier_mat n n
k \<in> spectrum A

goal (1 subgoal):
 1. poly (char_poly A) k = 0
[PROOF STEP]
unfolding spectrum_def  eigenvalue_root_char_poly
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n \<Longrightarrow> char_poly A = (\<Prod>a\<leftarrow>eigvals A. [:- a, 1:]) \<and> length (eigvals A) = dim_row A
A \<in> carrier_mat n n
k \<in> set (eigvals A)

goal (1 subgoal):
 1. poly (char_poly A) k = 0
[PROOF STEP]
by (simp add: linear_poly_root)


[STATEMENT]
lemma absolutely_integrable_Gamma_integral':
  assumes "Re z > 0"
  shows   "(\<lambda>t. complex_of_real t powr (z - 1) / of_real (exp t)) absolutely_integrable_on {0<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_set_integrable lebesgue {0<..} (\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t))
[PROOF STEP]
using absolutely_integrable_Gamma_integral [OF assms zero_less_one]
[PROOF STATE]
proof (prove)
using this:
complex_set_integrable lebesgue {0<..} (\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp (1 * t)))

goal (1 subgoal):
 1. complex_set_integrable lebesgue {0<..} (\<lambda>t. complex_of_real t powr (z - 1) / complex_of_real (exp t))
[PROOF STEP]
by simp


[STATEMENT]
lemma "((\<lambda>x::real. (ln(ln x + ln (ln x)) - ln (ln x)) /
                      (ln (ln x + ln (ln (ln x)))) * ln x) \<longlongrightarrow> 1) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (ln (ln x + ln (ln x)) - ln (ln x)) / ln (ln x + ln (ln (ln x))) * ln x) \<longlongrightarrow> 1) at_top
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma lfp_while_lattice:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'a"
  assumes "mono f" and "finite (UNIV :: 'a set)"
  shows "lfp f = while (\<lambda>A. f A \<noteq> A) f bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfp f = while (\<lambda>A. f A \<noteq> A) f bot
[PROOF STEP]
unfolding while_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfp f = the (while_option (\<lambda>A. f A \<noteq> A) f bot)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mono f
finite UNIV

goal (1 subgoal):
 1. lfp f = the (while_option (\<lambda>A. f A \<noteq> A) f bot)
[PROOF STEP]
by (rule lfp_the_while_option_lattice)


[STATEMENT]
lemma csorted_list_of_set_set [simp]:
  "\<lbrakk> ID CCOMPARE('a :: ccompare) = Some c; linorder.sorted (le_of_comp c) xs; distinct xs \<rbrakk>
  \<Longrightarrow> linorder.sorted_list_of_set (le_of_comp c) (set xs) = xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ID ccompare = Some c; sorted_wrt (le_of_comp c) xs; distinct xs\<rbrakk> \<Longrightarrow> linorder.sorted_list_of_set (le_of_comp c) (set xs) = xs
[PROOF STEP]
by(simp add: distinct_remdups_id linorder.sorted_list_of_set_sort_remdups[OF ID_ccompare] linorder.sorted_sort_id[OF ID_ccompare])


[STATEMENT]
lemma (in comm_monoid_add) sum_list_plus :
  "length xs = length ys
        \<Longrightarrow> sum_list xs + sum_list ys = sum_list [a+b. (a,b)\<leftarrow>zip xs ys]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys \<Longrightarrow> sum_list xs + sum_list ys = sum_list (map2 (+) xs ys)
[PROOF STEP]
proof (induct xs ys rule: list_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sum_list [] + sum_list [] = sum_list (map2 (+) [] [])
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; sum_list xs + sum_list ys = sum_list (map2 (+) xs ys)\<rbrakk> \<Longrightarrow> sum_list (x # xs) + sum_list (y # ys) = sum_list (map2 (+) (x # xs) (y # ys))
[PROOF STEP]
case Cons
[PROOF STATE]
proof (state)
this:
length xs_ = length ys_
sum_list xs_ + sum_list ys_ = sum_list (map2 (+) xs_ ys_)

goal (2 subgoals):
 1. sum_list [] + sum_list [] = sum_list (map2 (+) [] [])
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; sum_list xs + sum_list ys = sum_list (map2 (+) xs ys)\<rbrakk> \<Longrightarrow> sum_list (x # xs) + sum_list (y # ys) = sum_list (map2 (+) (x # xs) (y # ys))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
length xs_ = length ys_
sum_list xs_ + sum_list ys_ = sum_list (map2 (+) xs_ ys_)

goal (1 subgoal):
 1. sum_list (x_ # xs_) + sum_list (y_ # ys_) = sum_list (map2 (+) (x_ # xs_) (y_ # ys_))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
sum_list (x_ # xs_) + sum_list (y_ # ys_) = sum_list (map2 (+) (x_ # xs_) (y_ # ys_))

goal (1 subgoal):
 1. sum_list [] + sum_list [] = sum_list (map2 (+) [] [])
[PROOF STEP]
qed simp


[STATEMENT]
lemma insertion_sum_var : "((insertion f (\<Sum>i\<in>{0..<(n::nat)}.g(i))) = (\<Sum>i\<in>{0..<n}. insertion f (g i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion f (sum g {0..<n}) = (\<Sum>i = 0..<n. insertion f (g i))
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. insertion f (sum g {0..<0}) = (\<Sum>i = 0..<0. insertion f (g i))
 2. \<And>n. insertion f (sum g {0..<n}) = (\<Sum>i = 0..<n. insertion f (g i)) \<Longrightarrow> insertion f (sum g {0..<Suc n}) = (\<Sum>i = 0..<Suc n. insertion f (g i))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. insertion f (sum g {0..<0}) = (\<Sum>i = 0..<0. insertion f (g i))
 2. \<And>n. insertion f (sum g {0..<n}) = (\<Sum>i = 0..<n. insertion f (g i)) \<Longrightarrow> insertion f (sum g {0..<Suc n}) = (\<Sum>i = 0..<Suc n. insertion f (g i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion f (sum g {0..<0}) = (\<Sum>i = 0..<0. insertion f (g i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insertion f (sum g {0..<0}) = (\<Sum>i = 0..<0. insertion f (g i))

goal (1 subgoal):
 1. \<And>n. insertion f (sum g {0..<n}) = (\<Sum>i = 0..<n. insertion f (g i)) \<Longrightarrow> insertion f (sum g {0..<Suc n}) = (\<Sum>i = 0..<Suc n. insertion f (g i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. insertion f (sum g {0..<n}) = (\<Sum>i = 0..<n. insertion f (g i)) \<Longrightarrow> insertion f (sum g {0..<Suc n}) = (\<Sum>i = 0..<Suc n. insertion f (g i))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
insertion f (sum g {0..<n}) = (\<Sum>i = 0..<n. insertion f (g i))

goal (1 subgoal):
 1. \<And>n. insertion f (sum g {0..<n}) = (\<Sum>i = 0..<n. insertion f (g i)) \<Longrightarrow> insertion f (sum g {0..<Suc n}) = (\<Sum>i = 0..<Suc n. insertion f (g i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
insertion f (sum g {0..<n}) = (\<Sum>i = 0..<n. insertion f (g i))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
insertion f (sum g {0..<n}) = (\<Sum>i = 0..<n. insertion f (g i))

goal (1 subgoal):
 1. insertion f (sum g {0..<Suc n}) = (\<Sum>i = 0..<Suc n. insertion f (g i))
[PROOF STEP]
by (simp add: insertion_add)
[PROOF STATE]
proof (state)
this:
insertion f (sum g {0..<Suc n}) = (\<Sum>i = 0..<Suc n. insertion f (g i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_sets_trans: "\<lbrakk>A \<lless> B; B \<lless> C; B \<noteq> {}\<rbrakk> \<Longrightarrow> A \<lless> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<lless> B; B \<lless> C; B \<noteq> {}\<rbrakk> \<Longrightarrow> A \<lless> C
[PROOF STEP]
unfolding less_sets_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>A. \<forall>y\<in>B. x < y; \<forall>x\<in>B. \<forall>y\<in>C. x < y; B \<noteq> {}\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. \<forall>y\<in>C. x < y
[PROOF STEP]
using less_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x < ?y; ?y < ?z\<rbrakk> \<Longrightarrow> ?x < ?z

goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>A. \<forall>y\<in>B. x < y; \<forall>x\<in>B. \<forall>y\<in>C. x < y; B \<noteq> {}\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. \<forall>y\<in>C. x < y
[PROOF STEP]
by blast


[STATEMENT]
lemma prob0_fst_qubits_eq:
  fixes n:: nat
  shows "prob0_fst_qubits n v = (cmod(v $$ (0,0)))\<^sup>2 + (cmod(v $$ (1,0)))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob0_fst_qubits n v = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prob0_fst_qubits n v = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2
[PROOF STEP]
have "prob0_fst_qubits n v = (\<Sum>j\<in>{k| k::nat. (k<2^(n+1)) \<and> (\<forall>i\<in>{0..<n}. \<not> select_index (n+1) i k)}. (cmod(v $$ (j,0)))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob0_fst_qubits n v = (\<Sum>j\<in>{k |k. k < 2 ^ (n + 1) \<and> (\<forall>i\<in>{0..<n}. \<not> select_index (n + 1) i k)}. (cmod (v $$ (j, 0)))\<^sup>2)
[PROOF STEP]
using prob0_fst_qubits_def
[PROOF STATE]
proof (prove)
using this:
prob0_fst_qubits ?n ?v \<equiv> \<Sum>j\<in>{k |k. k < 2 ^ (?n + 1) \<and> (\<forall>i\<in>{0..<?n}. \<not> select_index (?n + 1) i k)}. (cmod (?v $$ (j, 0)))\<^sup>2

goal (1 subgoal):
 1. prob0_fst_qubits n v = (\<Sum>j\<in>{k |k. k < 2 ^ (n + 1) \<and> (\<forall>i\<in>{0..<n}. \<not> select_index (n + 1) i k)}. (cmod (v $$ (j, 0)))\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob0_fst_qubits n v = (\<Sum>j\<in>{k |k. k < 2 ^ (n + 1) \<and> (\<forall>i\<in>{0..<n}. \<not> select_index (n + 1) i k)}. (cmod (v $$ (j, 0)))\<^sup>2)

goal (1 subgoal):
 1. prob0_fst_qubits n v = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
prob0_fst_qubits n v = (\<Sum>j\<in>{k |k. k < 2 ^ (n + 1) \<and> (\<forall>i\<in>{0..<n}. \<not> select_index (n + 1) i k)}. (cmod (v $$ (j, 0)))\<^sup>2)

goal (1 subgoal):
 1. prob0_fst_qubits n v = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2
[PROOF STEP]
have "\<dots> = (\<Sum>j\<in>{0,1}. (cmod(v $$ (j,0)))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>{k |k. k < 2 ^ (n + 1) \<and> (\<forall>i\<in>{0..<n}. \<not> select_index (n + 1) i k)}. (cmod (v $$ (j, 0)))\<^sup>2) = (\<Sum>j\<in>{0, 1}. (cmod (v $$ (j, 0)))\<^sup>2)
[PROOF STEP]
using prob0_fst_qubits_index
[PROOF STATE]
proof (prove)
using this:
{k |k. k < 2 ^ (?n + 1) \<and> (\<forall>i\<in>{0..<?n}. \<not> select_index (?n + 1) i k)} = {0, 1}

goal (1 subgoal):
 1. (\<Sum>j\<in>{k |k. k < 2 ^ (n + 1) \<and> (\<forall>i\<in>{0..<n}. \<not> select_index (n + 1) i k)}. (cmod (v $$ (j, 0)))\<^sup>2) = (\<Sum>j\<in>{0, 1}. (cmod (v $$ (j, 0)))\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>{k |k. k < 2 ^ (n + 1) \<and> (\<forall>i\<in>{0..<n}. \<not> select_index (n + 1) i k)}. (cmod (v $$ (j, 0)))\<^sup>2) = (\<Sum>j\<in>{0, 1}. (cmod (v $$ (j, 0)))\<^sup>2)

goal (1 subgoal):
 1. prob0_fst_qubits n v = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prob0_fst_qubits n v = (\<Sum>j\<in>{0, 1}. (cmod (v $$ (j, 0)))\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prob0_fst_qubits n v = (\<Sum>j\<in>{0, 1}. (cmod (v $$ (j, 0)))\<^sup>2)

goal (1 subgoal):
 1. prob0_fst_qubits n v = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob0_fst_qubits n v = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem insert_list_set:
  assumes "sorted_less xs"
  shows "insert_list x xs = ins_list x xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert_list x xs = ins_list x xs
[PROOF STEP]
using assms split_list_conc
[PROOF STATE]
proof (prove)
using this:
sorted_less xs
split_list ?ks ?p = (?kls, ?krs) \<Longrightarrow> ?ks = ?kls @ ?krs

goal (1 subgoal):
 1. insert_list x xs = ins_list x xs
[PROOF STEP]
using insert_sorted_split_list[of xs x]
[PROOF STATE]
proof (prove)
using this:
sorted_less xs
split_list ?ks ?p = (?kls, ?krs) \<Longrightarrow> ?ks = ?kls @ ?krs
\<lbrakk>sorted_less xs; split_list xs x = (?ls, ?rs)\<rbrakk> \<Longrightarrow> ins_list x xs = ?ls @ ins_list x ?rs

goal (1 subgoal):
 1. insert_list x xs = ins_list x xs
[PROOF STEP]
using insert_sorted_split_list_right[of xs x]
[PROOF STATE]
proof (prove)
using this:
sorted_less xs
split_list ?ks ?p = (?kls, ?krs) \<Longrightarrow> ?ks = ?kls @ ?krs
\<lbrakk>sorted_less xs; split_list xs x = (?ls, ?rs)\<rbrakk> \<Longrightarrow> ins_list x xs = ?ls @ ins_list x ?rs
\<lbrakk>split_list xs x = (?ls, ?sep # ?rs); sorted_less xs; x \<noteq> ?sep\<rbrakk> \<Longrightarrow> ins_list x (?sep # ?rs) = x # ?sep # ?rs

goal (1 subgoal):
 1. insert_list x xs = ins_list x xs
[PROOF STEP]
by (auto split!: list.splits prod.splits)


[STATEMENT]
lemma sum_of_odd_squares:
  "3 * (\<Sum>i=0..<n. Suc(2*i) * Suc(2*i)) = n * (4 * n * n - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 * (\<Sum>i = 0..<n. Suc (2 * i) * Suc (2 * i)) = n * (4 * n * n - 1)
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma det_mult: "det (A * B) = det A * det B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Square_Matrix.det (A * B) = Square_Matrix.det A * Square_Matrix.det B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Square_Matrix.det (A * B) = Square_Matrix.det A * Square_Matrix.det B
[PROOF STEP]
have "A * B = upd_rows 0 UNIV (\<lambda>i. \<Sum>j\<in>UNIV. to_fun A i j *s row B j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B = upd_rows 0 UNIV (\<lambda>i. \<Sum>j\<in>UNIV. to_fun A i j *s Square_Matrix.row B j)
[PROOF STEP]
by transfer simp
[PROOF STATE]
proof (state)
this:
A * B = upd_rows 0 UNIV (\<lambda>i. \<Sum>j\<in>UNIV. to_fun A i j *s Square_Matrix.row B j)

goal (1 subgoal):
 1. Square_Matrix.det (A * B) = Square_Matrix.det A * Square_Matrix.det B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A * B = upd_rows 0 UNIV (\<lambda>i. \<Sum>j\<in>UNIV. to_fun A i j *s Square_Matrix.row B j)

goal (1 subgoal):
 1. Square_Matrix.det (A * B) = Square_Matrix.det A * Square_Matrix.det B
[PROOF STEP]
have "\<And>f. upd_rows 0 UNIV (\<lambda>i. Square_Matrix.row B (f i)) = perm_rows B f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. upd_rows 0 UNIV (\<lambda>i. Square_Matrix.row B (f i)) = perm_rows B f
[PROOF STEP]
by transfer simp
[PROOF STATE]
proof (state)
this:
upd_rows 0 UNIV (\<lambda>i. Square_Matrix.row B (?f i)) = perm_rows B ?f

goal (1 subgoal):
 1. Square_Matrix.det (A * B) = Square_Matrix.det A * Square_Matrix.det B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
upd_rows 0 UNIV (\<lambda>i. Square_Matrix.row B (?f i)) = perm_rows B ?f

goal (1 subgoal):
 1. Square_Matrix.det (A * B) = Square_Matrix.det A * Square_Matrix.det B
[PROOF STEP]
have "det A = (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. to_fun A i (p i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Square_Matrix.det A = (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. to_fun A i (p i)))
[PROOF STEP]
by transfer rule
[PROOF STATE]
proof (state)
this:
Square_Matrix.det A = (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. to_fun A i (p i)))

goal (1 subgoal):
 1. Square_Matrix.det (A * B) = Square_Matrix.det A * Square_Matrix.det B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
A * B = upd_rows 0 UNIV (\<lambda>i. \<Sum>j\<in>UNIV. to_fun A i j *s Square_Matrix.row B j)
upd_rows 0 UNIV (\<lambda>i. Square_Matrix.row B (?f i)) = perm_rows B ?f
Square_Matrix.det A = (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. to_fun A i (p i)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A * B = upd_rows 0 UNIV (\<lambda>i. \<Sum>j\<in>UNIV. to_fun A i j *s Square_Matrix.row B j)
upd_rows 0 UNIV (\<lambda>i. Square_Matrix.row B (?f i)) = perm_rows B ?f
Square_Matrix.det A = (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. to_fun A i (p i)))

goal (1 subgoal):
 1. Square_Matrix.det (A * B) = Square_Matrix.det A * Square_Matrix.det B
[PROOF STEP]
by (auto simp add: det_rows_sum det_rows_mult sum_distrib_right det_perm_rows_If
             split: if_split_asm intro!: sum.mono_neutral_cong_right)
[PROOF STATE]
proof (state)
this:
Square_Matrix.det (A * B) = Square_Matrix.det A * Square_Matrix.det B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma extreme_point_of_convex_hull_eq:
  fixes S :: "'a::euclidean_space set"
  shows
   "\<lbrakk>compact S; \<And>T. T \<subset> S \<Longrightarrow> convex hull T \<noteq> convex hull S\<rbrakk>
    \<Longrightarrow> (x extreme_point_of (convex hull S) \<longleftrightarrow> x \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>compact S; \<And>T. T \<subset> S \<Longrightarrow> convex hull T \<noteq> convex hull S\<rbrakk> \<Longrightarrow> (x extreme_point_of convex hull S) = (x \<in> S)
[PROOF STEP]
using extreme_points_of_convex_hull_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>compact ?S; \<And>T. T \<subset> ?S \<Longrightarrow> convex hull T \<noteq> convex hull ?S\<rbrakk> \<Longrightarrow> {x. x extreme_point_of convex hull ?S} = ?S

goal (1 subgoal):
 1. \<lbrakk>compact S; \<And>T. T \<subset> S \<Longrightarrow> convex hull T \<noteq> convex hull S\<rbrakk> \<Longrightarrow> (x extreme_point_of convex hull S) = (x \<in> S)
[PROOF STEP]
by auto


[STATEMENT]
lemma minus_mtx3: "mtx
  ([a\<^sub>1\<^sub>1, a\<^sub>1\<^sub>2, a\<^sub>1\<^sub>3] #
   [a\<^sub>2\<^sub>1, a\<^sub>2\<^sub>2, a\<^sub>2\<^sub>3] #
   [a\<^sub>3\<^sub>1, a\<^sub>3\<^sub>2, a\<^sub>3\<^sub>3] # []) - mtx
  ([b\<^sub>1\<^sub>1, b\<^sub>1\<^sub>2, b\<^sub>1\<^sub>3] #
   [b\<^sub>2\<^sub>1, b\<^sub>2\<^sub>2, b\<^sub>2\<^sub>3] #
   [b\<^sub>3\<^sub>1, b\<^sub>3\<^sub>2, b\<^sub>3\<^sub>3] # []) = (mtx
  ([a\<^sub>1\<^sub>1-b\<^sub>1\<^sub>1, a\<^sub>1\<^sub>2-b\<^sub>1\<^sub>2, a\<^sub>1\<^sub>3-b\<^sub>1\<^sub>3] #
   [a\<^sub>2\<^sub>1-b\<^sub>2\<^sub>1, a\<^sub>2\<^sub>2-b\<^sub>2\<^sub>2, a\<^sub>2\<^sub>3-b\<^sub>2\<^sub>3] #
   [a\<^sub>3\<^sub>1-b\<^sub>3\<^sub>1, a\<^sub>3\<^sub>2-b\<^sub>3\<^sub>2, a\<^sub>3\<^sub>3-b\<^sub>3\<^sub>3] # [])::3 sq_mtx)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mtx [[a\<^sub>1\<^sub>1, a\<^sub>1\<^sub>2, a\<^sub>1\<^sub>3], [a\<^sub>2\<^sub>1, a\<^sub>2\<^sub>2, a\<^sub>2\<^sub>3], [a\<^sub>3\<^sub>1, a\<^sub>3\<^sub>2, a\<^sub>3\<^sub>3]] - mtx [[b\<^sub>1\<^sub>1, b\<^sub>1\<^sub>2, b\<^sub>1\<^sub>3], [b\<^sub>2\<^sub>1, b\<^sub>2\<^sub>2, b\<^sub>2\<^sub>3], [b\<^sub>3\<^sub>1, b\<^sub>3\<^sub>2, b\<^sub>3\<^sub>3]] = mtx [[a\<^sub>1\<^sub>1 - b\<^sub>1\<^sub>1, a\<^sub>1\<^sub>2 - b\<^sub>1\<^sub>2, a\<^sub>1\<^sub>3 - b\<^sub>1\<^sub>3], [a\<^sub>2\<^sub>1 - b\<^sub>2\<^sub>1, a\<^sub>2\<^sub>2 - b\<^sub>2\<^sub>2, a\<^sub>2\<^sub>3 - b\<^sub>2\<^sub>3], [a\<^sub>3\<^sub>1 - b\<^sub>3\<^sub>1, a\<^sub>3\<^sub>2 - b\<^sub>3\<^sub>2, a\<^sub>3\<^sub>3 - b\<^sub>3\<^sub>3]]
[PROOF STEP]
by (simp add: sq_mtx_eq_iff)


[STATEMENT]
lemma local_lipschitz_therm_dyn:
  assumes "0 < (a::real)"
  shows "local_lipschitz UNIV UNIV (\<lambda>t::real. f a L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local_lipschitz UNIV UNIV (\<lambda>t. f a L)
[PROOF STEP]
apply(unfold local_lipschitz_def lipschitz_on_def dist_norm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. \<forall>t\<in>UNIV. \<exists>u>0. \<exists>La. \<forall>t\<in>cball t u \<inter> UNIV. 0 \<le> La \<and> (\<forall>xa\<in>cball x u \<inter> UNIV. \<forall>y\<in>cball x u \<inter> UNIV. \<parallel>f a L xa - f a L y\<parallel> \<le> La \<cdot> \<parallel>xa - y\<parallel>)
[PROOF STEP]
apply(clarsimp, rule_tac x=1 in exI, clarsimp, rule_tac x=a in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t ta. dist t ta \<le> 1 \<Longrightarrow> 0 \<le> a \<and> (\<forall>xa\<in>cball x 1. \<forall>y\<in>cball x 1. \<parallel>f a L xa - f a L y\<parallel> \<le> a \<cdot> \<parallel>xa - y\<parallel>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. \<And>x t ta. dist t ta \<le> 1 \<Longrightarrow> 0 \<le> a \<and> (\<forall>xa\<in>cball x 1. \<forall>y\<in>cball x 1. \<parallel>f a L xa - f a L y\<parallel> \<le> a \<cdot> \<parallel>xa - y\<parallel>)
[PROOF STEP]
apply(simp_all add: norm_diff_therm_dyn)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t ta. \<lbrakk>dist t ta \<le> 1; 0 < a\<rbrakk> \<Longrightarrow> \<forall>xa\<in>cball x 1. \<forall>y\<in>cball x 1. \<bar>xa $ 1 - y $ 1\<bar> \<le> \<parallel>xa - y\<parallel>
[PROOF STEP]
apply(simp add: norm_vec_def L2_set_def, unfold UNIV_4, clarsimp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t ta xa y. \<lbrakk>dist t ta \<le> 1; 0 < a; dist x xa \<le> 1; dist x y \<le> 1\<rbrakk> \<Longrightarrow> \<bar>xa $ 1 - y $ 1\<bar> \<le> sqrt ((xa $ 1 - y $ 1)\<^sup>2 + ((xa $ 2 - y $ 2)\<^sup>2 + ((xa $ 3 - y $ 3)\<^sup>2 + (xa $ 4 - y $ 4)\<^sup>2)))
[PROOF STEP]
unfolding real_sqrt_abs[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x t ta xa y. \<lbrakk>dist t ta \<le> 1; 0 < a; dist x xa \<le> 1; dist x y \<le> 1\<rbrakk> \<Longrightarrow> sqrt ((xa $ 1 - y $ 1)\<^sup>2) \<le> sqrt ((xa $ 1 - y $ 1)\<^sup>2 + ((xa $ 2 - y $ 2)\<^sup>2 + ((xa $ 3 - y $ 3)\<^sup>2 + (xa $ 4 - y $ 4)\<^sup>2)))
[PROOF STEP]
by (rule real_le_lsqrt) auto


[STATEMENT]
theorem integral_has_vector_derivative':
  fixes f :: "real \<Rightarrow> 'b::banach"
  assumes "continuous_on {a..b} f"
    and "x \<in> {a..b}"
  shows "((\<lambda>u. integral {u..b} f) has_vector_derivative - f x) (at x within {a..b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>u. integral {u..b} f) has_vector_derivative - f x) (at x within {a..b})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>u. integral {u..b} f) has_vector_derivative - f x) (at x within {a..b})
[PROOF STEP]
have *: "integral {x..b} f = integral {a .. b} f - integral {a .. x} f" if "a \<le> x" "x \<le> b" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {x..b} f = integral {a..b} f - integral {a..x} f
[PROOF STEP]
using integral_combine[of a x b for x, OF that integrable_continuous_real[OF assms(1)]]
[PROOF STATE]
proof (prove)
using this:
integral {a..x} f + integral {x..b} f = integral {a..b} f

goal (1 subgoal):
 1. integral {x..b} f = integral {a..b} f - integral {a..x} f
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
\<lbrakk>a \<le> ?x; ?x \<le> b\<rbrakk> \<Longrightarrow> integral {?x..b} f = integral {a..b} f - integral {a..?x} f

goal (1 subgoal):
 1. ((\<lambda>u. integral {u..b} f) has_vector_derivative - f x) (at x within {a..b})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>u. integral {u..b} f) has_vector_derivative - f x) (at x within {a..b})
[PROOF STEP]
using \<open>x \<in> _\<close> *
[PROOF STATE]
proof (prove)
using this:
x \<in> {a..b}
\<lbrakk>a \<le> ?x; ?x \<le> b\<rbrakk> \<Longrightarrow> integral {?x..b} f = integral {a..b} f - integral {a..?x} f

goal (1 subgoal):
 1. ((\<lambda>u. integral {u..b} f) has_vector_derivative - f x) (at x within {a..b})
[PROOF STEP]
by (rule has_vector_derivative_transform)
      (auto intro!: derivative_eq_intros assms integral_has_vector_derivative)
[PROOF STATE]
proof (state)
this:
((\<lambda>u. integral {u..b} f) has_vector_derivative - f x) (at x within {a..b})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ID_cEnum:
  "ID cEnum = Some (enum, enum_all, enum_ex)
  \<Longrightarrow> UNIV = set enum \<and> enum_all = Ball UNIV \<and> enum_ex = Bex UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ID cEnum = Some (enum, enum_all, enum_ex) \<Longrightarrow> UNIV = set enum \<and> enum_all = Ball UNIV \<and> enum_ex = Bex UNIV
[PROOF STEP]
unfolding ID_def id_apply fun_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cEnum = Some (enum, enum_all, enum_ex) \<Longrightarrow> UNIV = set enum \<and> (\<forall>x. enum_all x = Ball UNIV x) \<and> (\<forall>x. enum_ex x = Bex UNIV x)
[PROOF STEP]
by(intro conjI allI UNIV_cenum cenum_all_UNIV cenum_ex_UNIV fun_eq_iff)


[STATEMENT]
lemma closure_approachable_le:
  fixes S :: "'a::metric_space set"
  shows "x \<in> closure S \<longleftrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x \<le> e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> closure S) = (\<forall>e>0. \<exists>y\<in>S. dist y x \<le> e)
[PROOF STEP]
unfolding closure_approachable
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<exists>y\<in>S. dist y x < e) = (\<forall>e>0. \<exists>y\<in>S. dist y x \<le> e)
[PROOF STEP]
using dense
[PROOF STATE]
proof (prove)
using this:
?x < ?y \<Longrightarrow> \<exists>z>?x. z < ?y

goal (1 subgoal):
 1. (\<forall>e>0. \<exists>y\<in>S. dist y x < e) = (\<forall>e>0. \<exists>y\<in>S. dist y x \<le> e)
[PROOF STEP]
by force


[STATEMENT]
lemma Carmichael_prod_coprime:
  assumes "finite A" "\<And>i j. i \<in> A \<Longrightarrow> j \<in> A \<Longrightarrow> i \<noteq> j \<Longrightarrow> coprime (f i) (f j)"
  shows   "Carmichael (\<Prod>i\<in>A. f i) = (LCM i\<in>A. Carmichael (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael (prod f A) = (LCM i\<in>A. Carmichael (f i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
\<lbrakk>?i \<in> A; ?j \<in> A; ?i \<noteq> ?j\<rbrakk> \<Longrightarrow> coprime (f ?i) (f ?j)

goal (1 subgoal):
 1. Carmichael (prod f A) = (LCM i\<in>A. Carmichael (f i))
[PROOF STEP]
by (induction A rule: finite_induct)
                 (simp, simp, subst Carmichael_mult_coprime[OF prod_coprime_right], auto)


[STATEMENT]
lemma nth_prime_numeral:
  "nth_prime (numeral n) = smallest_prime_beyond (Suc (nth_prime (pred_numeral n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_prime (numeral n) = smallest_prime_beyond (Suc (nth_prime (pred_numeral n)))
[PROOF STEP]
by (subst nth_prime_Suc[symmetric]) auto


[STATEMENT]
lemma convex_comb_dets:
  assumes "det3 p q r > 0"
  shows "s = (det3 s q r / det3 p q r) *\<^sub>R p + (det3 p s r /  det3 p q r) *\<^sub>R q +
      (det3 p q s / det3 p q r) *\<^sub>R r"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s = (det3 s q r / det3 p q r) *\<^sub>R p + (det3 p s r / det3 p q r) *\<^sub>R q + (det3 p q s / det3 p q r) *\<^sub>R r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. s = (det3 s q r / det3 p q r) *\<^sub>R p + (det3 p s r / det3 p q r) *\<^sub>R q + (det3 p q s / det3 p q r) *\<^sub>R r
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < det3 p q r
[PROOF STEP]
have "det3 p q r *\<^sub>R ?lhs = det3 p q r *\<^sub>R ?rhs"
[PROOF STATE]
proof (prove)
using this:
0 < det3 p q r

goal (1 subgoal):
 1. det3 p q r *\<^sub>R s = det3 p q r *\<^sub>R ((det3 s q r / det3 p q r) *\<^sub>R p + (det3 p s r / det3 p q r) *\<^sub>R q + (det3 p q s / det3 p q r) *\<^sub>R r)
[PROOF STEP]
by (simp add: field_simps prod_eq_iff scaleR_add_right) (simp add: algebra_simps det3_def')
[PROOF STATE]
proof (state)
this:
det3 p q r *\<^sub>R s = det3 p q r *\<^sub>R ((det3 s q r / det3 p q r) *\<^sub>R p + (det3 p s r / det3 p q r) *\<^sub>R q + (det3 p q s / det3 p q r) *\<^sub>R r)

goal (1 subgoal):
 1. s = (det3 s q r / det3 p q r) *\<^sub>R p + (det3 p s r / det3 p q r) *\<^sub>R q + (det3 p q s / det3 p q r) *\<^sub>R r
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
det3 p q r *\<^sub>R s = det3 p q r *\<^sub>R ((det3 s q r / det3 p q r) *\<^sub>R p + (det3 p s r / det3 p q r) *\<^sub>R q + (det3 p q s / det3 p q r) *\<^sub>R r)

goal (1 subgoal):
 1. s = (det3 s q r / det3 p q r) *\<^sub>R p + (det3 p s r / det3 p q r) *\<^sub>R q + (det3 p q s / det3 p q r) *\<^sub>R r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
det3 p q r *\<^sub>R s = det3 p q r *\<^sub>R ((det3 s q r / det3 p q r) *\<^sub>R p + (det3 p s r / det3 p q r) *\<^sub>R q + (det3 p q s / det3 p q r) *\<^sub>R r)
0 < det3 p q r

goal (1 subgoal):
 1. s = (det3 s q r / det3 p q r) *\<^sub>R p + (det3 p s r / det3 p q r) *\<^sub>R q + (det3 p q s / det3 p q r) *\<^sub>R r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
s = (det3 s q r / det3 p q r) *\<^sub>R p + (det3 p s r / det3 p q r) *\<^sub>R q + (det3 p q s / det3 p q r) *\<^sub>R r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma upper_asymptotic_density_zero_lim:
  assumes "upper_asymptotic_density A = 0"
  shows "(\<lambda>n. card(A \<inter> {..<n})/n) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. real (card (A \<inter> {..<n})) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
apply (rule lower_asymptotic_density_eq_upper)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. lower_asymptotic_density A = 0
 2. upper_asymptotic_density A = 0
[PROOF STEP]
using assms lower_asymptotic_density_le_upper[of A] lower_asymptotic_density_in_01(3)[of A]
[PROOF STATE]
proof (prove)
using this:
upper_asymptotic_density A = 0
lower_asymptotic_density A \<le> upper_asymptotic_density A
0 \<le> lower_asymptotic_density A

goal (2 subgoals):
 1. lower_asymptotic_density A = 0
 2. upper_asymptotic_density A = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_left_invertible_span_rows_gen:
  "(\<exists>(B::'a^'m^'n). B ** (A::'a::field^'n^'m) = mat 1) \<longleftrightarrow> vec.span (rows A) = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>B. B ** A = mat (1::'a)) = (vec.span (rows A) = UNIV)
[PROOF STEP]
unfolding right_invertible_transpose[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>B. Finite_Cartesian_Product.transpose A ** B = mat (1::'a)) = (vec.span (rows A) = UNIV)
[PROOF STEP]
unfolding columns_transpose[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>B. Finite_Cartesian_Product.transpose A ** B = mat (1::'a)) = (vec.span (columns (Finite_Cartesian_Product.transpose A)) = UNIV)
[PROOF STEP]
unfolding matrix_right_invertible_span_columns
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vec.span (columns (Finite_Cartesian_Product.transpose A)) = UNIV) = (vec.span (columns (Finite_Cartesian_Product.transpose A)) = UNIV)
[PROOF STEP]
..


[STATEMENT]
lemma uminus_Inf: "- (\<Sqinter>A) = \<Squnion>(uminus ` A)" for A :: \<open>'a::complete_orthocomplemented_lattice set\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<Sqinter> A = \<Squnion> (uminus ` A)
[PROOF STEP]
proof (rule order.antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. - \<Sqinter> A \<le> \<Squnion> (uminus ` A)
 2. \<Squnion> (uminus ` A) \<le> - \<Sqinter> A
[PROOF STEP]
show "- \<Sqinter>A \<le> \<Squnion>(uminus ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<Sqinter> A \<le> \<Squnion> (uminus ` A)
[PROOF STEP]
by (rule compl_le_swap2, rule Inf_greatest, rule compl_le_swap2, rule Sup_upper) simp
[PROOF STATE]
proof (state)
this:
- \<Sqinter> A \<le> \<Squnion> (uminus ` A)

goal (1 subgoal):
 1. \<Squnion> (uminus ` A) \<le> - \<Sqinter> A
[PROOF STEP]
show "\<Squnion>(uminus ` A) \<le> - \<Sqinter>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> (uminus ` A) \<le> - \<Sqinter> A
[PROOF STEP]
by (rule Sup_least, rule compl_le_swap1, rule Inf_lower) auto
[PROOF STATE]
proof (state)
this:
\<Squnion> (uminus ` A) \<le> - \<Sqinter> A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sqrt_sum_squares_le_sum:
  "\<lbrakk>0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> sqrt (x\<^sup>2 + y\<^sup>2) \<le> x + y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> sqrt (x\<^sup>2 + y\<^sup>2) \<le> x + y
[PROOF STEP]
by (rule power2_le_imp_le) (simp_all add: power2_sum)


[STATEMENT]
lemma ceiling_zero [simp]: "\<lceil>0\<rceil> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>0::'a\<rceil> = 0
[PROOF STEP]
using ceiling_of_int [of 0]
[PROOF STATE]
proof (prove)
using this:
\<lceil>of_int 0\<rceil> = 0

goal (1 subgoal):
 1. \<lceil>0::'a\<rceil> = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma lagrange_exists:
  assumes d: "distinct (map fst zs_ws)"
  defines e: "(p :: complex poly) \<equiv> lagrange_interpolation_poly zs_ws"
  shows "degree p \<le> (length zs_ws)-1"
        "(\<forall>x y. (x,y) \<in> set zs_ws \<longrightarrow> poly p x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree p \<le> length zs_ws - 1 &&& \<forall>x y. (x, y) \<in> set zs_ws \<longrightarrow> poly p x = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree p \<le> length zs_ws - 1
 2. \<forall>x y. (x, y) \<in> set zs_ws \<longrightarrow> poly p x = y
[PROOF STEP]
from e
[PROOF STATE]
proof (chain)
picking this:
p \<equiv> lagrange_interpolation_poly zs_ws
[PROOF STEP]
show "degree p \<le> (length zs_ws - 1)"
[PROOF STATE]
proof (prove)
using this:
p \<equiv> lagrange_interpolation_poly zs_ws

goal (1 subgoal):
 1. degree p \<le> length zs_ws - 1
[PROOF STEP]
using degree_lagrange_interpolation_poly
[PROOF STATE]
proof (prove)
using this:
p \<equiv> lagrange_interpolation_poly zs_ws
degree (lagrange_interpolation_poly ?xs_ys) \<le> length ?xs_ys - 1

goal (1 subgoal):
 1. degree p \<le> length zs_ws - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree p \<le> length zs_ws - 1

goal (1 subgoal):
 1. \<forall>x y. (x, y) \<in> set zs_ws \<longrightarrow> poly p x = y
[PROOF STEP]
from e d
[PROOF STATE]
proof (chain)
picking this:
p \<equiv> lagrange_interpolation_poly zs_ws
distinct (map fst zs_ws)
[PROOF STEP]
have
    "poly p x = y" if "(x,y) \<in> set zs_ws" for x y
[PROOF STATE]
proof (prove)
using this:
p \<equiv> lagrange_interpolation_poly zs_ws
distinct (map fst zs_ws)

goal (1 subgoal):
 1. poly p x = y
[PROOF STEP]
using that lagrange_interpolation_poly
[PROOF STATE]
proof (prove)
using this:
p \<equiv> lagrange_interpolation_poly zs_ws
distinct (map fst zs_ws)
(x, y) \<in> set zs_ws
\<lbrakk>distinct (map fst ?xs_ys); ?p = lagrange_interpolation_poly ?xs_ys; (?x, ?y) \<in> set ?xs_ys\<rbrakk> \<Longrightarrow> poly ?p ?x = ?y

goal (1 subgoal):
 1. poly p x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(?x, ?y) \<in> set zs_ws \<Longrightarrow> poly p ?x = ?y

goal (1 subgoal):
 1. \<forall>x y. (x, y) \<in> set zs_ws \<longrightarrow> poly p x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(?x, ?y) \<in> set zs_ws \<Longrightarrow> poly p ?x = ?y
[PROOF STEP]
show "(\<forall>x y. (x,y) \<in> set zs_ws \<longrightarrow> poly p x = y)"
[PROOF STATE]
proof (prove)
using this:
(?x, ?y) \<in> set zs_ws \<Longrightarrow> poly p ?x = ?y

goal (1 subgoal):
 1. \<forall>x y. (x, y) \<in> set zs_ws \<longrightarrow> poly p x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x y. (x, y) \<in> set zs_ws \<longrightarrow> poly p x = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bin_lcs_rev: "bin_lcs x y = rev (bin_lcp (rev x) (rev y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_lcs x y = rev (bin_lcp (rev x) (rev y))
[PROOF STEP]
unfolding bin_lcp_def bin_lcs_def  longest_common_suffix_def rev_append
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev (rev y \<cdot> rev x \<and>\<^sub>p rev x \<cdot> rev y) = rev (rev x \<cdot> rev y \<and>\<^sub>p rev y \<cdot> rev x)
[PROOF STEP]
using lcp_sym
[PROOF STATE]
proof (prove)
using this:
?u \<and>\<^sub>p ?v = ?v \<and>\<^sub>p ?u

goal (1 subgoal):
 1. rev (rev y \<cdot> rev x \<and>\<^sub>p rev x \<cdot> rev y) = rev (rev x \<cdot> rev y \<and>\<^sub>p rev y \<cdot> rev x)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma legendre_aux_set_eq:
  assumes "prime p" "x \<ge> 1"
  shows   "{m. m > 0 \<and> real (p ^ m) \<le> x} = {0<..nat \<lfloor>log (real p) x\<rfloor>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {m. 0 < m \<and> real (p ^ m) \<le> x} = {0<..nat \<lfloor>log (real p) x\<rfloor>}
[PROOF STEP]
using prime_gt_1_nat[OF assms(1)] assms
[PROOF STATE]
proof (prove)
using this:
1 < p
prime p
1 \<le> x

goal (1 subgoal):
 1. {m. 0 < m \<and> real (p ^ m) \<le> x} = {0<..nat \<lfloor>log (real p) x\<rfloor>}
[PROOF STEP]
by (auto simp: le_nat_iff le_log_iff le_floor_iff powr_realpow)


[STATEMENT]
lemma coeff_linear_poly_power:
  fixes c :: "'a :: semiring_1"
  assumes "i \<le> n"
  shows   "coeff ([:a, b:] ^ n) i = of_nat (n choose i) * b ^ i * a ^ (n - i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff ([:a, b:] ^ n) i = of_nat (n choose i) * b ^ i * a ^ (n - i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeff ([:a, b:] ^ n) i = of_nat (n choose i) * b ^ i * a ^ (n - i)
[PROOF STEP]
have "[:a, b:] = monom b 1 + [:a:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:a, b:] = monom b 1 + [:a:]
[PROOF STEP]
by (simp add: monom_altdef)
[PROOF STATE]
proof (state)
this:
[:a, b:] = monom b 1 + [:a:]

goal (1 subgoal):
 1. coeff ([:a, b:] ^ n) i = of_nat (n choose i) * b ^ i * a ^ (n - i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[:a, b:] = monom b 1 + [:a:]

goal (1 subgoal):
 1. coeff ([:a, b:] ^ n) i = of_nat (n choose i) * b ^ i * a ^ (n - i)
[PROOF STEP]
have "coeff (\<dots> ^ n) i = (\<Sum>k\<le>n. a^(n-k) * of_nat (n choose k) * (if k = i then b ^ k else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff ((monom b 1 + [:a:]) ^ n) i = (\<Sum>k\<le>n. a ^ (n - k) * of_nat (n choose k) * (if k = i then b ^ k else (0::'b)))
[PROOF STEP]
by (subst binomial_ring) (simp add: coeff_sum of_nat_poly monom_power poly_const_pow mult_ac)
[PROOF STATE]
proof (state)
this:
coeff ((monom b 1 + [:a:]) ^ n) i = (\<Sum>k\<le>n. a ^ (n - k) * of_nat (n choose k) * (if k = i then b ^ k else (0::'b)))

goal (1 subgoal):
 1. coeff ([:a, b:] ^ n) i = of_nat (n choose i) * b ^ i * a ^ (n - i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coeff ((monom b 1 + [:a:]) ^ n) i = (\<Sum>k\<le>n. a ^ (n - k) * of_nat (n choose k) * (if k = i then b ^ k else (0::'b)))

goal (1 subgoal):
 1. coeff ([:a, b:] ^ n) i = of_nat (n choose i) * b ^ i * a ^ (n - i)
[PROOF STEP]
have "\<dots> = (\<Sum>k\<in>{i}. a ^ (n - i) * b ^ i * of_nat (n choose k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. a ^ (n - k) * of_nat (n choose k) * (if k = i then b ^ k else (0::'b))) = (\<Sum>k\<in>{i}. a ^ (n - i) * b ^ i * of_nat (n choose k))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<le> n

goal (1 subgoal):
 1. (\<Sum>k\<le>n. a ^ (n - k) * of_nat (n choose k) * (if k = i then b ^ k else (0::'b))) = (\<Sum>k\<in>{i}. a ^ (n - i) * b ^ i * of_nat (n choose k))
[PROOF STEP]
by (intro sum.mono_neutral_cong_right) (auto simp: mult_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. a ^ (n - k) * of_nat (n choose k) * (if k = i then b ^ k else (0::'b))) = (\<Sum>k\<in>{i}. a ^ (n - i) * b ^ i * of_nat (n choose k))

goal (1 subgoal):
 1. coeff ([:a, b:] ^ n) i = of_nat (n choose i) * b ^ i * a ^ (n - i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
coeff ([:a, b:] ^ n) i = (\<Sum>k\<in>{i}. a ^ (n - i) * b ^ i * of_nat (n choose k))
[PROOF STEP]
show *: ?thesis
[PROOF STATE]
proof (prove)
using this:
coeff ([:a, b:] ^ n) i = (\<Sum>k\<in>{i}. a ^ (n - i) * b ^ i * of_nat (n choose k))

goal (1 subgoal):
 1. coeff ([:a, b:] ^ n) i = of_nat (n choose i) * b ^ i * a ^ (n - i)
[PROOF STEP]
by (simp add: mult_ac)
[PROOF STATE]
proof (state)
this:
coeff ([:a, b:] ^ n) i = of_nat (n choose i) * b ^ i * a ^ (n - i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma divisor_count_squarefree:
  assumes "squarefree n" "n > 0"
  shows   "divisor_count n = 2 ^ primes_omega n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_count n = 2 ^ primes_omega n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. divisor_count n = 2 ^ primes_omega n
[PROOF STEP]
have "divisor_count n = (\<Prod>p\<in>prime_factors n. Suc (multiplicity p n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_count n = (\<Prod>p\<in>prime_factors n. Suc (multiplicity p n))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
squarefree n
0 < n

goal (1 subgoal):
 1. divisor_count n = (\<Prod>p\<in>prime_factors n. Suc (multiplicity p n))
[PROOF STEP]
by (subst divisor_count.prod_prime_factors') auto
[PROOF STATE]
proof (state)
this:
divisor_count n = (\<Prod>p\<in>prime_factors n. Suc (multiplicity p n))

goal (1 subgoal):
 1. divisor_count n = 2 ^ primes_omega n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
divisor_count n = (\<Prod>p\<in>prime_factors n. Suc (multiplicity p n))

goal (1 subgoal):
 1. divisor_count n = 2 ^ primes_omega n
[PROOF STEP]
have "\<dots> = (\<Prod>p\<in>prime_factors n. 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors n. Suc (multiplicity p n)) = (\<Prod>p\<in>prime_factors n. 2)
[PROOF STEP]
using assms assms
[PROOF STATE]
proof (prove)
using this:
squarefree n
0 < n
squarefree n
0 < n

goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors n. Suc (multiplicity p n)) = (\<Prod>p\<in>prime_factors n. 2)
[PROOF STEP]
by (intro prod.cong) (auto simp: squarefree_factorial_semiring')
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. Suc (multiplicity p n)) = (\<Prod>p\<in>prime_factors n. 2)

goal (1 subgoal):
 1. divisor_count n = 2 ^ primes_omega n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
divisor_count n = (\<Prod>p\<in>prime_factors n. 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
divisor_count n = (\<Prod>p\<in>prime_factors n. 2)

goal (1 subgoal):
 1. divisor_count n = 2 ^ primes_omega n
[PROOF STEP]
by (simp add: primes_omega_def)
[PROOF STATE]
proof (state)
this:
divisor_count n = 2 ^ primes_omega n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complex_div_gt_0: "(Re (a / b) > 0 \<longleftrightarrow> Re (a * cnj b) > 0) \<and> (Im (a / b) > 0 \<longleftrightarrow> Im (a * cnj b) > 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))
[PROOF STEP]
proof (cases "b = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b = 0 \<Longrightarrow> (0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))
 2. b \<noteq> 0 \<Longrightarrow> (0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
b = 0

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> (0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))
 2. b \<noteq> 0 \<Longrightarrow> (0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b = 0

goal (1 subgoal):
 1. (0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> (0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> (0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
b \<noteq> 0

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> (0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> 0
[PROOF STEP]
have "0 < (Re b)\<^sup>2 + (Im b)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> 0

goal (1 subgoal):
 1. 0 < (Re b)\<^sup>2 + (Im b)\<^sup>2
[PROOF STEP]
by (simp add: complex_eq_iff sum_power2_gt_zero_iff)
[PROOF STATE]
proof (state)
this:
0 < (Re b)\<^sup>2 + (Im b)\<^sup>2

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> (0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < (Re b)\<^sup>2 + (Im b)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < (Re b)\<^sup>2 + (Im b)\<^sup>2

goal (1 subgoal):
 1. (0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))
[PROOF STEP]
by (simp add: Re_divide Im_divide zero_less_divide_iff)
[PROOF STATE]
proof (state)
this:
(0 < Re (a / b)) = (0 < Re (a * cnj b)) \<and> (0 < Im (a / b)) = (0 < Im (a * cnj b))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma suminf_half_series_ereal: "(\<Sum>n. (1/2 :: ereal) ^ Suc n) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. (1 / 2) ^ Suc n) = 1
[PROOF STEP]
using sums_ereal[THEN iffD2, OF power_half_series, THEN sums_unique, symmetric]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x. ereal ((1 / 2) ^ Suc x)) = ereal 1

goal (1 subgoal):
 1. (\<Sum>n. (1 / 2) ^ Suc n) = 1
[PROOF STEP]
by (simp add: one_ereal_def)


[STATEMENT]
lemma odd_half_floor:
assumes "odd x"
shows "\<lfloor>real_of_int x / 2\<rfloor> = (x-1) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>real_of_int x / 2\<rfloor> = (x - 1) div 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
odd x

goal (1 subgoal):
 1. \<lfloor>real_of_int x / 2\<rfloor> = (x - 1) div 2
[PROOF STEP]
by (metis add.commute diff_add_cancel even_add
 even_succ_div_2 floor_divide_of_int_eq odd_one of_int_numeral)