[STATEMENT]
lemma EM_remainder'_integral_conv_Suc:
  shows   "integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) =
              (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f b - f a) -
              integral {a..b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
unfolding EM_remainder'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
let ?h = "\<lambda>i. (pbernpoly (Suc n) (real_of_int i) / real (Suc n)) *\<^sub>R f (real_of_int i)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
define T where "T = integral {a..b} (\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t)"
[PROOF STATE]
proof (state)
this:
T = integral {real_of_int a..real_of_int b} (\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t)

goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
note [derivative_intros] = has_field_derivative_pbernpoly_Suc'
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?f has_real_derivative ?D) (at ?x within ?s); 2 \<le> ?n \<or> ?f ?x \<notin> \<int>\<rbrakk> \<Longrightarrow> ((\<lambda>x. pbernpoly (Suc ?n) (?f x)) has_real_derivative real (Suc ?n) * pbernpoly ?n (?f ?x) * ?D) (at ?x within ?s)

goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
let ?A = "real_of_int ` {a..b} \<union> A"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
have "((\<lambda>t. pbernpoly n t *\<^sub>R f t) has_integral (-T + (?h b - ?h a))) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. pbernpoly n t *\<^sub>R f t) has_integral - T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a))) {real_of_int a..real_of_int b}
[PROOF STEP]
proof (rule integration_by_parts_interior_strong[OF bounded_bilinear_scaleR])
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. finite ?s
 2. real_of_int a \<le> real_of_int b
 3. continuous_on {real_of_int a..real_of_int b} ?f
 4. continuous_on {real_of_int a..real_of_int b} f
 5. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - ?s \<Longrightarrow> (?f has_vector_derivative pbernpoly n t) (at t)
 6. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - ?s \<Longrightarrow> (f has_vector_derivative ?g' t) (at t)
 7. ((\<lambda>t. ?f t *\<^sub>R ?g' t) has_integral ?f (real_of_int b) *\<^sub>R f (real_of_int b) - ?f (real_of_int a) *\<^sub>R f (real_of_int a) - (- T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a)))) {real_of_int a..real_of_int b}
[PROOF STEP]
from fin
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
show "finite ?A"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. finite (real_of_int ` {a..b} \<union> A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (real_of_int ` {a..b} \<union> A)

goal (6 subgoals):
 1. real_of_int a \<le> real_of_int b
 2. continuous_on {real_of_int a..real_of_int b} ?f
 3. continuous_on {real_of_int a..real_of_int b} f
 4. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> (?f has_vector_derivative pbernpoly n t) (at t)
 5. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> (f has_vector_derivative ?g' t) (at t)
 6. ((\<lambda>t. ?f t *\<^sub>R ?g' t) has_integral ?f (real_of_int b) *\<^sub>R f (real_of_int b) - ?f (real_of_int a) *\<^sub>R f (real_of_int a) - (- T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a)))) {real_of_int a..real_of_int b}
[PROOF STEP]
from \<open>n > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
show "continuous_on {of_int a..of_int b} (\<lambda>t. pbernpoly (Suc n) t / real (Suc n))"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. continuous_on {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t / real (Suc n))
[PROOF STEP]
by (intro continuous_intros) auto
[PROOF STATE]
proof (state)
this:
continuous_on {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t / real (Suc n))

goal (5 subgoals):
 1. real_of_int a \<le> real_of_int b
 2. continuous_on {real_of_int a..real_of_int b} f
 3. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> ((\<lambda>t. pbernpoly (Suc n) t / real (Suc n)) has_vector_derivative pbernpoly n t) (at t)
 4. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> (f has_vector_derivative ?g' t) (at t)
 5. ((\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R ?g' t) has_integral (pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) - (- T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a)))) {real_of_int a..real_of_int b}
[PROOF STEP]
show "continuous_on {of_int a..of_int b} f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {real_of_int a..real_of_int b} f
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
continuous_on {real_of_int a..real_of_int b} f

goal (4 subgoals):
 1. real_of_int a \<le> real_of_int b
 2. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> ((\<lambda>t. pbernpoly (Suc n) t / real (Suc n)) has_vector_derivative pbernpoly n t) (at t)
 3. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> (f has_vector_derivative ?g' t) (at t)
 4. ((\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R ?g' t) has_integral (pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) - (- T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a)))) {real_of_int a..real_of_int b}
[PROOF STEP]
show "(f has_vector_derivative f' t) (at t)" if "t \<in> {of_int a<..<of_int b} - ?A" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_vector_derivative f' t) (at t)
[PROOF STEP]
using deriv[of t] that
[PROOF STATE]
proof (prove)
using this:
t \<in> {real_of_int a<..<real_of_int b} - A \<Longrightarrow> (f has_vector_derivative f' t) (at t)
t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A)

goal (1 subgoal):
 1. (f has_vector_derivative f' t) (at t)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> (f has_vector_derivative f' ?t) (at ?t)

goal (3 subgoals):
 1. real_of_int a \<le> real_of_int b
 2. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> ((\<lambda>t. pbernpoly (Suc n) t / real (Suc n)) has_vector_derivative pbernpoly n t) (at t)
 3. ((\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t) has_integral (pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) - (- T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a)))) {real_of_int a..real_of_int b}
[PROOF STEP]
have "(\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) integrable_on {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) integrable_on {real_of_int a..real_of_int b}
[PROOF STEP]
by (intro integrable_EM_remainder' cont')
[PROOF STATE]
proof (state)
this:
(\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) integrable_on {real_of_int a..real_of_int b}

goal (3 subgoals):
 1. real_of_int a \<le> real_of_int b
 2. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> ((\<lambda>t. pbernpoly (Suc n) t / real (Suc n)) has_vector_derivative pbernpoly n t) (at t)
 3. ((\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t) has_integral (pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) - (- T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a)))) {real_of_int a..real_of_int b}
[PROOF STEP]
hence "(\<lambda>t. (1 / real (Suc n)) *\<^sub>R pbernpoly (Suc n) t *\<^sub>R f' t) integrable_on {a..b}"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) integrable_on {real_of_int a..real_of_int b}

goal (1 subgoal):
 1. (\<lambda>t. (1 / real (Suc n)) *\<^sub>R pbernpoly (Suc n) t *\<^sub>R f' t) integrable_on {real_of_int a..real_of_int b}
[PROOF STEP]
by (rule integrable_cmul)
[PROOF STATE]
proof (state)
this:
(\<lambda>t. (1 / real (Suc n)) *\<^sub>R pbernpoly (Suc n) t *\<^sub>R f' t) integrable_on {real_of_int a..real_of_int b}

goal (3 subgoals):
 1. real_of_int a \<le> real_of_int b
 2. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> ((\<lambda>t. pbernpoly (Suc n) t / real (Suc n)) has_vector_derivative pbernpoly n t) (at t)
 3. ((\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t) has_integral (pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) - (- T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a)))) {real_of_int a..real_of_int b}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>t. (1 / real (Suc n)) *\<^sub>R pbernpoly (Suc n) t *\<^sub>R f' t) integrable_on {real_of_int a..real_of_int b}

goal (3 subgoals):
 1. real_of_int a \<le> real_of_int b
 2. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> ((\<lambda>t. pbernpoly (Suc n) t / real (Suc n)) has_vector_derivative pbernpoly n t) (at t)
 3. ((\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t) has_integral (pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) - (- T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a)))) {real_of_int a..real_of_int b}
[PROOF STEP]
have "(\<lambda>t. (1 / real (Suc n)) *\<^sub>R pbernpoly (Suc n) t *\<^sub>R f' t) =
                 (\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. (1 / real (Suc n)) *\<^sub>R pbernpoly (Suc n) t *\<^sub>R f' t) = (\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t)
[PROOF STEP]
by (rule ext) (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>t. (1 / real (Suc n)) *\<^sub>R pbernpoly (Suc n) t *\<^sub>R f' t) = (\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t)

goal (3 subgoals):
 1. real_of_int a \<le> real_of_int b
 2. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> ((\<lambda>t. pbernpoly (Suc n) t / real (Suc n)) has_vector_derivative pbernpoly n t) (at t)
 3. ((\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t) has_integral (pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) - (- T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a)))) {real_of_int a..real_of_int b}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t) integrable_on {real_of_int a..real_of_int b}
[PROOF STEP]
show "((\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t)
                    has_integral ?h b - ?h a - (- T + (?h b - ?h a))) {a..b}"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t) integrable_on {real_of_int a..real_of_int b}

goal (1 subgoal):
 1. ((\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t) has_integral (pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) - (- T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a)))) {real_of_int a..real_of_int b}
[PROOF STEP]
using integrable_EM_remainder'[of a b f' "Suc n"]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t) integrable_on {real_of_int a..real_of_int b}
continuous_on {real_of_int a..real_of_int b} f' \<Longrightarrow> (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) integrable_on {real_of_int a..real_of_int b}

goal (1 subgoal):
 1. ((\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t) has_integral (pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) - (- T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a)))) {real_of_int a..real_of_int b}
[PROOF STEP]
by (simp add: has_integral_iff T_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. (pbernpoly (Suc n) t / real (Suc n)) *\<^sub>R f' t) has_integral (pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) - (- T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a)))) {real_of_int a..real_of_int b}

goal (2 subgoals):
 1. real_of_int a \<le> real_of_int b
 2. \<And>t. t \<in> {real_of_int a<..<real_of_int b} - (real_of_int ` {a..b} \<union> A) \<Longrightarrow> ((\<lambda>t. pbernpoly (Suc n) t / real (Suc n)) has_vector_derivative pbernpoly n t) (at t)
[PROOF STEP]
qed (insert ab n, auto intro!: derivative_eq_intros
           simp: has_real_derivative_iff_has_vector_derivative [symmetric] not_le elim!: Ints_cases)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. pbernpoly n t *\<^sub>R f t) has_integral - T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a))) {real_of_int a..real_of_int b}

goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>t. pbernpoly n t *\<^sub>R f t) has_integral - T + ((pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a))) {real_of_int a..real_of_int b}

goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
have "?h b - ?h a = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f b - f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a))
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. (pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a))
[PROOF STEP]
by (simp add: algebra_simps bernoulli'_def)
[PROOF STATE]
proof (state)
this:
(pbernpoly (Suc n) (real_of_int b) / real (Suc n)) *\<^sub>R f (real_of_int b) - (pbernpoly (Suc n) (real_of_int a) / real (Suc n)) *\<^sub>R f (real_of_int a) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a))

goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>t. pbernpoly n t *\<^sub>R f t) has_integral - T + (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a))) {real_of_int a..real_of_int b}
[PROOF STEP]
have "integral {a..b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = \<dots> - T"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. pbernpoly n t *\<^sub>R f t) has_integral - T + (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a))) {real_of_int a..real_of_int b}

goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - T
[PROOF STEP]
by (simp add: has_integral_iff)
[PROOF STATE]
proof (state)
this:
integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - T

goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - T

goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
have "T = integral {a..b} (\<lambda>t. (1 / real (Suc n)) *\<^sub>R (pbernpoly (Suc n) t) *\<^sub>R f' t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T = integral {real_of_int a..real_of_int b} (\<lambda>t. (1 / real (Suc n)) *\<^sub>R pbernpoly (Suc n) t *\<^sub>R f' t)
[PROOF STEP]
by (simp add: T_def)
[PROOF STATE]
proof (state)
this:
T = integral {real_of_int a..real_of_int b} (\<lambda>t. (1 / real (Suc n)) *\<^sub>R pbernpoly (Suc n) t *\<^sub>R f' t)

goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
T = integral {real_of_int a..real_of_int b} (\<lambda>t. (1 / real (Suc n)) *\<^sub>R pbernpoly (Suc n) t *\<^sub>R f' t)

goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
have "\<dots> = integral {a..b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. (1 / real (Suc n)) *\<^sub>R pbernpoly (Suc n) t *\<^sub>R f' t) = integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
by (subst integral_cmul) (simp_all add: divide_simps)
[PROOF STATE]
proof (state)
this:
integral {real_of_int a..real_of_int b} (\<lambda>t. (1 / real (Suc n)) *\<^sub>R pbernpoly (Suc n) t *\<^sub>R f' t) = integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)

goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)

goal (1 subgoal):
 1. integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly n t *\<^sub>R f t) = (bernoulli (Suc n) / real (Suc n)) *\<^sub>R (f (real_of_int b) - f (real_of_int a)) - integral {real_of_int a..real_of_int b} (\<lambda>t. pbernpoly (Suc n) t *\<^sub>R f' t) /\<^sub>R real (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma signs_are_cols_R: "\<forall>i < (length signs). col (alt_matrix_A_R signs subsets) i  = vec (length subsets) (\<lambda>j. z_R (subsets ! j) (signs ! i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length signs. col (alt_matrix_A_R signs subsets) i = vec (length subsets) (\<lambda>j. z_R (subsets ! j) (signs ! i))
[PROOF STEP]
unfolding col_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length signs. vec (dim_row (alt_matrix_A_R signs subsets)) (\<lambda>ia. alt_matrix_A_R signs subsets $$ (ia, i)) = vec (length subsets) (\<lambda>j. z_R (subsets ! j) (signs ! i))
[PROOF STEP]
unfolding alt_matrix_A_R_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length signs. vec (dim_row (mat (length subsets) (length signs) (\<lambda>(i, j). z_R (subsets ! i) (signs ! j)))) (\<lambda>ia. mat (length subsets) (length signs) (\<lambda>(i, j). z_R (subsets ! i) (signs ! j)) $$ (ia, i)) = vec (length subsets) (\<lambda>j. z_R (subsets ! j) (signs ! i))
[PROOF STEP]
by auto


[STATEMENT]
lemma mod_2_neq_1_eq_eq_0: "k mod 2 \<noteq> 1 \<longleftrightarrow> k mod 2 = 0"
  for k :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (k mod 2 \<noteq> 1) = (k mod 2 = 0)
[PROOF STEP]
by (fact not_mod_2_eq_1_eq_0)


[STATEMENT]
lemma DERIV_neg_dec_left:
  fixes f :: "real \<Rightarrow> real"
  assumes der: "DERIV f x :> l"
    and l: "l < 0"
  shows "\<exists>d > 0. \<forall>h > 0. h < d \<longrightarrow> f x < f (x - h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>h>0. h < d \<longrightarrow> f x < f (x - h)
[PROOF STEP]
using has_real_derivative_neg_dec_left[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>d>0. \<forall>h>0. x - h \<in> UNIV \<longrightarrow> h < d \<longrightarrow> f x < f (x - h)

goal (1 subgoal):
 1. \<exists>d>0. \<forall>h>0. h < d \<longrightarrow> f x < f (x - h)
[PROOF STEP]
by auto


[STATEMENT]
lemma is_projection_on_rank1:
  fixes t :: \<open>'a::complex_inner\<close>
  shows \<open>is_projection_on (\<lambda>x. ((t \<bullet>\<^sub>C x) / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
proof (cases \<open>t = 0\<close>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t = (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
 2. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
t = (0::'a)

goal (2 subgoals):
 1. t = (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
 2. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
t = (0::'a)

goal (1 subgoal):
 1. is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
by (simp add: is_projection_on_zero)
[PROOF STATE]
proof (state)
this:
is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})

goal (1 subgoal):
 1. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
t \<noteq> (0::'a)

goal (1 subgoal):
 1. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
define P where \<open>P x = ((t \<bullet>\<^sub>C x) / (t \<bullet>\<^sub>C t)) *\<^sub>C t\<close> for x
[PROOF STATE]
proof (state)
this:
P ?x = (t \<bullet>\<^sub>C ?x / (t \<bullet>\<^sub>C t)) *\<^sub>C t

goal (1 subgoal):
 1. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
define t' where \<open>t' = t /\<^sub>C norm t\<close>
[PROOF STATE]
proof (state)
this:
t' = t /\<^sub>C complex_of_real (norm t)

goal (1 subgoal):
 1. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
t \<noteq> (0::'a)
t' = t /\<^sub>C complex_of_real (norm t)
[PROOF STEP]
have \<open>norm t' = 1\<close>
[PROOF STATE]
proof (prove)
using this:
t \<noteq> (0::'a)
t' = t /\<^sub>C complex_of_real (norm t)

goal (1 subgoal):
 1. norm t' = 1
[PROOF STEP]
by (simp add: norm_inverse)
[PROOF STATE]
proof (state)
this:
norm t' = 1

goal (1 subgoal):
 1. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
have P_def': \<open>P x = cinner t' x *\<^sub>C t'\<close> for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P x = (t' \<bullet>\<^sub>C x) *\<^sub>C t'
[PROOF STEP]
unfolding P_def t'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t = ((t /\<^sub>C complex_of_real (norm t)) \<bullet>\<^sub>C x) *\<^sub>C (t /\<^sub>C complex_of_real (norm t))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<noteq> (0::'a) \<Longrightarrow> t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t) = inverse (complex_of_real (norm t)) * (t \<bullet>\<^sub>C x) * inverse (complex_of_real (norm t))
[PROOF STEP]
by (metis divide_divide_eq_left divide_inverse mult.commute power2_eq_square power2_norm_eq_cinner)
[PROOF STATE]
proof (state)
this:
P ?x = (t' \<bullet>\<^sub>C ?x) *\<^sub>C t'

goal (1 subgoal):
 1. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
have spant': \<open>cspan {t} = cspan {t'}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cspan {t} = cspan {t'}
[PROOF STEP]
by (simp add: False t'_def)
[PROOF STATE]
proof (state)
this:
cspan {t} = cspan {t'}

goal (1 subgoal):
 1. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
have cc: \<open>closed_csubspace (cspan {t})\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_csubspace (cspan {t})
[PROOF STEP]
by (auto intro!: finite_cspan_closed closed_csubspace.intro)
[PROOF STATE]
proof (state)
this:
closed_csubspace (cspan {t})

goal (1 subgoal):
 1. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
have ortho: \<open>h - P h \<in> orthogonal_complement (cspan {t})\<close> for h
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h - P h \<in> orthogonal_complement (cspan {t})
[PROOF STEP]
unfolding orthogonal_complement_def P_def' spant'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h - (t' \<bullet>\<^sub>C h) *\<^sub>C t' \<in> {x |x. \<forall>y\<in>cspan {t'}. is_orthogonal x y}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. y \<in> cspan {t'} \<Longrightarrow> is_orthogonal (h - (t' \<bullet>\<^sub>C h) *\<^sub>C t') y
[PROOF STEP]
by (smt (verit, ccfv_threshold) \<open>norm t' = 1\<close> add_cancel_right_left cinner_add_right cinner_commute' cinner_scaleC_right cnorm_eq_1 complex_vector.span_breakdown_eq complex_vector.span_empty diff_add_cancel mult_cancel_left1 singletonD)
[PROOF STATE]
proof (state)
this:
?h - P ?h \<in> orthogonal_complement (cspan {t})

goal (1 subgoal):
 1. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
have inspan: \<open>P h \<in> cspan {t}\<close> for h
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P h \<in> cspan {t}
[PROOF STEP]
unfolding P_def' spant'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (t' \<bullet>\<^sub>C h) *\<^sub>C t' \<in> cspan {t'}
[PROOF STEP]
by (simp add: complex_vector.span_base complex_vector.span_scale)
[PROOF STATE]
proof (state)
this:
P ?h \<in> cspan {t}

goal (1 subgoal):
 1. t \<noteq> (0::'a) \<Longrightarrow> is_projection_on (\<lambda>x. (t \<bullet>\<^sub>C x / (t \<bullet>\<^sub>C t)) *\<^sub>C t) (cspan {t})
[PROOF STEP]
show \<open>is_projection_on P (cspan {t})\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_projection_on P (cspan {t})
[PROOF STEP]
apply (subst is_projection_on_iff_orthog)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. closed_csubspace (cspan {t})
 2. \<forall>h. h - P h \<in> orthogonal_complement (cspan {t}) \<and> P h \<in> cspan {t}
[PROOF STEP]
using cc ortho inspan
[PROOF STATE]
proof (prove)
using this:
closed_csubspace (cspan {t})
?h - P ?h \<in> orthogonal_complement (cspan {t})
P ?h \<in> cspan {t}

goal (2 subgoals):
 1. closed_csubspace (cspan {t})
 2. \<forall>h. h - P h \<in> orthogonal_complement (cspan {t}) \<and> P h \<in> cspan {t}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_projection_on P (cspan {t})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "min (i::nat) j + max i j = i + j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min i j + max i j = i + j
[PROOF STEP]
by linarith


[STATEMENT]
lemma quad_form_vec_cnj_mat_cnj:
  assumes "hermitean H"
  shows "quad_form (vec_cnj z) (mat_cnj H) = quad_form z H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quad_form (vec_cnj z) (mat_cnj H) = quad_form z H
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hermitean H

goal (1 subgoal):
 1. quad_form (vec_cnj z) (mat_cnj H) = quad_form z H
[PROOF STEP]
using cnj_mult_vv cnj_quad_form hermitean_def vec_cnj_mult_vm
[PROOF STATE]
proof (prove)
using this:
hermitean H
cnj (?v1.0 *\<^sub>v\<^sub>v ?v2.0) = vec_cnj ?v1.0 *\<^sub>v\<^sub>v vec_cnj ?v2.0
cnj (quad_form ?z ?H) = quad_form ?z (mat_adj ?H)
hermitean ?A = (mat_adj ?A = ?A)
vec_cnj (?v *\<^sub>v\<^sub>m ?A) = vec_cnj ?v *\<^sub>v\<^sub>m mat_cnj ?A

goal (1 subgoal):
 1. quad_form (vec_cnj z) (mat_cnj H) = quad_form z H
[PROOF STEP]
by auto


[STATEMENT]
lemma godel_code'_butlast_last_id:
  "xs \<noteq> [] \<Longrightarrow> godel_code' xs (Suc j) =
  godel_code' (butlast xs) (Suc j) * Pi (length xs + j)^(last xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> godel_code' xs (Suc j) = godel_code' (butlast xs) (Suc j) * Pi (length xs + j) ^ last xs
[PROOF STEP]
apply(subgoal_tac "\<exists> ys y. xs = ys @ [y]")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>xs \<noteq> []; \<exists>ys y. xs = ys @ [y]\<rbrakk> \<Longrightarrow> godel_code' xs (Suc j) = godel_code' (butlast xs) (Suc j) * Pi (length xs + j) ^ last xs
 2. xs \<noteq> [] \<Longrightarrow> \<exists>ys y. xs = ys @ [y]
[PROOF STEP]
apply(erule_tac exE, erule_tac exE, simp add:
      godel_code'_butlast_last_id')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> \<exists>ys y. xs = ys @ [y]
[PROOF STEP]
apply(rule_tac x = "butlast xs" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> \<exists>y. xs = butlast xs @ [y]
[PROOF STEP]
apply(rule_tac x = "last xs" in exI, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma gram_schmidt_sub_result:
  assumes "gram_schmidt_sub n us ws = us'"
    and "set ws \<subseteq> carrier_vec n"
    and "set us \<subseteq> carrier_vec n"
    and "distinct (us @ ws)"
    and "~ lin_dep (set (us @ ws))"
    and "corthogonal us"
  shows "set us' \<subseteq> carrier_vec n \<and>
         distinct us' \<and>
         corthogonal us' \<and>
         span (set (us @ ws)) = span (set us') \<and> length us' = length us + length ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
gram_schmidt_sub n us ws = us'
set ws \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct (us @ ws)
lin_indpt (set (us @ ws))
corthogonal us

goal (1 subgoal):
 1. set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws
[PROOF STEP]
proof (induct ws arbitrary: us us')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
case (Cons w ws)
[PROOF STATE]
proof (state)
this:
\<lbrakk>gram_schmidt_sub n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct (?us1 @ ws); lin_indpt (set (?us1 @ ws)); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1) \<and> length ?us'1 = length ?us1 + length ws
gram_schmidt_sub n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct (us @ w # ws)
lin_indpt (set (us @ w # ws))
corthogonal us

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
let ?v = "adjuster n w us"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have wW[simp]: "set (w#ws) \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (w # ws) \<subseteq> carrier_vec n
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct (?us1 @ ws); lin_indpt (set (?us1 @ ws)); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1) \<and> length ?us'1 = length ?us1 + length ws
gram_schmidt_sub n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct (us @ w # ws)
lin_indpt (set (us @ w # ws))
corthogonal us

goal (1 subgoal):
 1. set (w # ws) \<subseteq> carrier_vec n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (w # ws) \<subseteq> carrier_vec n

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
hence W[simp]: "set ws \<subseteq> carrier_vec n"
   and w[simp]: "w : carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
set (w # ws) \<subseteq> carrier_vec n

goal (1 subgoal):
 1. set ws \<subseteq> carrier_vec n &&& w \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set ws \<subseteq> carrier_vec n
w \<in> carrier_vec n

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have U[simp]: "set us \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set us \<subseteq> carrier_vec n
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct (?us1 @ ws); lin_indpt (set (?us1 @ ws)); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1) \<and> length ?us'1 = length ?us1 + length ws
gram_schmidt_sub n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct (us @ w # ws)
lin_indpt (set (us @ w # ws))
corthogonal us

goal (1 subgoal):
 1. set us \<subseteq> carrier_vec n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set us \<subseteq> carrier_vec n

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have UW: "set (us@ws) \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (us @ ws) \<subseteq> carrier_vec n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (us @ ws) \<subseteq> carrier_vec n

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have wU: "set (w#us) \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (w # us) \<subseteq> carrier_vec n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (w # us) \<subseteq> carrier_vec n

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have dist: "distinct (us @ w # ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (us @ w # ws)
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct (?us1 @ ws); lin_indpt (set (?us1 @ ws)); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1) \<and> length ?us'1 = length ?us1 + length ws
gram_schmidt_sub n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct (us @ w # ws)
lin_indpt (set (us @ w # ws))
corthogonal us

goal (1 subgoal):
 1. distinct (us @ w # ws)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct (us @ w # ws)

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
hence dist_U: "distinct us"
    and dist_W: "distinct ws"
    and dist_UW: "distinct (us @ ws)"
    and w_U: "w \<notin> set us"
    and w_W: "w \<notin> set ws"
    and w_UW: "w \<notin> set (us @ ws)"
[PROOF STATE]
proof (prove)
using this:
distinct (us @ w # ws)

goal (1 subgoal):
 1. (distinct us &&& distinct ws &&& distinct (us @ ws)) &&& w \<notin> set us &&& w \<notin> set ws &&& w \<notin> set (us @ ws)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct us
distinct ws
distinct (us @ ws)
w \<notin> set us
w \<notin> set ws
w \<notin> set (us @ ws)

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have ind: "~ lin_dep (set (us @ w # ws))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_indpt (set (us @ w # ws))
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct (?us1 @ ws); lin_indpt (set (?us1 @ ws)); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1) \<and> length ?us'1 = length ?us1 + length ws
gram_schmidt_sub n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct (us @ w # ws)
lin_indpt (set (us @ w # ws))
corthogonal us

goal (1 subgoal):
 1. lin_indpt (set (us @ w # ws))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lin_indpt (set (us @ w # ws))

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have ind_U: "~ lin_dep (set us)"
    and ind_W: "~ lin_dep (set ws)"
    and ind_wU: "~ lin_dep (insert w (set us))"
    and ind_UW: "~ lin_dep (set (us @ ws))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lin_indpt (set us) &&& lin_indpt (set ws)) &&& lin_indpt (insert w (set us)) &&& lin_indpt (set (us @ ws))
[PROOF STEP]
by (subst subset_li_is_li[OF ind];auto)+
[PROOF STATE]
proof (state)
this:
lin_indpt (set us)
lin_indpt (set ws)
lin_indpt (insert w (set us))
lin_indpt (set (us @ ws))

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have corth: "corthogonal us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. corthogonal us
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct (?us1 @ ws); lin_indpt (set (?us1 @ ws)); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1) \<and> length ?us'1 = length ?us1 + length ws
gram_schmidt_sub n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct (us @ w # ws)
lin_indpt (set (us @ w # ws))
corthogonal us

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

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have U'def: "gram_schmidt_sub n ((?v + w)#us) ws = us'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gram_schmidt_sub n ((adjuster n w us + w) # us) ws = us'
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct (?us1 @ ws); lin_indpt (set (?us1 @ ws)); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1) \<and> length ?us'1 = length ?us1 + length ws
gram_schmidt_sub n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct (us @ w # ws)
lin_indpt (set (us @ w # ws))
corthogonal us

goal (1 subgoal):
 1. gram_schmidt_sub n ((adjuster n w us + w) # us) ws = us'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gram_schmidt_sub n ((adjuster n w us + w) # us) ws = us'

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have v: "?v : carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjuster n w us \<in> carrier_vec n
[PROOF STEP]
using dist_U
[PROOF STATE]
proof (prove)
using this:
distinct us

goal (1 subgoal):
 1. adjuster n w us \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us \<in> carrier_vec n

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
hence vw: "?v + w : carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
adjuster n w us \<in> carrier_vec n

goal (1 subgoal):
 1. adjuster n w us + w \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us + w \<in> carrier_vec n

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
hence vwU: "set ((?v + w) # us) \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
adjuster n w us + w \<in> carrier_vec n

goal (1 subgoal):
 1. set ((adjuster n w us + w) # us) \<subseteq> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set ((adjuster n w us + w) # us) \<subseteq> carrier_vec n

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have vsU: "?v : span (set us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjuster n w us \<in> local.span (set us)
[PROOF STEP]
using adjuster_in_span[OF w] dist
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?us \<subseteq> carrier_vec n; distinct ?us\<rbrakk> \<Longrightarrow> adjuster n w ?us \<in> local.span (set ?us)
distinct (us @ w # ws)

goal (1 subgoal):
 1. adjuster n w us \<in> local.span (set us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us \<in> local.span (set us)

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
hence vsUW: "?v : span (set (us @ ws))"
[PROOF STATE]
proof (prove)
using this:
adjuster n w us \<in> local.span (set us)

goal (1 subgoal):
 1. adjuster n w us \<in> local.span (set (us @ ws))
[PROOF STEP]
using span_is_monotone[of "set us" "set (us@ws)"]
[PROOF STATE]
proof (prove)
using this:
adjuster n w us \<in> local.span (set us)
set us \<subseteq> set (us @ ws) \<Longrightarrow> local.span (set us) \<subseteq> local.span (set (us @ ws))

goal (1 subgoal):
 1. adjuster n w us \<in> local.span (set (us @ ws))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us \<in> local.span (set (us @ ws))

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have wsU: "w \<notin> span (set us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<notin> local.span (set us)
[PROOF STEP]
using lin_dep_iff_in_span[OF U ind_U w w_U] ind_wU
[PROOF STATE]
proof (prove)
using this:
(w \<in> local.span (set us)) = lin_dep (set us \<union> {w})
lin_indpt (insert w (set us))

goal (1 subgoal):
 1. w \<notin> local.span (set us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<notin> local.span (set us)

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
hence vwU: "?v + w \<notin> span (set us)"
[PROOF STATE]
proof (prove)
using this:
w \<notin> local.span (set us)

goal (1 subgoal):
 1. adjuster n w us + w \<notin> local.span (set us)
[PROOF STEP]
using adjust_not_in_span[OF w U dist_U]
[PROOF STATE]
proof (prove)
using this:
w \<notin> local.span (set us)
w \<notin> local.span (set us) \<Longrightarrow> adjuster n w us + w \<notin> local.span (set us)

goal (1 subgoal):
 1. adjuster n w us + w \<notin> local.span (set us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us + w \<notin> local.span (set us)

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have "w \<notin> span (set (us@ws))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<notin> local.span (set (us @ ws))
[PROOF STEP]
using lin_dep_iff_in_span[OF _ ind_UW] dist ind
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set (us @ ws) \<subseteq> carrier_vec n; ?v \<in> carrier_vec n; ?v \<notin> set (us @ ws)\<rbrakk> \<Longrightarrow> (?v \<in> local.span (set (us @ ws))) = lin_dep (set (us @ ws) \<union> {?v})
distinct (us @ w # ws)
lin_indpt (set (us @ w # ws))

goal (1 subgoal):
 1. w \<notin> local.span (set (us @ ws))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<notin> local.span (set (us @ ws))

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
hence span: "?v + w \<notin> span (set (us@ws))"
[PROOF STATE]
proof (prove)
using this:
w \<notin> local.span (set (us @ ws))

goal (1 subgoal):
 1. adjuster n w us + w \<notin> local.span (set (us @ ws))
[PROOF STEP]
using span_add[OF UW vsUW w]
[PROOF STATE]
proof (prove)
using this:
w \<notin> local.span (set (us @ ws))
(w \<in> local.span (set (us @ ws))) = (adjuster n w us + w \<in> local.span (set (us @ ws)))

goal (1 subgoal):
 1. adjuster n w us + w \<notin> local.span (set (us @ ws))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us + w \<notin> local.span (set (us @ ws))

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
hence vwUS: "?v + w \<notin> set (us @ ws)"
[PROOF STATE]
proof (prove)
using this:
adjuster n w us + w \<notin> local.span (set (us @ ws))

goal (1 subgoal):
 1. adjuster n w us + w \<notin> set (us @ ws)
[PROOF STEP]
using span_mem
[PROOF STATE]
proof (prove)
using this:
adjuster n w us + w \<notin> local.span (set (us @ ws))
\<lbrakk>?E \<subseteq> carrier_vec n; ?u \<in> ?E\<rbrakk> \<Longrightarrow> ?u \<in> local.span ?E

goal (1 subgoal):
 1. adjuster n w us + w \<notin> set (us @ ws)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us + w \<notin> set (us @ ws)

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
hence ind2: "~ lin_dep (set (((?v + w) # us) @ ws))"
[PROOF STATE]
proof (prove)
using this:
adjuster n w us + w \<notin> set (us @ ws)

goal (1 subgoal):
 1. lin_indpt (set (((adjuster n w us + w) # us) @ ws))
[PROOF STEP]
using lin_dep_iff_in_span[OF UW ind_UW vw] span
[PROOF STATE]
proof (prove)
using this:
adjuster n w us + w \<notin> set (us @ ws)
adjuster n w us + w \<notin> set (us @ ws) \<Longrightarrow> (adjuster n w us + w \<in> local.span (set (us @ ws))) = lin_dep (set (us @ ws) \<union> {adjuster n w us + w})
adjuster n w us + w \<notin> local.span (set (us @ ws))

goal (1 subgoal):
 1. lin_indpt (set (((adjuster n w us + w) # us) @ ws))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lin_indpt (set (((adjuster n w us + w) # us) @ ws))

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have vwU: "set ((?v + w) # us) \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set ((adjuster n w us + w) # us) \<subseteq> carrier_vec n
[PROOF STEP]
using U w dist
[PROOF STATE]
proof (prove)
using this:
set us \<subseteq> carrier_vec n
w \<in> carrier_vec n
distinct (us @ w # ws)

goal (1 subgoal):
 1. set ((adjuster n w us + w) # us) \<subseteq> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set ((adjuster n w us + w) # us) \<subseteq> carrier_vec n

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have dist2: "distinct (((?v + w) # us) @ ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (((adjuster n w us + w) # us) @ ws)
[PROOF STEP]
using dist vwUS
[PROOF STATE]
proof (prove)
using this:
distinct (us @ w # ws)
adjuster n w us + w \<notin> set (us @ ws)

goal (1 subgoal):
 1. distinct (((adjuster n w us + w) # us) @ ws)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct (((adjuster n w us + w) # us) @ ws)

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
have orth2: "corthogonal ((adjuster n w us + w) # us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. corthogonal ((adjuster n w us + w) # us)
[PROOF STEP]
using adjust_orthogonal[OF U corth w wsU]
[PROOF STATE]
proof (prove)
using this:
corthogonal ((adjuster n w us + w) # us)

goal (1 subgoal):
 1. corthogonal ((adjuster n w us + w) # us)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
corthogonal ((adjuster n w us + w) # us)

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ ws); lin_indpt (set (us @ ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us') \<and> length us' = length us + length ws; gram_schmidt_sub n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ a # ws); lin_indpt (set (us @ a # ws)); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us') \<and> length us' = length us + length (a # ws)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us') \<and> length us' = length us + length (w # ws)
[PROOF STEP]
using Cons(1)[OF U'def W vwU dist2 ind2] orth2
[PROOF STATE]
proof (prove)
using this:
corthogonal ((adjuster n w us + w) # us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (((adjuster n w us + w) # us) @ ws)) = local.span (set us') \<and> length us' = length ((adjuster n w us + w) # us) + length ws
corthogonal ((adjuster n w us + w) # us)

goal (1 subgoal):
 1. set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us') \<and> length us' = length us + length (w # ws)
[PROOF STEP]
using span_Un[OF vwU wU gram_schmidt_sub_span[OF w U dist_U] W W]
[PROOF STATE]
proof (prove)
using this:
corthogonal ((adjuster n w us + w) # us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (((adjuster n w us + w) # us) @ ws)) = local.span (set us') \<and> length us' = length ((adjuster n w us + w) # us) + length ws
corthogonal ((adjuster n w us + w) # us)
local.span (set ws) = local.span (set ws) \<Longrightarrow> local.span (set ((adjuster n w us + w) # us) \<union> set ws) = local.span (set (w # us) \<union> set ws)

goal (1 subgoal):
 1. set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us') \<and> length us' = length us + length (w # ws)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us') \<and> length us' = length us + length (w # ws)

goal (1 subgoal):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct (us @ []); lin_indpt (set (us @ [])); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us') \<and> length us' = length us + length []
[PROOF STEP]
qed simp


[STATEMENT]
lemma cosh_real:
  fixes x :: real
  shows "of_real((exp x + inverse (exp x)) / 2) = cos(\<i> * of_real x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real ((exp x + inverse (exp x)) / 2) = cos (\<i> * complex_of_real x)
[PROOF STEP]
by (simp add: cos_exp_eq field_split_simps exp_minus exp_of_real)


[STATEMENT]
lemma locally_path_connected_Euclidean_space:
   "locally_path_connected_space (Euclidean_space n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally_path_connected_space (Euclidean_space n)
[PROOF STEP]
apply (simp add: homeomorphic_locally_path_connected_space [OF homeomorphic_Euclidean_space_product_topology [of n]]
                   locally_path_connected_space_product_topology)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>i. i < n) \<longrightarrow> {..<n} \<rightarrow>\<^sub>E UNIV = {} \<or> locally_path_connected_space euclideanreal
[PROOF STEP]
using locally_path_connected_space_euclideanreal
[PROOF STATE]
proof (prove)
using this:
locally_path_connected_space euclideanreal

goal (1 subgoal):
 1. (\<exists>i. i < n) \<longrightarrow> {..<n} \<rightarrow>\<^sub>E UNIV = {} \<or> locally_path_connected_space euclideanreal
[PROOF STEP]
by auto


[STATEMENT]
lemma isGlb_dual_isLub: "isGlb S cl = isLub S (dual cl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isGlb S cl = isLub S (dual cl)
[PROOF STEP]
by (simp add: isLub_def isGlb_def dual_def converse_unfold)


[STATEMENT]
lemma third_mertens_const_pos: "third_mertens_const > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < third_mertens_const
[PROOF STEP]
by (simp add: third_mertens_const_def)


[STATEMENT]
lemma (in prob_space) indep_setsD:
  assumes "indep_sets F I" and "J \<subseteq> I" "J \<noteq> {}" "finite J" "\<forall>j\<in>J. A j \<in> F j"
  shows "prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
indep_sets F I
J \<subseteq> I
J \<noteq> {}
finite J
\<forall>j\<in>J. A j \<in> F j

goal (1 subgoal):
 1. prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
unfolding indep_sets_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>i\<in>I. F i \<subseteq> events) \<and> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> (\<forall>A\<in>Pi J F. prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))))
J \<subseteq> I
J \<noteq> {}
finite J
\<forall>j\<in>J. A j \<in> F j

goal (1 subgoal):
 1. prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
by auto


[STATEMENT]
lemma isovarspar_sum:
  "isolate_variable_sparse (p+q) var deg =
  isolate_variable_sparse (p) var deg
  + isolate_variable_sparse (q) var deg"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isolate_variable_sparse (p + q) var deg = isolate_variable_sparse p var deg + isolate_variable_sparse q var deg
[PROOF STEP]
apply (auto simp add: mpoly_eq_iff coeff_isolate_variable_sparse )
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m. lookup m var = 0 \<Longrightarrow> MPoly_Type.coeff (p + q) (Poly_Mapping.update var deg m) = MPoly_Type.coeff (isolate_variable_sparse p var deg + isolate_variable_sparse q var deg) m
 2. \<And>m. 0 < lookup m var \<Longrightarrow> MPoly_Type.coeff (isolate_variable_sparse p var deg + isolate_variable_sparse q var deg) m = (0::'a)
[PROOF STEP]
apply (metis More_MPoly_Type.coeff_add coeff_isolate_variable_sparse)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. 0 < lookup m var \<Longrightarrow> MPoly_Type.coeff (isolate_variable_sparse p var deg + isolate_variable_sparse q var deg) m = (0::'a)
[PROOF STEP]
by (metis More_MPoly_Type.coeff_add add.comm_neutral coeff_isolate_variable_sparse less_numeral_extra(3))


[STATEMENT]
lemma evimage_image_eq: "(f \<inverse>\<^bsub>n\<^esub> (f ` A)) = {y \<in> carrier (R\<^bsup>n\<^esup>). \<exists>x\<in>A. f x = f y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<inverse>\<^bsub>n\<^esub> f ` A = {y \<in> carrier (R\<^bsup>n\<^esup>). \<exists>x\<in>A. f x = f y}
[PROOF STEP]
unfolding evimage_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f -` f ` A \<inter> carrier (R\<^bsup>n\<^esup>) = {y \<in> carrier (R\<^bsup>n\<^esup>). \<exists>x\<in>A. f x = f y}
[PROOF STEP]
by (blast intro: sym)


[STATEMENT]
lemma mk_poly2_sylvester_lower:
  fixes p q :: "'a :: comm_semiring_1 poly"
  assumes mi: "i \<ge> degree q" and imn: "i < degree p + degree q"
  shows "mk_poly2 (sylvester_mat p q) $ i = monom 1 (degree p + degree q - Suc i) * q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_poly2 (sylvester_mat p q) $ i = monom (1::'a) (degree p + degree q - Suc i) * q
[PROOF STEP]
apply (subst mk_poly2)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. i < dim_row (sylvester_mat p q)
 2. 0 < dim_col (sylvester_mat p q)
 3. (\<Sum>j'<dim_col (sylvester_mat p q). monom (sylvester_mat p q $$ (i, j')) (dim_col (sylvester_mat p q) - Suc j')) = monom (1::'a) (degree p + degree q - Suc i) * q
[PROOF STEP]
using imn
[PROOF STATE]
proof (prove)
using this:
i < degree p + degree q

goal (3 subgoals):
 1. i < dim_row (sylvester_mat p q)
 2. 0 < dim_col (sylvester_mat p q)
 3. (\<Sum>j'<dim_col (sylvester_mat p q). monom (sylvester_mat p q $$ (i, j')) (dim_col (sylvester_mat p q) - Suc j')) = monom (1::'a) (degree p + degree q - Suc i) * q
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < dim_col (sylvester_mat p q)
 2. (\<Sum>j'<dim_col (sylvester_mat p q). monom (sylvester_mat p q $$ (i, j')) (dim_col (sylvester_mat p q) - Suc j')) = monom (1::'a) (degree p + degree q - Suc i) * q
[PROOF STEP]
using mi imn
[PROOF STATE]
proof (prove)
using this:
degree q \<le> i
i < degree p + degree q

goal (2 subgoals):
 1. 0 < dim_col (sylvester_mat p q)
 2. (\<Sum>j'<dim_col (sylvester_mat p q). monom (sylvester_mat p q $$ (i, j')) (dim_col (sylvester_mat p q) - Suc j')) = monom (1::'a) (degree p + degree q - Suc i) * q
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j'<dim_col (sylvester_mat p q). monom (sylvester_mat p q $$ (i, j')) (dim_col (sylvester_mat p q) - Suc j')) = monom (1::'a) (degree p + degree q - Suc i) * q
[PROOF STEP]
unfolding sylvester_mat_dim
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j'<degree p + degree q. monom (sylvester_mat p q $$ (i, j')) (degree p + degree q - Suc j')) = monom (1::'a) (degree p + degree q - Suc i) * q
[PROOF STEP]
using sylvester_sum_mat_lower[OF mi imn]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j<degree p + degree q. monom (sylvester_mat p q $$ (i, j)) (degree p + degree q - Suc j)) = monom (1::'a) (degree p + degree q - Suc i) * q

goal (1 subgoal):
 1. (\<Sum>j'<degree p + degree q. monom (sylvester_mat p q $$ (i, j')) (degree p + degree q - Suc j')) = monom (1::'a) (degree p + degree q - Suc i) * q
[PROOF STEP]
apply (subst sylvester_sum_mat_lower)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<Sum>j<degree p + degree q. monom (sylvester_mat p q $$ (i, j)) (degree p + degree q - Suc j)) = monom (1::'a) (degree p + degree q - Suc i) * q \<Longrightarrow> degree q \<le> i
 2. (\<Sum>j<degree p + degree q. monom (sylvester_mat p q $$ (i, j)) (degree p + degree q - Suc j)) = monom (1::'a) (degree p + degree q - Suc i) * q \<Longrightarrow> i < degree p + degree q
 3. (\<Sum>j<degree p + degree q. monom (sylvester_mat p q $$ (i, j)) (degree p + degree q - Suc j)) = monom (1::'a) (degree p + degree q - Suc i) * q \<Longrightarrow> monom (1::'a) (degree p + degree q - Suc i) * q = monom (1::'a) (degree p + degree q - Suc i) * q
[PROOF STEP]
using mi imn
[PROOF STATE]
proof (prove)
using this:
degree q \<le> i
i < degree p + degree q

goal (3 subgoals):
 1. (\<Sum>j<degree p + degree q. monom (sylvester_mat p q $$ (i, j)) (degree p + degree q - Suc j)) = monom (1::'a) (degree p + degree q - Suc i) * q \<Longrightarrow> degree q \<le> i
 2. (\<Sum>j<degree p + degree q. monom (sylvester_mat p q $$ (i, j)) (degree p + degree q - Suc j)) = monom (1::'a) (degree p + degree q - Suc i) * q \<Longrightarrow> i < degree p + degree q
 3. (\<Sum>j<degree p + degree q. monom (sylvester_mat p q $$ (i, j)) (degree p + degree q - Suc j)) = monom (1::'a) (degree p + degree q - Suc i) * q \<Longrightarrow> monom (1::'a) (degree p + degree q - Suc i) * q = monom (1::'a) (degree p + degree q - Suc i) * q
[PROOF STEP]
by auto