# HG changeset patch # User paulson # Date 1524779224 -3600 # Node ID 0b4fb9fd91b10b015c1fb56e05eb2d9ada22836d # Parent ce8ad77cd3fa4a940b425343f9ab92758e91aead more messy proofs diff -r ce8ad77cd3fa -r 0b4fb9fd91b1 src/HOL/Analysis/Convex_Euclidean_Space.thy --- a/src/HOL/Analysis/Convex_Euclidean_Space.thy Thu Apr 26 16:14:35 2018 +0100 +++ b/src/HOL/Analysis/Convex_Euclidean_Space.thy Thu Apr 26 22:47:04 2018 +0100 @@ -2579,19 +2579,18 @@ also have "\ = u * v1 + v * v2" by simp finally have **:"1 - (u * u1 + v * u2) = u * v1 + v * v2" by auto - have "0 \ u * v1 + v * v2" "0 \ u * v1" "0 \ u * v1 + v * v2" "0 \ v * v2" + let ?b = "((u * v1) / (u * v1 + v * v2)) *\<^sub>R b1 + ((v * v2) / (u * v1 + v * v2)) *\<^sub>R b2" + have zeroes: "0 \ u * v1 + v * v2" "0 \ u * v1" "0 \ u * v1 + v * v2" "0 \ v * v2" using as(1,2) obt1(1,2) obt2(1,2) by auto - then show ?thesis - unfolding xeq yeq * ** - using False - apply (rule_tac - x = "((u * v1) / (u * v1 + v * v2)) *\<^sub>R b1 + ((v * v2) / (u * v1 + v * v2)) *\<^sub>R b2" in bexI) - defer - apply (rule convexD [OF convex_convex_hull]) - using obt1(4) obt2(4) - unfolding add_divide_distrib[symmetric] and zero_le_divide_iff - apply (auto simp: scaleR_left_distrib scaleR_right_distrib) - done + show ?thesis + proof + show "u *\<^sub>R x + v *\<^sub>R y = (u * u1) *\<^sub>R a + (v * u2) *\<^sub>R a + (?b - (u * u1) *\<^sub>R ?b - (v * u2) *\<^sub>R ?b)" + unfolding xeq yeq * ** + using False by (auto simp: scaleR_left_distrib scaleR_right_distrib) + show "?b \ convex hull S" + using False zeroes obt1(4) obt2(4) + by (auto simp: convexD [OF convex_convex_hull] scaleR_left_distrib scaleR_right_distrib add_divide_distrib[symmetric] zero_le_divide_iff) + qed qed then obtain b where b: "b \ convex hull S" "u *\<^sub>R x + v *\<^sub>R y = (u * u1) *\<^sub>R a + (v * u2) *\<^sub>R a + (b - (u * u1) *\<^sub>R b - (v * u2) *\<^sub>R b)" .. @@ -2629,143 +2628,80 @@ subsubsection%unimportant \Explicit expression for convex hull\ proposition%important convex_hull_indexed: - fixes s :: "'a::real_vector set" - shows "convex hull s = - {y. \k u x. - (\i\{1::nat .. k}. 0 \ u i \ x i \ s) \ - (sum u {1..k} = 1) \ (sum (\i. u i *\<^sub>R x i) {1..k} = y)}" - (is "?xyz = ?hull") - apply%unimportant (rule hull_unique) - apply rule - defer - apply (rule convexI) -proof - - fix x - assume "x\s" - then show "x \ ?hull" - unfolding mem_Collect_eq - apply (rule_tac x=1 in exI, rule_tac x="\x. 1" in exI, auto) - done + fixes S :: "'a::real_vector set" + shows "convex hull S = + {y. \k u x. (\i\{1::nat .. k}. 0 \ u i \ x i \ S) \ + (sum u {1..k} = 1) \ (\i = 1..k. u i *\<^sub>R x i) = y}" + (is "?xyz = ?hull") +proof (rule hull_unique [OF _ convexI]) + show "S \ ?hull" + by (clarsimp, rule_tac x=1 in exI, rule_tac x="\x. 1" in exI, auto) next - fix t - assume as: "s \ t" "convex t" - show "?hull \ t" - apply rule - unfolding mem_Collect_eq - apply (elim exE conjE) - proof - - fix x k u y - assume assm: - "\i\{1::nat..k}. 0 \ u i \ y i \ s" - "sum u {1..k} = 1" "(\i = 1..k. u i *\<^sub>R y i) = x" - show "x\t" - unfolding assm(3) [symmetric] - apply (rule as(2)[unfolded convex, rule_format]) - using assm(1,2) as(1) apply auto - done - qed + fix T + assume "S \ T" "convex T" + then show "?hull \ T" + by (blast intro: convex_sum) next fix x y u v assume uv: "0 \ u" "0 \ v" "u + v = (1::real)" assume xy: "x \ ?hull" "y \ ?hull" from xy obtain k1 u1 x1 where - x: "\i\{1::nat..k1}. 0\u1 i \ x1 i \ s" "sum u1 {Suc 0..k1} = 1" "(\i = Suc 0..k1. u1 i *\<^sub>R x1 i) = x" + x [rule_format]: "\i\{1::nat..k1}. 0\u1 i \ x1 i \ S" + "sum u1 {Suc 0..k1} = 1" "(\i = Suc 0..k1. u1 i *\<^sub>R x1 i) = x" by auto from xy obtain k2 u2 x2 where - y: "\i\{1::nat..k2}. 0\u2 i \ x2 i \ s" "sum u2 {Suc 0..k2} = 1" "(\i = Suc 0..k2. u2 i *\<^sub>R x2 i) = y" + y [rule_format]: "\i\{1::nat..k2}. 0\u2 i \ x2 i \ S" + "sum u2 {Suc 0..k2} = 1" "(\i = Suc 0..k2. u2 i *\<^sub>R x2 i) = y" by auto - have *: "\P (x1::'a) x2 s1 s2 i. - (if P i then s1 else s2) *\<^sub>R (if P i then x1 else x2) = (if P i then s1 *\<^sub>R x1 else s2 *\<^sub>R x2)" - "{1..k1 + k2} \ {1..k1} = {1..k1}" "{1..k1 + k2} \ - {1..k1} = (\i. i + k1) ` {1..k2}" - prefer 3 - apply (rule, rule) - unfolding image_iff - apply (rule_tac x = "x - k1" in bexI) - apply (auto simp: not_le) - done + have *: "\P (x::'a) y s t i. (if P i then s else t) *\<^sub>R (if P i then x else y) = (if P i then s *\<^sub>R x else t *\<^sub>R y)" + "{1..k1 + k2} \ {1..k1} = {1..k1}" "{1..k1 + k2} \ - {1..k1} = (\i. i + k1) ` {1..k2}" + by auto have inj: "inj_on (\i. i + k1) {1..k2}" unfolding inj_on_def by auto + let ?uu = "\i. if i \ {1..k1} then u * u1 i else v * u2 (i - k1)" + let ?xx = "\i. if i \ {1..k1} then x1 i else x2 (i - k1)" show "u *\<^sub>R x + v *\<^sub>R y \ ?hull" - apply rule - apply (rule_tac x="k1 + k2" in exI) - apply (rule_tac x="\i. if i \ {1..k1} then u * u1 i else v * u2 (i - k1)" in exI) - apply (rule_tac x="\i. if i \ {1..k1} then x1 i else x2 (i - k1)" in exI) - apply (rule, rule) - defer - apply rule - unfolding * and sum.If_cases[OF finite_atLeastAtMost[of 1 "k1 + k2"]] and - sum.reindex[OF inj] and o_def Collect_mem_eq - unfolding scaleR_scaleR[symmetric] scaleR_right.sum [symmetric] sum_distrib_left[symmetric] - proof - - fix i - assume i: "i \ {1..k1+k2}" - show "0 \ (if i \ {1..k1} then u * u1 i else v * u2 (i - k1)) \ - (if i \ {1..k1} then x1 i else x2 (i - k1)) \ s" - proof (cases "i\{1..k1}") - case True - then show ?thesis - using uv(1) x(1)[THEN bspec[where x=i]] by auto - next - case False - define j where "j = i - k1" - from i False have "j \ {1..k2}" - unfolding j_def by auto - then show ?thesis - using False uv(2) y(1)[THEN bspec[where x=j]] - by (auto simp: j_def[symmetric]) - qed - qed (auto simp: not_le x(2,3) y(2,3) uv(3)) + proof (intro CollectI exI conjI ballI) + show "0 \ ?uu i" "?xx i \ S" if "i \ {1..k1+k2}" for i + using that by (auto simp add: le_diff_conv uv(1) x(1) uv(2) y(1)) + show "(\i = 1..k1 + k2. ?uu i) = 1" "(\i = 1..k1 + k2. ?uu i *\<^sub>R ?xx i) = u *\<^sub>R x + v *\<^sub>R y" + unfolding * sum.If_cases[OF finite_atLeastAtMost[of 1 "k1 + k2"]] + sum.reindex[OF inj] Collect_mem_eq o_def + unfolding scaleR_scaleR[symmetric] scaleR_right.sum [symmetric] sum_distrib_left[symmetric] + by (simp_all add: sum_distrib_left[symmetric] x(2,3) y(2,3) uv(3)) + qed qed lemma convex_hull_finite: - fixes s :: "'a::real_vector set" - assumes "finite s" - shows "convex hull s = {y. \u. (\x\s. 0 \ u x) \ - sum u s = 1 \ sum (\x. u x *\<^sub>R x) s = y}" - (is "?HULL = ?set") -proof (rule hull_unique, auto simp: convex_def[of ?set]) + fixes S :: "'a::real_vector set" + assumes "finite S" + shows "convex hull S = {y. \u. (\x\S. 0 \ u x) \ sum u S = 1 \ sum (\x. u x *\<^sub>R x) S = y}" + (is "?HULL = _") +proof (rule hull_unique [OF _ convexI]; clarify) fix x - assume "x \ s" - then show "\u. (\x\s. 0 \ u x) \ sum u s = 1 \ (\x\s. u x *\<^sub>R x) = x" - apply (rule_tac x="\y. if x=y then 1 else 0" in exI, auto) - unfolding sum.delta'[OF assms] and sum_delta''[OF assms] - apply auto - done + assume "x \ S" + then show "\u. (\x\S. 0 \ u x) \ sum u S = 1 \ (\x\S. u x *\<^sub>R x) = x" + by (rule_tac x="\y. if x=y then 1 else 0" in exI) (auto simp: sum.delta'[OF assms] sum_delta''[OF assms]) next fix u v :: real assume uv: "0 \ u" "0 \ v" "u + v = 1" - fix ux assume ux: "\x\s. 0 \ ux x" "sum ux s = (1::real)" - fix uy assume uy: "\x\s. 0 \ uy x" "sum uy s = (1::real)" - { - fix x - assume "x\s" - then have "0 \ u * ux x + v * uy x" - using ux(1)[THEN bspec[where x=x]] uy(1)[THEN bspec[where x=x]] and uv(1,2) - by auto - } + fix ux assume ux [rule_format]: "\x\S. 0 \ ux x" "sum ux S = (1::real)" + fix uy assume uy [rule_format]: "\x\S. 0 \ uy x" "sum uy S = (1::real)" + have "0 \ u * ux x + v * uy x" if "x\S" for x + by (simp add: that uv ux(1) uy(1)) moreover - have "(\x\s. u * ux x + v * uy x) = 1" - unfolding sum.distrib and sum_distrib_left[symmetric] and ux(2) uy(2) + have "(\x\S. u * ux x + v * uy x) = 1" + unfolding sum.distrib and sum_distrib_left[symmetric] ux(2) uy(2) using uv(3) by auto moreover - have "(\x\s. (u * ux x + v * uy x) *\<^sub>R x) = u *\<^sub>R (\x\s. ux x *\<^sub>R x) + v *\<^sub>R (\x\s. uy x *\<^sub>R x)" - unfolding scaleR_left_distrib and sum.distrib and scaleR_scaleR[symmetric] - and scaleR_right.sum [symmetric] + have "(\x\S. (u * ux x + v * uy x) *\<^sub>R x) = u *\<^sub>R (\x\S. ux x *\<^sub>R x) + v *\<^sub>R (\x\S. uy x *\<^sub>R x)" + unfolding scaleR_left_distrib sum.distrib scaleR_scaleR[symmetric] scaleR_right.sum [symmetric] by auto ultimately - show "\uc. (\x\s. 0 \ uc x) \ sum uc s = 1 \ - (\x\s. uc x *\<^sub>R x) = u *\<^sub>R (\x\s. ux x *\<^sub>R x) + v *\<^sub>R (\x\s. uy x *\<^sub>R x)" - apply (rule_tac x="\x. u * ux x + v * uy x" in exI, auto) - done -next - fix t - assume t: "s \ t" "convex t" - fix u - assume u: "\x\s. 0 \ u x" "sum u s = (1::real)" - then show "(\x\s. u x *\<^sub>R x) \ t" - using t(2)[unfolded convex_explicit, THEN spec[where x=s], THEN spec[where x=u]] - using assms and t(1) by auto -qed + show "\uc. (\x\S. 0 \ uc x) \ sum uc S = 1 \ + (\x\S. uc x *\<^sub>R x) = u *\<^sub>R (\x\S. ux x *\<^sub>R x) + v *\<^sub>R (\x\S. uy x *\<^sub>R x)" + by (rule_tac x="\x. u * ux x + v * uy x" in exI, auto) +qed (use assms in \auto simp: convex_explicit\) subsubsection%unimportant \Another formulation from Lars Schewe\ @@ -2773,7 +2709,7 @@ lemma convex_hull_explicit: fixes p :: "'a::real_vector set" shows "convex hull p = - {y. \s u. finite s \ s \ p \ (\x\s. 0 \ u x) \ sum u s = 1 \ sum (\v. u v *\<^sub>R v) s = y}" + {y. \S u. finite S \ S \ p \ (\x\S. 0 \ u x) \ sum u S = 1 \ sum (\v. u v *\<^sub>R v) S = y}" (is "?lhs = ?rhs") proof - { @@ -2803,7 +2739,7 @@ using sum_image_gen[OF fin, of "\i. u i *\<^sub>R y i" y, symmetric] unfolding scaleR_left.sum using obt(3) by auto ultimately - have "\s u. finite s \ s \ p \ (\x\s. 0 \ u x) \ sum u s = 1 \ (\v\s. u v *\<^sub>R v) = x" + have "\S u. finite S \ S \ p \ (\x\S. 0 \ u x) \ sum u S = 1 \ (\v\S. u v *\<^sub>R v) = x" apply (rule_tac x="y ` {1..k}" in exI) apply (rule_tac x="\v. sum u {i\{1..k}. y i = v}" in exI, auto) done @@ -2813,50 +2749,48 @@ { fix y assume "y\?rhs" - then obtain s u where - obt: "finite s" "s \ p" "\x\s. 0 \ u x" "sum u s = 1" "(\v\s. u v *\<^sub>R v) = y" + then obtain S u where + obt: "finite S" "S \ p" "\x\S. 0 \ u x" "sum u S = 1" "(\v\S. u v *\<^sub>R v) = y" by auto - obtain f where f: "inj_on f {1..card s}" "f ` {1..card s} = s" + obtain f where f: "inj_on f {1..card S}" "f ` {1..card S} = S" using ex_bij_betw_nat_finite_1[OF obt(1)] unfolding bij_betw_def by auto { fix i :: nat - assume "i\{1..card s}" - then have "f i \ s" - apply (subst f(2)[symmetric]) - apply auto - done + assume "i\{1..card S}" + then have "f i \ S" + using f(2) by blast then have "0 \ u (f i)" "f i \ p" using obt(2,3) by auto } - moreover have *: "finite {1..card s}" by auto + moreover have *: "finite {1..card S}" by auto { fix y - assume "y\s" - then obtain i where "i\{1..card s}" "f i = y" - using f using image_iff[of y f "{1..card s}"] + assume "y\S" + then obtain i where "i\{1..card S}" "f i = y" + using f using image_iff[of y f "{1..card S}"] by auto - then have "{x. Suc 0 \ x \ x \ card s \ f x = y} = {i}" + then have "{x. Suc 0 \ x \ x \ card S \ f x = y} = {i}" apply auto using f(1)[unfolded inj_on_def] by (metis One_nat_def atLeastAtMost_iff) - then have "card {x. Suc 0 \ x \ x \ card s \ f x = y} = 1" by auto - then have "(\x\{x \ {1..card s}. f x = y}. u (f x)) = u y" - "(\x\{x \ {1..card s}. f x = y}. u (f x) *\<^sub>R f x) = u y *\<^sub>R y" + then have "card {x. Suc 0 \ x \ x \ card S \ f x = y} = 1" by auto + then have "(\x\{x \ {1..card S}. f x = y}. u (f x)) = u y" + "(\x\{x \ {1..card S}. f x = y}. u (f x) *\<^sub>R f x) = u y *\<^sub>R y" by (auto simp: sum_constant_scaleR) } - then have "(\x = 1..card s. u (f x)) = 1" "(\i = 1..card s. u (f i) *\<^sub>R f i) = y" + then have "(\x = 1..card S. u (f x)) = 1" "(\i = 1..card S. u (f i) *\<^sub>R f i) = y" unfolding sum_image_gen[OF *(1), of "\x. u (f x) *\<^sub>R f x" f] and sum_image_gen[OF *(1), of "\x. u (f x)" f] unfolding f - using sum.cong [of s s "\y. (\x\{x \ {1..card s}. f x = y}. u (f x) *\<^sub>R f x)" "\v. u v *\<^sub>R v"] - using sum.cong [of s s "\y. (\x\{x \ {1..card s}. f x = y}. u (f x))" u] + using sum.cong [of S S "\y. (\x\{x \ {1..card S}. f x = y}. u (f x) *\<^sub>R f x)" "\v. u v *\<^sub>R v"] + using sum.cong [of S S "\y. (\x\{x \ {1..card S}. f x = y}. u (f x))" u] unfolding obt(4,5) by auto ultimately have "\k u x. (\i\{1..k}. 0 \ u i \ x i \ p) \ sum u {1..k} = 1 \ (\i::nat = 1..k. u i *\<^sub>R x i) = y" - apply (rule_tac x="card s" in exI) + apply (rule_tac x="card S" in exI) apply (rule_tac x="u \ f" in exI) apply (rule_tac x=f in exI, fastforce) done @@ -2871,62 +2805,57 @@ subsubsection%unimportant \A stepping theorem for that expansion\ lemma convex_hull_finite_step: - fixes s :: "'a::real_vector set" - assumes "finite s" + fixes S :: "'a::real_vector set" + assumes "finite S" shows - "(\u. (\x\insert a s. 0 \ u x) \ sum u (insert a s) = w \ sum (\x. u x *\<^sub>R x) (insert a s) = y) - \ (\v\0. \u. (\x\s. 0 \ u x) \ sum u s = w - v \ sum (\x. u x *\<^sub>R x) s = y - v *\<^sub>R a)" + "(\u. (\x\insert a S. 0 \ u x) \ sum u (insert a S) = w \ sum (\x. u x *\<^sub>R x) (insert a S) = y) + \ (\v\0. \u. (\x\S. 0 \ u x) \ sum u S = w - v \ sum (\x. u x *\<^sub>R x) S = y - v *\<^sub>R a)" (is "?lhs = ?rhs") -proof (rule, case_tac[!] "a\s") - assume "a \ s" - then have *: "insert a s = s" by auto +proof (rule, case_tac[!] "a\S") + assume "a \ S" + then have *: "insert a S = S" by auto assume ?lhs then show ?rhs - unfolding * - apply (rule_tac x=0 in exI, auto) - done + unfolding * by (rule_tac x=0 in exI, auto) next assume ?lhs then obtain u where - u: "\x\insert a s. 0 \ u x" "sum u (insert a s) = w" "(\x\insert a s. u x *\<^sub>R x) = y" + u: "\x\insert a S. 0 \ u x" "sum u (insert a S) = w" "(\x\insert a S. u x *\<^sub>R x) = y" by auto - assume "a \ s" + assume "a \ S" then show ?rhs apply (rule_tac x="u a" in exI) using u(1)[THEN bspec[where x=a]] apply simp apply (rule_tac x=u in exI) - using u[unfolded sum_clauses(2)[OF assms]] and \a\s\ + using u[unfolded sum_clauses(2)[OF assms]] and \a\S\ apply auto done next - assume "a \ s" - then have *: "insert a s = s" by auto - have fin: "finite (insert a s)" using assms by auto + assume "a \ S" + then have *: "insert a S = S" by auto + have fin: "finite (insert a S)" using assms by auto assume ?rhs - then obtain v u where uv: "v\0" "\x\s. 0 \ u x" "sum u s = w - v" "(\x\s. u x *\<^sub>R x) = y - v *\<^sub>R a" + then obtain v u where uv: "v\0" "\x\S. 0 \ u x" "sum u S = w - v" "(\x\S. u x *\<^sub>R x) = y - v *\<^sub>R a" by auto show ?lhs apply (rule_tac x = "\x. (if a = x then v else 0) + u x" in exI) unfolding scaleR_left_distrib and sum.distrib and sum_delta''[OF fin] and sum.delta'[OF fin] unfolding sum_clauses(2)[OF assms] - using uv and uv(2)[THEN bspec[where x=a]] and \a\s\ + using uv and uv(2)[THEN bspec[where x=a]] and \a\S\ apply auto done next assume ?rhs - then obtain v u where uv: "v\0" "\x\s. 0 \ u x" "sum u s = w - v" "(\x\s. u x *\<^sub>R x) = y - v *\<^sub>R a" + then obtain v u where uv: "v\0" "\x\S. 0 \ u x" "sum u S = w - v" "(\x\S. u x *\<^sub>R x) = y - v *\<^sub>R a" by auto - moreover assume "a \ s" + moreover assume "a \ S" moreover - have "(\x\s. if a = x then v else u x) = sum u s" "(\x\s. (if a = x then v else u x) *\<^sub>R x) = (\x\s. u x *\<^sub>R x)" - using \a \ s\ + have "(\x\S. if a = x then v else u x) = sum u S" "(\x\S. (if a = x then v else u x) *\<^sub>R x) = (\x\S. u x *\<^sub>R x)" + using \a \ S\ by (auto simp: intro!: sum.cong) ultimately show ?lhs - apply (rule_tac x="\x. if a = x then v else u x" in exI) - unfolding sum_clauses(2)[OF assms] - apply auto - done + by (rule_tac x="\x. if a = x then v else u x" in exI) (auto simp: sum_clauses(2)[OF assms]) qed @@ -3050,23 +2979,12 @@ apply auto done have "(\x\insert a t. if x = a then - (\x\t. u (x - a)) else u (x - a)) = 0" - unfolding sum_clauses(2)[OF fin] - using \a\s\ \t\s\ - apply auto - unfolding * - apply auto - done + unfolding sum_clauses(2)[OF fin] * using \a\s\ \t\s\ by auto moreover have "\v\insert a t. (if v = a then - (\x\t. u (x - a)) else u (v - a)) \ 0" - apply (rule_tac x="v + a" in bexI) - using obt(3,4) and \0\S\ - unfolding t_def - apply auto - done + using obt(3,4) \0\S\ + by (rule_tac x="v + a" in bexI) (auto simp: t_def) moreover have *: "\P Q. (\x\t. (if x = a then P x else Q x) *\<^sub>R x) = (\x\t. Q x *\<^sub>R x)" - apply (rule sum.cong) - using \a\s\ \t\s\ - apply auto - done + using \a\s\ \t\s\ by (auto intro!: sum.cong) have "(\x\t. u (x - a)) *\<^sub>R a = (\v\t. u (v - a) *\<^sub>R v)" unfolding scaleR_left.sum unfolding t_def and sum.reindex[OF inj] and o_def @@ -3113,11 +3031,7 @@ have *: "{x - a |x. x \ s - {a}} = (\x. x - a) ` (s - {a})" by auto have "card {x - a |x. x \ s - {a}} = card (s - {a})" - unfolding * - apply (rule card_image) - unfolding inj_on_def - apply auto - done + unfolding * by (simp add: card_image inj_on_def) also have "\ > DIM('a)" using assms(2) unfolding card_Diff_singleton[OF assms(1) \a\s\] by auto finally show ?thesis @@ -3128,33 +3042,25 @@ qed lemma affine_dependent_biggerset_general: - assumes "finite (s :: 'a::euclidean_space set)" - and "card s \ dim s + 2" - shows "affine_dependent s" -proof - - from assms(2) have "s \ {}" by auto - then obtain a where "a\s" by auto - have *: "{x - a |x. x \ s - {a}} = (\x. x - a) ` (s - {a})" + assumes "finite (S :: 'a::euclidean_space set)" + and "card S \ dim S + 2" + shows "affine_dependent S" +proof - + from assms(2) have "S \ {}" by auto + then obtain a where "a\S" by auto + have *: "{x - a |x. x \ S - {a}} = (\x. x - a) ` (S - {a})" by auto - have **: "card {x - a |x. x \ s - {a}} = card (s - {a})" - unfolding * - apply (rule card_image) - unfolding inj_on_def - apply auto - done - have "dim {x - a |x. x \ s - {a}} \ dim s" - apply (rule subset_le_dim) - unfolding subset_eq - using \a\s\ - apply (auto simp:span_superset span_diff) - done - also have "\ < dim s + 1" by auto - also have "\ \ card (s - {a})" + have **: "card {x - a |x. x \ S - {a}} = card (S - {a})" + by (metis (no_types, lifting) "*" card_image diff_add_cancel inj_on_def) + have "dim {x - a |x. x \ S - {a}} \ dim S" + using \a\S\ by (auto simp: span_superset span_diff intro: subset_le_dim) + also have "\ < dim S + 1" by auto + also have "\ \ card (S - {a})" using assms - using card_Diff_singleton[OF assms(1) \a\s\] + using card_Diff_singleton[OF assms(1) \a\S\] by auto finally show ?thesis - apply (subst insert_Diff[OF \a\s\, symmetric]) + apply (subst insert_Diff[OF \a\S\, symmetric]) apply (rule dependent_imp_affine_dependent) apply (rule dependent_biggerset_general) unfolding ** @@ -3590,22 +3496,10 @@ by auto let ?t = "{x::'a::euclidean_space. \i\Basis. i \ d \ x\i = 0}" have "\f. linear f \ f ` B = d \ f ` span B = ?t \ inj_on f (span B)" - apply (rule basis_to_basis_subspace_isomorphism[of "span B" ?t B "d"]) - apply (rule subspace_span) - apply (rule subspace_substandard) - defer - apply (rule span_inc) - apply (rule assms) - defer - unfolding dim_span[of B] - apply(rule B) - unfolding span_substd_basis[OF d, symmetric] - apply (rule span_inc) - apply (rule independent_substdbasis[OF d], rule) - apply assumption - unfolding t[symmetric] span_substd_basis[OF d] dim_substandard[OF d] - apply auto - done + proof (intro basis_to_basis_subspace_isomorphism subspace_span subspace_substandard span_inc) + show "d \ {x. \i\Basis. i \ d \ x \ i = 0}" + using d inner_not_same_Basis by blast + qed (auto simp: span_substd_basis independent_substdbasis dim_substandard d t B assms) with t \card B = dim B\ d show ?thesis by auto qed @@ -7081,29 +6975,17 @@ done then have k: "\y\convex hull c. f y \ k" apply (rule_tac convex_on_convex_hull_bound, assumption) - unfolding k_def - apply (rule, rule Max_ge) - using c(1) - apply auto - done - have "d \ e" - unfolding d_def - apply (rule mult_imp_div_pos_le) - using \e > 0\ - unfolding mult_le_cancel_left1 - apply (auto simp: real_of_nat_ge_one_iff Suc_le_eq DIM_positive) - done + by (simp add: k_def c) + have "e \ e * real DIM('a)" + using e(2) real_of_nat_ge_one_iff by auto + then have "d \ e" + by (simp add: d_def divide_simps) then have dsube: "cball x d \ cball x e" by (rule subset_cball) have conv: "convex_on (cball x d) f" using \convex_on (convex hull c) f\ c2 convex_on_subset by blast then have "\y\cball x d. \f y\ \ k + 2 * \f x\" - apply (rule convex_bounds_lemma) - apply (rule ballI) - apply (rule k [rule_format]) - apply (erule rev_subsetD) - apply (rule c2) - done + by (rule convex_bounds_lemma) (use c2 k in blast) then have "continuous_on (ball x d) f" apply (rule_tac convex_on_bounded_continuous) apply (rule open_ball, rule convex_on_subset[OF conv])