[STATEMENT]
lemma aff_dim_empty:
  fixes S :: "'n::euclidean_space set"
  shows "S = {} \<longleftrightarrow> aff_dim S = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S = {}) = (aff_dim S = - 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (S = {}) = (aff_dim S = - 1)
[PROOF STEP]
obtain B where *: "affine hull B = affine hull S"
    and "\<not> affine_dependent B"
    and "int (card B) = aff_dim S + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>affine hull B = affine hull S; \<not> affine_dependent B; int (card B) = aff_dim S + 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using aff_dim_basis_exists
[PROOF STATE]
proof (prove)
using this:
\<exists>B. affine hull B = affine hull ?V \<and> \<not> affine_dependent B \<and> int (card B) = aff_dim ?V + 1

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>affine hull B = affine hull S; \<not> affine_dependent B; int (card B) = aff_dim S + 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine hull B = affine hull S
\<not> affine_dependent B
int (card B) = aff_dim S + 1

goal (1 subgoal):
 1. (S = {}) = (aff_dim S = - 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
affine hull B = affine hull S
\<not> affine_dependent B
int (card B) = aff_dim S + 1

goal (1 subgoal):
 1. (S = {}) = (aff_dim S = - 1)
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
affine hull B = affine hull S
[PROOF STEP]
have "S = {} \<longleftrightarrow> B = {}"
[PROOF STATE]
proof (prove)
using this:
affine hull B = affine hull S

goal (1 subgoal):
 1. (S = {}) = (B = {})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(S = {}) = (B = {})

goal (1 subgoal):
 1. (S = {}) = (aff_dim S = - 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
affine hull B = affine hull S
\<not> affine_dependent B
int (card B) = aff_dim S + 1
(S = {}) = (B = {})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
affine hull B = affine hull S
\<not> affine_dependent B
int (card B) = aff_dim S + 1
(S = {}) = (B = {})

goal (1 subgoal):
 1. (S = {}) = (aff_dim S = - 1)
[PROOF STEP]
using aff_independent_finite[of B] card_gt_0_iff[of B]
[PROOF STATE]
proof (prove)
using this:
affine hull B = affine hull S
\<not> affine_dependent B
int (card B) = aff_dim S + 1
(S = {}) = (B = {})
\<not> affine_dependent B \<Longrightarrow> finite B
(0 < card B) = (B \<noteq> {} \<and> finite B)

goal (1 subgoal):
 1. (S = {}) = (aff_dim S = - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(S = {}) = (aff_dim S = - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma violations_0_implies_all_subterms_0:
  assumes
    "count_violations t = 0"
  shows
    "\<forall>i \<in> {0..<length t}. (if postrecording_event t i
                                 then card {j \<in> {i+1..<length t}. prerecording_event t j}
                                 else 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{0..<length t}. (if postrecording_event t i then card {j \<in> {i + 1..<length t}. prerecording_event t j} else 0) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i\<in>{0..<length t}. (if postrecording_event t i then card {j \<in> {i + 1..<length t}. prerecording_event t j} else 0) = 0
[PROOF STEP]
have "sum (\<lambda>i. if postrecording_event t i
                                 then card {j \<in> {i+1..<length t}. prerecording_event t j}
                                 else 0)
        {0..<length t} = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<length t. if postrecording_event t i then card {j \<in> {i + 1..<length t}. prerecording_event t j} else 0) = 0
[PROOF STEP]
using count_violations_def assms
[PROOF STATE]
proof (prove)
using this:
count_violations ?t = (\<Sum>i = 0..<length ?t. if postrecording_event ?t i then card {j \<in> {i + 1..<length ?t}. prerecording_event ?t j} else 0)
count_violations t = 0

goal (1 subgoal):
 1. (\<Sum>i = 0..<length t. if postrecording_event t i then card {j \<in> {i + 1..<length t}. prerecording_event t j} else 0) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<length t. if postrecording_event t i then card {j \<in> {i + 1..<length t}. prerecording_event t j} else 0) = 0

goal (1 subgoal):
 1. \<forall>i\<in>{0..<length t}. (if postrecording_event t i then card {j \<in> {i + 1..<length t}. prerecording_event t j} else 0) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = 0..<length t. if postrecording_event t i then card {j \<in> {i + 1..<length t}. prerecording_event t j} else 0) = 0
[PROOF STEP]
show "\<forall>i \<in> {0..<length t}. (if postrecording_event t i
                                 then card {j \<in> {i+1..<length t}. prerecording_event t j}
                                 else 0) = 0"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<length t. if postrecording_event t i then card {j \<in> {i + 1..<length t}. prerecording_event t j} else 0) = 0

goal (1 subgoal):
 1. \<forall>i\<in>{0..<length t}. (if postrecording_event t i then card {j \<in> {i + 1..<length t}. prerecording_event t j} else 0) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{0..<length t}. (if postrecording_event t i then card {j \<in> {i + 1..<length t}. prerecording_event t j} else 0) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_triangle_eq_imp_collinear:
  fixes x y :: "'a::real_inner"
  assumes "norm (x + y) = norm x + norm y"
  shows "collinear{0,x,y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear {0::'a, x, y}
[PROOF STEP]
proof (cases "x = 0 \<or> y = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = (0::'a) \<or> y = (0::'a) \<Longrightarrow> collinear {0::'a, x, y}
 2. \<not> (x = (0::'a) \<or> y = (0::'a)) \<Longrightarrow> collinear {0::'a, x, y}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (x = (0::'a) \<or> y = (0::'a))

goal (2 subgoals):
 1. x = (0::'a) \<or> y = (0::'a) \<Longrightarrow> collinear {0::'a, x, y}
 2. \<not> (x = (0::'a) \<or> y = (0::'a)) \<Longrightarrow> collinear {0::'a, x, y}
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
norm (x + y) = norm x + norm y
\<not> (x = (0::'a) \<or> y = (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (x + y) = norm x + norm y
\<not> (x = (0::'a) \<or> y = (0::'a))

goal (1 subgoal):
 1. collinear {0::'a, x, y}
[PROOF STEP]
by (meson norm_cauchy_schwarz_abs_eq norm_cauchy_schwarz_equal norm_triangle_eq)
[PROOF STATE]
proof (state)
this:
collinear {0::'a, x, y}

goal (1 subgoal):
 1. x = (0::'a) \<or> y = (0::'a) \<Longrightarrow> collinear {0::'a, x, y}
[PROOF STEP]
qed (use collinear_lemma in blast)


[STATEMENT]
lemma fls_inverse_deriv':
  fixes a :: "'a::field fls"
  shows "fls_deriv (inverse a) = - fls_deriv a / a\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_deriv (inverse a) = - fls_deriv a / a\<^sup>2
[PROOF STEP]
using fls_inverse_deriv[of a]
[PROOF STATE]
proof (prove)
using this:
fls_deriv (inverse a) = - fls_deriv a * (inverse a)\<^sup>2

goal (1 subgoal):
 1. fls_deriv (inverse a) = - fls_deriv a / a\<^sup>2
[PROOF STEP]
by    (simp add: field_simps)


[STATEMENT]
lemma cauchy_def: "Cauchy S \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m n. m \<ge> N \<and> n \<ge> N \<longrightarrow> dist (S m) (S n) < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cauchy S = (\<forall>e>0. \<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (S m) (S n) < e)
[PROOF STEP]
unfolding Cauchy_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (S m) (S n) < e) = (\<forall>e>0. \<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (S m) (S n) < e)
[PROOF STEP]
by metis


[STATEMENT]
lemma continuous_on_inv_into:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space"
  assumes s: "continuous_on s f" "compact s"
    and f: "inj_on f s"
  shows "continuous_on (f ` s) (the_inv_into s f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (f ` s) (the_inv_into s f)
[PROOF STEP]
by (rule continuous_on_inv[OF s]) (auto simp: the_inv_into_f_f[OF f])


[STATEMENT]
theorem The_0_1_2_Principle:
  assumes "\<And> (f :: three \<Rightarrow> three \<Rightarrow> three) (xs :: three list).
             \<lbrakk> associative f ; xs \<noteq> [] \<rbrakk> \<Longrightarrow> candidate f xs = scanl1 f xs"
      and "associative g"
      and "ys \<noteq> []"
  shows "candidate g ys = scanl1 g ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. candidate g ys = scanl1 g ys
[PROOF STEP]
using Proposition_1 Proposition_2 and assms
[PROOF STATE]
proof (prove)
using this:
(\<And>f xs. \<lbrakk>associative f; xs \<noteq> []\<rbrakk> \<Longrightarrow> candidate f xs = scanl1 f xs) \<Longrightarrow> candidate (@) (map wrap [0..<?n + 1]) = ups ?n
\<lbrakk>\<And>n. candidate (@) (map wrap [0..<n + 1]) = ups n; associative ?g; ?xs \<noteq> []\<rbrakk> \<Longrightarrow> candidate ?g ?xs = scanl1 ?g ?xs
\<lbrakk>associative ?f; ?xs \<noteq> []\<rbrakk> \<Longrightarrow> candidate ?f ?xs = scanl1 ?f ?xs
associative g
ys \<noteq> []

goal (1 subgoal):
 1. candidate g ys = scanl1 g ys
[PROOF STEP]
by blast


[STATEMENT]
lemma open_dist: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open S = (\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S)
[PROOF STEP]
by (simp add: dist_commute open_uniformity eventually_uniformity_metric)


[STATEMENT]
lemma remove_max_set:
  "\<lbrakk>\<not> is_empty l; inv l; (m, l') = remove_max l\<rbrakk> \<Longrightarrow>
                                 set l' \<union> {m} = set l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> is_empty l; inv l; (m, l') = remove_max l\<rbrakk> \<Longrightarrow> local.set l' \<union> {m} = local.set l
[PROOF STEP]
using remove_max_multiset[of l m l']
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> is_empty l; inv l; (m, l') = remove_max l\<rbrakk> \<Longrightarrow> add_mset m (multiset l') = multiset l

goal (1 subgoal):
 1. \<lbrakk>\<not> is_empty l; inv l; (m, l') = remove_max l\<rbrakk> \<Longrightarrow> local.set l' \<union> {m} = local.set l
[PROOF STEP]
by (metis Un_insert_right local.set_def set_mset_add_mset_insert sup_bot_right)


[STATEMENT]
lemma int_Idl: "Idl\<^bsub>\<Z>\<^esub> {a} = {x * a | x. True}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Idl\<^bsub>\<Z>\<^esub> {a} = {x * a |x. True}
[PROOF STEP]
by (simp_all add: cgenideal_def int.cgenideal_eq_genideal[symmetric])


[STATEMENT]
lemma finite_Union_subsets:
  "\<lbrakk> \<forall> a \<in> A. a \<subseteq> b; finite b \<rbrakk> \<Longrightarrow> finite (\<Union>A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a\<in>A. a \<subseteq> b; finite b\<rbrakk> \<Longrightarrow> finite (\<Union> A)
[PROOF STEP]
by (metis Sup_le_iff finite_subset)


[STATEMENT]
lemma get_min_min:
  "\<lbrakk> bst_wrt (\<le>) h; h \<noteq> Leaf \<rbrakk> \<Longrightarrow> \<forall>x \<in> set_tree h. get_min h \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bst_wrt (\<le>) h; h \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> \<forall>x\<in>set_tree h. get_min h \<le> x
[PROOF STEP]
proof(induction h)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>bst_wrt (\<le>) \<langle>\<rangle>; \<langle>\<rangle> \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> Ball (set_tree \<langle>\<rangle>) ((\<le>) (get_min \<langle>\<rangle>))
 2. \<And>h1 x2 h2. \<lbrakk>\<lbrakk>bst_wrt (\<le>) h1; h1 \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> Ball (set_tree h1) ((\<le>) (get_min h1)); \<lbrakk>bst_wrt (\<le>) h2; h2 \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> Ball (set_tree h2) ((\<le>) (get_min h2)); bst_wrt (\<le>) \<langle>h1, x2, h2\<rangle>; \<langle>h1, x2, h2\<rangle> \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> Ball (set_tree \<langle>h1, x2, h2\<rangle>) ((\<le>) (get_min \<langle>h1, x2, h2\<rangle>))
[PROOF STEP]
case (Node l x r)
[PROOF STATE]
proof (state)
this:
\<lbrakk>bst_wrt (\<le>) l; l \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> \<forall>a\<in>set_tree l. get_min l \<le> a
\<lbrakk>bst_wrt (\<le>) r; r \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> \<forall>a\<in>set_tree r. get_min r \<le> a
bst_wrt (\<le>) \<langle>l, x, r\<rangle>
\<langle>l, x, r\<rangle> \<noteq> \<langle>\<rangle>

goal (2 subgoals):
 1. \<lbrakk>bst_wrt (\<le>) \<langle>\<rangle>; \<langle>\<rangle> \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> Ball (set_tree \<langle>\<rangle>) ((\<le>) (get_min \<langle>\<rangle>))
 2. \<And>h1 x2 h2. \<lbrakk>\<lbrakk>bst_wrt (\<le>) h1; h1 \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> Ball (set_tree h1) ((\<le>) (get_min h1)); \<lbrakk>bst_wrt (\<le>) h2; h2 \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> Ball (set_tree h2) ((\<le>) (get_min h2)); bst_wrt (\<le>) \<langle>h1, x2, h2\<rangle>; \<langle>h1, x2, h2\<rangle> \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> Ball (set_tree \<langle>h1, x2, h2\<rangle>) ((\<le>) (get_min \<langle>h1, x2, h2\<rangle>))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>bst_wrt (\<le>) l; l \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> \<forall>a\<in>set_tree l. get_min l \<le> a
\<lbrakk>bst_wrt (\<le>) r; r \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> \<forall>a\<in>set_tree r. get_min r \<le> a
bst_wrt (\<le>) \<langle>l, x, r\<rangle>
\<langle>l, x, r\<rangle> \<noteq> \<langle>\<rangle>

goal (1 subgoal):
 1. \<forall>a\<in>set_tree \<langle>l, x, r\<rangle>. get_min \<langle>l, x, r\<rangle> \<le> a
[PROOF STEP]
using get_min_in[of l] get_min_in[of r]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>bst_wrt (\<le>) l; l \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> \<forall>a\<in>set_tree l. get_min l \<le> a
\<lbrakk>bst_wrt (\<le>) r; r \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> \<forall>a\<in>set_tree r. get_min r \<le> a
bst_wrt (\<le>) \<langle>l, x, r\<rangle>
\<langle>l, x, r\<rangle> \<noteq> \<langle>\<rangle>
l \<noteq> \<langle>\<rangle> \<Longrightarrow> get_min l \<in> set_tree l
r \<noteq> \<langle>\<rangle> \<Longrightarrow> get_min r \<in> set_tree r

goal (1 subgoal):
 1. \<forall>a\<in>set_tree \<langle>l, x, r\<rangle>. get_min \<langle>l, x, r\<rangle> \<le> a
[PROOF STEP]
by auto (blast intro: order_trans)
[PROOF STATE]
proof (state)
this:
\<forall>a\<in>set_tree \<langle>l, x, r\<rangle>. get_min \<langle>l, x, r\<rangle> \<le> a

goal (1 subgoal):
 1. \<lbrakk>bst_wrt (\<le>) \<langle>\<rangle>; \<langle>\<rangle> \<noteq> \<langle>\<rangle>\<rbrakk> \<Longrightarrow> Ball (set_tree \<langle>\<rangle>) ((\<le>) (get_min \<langle>\<rangle>))
[PROOF STEP]
qed simp


[STATEMENT]
lemma dioph_rhs_bound:
  "\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (\<Sum>k\<leftarrow>ks. \<bar>k\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
have "\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> =
    \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) -
     (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2) div 2\<bar>"
    (is "_ = \<bar>(_ - ?r) div 2\<bar>")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> = \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2) div 2\<bar>
[PROOF STEP]
by (simp add: zmult_div_aux1)
[PROOF STATE]
proof (state)
this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> = \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2) div 2\<bar>

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> = \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2) div 2\<bar>

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
have "\<dots> = \<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - ?r\<bar> div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2) div 2\<bar> = \<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar> div 2
[PROOF STEP]
by (simp add: zmult_div_aux2 div_abs_eq)
[PROOF STATE]
proof (state)
this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2) div 2\<bar> = \<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar> div 2

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2) div 2\<bar> = \<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar> div 2

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
have "\<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - ?r\<bar> \<le>
    \<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> + \<bar>?r\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar> \<le> \<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>
[PROOF STEP]
by (rule abs_triangle_ineq4)
[PROOF STATE]
proof (state)
this:
\<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar> \<le> \<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) - (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar> \<le> \<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
have "\<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le>
    \<bar>l\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>l\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>
[PROOF STEP]
by (rule abs_triangle_ineq4)
[PROOF STATE]
proof (state)
this:
\<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>l\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>l\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
have "\<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> (\<Sum>k\<leftarrow>ks. \<bar>k\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks)
[PROOF STEP]
proof (induct ks xs rule: eval_dioph.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>k ks x xs. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks) \<Longrightarrow> \<bar>eval_dioph (k # ks) (map (\<lambda>x. x mod 2) (x # xs))\<bar> \<le> sum_list (map abs (k # ks))
 2. \<And>xs. \<bar>eval_dioph [] (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs [])
 3. \<And>ks. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) [])\<bar> \<le> sum_list (map abs ks)
[PROOF STEP]
case (1 k ks x xs)
[PROOF STATE]
proof (state)
this:
\<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks)

goal (3 subgoals):
 1. \<And>k ks x xs. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks) \<Longrightarrow> \<bar>eval_dioph (k # ks) (map (\<lambda>x. x mod 2) (x # xs))\<bar> \<le> sum_list (map abs (k # ks))
 2. \<And>xs. \<bar>eval_dioph [] (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs [])
 3. \<And>ks. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) [])\<bar> \<le> sum_list (map abs ks)
[PROOF STEP]
have "\<bar>k * int (x mod 2) + eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le>
      \<bar>k * int (x mod 2)\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>k * int (x mod 2) + eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>k * int (x mod 2)\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>
[PROOF STEP]
by (rule abs_triangle_ineq)
[PROOF STATE]
proof (state)
this:
\<bar>k * int (x mod 2) + eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>k * int (x mod 2)\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>

goal (3 subgoals):
 1. \<And>k ks x xs. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks) \<Longrightarrow> \<bar>eval_dioph (k # ks) (map (\<lambda>x. x mod 2) (x # xs))\<bar> \<le> sum_list (map abs (k # ks))
 2. \<And>xs. \<bar>eval_dioph [] (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs [])
 3. \<And>ks. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) [])\<bar> \<le> sum_list (map abs ks)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>k * int (x mod 2) + eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>k * int (x mod 2)\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>

goal (3 subgoals):
 1. \<And>k ks x xs. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks) \<Longrightarrow> \<bar>eval_dioph (k # ks) (map (\<lambda>x. x mod 2) (x # xs))\<bar> \<le> sum_list (map abs (k # ks))
 2. \<And>xs. \<bar>eval_dioph [] (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs [])
 3. \<And>ks. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) [])\<bar> \<le> sum_list (map abs ks)
[PROOF STEP]
have "\<bar>k * int (x mod 2)\<bar> \<le> \<bar>k\<bar> * \<bar>int (x mod 2)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>k * int (x mod 2)\<bar> \<le> \<bar>k\<bar> * \<bar>int (x mod 2)\<bar>
[PROOF STEP]
by (simp add: abs_mult)
[PROOF STATE]
proof (state)
this:
\<bar>k * int (x mod 2)\<bar> \<le> \<bar>k\<bar> * \<bar>int (x mod 2)\<bar>

goal (3 subgoals):
 1. \<And>k ks x xs. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks) \<Longrightarrow> \<bar>eval_dioph (k # ks) (map (\<lambda>x. x mod 2) (x # xs))\<bar> \<le> sum_list (map abs (k # ks))
 2. \<And>xs. \<bar>eval_dioph [] (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs [])
 3. \<And>ks. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) [])\<bar> \<le> sum_list (map abs ks)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>k * int (x mod 2)\<bar> \<le> \<bar>k\<bar> * \<bar>int (x mod 2)\<bar>

goal (3 subgoals):
 1. \<And>k ks x xs. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks) \<Longrightarrow> \<bar>eval_dioph (k # ks) (map (\<lambda>x. x mod 2) (x # xs))\<bar> \<le> sum_list (map abs (k # ks))
 2. \<And>xs. \<bar>eval_dioph [] (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs [])
 3. \<And>ks. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) [])\<bar> \<le> sum_list (map abs ks)
[PROOF STEP]
have "\<bar>int (x mod 2)\<bar> \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>int (x mod 2)\<bar> \<le> 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>int (x mod 2)\<bar> \<le> 1

goal (3 subgoals):
 1. \<And>k ks x xs. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks) \<Longrightarrow> \<bar>eval_dioph (k # ks) (map (\<lambda>x. x mod 2) (x # xs))\<bar> \<le> sum_list (map abs (k # ks))
 2. \<And>xs. \<bar>eval_dioph [] (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs [])
 3. \<And>ks. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) [])\<bar> \<le> sum_list (map abs ks)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> x + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> y + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>; \<And>x y. x \<le> y \<Longrightarrow> \<bar>k\<bar> * x + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>k\<bar> * y + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>\<rbrakk> \<Longrightarrow> \<bar>k * int (x mod 2) + eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>k\<bar> * 1 + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>
[PROOF STEP]
have "\<bar>k * int (x mod 2) + eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le>
      \<bar>k\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> x + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> y + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>; \<And>x y. x \<le> y \<Longrightarrow> \<bar>k\<bar> * x + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>k\<bar> * y + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>\<rbrakk> \<Longrightarrow> \<bar>k * int (x mod 2) + eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>k\<bar> * 1 + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>

goal (1 subgoal):
 1. \<bar>k * int (x mod 2) + eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>k\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>
[PROOF STEP]
by (auto simp add: mult_left_mono)
[PROOF STATE]
proof (state)
this:
\<bar>k * int (x mod 2) + eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>k\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>

goal (3 subgoals):
 1. \<And>k ks x xs. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks) \<Longrightarrow> \<bar>eval_dioph (k # ks) (map (\<lambda>x. x mod 2) (x # xs))\<bar> \<le> sum_list (map abs (k # ks))
 2. \<And>xs. \<bar>eval_dioph [] (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs [])
 3. \<And>ks. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) [])\<bar> \<le> sum_list (map abs ks)
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
\<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks)
\<bar>k * int (x mod 2) + eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>k\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks)
\<bar>k * int (x mod 2) + eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> \<bar>k\<bar> + \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar>

goal (1 subgoal):
 1. \<bar>eval_dioph (k # ks) (map (\<lambda>x. x mod 2) (x # xs))\<bar> \<le> sum_list (map abs (k # ks))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>eval_dioph (k # ks) (map (\<lambda>x. x mod 2) (x # xs))\<bar> \<le> sum_list (map abs (k # ks))

goal (2 subgoals):
 1. \<And>xs. \<bar>eval_dioph [] (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs [])
 2. \<And>ks. \<bar>eval_dioph ks (map (\<lambda>x. x mod 2) [])\<bar> \<le> sum_list (map abs ks)
[PROOF STEP]
qed (simp_all add: sum_list_abs_ge_0)
[PROOF STATE]
proof (state)
this:
\<bar>eval_dioph ks (map (\<lambda>x. x mod 2) xs)\<bar> \<le> sum_list (map abs ks)

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> x div 2 \<le> y div 2; \<And>x y. x \<le> y \<Longrightarrow> (x + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 \<le> (y + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2; \<And>x y. x \<le> y \<Longrightarrow> (\<bar>l\<bar> + x + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 \<le> (\<bar>l\<bar> + y + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2\<rbrakk> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> (\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2
[PROOF STEP]
have ineq: "\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le>
    (\<bar>l\<bar> + (\<Sum>k\<leftarrow>ks. \<bar>k\<bar>) + \<bar>?r\<bar>) div 2"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> x div 2 \<le> y div 2; \<And>x y. x \<le> y \<Longrightarrow> (x + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 \<le> (y + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2; \<And>x y. x \<le> y \<Longrightarrow> (\<bar>l\<bar> + x + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 \<le> (\<bar>l\<bar> + y + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2\<rbrakk> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> (\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> (\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2
[PROOF STEP]
by (simp add: zdiv_mono1)
[PROOF STATE]
proof (state)
this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> (\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
proof (cases "(\<Sum>k\<leftarrow>ks. \<bar>k\<bar>) \<le> \<bar>l\<bar>")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
 2. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
sum_list (map abs ks) \<le> \<bar>l\<bar>

goal (2 subgoals):
 1. sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
 2. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
note ineq
[PROOF STATE]
proof (state)
this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> (\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2

goal (2 subgoals):
 1. sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
 2. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> (\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2

goal (2 subgoals):
 1. sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
 2. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
sum_list (map abs ks) \<le> \<bar>l\<bar>
[PROOF STEP]
have "(\<bar>l\<bar> + (\<Sum>k\<leftarrow>ks. \<bar>k\<bar>) + \<bar>?r\<bar>) div 2 \<le> (\<bar>l\<bar> * 2 + \<bar>?r\<bar>) div 2"
[PROOF STATE]
proof (prove)
using this:
sum_list (map abs ks) \<le> \<bar>l\<bar>

goal (1 subgoal):
 1. (\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 \<le> (\<bar>l\<bar> * 2 + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2
[PROOF STEP]
by (simp add: zdiv_mono1)
[PROOF STATE]
proof (state)
this:
(\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 \<le> (\<bar>l\<bar> * 2 + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2

goal (2 subgoals):
 1. sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
 2. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 \<le> (\<bar>l\<bar> * 2 + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2

goal (2 subgoals):
 1. sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
 2. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
have "\<dots> = \<bar>l\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>l\<bar> * 2 + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 = \<bar>l\<bar>
[PROOF STEP]
by (simp add: add_div_trivial)
[PROOF STATE]
proof (state)
this:
(\<bar>l\<bar> * 2 + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 = \<bar>l\<bar>

goal (2 subgoals):
 1. sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
 2. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> \<bar>l\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> \<bar>l\<bar>

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))

goal (1 subgoal):
 1. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> sum_list (map abs ks) \<le> \<bar>l\<bar>

goal (1 subgoal):
 1. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
note ineq
[PROOF STATE]
proof (state)
this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> (\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2

goal (1 subgoal):
 1. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> (\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2

goal (1 subgoal):
 1. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
\<not> sum_list (map abs ks) \<le> \<bar>l\<bar>
[PROOF STEP]
have "(\<bar>l\<bar> + (\<Sum>k\<leftarrow>ks. \<bar>k\<bar>) + \<bar>?r\<bar>) div 2 \<le> ((\<Sum>k\<leftarrow>ks. \<bar>k\<bar>) * 2 + \<bar>?r\<bar>) div 2"
[PROOF STATE]
proof (prove)
using this:
\<not> sum_list (map abs ks) \<le> \<bar>l\<bar>

goal (1 subgoal):
 1. (\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 \<le> (sum_list (map abs ks) * 2 + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2
[PROOF STEP]
by (simp add: zdiv_mono1)
[PROOF STATE]
proof (state)
this:
(\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 \<le> (sum_list (map abs ks) * 2 + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2

goal (1 subgoal):
 1. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<bar>l\<bar> + sum_list (map abs ks) + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 \<le> (sum_list (map abs ks) * 2 + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2

goal (1 subgoal):
 1. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
have "\<dots> = (\<Sum>k\<leftarrow>ks. \<bar>k\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sum_list (map abs ks) * 2 + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 = sum_list (map abs ks)
[PROOF STEP]
by (simp add: add_div_trivial)
[PROOF STATE]
proof (state)
this:
(sum_list (map abs ks) * 2 + \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2\<bar>) div 2 = sum_list (map abs ks)

goal (1 subgoal):
 1. \<not> sum_list (map abs ks) \<le> \<bar>l\<bar> \<Longrightarrow> \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> sum_list (map abs ks)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> sum_list (map abs ks)

goal (1 subgoal):
 1. \<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<bar> \<le> max \<bar>l\<bar> (sum_list (map abs ks))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_insert:
  fixes x :: "'a::t1_space"
  shows "closure (insert x s) = insert x (closure s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (insert x s) = insert x (closure s)
[PROOF STEP]
by (meson closed_closure closed_insert closure_minimal closure_subset dual_order.antisym insert_mono insert_subset)


[STATEMENT]
lemma has_integral_stretch_cart:
  fixes m :: "'n::finite \<Rightarrow> real"
  assumes f: "(f has_integral i) (cbox a b)" and m: "\<And>k. m k \<noteq> 0"
  shows "((\<lambda>x. f(\<chi> k. m k * x$k)) has_integral i /\<^sub>R \<bar>prod m UNIV\<bar>)
            ((\<lambda>x. \<chi> k. x$k / m k) ` (cbox a b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (\<chi>k. m k * x $ k)) has_integral i /\<^sub>R \<bar>prod m UNIV\<bar>) ((\<lambda>x. \<chi>k. x $ k / m k) ` cbox a b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. f (\<chi>k. m k * x $ k)) has_integral i /\<^sub>R \<bar>prod m UNIV\<bar>) ((\<lambda>x. \<chi>k. x $ k / m k) ` cbox a b)
[PROOF STEP]
have *: "\<forall>k:: real^'n \<in> Basis. m (axis_index k) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>k\<in>Basis. m (axis_index k) \<noteq> 0
[PROOF STEP]
using axis_index
[PROOF STATE]
proof (prove)
using this:
?v \<in> Basis \<Longrightarrow> ?v = axis (axis_index ?v) 1

goal (1 subgoal):
 1. \<forall>k\<in>Basis. m (axis_index k) \<noteq> 0
[PROOF STEP]
by (simp add: m)
[PROOF STATE]
proof (state)
this:
\<forall>k\<in>Basis. m (axis_index k) \<noteq> 0

goal (1 subgoal):
 1. ((\<lambda>x. f (\<chi>k. m k * x $ k)) has_integral i /\<^sub>R \<bar>prod m UNIV\<bar>) ((\<lambda>x. \<chi>k. x $ k / m k) ` cbox a b)
[PROOF STEP]
have eqp: "(\<Prod>k:: real^'n \<in> Basis. m (axis_index k)) = prod m UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>k\<in>Basis. m (axis_index k)) = prod m UNIV
[PROOF STEP]
by (simp add: Basis_vec_def UNION_singleton_eq_range prod.reindex axis_eq_axis inj_on_def)
[PROOF STATE]
proof (state)
this:
(\<Prod>k\<in>Basis. m (axis_index k)) = prod m UNIV

goal (1 subgoal):
 1. ((\<lambda>x. f (\<chi>k. m k * x $ k)) has_integral i /\<^sub>R \<bar>prod m UNIV\<bar>) ((\<lambda>x. \<chi>k. x $ k / m k) ` cbox a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (\<chi>k. m k * x $ k)) has_integral i /\<^sub>R \<bar>prod m UNIV\<bar>) ((\<lambda>x. \<chi>k. x $ k / m k) ` cbox a b)
[PROOF STEP]
using has_integral_stretch [OF f *] vec_lambda_eq_sum [where f="\<lambda>i x. m i * x"] vec_lambda_eq_sum [where f="\<lambda>i x. x / m i"]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f (\<Sum>k\<in>Basis. (m (axis_index k) * (x \<bullet> k)) *\<^sub>R k)) has_integral (1 / \<bar>\<Prod>k\<in>Basis. m (axis_index k)\<bar>) *\<^sub>R i) ((\<lambda>x. \<Sum>k\<in>Basis. (1 / m (axis_index k) * (x \<bullet> k)) *\<^sub>R k) ` cbox a b)
(\<chi>k. m k * ?x $ k) = (\<Sum>k\<in>Basis. (m (axis_index k) * (?x \<bullet> k)) *\<^sub>R k)
(\<chi>k. ?x $ k / m k) = (\<Sum>k\<in>Basis. (?x \<bullet> k / m (axis_index k)) *\<^sub>R k)

goal (1 subgoal):
 1. ((\<lambda>x. f (\<chi>k. m k * x $ k)) has_integral i /\<^sub>R \<bar>prod m UNIV\<bar>) ((\<lambda>x. \<chi>k. x $ k / m k) ` cbox a b)
[PROOF STEP]
by (simp add: field_simps eqp)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (\<chi>k. m k * x $ k)) has_integral i /\<^sub>R \<bar>prod m UNIV\<bar>) ((\<lambda>x. \<chi>k. x $ k / m k) ` cbox a b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma choose_row_sum: "(\<Sum>k\<le>n. n choose k) = 2^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((choose) n) {..n} = 2 ^ n
[PROOF STEP]
using binomial [of 1 "1" n]
[PROOF STATE]
proof (prove)
using this:
(1 + 1) ^ n = (\<Sum>k\<le>n. of_nat (n choose k) * 1 ^ k * 1 ^ (n - k))

goal (1 subgoal):
 1. sum ((choose) n) {..n} = 2 ^ n
[PROOF STEP]
by (simp add: numeral_2_eq_2)


[STATEMENT]
lemma trss_add_context_s:
  "\<lbrakk>((s,c),e,(s',c'))\<in>trss fg; mon_e fg e \<inter> mon_c fg ce = {}\<rbrakk>
    \<Longrightarrow> ((s,c+ce),e,(s',c'+ce))\<in>trss fg"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>((s, c), e, s', c') \<in> trss fg; mon_e fg e \<inter> mon_c fg ce = {}\<rbrakk> \<Longrightarrow> ((s, c + ce), e, s', c' + ce) \<in> trss fg
[PROOF STEP]
by (auto elim!: trss.cases intro!: trss.intros simp add: union_assoc mon_c_unconc)


[STATEMENT]
lemma ct_list_eq_take:
  assumes "ct_list_eq xs ys"
  shows "ct_list_eq (take n xs) (take n ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ct_list_eq (take n xs) (take n ys)
[PROOF STEP]
using assms list_all2_takeI
[PROOF STATE]
proof (prove)
using this:
ct_list_eq xs ys
list_all2 ?P ?xs ?ys \<Longrightarrow> list_all2 ?P (take ?n ?xs) (take ?n ?ys)

goal (1 subgoal):
 1. ct_list_eq (take n xs) (take n ys)
[PROOF STEP]
unfolding ct_list_eq_def
[PROOF STATE]
proof (prove)
using this:
list_all2 ct_eq xs ys
list_all2 ?P ?xs ?ys \<Longrightarrow> list_all2 ?P (take ?n ?xs) (take ?n ?ys)

goal (1 subgoal):
 1. list_all2 ct_eq (take n xs) (take n ys)
[PROOF STEP]
by blast


[STATEMENT]
lemma eventually_ae_filter: "eventually P (ae_filter M) \<longleftrightarrow> (\<exists>N\<in>null_sets M. {x \<in> space M. \<not> P x} \<subseteq> N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. almost_everywhere M P = (\<exists>N\<in>null_sets M. {x \<in> space M. \<not> P x} \<subseteq> N)
[PROOF STEP]
unfolding ae_filter_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (INF N\<in>null_sets M. principal (space M - N)) = (\<exists>N\<in>null_sets M. {x \<in> space M. \<not> P x} \<subseteq> N)
[PROOF STEP]
by (subst eventually_INF_base) (auto simp: eventually_principal subset_eq)


[STATEMENT]
lemma (in finite_measure) finite_measure_compl:
  assumes S: "S \<in> sets M"
  shows "measure M (space M - S) = measure M (space M) - measure M S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (space M - S) = Sigma_Algebra.measure M (space M) - Sigma_Algebra.measure M S
[PROOF STEP]
using measure_Diff[OF _ sets.top S sets.sets_into_space] S
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>emeasure M (space M) \<noteq> \<infinity>; S \<in> sets M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (space M - S) = Sigma_Algebra.measure M (space M) - Sigma_Algebra.measure M S
S \<in> sets M

goal (1 subgoal):
 1. Sigma_Algebra.measure M (space M - S) = Sigma_Algebra.measure M (space M) - Sigma_Algebra.measure M S
[PROOF STEP]
by simp


[STATEMENT]
lemma list_append_subset3 : "set xs1 \<subseteq> set ys1 \<Longrightarrow> set xs2 \<subseteq> set ys2 \<Longrightarrow> set xs3 \<subseteq> set ys3 \<Longrightarrow> set (xs1@xs2@xs3) \<subseteq> set(ys1@ys2@ys3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set xs1 \<subseteq> set ys1; set xs2 \<subseteq> set ys2; set xs3 \<subseteq> set ys3\<rbrakk> \<Longrightarrow> set (xs1 @ xs2 @ xs3) \<subseteq> set (ys1 @ ys2 @ ys3)
[PROOF STEP]
by auto


[STATEMENT]
lemma prod_list_replicate[simp]: "prod_list (replicate n a) = a ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (replicate n a) = a ^ n
[PROOF STEP]
by (induct n, auto)


[STATEMENT]
lemma summation_normalized :
  assumes nonzero : "(B ::real) \<noteq>0"
  shows "(\<Sum>i = 0..<((n::nat)+1). (f i :: real) * B ^ (n - i)) = (\<Sum>i = 0..<(n+1). (f i) / (B ^ i)) * (B^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i * B ^ (n - i)) = (\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i * B ^ (n - i)) = (\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n
[PROOF STEP]
have h1a : "\<forall>x::real. ((\<Sum>i = 0..<(n+1). (f i) / (B ^ i)) * x = (\<Sum>i = 0..<(n+1). ((f i) / (B ^ i)) * x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (\<Sum>i = 0..<n + 1. f i / B ^ i) * x = (\<Sum>i = 0..<n + 1. f i / B ^ i * x)
[PROOF STEP]
apply(induction n )
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x. (\<Sum>i = 0..<0 + 1. f i / B ^ i) * x = (\<Sum>i = 0..<0 + 1. f i / B ^ i * x)
 2. \<And>n. \<forall>x. (\<Sum>i = 0..<n + 1. f i / B ^ i) * x = (\<Sum>i = 0..<n + 1. f i / B ^ i * x) \<Longrightarrow> \<forall>x. (\<Sum>i = 0..<Suc n + 1. f i / B ^ i) * x = (\<Sum>i = 0..<Suc n + 1. f i / B ^ i * x)
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n x. \<forall>x. ((\<Sum>i = 0..<n. f i / B ^ i) + f n / B ^ n) * x = (\<Sum>i = 0..<n. f i * x / B ^ i) + f n * x / B ^ n \<Longrightarrow> ((\<Sum>i = 0..<n. f i / B ^ i) + f n / B ^ n + f (Suc n) / (B * B ^ n)) * x = (\<Sum>i = 0..<n. f i * x / B ^ i) + f n * x / B ^ n + f (Suc n) * x / (B * B ^ n)
[PROOF STEP]
by (simp add: distrib_right)
[PROOF STATE]
proof (state)
this:
\<forall>x. (\<Sum>i = 0..<n + 1. f i / B ^ i) * x = (\<Sum>i = 0..<n + 1. f i / B ^ i * x)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i * B ^ (n - i)) = (\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n
[PROOF STEP]
have h1 : "(\<Sum>i = 0..<(n+1). (f i) / (B ^ i)) * (B^n) = (\<Sum>i = 0..<(n+1). ((f i) / (B ^ i)) * (B^n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n = (\<Sum>i = 0..<n + 1. f i / B ^ i * B ^ n)
[PROOF STEP]
using h1a
[PROOF STATE]
proof (prove)
using this:
\<forall>x. (\<Sum>i = 0..<n + 1. f i / B ^ i) * x = (\<Sum>i = 0..<n + 1. f i / B ^ i * x)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n = (\<Sum>i = 0..<n + 1. f i / B ^ i * B ^ n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n = (\<Sum>i = 0..<n + 1. f i / B ^ i * B ^ n)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i * B ^ (n - i)) = (\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n
[PROOF STEP]
have h2 : "(\<Sum>i = 0..<(n+1). ((f i) / (B ^ i)) * (B^n)) = (\<Sum>i = 0..<(n+1). (f i) * ((B^n) / (B ^ i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i / B ^ i * B ^ n) = (\<Sum>i = 0..<n + 1. f i * (B ^ n / B ^ i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n + 1. f i / B ^ i * B ^ n) = (\<Sum>i = 0..<n + 1. f i * (B ^ n / B ^ i))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i * B ^ (n - i)) = (\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n
[PROOF STEP]
have h3 : "(\<Sum>i = 0..<(n+1). (f i) * ((B^n) / (B ^ i))) = (\<Sum>i = 0..<(n+1). (f i) * B ^ (n - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i * (B ^ n / B ^ i)) = (\<Sum>i = 0..<n + 1. f i * B ^ (n - i))
[PROOF STEP]
using add.right_neutral nonzero power_diff
[PROOF STATE]
proof (prove)
using this:
?a + (0::?'a) = ?a
B \<noteq> 0
\<lbrakk>?a \<noteq> (0::?'a); ?n \<le> ?m\<rbrakk> \<Longrightarrow> ?a ^ (?m - ?n) = ?a ^ ?m div ?a ^ ?n

goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i * (B ^ n / B ^ i)) = (\<Sum>i = 0..<n + 1. f i * B ^ (n - i))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n + 1. f i * (B ^ n / B ^ i)) = (\<Sum>i = 0..<n + 1. f i * B ^ (n - i))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i * B ^ (n - i)) = (\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i * B ^ (n - i)) = (\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n
[PROOF STEP]
using h1 h2 h3
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n = (\<Sum>i = 0..<n + 1. f i / B ^ i * B ^ n)
(\<Sum>i = 0..<n + 1. f i / B ^ i * B ^ n) = (\<Sum>i = 0..<n + 1. f i * (B ^ n / B ^ i))
(\<Sum>i = 0..<n + 1. f i * (B ^ n / B ^ i)) = (\<Sum>i = 0..<n + 1. f i * B ^ (n - i))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n + 1. f i * B ^ (n - i)) = (\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n + 1. f i * B ^ (n - i)) = (\<Sum>i = 0..<n + 1. f i / B ^ i) * B ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unat_shiftr_less_t2n:
  fixes x :: "'a :: len word"
  shows "unat x < 2 ^ (n + m) \<Longrightarrow> unat (x >> n) < 2 ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unat x < 2 ^ (n + m) \<Longrightarrow> unat (x >> n) < 2 ^ m
[PROOF STEP]
by (simp add: shiftr_div_2n' power_add mult.commute less_mult_imp_div_less)


[STATEMENT]
lemma fun_eq_on_UNIV: "(fun_eq_on f g UNIV) = (f=g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fun_eq_on f g UNIV = (f = g)
[PROOF STEP]
unfolding fun_eq_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>a\<in>UNIV. f a = g a) = (f = g)
[PROOF STEP]
by fast


[STATEMENT]
lemma vint_transitive_law:
  assumes "x \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>"
    and "y \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>"
    and "z \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>"
    and "x <\<^sub>\<int> y"
    and "y <\<^sub>\<int> z"
  shows "x <\<^sub>\<int> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x <\<^sub>\<int> z
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x <\<^sub>\<int> z
[PROOF STEP]
have "x' < y' \<Longrightarrow> y' < z' \<Longrightarrow> x' < z'" for x' y' z' :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x' < y'; y' < z'\<rbrakk> \<Longrightarrow> x' < z'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x' < ?y'; ?y' < ?z'\<rbrakk> \<Longrightarrow> ?x' < ?z'

goal (1 subgoal):
 1. x <\<^sub>\<int> z
[PROOF STEP]
from this[untransferred, OF assms]
[PROOF STATE]
proof (chain)
picking this:
x <\<^sub>\<int> z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x <\<^sub>\<int> z

goal (1 subgoal):
 1. x <\<^sub>\<int> z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x <\<^sub>\<int> z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma max_enn2ereal: "max (enn2ereal x) (enn2ereal y) = enn2ereal (max x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (enn2ereal x) (enn2ereal y) = enn2ereal (max x y)
[PROOF STEP]
including ennreal.lifting
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (enn2ereal x) (enn2ereal y) = enn2ereal (max x y)
[PROOF STEP]
unfolding max_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if enn2ereal x \<le> enn2ereal y then enn2ereal y else enn2ereal x) = enn2ereal (if x \<le> y then y else x)
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma index_append_vec[simp]: "i < dim_vec v + dim_vec w
  \<Longrightarrow> (v @\<^sub>v w) $ i = (if i < dim_vec v then v $ i else w $ (i - dim_vec v))"
  "dim_vec (v @\<^sub>v w) = dim_vec v + dim_vec w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < dim_vec v + dim_vec w \<Longrightarrow> (v @\<^sub>v w) $ i = (if i < dim_vec v then v $ i else w $ (i - dim_vec v))) &&& dim_vec (v @\<^sub>v w) = dim_vec v + dim_vec w
[PROOF STEP]
unfolding append_vec_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < dim_vec v + dim_vec w \<Longrightarrow> vec (dim_vec v + dim_vec w) (\<lambda>i. if i < dim_vec v then v $ i else w $ (i - dim_vec v)) $ i = (if i < dim_vec v then v $ i else w $ (i - dim_vec v))) &&& dim_vec (vec (dim_vec v + dim_vec w) (\<lambda>i. if i < dim_vec v then v $ i else w $ (i - dim_vec v))) = dim_vec v + dim_vec w
[PROOF STEP]
by auto


[STATEMENT]
lemma dverts_children_count_ge2_aux:
  assumes "(t1,e1) \<in> fset xs" and "(t2,e2) \<in> fset xs" and "(t1,e1) \<noteq> (t2,e2)"
      and "x \<in> dverts t1" and "x \<in> dverts t2"
    shows "(\<Sum>(t1, e1)\<in>fset xs. count (dverts_mset t1) x) \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (dverts_mset t1) x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (dverts_mset t1) x)
[PROOF STEP]
have "2 \<le> count (dverts_mset t1) x + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> count (dverts_mset t1) x + 1
[PROOF STEP]
using assms(4)
[PROOF STATE]
proof (prove)
using this:
x \<in> dverts t1

goal (1 subgoal):
 1. 2 \<le> count (dverts_mset t1) x + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 \<le> count (dverts_mset t1) x + 1

goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (dverts_mset t1) x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 \<le> count (dverts_mset t1) x + 1

goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (dverts_mset t1) x)
[PROOF STEP]
have "\<dots> \<le> count (dverts_mset t1) x + count (dverts_mset t2) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (dverts_mset t1) x + 1 \<le> count (dverts_mset t1) x + count (dverts_mset t2) x
[PROOF STEP]
using assms(5)
[PROOF STATE]
proof (prove)
using this:
x \<in> dverts t2

goal (1 subgoal):
 1. count (dverts_mset t1) x + 1 \<le> count (dverts_mset t1) x + count (dverts_mset t2) x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
count (dverts_mset t1) x + 1 \<le> count (dverts_mset t1) x + count (dverts_mset t2) x

goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (dverts_mset t1) x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 \<le> count (dverts_mset t1) x + count (dverts_mset t2) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 \<le> count (dverts_mset t1) x + count (dverts_mset t2) x

goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (dverts_mset t1) x)
[PROOF STEP]
using fset_sum_ge_elem2[OF assms(1-3), of "\<lambda>(t1,e1). count (dverts_mset t1) x"]
[PROOF STATE]
proof (prove)
using this:
2 \<le> count (dverts_mset t1) x + count (dverts_mset t2) x
(case (t1, e1) of (t1, e1) \<Rightarrow> count (dverts_mset t1) x) + (case (t2, e2) of (t1, e1) \<Rightarrow> count (dverts_mset t1) x) \<le> (\<Sum>xa\<in>fset xs. case xa of (t1, e1) \<Rightarrow> count (dverts_mset t1) x)

goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (dverts_mset t1) x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (dverts_mset t1) x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_finite: "finite N \<Longrightarrow> (\<And>n. n \<notin> N \<Longrightarrow> f n = 0) \<Longrightarrow> summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite N; \<And>n. n \<notin> N \<Longrightarrow> f n = (0::'a)\<rbrakk> \<Longrightarrow> summable f
[PROOF STEP]
by (rule sums_summable) (rule sums_finite)


[STATEMENT]
lemma suminf_split_initial_segment':
  "summable (f :: nat \<Rightarrow> 'a::real_normed_vector) \<Longrightarrow>
       suminf f = (\<Sum>n. f (n + k + 1)) + sum f {..k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f \<Longrightarrow> suminf f = (\<Sum>n. f (n + k + 1)) + sum f {..k}
[PROOF STEP]
by (subst suminf_split_initial_segment[of _ "Suc k"], assumption, subst lessThan_Suc_atMost)
     simp_all


[STATEMENT]
lemma advice_sets_length:
  "length (advice_sets \<phi>) \<le> 2 ^ card (subfrmlsn \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (advice_sets \<phi>) \<le> 2 ^ card (subfrmlsn \<phi>)
[PROOF STEP]
unfolding advice_sets_def length_product length_subseqs subformulas\<^sub>\<mu>_list_length subformulas\<^sub>\<nu>_list_length power_add[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (card (subformulas\<^sub>\<mu> \<phi>) + card (subformulas\<^sub>\<nu> \<phi>)) \<le> 2 ^ card (subfrmlsn \<phi>)
[PROOF STEP]
by (metis Suc_1 card_mono lessI power_increasing_iff subformulas\<^sub>\<mu>\<^sub>\<nu>_card subformulas\<^sub>\<mu>\<^sub>\<nu>_subfrmlsn subfrmlsn_finite)


[STATEMENT]
lemma bw_diff_plus [simp]: "bw_diff (\<lambda>x. f x + g x) = (\<lambda>x. bw_diff f x + bw_diff g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bw_diff (\<lambda>x. f x + g x) = (\<lambda>x. bw_diff f x + bw_diff g x)
[PROOF STEP]
by (rule ext) (simp add: bw_diff_def)


[STATEMENT]
lemma VInter_VPow: "\<Inter>\<^sub>\<circ> (VPow A) \<subseteq>\<^sub>\<circ> VPow (\<Inter>\<^sub>\<circ> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter>\<^sub>\<circ> (VPow A) \<subseteq>\<^sub>\<circ> VPow (\<Inter>\<^sub>\<circ> A)
[PROOF STEP]
by auto


[STATEMENT]
lemma subsets_are_rows: "\<forall>i < (length subsets). row (alt_matrix_A signs subsets) i  = vec (length signs) (\<lambda>j. z (subsets ! i) (signs ! j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length subsets. row (alt_matrix_A signs subsets) i = vec (length signs) (\<lambda>j. z (subsets ! i) (signs ! j))
[PROOF STEP]
unfolding row_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length subsets. vec (dim_col (alt_matrix_A signs subsets)) (\<lambda>j. alt_matrix_A signs subsets $$ (i, j)) = vec (length signs) (\<lambda>j. z (subsets ! i) (signs ! j))
[PROOF STEP]
unfolding alt_matrix_A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length subsets. vec (dim_col (mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j)))) (\<lambda>j. mat (length subsets) (length signs) (\<lambda>(i, j). z (subsets ! i) (signs ! j)) $$ (i, j)) = vec (length signs) (\<lambda>j. z (subsets ! i) (signs ! j))
[PROOF STEP]
by auto


[STATEMENT]
lemma space_PiM: "space (\<Pi>\<^sub>M i\<in>I. M i) = (\<Pi>\<^sub>E i\<in>I. space (M i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (Pi\<^sub>M I M) = (\<Pi>\<^sub>E i\<in>I. space (M i))
[PROOF STEP]
using prod_algebra_sets_into_space
[PROOF STATE]
proof (prove)
using this:
prod_algebra ?I ?M \<subseteq> Pow (\<Pi>\<^sub>E i\<in>?I. space (?M i))

goal (1 subgoal):
 1. space (Pi\<^sub>M I M) = (\<Pi>\<^sub>E i\<in>I. space (M i))
[PROOF STEP]
unfolding PiM_def prod_algebra_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(J, X). prod_emb ?I ?M J (Pi\<^sub>E J X)) ` {(J, X). (J \<noteq> {} \<or> ?I = {}) \<and> finite J \<and> J \<subseteq> ?I \<and> X \<in> (\<Pi> j\<in>J. sets (?M j))} \<subseteq> Pow (\<Pi>\<^sub>E i\<in>?I. space (?M i))

goal (1 subgoal):
 1. space (extend_measure (\<Pi>\<^sub>E i\<in>I. space (M i)) {(J, X). (J \<noteq> {} \<or> I = {}) \<and> finite J \<and> J \<subseteq> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))} (\<lambda>(J, X). prod_emb I M J (Pi\<^sub>E J X)) (\<lambda>(J, X). \<Prod>j\<in>J \<union> {i \<in> I. emeasure (M i) (space (M i)) \<noteq> 1}. if j \<in> J then emeasure (M j) (X j) else emeasure (M j) (space (M j)))) = (\<Pi>\<^sub>E i\<in>I. space (M i))
[PROOF STEP]
by (intro space_extend_measure) simp


[STATEMENT]
lemma ennreal_divide_eq_top_iff: "(a::ennreal) / b = top \<longleftrightarrow> ((a \<noteq> 0 \<and> b = 0) \<or> (a = top \<and> b \<noteq> top))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a / b = top) = (a \<noteq> 0 \<and> b = 0 \<or> a = top \<and> b \<noteq> top)
[PROOF STEP]
by (auto simp add: divide_ennreal_def ennreal_mult_eq_top_iff)


[STATEMENT]
lemma integrable_on_powr_from_0:
  assumes a: "a > (-1::real)" and c: "c \<ge> 0"
  shows   "(\<lambda>x. x powr a) integrable_on {0..c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x powr a) integrable_on {0..c}
[PROOF STEP]
using has_integral_powr_from_0[OF assms]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}

goal (1 subgoal):
 1. (\<lambda>x. x powr a) integrable_on {0..c}
[PROOF STEP]
unfolding integrable_on_def
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1)) {0..c}

goal (1 subgoal):
 1. \<exists>y. ((\<lambda>x. x powr a) has_integral y) {0..c}
[PROOF STEP]
by blast


[STATEMENT]
lemma frontier_of_subtopology_mono:
   "\<lbrakk>S \<subseteq> T; T \<subseteq> U\<rbrakk> \<Longrightarrow> (subtopology X T) frontier_of S \<subseteq> (subtopology X U) frontier_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> T; T \<subseteq> U\<rbrakk> \<Longrightarrow> subtopology X T frontier_of S \<subseteq> subtopology X U frontier_of S
[PROOF STEP]
by (simp add: frontier_of_def Diff_mono closure_of_subtopology_mono interior_of_subtopology_mono)


[STATEMENT]
lemma polytope_equiv_bounded_polyhedron:
  "polytope P \<longleftrightarrow>
  (\<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polytope P = (\<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. polytope P \<Longrightarrow> \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
 2. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
assume polyP: "polytope P"
[PROOF STATE]
proof (state)
this:
polytope P

goal (2 subgoals):
 1. polytope P \<Longrightarrow> \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
 2. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
polytope P
[PROOF STEP]
obtain Q where Qcarr: "Q \<subseteq> carrier_vec n" and finQ: "finite Q"
    and PconvhQ: "P = convex_hull Q"
[PROOF STATE]
proof (prove)
using this:
polytope P

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>Q \<subseteq> carrier_vec n; finite Q; P = convex_hull Q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding polytope_def
[PROOF STATE]
proof (prove)
using this:
\<exists>V\<subseteq>carrier_vec n. finite V \<and> P = convex_hull V

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>Q \<subseteq> carrier_vec n; finite Q; P = convex_hull Q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Q \<subseteq> carrier_vec n
finite Q
P = convex_hull Q

goal (2 subgoals):
 1. polytope P \<Longrightarrow> \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
 2. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
let ?X = "{}"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. polytope P \<Longrightarrow> \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
 2. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
have "convex_hull Q + {0\<^sub>v n} = convex_hull Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_hull Q + {0\<^sub>v n} = convex_hull Q
[PROOF STEP]
using Qcarr add_0_right_vecset[of "convex_hull Q"]
[PROOF STATE]
proof (prove)
using this:
Q \<subseteq> carrier_vec n
convex_hull Q \<subseteq> carrier_vec ?n \<Longrightarrow> convex_hull Q + {0\<^sub>v ?n} = convex_hull Q

goal (1 subgoal):
 1. convex_hull Q + {0\<^sub>v n} = convex_hull Q
[PROOF STEP]
by (simp add: convex_hull_carrier)
[PROOF STATE]
proof (state)
this:
convex_hull Q + {0\<^sub>v n} = convex_hull Q

goal (2 subgoals):
 1. polytope P \<Longrightarrow> \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
 2. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
hence "P = convex_hull Q + cone ?X"
[PROOF STATE]
proof (prove)
using this:
convex_hull Q + {0\<^sub>v n} = convex_hull Q

goal (1 subgoal):
 1. P = convex_hull Q + cone {}
[PROOF STEP]
using PconvhQ
[PROOF STATE]
proof (prove)
using this:
convex_hull Q + {0\<^sub>v n} = convex_hull Q
P = convex_hull Q

goal (1 subgoal):
 1. P = convex_hull Q + cone {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P = convex_hull Q + cone {}

goal (2 subgoals):
 1. polytope P \<Longrightarrow> \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
 2. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
hence "Q \<union> ?X \<subseteq> carrier_vec n \<and> finite (Q \<union> ?X) \<and> P = convex_hull Q + cone ?X"
[PROOF STATE]
proof (prove)
using this:
P = convex_hull Q + cone {}

goal (1 subgoal):
 1. Q \<union> {} \<subseteq> carrier_vec n \<and> finite (Q \<union> {}) \<and> P = convex_hull Q + cone {}
[PROOF STEP]
using Qcarr finQ PconvhQ
[PROOF STATE]
proof (prove)
using this:
P = convex_hull Q + cone {}
Q \<subseteq> carrier_vec n
finite Q
P = convex_hull Q

goal (1 subgoal):
 1. Q \<union> {} \<subseteq> carrier_vec n \<and> finite (Q \<union> {}) \<and> P = convex_hull Q + cone {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Q \<union> {} \<subseteq> carrier_vec n \<and> finite (Q \<union> {}) \<and> P = convex_hull Q + cone {}

goal (2 subgoals):
 1. polytope P \<Longrightarrow> \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
 2. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
hence "\<exists> A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b"
[PROOF STATE]
proof (prove)
using this:
Q \<union> {} \<subseteq> carrier_vec n \<and> finite (Q \<union> {}) \<and> P = convex_hull Q + cone {}

goal (1 subgoal):
 1. \<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b
[PROOF STEP]
using decomposition_theorem_polyhedra
[PROOF STATE]
proof (prove)
using this:
Q \<union> {} \<subseteq> carrier_vec n \<and> finite (Q \<union> {}) \<and> P = convex_hull Q + cone {}
(\<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> ?P = polyhedron A b) = (\<exists>Q X. Q \<union> X \<subseteq> carrier_vec n \<and> finite (Q \<union> X) \<and> ?P = convex_hull Q + cone X)

goal (1 subgoal):
 1. \<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b

goal (2 subgoals):
 1. polytope P \<Longrightarrow> \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
 2. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
hence Ppolyh: "\<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b"
[PROOF STATE]
proof (prove)
using this:
\<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b

goal (1 subgoal):
 1. \<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b

goal (2 subgoals):
 1. polytope P \<Longrightarrow> \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
 2. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
from finite_Bounded_vec_Max[OF Qcarr finQ]
[PROOF STATE]
proof (chain)
picking this:
Q \<subseteq> Bounded_vec (Max {\<bar>a $ i\<bar> |a i. a \<in> Q \<and> i < n})
[PROOF STEP]
obtain bnd where "Q \<subseteq> Bounded_vec bnd"
[PROOF STATE]
proof (prove)
using this:
Q \<subseteq> Bounded_vec (Max {\<bar>a $ i\<bar> |a i. a \<in> Q \<and> i < n})

goal (1 subgoal):
 1. (\<And>bnd. Q \<subseteq> Bounded_vec bnd \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Q \<subseteq> Bounded_vec bnd

goal (2 subgoals):
 1. polytope P \<Longrightarrow> \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
 2. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
hence Pbnd: "P \<subseteq> Bounded_vec bnd"
[PROOF STATE]
proof (prove)
using this:
Q \<subseteq> Bounded_vec bnd

goal (1 subgoal):
 1. P \<subseteq> Bounded_vec bnd
[PROOF STEP]
using convex_hull_bound PconvhQ Qcarr
[PROOF STATE]
proof (prove)
using this:
Q \<subseteq> Bounded_vec bnd
\<lbrakk>?X \<subseteq> Bounded_vec ?Bnd; ?X \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> convex_hull ?X \<subseteq> Bounded_vec ?Bnd
P = convex_hull Q
Q \<subseteq> carrier_vec n

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

goal (2 subgoals):
 1. polytope P \<Longrightarrow> \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
 2. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
from Ppolyh Pbnd
[PROOF STATE]
proof (chain)
picking this:
\<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b
P \<subseteq> Bounded_vec bnd
[PROOF STEP]
show "\<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr
    \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd"
[PROOF STATE]
proof (prove)
using this:
\<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b
P \<subseteq> Bounded_vec bnd

goal (1 subgoal):
 1. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd

goal (1 subgoal):
 1. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
assume "\<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b
    \<and> P \<subseteq> Bounded_vec bnd"
[PROOF STATE]
proof (state)
this:
\<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd

goal (1 subgoal):
 1. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd
[PROOF STEP]
obtain A b nr bnd where Adim: "A \<in> carrier_mat nr n" and bdim: "b \<in> carrier_vec nr"
    and Ppolyh: "P = polyhedron A b" and Pbnd: "P \<subseteq> Bounded_vec bnd"
[PROOF STATE]
proof (prove)
using this:
\<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd

goal (1 subgoal):
 1. (\<And>A nr b bnd. \<lbrakk>A \<in> carrier_mat nr n; b \<in> carrier_vec nr; P = polyhedron A b; P \<subseteq> Bounded_vec bnd\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat nr n
b \<in> carrier_vec nr
P = polyhedron A b
P \<subseteq> Bounded_vec bnd

goal (1 subgoal):
 1. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
have "\<exists> A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b
[PROOF STEP]
using Adim bdim Ppolyh
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr n
b \<in> carrier_vec nr
P = polyhedron A b

goal (1 subgoal):
 1. \<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b

goal (1 subgoal):
 1. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
hence "\<exists> Q X. Q \<union> X \<subseteq> carrier_vec n \<and> finite (Q \<union> X) \<and> P = convex_hull Q + cone X"
[PROOF STATE]
proof (prove)
using this:
\<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b

goal (1 subgoal):
 1. \<exists>Q X. Q \<union> X \<subseteq> carrier_vec n \<and> finite (Q \<union> X) \<and> P = convex_hull Q + cone X
[PROOF STEP]
using decomposition_theorem_polyhedra
[PROOF STATE]
proof (prove)
using this:
\<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b
(\<exists>A b nr. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> ?P = polyhedron A b) = (\<exists>Q X. Q \<union> X \<subseteq> carrier_vec n \<and> finite (Q \<union> X) \<and> ?P = convex_hull Q + cone X)

goal (1 subgoal):
 1. \<exists>Q X. Q \<union> X \<subseteq> carrier_vec n \<and> finite (Q \<union> X) \<and> P = convex_hull Q + cone X
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>Q X. Q \<union> X \<subseteq> carrier_vec n \<and> finite (Q \<union> X) \<and> P = convex_hull Q + cone X

goal (1 subgoal):
 1. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>Q X. Q \<union> X \<subseteq> carrier_vec n \<and> finite (Q \<union> X) \<and> P = convex_hull Q + cone X
[PROOF STEP]
obtain Q X where QXcarr: "Q \<union> X \<subseteq> carrier_vec n"
    and finQX: "finite (Q \<union> X)" and Psum: "P = convex_hull Q + cone X"
[PROOF STATE]
proof (prove)
using this:
\<exists>Q X. Q \<union> X \<subseteq> carrier_vec n \<and> finite (Q \<union> X) \<and> P = convex_hull Q + cone X

goal (1 subgoal):
 1. (\<And>Q X. \<lbrakk>Q \<union> X \<subseteq> carrier_vec n; finite (Q \<union> X); P = convex_hull Q + cone X\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Q \<union> X \<subseteq> carrier_vec n
finite (Q \<union> X)
P = convex_hull Q + cone X

goal (1 subgoal):
 1. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
from QXcarr
[PROOF STATE]
proof (chain)
picking this:
Q \<union> X \<subseteq> carrier_vec n
[PROOF STEP]
have Qcarr: "convex_hull Q \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
Q \<union> X \<subseteq> carrier_vec n

goal (1 subgoal):
 1. convex_hull Q \<subseteq> carrier_vec n
[PROOF STEP]
by (simp add: convex_hull_carrier)
[PROOF STATE]
proof (state)
this:
convex_hull Q \<subseteq> carrier_vec n

goal (1 subgoal):
 1. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
from QXcarr
[PROOF STATE]
proof (chain)
picking this:
Q \<union> X \<subseteq> carrier_vec n
[PROOF STEP]
have Xcarr: "cone X \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
Q \<union> X \<subseteq> carrier_vec n

goal (1 subgoal):
 1. cone X \<subseteq> carrier_vec n
[PROOF STEP]
by (simp add: gram_schmidt.cone_carrier)
[PROOF STATE]
proof (state)
this:
cone X \<subseteq> carrier_vec n

goal (1 subgoal):
 1. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
from Pbnd
[PROOF STATE]
proof (chain)
picking this:
P \<subseteq> Bounded_vec bnd
[PROOF STEP]
have Pcarr: "P \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
P \<subseteq> Bounded_vec bnd

goal (1 subgoal):
 1. P \<subseteq> carrier_vec n
[PROOF STEP]
using Ppolyh
[PROOF STATE]
proof (prove)
using this:
P \<subseteq> Bounded_vec bnd
P = polyhedron A b

goal (1 subgoal):
 1. P \<subseteq> carrier_vec n
[PROOF STEP]
unfolding polyhedron_def
[PROOF STATE]
proof (prove)
using this:
P \<subseteq> Bounded_vec bnd
P = {x \<in> carrier_vec n. A *\<^sub>v x \<le> b}

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

goal (1 subgoal):
 1. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
have "P = convex_hull Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P = convex_hull Q
[PROOF STEP]
proof(cases "Q = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Q = {} \<Longrightarrow> P = convex_hull Q
 2. Q \<noteq> {} \<Longrightarrow> P = convex_hull Q
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
Q = {}

goal (2 subgoals):
 1. Q = {} \<Longrightarrow> P = convex_hull Q
 2. Q \<noteq> {} \<Longrightarrow> P = convex_hull Q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Q = {}
[PROOF STEP]
show "P = convex_hull Q"
[PROOF STATE]
proof (prove)
using this:
Q = {}

goal (1 subgoal):
 1. P = convex_hull Q
[PROOF STEP]
unfolding Psum
[PROOF STATE]
proof (prove)
using this:
Q = {}

goal (1 subgoal):
 1. convex_hull Q + cone X = convex_hull Q
[PROOF STEP]
by (auto simp: set_plus_def)
[PROOF STATE]
proof (state)
this:
P = convex_hull Q

goal (1 subgoal):
 1. Q \<noteq> {} \<Longrightarrow> P = convex_hull Q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Q \<noteq> {} \<Longrightarrow> P = convex_hull Q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
Q \<noteq> {}

goal (1 subgoal):
 1. Q \<noteq> {} \<Longrightarrow> P = convex_hull Q
[PROOF STEP]
hence convnotempty: "convex_hull Q \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
Q \<noteq> {}

goal (1 subgoal):
 1. convex_hull Q \<noteq> {}
[PROOF STEP]
using QXcarr
[PROOF STATE]
proof (prove)
using this:
Q \<noteq> {}
Q \<union> X \<subseteq> carrier_vec n

goal (1 subgoal):
 1. convex_hull Q \<noteq> {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
convex_hull Q \<noteq> {}

goal (1 subgoal):
 1. Q \<noteq> {} \<Longrightarrow> P = convex_hull Q
[PROOF STEP]
have Pbndex: "\<exists>bnd. P \<subseteq> Bounded_vec bnd"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>bnd. P \<subseteq> Bounded_vec bnd
[PROOF STEP]
using Pbnd
[PROOF STATE]
proof (prove)
using this:
P \<subseteq> Bounded_vec bnd

goal (1 subgoal):
 1. \<exists>bnd. P \<subseteq> Bounded_vec bnd
[PROOF STEP]
using QXcarr
[PROOF STATE]
proof (prove)
using this:
P \<subseteq> Bounded_vec bnd
Q \<union> X \<subseteq> carrier_vec n

goal (1 subgoal):
 1. \<exists>bnd. P \<subseteq> Bounded_vec bnd
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>bnd. P \<subseteq> Bounded_vec bnd

goal (1 subgoal):
 1. Q \<noteq> {} \<Longrightarrow> P = convex_hull Q
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
Q \<noteq> {}
[PROOF STEP]
have "(\<exists> bndc. cone X \<subseteq> Bounded_vec bndc)"
[PROOF STATE]
proof (prove)
using this:
Q \<noteq> {}

goal (1 subgoal):
 1. \<exists>bndc. cone X \<subseteq> Bounded_vec bndc
[PROOF STEP]
using bounded_vecset_sum[OF Qcarr Xcarr Psum Pbndex] False convnotempty
[PROOF STATE]
proof (prove)
using this:
Q \<noteq> {}
convex_hull Q \<noteq> {} \<Longrightarrow> \<exists>bndB. cone X \<subseteq> Bounded_vec bndB
cone X \<noteq> {} \<Longrightarrow> \<exists>bndA. convex_hull Q \<subseteq> Bounded_vec bndA
Q \<noteq> {}
convex_hull Q \<noteq> {}

goal (1 subgoal):
 1. \<exists>bndc. cone X \<subseteq> Bounded_vec bndc
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>bndc. cone X \<subseteq> Bounded_vec bndc

goal (1 subgoal):
 1. Q \<noteq> {} \<Longrightarrow> P = convex_hull Q
[PROOF STEP]
hence "cone X = {0\<^sub>v n}"
[PROOF STATE]
proof (prove)
using this:
\<exists>bndc. cone X \<subseteq> Bounded_vec bndc

goal (1 subgoal):
 1. cone X = {0\<^sub>v n}
[PROOF STEP]
using bounded_cone_is_zero QXcarr
[PROOF STATE]
proof (prove)
using this:
\<exists>bndc. cone X \<subseteq> Bounded_vec bndc
\<lbrakk>?C \<subseteq> carrier_vec n; cone ?C \<subseteq> Bounded_vec ?bnd\<rbrakk> \<Longrightarrow> cone ?C = {0\<^sub>v n}
Q \<union> X \<subseteq> carrier_vec n

goal (1 subgoal):
 1. cone X = {0\<^sub>v n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cone X = {0\<^sub>v n}

goal (1 subgoal):
 1. Q \<noteq> {} \<Longrightarrow> P = convex_hull Q
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
cone X = {0\<^sub>v n}

goal (1 subgoal):
 1. P = convex_hull Q
[PROOF STEP]
unfolding Psum
[PROOF STATE]
proof (prove)
using this:
cone X = {0\<^sub>v n}

goal (1 subgoal):
 1. convex_hull Q + cone X = convex_hull Q
[PROOF STEP]
using Qcarr
[PROOF STATE]
proof (prove)
using this:
cone X = {0\<^sub>v n}
convex_hull Q \<subseteq> carrier_vec n

goal (1 subgoal):
 1. convex_hull Q + cone X = convex_hull Q
[PROOF STEP]
by (auto simp: add_0_right_vecset)
[PROOF STATE]
proof (state)
this:
P = convex_hull Q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P = convex_hull Q

goal (1 subgoal):
 1. \<exists>A b nr bnd. A \<in> carrier_mat nr n \<and> b \<in> carrier_vec nr \<and> P = polyhedron A b \<and> P \<subseteq> Bounded_vec bnd \<Longrightarrow> polytope P
[PROOF STEP]
thus "polytope P"
[PROOF STATE]
proof (prove)
using this:
P = convex_hull Q

goal (1 subgoal):
 1. polytope P
[PROOF STEP]
using finQX QXcarr
[PROOF STATE]
proof (prove)
using this:
P = convex_hull Q
finite (Q \<union> X)
Q \<union> X \<subseteq> carrier_vec n

goal (1 subgoal):
 1. polytope P
[PROOF STEP]
unfolding polytope_def
[PROOF STATE]
proof (prove)
using this:
P = convex_hull Q
finite (Q \<union> X)
Q \<union> X \<subseteq> carrier_vec n

goal (1 subgoal):
 1. \<exists>V\<subseteq>carrier_vec n. finite V \<and> P = convex_hull V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
polytope P

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ident_has_integral:
  fixes a::real
  assumes "a \<le> b"
  shows "((\<lambda>x. x) has_integral (b\<^sup>2 - a\<^sup>2)/2) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x) has_integral (b\<^sup>2 - a\<^sup>2) / 2) {a..b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. x) has_integral (b\<^sup>2 - a\<^sup>2) / 2) {a..b}
[PROOF STEP]
have "((\<lambda>x. x) has_integral inverse 2 * b\<^sup>2 - inverse 2 * a\<^sup>2) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x) has_integral inverse 2 * b\<^sup>2 - inverse 2 * a\<^sup>2) {a..b}
[PROOF STEP]
unfolding power2_eq_square
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x) has_integral inverse 2 * (b * b) - inverse 2 * (a * a)) {a..b}
[PROOF STEP]
by (rule fundamental_theorem_of_calculus [OF assms] derivative_eq_intros | simp)+
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x) has_integral inverse 2 * b\<^sup>2 - inverse 2 * a\<^sup>2) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. x) has_integral (b\<^sup>2 - a\<^sup>2) / 2) {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. x) has_integral inverse 2 * b\<^sup>2 - inverse 2 * a\<^sup>2) {a..b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x) has_integral inverse 2 * b\<^sup>2 - inverse 2 * a\<^sup>2) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. x) has_integral (b\<^sup>2 - a\<^sup>2) / 2) {a..b}
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x) has_integral (b\<^sup>2 - a\<^sup>2) / 2) {a..b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_Suc_exists_in_fset:
  shows "card_fset S = Suc n \<Longrightarrow> \<exists>a. a |\<in>| S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_fset S = Suc n \<Longrightarrow> \<exists>a. a |\<in>| S
[PROOF STEP]
by (drule card_fset_Suc) (auto)


[STATEMENT]
lemma orthogonal_complement_zero_intersection:
  assumes "0\<in>M"
  shows \<open>M \<inter> (orthogonal_complement M) = {0}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M \<inter> orthogonal_complement M = {0::'a}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M \<inter> orthogonal_complement M = {0::'a}
[PROOF STEP]
have "x=0" if "x\<in>M" and "x\<in>orthogonal_complement M" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = (0::'a)
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
x \<in> M
x \<in> orthogonal_complement M
[PROOF STEP]
have "is_orthogonal x x"
[PROOF STATE]
proof (prove)
using this:
x \<in> M
x \<in> orthogonal_complement M

goal (1 subgoal):
 1. is_orthogonal x x
[PROOF STEP]
unfolding orthogonal_complement_def
[PROOF STATE]
proof (prove)
using this:
x \<in> M
x \<in> {x |x. \<forall>y\<in>M. is_orthogonal x y}

goal (1 subgoal):
 1. is_orthogonal x x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_orthogonal x x

goal (1 subgoal):
 1. x = (0::'a)
[PROOF STEP]
thus "x=0"
[PROOF STATE]
proof (prove)
using this:
is_orthogonal x x

goal (1 subgoal):
 1. x = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> M; ?x \<in> orthogonal_complement M\<rbrakk> \<Longrightarrow> ?x = (0::'a)

goal (1 subgoal):
 1. M \<inter> orthogonal_complement M = {0::'a}
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<in> M
\<lbrakk>?x \<in> M; ?x \<in> orthogonal_complement M\<rbrakk> \<Longrightarrow> ?x = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<in> M
\<lbrakk>?x \<in> M; ?x \<in> orthogonal_complement M\<rbrakk> \<Longrightarrow> ?x = (0::'a)

goal (1 subgoal):
 1. M \<inter> orthogonal_complement M = {0::'a}
[PROOF STEP]
unfolding orthogonal_complement_def
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<in> M
\<lbrakk>?x \<in> M; ?x \<in> {x |x. \<forall>y\<in>M. is_orthogonal x y}\<rbrakk> \<Longrightarrow> ?x = (0::'a)

goal (1 subgoal):
 1. M \<inter> {x |x. \<forall>y\<in>M. is_orthogonal x y} = {0::'a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M \<inter> orthogonal_complement M = {0::'a}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma adj_to_edge_set_card:
  assumes "e \<in> edge_set"
  shows "card e = 1 \<or> card e = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card e = 1 \<or> card e = 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card e = 1 \<or> card e = 2
[PROOF STEP]
obtain u v where "e = {u, v}" and "adj u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u v. \<lbrakk>e = {u, v}; adj u v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using obtain_edge_pair_adj assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?e \<in> edge_set; \<And>u v. \<lbrakk>?e = {u, v}; adj u v\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
e \<in> edge_set

goal (1 subgoal):
 1. (\<And>u v. \<lbrakk>e = {u, v}; adj u v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
e = {u, v}
adj u v

goal (1 subgoal):
 1. card e = 1 \<or> card e = 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e = {u, v}
adj u v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
e = {u, v}
adj u v

goal (1 subgoal):
 1. card e = 1 \<or> card e = 2
[PROOF STEP]
by (cases "u = v", simp_all)
[PROOF STATE]
proof (state)
this:
card e = 1 \<or> card e = 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lfp_subset_iter:
  "\<lbrakk> mono f; !!X. f X \<subseteq> f' X; lfp f \<subseteq> D \<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' n A D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' n A D
[PROOF STEP]
proof(induction n arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' 0 A D
 2. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' n A D; mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' (Suc n) A D
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
mono f
f ?X \<subseteq> f' ?X
lfp f \<subseteq> D

goal (2 subgoals):
 1. \<And>A. \<lbrakk>mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' 0 A D
 2. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' n A D; mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' (Suc n) A D
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
mono f
f ?X \<subseteq> f' ?X
lfp f \<subseteq> D

goal (1 subgoal):
 1. lfp f \<subseteq> iter f' 0 A D
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lfp f \<subseteq> iter f' 0 A D

goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' n A D; mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' (Suc n) A D
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' n A D; mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' (Suc n) A D
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
\<lbrakk>mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' n_ ?A D
mono f
f ?X \<subseteq> f' ?X
lfp f \<subseteq> D

goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' n A D; mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' (Suc n) A D
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>mono f; \<And>X. f X \<subseteq> f' X; lfp f \<subseteq> D\<rbrakk> \<Longrightarrow> lfp f \<subseteq> iter f' n_ ?A D
mono f
f ?X \<subseteq> f' ?X
lfp f \<subseteq> D

goal (1 subgoal):
 1. lfp f \<subseteq> iter f' (Suc n_) A D
[PROOF STEP]
by simp (metis lfp_lowerbound)
[PROOF STATE]
proof (state)
this:
lfp f \<subseteq> iter f' (Suc n_) A D

goal:
No subgoals!
[PROOF STEP]
qed