diff -r 2666cd7d380c -r 0268784f60da src/HOL/Multivariate_Analysis/Ordered_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Ordered_Euclidean_Space.thy Mon Mar 17 21:56:32 2014 +0100 +++ b/src/HOL/Multivariate_Analysis/Ordered_Euclidean_Space.thy Tue Mar 18 10:12:57 2014 +0100 @@ -175,31 +175,31 @@ eucl_le[where 'a='b] abs_prod_def abs_inner) -subsection {* Intervals *} +subsection {* Boxes *} -lemma interval: - fixes a :: "'a::ordered_euclidean_space" +lemma box: + fixes a :: "'a::euclidean_space" shows "box a b = {x::'a. \i\Basis. a\i < x\i \ x\i < b\i}" - and "{a .. b} = {x::'a. \i\Basis. a\i \ x\i \ x\i \ b\i}" - by (auto simp add:set_eq_iff eucl_le[where 'a='a] box_def) + and "cbox a b = {x::'a. \i\Basis. a\i \ x\i \ x\i \ b\i}" + by (auto simp add:set_eq_iff box_def cbox_def) -lemma mem_interval: - fixes a :: "'a::ordered_euclidean_space" +lemma mem_box: + fixes a :: "'a::euclidean_space" shows "x \ box a b \ (\i\Basis. a\i < x\i \ x\i < b\i)" - and "x \ {a .. b} \ (\i\Basis. a\i \ x\i \ x\i \ b\i)" - using interval[of a b] + and "x \ cbox a b \ (\i\Basis. a\i \ x\i \ x\i \ b\i)" + using box[of a b] by auto -lemma interval_eq_empty: - fixes a :: "'a::ordered_euclidean_space" +lemma box_eq_empty: + fixes a :: "'a::euclidean_space" shows "(box a b = {} \ (\i\Basis. b\i \ a\i))" (is ?th1) - and "({a .. b} = {} \ (\i\Basis. b\i < a\i))" (is ?th2) + and "(cbox a b = {} \ (\i\Basis. b\i < a\i))" (is ?th2) proof - { fix i x assume i: "i\Basis" and as:"b\i \ a\i" and x:"x\box a b" then have "a \ i < x \ i \ x \ i < b \ i" - unfolding mem_interval by auto + unfolding mem_box by (auto simp: box_def) then have "a\i < b\i" by auto then have False using as by auto } @@ -216,15 +216,15 @@ by (auto simp: inner_add_left) } then have "box a b \ {}" - using mem_interval(1)[of "?x" a b] by auto + using mem_box(1)[of "?x" a b] by auto } ultimately show ?th1 by blast { fix i x - assume i: "i \ Basis" and as:"b\i < a\i" and x:"x\{a .. b}" + assume i: "i \ Basis" and as:"b\i < a\i" and x:"x\cbox a b" then have "a \ i \ x \ i \ x \ i \ b \ i" - unfolding mem_interval by auto + unfolding mem_box by auto then have "a\i \ b\i" by auto then have False using as by auto } @@ -240,57 +240,58 @@ then have "a\i \ ((1/2) *\<^sub>R (a+b)) \ i" "((1/2) *\<^sub>R (a+b)) \ i \ b\i" by (auto simp: inner_add_left) } - then have "{a .. b} \ {}" - using mem_interval(2)[of "?x" a b] by auto + then have "cbox a b \ {}" + using mem_box(2)[of "?x" a b] by auto } ultimately show ?th2 by blast qed -lemma interval_ne_empty: - fixes a :: "'a::ordered_euclidean_space" - shows "{a .. b} \ {} \ (\i\Basis. a\i \ b\i)" +lemma box_ne_empty: + fixes a :: "'a::euclidean_space" + shows "cbox a b \ {} \ (\i\Basis. a\i \ b\i)" and "box a b \ {} \ (\i\Basis. a\i < b\i)" - unfolding interval_eq_empty[of a b] by fastforce+ + unfolding box_eq_empty[of a b] by fastforce+ -lemma interval_sing: - fixes a :: "'a::ordered_euclidean_space" - shows "{a .. a} = {a}" - and "box a a = {}" - unfolding set_eq_iff mem_interval eq_iff [symmetric] - by (auto intro: euclidean_eqI simp: ex_in_conv) +lemma + fixes a :: "'a::euclidean_space" + shows cbox_sing: "cbox a a = {a}" + and box_sing: "box a a = {}" + unfolding set_eq_iff mem_box eq_iff [symmetric] + by (auto intro!: euclidean_eqI[where 'a='a]) + (metis all_not_in_conv nonempty_Basis) -lemma subset_interval_imp: - fixes a :: "'a::ordered_euclidean_space" - shows "(\i\Basis. a\i \ c\i \ d\i \ b\i) \ {c .. d} \ {a .. b}" - and "(\i\Basis. a\i < c\i \ d\i < b\i) \ {c .. d} \ box a b" - and "(\i\Basis. a\i \ c\i \ d\i \ b\i) \ box c d \ {a .. b}" - and "(\i\Basis. a\i \ c\i \ d\i \ b\i) \ box c d \ box a b" - unfolding subset_eq[unfolded Ball_def] unfolding mem_interval - by (best intro: order_trans less_le_trans le_less_trans less_imp_le)+ +lemma subset_box_imp: + fixes a :: "'a::euclidean_space" + shows "(\i\Basis. a\i \ c\i \ d\i \ b\i) \ cbox c d \ cbox a b" + and "(\i\Basis. a\i < c\i \ d\i < b\i) \ cbox c d \ box a b" + and "(\i\Basis. a\i \ c\i \ d\i \ b\i) \ box c d \ cbox a b" + and "(\i\Basis. a\i \ c\i \ d\i \ b\i) \ box c d \ box a b" + unfolding subset_eq[unfolded Ball_def] unfolding mem_box + by (best intro: order_trans less_le_trans le_less_trans less_imp_le)+ -lemma interval_open_subset_closed: - fixes a :: "'a::ordered_euclidean_space" - shows "box a b \ {a .. b}" - unfolding subset_eq [unfolded Ball_def] mem_interval +lemma box_subset_cbox: + fixes a :: "'a::euclidean_space" + shows "box a b \ cbox a b" + unfolding subset_eq [unfolded Ball_def] mem_box by (fast intro: less_imp_le) -lemma subset_interval: - fixes a :: "'a::ordered_euclidean_space" - shows "{c .. d} \ {a .. b} \ (\i\Basis. c\i \ d\i) --> (\i\Basis. a\i \ c\i \ d\i \ b\i)" (is ?th1) - and "{c .. d} \ box a b \ (\i\Basis. c\i \ d\i) --> (\i\Basis. a\i < c\i \ d\i < b\i)" (is ?th2) - and "box c d \ {a .. b} \ (\i\Basis. c\i < d\i) --> (\i\Basis. a\i \ c\i \ d\i \ b\i)" (is ?th3) +lemma subset_box: + fixes a :: "'a::euclidean_space" + shows "cbox c d \ cbox a b \ (\i\Basis. c\i \ d\i) --> (\i\Basis. a\i \ c\i \ d\i \ b\i)" (is ?th1) + and "cbox c d \ box a b \ (\i\Basis. c\i \ d\i) --> (\i\Basis. a\i < c\i \ d\i < b\i)" (is ?th2) + and "box c d \ cbox a b \ (\i\Basis. c\i < d\i) --> (\i\Basis. a\i \ c\i \ d\i \ b\i)" (is ?th3) and "box c d \ box a b \ (\i\Basis. c\i < d\i) --> (\i\Basis. a\i \ c\i \ d\i \ b\i)" (is ?th4) proof - show ?th1 - unfolding subset_eq and Ball_def and mem_interval + unfolding subset_eq and Ball_def and mem_box by (auto intro: order_trans) show ?th2 - unfolding subset_eq and Ball_def and mem_interval + unfolding subset_eq and Ball_def and mem_box by (auto intro: le_less_trans less_le_trans order_trans less_imp_le) { - assume as: "box c d \ {a .. b}" "\i\Basis. c\i < d\i" + assume as: "box c d \ cbox a b" "\i\Basis. c\i < d\i" then have "box c d \ {}" - unfolding interval_eq_empty by auto + unfolding box_eq_empty by auto fix i :: 'a assume i: "i \ Basis" (** TODO combine the following two parts as done in the HOL_light version. **) @@ -307,10 +308,10 @@ done } then have "?x\box c d" - using i unfolding mem_interval by auto + using i unfolding mem_box by auto moreover - have "?x \ {a .. b}" - unfolding mem_interval + have "?x \ cbox a b" + unfolding mem_box apply auto apply (rule_tac x=i in bexI) using as(2)[THEN bspec[where x=i]] and as2 i @@ -333,10 +334,10 @@ done } then have "?x\box c d" - unfolding mem_interval by auto + unfolding mem_box by auto moreover - have "?x\{a .. b}" - unfolding mem_interval + have "?x\cbox a b" + unfolding mem_box apply auto apply (rule_tac x=i in bexI) using as(2)[THEN bspec[where x=i]] and as2 using i @@ -349,10 +350,10 @@ have "a\i \ c\i \ d\i \ b\i" by auto } note part1 = this show ?th3 - unfolding subset_eq and Ball_def and mem_interval + unfolding subset_eq and Ball_def and mem_box apply (rule, rule, rule, rule) apply (rule part1) - unfolding subset_eq and Ball_def and mem_interval + unfolding subset_eq and Ball_def and mem_box prefer 4 apply auto apply (erule_tac x=xa in allE, erule_tac x=xa in allE, fastforce)+ @@ -361,16 +362,16 @@ assume as: "box c d \ box a b" "\i\Basis. c\i < d\i" fix i :: 'a assume i:"i\Basis" - from as(1) have "box c d \ {a..b}" - using interval_open_subset_closed[of a b] by auto + from as(1) have "box c d \ cbox a b" + using box_subset_cbox[of a b] by auto then have "a\i \ c\i \ d\i \ b\i" using part1 and as(2) using i by auto } note * = this show ?th4 - unfolding subset_eq and Ball_def and mem_interval + unfolding subset_eq and Ball_def and mem_box apply (rule, rule, rule, rule) apply (rule *) - unfolding subset_eq and Ball_def and mem_interval + unfolding subset_eq and Ball_def and mem_box prefer 4 apply auto apply (erule_tac x=xa in allE, simp)+ @@ -378,68 +379,68 @@ qed lemma inter_interval: - fixes a :: "'a::ordered_euclidean_space" - shows "{a .. b} \ {c .. d} = - {(\i\Basis. max (a\i) (c\i) *\<^sub>R i) .. (\i\Basis. min (b\i) (d\i) *\<^sub>R i)}" - unfolding set_eq_iff and Int_iff and mem_interval + fixes a :: "'a::euclidean_space" + shows "cbox a b \ cbox c d = + cbox (\i\Basis. max (a\i) (c\i) *\<^sub>R i) (\i\Basis. min (b\i) (d\i) *\<^sub>R i)" + unfolding set_eq_iff and Int_iff and mem_box by auto lemma disjoint_interval: - fixes a::"'a::ordered_euclidean_space" - shows "{a .. b} \ {c .. d} = {} \ (\i\Basis. (b\i < a\i \ d\i < c\i \ b\i < c\i \ d\i < a\i))" (is ?th1) - and "{a .. b} \ box c d = {} \ (\i\Basis. (b\i < a\i \ d\i \ c\i \ b\i \ c\i \ d\i \ a\i))" (is ?th2) - and "box a b \ {c .. d} = {} \ (\i\Basis. (b\i \ a\i \ d\i < c\i \ b\i \ c\i \ d\i \ a\i))" (is ?th3) + fixes a::"'a::euclidean_space" + shows "cbox a b \ cbox c d = {} \ (\i\Basis. (b\i < a\i \ d\i < c\i \ b\i < c\i \ d\i < a\i))" (is ?th1) + and "cbox a b \ box c d = {} \ (\i\Basis. (b\i < a\i \ d\i \ c\i \ b\i \ c\i \ d\i \ a\i))" (is ?th2) + and "box a b \ cbox c d = {} \ (\i\Basis. (b\i \ a\i \ d\i < c\i \ b\i \ c\i \ d\i \ a\i))" (is ?th3) and "box a b \ box c d = {} \ (\i\Basis. (b\i \ a\i \ d\i \ c\i \ b\i \ c\i \ d\i \ a\i))" (is ?th4) proof - let ?z = "(\i\Basis. (((max (a\i) (c\i)) + (min (b\i) (d\i))) / 2) *\<^sub>R i)::'a" have **: "\P Q. (\i :: 'a. i \ Basis \ Q ?z i \ P i) \ (\i x :: 'a. i \ Basis \ P i \ Q x i) \ (\x. \i\Basis. Q x i) \ (\i\Basis. P i)" by blast - note * = set_eq_iff Int_iff empty_iff mem_interval ball_conj_distrib[symmetric] eq_False ball_simps(10) + note * = set_eq_iff Int_iff empty_iff mem_box ball_conj_distrib[symmetric] eq_False ball_simps(10) show ?th1 unfolding * by (intro **) auto show ?th2 unfolding * by (intro **) auto show ?th3 unfolding * by (intro **) auto show ?th4 unfolding * by (intro **) auto qed -(* Moved interval_open_subset_closed a bit upwards *) +(* Moved box_subset_cbox a bit upwards *) -lemma open_interval[intro]: - fixes a b :: "'a::ordered_euclidean_space" +lemma open_box[intro]: + fixes a b :: "'a::euclidean_space" shows "open (box a b)" proof - have "open (\i\Basis. (\x. x\i) -` {a\i<..i})" by (intro open_INT finite_lessThan ballI continuous_open_vimage allI linear_continuous_at open_real_greaterThanLessThan finite_Basis bounded_linear_inner_left) also have "(\i\Basis. (\x. x\i) -` {a\i<..i}) = box a b" - by (auto simp add: interval) + by (auto simp add: box) finally show "open (box a b)" . qed -lemma closed_interval[intro]: - fixes a b :: "'a::ordered_euclidean_space" - shows "closed {a .. b}" +lemma closed_cbox[intro]: + fixes a b :: "'a::euclidean_space" + shows "closed (cbox a b)" proof - have "closed (\i\Basis. (\x. x\i) -` {a\i .. b\i})" by (intro closed_INT ballI continuous_closed_vimage allI linear_continuous_at closed_real_atLeastAtMost finite_Basis bounded_linear_inner_left) - also have "(\i\Basis. (\x. x\i) -` {a\i .. b\i}) = {a .. b}" - by (auto simp add: eucl_le [where 'a='a]) - finally show "closed {a .. b}" . + also have "(\i\Basis. (\x. x\i) -` {a\i .. b\i}) = cbox a b" + by (auto simp add: cbox_def) + finally show "closed (cbox a b)" . qed -lemma interior_closed_interval [intro]: - fixes a b :: "'a::ordered_euclidean_space" - shows "interior {a..b} = box a b" (is "?L = ?R") +lemma interior_cbox [intro]: + fixes a b :: "'a::euclidean_space" + shows "interior (cbox a b) = box a b" (is "?L = ?R") proof(rule subset_antisym) show "?R \ ?L" - using interval_open_subset_closed open_interval + using box_subset_cbox open_box by (rule interior_maximal) { fix x - assume "x \ interior {a..b}" - then obtain s where s: "open s" "x \ s" "s \ {a..b}" .. - then obtain e where "e>0" and e:"\x'. dist x' x < e \ x' \ {a..b}" + assume "x \ interior (cbox a b)" + then obtain s where s: "open s" "x \ s" "s \ cbox a b" .. + then obtain e where "e>0" and e:"\x'. dist x' x < e \ x' \ cbox a b" unfolding open_dist and subset_eq by auto { fix i :: 'a @@ -455,7 +456,7 @@ then have "a \ i \ (x - (e / 2) *\<^sub>R i) \ i" and "(x + (e / 2) *\<^sub>R i) \ i \ b \ i" using e[THEN spec[where x="x - (e/2) *\<^sub>R i"]] and e[THEN spec[where x="x + (e/2) *\<^sub>R i"]] - unfolding mem_interval + unfolding mem_box using i by blast+ then have "a \ i < x \ i" and "x \ i < b \ i" @@ -463,14 +464,14 @@ by (auto simp: inner_diff_left inner_Basis inner_add_left) } then have "x \ box a b" - unfolding mem_interval by auto + unfolding mem_box by auto } then show "?L \ ?R" .. qed -lemma bounded_closed_interval: - fixes a :: "'a::ordered_euclidean_space" - shows "bounded {a .. b}" +lemma bounded_cbox: + fixes a :: "'a::euclidean_space" + shows "bounded (cbox a b)" proof - let ?b = "\i\Basis. \a\i\ + \b\i\" { @@ -491,30 +492,30 @@ using norm_le_l1[of x] by auto } then show ?thesis - unfolding interval and bounded_iff by auto + unfolding box and bounded_iff by auto qed lemma bounded_interval: - fixes a :: "'a::ordered_euclidean_space" - shows "bounded {a .. b} \ bounded (box a b)" - using bounded_closed_interval[of a b] - using interval_open_subset_closed[of a b] - using bounded_subset[of "{a..b}" "box a b"] + fixes a :: "'a::euclidean_space" + shows "bounded (cbox a b) \ bounded (box a b)" + using bounded_cbox[of a b] + using box_subset_cbox[of a b] + using bounded_subset[of "cbox a b" "box a b"] by simp lemma not_interval_univ: - fixes a :: "'a::ordered_euclidean_space" - shows "{a .. b} \ UNIV \ box a b \ UNIV" + fixes a :: "'a::euclidean_space" + shows "cbox a b \ UNIV \ box a b \ UNIV" using bounded_interval[of a b] by auto -lemma compact_interval: - fixes a :: "'a::ordered_euclidean_space" - shows "compact {a .. b}" - using bounded_closed_imp_seq_compact[of "{a..b}"] using bounded_interval[of a b] +lemma compact_cbox: + fixes a :: "'a::euclidean_space" + shows "compact (cbox a b)" + using bounded_closed_imp_seq_compact[of "cbox a b"] using bounded_interval[of a b] by (auto simp: compact_eq_seq_compact_metric) lemma open_interval_midpoint: - fixes a :: "'a::ordered_euclidean_space" + fixes a :: "'a::euclidean_space" assumes "box a b \ {}" shows "((1/2) *\<^sub>R (a + b)) \ box a b" proof - @@ -522,15 +523,15 @@ fix i :: 'a assume "i \ Basis" then have "a \ i < ((1 / 2) *\<^sub>R (a + b)) \ i \ ((1 / 2) *\<^sub>R (a + b)) \ i < b \ i" - using assms[unfolded interval_ne_empty, THEN bspec[where x=i]] by (auto simp: inner_add_left) + using assms[unfolded box_ne_empty, THEN bspec[where x=i]] by (auto simp: inner_add_left) } - then show ?thesis unfolding mem_interval by auto + then show ?thesis unfolding mem_box by auto qed lemma open_closed_interval_convex: - fixes x :: "'a::ordered_euclidean_space" + fixes x :: "'a::euclidean_space" assumes x: "x \ box a b" - and y: "y \ {a .. b}" + and y: "y \ cbox a b" and e: "0 < e" "e \ 1" shows "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \ box a b" proof - @@ -543,9 +544,9 @@ apply (rule add_less_le_mono) using e unfolding mult_less_cancel_left and mult_le_cancel_left apply simp_all - using x unfolding mem_interval using i + using x unfolding mem_box using i apply simp - using y unfolding mem_interval using i + using y unfolding mem_box using i apply simp done finally have "a \ i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \ i" @@ -559,11 +560,11 @@ using e unfolding mult_less_cancel_left and mult_le_cancel_left apply simp_all using x - unfolding mem_interval + unfolding mem_box using i apply simp using y - unfolding mem_interval + unfolding mem_box using i apply simp done @@ -574,23 +575,23 @@ by auto } then show ?thesis - unfolding mem_interval by auto + unfolding mem_box by auto qed notation eucl_less (infix " {}" - shows "closure (box a b) = {a .. b}" + fixes a :: "'a::euclidean_space" + assumes "box a b \ {}" + shows "closure (box a b) = cbox a b" proof - have ab: "a {a .. b}" + assume as:"x \ cbox a b" def f \ "\n::nat. x + (inverse (real n + 1)) *\<^sub>R (?c - x)" { fix n @@ -602,7 +603,7 @@ by (auto simp add: algebra_simps) then have "f n a. s \ box (-a) a" proof - @@ -665,38 +666,38 @@ by auto } then show ?thesis - by (auto intro: exI[where x=a] simp add: interval) + by (auto intro: exI[where x=a] simp add: box) qed lemma bounded_subset_open_interval: - fixes s :: "('a::ordered_euclidean_space) set" + fixes s :: "('a::euclidean_space) set" shows "bounded s \ (\a b. s \ box a b)" by (auto dest!: bounded_subset_open_interval_symmetric) -lemma bounded_subset_closed_interval_symmetric: - fixes s :: "('a::ordered_euclidean_space) set" - assumes "bounded s" - shows "\a. s \ {-a .. a}" +lemma bounded_subset_cbox_symmetric: + fixes s :: "('a::euclidean_space) set" + assumes "bounded s" + shows "\a. s \ cbox (-a) a" proof - obtain a where "s \ box (-a) a" using bounded_subset_open_interval_symmetric[OF assms] by auto then show ?thesis - using interval_open_subset_closed[of "-a" a] by auto + using box_subset_cbox[of "-a" a] by auto qed -lemma bounded_subset_closed_interval: - fixes s :: "('a::ordered_euclidean_space) set" - shows "bounded s \ \a b. s \ {a .. b}" - using bounded_subset_closed_interval_symmetric[of s] by auto +lemma bounded_subset_cbox: + fixes s :: "('a::euclidean_space) set" + shows "bounded s \ \a b. s \ cbox a b" + using bounded_subset_cbox_symmetric[of s] by auto lemma frontier_closed_interval: - fixes a b :: "'a::ordered_euclidean_space" - shows "frontier {a .. b} = {a .. b} - box a b" - unfolding frontier_def unfolding interior_closed_interval and closure_closed[OF closed_interval] .. + fixes a b :: "'a::euclidean_space" + shows "frontier (cbox a b) = cbox a b - box a b" + unfolding frontier_def unfolding interior_cbox and closure_closed[OF closed_cbox] .. lemma frontier_open_interval: - fixes a b :: "'a::ordered_euclidean_space" - shows "frontier (box a b) = (if box a b = {} then {} else {a .. b} - box a b)" + fixes a b :: "'a::euclidean_space" + shows "frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)" proof (cases "box a b = {}") case True then show ?thesis @@ -704,16 +705,16 @@ next case False then show ?thesis - unfolding frontier_def and closure_open_interval[OF False] and interior_open[OF open_interval] + unfolding frontier_def and closure_open_interval[OF False] and interior_open[OF open_box] by auto qed lemma inter_interval_mixed_eq_empty: - fixes a :: "'a::ordered_euclidean_space" - assumes "box c d \ {}" - shows "box a b \ {c .. d} = {} \ box a b \ box c d = {}" + fixes a :: "'a::euclidean_space" + assumes "box c d \ {}" + shows "box a b \ cbox c d = {} \ box a b \ box c d = {}" unfolding closure_open_interval[OF assms, symmetric] - unfolding open_inter_closure_eq_empty[OF open_interval] .. + unfolding open_inter_closure_eq_empty[OF open_box] .. lemma diameter_closed_interval: fixes a b::"'a::ordered_euclidean_space" @@ -726,9 +727,9 @@ definition "is_interval (s::('a::euclidean_space) set) \ (\a\s. \b\s. \x. (\i\Basis. ((a\i \ x\i \ x\i \ b\i) \ (b\i \ x\i \ x\i \ a\i))) \ x \ s)" -lemma is_interval_interval: "is_interval {a .. b::'a::ordered_euclidean_space}" (is ?th1) +lemma is_interval_interval: "is_interval (cbox a (b::'a::euclidean_space))" (is ?th1) "is_interval (box a b)" (is ?th2) proof - - show ?th1 ?th2 unfolding is_interval_def mem_interval Ball_def atLeastAtMost_iff + show ?th1 ?th2 unfolding is_interval_def mem_box Ball_def atLeastAtMost_iff by(meson order_trans le_less_trans less_le_trans less_trans)+ qed lemma is_interval_empty: @@ -756,7 +757,7 @@ shows "(\i\Basis. (if i = j then y i \ i else x \ i) *\<^sub>R i) \ S" by (rule mem_is_intervalI[OF assms(1,2)]) (auto simp: assms) -lemma mem_interval_componentwiseI: +lemma mem_box_componentwiseI: fixes S::"'a::ordered_euclidean_space set" assumes "is_interval S" assumes "\i. i \ Basis \ x \ i \ ((\x. x \ i) ` S)" @@ -787,93 +788,72 @@ finally show ?thesis . qed -text{* Instantiation for intervals on @{text ordered_euclidean_space} *} - -lemma eucl_lessThan_eq_halfspaces: - fixes a :: "'a\ordered_euclidean_space" +lemma eucl_less_eq_halfspaces: + fixes a :: "'a\euclidean_space" shows "{x. x i\Basis. {x. x \ i < a \ i})" - by (auto simp: eucl_less_def) - -lemma eucl_greaterThan_eq_halfspaces: - fixes a :: "'a\ordered_euclidean_space" - shows "{x. a i\Basis. {x. a \ i < x \ i})" + "{x. a i\Basis. {x. a \ i < x \ i})" by (auto simp: eucl_less_def) -lemma eucl_atMost_eq_halfspaces: - fixes a :: "'a\ordered_euclidean_space" - shows "{.. a} = (\i\Basis. {x. x \ i \ a \ i})" - by (auto simp: eucl_le[where 'a='a]) - -lemma eucl_atLeast_eq_halfspaces: - fixes a :: "'a\ordered_euclidean_space" - shows "{a ..} = (\i\Basis. {x. a \ i \ x \ i})" - by (auto simp: eucl_le[where 'a='a]) +lemma eucl_le_eq_halfspaces: + fixes a :: "'a\euclidean_space" + shows "{x. \i\Basis. x \ i \ a \ i} = (\i\Basis. {x. x \ i \ a \ i})" + "{x. \i\Basis. a \ i \ x \ i} = (\i\Basis. {x. a \ i \ x \ i})" + by auto -lemma open_eucl_lessThan[simp, intro]: - fixes a :: "'a\ordered_euclidean_space" +lemma open_Collect_eucl_less[simp, intro]: + fixes a :: "'a\euclidean_space" shows "open {x. x ordered_euclidean_space" - shows "open {x. a ordered_euclidean_space" - shows "closed {.. a}" - unfolding eucl_atMost_eq_halfspaces - by (simp add: closed_INT closed_Collect_le) +lemma closed_Collect_eucl_le[simp, intro]: + fixes a :: "'a\euclidean_space" + shows "closed {x. \i\Basis. a \ i \ x \ i}" + "closed {x. \i\Basis. x \ i \ a \ i}" + unfolding eucl_le_eq_halfspaces + by (simp_all add: closed_INT closed_Collect_le) -lemma closed_eucl_atLeast[simp, intro]: - fixes a :: "'a\ordered_euclidean_space" - shows "closed {a ..}" - unfolding eucl_atLeast_eq_halfspaces - by (simp add: closed_INT closed_Collect_le) - - -lemma image_affinity_interval: fixes m::real - fixes a b c :: "'a::ordered_euclidean_space" - shows "(\x. m *\<^sub>R x + c) ` {a .. b} = - (if {a .. b} = {} then {} - else (if 0 \ m then {m *\<^sub>R a + c .. m *\<^sub>R b + c} - else {m *\<^sub>R b + c .. m *\<^sub>R a + c}))" +lemma image_affinity_cbox: fixes m::real + fixes a b c :: "'a::euclidean_space" + shows "(\x. m *\<^sub>R x + c) ` cbox a b = + (if cbox a b = {} then {} + else (if 0 \ m then cbox (m *\<^sub>R a + c) (m *\<^sub>R b + c) + else cbox (m *\<^sub>R b + c) (m *\<^sub>R a + c)))" proof (cases "m = 0") case True { fix x - assume "x \ c" "c \ x" + assume "\i\Basis. x \ i \ c \ i" "\i\Basis. c \ i \ x \ i" then have "x = c" - unfolding eucl_le[where 'a='a] apply - apply (subst euclidean_eq_iff) apply (auto intro: order_antisym) done } - moreover have "c \ {m *\<^sub>R a + c..m *\<^sub>R b + c}" - unfolding True by (auto simp add: eucl_le[where 'a='a]) - ultimately show ?thesis using True by auto + moreover have "c \ cbox (m *\<^sub>R a + c) (m *\<^sub>R b + c)" + unfolding True by (auto simp add: cbox_sing) + ultimately show ?thesis using True by (auto simp: cbox_def) next case False { fix y - assume "a \ y" "y \ b" "m > 0" - then have "m *\<^sub>R a + c \ m *\<^sub>R y + c" and "m *\<^sub>R y + c \ m *\<^sub>R b + c" - unfolding eucl_le[where 'a='a] by (auto simp: inner_distrib) + assume "\i\Basis. a \ i \ y \ i" "\i\Basis. y \ i \ b \ i" "m > 0" + then have "\i\Basis. (m *\<^sub>R a + c) \ i \ (m *\<^sub>R y + c) \ i" and "\i\Basis. (m *\<^sub>R y + c) \ i \ (m *\<^sub>R b + c) \ i" + by (auto simp: inner_distrib) } moreover { fix y - assume "a \ y" "y \ b" "m < 0" - then have "m *\<^sub>R b + c \ m *\<^sub>R y + c" and "m *\<^sub>R y + c \ m *\<^sub>R a + c" - unfolding eucl_le[where 'a='a] by (auto simp add: mult_left_mono_neg inner_distrib) + assume "\i\Basis. a \ i \ y \ i" "\i\Basis. y \ i \ b \ i" "m < 0" + then have "\i\Basis. (m *\<^sub>R b + c) \ i \ (m *\<^sub>R y + c) \ i" and "\i\Basis. (m *\<^sub>R y + c) \ i \ (m *\<^sub>R a + c) \ i" + by (auto simp add: mult_left_mono_neg inner_distrib) } moreover { fix y - assume "m > 0" and "m *\<^sub>R a + c \ y" and "y \ m *\<^sub>R b + c" - then have "y \ (\x. m *\<^sub>R x + c) ` {a..b}" - unfolding image_iff Bex_def mem_interval eucl_le[where 'a='a] + assume "m > 0" and "\i\Basis. (m *\<^sub>R a + c) \ i \ y \ i" and "\i\Basis. y \ i \ (m *\<^sub>R b + c) \ i" + then have "y \ (\x. m *\<^sub>R x + c) ` cbox a b" + unfolding image_iff Bex_def mem_box apply (intro exI[where x="(1 / m) *\<^sub>R (y - c)"]) apply (auto simp add: pos_le_divide_eq pos_divide_le_eq mult_commute diff_le_iff inner_distrib inner_diff_left) done @@ -881,19 +861,58 @@ moreover { fix y - assume "m *\<^sub>R b + c \ y" "y \ m *\<^sub>R a + c" "m < 0" - then have "y \ (\x. m *\<^sub>R x + c) ` {a..b}" - unfolding image_iff Bex_def mem_interval eucl_le[where 'a='a] + assume "\i\Basis. (m *\<^sub>R b + c) \ i \ y \ i" "\i\Basis. y \ i \ (m *\<^sub>R a + c) \ i" "m < 0" + then have "y \ (\x. m *\<^sub>R x + c) ` cbox a b" + unfolding image_iff Bex_def mem_box apply (intro exI[where x="(1 / m) *\<^sub>R (y - c)"]) apply (auto simp add: neg_le_divide_eq neg_divide_le_eq mult_commute diff_le_iff inner_distrib inner_diff_left) done } - ultimately show ?thesis using False by auto + ultimately show ?thesis using False by (auto simp: cbox_def) qed -lemma image_smult_interval:"(\x. m *\<^sub>R (x::_::ordered_euclidean_space)) ` {a..b} = - (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})" - using image_affinity_interval[of m 0 a b] by auto +lemma image_smult_cbox:"(\x. m *\<^sub>R (x::_::euclidean_space)) ` cbox a b = + (if cbox a b = {} then {} else if 0 \ m then cbox (m *\<^sub>R a) (m *\<^sub>R b) else cbox (m *\<^sub>R b) (m *\<^sub>R a))" + using image_affinity_cbox[of m 0 a b] by auto + +text{* Instantiation for intervals on @{text ordered_euclidean_space} *} + +lemma + fixes a :: "'a\ordered_euclidean_space" + shows cbox_interval: "cbox a b = {a..b}" + and interval_cbox: "{a..b} = cbox a b" + and eucl_le_atMost: "{x. \i\Basis. x \ i <= a \ i} = {..a}" + and eucl_le_atLeast: "{x. \i\Basis. a \ i <= x \ i} = {a..}" + by (auto simp: eucl_le[where 'a='a] eucl_less_def box_def cbox_def) + +lemma closed_eucl_atLeastAtMost[simp, intro]: + fixes a :: "'a\ordered_euclidean_space" + shows "closed {a..b}" + by (simp add: cbox_interval[symmetric] closed_cbox) + +lemma closed_eucl_atMost[simp, intro]: + fixes a :: "'a\ordered_euclidean_space" + shows "closed {..a}" + by (simp add: eucl_le_atMost[symmetric]) + +lemma closed_eucl_atLeast[simp, intro]: + fixes a :: "'a\ordered_euclidean_space" + shows "closed {a..}" + by (simp add: eucl_le_atLeast[symmetric]) + +lemma image_affinity_interval: fixes m::real + fixes a b c :: "'a::ordered_euclidean_space" + shows "(\x. m *\<^sub>R x + c) ` {a..b} = + (if {a..b} = {} then {} + else (if 0 \ m then {m *\<^sub>R a + c .. m *\<^sub>R b + c} + else {m *\<^sub>R b + c .. m *\<^sub>R a + c}))" + using image_affinity_cbox[of m c a b] + by (simp add: cbox_interval) + +lemma image_smult_interval:"(\x. m *\<^sub>R (x::_::ordered_euclidean_space)) ` {a .. b} = + (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})" + using image_smult_cbox[of m a b] + by (simp add: cbox_interval) no_notation eucl_less (infix "