# HG changeset patch # User hoelzl # Date 1300109861 -3600 # Node ID d47eabd80e59b8ec4db5ad45a0614c39f4866798 # Parent 6e691abef08fc0ddb81bf6f85759525fc3dd84ab simplified definition of open_extreal diff -r 6e691abef08f -r d47eabd80e59 src/HOL/Library/Extended_Reals.thy --- a/src/HOL/Library/Extended_Reals.thy Mon Mar 14 14:37:40 2011 +0100 +++ b/src/HOL/Library/Extended_Reals.thy Mon Mar 14 14:37:41 2011 +0100 @@ -1076,128 +1076,89 @@ subsubsection "Topological space" +lemma + shows extreal_max[simp]: "extreal (max x y) = max (extreal x) (extreal y)" + and extreal_min[simp]: "extreal (min x y) = min (extreal x) (extreal y)" + by (simp_all add: min_def max_def) + instantiation extreal :: topological_space begin -definition "open A \ - (\T. open T \ extreal ` T = A - {\, -\}) +definition "open A \ open (extreal -` A) \ (\ \ A \ (\x. {extreal x <..} \ A)) \ (-\ \ A \ (\x. {.. A))" -lemma open_PInfty: "open A ==> \ : A ==> (EX x. {extreal x<..} <= A)" +lemma open_PInfty: "open A \ \ \ A \ (\x. {extreal x<..} \ A)" unfolding open_extreal_def by auto -lemma open_MInfty: "open A ==> (-\) : A ==> (EX x. {.. -\ \ A \ (\x. {.. A)" unfolding open_extreal_def by auto -lemma open_PInfty2: assumes "open A" "\ : A" obtains x where "{extreal x<..} <= A" +lemma open_PInfty2: assumes "open A" "\ \ A" obtains x where "{extreal x<..} \ A" using open_PInfty[OF assms] by auto -lemma open_MInfty2: assumes "open A" "(-\) : A" obtains x where "{.. \ A" obtains x where "{.. A" using open_MInfty[OF assms] by auto -lemma extreal_openE: assumes "open A" obtains A' x y where - "open A'" "extreal ` A' = A - {\, (-\)}" - "\ : A ==> {extreal x<..} <= A" - "(-\) : A ==> {.. \ A \ {extreal x<..} \ A" + "-\ \ A \ {.. A" using assms open_extreal_def by auto instance proof let ?U = "UNIV::extreal set" show "open ?U" unfolding open_extreal_def - by (auto intro!: exI[of _ "UNIV"] exI[of _ 0]) + by (auto intro!: exI[of _ 0]) next fix S T::"extreal set" assume "open S" and "open T" - from `open S`[THEN extreal_openE] guess S' xS yS . note S' = this - from `open T`[THEN extreal_openE] guess T' xT yT . note T' = this - - have "extreal ` (S' Int T') = (extreal ` S') Int (extreal ` T')" by auto - also have "... = S Int T - {\, (-\)}" using S' T' by auto - finally have "extreal ` (S' Int T') = S Int T - {\, (-\)}" by auto - moreover have "open (S' Int T')" using S' T' by auto - moreover - { assume a: "\ : S Int T" - hence "EX x. {extreal x<..} <= S Int T" - apply(rule_tac x="max xS xT" in exI) - proof- - { fix x assume *: "extreal (max xS xT) < x" - hence "x : S Int T" apply (cases x, auto simp: max_def split: split_if_asm) - using a S' T' by auto - } thus "{extreal (max xS xT)<..} <= S Int T" by auto - qed } - moreover - { assume a: "(-\) : S Int T" - hence "EX x. {.. x" - hence "x T))" + "\ \ S \ T \ {extreal (max xS xT) <..} \ S \ T" + "-\ \ S \ T \ {..< extreal (min yS yT)} \ S \ T" + by auto + then show "open (S Int T)" unfolding open_extreal_def by blast next - fix K assume openK: "ALL S : K. open (S:: extreal set)" - hence "ALL S:K. EX T. open T & extreal ` T = S - {\, (-\)}" by (auto simp: open_extreal_def) - from bchoice[OF this] guess T .. note T = this[rule_format] - - show "open (Union K)" unfolding open_extreal_def - proof (safe intro!: exI[of _ "Union (T ` K)"]) - fix x S assume "x : T S" "S : K" - with T[OF `S : K`] show "extreal x : Union K" by auto - next - fix x S assume x: "x ~: extreal ` (Union (T ` K))" "S : K" "x : S" "x ~= \" - hence "x ~: extreal ` (T S)" - by (auto simp: image_UN UN_simps[symmetric] simp del: UN_simps) - thus "x=(-\)" using T[OF `S : K`] `x : S` `x ~= \` by auto - next - fix S assume "\ : S" "S : K" - from openK[rule_format, OF `S : K`, THEN extreal_openE] guess S' x . - from this(3) `\ : S` - show "EX x. {extreal x<..} <= Union K" - by (auto intro!: exI[of _ x] bexI[OF _ `S : K`]) - next - fix S assume "(-\) : S" "S : K" - from openK[rule_format, OF `S : K`, THEN extreal_openE] guess S' x y . - from this(4) `(-\) : S` - show "EX y. {..S\K. open S" + then have *: "\S. \x y. S \ K \ open (extreal -` S) \ + (\ \ S \ {extreal x <..} \ S) \ (-\ \ S \ {..< extreal y} \ S)" + by (auto simp: open_extreal_def) + then show "open (Union K)" unfolding open_extreal_def + proof (intro conjI impI) + show "open (extreal -` \K)" + using *[unfolded choice_iff] by (auto simp: vimage_Union) + qed ((metis UnionE Union_upper subset_trans *)+) qed end -lemma open_extreal_lessThan[simp]: - "open {..< a :: extreal}" -proof (cases a) - case (real x) - then show ?thesis unfolding open_extreal_def - proof (safe intro!: exI[of _ "{..< x}"]) - fix y assume "y < extreal x" - moreover assume "y ~: (extreal ` {..)" apply (cases y) using `y < extreal x` by auto - qed auto -qed (auto simp: open_extreal_def) - -lemma open_extreal_greaterThan[simp]: +lemma continuous_on_extreal[intro, simp]: "continuous_on A extreal" + unfolding continuous_on_topological open_extreal_def by auto + +lemma continuous_at_extreal[intro, simp]: "continuous (at x) extreal" + using continuous_on_eq_continuous_at[of UNIV] by auto + +lemma continuous_within_extreal[intro, simp]: "x \ A \ continuous (at x within A) extreal" + using continuous_on_eq_continuous_within[of A] by auto + +lemma open_extreal_lessThan[intro, simp]: "open {..< a :: extreal}" +proof - + have "\x. extreal -` {..} = UNIV" "extreal -` {..< -\} = {}" by auto + then show ?thesis by (cases a) (auto simp: open_extreal_def) +qed + +lemma open_extreal_greaterThan[intro, simp]: "open {a :: extreal <..}" -proof (cases a) - case (real x) - then show ?thesis unfolding open_extreal_def - proof (safe intro!: exI[of _ "{x<..}"]) - fix y assume "extreal x < y" - moreover assume "y ~: (extreal ` {x<..})" - moreover assume "y ~= \" - ultimately have "y ~= extreal (real y)" using real by (cases y) auto - hence False apply (cases y) using `extreal x < y` `y ~= \` by auto - thus "y = (-\)" by auto - qed auto -qed (auto simp: open_extreal_def) - -lemma extreal_open_greaterThanLessThan[simp]: "open {a::extreal <..< b}" +proof - + have "\x. extreal -` {extreal x<..} = {x<..}" + "extreal -` {\<..} = {}" "extreal -` {-\<..} = UNIV" by auto + then show ?thesis by (cases a) (auto simp: open_extreal_def) +qed + +lemma extreal_open_greaterThanLessThan[intro, simp]: "open {a::extreal <..< b}" unfolding greaterThanLessThan_def by auto lemma closed_extreal_atLeast[simp, intro]: "closed {a :: extreal ..}" @@ -1227,19 +1188,17 @@ obtains e where "e>0" "{x-e <..< x+e} \ S" proof- obtain m where m_def: "x = extreal m" using assms by (cases x) auto - obtain A where "open A" and A_def: "extreal ` A = S - {\,(-\)}" - using assms by (auto elim!: extreal_openE) - hence "m : A" using m_def assms by auto - from this obtain e where e_def: "e>0 & ball m e <= A" - using open_contains_ball[of A] `open A` by auto - moreover have "ball m e = {m-e <..< m+e}" unfolding ball_def dist_norm by auto - ultimately have *: "{m-e <..< m+e} <= A" using e_def by auto - { fix y assume y_def: "y:{x-extreal e <..< x+extreal e}" - from this obtain z where z_def: "y = extreal z" by (cases y) auto - hence "z:A" using y_def m_def * by auto - hence "y:S" using z_def A_def by auto - } hence "{x-extreal e <..< x+extreal e} <= S" by auto - thus thesis apply- apply(rule that[of "extreal e"]) using e_def by auto + from `open S` have "open (extreal -` S)" by (rule extreal_openE) + then obtain e where "0 < e" and e: "ball m e \ extreal -` S" + using `x \ S` unfolding open_contains_ball m_def by force + show thesis + proof (intro that subsetI) + show "0 < extreal e" using `0 < e` by auto + fix y assume "y \ {x - extreal e<.. ball m e" + unfolding m_def by (cases y) (auto simp: ball_def dist_real_def) + then show "y \ S" using e by auto + qed qed lemma extreal_open_cont_interval2: @@ -1266,41 +1225,36 @@ fixes S :: "extreal set" assumes "open S" shows "open (uminus ` S)" -proof- - obtain T x y where T_def: "open T & extreal ` T = S - {\, (-\)} & - (\ : S --> {extreal x<..} <= S) & ((-\) : S --> {.., (-\)})" using T_def by auto - finally have "extreal ` uminus ` T = uminus ` S - {\, (-\)}" by (auto simp: extreal_uminus_reorder) - moreover have "open (uminus ` T)" using T_def open_negations[of T] by auto - ultimately have "EX T. open T & extreal ` T = uminus ` S - {\, (-\)}" by auto - moreover - { assume "\: uminus ` S" - hence "(-\) : S" by (metis image_iff extreal_uminus_uminus) - hence "uminus ` {..): uminus ` S" - hence "\ : S" by (metis image_iff extreal_uminus_uminus) - hence "uminus ` {extreal x<..} <= uminus ` S" using T_def by (intro image_mono) auto - hence "EX y. {.. \ S \ {extreal x<..} \ S" "-\ \ S \ {..< extreal y} \ S" + using `open S` unfolding open_extreal_def by auto + have "extreal -` uminus ` S = uminus ` (extreal -` S)" + proof safe + fix x y assume "extreal x = - y" "y \ S" + then show "x \ uminus ` extreal -` S" by (cases y) auto + next + fix x assume "extreal x \ S" + then show "- x \ extreal -` uminus ` S" + by (auto intro: image_eqI[of _ _ "extreal x"]) + qed + then show "open (extreal -` uminus ` S)" + using S by (auto intro: open_negations) + { assume "\ \ uminus ` S" + then have "-\ \ S" by (metis image_iff extreal_uminus_uminus) + then have "uminus ` {.. uminus ` S" using S by (intro image_mono) auto + then show "\x. {extreal x<..} \ uminus ` S" using extreal_uminus_lessThan by auto } + { assume "-\ \ uminus ` S" + then have "\ : S" by (metis image_iff extreal_uminus_uminus) + then have "uminus ` {extreal x<..} <= uminus ` S" using S by (intro image_mono) auto + then show "\y. {.. -x:(- S)" by (metis image_iff extreal_uminus_uminus) - also have "... <-> x:(- uminus ` S)" - by (metis ComplI Compl_iff image_eqI extreal_uminus_uminus extreal_minus_minus_image) - finally have "x:uminus ` (- S) <-> x:(- uminus ` S)" by auto -} thus ?thesis by auto -qed + shows "uminus ` (- S) = - uminus ` S" + by (auto intro!: bij_image_Compl_eq surjI[of _ uminus] simp: bij_betw_def) lemma extreal_closed_uminus: fixes S :: "extreal set" @@ -1309,7 +1263,6 @@ using assms unfolding closed_def using extreal_open_uminus[of "- S"] extreal_uminus_complement by auto - lemma not_open_extreal_singleton: "~(open {a :: extreal})" proof(rule ccontr) @@ -1491,22 +1444,17 @@ qed qed -lemma open_extreal: assumes "open S" shows "open (extreal ` S)" - unfolding open_extreal_def apply(rule,rule,rule,rule assms) by auto - -lemma open_real_of_extreal: - fixes S :: "extreal set" assumes "open S" - shows "open (real ` (S - {\, -\}))" -proof - - from `open S` obtain T where T: "open T" "S - {\, -\} = extreal ` T" - unfolding open_extreal_def by auto - show ?thesis using T by (simp add: image_image) -qed +lemma inj_extreal[simp]: "inj_on extreal A" + unfolding inj_on_def by auto + +lemma open_extreal: "open S \ open (extreal ` S)" + by (auto simp: inj_vimage_image_eq open_extreal_def) + +lemma open_extreal_vimage: "open S \ open (extreal -` S)" + unfolding open_extreal_def by auto subsubsection {* Convergent sequences *} -lemma inj_extreal[simp, intro]: "inj_on extreal A" by (auto intro: inj_onI) - lemma lim_extreal[simp]: "((\n. extreal (f n)) ---> extreal x) net \ (f ---> x) net" (is "?l = ?r") proof (intro iffI topological_tendstoI) @@ -1516,12 +1464,9 @@ by (simp add: inj_image_mem_iff) next fix S assume "?r" "open S" "extreal x \ S" - have *: "\x. x \ real ` (S - {\, - \}) \ extreal x \ S" - apply (safe intro!: rev_image_eqI) - by (case_tac xa) auto show "eventually (\x. extreal (f x) \ S) net" - using `?r`[THEN topological_tendstoD, OF open_real_of_extreal, OF `open S`] - using `extreal x \ S` by (simp add: *) + using `?r`[THEN topological_tendstoD, OF open_extreal_vimage, OF `open S`] + using `extreal x \ S` by auto qed lemma lim_real_of_extreal[simp]: @@ -1744,21 +1689,18 @@ obtain r where r[simp]: "m = extreal r" using m by (cases m) auto obtain p where p[simp]: "t = extreal p" using t by (cases t) auto have "r \ 0" "0 < r" and m': "m \ \" "m \ -\" "m \ 0" using m by auto - from `open S`[THEN extreal_openE] guess T l u . note T = this + from `open S`[THEN extreal_openE] guess l u . note T = this let ?f = "(\x. m * x + t)" show ?thesis unfolding open_extreal_def proof (intro conjI impI exI subsetI) - show "open ((\x. r*x + p)`T)" - using open_affinity[OF `open T` `r \ 0`] by (auto simp: ac_simps) - have affine_infy: "?f ` {\, - \} = {\, -\}" - using `r \ 0` by auto - have "extreal ` (\x. r * x + p) ` T = ?f ` (extreal ` T)" - by (simp add: image_image) - also have "\ = ?f ` (S - {\, -\})" - using T(2) by simp - also have "\ = ?f ` S - {\, -\}" - using extreal_inj_affinity[OF m' t] by (simp only: image_set_diff affine_infy) - finally show "extreal ` (\x. r * x + p) ` T = ?f ` S - {\, -\}" . + have "extreal -` ?f ` S = (\x. r * x + p) ` (extreal -` S)" + proof safe + fix x y assume "extreal y = m * x + t" "x \ S" + then show "y \ (\x. r * x + p) ` extreal -` S" + using `r \ 0` by (cases x) (auto intro!: image_eqI[of _ _ "real x"] split: split_if_asm) + qed force + then show "open (extreal -` ?f ` S)" + using open_affinity[OF T(1) `r \ 0`] by (auto simp: ac_simps) next assume "\ \ ?f`S" with `0 < r` have "\ \ S" by auto fix x assume "x \ {extreal (r * l + p)<..}" @@ -1769,7 +1711,7 @@ using m t by (cases rule: extreal3_cases[of m x t]) auto have "extreal l < (x - t)/m" using m t by (simp add: extreal_less_divide_pos extreal_less_minus) - then show "(x - t)/m \ S" using T(3)[OF `\ \ S`] by auto + then show "(x - t)/m \ S" using T(2)[OF `\ \ S`] by auto qed next assume "-\ \ ?f`S" with `0 < r` have "-\ \ S" by auto @@ -1781,7 +1723,7 @@ using m t by (cases rule: extreal3_cases[of m x t]) auto have "(x - t)/m < extreal u" using m t by (simp add: extreal_divide_less_pos extreal_minus_less) - then show "(x - t)/m \ S" using T(4)[OF `-\ \ S`] by auto + then show "(x - t)/m \ S" using T(3)[OF `-\ \ S`] by auto qed qed qed @@ -1864,12 +1806,9 @@ proof (rule topological_tendstoI, unfold eventually_sequentially) obtain rx where rx_def: "x=extreal rx" using assms by (cases x) auto fix S assume "open S" "x : S" - then obtain A where "open A" and A_eq: "extreal ` A = S - {\,(-\)}" - by (auto elim!: extreal_openE) - then have "x : extreal ` A" using `x : S` assms by auto - then have "rx : A" using rx_def by auto - then obtain r where "0 < r" and dist: "!!y. dist y (real x) < r ==> y : A" - using `open A` unfolding open_real_def rx_def by auto + then have "open (extreal -` S)" unfolding open_extreal_def by auto + with `x \ S` obtain r where "0 < r" and dist: "!!y. dist y rx < r ==> extreal y \ S" + unfolding open_real_def rx_def by auto then obtain n where upper: "!!N. n <= N ==> u N < x + extreal r" and lower: "!!N. n <= N ==> x < u N + extreal r" using assms(3)[of "extreal r"] by auto @@ -1881,13 +1820,11 @@ from this obtain ra where ra_def: "(u N) = extreal ra" by (cases "u N") auto hence "rx < ra + r" and "ra < rx + r" using rx_def assms `0 < r` lower[OF `n <= N`] upper[OF `n <= N`] by auto - hence "dist (real (u N)) (real x) < r" + hence "dist (real (u N)) rx < r" using rx_def ra_def by (auto simp: dist_real_def abs_diff_less_iff field_simps) - from dist[OF this] - have "u N : extreal ` A" using `u N ~: {\,(-\)}` + from dist[OF this] show "u N : S" using `u N ~: {\,(-\)}` by (auto intro!: image_eqI[of _ _ "real (u N)"] simp: extreal_real) - thus "u N : S" using A_eq by simp qed qed @@ -2933,21 +2870,6 @@ from this show ?thesis using continuous_imp_tendsto by auto qed - -lemma continuous_at_extreal: -fixes x0 :: real -shows "continuous (at x0) extreal" -proof- -{ fix T assume T_def: "open T & extreal x0 : T" - from this obtain S where S_def: "open S & extreal ` S = T - {\, (-\)}" - using extreal_openE[of T] by metis - moreover hence "x0 : S" using T_def by auto - moreover have "ALL y:S. extreal y : T" using S_def by auto - ultimately have "EX S. x0 : S & open S & (ALL y:S. extreal y : T)" by auto -} from this show ?thesis unfolding continuous_at_open by blast -qed - - lemma continuous_at_of_extreal: fixes x0 :: extreal assumes "x0 ~: {\, (-\)}" @@ -2995,9 +2917,6 @@ using continuous_at_iff_extreal assms by (auto simp add: continuous_on_eq_continuous_at) -lemma continuous_on_extreal: "continuous_on UNIV extreal" - using continuous_at_extreal continuous_on_eq_continuous_at by auto - lemma open_image_extreal: "open(UNIV-{\,(-\)})" by (metis range_extreal open_extreal open_UNIV)