src/HOL/Analysis/Cartesian_Euclidean_Space.thy
changeset 71025 be8cec1abcbb
parent 70817 dd675800469d
child 71170 57bc95d23491
equal deleted inserted replaced
71024:38bed2483e6a 71025:be8cec1abcbb
    45         "box (vec a) (vec b) = {} \<longleftrightarrow> box a b = {}"
    45         "box (vec a) (vec b) = {} \<longleftrightarrow> box a b = {}"
    46   by (auto simp: Basis_vec_def mem_box box_eq_empty inner_axis)
    46   by (auto simp: Basis_vec_def mem_box box_eq_empty inner_axis)
    47 
    47 
    48 subsection\<open>Closures and interiors of halfspaces\<close>
    48 subsection\<open>Closures and interiors of halfspaces\<close>
    49 
    49 
    50 lemma interior_halfspace_le [simp]:
       
    51   assumes "a \<noteq> 0"
       
    52     shows "interior {x. a \<bullet> x \<le> b} = {x. a \<bullet> x < b}"
       
    53 proof -
       
    54   have *: "a \<bullet> x < b" if x: "x \<in> S" and S: "S \<subseteq> {x. a \<bullet> x \<le> b}" and "open S" for S x
       
    55   proof -
       
    56     obtain e where "e>0" and e: "cball x e \<subseteq> S"
       
    57       using \<open>open S\<close> open_contains_cball x by blast
       
    58     then have "x + (e / norm a) *\<^sub>R a \<in> cball x e"
       
    59       by (simp add: dist_norm)
       
    60     then have "x + (e / norm a) *\<^sub>R a \<in> S"
       
    61       using e by blast
       
    62     then have "x + (e / norm a) *\<^sub>R a \<in> {x. a \<bullet> x \<le> b}"
       
    63       using S by blast
       
    64     moreover have "e * (a \<bullet> a) / norm a > 0"
       
    65       by (simp add: \<open>0 < e\<close> assms)
       
    66     ultimately show ?thesis
       
    67       by (simp add: algebra_simps)
       
    68   qed
       
    69   show ?thesis
       
    70     by (rule interior_unique) (auto simp: open_halfspace_lt *)
       
    71 qed
       
    72 
       
    73 lemma interior_halfspace_ge [simp]:
       
    74    "a \<noteq> 0 \<Longrightarrow> interior {x. a \<bullet> x \<ge> b} = {x. a \<bullet> x > b}"
       
    75 using interior_halfspace_le [of "-a" "-b"] by simp
       
    76 
       
    77 lemma interior_halfspace_component_le [simp]:
    50 lemma interior_halfspace_component_le [simp]:
    78      "interior {x. x$k \<le> a} = {x :: (real^'n). x$k < a}" (is "?LE")
    51      "interior {x. x$k \<le> a} = {x :: (real^'n). x$k < a}" (is "?LE")
    79   and interior_halfspace_component_ge [simp]:
    52   and interior_halfspace_component_ge [simp]:
    80      "interior {x. x$k \<ge> a} = {x :: (real^'n). x$k > a}" (is "?GE")
    53      "interior {x. x$k \<ge> a} = {x :: (real^'n). x$k > a}" (is "?GE")
    81 proof -
    54 proof -
    86   ultimately show ?LE ?GE
    59   ultimately show ?LE ?GE
    87     using interior_halfspace_le [of "axis k (1::real)" a]
    60     using interior_halfspace_le [of "axis k (1::real)" a]
    88           interior_halfspace_ge [of "axis k (1::real)" a] by auto
    61           interior_halfspace_ge [of "axis k (1::real)" a] by auto
    89 qed
    62 qed
    90 
    63 
    91 lemma closure_halfspace_lt [simp]:
       
    92   assumes "a \<noteq> 0"
       
    93     shows "closure {x. a \<bullet> x < b} = {x. a \<bullet> x \<le> b}"
       
    94 proof -
       
    95   have [simp]: "-{x. a \<bullet> x < b} = {x. a \<bullet> x \<ge> b}"
       
    96     by (force simp:)
       
    97   then show ?thesis
       
    98     using interior_halfspace_ge [of a b] assms
       
    99     by (force simp: closure_interior)
       
   100 qed
       
   101 
       
   102 lemma closure_halfspace_gt [simp]:
       
   103    "a \<noteq> 0 \<Longrightarrow> closure {x. a \<bullet> x > b} = {x. a \<bullet> x \<ge> b}"
       
   104 using closure_halfspace_lt [of "-a" "-b"] by simp
       
   105 
       
   106 lemma closure_halfspace_component_lt [simp]:
    64 lemma closure_halfspace_component_lt [simp]:
   107      "closure {x. x$k < a} = {x :: (real^'n). x$k \<le> a}" (is "?LE")
    65      "closure {x. x$k < a} = {x :: (real^'n). x$k \<le> a}" (is "?LE")
   108   and closure_halfspace_component_gt [simp]:
    66   and closure_halfspace_component_gt [simp]:
   109      "closure {x. x$k > a} = {x :: (real^'n). x$k \<ge> a}" (is "?GE")
    67      "closure {x. x$k > a} = {x :: (real^'n). x$k \<ge> a}" (is "?GE")
   110 proof -
    68 proof -
   113   moreover have "axis k (1::real) \<bullet> x = x$k" for x
    71   moreover have "axis k (1::real) \<bullet> x = x$k" for x
   114     by (simp add: cart_eq_inner_axis inner_commute)
    72     by (simp add: cart_eq_inner_axis inner_commute)
   115   ultimately show ?LE ?GE
    73   ultimately show ?LE ?GE
   116     using closure_halfspace_lt [of "axis k (1::real)" a]
    74     using closure_halfspace_lt [of "axis k (1::real)" a]
   117           closure_halfspace_gt [of "axis k (1::real)" a] by auto
    75           closure_halfspace_gt [of "axis k (1::real)" a] by auto
   118 qed
       
   119 
       
   120 lemma interior_hyperplane [simp]:
       
   121   assumes "a \<noteq> 0"
       
   122     shows "interior {x. a \<bullet> x = b} = {}"
       
   123 proof -
       
   124   have [simp]: "{x. a \<bullet> x = b} = {x. a \<bullet> x \<le> b} \<inter> {x. a \<bullet> x \<ge> b}"
       
   125     by (force simp:)
       
   126   then show ?thesis
       
   127     by (auto simp: assms)
       
   128 qed
       
   129 
       
   130 lemma frontier_halfspace_le:
       
   131   assumes "a \<noteq> 0 \<or> b \<noteq> 0"
       
   132     shows "frontier {x. a \<bullet> x \<le> b} = {x. a \<bullet> x = b}"
       
   133 proof (cases "a = 0")
       
   134   case True with assms show ?thesis by simp
       
   135 next
       
   136   case False then show ?thesis
       
   137     by (force simp: frontier_def closed_halfspace_le)
       
   138 qed
       
   139 
       
   140 lemma frontier_halfspace_ge:
       
   141   assumes "a \<noteq> 0 \<or> b \<noteq> 0"
       
   142     shows "frontier {x. a \<bullet> x \<ge> b} = {x. a \<bullet> x = b}"
       
   143 proof (cases "a = 0")
       
   144   case True with assms show ?thesis by simp
       
   145 next
       
   146   case False then show ?thesis
       
   147     by (force simp: frontier_def closed_halfspace_ge)
       
   148 qed
       
   149 
       
   150 lemma frontier_halfspace_lt:
       
   151   assumes "a \<noteq> 0 \<or> b \<noteq> 0"
       
   152     shows "frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}"
       
   153 proof (cases "a = 0")
       
   154   case True with assms show ?thesis by simp
       
   155 next
       
   156   case False then show ?thesis
       
   157     by (force simp: frontier_def interior_open open_halfspace_lt)
       
   158 qed
       
   159 
       
   160 lemma frontier_halfspace_gt:
       
   161   assumes "a \<noteq> 0 \<or> b \<noteq> 0"
       
   162     shows "frontier {x. a \<bullet> x > b} = {x. a \<bullet> x = b}"
       
   163 proof (cases "a = 0")
       
   164   case True with assms show ?thesis by simp
       
   165 next
       
   166   case False then show ?thesis
       
   167     by (force simp: frontier_def interior_open open_halfspace_gt)
       
   168 qed
    76 qed
   169 
    77 
   170 lemma interior_standard_hyperplane:
    78 lemma interior_standard_hyperplane:
   171    "interior {x :: (real^'n). x$k = a} = {}"
    79    "interior {x :: (real^'n). x$k = a} = {}"
   172 proof -
    80 proof -
   621     then show "x \<in> S"
   529     then show "x \<in> S"
   622       by (metis (no_types, lifting) L imageE imageI vec_component vec_nth_cbox_1_eq vector_one_nth)
   530       by (metis (no_types, lifting) L imageE imageI vec_component vec_nth_cbox_1_eq vector_one_nth)
   623   qed
   531   qed
   624 qed simp
   532 qed simp
   625 
   533 
       
   534 lemma vec_nth_real_1_iff_cbox [simp]:
       
   535   fixes a b :: real
       
   536   shows "(\<lambda>x::real^1. x $ 1) ` S = {a..b} \<longleftrightarrow> S = cbox (vec a) (vec b)"
       
   537   using vec_nth_1_iff_cbox[of S a b]
       
   538   by simp
   626 
   539 
   627 lemma interval_split_cart:
   540 lemma interval_split_cart:
   628   "{a..b::real^'n} \<inter> {x. x$k \<le> c} = {a .. (\<chi> i. if i = k then min (b$k) c else b$i)}"
   541   "{a..b::real^'n} \<inter> {x. x$k \<le> c} = {a .. (\<chi> i. if i = k then min (b$k) c else b$i)}"
   629   "cbox a b \<inter> {x. x$k \<ge> c} = {(\<chi> i. if i = k then max (a$k) c else a$i) .. b}"
   542   "cbox a b \<inter> {x. x$k \<ge> c} = {(\<chi> i. if i = k then max (a$k) c else a$i) .. b}"
   630   apply (rule_tac[!] set_eqI)
   543   apply (rule_tac[!] set_eqI)