src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy
changeset 60800 7d04351c795a
parent 60762 bf0c76ccee8d
child 60809 457abb82fb9e
equal deleted inserted replaced
60799:57dd0b45fc21 60800:7d04351c795a
  1385     using mult_strict_left_mono[OF y \<open>u>0\<close>]
  1385     using mult_strict_left_mono[OF y \<open>u>0\<close>]
  1386     unfolding left_diff_distrib
  1386     unfolding left_diff_distrib
  1387     by auto
  1387     by auto
  1388 qed
  1388 qed
  1389 
  1389 
  1390 lemma convex_ball:
  1390 lemma convex_ball [iff]:
  1391   fixes x :: "'a::real_normed_vector"
  1391   fixes x :: "'a::real_normed_vector"
  1392   shows "convex (ball x e)"
  1392   shows "convex (ball x e)"
  1393 proof (auto simp add: convex_def)
  1393 proof (auto simp add: convex_def)
  1394   fix y z
  1394   fix y z
  1395   assume yz: "dist x y < e" "dist x z < e"
  1395   assume yz: "dist x y < e" "dist x z < e"
  1402     by auto
  1402     by auto
  1403   then show "dist x (u *\<^sub>R y + v *\<^sub>R z) < e"
  1403   then show "dist x (u *\<^sub>R y + v *\<^sub>R z) < e"
  1404     using convex_bound_lt[OF yz uv] by auto
  1404     using convex_bound_lt[OF yz uv] by auto
  1405 qed
  1405 qed
  1406 
  1406 
  1407 lemma convex_cball:
  1407 lemma convex_cball [iff]:
  1408   fixes x :: "'a::real_normed_vector"
  1408   fixes x :: "'a::real_normed_vector"
  1409   shows "convex (cball x e)"
  1409   shows "convex (cball x e)"
  1410 proof -
  1410 proof -
  1411   {
  1411   {
  1412     fix y z
  1412     fix y z
  3237   fixes S :: "'n::euclidean_space set"
  3237   fixes S :: "'n::euclidean_space set"
  3238   assumes "open S"
  3238   assumes "open S"
  3239   shows "rel_interior S = S"
  3239   shows "rel_interior S = S"
  3240   by (metis assms interior_eq interior_subset_rel_interior rel_interior_subset set_eq_subset)
  3240   by (metis assms interior_eq interior_subset_rel_interior rel_interior_subset set_eq_subset)
  3241 
  3241 
       
  3242 lemma interior_ball [simp]: "interior (ball x e) = ball x e"
       
  3243   by (simp add: interior_open)
       
  3244 
  3242 lemma interior_rel_interior_gen:
  3245 lemma interior_rel_interior_gen:
  3243   fixes S :: "'n::euclidean_space set"
  3246   fixes S :: "'n::euclidean_space set"
  3244   shows "interior S = (if aff_dim S = int(DIM('n)) then rel_interior S else {})"
  3247   shows "interior S = (if aff_dim S = int(DIM('n)) then rel_interior S else {})"
  3245   by (metis interior_rel_interior low_dim_interior)
  3248   by (metis interior_rel_interior low_dim_interior)
  3246 
  3249 
  3549       using affine_hull_translation[of a S] open_translation[of T a] x by auto
  3552       using affine_hull_translation[of a S] open_translation[of T a] x by auto
  3550     then have "a + x \<in> rel_interior ((\<lambda>x. a + x) ` S)"
  3553     then have "a + x \<in> rel_interior ((\<lambda>x. a + x) ` S)"
  3551       using mem_rel_interior[of "a+x" "((\<lambda>x. a + x) ` S)"] by auto
  3554       using mem_rel_interior[of "a+x" "((\<lambda>x. a + x) ` S)"] by auto
  3552   }
  3555   }
  3553   then show ?thesis by auto
  3556   then show ?thesis by auto
  3554 qed
  3557 qed                   
  3555 
  3558 
  3556 lemma rel_interior_translation:
  3559 lemma rel_interior_translation:
  3557   fixes a :: "'n::euclidean_space"
  3560   fixes a :: "'n::euclidean_space"
  3558   shows "rel_interior ((\<lambda>x. a + x) ` S) = (\<lambda>x. a + x) ` rel_interior S"
  3561   shows "rel_interior ((\<lambda>x. a + x) ` S) = (\<lambda>x. a + x) ` rel_interior S"
  3559 proof -
  3562 proof -
  9315     apply (metis UNIV_I affine_hull_convex_hull affine_hull_empty affine_independent_span_eq convex_convex_hull empty_iff rel_interior_interior rel_interior_same_affine_hull)
  9318     apply (metis UNIV_I affine_hull_convex_hull affine_hull_empty affine_independent_span_eq convex_convex_hull empty_iff rel_interior_interior rel_interior_same_affine_hull)
  9316     apply (auto simp: affine_dependent_def)
  9319     apply (auto simp: affine_dependent_def)
  9317     done
  9320     done
  9318 qed
  9321 qed
  9319 
  9322 
       
  9323 
  9320 subsection \<open>Coplanarity, and collinearity in terms of affine hull\<close>
  9324 subsection \<open>Coplanarity, and collinearity in terms of affine hull\<close>
  9321 
       
  9322 
  9325 
  9323 definition coplanar  where
  9326 definition coplanar  where
  9324    "coplanar s \<equiv> \<exists>u v w. s \<subseteq> affine hull {u,v,w}"
  9327    "coplanar s \<equiv> \<exists>u v w. s \<subseteq> affine hull {u,v,w}"
  9325 
  9328 
  9326 lemma collinear_affine_hull:
  9329 lemma collinear_affine_hull:
  9423   } then
  9426   } then
  9424   show ?thesis
  9427   show ?thesis
  9425     by auto (meson assms(1) coplanar_def)
  9428     by auto (meson assms(1) coplanar_def)
  9426 qed
  9429 qed
  9427 
  9430 
  9428 (*?  Still not ported
  9431 lemma coplanar_translation_imp: "coplanar s \<Longrightarrow> coplanar ((\<lambda>x. a + x) ` s)"
  9429 lemma COPLANAR_TRANSLATION_EQ: "coplanar((\<lambda>x. a + x) ` s) \<longleftrightarrow> coplanar s"
  9432   unfolding coplanar_def
  9430   apply (simp add: coplanar_def)
  9433   apply clarify
  9431   apply (simp add: Set.image_subset_iff_subset_vimage)
  9434   apply (rule_tac x="u+a" in exI)
  9432   apply (auto simp:)
  9435   apply (rule_tac x="v+a" in exI)
  9433   apply (rule_tac x="u-a" in exI)
  9436   apply (rule_tac x="w+a" in exI)
  9434   apply (rule_tac x="v-a" in exI)
  9437   using affine_hull_translation [of a "{u,v,w}" for u v w]
  9435   apply (rule_tac x="w-a" in exI)
  9438   apply (force simp: add.commute)
  9436   apply (auto simp:)
  9439   done
  9437   apply (drule_tac c="x+a" in subsetD)
  9440 
  9438   apply (simp add: affine_alt)
  9441 lemma coplanar_translation_eq: "coplanar((\<lambda>x. a + x) ` s) \<longleftrightarrow> coplanar s"
  9439 
  9442     by (metis (no_types) coplanar_translation_imp translation_galois)
  9440 lemma COPLANAR_TRANSLATION:
       
  9441   !a:real^N s. coplanar s ==> coplanar(IMAGE (\x. a + x) s)"
       
  9442   REWRITE_TAC[COPLANAR_TRANSLATION_EQ]);;
       
  9443 
  9443 
  9444 lemma coplanar_linear_image_eq:
  9444 lemma coplanar_linear_image_eq:
  9445   fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  9445   fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  9446   assumes "linear f" "inj f" shows "coplanar(f ` s) = coplanar s"
  9446   assumes "linear f" "inj f" shows "coplanar(f ` s) = coplanar s"
  9447   MATCH_ACCEPT_TAC(LINEAR_INVARIANT_RULE COPLANAR_LINEAR_IMAGE));;
  9447 proof 
       
  9448   assume "coplanar s"
       
  9449   then show "coplanar (f ` s)"
       
  9450     unfolding coplanar_def
       
  9451     using affine_hull_linear_image [of f "{u,v,w}" for u v w]  assms
       
  9452     by (meson coplanar_def coplanar_linear_image)
       
  9453 next
       
  9454   obtain g where g: "linear g" "g \<circ> f = id"
       
  9455     using linear_injective_left_inverse [OF assms]
       
  9456     by blast
       
  9457   assume "coplanar (f ` s)"
       
  9458   then obtain u v w where "f ` s \<subseteq> affine hull {u, v, w}"
       
  9459     by (auto simp: coplanar_def)
       
  9460   then have "g ` f ` s \<subseteq> g ` (affine hull {u, v, w})"
       
  9461     by blast
       
  9462   then have "s \<subseteq> g ` (affine hull {u, v, w})"
       
  9463     using g by (simp add: Fun.image_comp)
       
  9464   then show "coplanar s"
       
  9465     unfolding coplanar_def
       
  9466     using affine_hull_linear_image [of g "{u,v,w}" for u v w]  `linear g` linear_conv_bounded_linear 
       
  9467     by fastforce
       
  9468 qed
       
  9469 (*The HOL Light proof is simply
       
  9470     MATCH_ACCEPT_TAC(LINEAR_INVARIANT_RULE COPLANAR_LINEAR_IMAGE));;
  9448 *)
  9471 *)
  9449 
  9472 
  9450 lemma coplanar_subset: "\<lbrakk>coplanar t; s \<subseteq> t\<rbrakk> \<Longrightarrow> coplanar s"
  9473 lemma coplanar_subset: "\<lbrakk>coplanar t; s \<subseteq> t\<rbrakk> \<Longrightarrow> coplanar s"
  9451   by (meson coplanar_def order_trans)
  9474   by (meson coplanar_def order_trans)
  9452 
  9475