src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy
changeset 55697 abec82f4e3e9
parent 54780 6fae499e0827
child 55787 41a73a41f6c8
equal deleted inserted replaced
55696:de2668c50403 55697:abec82f4e3e9
  4804 
  4804 
  4805 lemma radon_ex_lemma:
  4805 lemma radon_ex_lemma:
  4806   assumes "finite c" "affine_dependent c"
  4806   assumes "finite c" "affine_dependent c"
  4807   shows "\<exists>u. setsum u c = 0 \<and> (\<exists>v\<in>c. u v \<noteq> 0) \<and> setsum (\<lambda>v. u v *\<^sub>R v) c = 0"
  4807   shows "\<exists>u. setsum u c = 0 \<and> (\<exists>v\<in>c. u v \<noteq> 0) \<and> setsum (\<lambda>v. u v *\<^sub>R v) c = 0"
  4808 proof -
  4808 proof -
  4809   from assms(2)[unfolded affine_dependent_explicit] guess s ..
  4809   from assms(2)[unfolded affine_dependent_explicit]
  4810   then guess u ..
  4810   obtain s u where
       
  4811       "finite s" "s \<subseteq> c" "setsum u s = 0" "\<exists>v\<in>s. u v \<noteq> 0" "(\<Sum>v\<in>s. u v *\<^sub>R v) = 0"
       
  4812     by blast
  4811   then show ?thesis
  4813   then show ?thesis
  4812     apply (rule_tac x="\<lambda>v. if v\<in>s then u v else 0" in exI)
  4814     apply (rule_tac x="\<lambda>v. if v\<in>s then u v else 0" in exI)
  4813     unfolding if_smult scaleR_zero_left and setsum_restrict_set[OF assms(1), symmetric]
  4815     unfolding if_smult scaleR_zero_left and setsum_restrict_set[OF assms(1), symmetric]
  4814     apply (auto simp add: Int_absorb1)
  4816     apply (auto simp add: Int_absorb1)
  4815     done
  4817     done
  4929 
  4931 
  4930 lemma radon:
  4932 lemma radon:
  4931   assumes "affine_dependent c"
  4933   assumes "affine_dependent c"
  4932   obtains m p where "m \<subseteq> c" "p \<subseteq> c" "m \<inter> p = {}" "(convex hull m) \<inter> (convex hull p) \<noteq> {}"
  4934   obtains m p where "m \<subseteq> c" "p \<subseteq> c" "m \<inter> p = {}" "(convex hull m) \<inter> (convex hull p) \<noteq> {}"
  4933 proof -
  4935 proof -
  4934   from assms[unfolded affine_dependent_explicit] guess s .. then guess u ..
  4936   from assms[unfolded affine_dependent_explicit]
       
  4937   obtain s u where
       
  4938       "finite s" "s \<subseteq> c" "setsum u s = 0" "\<exists>v\<in>s. u v \<noteq> 0" "(\<Sum>v\<in>s. u v *\<^sub>R v) = 0"
       
  4939     by blast
  4935   then have *: "finite s" "affine_dependent s" and s: "s \<subseteq> c"
  4940   then have *: "finite s" "affine_dependent s" and s: "s \<subseteq> c"
  4936     unfolding affine_dependent_explicit by auto
  4941     unfolding affine_dependent_explicit by auto
  4937   from radon_partition[OF *] guess m .. then guess p ..
  4942   from radon_partition[OF *]
       
  4943   obtain m p where "m \<inter> p = {}" "m \<union> p = s" "convex hull m \<inter> convex hull p \<noteq> {}"
       
  4944     by blast
  4938   then show ?thesis
  4945   then show ?thesis
  4939     apply (rule_tac that[of p m])
  4946     apply (rule_tac that[of p m])
  4940     using s
  4947     using s
  4941     apply auto
  4948     apply auto
  4942     done
  4949     done
  5024         prefer 3
  5031         prefer 3
  5025         apply rule
  5032         apply rule
  5026       proof -
  5033       proof -
  5027         fix x
  5034         fix x
  5028         assume "x \<in> X ` g"
  5035         assume "x \<in> X ` g"
  5029         then guess y unfolding image_iff ..
  5036         then obtain y where "y \<in> g" "x = X y"
       
  5037           unfolding image_iff ..
  5030         then show "x \<in> \<Inter>h"
  5038         then show "x \<in> \<Inter>h"
  5031           using X[THEN bspec[where x=y]] using * f by auto
  5039           using X[THEN bspec[where x=y]] using * f by auto
  5032       next
  5040       next
  5033         fix x
  5041         fix x
  5034         assume "x \<in> X ` h"
  5042         assume "x \<in> X ` h"
  5035         then guess y unfolding image_iff ..
  5043         then obtain y where "y \<in> h" "x = X y"
       
  5044           unfolding image_iff ..
  5036         then show "x \<in> \<Inter>g"
  5045         then show "x \<in> \<Inter>g"
  5037           using X[THEN bspec[where x=y]] using * f by auto
  5046           using X[THEN bspec[where x=y]] using * f by auto
  5038       qed auto
  5047       qed auto
  5039       then show ?thesis
  5048       then show ?thesis
  5040         unfolding f using mp(3)[unfolded gh] by blast
  5049         unfolding f using mp(3)[unfolded gh] by blast
  6744     finally show "setsum (op \<bullet> x) Basis < 1" by auto
  6753     finally show "setsum (op \<bullet> x) Basis < 1" by auto
  6745   qed
  6754   qed
  6746 next
  6755 next
  6747   fix x :: 'a
  6756   fix x :: 'a
  6748   assume as: "\<forall>i\<in>Basis. 0 < x \<bullet> i" "setsum (op \<bullet> x) Basis < 1"
  6757   assume as: "\<forall>i\<in>Basis. 0 < x \<bullet> i" "setsum (op \<bullet> x) Basis < 1"
  6749   guess a using UNIV_witness[where 'a='b] ..
  6758   obtain a :: 'b where "a \<in> UNIV" using UNIV_witness ..
  6750   let ?d = "(1 - setsum (op \<bullet> x) Basis) / real (DIM('a))"
  6759   let ?d = "(1 - setsum (op \<bullet> x) Basis) / real (DIM('a))"
  6751   have "Min ((op \<bullet> x) ` Basis) > 0"
  6760   have "Min ((op \<bullet> x) ` Basis) > 0"
  6752     apply (rule Min_grI)
  6761     apply (rule Min_grI)
  6753     using as(1)
  6762     using as(1)
  6754     apply auto
  6763     apply auto
  8936   (is "_ \<ge> _ + Inf (?F x) * (y - x)")
  8945   (is "_ \<ge> _ + Inf (?F x) * (y - x)")
  8937 proof (cases rule: linorder_cases)
  8946 proof (cases rule: linorder_cases)
  8938   assume "x < y"
  8947   assume "x < y"
  8939   moreover
  8948   moreover
  8940   have "open (interior I)" by auto
  8949   have "open (interior I)" by auto
  8941   from openE[OF this `x \<in> interior I`] guess e . note e = this
  8950   from openE[OF this `x \<in> interior I`]
       
  8951   obtain e where e: "0 < e" "ball x e \<subseteq> interior I" .
  8942   moreover def t \<equiv> "min (x + e / 2) ((x + y) / 2)"
  8952   moreover def t \<equiv> "min (x + e / 2) ((x + y) / 2)"
  8943   ultimately have "x < t" "t < y" "t \<in> ball x e"
  8953   ultimately have "x < t" "t < y" "t \<in> ball x e"
  8944     by (auto simp: dist_real_def field_simps split: split_min)
  8954     by (auto simp: dist_real_def field_simps split: split_min)
  8945   with `x \<in> interior I` e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
  8955   with `x \<in> interior I` e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
  8946 
  8956 
  8947   have "open (interior I)" by auto
  8957   have "open (interior I)" by auto
  8948   from openE[OF this `x \<in> interior I`] guess e .
  8958   from openE[OF this `x \<in> interior I`]
       
  8959   obtain e where "0 < e" "ball x e \<subseteq> interior I" .
  8949   moreover def K \<equiv> "x - e / 2"
  8960   moreover def K \<equiv> "x - e / 2"
  8950   with `0 < e` have "K \<in> ball x e" "K < x"
  8961   with `0 < e` have "K \<in> ball x e" "K < x"
  8951     by (auto simp: dist_real_def)
  8962     by (auto simp: dist_real_def)
  8952   ultimately have "K \<in> I" "K < x" "x \<in> I"
  8963   ultimately have "K \<in> I" "K < x" "x \<in> I"
  8953     using interior_subset[of I] `x \<in> interior I` by auto
  8964     using interior_subset[of I] `x \<in> interior I` by auto
  8969     using `x < y` by (simp add: field_simps)
  8980     using `x < y` by (simp add: field_simps)
  8970 next
  8981 next
  8971   assume "y < x"
  8982   assume "y < x"
  8972   moreover
  8983   moreover
  8973   have "open (interior I)" by auto
  8984   have "open (interior I)" by auto
  8974   from openE[OF this `x \<in> interior I`] guess e . note e = this
  8985   from openE[OF this `x \<in> interior I`]
       
  8986   obtain e where e: "0 < e" "ball x e \<subseteq> interior I" .
  8975   moreover def t \<equiv> "x + e / 2"
  8987   moreover def t \<equiv> "x + e / 2"
  8976   ultimately have "x < t" "t \<in> ball x e"
  8988   ultimately have "x < t" "t \<in> ball x e"
  8977     by (auto simp: dist_real_def field_simps)
  8989     by (auto simp: dist_real_def field_simps)
  8978   with `x \<in> interior I` e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
  8990   with `x \<in> interior I` e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
  8979 
  8991 
  8988     have "(f y - f x) / (y - x) \<le> z"
  9000     have "(f y - f x) / (y - x) \<le> z"
  8989       by auto
  9001       by auto
  8990     finally show "(f x - f y) / (x - y) \<le> z" .
  9002     finally show "(f x - f y) / (x - y) \<le> z" .
  8991   next
  9003   next
  8992     have "open (interior I)" by auto
  9004     have "open (interior I)" by auto
  8993     from openE[OF this `x \<in> interior I`] guess e . note e = this
  9005     from openE[OF this `x \<in> interior I`]
       
  9006     obtain e where e: "0 < e" "ball x e \<subseteq> interior I" .
  8994     then have "x + e / 2 \<in> ball x e"
  9007     then have "x + e / 2 \<in> ball x e"
  8995       by (auto simp: dist_real_def)
  9008       by (auto simp: dist_real_def)
  8996     with e interior_subset[of I] have "x + e / 2 \<in> {x<..} \<inter> I"
  9009     with e interior_subset[of I] have "x + e / 2 \<in> {x<..} \<inter> I"
  8997       by auto
  9010       by auto
  8998     then show "?F x \<noteq> {}"
  9011     then show "?F x \<noteq> {}"