[STATEMENT]
lemma factt:
  fixes s n ::nat assumes "s \<le> n"
  shows " (\<Sum>i=s..n. 2^i) < (2^(n+1) :: real) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) 2) {s..n} < 2 ^ (n + 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
s \<le> n

goal (1 subgoal):
 1. sum ((^) 2) {s..n} < 2 ^ (n + 1)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. s \<le> 0 \<Longrightarrow> sum ((^) 2) {s..0} < 2 ^ (0 + 1)
 2. \<And>n. \<lbrakk>s \<le> n \<Longrightarrow> sum ((^) 2) {s..n} < 2 ^ (n + 1); s \<le> Suc n\<rbrakk> \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
s \<le> 0

goal (2 subgoals):
 1. s \<le> 0 \<Longrightarrow> sum ((^) 2) {s..0} < 2 ^ (0 + 1)
 2. \<And>n. \<lbrakk>s \<le> n \<Longrightarrow> sum ((^) 2) {s..n} < 2 ^ (n + 1); s \<le> Suc n\<rbrakk> \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) 2) {s..0} < 2 ^ (0 + 1)
[PROOF STEP]
by  auto
[PROOF STATE]
proof (state)
this:
sum ((^) 2) {s..0} < 2 ^ (0 + 1)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>s \<le> n \<Longrightarrow> sum ((^) 2) {s..n} < 2 ^ (n + 1); s \<le> Suc n\<rbrakk> \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>s \<le> n \<Longrightarrow> sum ((^) 2) {s..n} < 2 ^ (n + 1); s \<le> Suc n\<rbrakk> \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
s \<le> n \<Longrightarrow> sum ((^) 2) {s..n} < 2 ^ (n + 1)
s \<le> Suc n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>s \<le> n \<Longrightarrow> sum ((^) 2) {s..n} < 2 ^ (n + 1); s \<le> Suc n\<rbrakk> \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
have ?case when  "s=n+1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
s = n + 1

goal (1 subgoal):
 1. sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s = n + 1 \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>s \<le> n \<Longrightarrow> sum ((^) 2) {s..n} < 2 ^ (n + 1); s \<le> Suc n\<rbrakk> \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
s = n + 1 \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>s \<le> n \<Longrightarrow> sum ((^) 2) {s..n} < 2 ^ (n + 1); s \<le> Suc n\<rbrakk> \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
have ?case when  "s \<noteq> n+1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
have"(\<Sum>i=s..(n+1). 2^i ) = (\<Sum>i=s..n. 2^i ) + (2::real)^(n+1) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) 2) {s..n + 1} = sum ((^) 2) {s..n} + 2 ^ (n + 1)
[PROOF STEP]
using sum.cl_ivl_Suc \<open>s \<le> Suc n \<close>
[PROOF STATE]
proof (prove)
using this:
sum ?g {?m..Suc ?n} = (if Suc ?n < ?m then 0::?'a else sum ?g {?m..?n} + ?g (Suc ?n))
s \<le> Suc n

goal (1 subgoal):
 1. sum ((^) 2) {s..n + 1} = sum ((^) 2) {s..n} + 2 ^ (n + 1)
[PROOF STEP]
by (auto simp add:add.commute)
[PROOF STATE]
proof (state)
this:
sum ((^) 2) {s..n + 1} = sum ((^) 2) {s..n} + 2 ^ (n + 1)

goal (1 subgoal):
 1. sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((^) 2) {s..n + 1} = sum ((^) 2) {s..n} + 2 ^ (n + 1)

goal (1 subgoal):
 1. sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
have "... < (2) ^ (n +1) + (2)^(n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) 2) {s..n} + 2 ^ (n + 1) < 2 ^ (n + 1) + 2 ^ (n + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum ((^) 2) {s..n} + 2 ^ (n + 1) < 2 ^ (n + 1) + 2 ^ (n + 1)
[PROOF STEP]
have "s \<le>n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<le> n
[PROOF STEP]
using that  \<open>s \<le> Suc n \<close>
[PROOF STATE]
proof (prove)
using this:
s \<noteq> n + 1
s \<le> Suc n

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

goal (1 subgoal):
 1. sum ((^) 2) {s..n} + 2 ^ (n + 1) < 2 ^ (n + 1) + 2 ^ (n + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s \<le> n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
s \<le> n

goal (1 subgoal):
 1. sum ((^) 2) {s..n} + 2 ^ (n + 1) < 2 ^ (n + 1) + 2 ^ (n + 1)
[PROOF STEP]
using Suc.hyps \<open>s \<le> n\<close>
[PROOF STATE]
proof (prove)
using this:
s \<le> n
s \<le> n \<Longrightarrow> sum ((^) 2) {s..n} < 2 ^ (n + 1)
s \<le> n

goal (1 subgoal):
 1. sum ((^) 2) {s..n} + 2 ^ (n + 1) < 2 ^ (n + 1) + 2 ^ (n + 1)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
sum ((^) 2) {s..n} + 2 ^ (n + 1) < 2 ^ (n + 1) + 2 ^ (n + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum ((^) 2) {s..n} + 2 ^ (n + 1) < 2 ^ (n + 1) + 2 ^ (n + 1)

goal (1 subgoal):
 1. sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((^) 2) {s..n} + 2 ^ (n + 1) < 2 ^ (n + 1) + 2 ^ (n + 1)

goal (1 subgoal):
 1. sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
have "... = 2^(n+2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (n + 1) + 2 ^ (n + 1) = 2 ^ (n + 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ (n + 1) + 2 ^ (n + 1) = 2 ^ (n + 2)

goal (1 subgoal):
 1. sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum ((^) 2) {s..n + 1} < 2 ^ (n + 2)
[PROOF STEP]
show "(\<Sum>i=s..(Suc n). 2^i )< (2::real)^(Suc n+1)"
[PROOF STATE]
proof (prove)
using this:
sum ((^) 2) {s..n + 1} < 2 ^ (n + 2)

goal (1 subgoal):
 1. sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
s \<noteq> n + 1 \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>s \<le> n \<Longrightarrow> sum ((^) 2) {s..n} < 2 ^ (n + 1); s \<le> Suc n\<rbrakk> \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
s = n + 1 \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
s \<noteq> n + 1 \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
s = n + 1 \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
s \<noteq> n + 1 \<Longrightarrow> sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)

goal (1 subgoal):
 1. sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sum ((^) 2) {s..Suc n} < 2 ^ (Suc n + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma case_duality_2:
  "(-x \<sqinter> -y) \<squnion> (--x \<sqinter> -z) = (-x \<squnion> -z) \<sqinter> (--x \<squnion> -y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - x \<sqinter> - y \<squnion> - - x \<sqinter> - z = (- x \<squnion> - z) \<sqinter> (- - x \<squnion> - y)
[PROOF STEP]
using case_duality sub_commutative sub_inf_def
[PROOF STATE]
proof (prove)
using this:
- - ?x \<sqinter> - ?y \<squnion> - ?x \<sqinter> - ?z = (- ?x \<squnion> - ?y) \<sqinter> (- - ?x \<squnion> - ?z)
- ?x \<squnion> - ?y = - ?y \<squnion> - ?x
- ?x \<sqinter> - ?y = - (- - ?x \<squnion> - - ?y)

goal (1 subgoal):
 1. - x \<sqinter> - y \<squnion> - - x \<sqinter> - z = (- x \<squnion> - z) \<sqinter> (- - x \<squnion> - y)
[PROOF STEP]
by auto


[STATEMENT]
theorem sigma_INTER:
  assumes a:"(\<And>i::nat. i \<in> S \<Longrightarrow> a i \<in> sigma A)"
  shows "(\<Inter>i\<in>S. a i) \<in> sigma A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> (a ` S) \<in> sigma A
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> (a ` S) \<in> sigma A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Inter> (a ` S) \<in> sigma A
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
?i \<in> S \<Longrightarrow> a ?i \<in> sigma A
[PROOF STEP]
have "\<And>i. (if i\<in>S then {} else UNIV) \<union> a i \<in> sigma A"
[PROOF STATE]
proof (prove)
using this:
?i \<in> S \<Longrightarrow> a ?i \<in> sigma A

goal (1 subgoal):
 1. \<And>i. (if i \<in> S then {} else UNIV) \<union> a i \<in> sigma A
[PROOF STEP]
by (simp add: sigma.intros sigma_UNIV)
[PROOF STATE]
proof (state)
this:
(if ?i \<in> S then {} else UNIV) \<union> a ?i \<in> sigma A

goal (1 subgoal):
 1. \<Inter> (a ` S) \<in> sigma A
[PROOF STEP]
hence "(\<Inter>i. (if i\<in>S then {} else UNIV) \<union> a i) \<in> sigma A"
[PROOF STATE]
proof (prove)
using this:
(if ?i \<in> S then {} else UNIV) \<union> a ?i \<in> sigma A

goal (1 subgoal):
 1. (\<Inter>i. (if i \<in> S then {} else UNIV) \<union> a i) \<in> sigma A
[PROOF STEP]
by (rule sigma_Inter)
[PROOF STATE]
proof (state)
this:
(\<Inter>i. (if i \<in> S then {} else UNIV) \<union> a i) \<in> sigma A

goal (1 subgoal):
 1. \<Inter> (a ` S) \<in> sigma A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Inter>i. (if i \<in> S then {} else UNIV) \<union> a i) \<in> sigma A

goal (1 subgoal):
 1. \<Inter> (a ` S) \<in> sigma A
[PROOF STEP]
have "(\<Inter>i. (if i\<in>S then {} else UNIV) \<union> a i) = (\<Inter>i\<in>S. a i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>i. (if i \<in> S then {} else UNIV) \<union> a i) = \<Inter> (a ` S)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<Inter>i. (if i \<in> S then {} else UNIV) \<union> a i) = \<Inter> (a ` S)

goal (1 subgoal):
 1. \<Inter> (a ` S) \<in> sigma A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Inter> (a ` S) \<in> sigma A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Inter> (a ` S) \<in> sigma A

goal (1 subgoal):
 1. \<Inter> (a ` S) \<in> sigma A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Inter> (a ` S) \<in> sigma A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pdevs_of_ivl_real:
  fixes a b::real
  shows "pdevs_of_ivl a b = singleton_pdevs ((b - a) / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pdevs_of_ivl a b = singleton_pdevs ((b - a) / 2)
[PROOF STEP]
by (auto simp: pdevs_of_ivl_def Basis_list_real_def intro!: pdevs_eqI)


[STATEMENT]
lemma expand_arctan_approx:
  "(\<Sum>k<(numeral n::nat). inverse (f k) * inverse (x ^ k)) =
     inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k+1)) * inverse (x^k)) / x"
  "(\<Sum>k<Suc 0. inverse (f k) * inverse (x^k)) = inverse (f 0 :: 'a :: field)"
  "(\<Sum>k<(0::nat). inverse (f k) * inverse (x^k)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<numeral n. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x &&& (\<Sum>k<Suc 0. inverse (f k) * inverse (x ^ k)) = inverse (f 0) &&& (\<Sum>k<0. inverse (f k) * inverse (x ^ k)) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<Sum>k<numeral n. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x
 2. (\<Sum>k<Suc 0. inverse (f k) * inverse (x ^ k)) = inverse (f 0)
 3. (\<Sum>k<0. inverse (f k) * inverse (x ^ k)) = (0::'a)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<Sum>k<numeral n. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x
 2. (\<Sum>k<Suc 0. inverse (f k) * inverse (x ^ k)) = inverse (f 0)
 3. (\<Sum>k<0. inverse (f k) * inverse (x ^ k)) = (0::'a)
[PROOF STEP]
fix m :: nat
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<Sum>k<numeral n. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x
 2. (\<Sum>k<Suc 0. inverse (f k) * inverse (x ^ k)) = inverse (f 0)
 3. (\<Sum>k<0. inverse (f k) * inverse (x ^ k)) = (0::'a)
[PROOF STEP]
have "(\<Sum>k<Suc m. inverse (f k * x^k)) =
             inverse (f 0) + (\<Sum>k=Suc 0..<Suc m. inverse (f k * x^k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<Suc m. inverse (f k * x ^ k)) = inverse (f 0) + (\<Sum>k = Suc 0..<Suc m. inverse (f k * x ^ k))
[PROOF STEP]
by (subst atLeast0LessThan [symmetric], subst sum.atLeast_Suc_lessThan) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>k<Suc m. inverse (f k * x ^ k)) = inverse (f 0) + (\<Sum>k = Suc 0..<Suc m. inverse (f k * x ^ k))

goal (3 subgoals):
 1. (\<Sum>k<numeral n. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x
 2. (\<Sum>k<Suc 0. inverse (f k) * inverse (x ^ k)) = inverse (f 0)
 3. (\<Sum>k<0. inverse (f k) * inverse (x ^ k)) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k<Suc m. inverse (f k * x ^ k)) = inverse (f 0) + (\<Sum>k = Suc 0..<Suc m. inverse (f k * x ^ k))

goal (3 subgoals):
 1. (\<Sum>k<numeral n. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x
 2. (\<Sum>k<Suc 0. inverse (f k) * inverse (x ^ k)) = inverse (f 0)
 3. (\<Sum>k<0. inverse (f k) * inverse (x ^ k)) = (0::'a)
[PROOF STEP]
have "(\<Sum>k=Suc 0..<Suc m. inverse (f k * x^k)) = (\<Sum>k<m. inverse (f (k+1) * x^k)) / x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<Suc m. inverse (f k * x ^ k)) = (\<Sum>k<m. inverse (f (k + 1) * x ^ k)) / x
[PROOF STEP]
by (subst sum.shift_bounds_Suc_ivl)
         (simp add: sum_distrib_left divide_inverse algebra_simps
                    atLeast0LessThan power_commutes)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..<Suc m. inverse (f k * x ^ k)) = (\<Sum>k<m. inverse (f (k + 1) * x ^ k)) / x

goal (3 subgoals):
 1. (\<Sum>k<numeral n. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x
 2. (\<Sum>k<Suc 0. inverse (f k) * inverse (x ^ k)) = inverse (f 0)
 3. (\<Sum>k<0. inverse (f k) * inverse (x ^ k)) = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k<Suc m. inverse (f k * x ^ k)) = inverse (f 0) + (\<Sum>k<m. inverse (f (k + 1) * x ^ k)) / x
[PROOF STEP]
have "(\<Sum>k<Suc m. inverse (f k) * inverse (x ^ k)) =
                      inverse (f 0) + (\<Sum>k<m. inverse (f (k + 1)) * inverse (x ^ k)) / x"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k<Suc m. inverse (f k * x ^ k)) = inverse (f 0) + (\<Sum>k<m. inverse (f (k + 1) * x ^ k)) / x

goal (1 subgoal):
 1. (\<Sum>k<Suc m. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<m. inverse (f (k + 1)) * inverse (x ^ k)) / x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k<Suc m. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<m. inverse (f (k + 1)) * inverse (x ^ k)) / x

goal (3 subgoals):
 1. (\<Sum>k<numeral n. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x
 2. (\<Sum>k<Suc 0. inverse (f k) * inverse (x ^ k)) = inverse (f 0)
 3. (\<Sum>k<0. inverse (f k) * inverse (x ^ k)) = (0::'a)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(\<Sum>k<Suc ?m2. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<?m2. inverse (f (k + 1)) * inverse (x ^ k)) / x

goal (3 subgoals):
 1. (\<Sum>k<numeral n. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x
 2. (\<Sum>k<Suc 0. inverse (f k) * inverse (x ^ k)) = inverse (f 0)
 3. (\<Sum>k<0. inverse (f k) * inverse (x ^ k)) = (0::'a)
[PROOF STEP]
from this[of "pred_numeral n"]
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k<Suc (pred_numeral n). inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x
[PROOF STEP]
show "(\<Sum>k<numeral n. inverse (f k) * inverse (x^k)) =
            inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k+1)) * inverse (x^k)) / x"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k<Suc (pred_numeral n). inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x

goal (1 subgoal):
 1. (\<Sum>k<numeral n. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x
[PROOF STEP]
by (simp add: numeral_eq_Suc)
[PROOF STATE]
proof (state)
this:
(\<Sum>k<numeral n. inverse (f k) * inverse (x ^ k)) = inverse (f 0) + (\<Sum>k<pred_numeral n. inverse (f (k + 1)) * inverse (x ^ k)) / x

goal (2 subgoals):
 1. (\<Sum>k<Suc 0. inverse (f k) * inverse (x ^ k)) = inverse (f 0)
 2. (\<Sum>k<0. inverse (f k) * inverse (x ^ k)) = (0::'a)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma power_mono: "a \<le> b \<Longrightarrow> 0 \<le> a \<Longrightarrow> a ^ n \<le> b ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; (0::'a) \<le> a\<rbrakk> \<Longrightarrow> a ^ n \<le> b ^ n
[PROOF STEP]
by (induct n) (auto intro: mult_mono order_trans [of 0 a b])


[STATEMENT]
lemma infdist_triangle_abs [mono_intros]:
  "\<bar>infdist x A - infdist y A\<bar> \<le> dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>infdist x A - infdist y A\<bar> \<le> dist x y
[PROOF STEP]
by (metis (full_types) abs_diff_le_iff diff_le_eq dist_commute infdist_triangle)


[STATEMENT]
lemma cr_real_eq: "pcr_real = (\<lambda>x y. cauchy x \<and> Real x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pcr_real = (\<lambda>x y. cauchy x \<and> Real x = y)
[PROOF STEP]
unfolding real.pcr_cr_eq cr_real_def realrel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x y. (cauchy x \<and> cauchy x \<and> vanishes (\<lambda>n. x n - x n)) \<and> Real x = y) = (\<lambda>x y. cauchy x \<and> Real x = y)
[PROOF STEP]
by auto


[STATEMENT]
lemma vareq_trans: "t0 \<in> existence_ivl0 x0 \<Longrightarrow> t \<in> existence_ivl0 (flow0 x0 t0) \<Longrightarrow>
  vareq (flow0 x0 t0) t = vareq x0 (t0 + t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t0 \<in> existence_ivl0 x0; t \<in> existence_ivl0 (flow0 x0 t0)\<rbrakk> \<Longrightarrow> vareq (flow0 x0 t0) t = vareq x0 (t0 + t)
[PROOF STEP]
by (auto simp: vareq_def flow_trans)


[STATEMENT]
lemma fps_exp_0[simp]: "fps_exp (0::'a::field) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_exp (0::'a) = 1
[PROOF STEP]
by (simp add: fps_eq_iff power_0_left)


[STATEMENT]
lemma l2wi: "wordinterval_to_set (l2wi l) = (\<Union> (i,j) \<in> set l. {i .. j})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (l2wi l) = (\<Union>(i, j)\<in>set l. {i..j})
[PROOF STEP]
by(induction l rule: l2wi.induct, simp_all)


[STATEMENT]
lemma positively_invariant_outer:
  shows "c.positively_invariant  {p. (\<lambda>p. (fst p)\<^sup>2 + (snd p)\<^sup>2 - 4) p \<le> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c.positively_invariant {p. (fst p)\<^sup>2 + (snd p)\<^sup>2 - 4 \<le> 0}
[PROOF STEP]
apply (rule c.positively_invariant_le[of "\<lambda>p.-2*((fst p)^2+(snd p)^2)" _  "\<lambda>x p. 2 * fst x * fst p + 2 * snd x * snd p" ])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. continuous_on UNIV (\<lambda>p. - 2 * ((fst p)\<^sup>2 + (snd p)\<^sup>2))
 2. \<And>x. ((\<lambda>x. (fst x)\<^sup>2 + (snd x)\<^sup>2 - 4) has_derivative (\<lambda>p. 2 * fst x * fst p + 2 * snd x * snd p)) (at x)
 3. \<And>s. 2 * fst s * fst (case s of (x, y) \<Rightarrow> (cx x y, cy x y)) + 2 * snd s * snd (case s of (x, y) \<Rightarrow> (cx x y, cy x y)) \<le> - 2 * ((fst s)\<^sup>2 + (snd s)\<^sup>2) * ((fst s)\<^sup>2 + (snd s)\<^sup>2 - 4)
[PROOF STEP]
apply (auto intro!: continuous_intros derivative_eq_intros)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. 2 * a * cx a b + 2 * b * cy a b \<le> (- (2 * a\<^sup>2) - 2 * b\<^sup>2) * (a\<^sup>2 + b\<^sup>2 - 4)
[PROOF STEP]
unfolding cx_def cy_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. 2 * a * (- b + a * (1 - a\<^sup>2 - b\<^sup>2)) + 2 * b * (a + b * (1 - a\<^sup>2 - b\<^sup>2)) \<le> (- (2 * a\<^sup>2) - 2 * b\<^sup>2) * (a\<^sup>2 + b\<^sup>2 - 4)
[PROOF STEP]
by (sos "(((A<0 * R<1) + (R<1 * ((R<6 * [a]^2) + (R<6 * [b]^2)))))")


[STATEMENT]
lemma mod_plus_minus_leq_mod:
  "\<bar>x mod+- q\<bar> \<le> \<bar>x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x mod+- q\<bar> \<le> \<bar>x\<bar>
[PROOF STEP]
by (smt (verit, best) atLeastAtMost_iff mod_plus_minus_range
  mod_plus_minus_rangeE' q_gt_zero q_odd)


[STATEMENT]
lemma div_apart: "\<lbrakk>x mod (2::nat) = 0; y mod 2 = 0\<rbrakk>
          \<Longrightarrow> (x + y) div 2 = x div 2 + y div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_even x; is_even y\<rbrakk> \<Longrightarrow> (x + y) div 2 = x div 2 + y div 2
[PROOF STEP]
by(auto)


[STATEMENT]
lemma timesmod1: "((x::nat)*((y::nat) mod n)) mod (n::nat) = ((x*y) mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (y mod n) mod n = x * y mod n
[PROOF STEP]
by (rule mod_mult_right_eq)


[STATEMENT]
lemma inter_in_pow_nodes:
  assumes "xs \<in> (rev \<circ> sorted_list_of_set) ` (Pow (set nodes))"
    shows "(rev \<circ> sorted_list_of_set)(set xs \<inter> set ys) \<in> (rev \<circ> (sorted_list_of_set)) ` (Pow (set nodes))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rev \<circ> sorted_list_of_set) (set xs \<inter> set ys) \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)

goal (1 subgoal):
 1. (rev \<circ> sorted_list_of_set) (set xs \<inter> set ys) \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes) \<Longrightarrow> (rev \<circ> sorted_list_of_set) (set xs \<inter> set ys) \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
let ?res = "set xs \<inter> set ys"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes) \<Longrightarrow> (rev \<circ> sorted_list_of_set) (set xs \<inter> set ys) \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
have "set xs \<subseteq> set nodes"
[PROOF STATE]
proof (prove)
using this:
xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)

goal (1 subgoal):
 1. set xs \<subseteq> set nodes
[PROOF STEP]
using inpow_subset_nodes
[PROOF STATE]
proof (prove)
using this:
xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
?xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes) \<Longrightarrow> set ?xs \<subseteq> set nodes

goal (1 subgoal):
 1. set xs \<subseteq> set nodes
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set xs \<subseteq> set nodes

goal (1 subgoal):
 1. xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes) \<Longrightarrow> (rev \<circ> sorted_list_of_set) (set xs \<inter> set ys) \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set xs \<subseteq> set nodes
[PROOF STEP]
have "?res \<subseteq> set nodes"
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> set nodes

goal (1 subgoal):
 1. set xs \<inter> set ys \<subseteq> set nodes
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set xs \<inter> set ys \<subseteq> set nodes

goal (1 subgoal):
 1. xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes) \<Longrightarrow> (rev \<circ> sorted_list_of_set) (set xs \<inter> set ys) \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set xs \<inter> set ys \<subseteq> set nodes
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set xs \<inter> set ys \<subseteq> set nodes

goal (1 subgoal):
 1. (rev \<circ> sorted_list_of_set) (set xs \<inter> set ys) \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
using subset_nodes_inpow
[PROOF STATE]
proof (prove)
using this:
set xs \<inter> set ys \<subseteq> set nodes
\<lbrakk>Sorted_Less.sorted (rev ?xs); set ?xs \<subseteq> set nodes\<rbrakk> \<Longrightarrow> ?xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)

goal (1 subgoal):
 1. (rev \<circ> sorted_list_of_set) (set xs \<inter> set ys) \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(rev \<circ> sorted_list_of_set) (set xs \<inter> set ys) \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vinsert_ident:
  assumes "x \<notin>\<^sub>\<circ> A" and "x \<notin>\<^sub>\<circ> B"
  shows "vinsert x A = vinsert x B \<longleftrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vinsert x A = vinsert x B) = (A = B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<notin>\<^sub>\<circ> A
x \<notin>\<^sub>\<circ> B

goal (1 subgoal):
 1. (vinsert x A = vinsert x B) = (A = B)
[PROOF STEP]
by force


[STATEMENT]
lemma ncols_eq_card_columns:
  fixes A::"'a^'columns::{mod_type}^'rows::{mod_type}"
  shows "ncols_iarray (matrix_to_iarray A) = CARD('columns)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ncols_iarray (matrix_to_iarray A) = CARD('columns)
[PROOF STEP]
unfolding ncols_iarray_def length_eq_card_columns
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('columns) = CARD('columns)
[PROOF STEP]
..


[STATEMENT]
lemma bi_unique_vec_rel: "bi_unique R \<Longrightarrow> bi_unique (vec_rel R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bi_unique R \<Longrightarrow> bi_unique (vec_rel R)
[PROOF STEP]
using left_unique_vec_rel[of R] right_unique_vec_rel[of R]
[PROOF STATE]
proof (prove)
using this:
left_unique R \<Longrightarrow> left_unique (vec_rel R)
right_unique R \<Longrightarrow> right_unique (vec_rel R)

goal (1 subgoal):
 1. bi_unique R \<Longrightarrow> bi_unique (vec_rel R)
[PROOF STEP]
unfolding bi_unique_def left_unique_def right_unique_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y z. R x z \<longrightarrow> R y z \<longrightarrow> x = y \<Longrightarrow> \<forall>x y z. vec_rel R x z \<longrightarrow> vec_rel R y z \<longrightarrow> x = y
\<forall>x y z. R x y \<longrightarrow> R x z \<longrightarrow> y = z \<Longrightarrow> \<forall>x y z. vec_rel R x y \<longrightarrow> vec_rel R x z \<longrightarrow> y = z

goal (1 subgoal):
 1. (\<forall>x y z. R x y \<longrightarrow> R x z \<longrightarrow> y = z) \<and> (\<forall>x y z. R x z \<longrightarrow> R y z \<longrightarrow> x = y) \<Longrightarrow> (\<forall>x y z. vec_rel R x y \<longrightarrow> vec_rel R x z \<longrightarrow> y = z) \<and> (\<forall>x y z. vec_rel R x z \<longrightarrow> vec_rel R y z \<longrightarrow> x = y)
[PROOF STEP]
by blast


[STATEMENT]
lemma convex_hull_convex_hull_listD: assumes A: "A \<subseteq> carrier_vec n"
  and x: "x \<in> convex_hull A"
shows "\<exists> as. set as \<subseteq> A \<and> x \<in> convex_hull_list as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>as. set as \<subseteq> A \<and> x \<in> convex_hull_list as
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>as. set as \<subseteq> A \<and> x \<in> convex_hull_list as
[PROOF STEP]
from x[unfolded convex_hull_def]
[PROOF STATE]
proof (chain)
picking this:
x \<in> {x. \<exists>Ws c. finite Ws \<and> Ws \<subseteq> A \<and> convex_lincomb c Ws x}
[PROOF STEP]
obtain X c where finX: "finite X" and XA: "X \<subseteq> A" and "convex_lincomb c X x"
[PROOF STATE]
proof (prove)
using this:
x \<in> {x. \<exists>Ws c. finite Ws \<and> Ws \<subseteq> A \<and> convex_lincomb c Ws x}

goal (1 subgoal):
 1. (\<And>X c. \<lbrakk>finite X; X \<subseteq> A; convex_lincomb c X x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite X
X \<subseteq> A
convex_lincomb c X x

goal (1 subgoal):
 1. \<exists>as. set as \<subseteq> A \<and> x \<in> convex_hull_list as
[PROOF STEP]
hence x: "x \<in> convex_hull X"
[PROOF STATE]
proof (prove)
using this:
finite X
X \<subseteq> A
convex_lincomb c X x

goal (1 subgoal):
 1. x \<in> convex_hull X
[PROOF STEP]
unfolding convex_hull_def
[PROOF STATE]
proof (prove)
using this:
finite X
X \<subseteq> A
convex_lincomb c X x

goal (1 subgoal):
 1. x \<in> {x. \<exists>Ws c. finite Ws \<and> Ws \<subseteq> X \<and> convex_lincomb c Ws x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> convex_hull X

goal (1 subgoal):
 1. \<exists>as. set as \<subseteq> A \<and> x \<in> convex_hull_list as
[PROOF STEP]
from finite_list[OF finX]
[PROOF STATE]
proof (chain)
picking this:
\<exists>xs. set xs = X
[PROOF STEP]
obtain xs where X: "X = set xs"
[PROOF STATE]
proof (prove)
using this:
\<exists>xs. set xs = X

goal (1 subgoal):
 1. (\<And>xs. X = set xs \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X = set xs

goal (1 subgoal):
 1. \<exists>as. set as \<subseteq> A \<and> x \<in> convex_hull_list as
[PROOF STEP]
from finite_convex_hull_iff_convex_hull_list[OF _ this] x XA A
[PROOF STATE]
proof (chain)
picking this:
X \<subseteq> carrier_vec n \<Longrightarrow> convex_hull X = convex_hull_list xs
x \<in> convex_hull X
X \<subseteq> A
A \<subseteq> carrier_vec n
[PROOF STEP]
have x: "x \<in> convex_hull_list xs"
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> carrier_vec n \<Longrightarrow> convex_hull X = convex_hull_list xs
x \<in> convex_hull X
X \<subseteq> A
A \<subseteq> carrier_vec n

goal (1 subgoal):
 1. x \<in> convex_hull_list xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> convex_hull_list xs

goal (1 subgoal):
 1. \<exists>as. set as \<subseteq> A \<and> x \<in> convex_hull_list as
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> convex_hull_list xs

goal (1 subgoal):
 1. \<exists>as. set as \<subseteq> A \<and> x \<in> convex_hull_list as
[PROOF STEP]
using XA
[PROOF STATE]
proof (prove)
using this:
x \<in> convex_hull_list xs
X \<subseteq> A

goal (1 subgoal):
 1. \<exists>as. set as \<subseteq> A \<and> x \<in> convex_hull_list as
[PROOF STEP]
unfolding X
[PROOF STATE]
proof (prove)
using this:
x \<in> convex_hull_list xs
set xs \<subseteq> A

goal (1 subgoal):
 1. \<exists>as. set as \<subseteq> A \<and> x \<in> convex_hull_list as
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>as. set as \<subseteq> A \<and> x \<in> convex_hull_list as

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measure_subadditive_countably:
  assumes A: "range A \<subseteq> sets M" and fin: "(\<Sum>i. emeasure M (A i)) \<noteq> \<infinity>"
  shows "measure M (\<Union>i. A i) \<le> (\<Sum>i. measure M (A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
from fin
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i. emeasure M (A i)) \<noteq> \<infinity>
[PROOF STEP]
have **: "\<And>i. emeasure M (A i) \<noteq> top"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i. emeasure M (A i)) \<noteq> \<infinity>

goal (1 subgoal):
 1. \<And>i. emeasure M (A i) \<noteq> top
[PROOF STEP]
using ennreal_suminf_lessD[of "\<lambda>i. emeasure M (A i)"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i. emeasure M (A i)) \<noteq> \<infinity>
(\<Sum>i. emeasure M (A i)) < ?x \<Longrightarrow> emeasure M (A ?i) < ?x

goal (1 subgoal):
 1. \<And>i. emeasure M (A i) \<noteq> top
[PROOF STEP]
by (simp add: less_top)
[PROOF STATE]
proof (state)
this:
emeasure M (A ?i) \<noteq> top

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
emeasure M (A ?i) \<noteq> top

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
have "emeasure M (\<Union>i. A i) \<le> (\<Sum>i. emeasure M (A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (\<Union> (range A)) \<le> (\<Sum>i. emeasure M (A i))
[PROOF STEP]
using emeasure_subadditive_countably[OF A]
[PROOF STATE]
proof (prove)
using this:
emeasure M (\<Union> (range A)) \<le> (\<Sum>i. emeasure M (A i))

goal (1 subgoal):
 1. emeasure M (\<Union> (range A)) \<le> (\<Sum>i. emeasure M (A i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union> (range A)) \<le> (\<Sum>i. emeasure M (A i))

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union> (range A)) \<le> (\<Sum>i. emeasure M (A i))

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
have "\<dots> < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. emeasure M (A i)) < \<infinity>
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i. emeasure M (A i)) \<noteq> \<infinity>

goal (1 subgoal):
 1. (\<Sum>i. emeasure M (A i)) < \<infinity>
[PROOF STEP]
by (simp add: less_top)
[PROOF STATE]
proof (state)
this:
(\<Sum>i. emeasure M (A i)) < \<infinity>

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure M (\<Union> (range A)) < \<infinity>
[PROOF STEP]
have "emeasure M (\<Union>i. A i) \<noteq> top"
[PROOF STATE]
proof (prove)
using this:
emeasure M (\<Union> (range A)) < \<infinity>

goal (1 subgoal):
 1. emeasure M (\<Union> (range A)) \<noteq> top
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union> (range A)) \<noteq> top

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union> (range A)) \<noteq> top

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
emeasure M (\<Union> (range A)) \<noteq> top
[PROOF STEP]
have "ennreal (measure M (\<Union>i. A i)) = emeasure M (\<Union>i. A i)"
[PROOF STATE]
proof (prove)
using this:
emeasure M (\<Union> (range A)) \<noteq> top

goal (1 subgoal):
 1. ennreal (Sigma_Algebra.measure M (\<Union> (range A))) = emeasure M (\<Union> (range A))
[PROOF STEP]
by (rule emeasure_eq_ennreal_measure[symmetric])
[PROOF STATE]
proof (state)
this:
ennreal (Sigma_Algebra.measure M (\<Union> (range A))) = emeasure M (\<Union> (range A))

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (Sigma_Algebra.measure M (\<Union> (range A))) = emeasure M (\<Union> (range A))

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
have "\<dots> \<le> (\<Sum>i. emeasure M (A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (\<Union> (range A)) \<le> (\<Sum>i. emeasure M (A i))
[PROOF STEP]
using emeasure_subadditive_countably[OF A]
[PROOF STATE]
proof (prove)
using this:
emeasure M (\<Union> (range A)) \<le> (\<Sum>i. emeasure M (A i))

goal (1 subgoal):
 1. emeasure M (\<Union> (range A)) \<le> (\<Sum>i. emeasure M (A i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union> (range A)) \<le> (\<Sum>i. emeasure M (A i))

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union> (range A)) \<le> (\<Sum>i. emeasure M (A i))

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
have "\<dots> = ennreal (\<Sum>i. measure M (A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. emeasure M (A i)) = ennreal (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i. emeasure M (A i)) \<noteq> \<infinity>

goal (1 subgoal):
 1. (\<Sum>i. emeasure M (A i)) = ennreal (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
unfolding emeasure_eq_ennreal_measure[OF **]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i. ennreal (Sigma_Algebra.measure M (A i))) \<noteq> \<infinity>

goal (1 subgoal):
 1. (\<Sum>i. ennreal (Sigma_Algebra.measure M (A i))) = ennreal (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
by (subst suminf_ennreal) (auto simp: **)
[PROOF STATE]
proof (state)
this:
(\<Sum>i. emeasure M (A i)) = ennreal (\<Sum>i. Sigma_Algebra.measure M (A i))

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (Sigma_Algebra.measure M (\<Union> (range A))) \<le> ennreal (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (Sigma_Algebra.measure M (\<Union> (range A))) \<le> ennreal (\<Sum>i. Sigma_Algebra.measure M (A i))

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
apply (rule ennreal_le_iff[THEN iffD1, rotated])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))
[PROOF STEP]
apply (intro suminf_nonneg allI measure_nonneg summable_suminf_not_top)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. ennreal (Sigma_Algebra.measure M (A i))) \<noteq> top
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i. emeasure M (A i)) \<noteq> \<infinity>

goal (1 subgoal):
 1. (\<Sum>i. ennreal (Sigma_Algebra.measure M (A i))) \<noteq> top
[PROOF STEP]
apply (simp add: emeasure_eq_ennreal_measure[OF **])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (\<Union> (range A)) \<le> (\<Sum>i. Sigma_Algebra.measure M (A i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma asym_if_irrefl_trans: "irrefl r \<Longrightarrow> trans r \<Longrightarrow> asym r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>irrefl r; trans r\<rbrakk> \<Longrightarrow> asym r
[PROOF STEP]
by (intro asymI) (auto simp: irrefl_def trans_def)


[STATEMENT]
lemma extend_to_affine_basis_nonempty:
  fixes S V :: "'n::real_vector set"
  assumes "\<not> affine_dependent S" "S \<subseteq> V" "S \<noteq> {}"
  shows "\<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
obtain a where a: "a \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. a \<in> S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> affine_dependent S
S \<subseteq> V
S \<noteq> {}

goal (1 subgoal):
 1. (\<And>a. a \<in> S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> S

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> S
[PROOF STEP]
have h0: "independent  ((\<lambda>x. -a + x) ` (S-{a}))"
[PROOF STATE]
proof (prove)
using this:
a \<in> S

goal (1 subgoal):
 1. independent ((+) (- a) ` (S - {a}))
[PROOF STEP]
using affine_dependent_iff_dependent2 assms
[PROOF STATE]
proof (prove)
using this:
a \<in> S
?a \<in> ?S \<Longrightarrow> affine_dependent ?S = dependent ((+) (- ?a) ` (?S - {?a}))
\<not> affine_dependent S
S \<subseteq> V
S \<noteq> {}

goal (1 subgoal):
 1. independent ((+) (- a) ` (S - {a}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
independent ((+) (- a) ` (S - {a}))

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
obtain B where B:
    "(\<lambda>x. -a+x) ` (S - {a}) \<subseteq> B \<and> B \<subseteq> (\<lambda>x. -a+x) ` V \<and> independent B \<and> (\<lambda>x. -a+x) ` V \<subseteq> span B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. (+) (- a) ` (S - {a}) \<subseteq> B \<and> B \<subseteq> (+) (- a) ` V \<and> independent B \<and> (+) (- a) ` V \<subseteq> span B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> affine_dependent S
S \<subseteq> V
S \<noteq> {}

goal (1 subgoal):
 1. (\<And>B. (+) (- a) ` (S - {a}) \<subseteq> B \<and> B \<subseteq> (+) (- a) ` V \<and> independent B \<and> (+) (- a) ` V \<subseteq> span B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (blast intro: maximal_independent_subset_extend[OF _ h0, of "(\<lambda>x. -a + x) ` V"])
[PROOF STATE]
proof (state)
this:
(+) (- a) ` (S - {a}) \<subseteq> B \<and> B \<subseteq> (+) (- a) ` V \<and> independent B \<and> (+) (- a) ` V \<subseteq> span B

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
define T where "T = (\<lambda>x. a+x) ` insert 0 B"
[PROOF STATE]
proof (state)
this:
T = (+) a ` insert (0::'n) B

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T = (+) a ` insert (0::'n) B
[PROOF STEP]
have "T = insert a ((\<lambda>x. a+x) ` B)"
[PROOF STATE]
proof (prove)
using this:
T = (+) a ` insert (0::'n) B

goal (1 subgoal):
 1. T = insert a ((+) a ` B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
T = insert a ((+) a ` B)

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T = insert a ((+) a ` B)
[PROOF STEP]
have "affine hull T = (\<lambda>x. a+x) ` span B"
[PROOF STATE]
proof (prove)
using this:
T = insert a ((+) a ` B)

goal (1 subgoal):
 1. affine hull T = (+) a ` span B
[PROOF STEP]
using affine_hull_insert_span_gen[of a "((\<lambda>x. a+x) ` B)"] translation_assoc[of "-a" a B]
[PROOF STATE]
proof (prove)
using this:
T = insert a ((+) a ` B)
affine hull insert a ((+) a ` B) = (+) a ` span ((+) (- a) ` (+) a ` B)
(+) (- a) ` (+) a ` B = (+) (a + - a) ` B

goal (1 subgoal):
 1. affine hull T = (+) a ` span B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine hull T = (+) a ` span B

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
affine hull T = (+) a ` span B
[PROOF STEP]
have "V \<subseteq> affine hull T"
[PROOF STATE]
proof (prove)
using this:
affine hull T = (+) a ` span B

goal (1 subgoal):
 1. V \<subseteq> affine hull T
[PROOF STEP]
using B assms translation_inverse_subset[of a V "span B"]
[PROOF STATE]
proof (prove)
using this:
affine hull T = (+) a ` span B
(+) (- a) ` (S - {a}) \<subseteq> B \<and> B \<subseteq> (+) (- a) ` V \<and> independent B \<and> (+) (- a) ` V \<subseteq> span B
\<not> affine_dependent S
S \<subseteq> V
S \<noteq> {}
(+) (- a) ` V \<subseteq> span B \<Longrightarrow> V \<subseteq> (+) a ` span B

goal (1 subgoal):
 1. V \<subseteq> affine hull T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V \<subseteq> affine hull T

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
V \<subseteq> affine hull T

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
have "T \<subseteq> V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T \<subseteq> V
[PROOF STEP]
using T_def B a assms
[PROOF STATE]
proof (prove)
using this:
T = (+) a ` insert (0::'n) B
(+) (- a) ` (S - {a}) \<subseteq> B \<and> B \<subseteq> (+) (- a) ` V \<and> independent B \<and> (+) (- a) ` V \<subseteq> span B
a \<in> S
\<not> affine_dependent S
S \<subseteq> V
S \<noteq> {}

goal (1 subgoal):
 1. T \<subseteq> V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
T \<subseteq> V

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
V \<subseteq> affine hull T
T \<subseteq> V
[PROOF STEP]
have "affine hull T = affine hull V"
[PROOF STATE]
proof (prove)
using this:
V \<subseteq> affine hull T
T \<subseteq> V

goal (1 subgoal):
 1. affine hull T = affine hull V
[PROOF STEP]
by (metis Int_absorb1 Int_absorb2 hull_hull hull_mono)
[PROOF STATE]
proof (state)
this:
affine hull T = affine hull V

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
affine hull T = affine hull V

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
have "S \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> T
[PROOF STEP]
using T_def B translation_inverse_subset[of a "S-{a}" B]
[PROOF STATE]
proof (prove)
using this:
T = (+) a ` insert (0::'n) B
(+) (- a) ` (S - {a}) \<subseteq> B \<and> B \<subseteq> (+) (- a) ` V \<and> independent B \<and> (+) (- a) ` V \<subseteq> span B
(+) (- a) ` (S - {a}) \<subseteq> B \<Longrightarrow> S - {a} \<subseteq> (+) a ` B

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

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
S \<subseteq> T

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
have "\<not> affine_dependent T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> affine_dependent T
[PROOF STEP]
using T_def affine_dependent_translation_eq[of "insert 0 B"]
      affine_dependent_imp_dependent2 B
[PROOF STATE]
proof (prove)
using this:
T = (+) a ` insert (0::'n) B
affine_dependent (insert (0::'n) B) = affine_dependent ((+) ?a ` insert (0::'n) B)
affine_dependent (insert (0::?'a) ?S) \<Longrightarrow> dependent ?S
(+) (- a) ` (S - {a}) \<subseteq> B \<and> B \<subseteq> (+) (- a) ` V \<and> independent B \<and> (+) (- a) ` V \<subseteq> span B

goal (1 subgoal):
 1. \<not> affine_dependent T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> affine_dependent T

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
affine hull T = affine hull V
S \<subseteq> T
\<not> affine_dependent T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
affine hull T = affine hull V
S \<subseteq> T
\<not> affine_dependent T

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
using \<open>T \<subseteq> V\<close>
[PROOF STATE]
proof (prove)
using this:
affine hull T = affine hull V
S \<subseteq> T
\<not> affine_dependent T
T \<subseteq> V

goal (1 subgoal):
 1. \<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vector_derivative_cong_eq:
  assumes "eventually (\<lambda>x. x \<in> A \<longrightarrow> f x = g x) (nhds x)" "x = y" "A = B" "x \<in> A"
  shows   "vector_derivative f (at x within A) = vector_derivative g (at y within B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative f (at x within A) = vector_derivative g (at y within B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vector_derivative f (at x within A) = vector_derivative g (at y within B)
[PROOF STEP]
have "f x = g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
using assms eventually_nhds_x_imp_x
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds x. x \<in> A \<longrightarrow> f x = g x
x = y
A = B
x \<in> A
eventually ?P (nhds ?x) \<Longrightarrow> ?P ?x

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f x = g x

goal (1 subgoal):
 1. vector_derivative f (at x within A) = vector_derivative g (at y within B)
[PROOF STEP]
hence "(\<lambda>D. (f has_vector_derivative D) (at x within A)) =
           (\<lambda>D. (g has_vector_derivative D) (at x within A))"
[PROOF STATE]
proof (prove)
using this:
f x = g x

goal (1 subgoal):
 1. (\<lambda>D. (f has_vector_derivative D) (at x within A)) = (\<lambda>D. (g has_vector_derivative D) (at x within A))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f x = g x
\<forall>\<^sub>F x in nhds x. x \<in> A \<longrightarrow> f x = g x
x = y
A = B
x \<in> A

goal (1 subgoal):
 1. (\<lambda>D. (f has_vector_derivative D) (at x within A)) = (\<lambda>D. (g has_vector_derivative D) (at x within A))
[PROOF STEP]
by (intro ext has_vector_derivative_cong_ev refl assms) simp_all
[PROOF STATE]
proof (state)
this:
(\<lambda>D. (f has_vector_derivative D) (at x within A)) = (\<lambda>D. (g has_vector_derivative D) (at x within A))

goal (1 subgoal):
 1. vector_derivative f (at x within A) = vector_derivative g (at y within B)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>D. (f has_vector_derivative D) (at x within A)) = (\<lambda>D. (g has_vector_derivative D) (at x within A))

goal (1 subgoal):
 1. vector_derivative f (at x within A) = vector_derivative g (at y within B)
[PROOF STEP]
by (simp add: vector_derivative_def assms)
[PROOF STATE]
proof (state)
this:
vector_derivative f (at x within A) = vector_derivative g (at y within B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_nth_fps_expansion:
  fixes f :: "complex \<Rightarrow> complex"
  assumes "f has_fps_expansion F"
  shows   "fps_nth F n = (deriv ^^ n) f 0 / fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_nth F n = (deriv ^^ n) f 0 / fact n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_nth F n = (deriv ^^ n) f 0 / fact n
[PROOF STEP]
have "fps_nth F n = (deriv ^^ n) (eval_fps F) 0 / fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_nth F n = (deriv ^^ n) (eval_fps F) 0 / fact n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f has_fps_expansion F

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

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

goal (1 subgoal):
 1. fps_nth F n = (deriv ^^ n) f 0 / fact n
[PROOF STEP]
have "(deriv ^^ n) (eval_fps F) 0 = (deriv ^^ n) f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv ^^ n) (eval_fps F) 0 = (deriv ^^ n) f 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f has_fps_expansion F

goal (1 subgoal):
 1. (deriv ^^ n) (eval_fps F) 0 = (deriv ^^ n) f 0
[PROOF STEP]
by (intro higher_deriv_cong_ev) (auto simp: has_fps_expansion_def)
[PROOF STATE]
proof (state)
this:
(deriv ^^ n) (eval_fps F) 0 = (deriv ^^ n) f 0

goal (1 subgoal):
 1. fps_nth F n = (deriv ^^ n) f 0 / fact n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fps_nth F n = (deriv ^^ n) f 0 / fact n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fps_nth F n = (deriv ^^ n) f 0 / fact n

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_convex_hull_iff_convex_hull_list: assumes Vs: "Vs \<subseteq> carrier_vec n"
  and id': "Vs = set Vsl'"
shows "convex_hull Vs = convex_hull_list Vsl'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have fin: "finite Vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite Vs
[PROOF STEP]
unfolding id'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set Vsl')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite Vs

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
from finite_distinct_list fin
[PROOF STATE]
proof (chain)
picking this:
finite ?A \<Longrightarrow> \<exists>xs. set xs = ?A \<and> distinct xs
finite Vs
[PROOF STEP]
obtain Vsl
    where id: "Vs = set Vsl" and dist: "distinct Vsl"
[PROOF STATE]
proof (prove)
using this:
finite ?A \<Longrightarrow> \<exists>xs. set xs = ?A \<and> distinct xs
finite Vs

goal (1 subgoal):
 1. (\<And>Vsl. \<lbrakk>Vs = set Vsl; distinct Vsl\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Vs = set Vsl
distinct Vsl

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
from Vs id
[PROOF STATE]
proof (chain)
picking this:
Vs \<subseteq> carrier_vec n
Vs = set Vsl
[PROOF STEP]
have Vsl: "set Vsl \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
Vs \<subseteq> carrier_vec n
Vs = set Vsl

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

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
set Vsl \<subseteq> carrier_vec n

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
fix c :: "nat \<Rightarrow> 'a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have "distinct Vsl \<Longrightarrow>(\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x Vsl))) =
                          sum c {0..<length Vsl}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct Vsl \<Longrightarrow> (\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x Vsl))) = sum c {0..<length Vsl}
[PROOF STEP]
proof (induction Vsl rule: rev_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
case (snoc v Vsl)
[PROOF STATE]
proof (state)
this:
distinct Vsl \<Longrightarrow> (\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x Vsl))) = sum c {0..<length Vsl}
distinct (Vsl @ [v])

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
let ?coef = "\<lambda> x. sum_list (map c (find_indices x (Vsl @ [v])))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
let ?coef' = "\<lambda> x. sum_list (map c (find_indices x Vsl))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
have dist: "distinct Vsl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct Vsl
[PROOF STEP]
using snoc.prems
[PROOF STATE]
proof (prove)
using this:
distinct (Vsl @ [v])

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

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
have "sum ?coef (set (Vsl @ [v])) = sum_list (map ?coef (Vsl @ [v]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set (Vsl @ [v]). sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<leftarrow>Vsl @ [v]. sum_list (map c (find_indices x (Vsl @ [v]))))
[PROOF STEP]
by (rule sum.distinct_set_conv_list[OF snoc.prems, of ?coef])
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (Vsl @ [v]). sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<leftarrow>Vsl @ [v]. sum_list (map c (find_indices x (Vsl @ [v]))))

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (Vsl @ [v]). sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<leftarrow>Vsl @ [v]. sum_list (map c (find_indices x (Vsl @ [v]))))

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
have "\<dots> = sum_list (map ?coef Vsl) + ?coef v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>Vsl @ [v]. sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<leftarrow>Vsl. sum_list (map c (find_indices x (Vsl @ [v])))) + sum_list (map c (find_indices v (Vsl @ [v])))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>Vsl @ [v]. sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<leftarrow>Vsl. sum_list (map c (find_indices x (Vsl @ [v])))) + sum_list (map c (find_indices v (Vsl @ [v])))

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>Vsl @ [v]. sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<leftarrow>Vsl. sum_list (map c (find_indices x (Vsl @ [v])))) + sum_list (map c (find_indices v (Vsl @ [v])))

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
have "sum_list (map ?coef Vsl) = sum ?coef (set Vsl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>Vsl. sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x (Vsl @ [v]))))
[PROOF STEP]
using sum.distinct_set_conv_list[OF dist, of ?coef]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<leftarrow>Vsl. sum_list (map c (find_indices x (Vsl @ [v]))))

goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>Vsl. sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x (Vsl @ [v]))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>Vsl. sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x (Vsl @ [v]))))

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>Vsl. sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x (Vsl @ [v]))))

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
have "\<dots> = sum ?coef' (set Vsl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x Vsl)))
[PROOF STEP]
proof (intro R.finsum_restrict[of ?coef] restrict_ext, standard)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> set Vsl \<Longrightarrow> sum_list (map c (find_indices x (Vsl @ [v]))) = sum_list (map c (find_indices x Vsl))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> set Vsl \<Longrightarrow> sum_list (map c (find_indices x (Vsl @ [v]))) = sum_list (map c (find_indices x Vsl))
[PROOF STEP]
assume "x \<in> set Vsl"
[PROOF STATE]
proof (state)
this:
x \<in> set Vsl

goal (1 subgoal):
 1. \<And>x. x \<in> set Vsl \<Longrightarrow> sum_list (map c (find_indices x (Vsl @ [v]))) = sum_list (map c (find_indices x Vsl))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> set Vsl
[PROOF STEP]
obtain i where i: "i < length Vsl" and x: "x = Vsl ! i"
[PROOF STATE]
proof (prove)
using this:
x \<in> set Vsl

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < length Vsl; x = Vsl ! i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using in_set_conv_nth[of x Vsl]
[PROOF STATE]
proof (prove)
using this:
x \<in> set Vsl
(x \<in> set Vsl) = (\<exists>i<length Vsl. Vsl ! i = x)

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < length Vsl; x = Vsl ! i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i < length Vsl
x = Vsl ! i

goal (1 subgoal):
 1. \<And>x. x \<in> set Vsl \<Longrightarrow> sum_list (map c (find_indices x (Vsl @ [v]))) = sum_list (map c (find_indices x Vsl))
[PROOF STEP]
hence "(Vsl @ [v]) ! i = x"
[PROOF STATE]
proof (prove)
using this:
i < length Vsl
x = Vsl ! i

goal (1 subgoal):
 1. (Vsl @ [v]) ! i = x
[PROOF STEP]
by (simp add: append_Cons_nth_left)
[PROOF STATE]
proof (state)
this:
(Vsl @ [v]) ! i = x

goal (1 subgoal):
 1. \<And>x. x \<in> set Vsl \<Longrightarrow> sum_list (map c (find_indices x (Vsl @ [v]))) = sum_list (map c (find_indices x Vsl))
[PROOF STEP]
hence "?coef x = c i"
[PROOF STATE]
proof (prove)
using this:
(Vsl @ [v]) ! i = x

goal (1 subgoal):
 1. sum_list (map c (find_indices x (Vsl @ [v]))) = c i
[PROOF STEP]
using distinct_list_find_indices[OF _ _ snoc.prems] i
[PROOF STATE]
proof (prove)
using this:
(Vsl @ [v]) ! i = x
\<lbrakk>?i < length (Vsl @ [v]); (Vsl @ [v]) ! ?i = ?x\<rbrakk> \<Longrightarrow> find_indices ?x (Vsl @ [v]) = [?i]
i < length Vsl

goal (1 subgoal):
 1. sum_list (map c (find_indices x (Vsl @ [v]))) = c i
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
sum_list (map c (find_indices x (Vsl @ [v]))) = c i

goal (1 subgoal):
 1. \<And>x. x \<in> set Vsl \<Longrightarrow> sum_list (map c (find_indices x (Vsl @ [v]))) = sum_list (map c (find_indices x Vsl))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map c (find_indices x (Vsl @ [v]))) = c i

goal (1 subgoal):
 1. \<And>x. x \<in> set Vsl \<Longrightarrow> sum_list (map c (find_indices x (Vsl @ [v]))) = sum_list (map c (find_indices x Vsl))
[PROOF STEP]
have  "c i = ?coef' x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c i = sum_list (map c (find_indices x Vsl))
[PROOF STEP]
using distinct_list_find_indices[OF i _ dist] x
[PROOF STATE]
proof (prove)
using this:
Vsl ! i = ?x \<Longrightarrow> find_indices ?x Vsl = [i]
x = Vsl ! i

goal (1 subgoal):
 1. c i = sum_list (map c (find_indices x Vsl))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c i = sum_list (map c (find_indices x Vsl))

goal (1 subgoal):
 1. \<And>x. x \<in> set Vsl \<Longrightarrow> sum_list (map c (find_indices x (Vsl @ [v]))) = sum_list (map c (find_indices x Vsl))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_list (map c (find_indices x (Vsl @ [v]))) = sum_list (map c (find_indices x Vsl))
[PROOF STEP]
show "?coef x = ?coef' x"
[PROOF STATE]
proof (prove)
using this:
sum_list (map c (find_indices x (Vsl @ [v]))) = sum_list (map c (find_indices x Vsl))

goal (1 subgoal):
 1. sum_list (map c (find_indices x (Vsl @ [v]))) = sum_list (map c (find_indices x Vsl))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum_list (map c (find_indices x (Vsl @ [v]))) = sum_list (map c (find_indices x Vsl))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x Vsl)))

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x (Vsl @ [v])))) = (\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x Vsl)))

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
have "\<dots> = sum c {0..<length Vsl}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x Vsl))) = sum c {0..<length Vsl}
[PROOF STEP]
by (rule snoc.IH[OF dist])
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x Vsl))) = sum c {0..<length Vsl}

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x Vsl))) = sum c {0..<length Vsl}

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
have "?coef v = c (length Vsl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map c (find_indices v (Vsl @ [v]))) = c (length Vsl)
[PROOF STEP]
using distinct_list_find_indices[OF _ _ snoc.prems, of "length Vsl" v]
          nth_append_length
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length Vsl < length (Vsl @ [v]); (Vsl @ [v]) ! length Vsl = v\<rbrakk> \<Longrightarrow> find_indices v (Vsl @ [v]) = [length Vsl]
(?xs @ ?x # ?ys) ! length ?xs = ?x

goal (1 subgoal):
 1. sum_list (map c (find_indices v (Vsl @ [v]))) = c (length Vsl)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (map c (find_indices v (Vsl @ [v]))) = c (length Vsl)

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
 2. \<And>x xs. \<lbrakk>distinct xs \<Longrightarrow> (\<Sum>x\<in>set xs. sum_list (map c (find_indices x xs))) = sum c {0..<length xs}; distinct (xs @ [x])\<rbrakk> \<Longrightarrow> (\<Sum>xa\<in>set (xs @ [x]). sum_list (map c (find_indices xa (xs @ [x])))) = sum c {0..<length (xs @ [x])}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x\<in>set (Vsl @ [v]). sum_list (map c (find_indices x (Vsl @ [v])))) = sum c {0..<length Vsl} + c (length Vsl)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>set (Vsl @ [v]). sum_list (map c (find_indices x (Vsl @ [v])))) = sum c {0..<length Vsl} + c (length Vsl)

goal (1 subgoal):
 1. (\<Sum>x\<in>set (Vsl @ [v]). sum_list (map c (find_indices x (Vsl @ [v])))) = sum c {0..<length (Vsl @ [v])}
[PROOF STEP]
using sum.atLeast0_lessThan_Suc
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>set (Vsl @ [v]). sum_list (map c (find_indices x (Vsl @ [v])))) = sum c {0..<length Vsl} + c (length Vsl)
sum ?g {0..<Suc ?n} = sum ?g {0..<?n} + ?g ?n

goal (1 subgoal):
 1. (\<Sum>x\<in>set (Vsl @ [v]). sum_list (map c (find_indices x (Vsl @ [v])))) = sum c {0..<length (Vsl @ [v])}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (Vsl @ [v]). sum_list (map c (find_indices x (Vsl @ [v])))) = sum c {0..<length (Vsl @ [v])}

goal (1 subgoal):
 1. distinct [] \<Longrightarrow> (\<Sum>x\<in>set []. sum_list (map c (find_indices x []))) = sum c {0..<length []}
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
distinct Vsl \<Longrightarrow> (\<Sum>x\<in>set Vsl. sum_list (map c (find_indices x Vsl))) = sum c {0..<length Vsl}

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
distinct Vsl \<Longrightarrow> (\<Sum>x\<in>set Vsl. sum_list (map ?c5 (find_indices x Vsl))) = sum ?c5 {0..<length Vsl}

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
note sum_sumlist = this
[PROOF STATE]
proof (state)
this:
distinct Vsl \<Longrightarrow> (\<Sum>x\<in>set Vsl. sum_list (map ?c5 (find_indices x Vsl))) = sum ?c5 {0..<length Vsl}

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
distinct Vsl \<Longrightarrow> (\<Sum>x\<in>set Vsl. sum_list (map ?c5 (find_indices x Vsl))) = sum ?c5 {0..<length Vsl}

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
assume "b \<in> convex_hull_list Vsl"
[PROOF STATE]
proof (state)
this:
b \<in> convex_hull_list Vsl

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in> convex_hull_list Vsl
[PROOF STEP]
obtain c where b: "lincomb_list c Vsl = b" and c: "(\<forall> i < length Vsl. c i \<ge> 0)"
      and c1: "sum c {0..<length Vsl} = 1"
[PROOF STATE]
proof (prove)
using this:
b \<in> convex_hull_list Vsl

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>lincomb_list c Vsl = b; \<forall>i<length Vsl. (0::'a) \<le> c i; sum c {0..<length Vsl} = (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding convex_hull_list_def convex_lincomb_list_def nonneg_lincomb_list_def
[PROOF STATE]
proof (prove)
using this:
b \<in> {x. \<exists>c. (lincomb_list c Vsl = x \<and> (\<forall>i<length Vsl. (0::'a) \<le> c i)) \<and> sum c {0..<length Vsl} = (1::'a)}

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>lincomb_list c Vsl = b; \<forall>i<length Vsl. (0::'a) \<le> c i; sum c {0..<length Vsl} = (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb_list c Vsl = b
\<forall>i<length Vsl. (0::'a) \<le> c i
sum c {0..<length Vsl} = (1::'a)

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have "convex_lincomb (mk_coeff Vsl c) Vs b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_lincomb (mk_coeff Vsl c) Vs b
[PROOF STEP]
unfolding b[symmetric] convex_lincomb_def nonneg_lincomb_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lincomb (mk_coeff Vsl c) Vs = lincomb_list c Vsl \<and> mk_coeff Vsl c ` Vs \<subseteq> Collect ((\<le>) (0::'a))) \<and> sum (mk_coeff Vsl c) Vs = (1::'a)
[PROOF STEP]
apply (subst lincomb_list_as_lincomb[OF Vsl])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lincomb (mk_coeff Vsl c) Vs = lincomb (mk_coeff Vsl c) (set Vsl) \<and> mk_coeff Vsl c ` Vs \<subseteq> Collect ((\<le>) (0::'a))) \<and> sum (mk_coeff Vsl c) Vs = (1::'a)
[PROOF STEP]
by (insert c c1, auto simp: id mk_coeff_def dist sum_sumlist intro!: sum_list_nonneg)
[PROOF STATE]
proof (state)
this:
convex_lincomb (mk_coeff Vsl c) Vs b

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
hence "b \<in> convex_hull Vs"
[PROOF STATE]
proof (prove)
using this:
convex_lincomb (mk_coeff Vsl c) Vs b

goal (1 subgoal):
 1. b \<in> convex_hull Vs
[PROOF STEP]
unfolding convex_hull_def convex_lincomb_def
[PROOF STATE]
proof (prove)
using this:
nonneg_lincomb (mk_coeff Vsl c) Vs b \<and> sum (mk_coeff Vsl c) Vs = (1::'a)

goal (1 subgoal):
 1. b \<in> {x. \<exists>Ws c. finite Ws \<and> Ws \<subseteq> Vs \<and> nonneg_lincomb c Ws x \<and> sum c Ws = (1::'a)}
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
nonneg_lincomb (mk_coeff Vsl c) Vs b \<and> sum (mk_coeff Vsl c) Vs = (1::'a)
finite Vs

goal (1 subgoal):
 1. b \<in> {x. \<exists>Ws c. finite Ws \<and> Ws \<subseteq> Vs \<and> nonneg_lincomb c Ws x \<and> sum c Ws = (1::'a)}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b \<in> convex_hull Vs

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?b5 \<in> convex_hull_list Vsl \<Longrightarrow> ?b5 \<in> convex_hull Vs

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?b5 \<in> convex_hull_list Vsl \<Longrightarrow> ?b5 \<in> convex_hull Vs

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?b5 \<in> convex_hull_list Vsl \<Longrightarrow> ?b5 \<in> convex_hull Vs

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
assume "b \<in> convex_hull Vs"
[PROOF STATE]
proof (state)
this:
b \<in> convex_hull Vs

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in> convex_hull Vs
[PROOF STEP]
obtain c Ws where Ws: "Ws \<subseteq> Vs" and b: "lincomb c Ws = b"
      and c: "c ` Ws \<subseteq> {x. x \<ge> 0}" and c1: "sum c Ws = 1"
[PROOF STATE]
proof (prove)
using this:
b \<in> convex_hull Vs

goal (1 subgoal):
 1. (\<And>Ws c. \<lbrakk>Ws \<subseteq> Vs; lincomb c Ws = b; c ` Ws \<subseteq> {x. (0::'a) \<le> x}; sum c Ws = (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding convex_hull_def convex_lincomb_def nonneg_lincomb_def
[PROOF STATE]
proof (prove)
using this:
b \<in> {x. \<exists>Ws c. finite Ws \<and> Ws \<subseteq> Vs \<and> (lincomb c Ws = x \<and> c ` Ws \<subseteq> Collect ((\<le>) (0::'a))) \<and> sum c Ws = (1::'a)}

goal (1 subgoal):
 1. (\<And>Ws c. \<lbrakk>Ws \<subseteq> Vs; lincomb c Ws = b; c ` Ws \<subseteq> {x. (0::'a) \<le> x}; sum c Ws = (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ws \<subseteq> Vs
lincomb c Ws = b
c ` Ws \<subseteq> {x. (0::'a) \<le> x}
sum c Ws = (1::'a)

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
let ?d = "\<lambda> x. if x \<in> Ws then c x else 0"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have "lincomb ?d Vs = lincomb c Ws + lincomb (\<lambda> x. 0) (Vs - Ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = lincomb c Ws + lincomb (\<lambda>x. 0::'a) (Vs - Ws)
[PROOF STEP]
using lincomb_union2[OF _ _ Diff_disjoint[of Ws Vs], of c "\<lambda> x. 0"]
        fin Vs Diff_partition[OF Ws]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (Ws \<union> (Vs - Ws)); Ws \<union> (Vs - Ws) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb c Ws + lincomb (\<lambda>x. 0::'a) (Vs - Ws) = lincomb (\<lambda>v. if v \<in> Ws then c v else (0::'a)) (Ws \<union> (Vs - Ws))
finite Vs
Vs \<subseteq> carrier_vec n
Ws \<union> (Vs - Ws) = Vs

goal (1 subgoal):
 1. lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = lincomb c Ws + lincomb (\<lambda>x. 0::'a) (Vs - Ws)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = lincomb c Ws + lincomb (\<lambda>x. 0::'a) (Vs - Ws)

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = lincomb c Ws + lincomb (\<lambda>x. 0::'a) (Vs - Ws)

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have "lincomb (\<lambda> x. 0) (Vs - Ws) = 0\<^sub>v n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb (\<lambda>x. 0::'a) (Vs - Ws) = 0\<^sub>v n
[PROOF STEP]
using lincomb_zero[of "Vs - Ws" "\<lambda> x. 0"] Vs
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Vs - Ws \<subseteq> carrier_vec n; (\<lambda>x. 0::'a) \<in> Vs - Ws \<rightarrow> {0::'a}\<rbrakk> \<Longrightarrow> lincomb (\<lambda>x. 0::'a) (Vs - Ws) = 0\<^sub>v n
Vs \<subseteq> carrier_vec n

goal (1 subgoal):
 1. lincomb (\<lambda>x. 0::'a) (Vs - Ws) = 0\<^sub>v n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb (\<lambda>x. 0::'a) (Vs - Ws) = 0\<^sub>v n

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = lincomb c Ws + 0\<^sub>v n
[PROOF STEP]
have "lincomb ?d Vs = b"
[PROOF STATE]
proof (prove)
using this:
lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = lincomb c Ws + 0\<^sub>v n

goal (1 subgoal):
 1. lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = b
[PROOF STEP]
using b lincomb_closed Vs Ws
[PROOF STATE]
proof (prove)
using this:
lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = lincomb c Ws + 0\<^sub>v n
lincomb c Ws = b
?S \<subseteq> carrier_vec n \<Longrightarrow> lincomb ?a ?S \<in> carrier_vec n
Vs \<subseteq> carrier_vec n
Ws \<subseteq> Vs

goal (1 subgoal):
 1. lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = b

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = b

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have "?d ` Vs \<subseteq> {t. t \<ge> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<in> Ws then c x else (0::'a)) ` Vs \<subseteq> {t. (0::'a) \<le> t}
[PROOF STEP]
using c
[PROOF STATE]
proof (prove)
using this:
c ` Ws \<subseteq> {x. (0::'a) \<le> x}

goal (1 subgoal):
 1. (\<lambda>x. if x \<in> Ws then c x else (0::'a)) ` Vs \<subseteq> {t. (0::'a) \<le> t}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<in> Ws then c x else (0::'a)) ` Vs \<subseteq> {t. (0::'a) \<le> t}

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<in> Ws then c x else (0::'a)) ` Vs \<subseteq> {t. (0::'a) \<le> t}

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have "sum ?d Vs = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>Vs. if x \<in> Ws then c x else (0::'a)) = (1::'a)
[PROOF STEP]
using  c1 R.extend_sum[OF fin Ws]
[PROOF STATE]
proof (prove)
using this:
sum c Ws = (1::'a)
(\<Sum>x\<in>Vs. if x \<in> Ws then ?a x else (0::'a)) = sum ?a Ws

goal (1 subgoal):
 1. (\<Sum>x\<in>Vs. if x \<in> Ws then c x else (0::'a)) = (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>Vs. if x \<in> Ws then c x else (0::'a)) = (1::'a)

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = b
(\<lambda>x. if x \<in> Ws then c x else (0::'a)) ` Vs \<subseteq> {t. (0::'a) \<le> t}
(\<Sum>x\<in>Vs. if x \<in> Ws then c x else (0::'a)) = (1::'a)
[PROOF STEP]
have "\<exists> c. convex_lincomb c Vs b"
[PROOF STATE]
proof (prove)
using this:
lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = b
(\<lambda>x. if x \<in> Ws then c x else (0::'a)) ` Vs \<subseteq> {t. (0::'a) \<le> t}
(\<Sum>x\<in>Vs. if x \<in> Ws then c x else (0::'a)) = (1::'a)

goal (1 subgoal):
 1. \<exists>c. convex_lincomb c Vs b
[PROOF STEP]
unfolding convex_lincomb_def nonneg_lincomb_def
[PROOF STATE]
proof (prove)
using this:
lincomb (\<lambda>x. if x \<in> Ws then c x else (0::'a)) Vs = b
(\<lambda>x. if x \<in> Ws then c x else (0::'a)) ` Vs \<subseteq> {t. (0::'a) \<le> t}
(\<Sum>x\<in>Vs. if x \<in> Ws then c x else (0::'a)) = (1::'a)

goal (1 subgoal):
 1. \<exists>c. (lincomb c Vs = b \<and> c ` Vs \<subseteq> Collect ((\<le>) (0::'a))) \<and> sum c Vs = (1::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>c. convex_lincomb c Vs b

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?b5 \<in> convex_hull Vs \<Longrightarrow> \<exists>c. convex_lincomb c Vs ?b5

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?b5 \<in> convex_hull Vs \<Longrightarrow> \<exists>c. convex_lincomb c Vs ?b5

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?b5 \<in> convex_hull Vs \<Longrightarrow> \<exists>c. convex_lincomb c Vs ?b5

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
assume "\<exists> c. convex_lincomb c Vs b"
[PROOF STATE]
proof (state)
this:
\<exists>c. convex_lincomb c Vs b

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>c. convex_lincomb c Vs b
[PROOF STEP]
obtain c where b: "lincomb c Vs = b" and c: "c ` Vs \<subseteq> {x. x \<ge> 0}"
      and c1: "sum c Vs = 1"
[PROOF STATE]
proof (prove)
using this:
\<exists>c. convex_lincomb c Vs b

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>lincomb c Vs = b; c ` Vs \<subseteq> {x. (0::'a) \<le> x}; sum c Vs = (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding convex_lincomb_def nonneg_lincomb_def
[PROOF STATE]
proof (prove)
using this:
\<exists>c. (lincomb c Vs = b \<and> c ` Vs \<subseteq> Collect ((\<le>) (0::'a))) \<and> sum c Vs = (1::'a)

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>lincomb c Vs = b; c ` Vs \<subseteq> {x. (0::'a) \<le> x}; sum c Vs = (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb c Vs = b
c ` Vs \<subseteq> {x. (0::'a) \<le> x}
sum c Vs = (1::'a)

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
from lincomb_as_lincomb_list_distinct[OF Vsl dist, of c]
[PROOF STATE]
proof (chain)
picking this:
lincomb c (set Vsl) = lincomb_list (\<lambda>i. c (Vsl ! i)) Vsl
[PROOF STEP]
have b: "lincomb_list (\<lambda>i. c (Vsl ! i)) Vsl = b"
[PROOF STATE]
proof (prove)
using this:
lincomb c (set Vsl) = lincomb_list (\<lambda>i. c (Vsl ! i)) Vsl

goal (1 subgoal):
 1. lincomb_list (\<lambda>i. c (Vsl ! i)) Vsl = b
[PROOF STEP]
unfolding b[symmetric] id
[PROOF STATE]
proof (prove)
using this:
lincomb c (set Vsl) = lincomb_list (\<lambda>i. c (Vsl ! i)) Vsl

goal (1 subgoal):
 1. lincomb_list (\<lambda>i. c (Vsl ! i)) Vsl = lincomb c (set Vsl)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lincomb_list (\<lambda>i. c (Vsl ! i)) Vsl = b

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have "1 = sum c (set Vsl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) = sum c (set Vsl)
[PROOF STEP]
using c1 id
[PROOF STATE]
proof (prove)
using this:
sum c Vs = (1::'a)
Vs = set Vsl

goal (1 subgoal):
 1. (1::'a) = sum c (set Vsl)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1::'a) = sum c (set Vsl)

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) = sum c (set Vsl)

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have "\<dots> = sum_list (map c Vsl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum c (set Vsl) = sum_list (map c Vsl)
[PROOF STEP]
by(rule sum.distinct_set_conv_list[OF dist])
[PROOF STATE]
proof (state)
this:
sum c (set Vsl) = sum_list (map c Vsl)

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum c (set Vsl) = sum_list (map c Vsl)

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have "\<dots> = sum ((!) (map c Vsl)) {0..<length Vsl}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map c Vsl) = sum ((!) (map c Vsl)) {0..<length Vsl}
[PROOF STEP]
using sum_list_sum_nth length_map
[PROOF STATE]
proof (prove)
using this:
sum_list ?xs = sum ((!) ?xs) {0..<length ?xs}
length (map ?f ?xs) = length ?xs

goal (1 subgoal):
 1. sum_list (map c Vsl) = sum ((!) (map c Vsl)) {0..<length Vsl}
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
sum_list (map c Vsl) = sum ((!) (map c Vsl)) {0..<length Vsl}

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map c Vsl) = sum ((!) (map c Vsl)) {0..<length Vsl}

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have "\<dots> = sum (\<lambda> i. c (Vsl ! i)) {0..<length Vsl}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((!) (map c Vsl)) {0..<length Vsl} = (\<Sum>i = 0..<length Vsl. c (Vsl ! i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum ((!) (map c Vsl)) {0..<length Vsl} = (\<Sum>i = 0..<length Vsl. c (Vsl ! i))

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1::'a) = (\<Sum>i = 0..<length Vsl. c (Vsl ! i))
[PROOF STEP]
have sum_1: "(\<Sum>i = 0..<length Vsl. c (Vsl ! i)) = 1"
[PROOF STATE]
proof (prove)
using this:
(1::'a) = (\<Sum>i = 0..<length Vsl. c (Vsl ! i))

goal (1 subgoal):
 1. (\<Sum>i = 0..<length Vsl. c (Vsl ! i)) = (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<length Vsl. c (Vsl ! i)) = (1::'a)

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have "\<exists> c. convex_lincomb_list c Vsl b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>c. convex_lincomb_list c Vsl b
[PROOF STEP]
unfolding convex_lincomb_list_def nonneg_lincomb_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>c. (lincomb_list c Vsl = b \<and> (\<forall>i<length Vsl. (0::'a) \<le> c i)) \<and> sum c {0..<length Vsl} = (1::'a)
[PROOF STEP]
by (intro exI[of _ "\<lambda>i. c (Vsl ! i)"] conjI b sum_1)
        (insert c, force simp: set_conv_nth id)
[PROOF STATE]
proof (state)
this:
\<exists>c. convex_lincomb_list c Vsl b

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
hence "b \<in> convex_hull_list Vsl"
[PROOF STATE]
proof (prove)
using this:
\<exists>c. convex_lincomb_list c Vsl b

goal (1 subgoal):
 1. b \<in> convex_hull_list Vsl
[PROOF STEP]
unfolding convex_hull_list_def
[PROOF STATE]
proof (prove)
using this:
\<exists>c. convex_lincomb_list c Vsl b

goal (1 subgoal):
 1. b \<in> {x. \<exists>c. convex_lincomb_list c Vsl x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<in> convex_hull_list Vsl

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<exists>c. convex_lincomb c Vs ?b5 \<Longrightarrow> ?b5 \<in> convex_hull_list Vsl

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?b5 \<in> convex_hull_list Vsl \<Longrightarrow> ?b5 \<in> convex_hull Vs
?b5 \<in> convex_hull Vs \<Longrightarrow> \<exists>c. convex_lincomb c Vs ?b5
\<exists>c. convex_lincomb c Vs ?b5 \<Longrightarrow> ?b5 \<in> convex_hull_list Vsl
[PROOF STEP]
have "convex_hull Vs = convex_hull_list Vsl"
[PROOF STATE]
proof (prove)
using this:
?b5 \<in> convex_hull_list Vsl \<Longrightarrow> ?b5 \<in> convex_hull Vs
?b5 \<in> convex_hull Vs \<Longrightarrow> \<exists>c. convex_lincomb c Vs ?b5
\<exists>c. convex_lincomb c Vs ?b5 \<Longrightarrow> ?b5 \<in> convex_hull_list Vsl

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
convex_hull Vs = convex_hull_list Vsl

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
convex_hull Vs = convex_hull_list Vsl

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
have "convex_hull_list Vsl = convex_hull_list Vsl'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_hull_list Vsl = convex_hull_list Vsl'
[PROOF STEP]
using convex_hull_list_eq_set[OF Vsl, of Vsl'] id id'
[PROOF STATE]
proof (prove)
using this:
set Vsl = set Vsl' \<Longrightarrow> convex_hull_list Vsl = convex_hull_list Vsl'
Vs = set Vsl
Vs = set Vsl'

goal (1 subgoal):
 1. convex_hull_list Vsl = convex_hull_list Vsl'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
convex_hull_list Vsl = convex_hull_list Vsl'

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
convex_hull Vs = convex_hull_list Vsl'

goal (1 subgoal):
 1. convex_hull Vs = convex_hull_list Vsl'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
convex_hull Vs = convex_hull_list Vsl'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_arc_pos_one:
  assumes n0: "n > 0"
  shows "mat_arc_posI arc_pos (1\<^sub>m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_arc_pos (1\<^sub>m n)
[PROOF STEP]
unfolding mat_arc_posI_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arc_pos (1\<^sub>m n $$ (0, 0))
[PROOF STEP]
unfolding arc_pos_one index_one_mat(1)[OF n0 n0]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arc_pos (if 0 = 0 then 1::'a else (0::'a))
[PROOF STEP]
using arc_pos_one
[PROOF STATE]
proof (prove)
using this:
arc_pos (1::'a)

goal (1 subgoal):
 1. arc_pos (if 0 = 0 then 1::'a else (0::'a))
[PROOF STEP]
by simp


[STATEMENT]
lemma markedElementsEmptyImpliesMarkedElementsToEmpty:
  assumes "markedElements M = []"
  shows "markedElementsTo e M = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. markedElementsTo e M = []
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
markedElements M = []

goal (1 subgoal):
 1. markedElementsTo e M = []
[PROOF STEP]
using markedElementsToArePrefixOfMarkedElements [of "e" "M"]
[PROOF STATE]
proof (prove)
using this:
markedElements M = []
isPrefix (markedElementsTo e M) (markedElements M)

goal (1 subgoal):
 1. markedElementsTo e M = []
[PROOF STEP]
unfolding isPrefix_def
[PROOF STATE]
proof (prove)
using this:
markedElements M = []
\<exists>s. markedElementsTo e M @ s = markedElements M

goal (1 subgoal):
 1. markedElementsTo e M = []
[PROOF STEP]
by auto