src/HOL/Analysis/Ordered_Euclidean_Space.thy
 author wenzelm Sun Sep 18 20:33:48 2016 +0200 (2016-09-18) changeset 63915 bab633745c7f parent 63886 685fb01256af child 64267 b9a1486e79be permissions -rw-r--r--
tuned proofs;
 immler@54780 ` 1` ```theory Ordered_Euclidean_Space ``` immler@54780 ` 2` ```imports ``` immler@56189 ` 3` ``` Cartesian_Euclidean_Space ``` immler@54780 ` 4` ``` "~~/src/HOL/Library/Product_Order" ``` immler@54780 ` 5` ```begin ``` immler@54780 ` 6` wenzelm@60420 ` 7` ```subsection \An ordering on euclidean spaces that will allow us to talk about intervals\ ``` immler@54780 ` 8` immler@54780 ` 9` ```class ordered_euclidean_space = ord + inf + sup + abs + Inf + Sup + euclidean_space + ``` immler@54780 ` 10` ``` assumes eucl_le: "x \ y \ (\i\Basis. x \ i \ y \ i)" ``` immler@54780 ` 11` ``` assumes eucl_less_le_not_le: "x < y \ x \ y \ \ y \ x" ``` immler@54780 ` 12` ``` assumes eucl_inf: "inf x y = (\i\Basis. inf (x \ i) (y \ i) *\<^sub>R i)" ``` immler@54780 ` 13` ``` assumes eucl_sup: "sup x y = (\i\Basis. sup (x \ i) (y \ i) *\<^sub>R i)" ``` immler@54780 ` 14` ``` assumes eucl_Inf: "Inf X = (\i\Basis. (INF x:X. x \ i) *\<^sub>R i)" ``` immler@54780 ` 15` ``` assumes eucl_Sup: "Sup X = (\i\Basis. (SUP x:X. x \ i) *\<^sub>R i)" ``` wenzelm@61945 ` 16` ``` assumes eucl_abs: "\x\ = (\i\Basis. \x \ i\ *\<^sub>R i)" ``` immler@54780 ` 17` ```begin ``` immler@54780 ` 18` immler@54780 ` 19` ```subclass order ``` wenzelm@61169 ` 20` ``` by standard ``` immler@54780 ` 21` ``` (auto simp: eucl_le eucl_less_le_not_le intro!: euclidean_eqI antisym intro: order.trans) ``` immler@54780 ` 22` immler@54780 ` 23` ```subclass ordered_ab_group_add_abs ``` wenzelm@61169 ` 24` ``` by standard (auto simp: eucl_le inner_add_left eucl_abs abs_leI) ``` immler@54780 ` 25` immler@54780 ` 26` ```subclass ordered_real_vector ``` wenzelm@61169 ` 27` ``` by standard (auto simp: eucl_le intro!: mult_left_mono mult_right_mono) ``` immler@54780 ` 28` immler@54780 ` 29` ```subclass lattice ``` wenzelm@61169 ` 30` ``` by standard (auto simp: eucl_inf eucl_sup eucl_le) ``` immler@54780 ` 31` immler@54780 ` 32` ```subclass distrib_lattice ``` wenzelm@61169 ` 33` ``` by standard (auto simp: eucl_inf eucl_sup sup_inf_distrib1 intro!: euclidean_eqI) ``` immler@54780 ` 34` immler@54780 ` 35` ```subclass conditionally_complete_lattice ``` immler@54780 ` 36` ```proof ``` immler@54780 ` 37` ``` fix z::'a and X::"'a set" ``` immler@54780 ` 38` ``` assume "X \ {}" ``` immler@54780 ` 39` ``` hence "\i. (\x. x \ i) ` X \ {}" by simp ``` immler@54780 ` 40` ``` thus "(\x. x \ X \ z \ x) \ z \ Inf X" "(\x. x \ X \ x \ z) \ Sup X \ z" ``` haftmann@62343 ` 41` ``` by (auto simp: eucl_Inf eucl_Sup eucl_le ``` immler@54780 ` 42` ``` intro!: cInf_greatest cSup_least) ``` immler@54780 ` 43` ```qed (force intro!: cInf_lower cSup_upper ``` immler@54780 ` 44` ``` simp: bdd_below_def bdd_above_def preorder_class.bdd_below_def preorder_class.bdd_above_def ``` haftmann@62343 ` 45` ``` eucl_Inf eucl_Sup eucl_le)+ ``` immler@54780 ` 46` immler@54780 ` 47` ```lemma inner_Basis_inf_left: "i \ Basis \ inf x y \ i = inf (x \ i) (y \ i)" ``` immler@54780 ` 48` ``` and inner_Basis_sup_left: "i \ Basis \ sup x y \ i = sup (x \ i) (y \ i)" ``` haftmann@57418 ` 49` ``` by (simp_all add: eucl_inf eucl_sup inner_setsum_left inner_Basis if_distrib comm_monoid_add_class.setsum.delta ``` immler@54780 ` 50` ``` cong: if_cong) ``` immler@54780 ` 51` immler@54780 ` 52` ```lemma inner_Basis_INF_left: "i \ Basis \ (INF x:X. f x) \ i = (INF x:X. f x \ i)" ``` immler@54780 ` 53` ``` and inner_Basis_SUP_left: "i \ Basis \ (SUP x:X. f x) \ i = (SUP x:X. f x \ i)" ``` haftmann@56166 ` 54` ``` using eucl_Sup [of "f ` X"] eucl_Inf [of "f ` X"] by (simp_all add: comp_def) ``` immler@54780 ` 55` wenzelm@61945 ` 56` ```lemma abs_inner: "i \ Basis \ \x\ \ i = \x \ i\" ``` immler@54780 ` 57` ``` by (auto simp: eucl_abs) ``` immler@54780 ` 58` immler@54780 ` 59` ```lemma ``` immler@54780 ` 60` ``` abs_scaleR: "\a *\<^sub>R b\ = \a\ *\<^sub>R \b\" ``` immler@54780 ` 61` ``` by (auto simp: eucl_abs abs_mult intro!: euclidean_eqI) ``` immler@54780 ` 62` immler@54780 ` 63` ```lemma interval_inner_leI: ``` immler@54780 ` 64` ``` assumes "x \ {a .. b}" "0 \ i" ``` immler@54780 ` 65` ``` shows "a\i \ x\i" "x\i \ b\i" ``` immler@54780 ` 66` ``` using assms ``` immler@54780 ` 67` ``` unfolding euclidean_inner[of a i] euclidean_inner[of x i] euclidean_inner[of b i] ``` hoelzl@62376 ` 68` ``` by (auto intro!: ordered_comm_monoid_add_class.setsum_mono mult_right_mono simp: eucl_le) ``` immler@54780 ` 69` immler@54780 ` 70` ```lemma inner_nonneg_nonneg: ``` immler@54780 ` 71` ``` shows "0 \ a \ 0 \ b \ 0 \ a \ b" ``` immler@54780 ` 72` ``` using interval_inner_leI[of a 0 a b] ``` immler@54780 ` 73` ``` by auto ``` immler@54780 ` 74` immler@54780 ` 75` ```lemma inner_Basis_mono: ``` immler@54780 ` 76` ``` shows "a \ b \ c \ Basis \ a \ c \ b \ c" ``` immler@54780 ` 77` ``` by (simp add: eucl_le) ``` immler@54780 ` 78` immler@54780 ` 79` ```lemma Basis_nonneg[intro, simp]: "i \ Basis \ 0 \ i" ``` immler@54780 ` 80` ``` by (auto simp: eucl_le inner_Basis) ``` immler@54780 ` 81` immler@54781 ` 82` ```lemma Sup_eq_maximum_componentwise: ``` immler@54781 ` 83` ``` fixes s::"'a set" ``` immler@54781 ` 84` ``` assumes i: "\b. b \ Basis \ X \ b = i b \ b" ``` immler@54781 ` 85` ``` assumes sup: "\b x. b \ Basis \ x \ s \ x \ b \ X \ b" ``` immler@54781 ` 86` ``` assumes i_s: "\b. b \ Basis \ (i b \ b) \ (\x. x \ b) ` s" ``` immler@54781 ` 87` ``` shows "Sup s = X" ``` immler@54781 ` 88` ``` using assms ``` immler@54781 ` 89` ``` unfolding eucl_Sup euclidean_representation_setsum ``` haftmann@62343 ` 90` ``` by (auto intro!: conditionally_complete_lattice_class.cSup_eq_maximum) ``` immler@54781 ` 91` immler@54781 ` 92` ```lemma Inf_eq_minimum_componentwise: ``` immler@54781 ` 93` ``` assumes i: "\b. b \ Basis \ X \ b = i b \ b" ``` immler@54781 ` 94` ``` assumes sup: "\b x. b \ Basis \ x \ s \ X \ b \ x \ b" ``` immler@54781 ` 95` ``` assumes i_s: "\b. b \ Basis \ (i b \ b) \ (\x. x \ b) ` s" ``` immler@54781 ` 96` ``` shows "Inf s = X" ``` immler@54781 ` 97` ``` using assms ``` immler@54781 ` 98` ``` unfolding eucl_Inf euclidean_representation_setsum ``` haftmann@62343 ` 99` ``` by (auto intro!: conditionally_complete_lattice_class.cInf_eq_minimum) ``` immler@54781 ` 100` immler@54780 ` 101` ```end ``` immler@54780 ` 102` immler@54781 ` 103` ```lemma ``` immler@54781 ` 104` ``` compact_attains_Inf_componentwise: ``` immler@54781 ` 105` ``` fixes b::"'a::ordered_euclidean_space" ``` immler@54781 ` 106` ``` assumes "b \ Basis" assumes "X \ {}" "compact X" ``` immler@54781 ` 107` ``` obtains x where "x \ X" "x \ b = Inf X \ b" "\y. y \ X \ x \ b \ y \ b" ``` immler@54781 ` 108` ```proof atomize_elim ``` immler@54781 ` 109` ``` let ?proj = "(\x. x \ b) ` X" ``` immler@54781 ` 110` ``` from assms have "compact ?proj" "?proj \ {}" ``` hoelzl@56371 ` 111` ``` by (auto intro!: compact_continuous_image continuous_intros) ``` immler@54781 ` 112` ``` from compact_attains_inf[OF this] ``` immler@54781 ` 113` ``` obtain s x ``` immler@54781 ` 114` ``` where s: "s\(\x. x \ b) ` X" "\t. t\(\x. x \ b) ` X \ s \ t" ``` immler@54781 ` 115` ``` and x: "x \ X" "s = x \ b" "\y. y \ X \ x \ b \ y \ b" ``` immler@54781 ` 116` ``` by auto ``` immler@54781 ` 117` ``` hence "Inf ?proj = x \ b" ``` haftmann@62343 ` 118` ``` by (auto intro!: conditionally_complete_lattice_class.cInf_eq_minimum) ``` immler@54781 ` 119` ``` hence "x \ b = Inf X \ b" ``` haftmann@62343 ` 120` ``` by (auto simp: eucl_Inf inner_setsum_left inner_Basis if_distrib \b \ Basis\ setsum.delta ``` haftmann@56166 ` 121` ``` cong: if_cong) ``` immler@54781 ` 122` ``` with x show "\x. x \ X \ x \ b = Inf X \ b \ (\y. y \ X \ x \ b \ y \ b)" by blast ``` immler@54781 ` 123` ```qed ``` immler@54781 ` 124` immler@54781 ` 125` ```lemma ``` immler@54781 ` 126` ``` compact_attains_Sup_componentwise: ``` immler@54781 ` 127` ``` fixes b::"'a::ordered_euclidean_space" ``` immler@54781 ` 128` ``` assumes "b \ Basis" assumes "X \ {}" "compact X" ``` immler@54781 ` 129` ``` obtains x where "x \ X" "x \ b = Sup X \ b" "\y. y \ X \ y \ b \ x \ b" ``` immler@54781 ` 130` ```proof atomize_elim ``` immler@54781 ` 131` ``` let ?proj = "(\x. x \ b) ` X" ``` immler@54781 ` 132` ``` from assms have "compact ?proj" "?proj \ {}" ``` hoelzl@56371 ` 133` ``` by (auto intro!: compact_continuous_image continuous_intros) ``` immler@54781 ` 134` ``` from compact_attains_sup[OF this] ``` immler@54781 ` 135` ``` obtain s x ``` immler@54781 ` 136` ``` where s: "s\(\x. x \ b) ` X" "\t. t\(\x. x \ b) ` X \ t \ s" ``` immler@54781 ` 137` ``` and x: "x \ X" "s = x \ b" "\y. y \ X \ y \ b \ x \ b" ``` immler@54781 ` 138` ``` by auto ``` immler@54781 ` 139` ``` hence "Sup ?proj = x \ b" ``` haftmann@62343 ` 140` ``` by (auto intro!: cSup_eq_maximum) ``` immler@54781 ` 141` ``` hence "x \ b = Sup X \ b" ``` haftmann@62343 ` 142` ``` by (auto simp: eucl_Sup[where 'a='a] inner_setsum_left inner_Basis if_distrib \b \ Basis\ setsum.delta ``` haftmann@62343 ` 143` ``` cong: if_cong) ``` immler@54781 ` 144` ``` with x show "\x. x \ X \ x \ b = Sup X \ b \ (\y. y \ X \ y \ b \ x \ b)" by blast ``` immler@54781 ` 145` ```qed ``` immler@54781 ` 146` immler@54780 ` 147` ```lemma (in order) atLeastatMost_empty'[simp]: ``` immler@54780 ` 148` ``` "(~ a <= b) \ {a..b} = {}" ``` immler@54780 ` 149` ``` by (auto) ``` immler@54780 ` 150` immler@54780 ` 151` ```instance real :: ordered_euclidean_space ``` haftmann@62343 ` 152` ``` by standard auto ``` immler@54780 ` 153` immler@54780 ` 154` ```lemma in_Basis_prod_iff: ``` immler@54780 ` 155` ``` fixes i::"'a::euclidean_space*'b::euclidean_space" ``` immler@54780 ` 156` ``` shows "i \ Basis \ fst i = 0 \ snd i \ Basis \ snd i = 0 \ fst i \ Basis" ``` immler@54780 ` 157` ``` by (cases i) (auto simp: Basis_prod_def) ``` immler@54780 ` 158` wenzelm@61945 ` 159` ```instantiation prod :: (abs, abs) abs ``` immler@54780 ` 160` ```begin ``` immler@54780 ` 161` wenzelm@61945 ` 162` ```definition "\x\ = (\fst x\, \snd x\)" ``` immler@54780 ` 163` wenzelm@61945 ` 164` ```instance .. ``` wenzelm@61945 ` 165` immler@54780 ` 166` ```end ``` immler@54780 ` 167` immler@54780 ` 168` ```instance prod :: (ordered_euclidean_space, ordered_euclidean_space) ordered_euclidean_space ``` wenzelm@61169 ` 169` ``` by standard ``` immler@54780 ` 170` ``` (auto intro!: add_mono simp add: euclidean_representation_setsum' Ball_def inner_prod_def ``` immler@54780 ` 171` ``` in_Basis_prod_iff inner_Basis_inf_left inner_Basis_sup_left inner_Basis_INF_left Inf_prod_def ``` immler@54780 ` 172` ``` inner_Basis_SUP_left Sup_prod_def less_prod_def less_eq_prod_def eucl_le[where 'a='a] ``` immler@54780 ` 173` ``` eucl_le[where 'a='b] abs_prod_def abs_inner) ``` immler@54780 ` 174` wenzelm@61808 ` 175` ```text\Instantiation for intervals on \ordered_euclidean_space\\ ``` immler@56188 ` 176` immler@56188 ` 177` ```lemma ``` wenzelm@61076 ` 178` ``` fixes a :: "'a::ordered_euclidean_space" ``` immler@56188 ` 179` ``` shows cbox_interval: "cbox a b = {a..b}" ``` immler@56188 ` 180` ``` and interval_cbox: "{a..b} = cbox a b" ``` immler@56188 ` 181` ``` and eucl_le_atMost: "{x. \i\Basis. x \ i <= a \ i} = {..a}" ``` immler@56188 ` 182` ``` and eucl_le_atLeast: "{x. \i\Basis. a \ i <= x \ i} = {a..}" ``` immler@56188 ` 183` ``` by (auto simp: eucl_le[where 'a='a] eucl_less_def box_def cbox_def) ``` immler@56188 ` 184` immler@56188 ` 185` ```lemma closed_eucl_atLeastAtMost[simp, intro]: ``` wenzelm@61076 ` 186` ``` fixes a :: "'a::ordered_euclidean_space" ``` immler@56188 ` 187` ``` shows "closed {a..b}" ``` immler@56188 ` 188` ``` by (simp add: cbox_interval[symmetric] closed_cbox) ``` immler@56188 ` 189` immler@56188 ` 190` ```lemma closed_eucl_atMost[simp, intro]: ``` wenzelm@61076 ` 191` ``` fixes a :: "'a::ordered_euclidean_space" ``` immler@56188 ` 192` ``` shows "closed {..a}" ``` immler@56188 ` 193` ``` by (simp add: eucl_le_atMost[symmetric]) ``` immler@56188 ` 194` immler@56188 ` 195` ```lemma closed_eucl_atLeast[simp, intro]: ``` wenzelm@61076 ` 196` ``` fixes a :: "'a::ordered_euclidean_space" ``` immler@56188 ` 197` ``` shows "closed {a..}" ``` immler@56188 ` 198` ``` by (simp add: eucl_le_atLeast[symmetric]) ``` immler@56188 ` 199` immler@56189 ` 200` ```lemma bounded_closed_interval: ``` immler@56189 ` 201` ``` fixes a :: "'a::ordered_euclidean_space" ``` immler@56189 ` 202` ``` shows "bounded {a .. b}" ``` immler@56189 ` 203` ``` using bounded_cbox[of a b] ``` immler@56189 ` 204` ``` by (metis interval_cbox) ``` immler@56189 ` 205` immler@56190 ` 206` ```lemma convex_closed_interval: ``` immler@56190 ` 207` ``` fixes a :: "'a::ordered_euclidean_space" ``` immler@56190 ` 208` ``` shows "convex {a .. b}" ``` immler@56190 ` 209` ``` using convex_box[of a b] ``` immler@56190 ` 210` ``` by (metis interval_cbox) ``` immler@56190 ` 211` immler@56188 ` 212` ```lemma image_smult_interval:"(\x. m *\<^sub>R (x::_::ordered_euclidean_space)) ` {a .. b} = ``` immler@56188 ` 213` ``` (if {a .. b} = {} then {} else if 0 \ m then {m *\<^sub>R a .. m *\<^sub>R b} else {m *\<^sub>R b .. m *\<^sub>R a})" ``` immler@56188 ` 214` ``` using image_smult_cbox[of m a b] ``` immler@56188 ` 215` ``` by (simp add: cbox_interval) ``` immler@54780 ` 216` immler@56189 ` 217` ```lemma is_interval_closed_interval: ``` immler@56189 ` 218` ``` "is_interval {a .. (b::'a::ordered_euclidean_space)}" ``` immler@56189 ` 219` ``` by (metis cbox_interval is_interval_cbox) ``` immler@56189 ` 220` immler@56190 ` 221` ```lemma compact_interval: ``` immler@56190 ` 222` ``` fixes a b::"'a::ordered_euclidean_space" ``` immler@56190 ` 223` ``` shows "compact {a .. b}" ``` immler@56190 ` 224` ``` by (metis compact_cbox interval_cbox) ``` immler@56190 ` 225` lp15@62620 ` 226` ```lemma homeomorphic_closed_intervals: ``` lp15@62620 ` 227` ``` fixes a :: "'a::euclidean_space" and b and c :: "'a::euclidean_space" and d ``` lp15@62620 ` 228` ``` assumes "box a b \ {}" and "box c d \ {}" ``` lp15@62620 ` 229` ``` shows "(cbox a b) homeomorphic (cbox c d)" ``` lp15@62620 ` 230` ```apply (rule homeomorphic_convex_compact) ``` lp15@62620 ` 231` ```using assms apply auto ``` lp15@62620 ` 232` ```done ``` lp15@62620 ` 233` lp15@62620 ` 234` ```lemma homeomorphic_closed_intervals_real: ``` lp15@62620 ` 235` ``` fixes a::real and b and c::real and d ``` lp15@62620 ` 236` ``` assumes "a (\Basis::'a::ordered_euclidean_space)" ``` immler@56189 ` 244` ``` by (auto intro: setsum_nonneg) ``` immler@56189 ` 245` immler@56190 ` 246` ```lemma ``` immler@56190 ` 247` ``` fixes a b::"'a::ordered_euclidean_space" ``` immler@56190 ` 248` ``` shows bdd_above_cbox[intro, simp]: "bdd_above (cbox a b)" ``` immler@56190 ` 249` ``` and bdd_below_cbox[intro, simp]: "bdd_below (cbox a b)" ``` immler@56190 ` 250` ``` and bdd_above_box[intro, simp]: "bdd_above (box a b)" ``` immler@56190 ` 251` ``` and bdd_below_box[intro, simp]: "bdd_below (box a b)" ``` immler@56190 ` 252` ``` unfolding atomize_conj ``` immler@56190 ` 253` ``` by (metis bdd_above_Icc bdd_above_mono bdd_below_Icc bdd_below_mono bounded_box ``` immler@56190 ` 254` ``` bounded_subset_cbox interval_cbox) ``` immler@56190 ` 255` immler@56189 ` 256` ```instantiation vec :: (ordered_euclidean_space, finite) ordered_euclidean_space ``` immler@56189 ` 257` ```begin ``` immler@56189 ` 258` immler@56189 ` 259` ```definition "inf x y = (\ i. inf (x \$ i) (y \$ i))" ``` immler@56189 ` 260` ```definition "sup x y = (\ i. sup (x \$ i) (y \$ i))" ``` immler@56189 ` 261` ```definition "Inf X = (\ i. (INF x:X. x \$ i))" ``` immler@56189 ` 262` ```definition "Sup X = (\ i. (SUP x:X. x \$ i))" ``` wenzelm@61945 ` 263` ```definition "\x\ = (\ i. \x \$ i\)" ``` immler@56189 ` 264` immler@56189 ` 265` ```instance ``` wenzelm@61169 ` 266` ``` apply standard ``` immler@56189 ` 267` ``` unfolding euclidean_representation_setsum' ``` immler@56189 ` 268` ``` apply (auto simp: less_eq_vec_def inf_vec_def sup_vec_def Inf_vec_def Sup_vec_def inner_axis ``` immler@56189 ` 269` ``` Basis_vec_def inner_Basis_inf_left inner_Basis_sup_left inner_Basis_INF_left ``` immler@56189 ` 270` ``` inner_Basis_SUP_left eucl_le[where 'a='a] less_le_not_le abs_vec_def abs_inner) ``` immler@56189 ` 271` ``` done ``` immler@56189 ` 272` immler@54780 ` 273` ```end ``` immler@56189 ` 274` lp15@63469 ` 275` ```lemma ANR_interval [iff]: ``` lp15@63469 ` 276` ``` fixes a :: "'a::ordered_euclidean_space" ``` lp15@63469 ` 277` ``` shows "ANR{a..b}" ``` lp15@63469 ` 278` ```by (simp add: interval_cbox) ``` lp15@63469 ` 279` lp15@63469 ` 280` ```lemma ENR_interval [iff]: ``` lp15@63469 ` 281` ``` fixes a :: "'a::ordered_euclidean_space" ``` lp15@63469 ` 282` ``` shows "ENR{a..b}" ``` lp15@63469 ` 283` ``` by (auto simp: interval_cbox) ``` lp15@63469 ` 284` immler@56189 ` 285` ```end ``` immler@56189 ` 286`