# HG changeset patch # User hoelzl # Date 1300109862 -3600 # Node ID 3fdbc7d5b5259b0dd03716a7668572783d85e3dc # Parent d47eabd80e59b8ec4db5ad45a0614c39f4866798 use abs_extreal diff -r d47eabd80e59 -r 3fdbc7d5b525 src/HOL/Library/Extended_Reals.thy --- a/src/HOL/Library/Extended_Reals.thy Mon Mar 14 14:37:41 2011 +0100 +++ b/src/HOL/Library/Extended_Reals.thy Mon Mar 14 14:37:42 2011 +0100 @@ -27,6 +27,9 @@ instance .. end +lemma inj_extreal[simp]: "inj_on extreal A" + unfolding inj_on_def by auto + lemma MInfty_neq_PInfty[simp]: "\ \ - \" "- \ \ \" by simp_all @@ -88,6 +91,26 @@ instance proof qed end +instantiation extreal :: abs +begin + function abs_extreal where + "\extreal r\ = extreal \r\" + | "\-\\ = \" + | "\\\ = \" + by (auto intro: extreal_cases) + termination proof qed (rule wf_empty) + instance .. +end + +lemma abs_eq_infinity_cases[elim!]: "\ \x\ = \ ; x = \ \ P ; x = -\ \ P \ \ P" + by (cases x) auto + +lemma abs_neq_infinity_cases[elim!]: "\ \x\ \ \ ; \r. x = extreal r \ P \ \ P" + by (cases x) auto + +lemma abs_extreal_uminus[simp]: "\- x\ = \x::extreal\" + by (cases x) auto + subsubsection "Addition" instantiation extreal :: comm_monoid_add @@ -131,6 +154,9 @@ qed end +lemma abs_extreal_zero[simp]: "\0\ = (0::extreal)" + unfolding zero_extreal_def abs_extreal.simps by simp + lemma extreal_uminus_zero[simp]: "- 0 = (0::extreal)" by (simp add: zero_extreal_def) @@ -159,7 +185,7 @@ using assms by (cases rule: extreal3_cases[of a b c]) auto lemma extreal_real: - "extreal (real x) = (if x = \ \ x = -\ then 0 else x)" + "extreal (real x) = (if \x\ = \ then 0 else x)" by (cases x) simp_all subsubsection "Linear order on @{typ extreal}" @@ -258,19 +284,19 @@ by (cases rule: extreal2_cases[of a b]) auto lemma extreal_le_real_iff: - "x \ real y \ ((y \ -\ \ y \ \ \ extreal x \ y) \ (y = -\ \ y = \ \ x \ 0))" + "x \ real y \ ((\y\ \ \ \ extreal x \ y) \ (\y\ = \ \ x \ 0))" by (cases y) auto lemma real_le_extreal_iff: - "real y \ x \ ((y \ -\ \ y \ \ \ y \ extreal x) \ (y = -\ \ y = \ \ 0 \ x))" + "real y \ x \ ((\y\ \ \ \ y \ extreal x) \ (\y\ = \ \ 0 \ x))" by (cases y) auto lemma extreal_less_real_iff: - "x < real y \ ((y \ -\ \ y \ \ \ extreal x < y) \ (y = -\ \ y = \ \ x < 0))" + "x < real y \ ((\y\ \ \ \ extreal x < y) \ (\y\ = \ \ x < 0))" by (cases y) auto lemma real_less_extreal_iff: - "real y < x \ ((y \ -\ \ y \ \ \ y < extreal x) \ (y = -\ \ y = \ \ 0 < x))" + "real y < x \ ((\y\ \ \ \ y < extreal x) \ (\y\ = \ \ 0 < x))" by (cases y) auto lemmas real_of_extreal_ord_simps = @@ -310,11 +336,18 @@ subsubsection "Multiplication" -instantiation extreal :: comm_monoid_mult +instantiation extreal :: "{comm_monoid_mult, sgn}" begin definition "1 = extreal 1" +function sgn_extreal where + "sgn (extreal r) = extreal (sgn r)" +| "sgn \ = 1" +| "sgn (-\) = -1" +by (auto intro: extreal_cases) +termination proof qed (rule wf_empty) + function times_extreal where "extreal r * extreal p = extreal (r * p)" | "extreal r * \ = (if r = 0 then 0 else if r > 0 then \ else -\)" | @@ -344,6 +377,9 @@ qed end +lemma abs_extreal_one[simp]: "\1\ = (1::extreal)" + unfolding one_extreal_def by simp + lemma extreal_mult_zero[simp]: fixes a :: extreal shows "a * 0 = 0" by (cases a) (simp_all add: zero_extreal_def) @@ -470,13 +506,13 @@ by (simp_all add: minus_extreal_def) lemma extreal_x_minus_x[simp]: - "x - x = (if x = -\ \ x = \ then \ else 0)" + "x - x = (if \x\ = \ then \ else 0)" by (cases x) simp_all lemma extreal_eq_minus_iff: fixes x y z :: extreal shows "x = z - y \ - (y \ \ \ y \ -\ \ x + y = z) \ + (\y\ \ \ \ x + y = z) \ (y = -\ \ x = \) \ (y = \ \ z = \ \ x = \) \ (y = \ \ z \ \ \ x = -\)" @@ -484,33 +520,33 @@ lemma extreal_eq_minus: fixes x y z :: extreal - shows "y \ \ \ y \ -\ \ x = z - y \ x + y = z" - by (simp add: extreal_eq_minus_iff) + shows "\y\ \ \ \ x = z - y \ x + y = z" + by (auto simp: extreal_eq_minus_iff) lemma extreal_less_minus_iff: fixes x y z :: extreal shows "x < z - y \ (y = \ \ z = \ \ x \ \) \ (y = -\ \ x \ \) \ - (y \ \ \ y \ -\ \ x + y < z)" + (\y\ \ \\ x + y < z)" by (cases rule: extreal3_cases[of x y z]) auto lemma extreal_less_minus: fixes x y z :: extreal - shows "y \ \ \ y \ -\ \ x < z - y \ x + y < z" - by (simp add: extreal_less_minus_iff) + shows "\y\ \ \ \ x < z - y \ x + y < z" + by (auto simp: extreal_less_minus_iff) lemma extreal_le_minus_iff: fixes x y z :: extreal shows "x \ z - y \ (y = \ \ z \ \ \ x = -\) \ - (y \ \ \ y \ -\ \ x + y \ z)" + (\y\ \ \ \ x + y \ z)" by (cases rule: extreal3_cases[of x y z]) auto lemma extreal_le_minus: fixes x y z :: extreal - shows "y \ \ \ y \ -\ \ x \ z - y \ x + y \ z" - by (simp add: extreal_le_minus_iff) + shows "\y\ \ \ \ x \ z - y \ x + y \ z" + by (auto simp: extreal_le_minus_iff) lemma extreal_minus_less_iff: fixes x y z :: extreal @@ -521,21 +557,21 @@ lemma extreal_minus_less: fixes x y z :: extreal - shows "y \ \ \ y \ -\ \ x - y < z \ x < z + y" - by (simp add: extreal_minus_less_iff) + shows "\y\ \ \ \ x - y < z \ x < z + y" + by (auto simp: extreal_minus_less_iff) lemma extreal_minus_le_iff: fixes x y z :: extreal shows "x - y \ z \ (y = -\ \ z = \) \ (y = \ \ x = \ \ z = \) \ - (y \ \ \ y \ -\ \ x \ z + y)" + (\y\ \ \ \ x \ z + y)" by (cases rule: extreal3_cases[of x y z]) auto lemma extreal_minus_le: fixes x y z :: extreal - shows "y \ \ \ y \ -\ \ x - y \ z \ x \ z + y" - by (simp add: extreal_minus_le_iff) + shows "\y\ \ \ \ x - y \ z \ x \ z + y" + by (auto simp: extreal_minus_le_iff) lemma extreal_minus_eq_minus_iff: fixes a b c :: extreal @@ -549,20 +585,19 @@ by (cases rule: extreal3_cases[of a b c]) (simp_all add: field_simps) lemma extreal_mult_le_mult_iff: - "c \ \ \ c \ -\ \ c * a \ c * b \ - (0 < c \ a \ b) \ (c < 0 \ b \ a)" + "\c\ \ \ \ c * a \ c * b \ (0 < c \ a \ b) \ (c < 0 \ b \ a)" by (cases rule: extreal3_cases[of a b c]) (simp_all add: mult_le_cancel_left) lemma extreal_between: fixes x e :: extreal - assumes "x \ \" "x \ -\" "0 < e" + assumes "\x\ \ \" "0 < e" shows "x - e < x" "x < x + e" using assms apply (cases x, cases e) apply auto using assms by (cases x, cases e) auto lemma extreal_distrib: fixes a b c :: extreal - assumes "a \ \ \ b \ -\" "a \ -\ \ b \ \" "c \ \" "c \ -\" + assumes "a \ \ \ b \ -\" "a \ -\ \ b \ \" "\c\ \ \" shows "(a + b) * c = a * c + b * c" using assms by (cases rule: extreal3_cases[of a b c]) (simp_all add: field_simps) @@ -594,7 +629,7 @@ unfolding divide_extreal_def by (auto simp: divide_real_def) lemma extreal_divide_same[simp]: - "x / x = (if x = \ \ x = -\ \ x = 0 then 0 else 1)" + "x / x = (if \x\ = \ \ x = 0 then 0 else 1)" by (cases x) (simp_all add: divide_real_def divide_extreal_def one_extreal_def) @@ -711,7 +746,7 @@ instantiation extreal :: complete_lattice begin -definition "bot = (-\)" +definition "bot = -\" definition "top = \" definition "Sup S = (LEAST z. ALL x:S. x <= z :: extreal)" @@ -941,19 +976,16 @@ lemma Sup_extreal_close: fixes e :: extreal - assumes "0 < e" and S: "Sup S \ \" "Sup S \ -\" "S \ {}" + assumes "0 < e" and S: "\Sup S\ \ \" "S \ {}" shows "\x\S. Sup S - e < x" -proof (rule less_Sup_iff[THEN iffD1]) - show "Sup S - e < Sup S " using assms - by (cases "Sup S", cases e) auto -qed + using assms by (cases e) (auto intro!: less_Sup_iff[THEN iffD1]) lemma Inf_extreal_close: - fixes e :: extreal assumes "Inf X \ \" "Inf X \ -\" "0 < e" + fixes e :: extreal assumes "\Inf X\ \ \" "0 < e" shows "\x\X. x < Inf X + e" proof (rule Inf_less_iff[THEN iffD1]) show "Inf X < Inf X + e" using assms - by (cases "Inf X", cases e) auto + by (cases e) auto qed lemma (in complete_lattice) top_le: @@ -1134,6 +1166,12 @@ qed end +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 + lemma continuous_on_extreal[intro, simp]: "continuous_on A extreal" unfolding continuous_on_topological open_extreal_def by auto @@ -1184,25 +1222,24 @@ by (metis atLeastAtMost_singleton closed_extreal_atLeastAtMost) lemma extreal_open_cont_interval: - assumes "open S" "x \ S" and "x \ \" "x \ - \" + assumes "open S" "x \ S" "\x\ \ \" 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 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 + then obtain e where "0 < e" and e: "ball (real x) e \ extreal -` S" + using assms unfolding open_contains_ball 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) + with assms obtain t where "y = extreal t" "t \ ball (real x) e" + 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: - assumes "open S" "x \ S" and x: "x \ \" "x \ -\" + assumes "open S" "x \ S" and x: "\x\ \ \" obtains a b where "a < x" "x < b" "{a <..< b} \ S" proof- guess e using extreal_open_cont_interval[OF assms] . @@ -1264,26 +1301,28 @@ using extreal_open_uminus[of "- S"] extreal_uminus_complement by auto lemma not_open_extreal_singleton: - "~(open {a :: extreal})" + "\ (open {a :: extreal})" proof(rule ccontr) - assume "~ ~ open {a}" hence a: "open {a}" by auto - { assume "a=(-\)" + assume "\ \ open {a}" hence a: "open {a}" by auto + show False + proof (cases a) + case MInf then obtain y where "{..)` by auto - } moreover - { assume "a=\" + then show False using `a=(-\)` by auto + next + case PInf then obtain y where "{extreal y<..} <= {a}" using a open_PInfty2[of "{a}"] by auto hence "extreal(y+1):{a}" apply (subst subsetD[of "{extreal y<..}"]) by auto - hence False using `a=\` by auto - } moreover - { assume fin: "a~=(-\)" "a~=\" - from extreal_open_cont_interval[OF a singletonI this(2,1)] guess e . note e = this + then show False using `a=\` by auto + next + case (real r) then have fin: "\a\ \ \" by simp + from extreal_open_cont_interval[OF a singletonI this] guess e . note e = this then obtain b where b_def: "a)" hence "(-\) : - S" using a by auto - then obtain y where "{.." hence "S={\}" by (metis Inf_eq_PInfty assms(2)) - hence False by (metis `Inf S ~: S` insert_code mem_def pinf) -} moreover -{ assume fin: "Inf S ~= \" "Inf S ~= (-\)" - from extreal_open_cont_interval[OF a this] guess e . note e = this - { fix x assume "x:S" hence "x>=Inf S" by (rule complete_lattice_class.Inf_lower) - hence *: "x>Inf S-e" using e by (metis fin extreal_between(1) order_less_le_trans) - { assume "x=Inf S+e" by (metis linorder_le_less_linear) - } hence "Inf S + e <= Inf S" by (metis le_Inf_iff) - hence False by (metis calculation(1) calculation(2) e extreal_between(2) leD) -} ultimately show False by auto + assume "Inf S \ S" hence a: "open (-S)" "Inf S:(- S)" using assms by auto + show False + proof (cases "Inf S") + case MInf hence "(-\) : - S" using a by auto + then obtain y where "{..}" by (metis Inf_eq_PInfty assms(2)) + then show False by (metis `Inf S ~: S` insert_code mem_def PInf) + next + case (real r) then have fin: "\Inf S\ \ \" by simp + from extreal_open_cont_interval[OF a this] guess e . note e = this + { fix x assume "x:S" hence "x>=Inf S" by (rule complete_lattice_class.Inf_lower) + hence *: "x>Inf S-e" using e by (metis fin extreal_between(1) order_less_le_trans) + { assume "x=Inf S+e" by (metis linorder_le_less_linear) + } hence "Inf S + e <= Inf S" by (metis le_Inf_iff) + then show False using real e by (cases e) auto + qed qed lemma extreal_closed_contains_Sup: @@ -1337,7 +1378,7 @@ { assume "Inf S=\" hence "S={\}" by (metis Inf_eq_PInfty `S ~= {}`) hence False by (metis assms(1) not_open_extreal_singleton) } moreover - { assume fin: "~(Inf S=\)" "~(Inf S=(-\))" + { assume fin: "\Inf S\ \ \" from extreal_open_cont_interval[OF assms(1) * fin] guess e . note e = this then obtain b where b_def: "Inf S-e 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 lim_extreal[simp]: @@ -1643,7 +1675,7 @@ lemma tendsto_extreal_realI: fixes f :: "'a \ extreal" - assumes x: "x \ \" "x \ -\" and tendsto: "(f ---> x) net" + assumes x: "\x\ \ \" and tendsto: "(f ---> x) net" shows "((\x. extreal (real (f x))) ---> x) net" proof (intro topological_tendstoI) fix S assume "open S" "x \ S" @@ -1655,12 +1687,12 @@ lemma extreal_mult_cancel_left: fixes a b c :: extreal shows "a * b = a * c \ - (((a = \ \ a = -\) \ 0 < b * c) \ a = 0 \ b = c)" + ((\a\ = \ \ 0 < b * c) \ a = 0 \ b = c)" by (cases rule: extreal3_cases[of a b c]) (simp_all add: zero_less_mult_iff) lemma extreal_inj_affinity: - assumes "m \ \" "m \ -\" "m \ 0" "t \ \" "t \ -\" + assumes "\m\ \ \" "m \ 0" "\t\ \ \" shows "inj_on (\x. m * x + t) A" using assms by (cases rule: extreal2_cases[of m t]) @@ -1683,11 +1715,11 @@ by (cases rule: extreal3_cases[of x y z]) (auto simp: field_simps) lemma extreal_open_affinity_pos: - assumes "open S" and m: "m \ \" "0 < m" and t: "t \ \" "t \ -\" + assumes "open S" and m: "m \ \" "0 < m" and t: "\t\ \ \" shows "open ((\x. m * x + t) ` S)" proof - 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 + obtain p where p[simp]: "t = extreal p" using t by auto have "r \ 0" "0 < r" and m': "m \ \" "m \ -\" "m \ 0" using m by auto from `open S`[THEN extreal_openE] guess l u . note T = this let ?f = "(\x. m * x + t)" @@ -1729,22 +1761,22 @@ qed lemma extreal_open_affinity: - assumes "open S" and m: "m \ \" "m \ -\" "m \ 0" and t: "t \ \" "t \ -\" + assumes "open S" and m: "\m\ \ \" "m \ 0" and t: "\t\ \ \" shows "open ((\x. m * x + t) ` S)" proof cases assume "0 < m" then show ?thesis - using extreal_open_affinity_pos[OF `open S` `m \ \` _ t] by auto + using extreal_open_affinity_pos[OF `open S` _ _ t, of m] m by auto next assume "\ 0 < m" then have "0 < -m" using `m \ 0` by (cases m) auto - then have m: "-m \ \" "0 < -m" using `m \ -\` - by (simp_all add: extreal_uminus_eq_reorder) + then have m: "-m \ \" "0 < -m" using `\m\ \ \` + by (auto simp: extreal_uminus_eq_reorder) from extreal_open_affinity_pos[OF extreal_open_uminus[OF `open S`] m t] show ?thesis unfolding image_image by simp qed lemma extreal_divide_eq: - "b \ 0 \ b \ \ \ b \ -\ \ a / b = c \ a = b * c" + "b \ 0 \ \b\ \ \ \ a / b = c \ a = b * c" by (cases rule: extreal3_cases[of a b c]) (simp_all add: field_simps) @@ -1753,7 +1785,7 @@ lemma extreal_lim_mult: fixes X :: "'a \ extreal" - assumes lim: "(X ---> L) net" and a: "a \ \" "a \ -\" + assumes lim: "(X ---> L) net" and a: "\a\ \ \" shows "((\i. a * X i) ---> a * L) net" proof cases assume "a \ 0" @@ -1766,7 +1798,7 @@ using `a * L \ S` by (force simp: image_iff) moreover have "open ((\x. x / a) ` S)" using extreal_open_affinity[OF `open S`, of "inverse a" 0] `a \ 0` a - by (simp add: extreal_divide_eq extreal_inverse_eq_0 divide_extreal_def ac_simps) + by (auto simp: extreal_divide_eq extreal_inverse_eq_0 divide_extreal_def ac_simps) note * = lim[THEN topological_tendstoD, OF this L] { fix x from a `a \ 0` have "a * (x / a) = x" by (cases rule: extreal2_cases[of a x]) auto } @@ -1800,7 +1832,7 @@ lemma extreal_LimI_finite: - assumes "x ~= \" "x ~= (-\)" + assumes "\x\ \ \" assumes "!!r. 0 < r ==> EX N. ALL n>=N. u n < x + r & x < u n + r" shows "u ----> x" proof (rule topological_tendstoI, unfold eventually_sequentially) @@ -1811,7 +1843,7 @@ 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 + lower: "!!N. n <= N ==> x < u N + extreal r" using assms(2)[of "extreal r"] by auto show "EX N. ALL n>=N. u n : S" proof (safe intro!: exI[of _ n]) fix N assume "n <= N" @@ -1823,25 +1855,27 @@ 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] show "u N : S" using `u N ~: {\,(-\)}` - by (auto intro!: image_eqI[of _ _ "real (u N)"] simp: extreal_real) + from dist[OF this] show "u N : S" using `u N ~: {\, -\}` + by (auto simp: extreal_real split: split_if_asm) qed qed lemma extreal_LimI_finite_iff: - assumes "x ~= \" "x ~= (-\)" + assumes "\x\ \ \" shows "u ----> x <-> (ALL r. 0 < r --> (EX N. ALL n>=N. u n < x + r & x < u n + r))" (is "?lhs <-> ?rhs") -proof- -{ assume lim: "u ----> x" +proof + assume lim: "u ----> x" { fix r assume "(r::extreal)>0" from this obtain N where N_def: "ALL n>=N. u n : {x - r <..< x + r}" apply (subst tendsto_obtains_N[of u x "{x - r <..< x + r}"]) using lim extreal_between[of x r] assms `r>0` by auto hence "EX N. ALL n>=N. u n < x + r & x < u n + r" using extreal_minus_less[of r x] by (cases r) auto - } hence "?rhs" by auto -} from this show ?thesis using extreal_LimI_finite assms by blast + } then show "?rhs" by auto +next + assume ?rhs then show "u ----> x" + using extreal_LimI_finite[of x] assms by auto qed @@ -2406,10 +2440,8 @@ using assms by auto qed - -lemma extreal_real': assumes "x~=\" and "x~=(-\)" shows "extreal (real x) = x" - using assms extreal_real by auto - +lemma extreal_real': assumes "\x\ \ \" shows "extreal (real x) = x" + using assms by auto lemma lim_extreal_increasing: assumes "\n m. n >= m \ f n >= f m" obtains l where "f ----> (l::extreal)" @@ -2432,7 +2464,7 @@ hence "ALL n. Y n < extreal B" using Y_def by auto note B = this[rule_format] { fix n have "Y n < \" using B[of n] apply (subst less_le_trans) by auto hence "Y n ~= \ & Y n ~= (-\)" using minfy by auto - } hence *: "ALL n. Y n ~= \ & Y n ~= (-\)" by auto + } hence *: "ALL n. \Y n\ \ \" by auto { fix n have "real (Y n) < B" proof- case goal1 thus ?case using B[of n] apply-apply(subst(asm) extreal_real'[THEN sym]) defer defer unfolding extreal_less using * by auto @@ -2455,7 +2487,6 @@ qed qed - lemma lim_extreal_decreasing: assumes "\n m. n >= m \ f n <= f m" obtains l where "f ----> (l::extreal)" proof - @@ -2491,51 +2522,52 @@ lemma incseq_le_extreal: assumes inc: "!!n m. n>=m ==> X n >= X m" and lim: "X ----> (L::extreal)" shows "X N <= L" proof(cases "X N = (-\)") -case True thus ?thesis by auto + case True thus ?thesis by auto next -case False - have "ALL n>=N. X n >= X N" using inc by auto - hence minf: "ALL n>=N. X n > (-\)" using False by auto - def Y == "(%n. (if n>=N then X n else X N))" - hence incy: "!!n m. n>=m ==> Y n >= Y m" using inc by auto - from minf have minfy: "ALL n. Y n ~= (-\)" using Y_def by auto - from lim have limy: "Y ----> L" - apply (subst tail_same_limit[of X _ N]) using Y_def by auto -show ?thesis -proof(cases "L = \ | L=(-\)") - case False have "ALL n. Y n ~= \" - proof(rule ccontr,unfold not_all not_not,safe) - case goal1 hence "ALL n>=x. Y n = \" using incy[of x] by auto - hence "Y ----> \" unfolding tendsto_def eventually_sequentially - apply safe apply(rule_tac x=x in exI) by auto - note Lim_unique[OF trivial_limit_sequentially this limy] - with False show False by auto - qed note * =this[rule_format] - - have **:"ALL m n. m <= n --> extreal (real (Y m)) <= extreal (real (Y n))" - unfolding extreal_real using minfy * incy apply (cases "Y m", cases "Y n") by auto - have "real (Y N) <= real L" apply-apply(rule incseq_le) defer - apply(subst lim_extreal[THEN sym]) - unfolding extreal_real - unfolding incseq_def using minfy * ** limy False by auto - hence "extreal (real (Y N)) <= extreal (real L)" by auto - hence ***: "Y N <= L" unfolding extreal_real using minfy * False by auto - thus ?thesis using Y_def by auto -next -case True -show ?thesis proof(cases "L=(-\)") - case True - have "open {..) : {..=N1. X n : {..=N. X n >= X N" using inc by auto + hence minf: "ALL n>=N. X n > (-\)" using False by auto + def Y == "(%n. (if n>=N then X n else X N))" + hence incy: "!!n m. n>=m ==> Y n >= Y m" using inc by auto + from minf have minfy: "ALL n. Y n ~= (-\)" using Y_def by auto + from lim have limy: "Y ----> L" + apply (subst tail_same_limit[of X _ N]) using Y_def by auto + show ?thesis + proof (cases "\L\ = \") + case False have "ALL n. Y n ~= \" + proof(rule ccontr,unfold not_all not_not,safe) + case goal1 hence "ALL n>=x. Y n = \" using incy[of x] by auto + hence "Y ----> \" unfolding tendsto_def eventually_sequentially + apply safe apply(rule_tac x=x in exI) by auto + note Lim_unique[OF trivial_limit_sequentially this limy] + with False show False by auto + qed + with minfy have *: "\n. \Y n\ \ \" by auto + + have **:"ALL m n. m <= n --> extreal (real (Y m)) <= extreal (real (Y n))" + unfolding extreal_real using minfy * incy apply (cases "Y m", cases "Y n") by auto + have "real (Y N) <= real L" apply-apply(rule incseq_le) defer + apply(subst lim_extreal[THEN sym]) + unfolding extreal_real + unfolding incseq_def using * ** limy False by auto + hence "extreal (real (Y N)) <= extreal (real L)" by auto + hence ***: "Y N <= L" unfolding extreal_real using * False by auto + thus ?thesis using Y_def by auto + next + case True + show ?thesis + proof(cases "L=(-\)") + case True + have "open {..) : {..=N1. X n : {..=m ==> X n <= X m" and lim: "X ----> (L::extreal)" shows "X N >= L" @@ -2561,21 +2593,19 @@ using assms by auto next fix y assume y:"ALL x:range f. x <= y" show "l <= y" proof- - { assume ym: "y ~= (-\)" and yp: "y ~= \" + { assume yinf: "\y\ \ \" { assume as:"y < l" - hence lm: "l ~= (-\)" by auto - have lp:"l ~= \" apply(rule Lim_bounded_PInfty[OF assms(2), of "real y"]) - using y yp unfolding extreal_real by auto + hence linf: "\l\ \ \" + using Lim_bounded_PInfty[OF assms(2), of "real y"] y yinf by auto have [simp]: "extreal (1 / 2) = 1 / 2" by (auto simp: divide_extreal_def) - have yl:"real y < real l" using as apply- - apply(subst(asm) extreal_real'[THEN sym,OF `y~=\` `y~=(-\)`]) - apply(subst(asm) extreal_real'[THEN sym,OF `l~=\` `l~=(-\)`]) - unfolding extreal_less by auto + have yl:"real y < real l" using as + apply(subst(asm) extreal_real'[THEN sym,OF yinf]) + apply(subst(asm) extreal_real'[THEN sym,OF linf]) by auto hence "y + (l - y) * 1 / 2 < l" apply- - apply(subst extreal_real'[THEN sym,OF `y~=\` `y~=(-\)`]) - apply(subst(2) extreal_real'[THEN sym,OF `y~=\` `y~=(-\)`]) - apply(subst extreal_real'[THEN sym,OF `l~=\` `l~=(-\)`]) - apply(subst(2) extreal_real'[THEN sym,OF `l~=\` `l~=(-\)`]) + apply(subst extreal_real'[THEN sym,OF yinf]) + apply(subst(2) extreal_real'[THEN sym,OF yinf]) + apply(subst extreal_real'[THEN sym,OF linf]) + apply(subst(2) extreal_real'[THEN sym,OF linf]) using real_interm by auto hence *:"l : {y + (l - y) / 2<..}" by auto have "open {y + (l-y)/2 <..}" by auto @@ -2583,7 +2613,7 @@ from this[unfolded eventually_sequentially] guess N .. note this[rule_format, of N] hence "y + (l - y) / 2 < y" using y[rule_format,of "f N"] by auto hence "extreal (real y) + (extreal (real l) - extreal (real y)) / 2 < extreal (real y)" - unfolding extreal_real using `y~=\` `y~=(-\)` `l~=\` `l~=(-\)` by auto + unfolding extreal_real using yinf linf by auto hence False using yl by auto } hence ?thesis using not_le by auto } @@ -2871,9 +2901,9 @@ qed lemma continuous_at_of_extreal: -fixes x0 :: extreal -assumes "x0 ~: {\, (-\)}" -shows "continuous (at x0) real" + fixes x0 :: extreal + assumes "\x0\ \ \" + shows "continuous (at x0) real" proof- { fix T assume T_def: "open T & real x0 : T" def S == "extreal ` T" @@ -2925,13 +2955,13 @@ lemma continuous_on_iff_real: -fixes f :: "'a::t2_space => extreal" -assumes "ALL x. x:A --> (f x ~: {\,(-\)})" -shows "continuous_on A f <-> continuous_on A (real o f)" + fixes f :: "'a::t2_space => extreal" + assumes "\x. x \ A \ \f x\ \ \" + shows "continuous_on A f \ continuous_on A (real \ f)" proof- -have "f ` A <= UNIV-{\,(-\)}" using assms by auto -hence *: "continuous_on (f ` A) real" - using continuous_on_real by (simp add: continuous_on_subset) + have "f ` A <= UNIV-{\,(-\)}" using assms by force + hence *: "continuous_on (f ` A) real" + using continuous_on_real by (simp add: continuous_on_subset) have **: "continuous_on ((real o f) ` A) extreal" using continuous_on_extreal continuous_on_subset[of "UNIV" "extreal" "(real o f) ` A"] by blast { assume "continuous_on A f" hence "continuous_on A (real o f)"