# HG changeset patch # User hoelzl # Date 1422371560 -3600 # Node ID 2538b2c51769f9e40c424644233f8f8c5cb6eac3 # Parent 86be42bb5174e0c00de98329419d4678dd55fed7 ereal: tuned proofs concerning continuity and suprema diff -r 86be42bb5174 -r 2538b2c51769 src/HOL/Conditionally_Complete_Lattices.thy --- a/src/HOL/Conditionally_Complete_Lattices.thy Mon Jan 26 14:40:13 2015 +0100 +++ b/src/HOL/Conditionally_Complete_Lattices.thy Tue Jan 27 16:12:40 2015 +0100 @@ -102,15 +102,25 @@ lemma (in order_bot) bdd_above_bot[simp, intro!]: "bdd_below A" by (rule bdd_belowI[of _ bot]) simp -lemma bdd_above_uminus[simp]: - fixes X :: "'a::ordered_ab_group_add set" - shows "bdd_above (uminus ` X) \ bdd_below X" - by (auto simp: bdd_above_def bdd_below_def intro: le_imp_neg_le) (metis le_imp_neg_le minus_minus) +lemma bdd_above_image_mono: "mono f \ bdd_above A \ bdd_above (f`A)" + by (auto simp: bdd_above_def mono_def) + +lemma bdd_below_image_mono: "mono f \ bdd_below A \ bdd_below (f`A)" + by (auto simp: bdd_below_def mono_def) + +lemma bdd_above_image_antimono: "antimono f \ bdd_below A \ bdd_above (f`A)" + by (auto simp: bdd_above_def bdd_below_def antimono_def) -lemma bdd_below_uminus[simp]: +lemma bdd_below_image_antimono: "antimono f \ bdd_above A \ bdd_below (f`A)" + by (auto simp: bdd_above_def bdd_below_def antimono_def) + +lemma fixes X :: "'a::ordered_ab_group_add set" - shows"bdd_below (uminus ` X) \ bdd_above X" - by (auto simp: bdd_above_def bdd_below_def intro: le_imp_neg_le) (metis le_imp_neg_le minus_minus) + shows bdd_above_uminus[simp]: "bdd_above (uminus ` X) \ bdd_below X" + and bdd_below_uminus[simp]: "bdd_below (uminus ` X) \ bdd_above X" + using bdd_above_image_antimono[of uminus X] bdd_below_image_antimono[of uminus "uminus`X"] + using bdd_below_image_antimono[of uminus X] bdd_above_image_antimono[of uminus "uminus`X"] + by (auto simp: antimono_def image_image) context lattice begin diff -r 86be42bb5174 -r 2538b2c51769 src/HOL/Library/Extended_Real.thy --- a/src/HOL/Library/Extended_Real.thy Mon Jan 26 14:40:13 2015 +0100 +++ b/src/HOL/Library/Extended_Real.thy Tue Jan 27 16:12:40 2015 +0100 @@ -568,6 +568,9 @@ lemma ereal_uminus_less_reorder: "- a < b \ -b < (a::ereal)" by (subst (3) ereal_uminus_uminus[symmetric]) (simp only: ereal_minus_less_minus) +lemma ereal_less_uminus_reorder: "a < - b \ b < - (a::ereal)" + by (subst (3) ereal_uminus_uminus[symmetric]) (simp only: ereal_minus_less_minus) + lemma ereal_uminus_le_reorder: "- a \ b \ -b \ (a::ereal)" by (subst (3) ereal_uminus_uminus[symmetric]) (simp only: ereal_minus_le_minus) @@ -1605,39 +1608,142 @@ show "\a b::ereal. a \ b" using zero_neq_one by blast qed +subsubsection "Topological space" + +instantiation ereal :: linear_continuum_topology +begin + +definition "open_ereal" :: "ereal set \ bool" where + open_ereal_generated: "open_ereal = generate_topology (range lessThan \ range greaterThan)" + +instance + by default (simp add: open_ereal_generated) + +end + +lemma tendsto_ereal[tendsto_intros, simp, intro]: "(f ---> x) F \ ((\x. ereal (f x)) ---> ereal x) F" + apply (rule tendsto_compose[where g=ereal]) + apply (auto intro!: order_tendstoI simp: eventually_at_topological) + apply (rule_tac x="case a of MInfty \ UNIV | ereal x \ {x <..} | PInfty \ {}" in exI) + apply (auto split: ereal.split) [] + apply (rule_tac x="case a of MInfty \ {} | ereal x \ {..< x} | PInfty \ UNIV" in exI) + apply (auto split: ereal.split) [] + done + +lemma tendsto_uminus_ereal[tendsto_intros, simp, intro]: "(f ---> x) F \ ((\x. - f x::ereal) ---> - x) F" + apply (rule tendsto_compose[where g=uminus]) + apply (auto intro!: order_tendstoI simp: eventually_at_topological) + apply (rule_tac x="{..< -a}" in exI) + apply (auto split: ereal.split simp: ereal_less_uminus_reorder) [] + apply (rule_tac x="{- a <..}" in exI) + apply (auto split: ereal.split simp: ereal_uminus_reorder) [] + done + +lemma ereal_Lim_uminus: "(f ---> f0) net \ ((\x. - f x::ereal) ---> - f0) net" + using tendsto_uminus_ereal[of f f0 net] tendsto_uminus_ereal[of "\x. - f x" "- f0" net] + by auto + +lemma ereal_divide_less_iff: "0 < (c::ereal) \ c < \ \ a / c < b \ a < b * c" + by (cases a b c rule: ereal3_cases) (auto simp: field_simps) + +lemma ereal_less_divide_iff: "0 < (c::ereal) \ c < \ \ a < b / c \ a * c < b" + by (cases a b c rule: ereal3_cases) (auto simp: field_simps) + +lemma tendsto_cmult_ereal[tendsto_intros, simp, intro]: + assumes c: "\c\ \ \" and f: "(f ---> x) F" shows "((\x. c * f x::ereal) ---> c * x) F" +proof - + { fix c :: ereal assume "0 < c" "c < \" + then have "((\x. c * f x::ereal) ---> c * x) F" + apply (intro tendsto_compose[OF _ f]) + apply (auto intro!: order_tendstoI simp: eventually_at_topological) + apply (rule_tac x="{a/c <..}" in exI) + apply (auto split: ereal.split simp: ereal_divide_less_iff mult.commute) [] + apply (rule_tac x="{..< a/c}" in exI) + apply (auto split: ereal.split simp: ereal_less_divide_iff mult.commute) [] + done } + note * = this + + have "((0 < c \ c < \) \ (-\ < c \ c < 0) \ c = 0)" + using c by (cases c) auto + then show ?thesis + proof (elim disjE conjE) + assume "- \ < c" "c < 0" + then have "0 < - c" "- c < \" + by (auto simp: ereal_uminus_reorder ereal_less_uminus_reorder[of 0]) + then have "((\x. (- c) * f x) ---> (- c) * x) F" + by (rule *) + from tendsto_uminus_ereal[OF this] show ?thesis + by simp + qed (auto intro!: *) +qed + +lemma tendsto_cmult_ereal_not_0[tendsto_intros, simp, intro]: + assumes "x \ 0" and f: "(f ---> x) F" shows "((\x. c * f x::ereal) ---> c * x) F" +proof cases + assume "\c\ = \" + show ?thesis + proof (rule filterlim_cong[THEN iffD1, OF refl refl _ tendsto_const]) + have "0 < x \ x < 0" + using `x \ 0` by (auto simp add: neq_iff) + then show "eventually (\x'. c * x = c * f x') F" + proof + assume "0 < x" from order_tendstoD(1)[OF f this] show ?thesis + by eventually_elim (insert `0c\ = \`, auto) + next + assume "x < 0" from order_tendstoD(2)[OF f this] show ?thesis + by eventually_elim (insert `x<0` `\c\ = \`, auto) + qed + qed +qed (rule tendsto_cmult_ereal[OF _ f]) + +lemma tendsto_cadd_ereal[tendsto_intros, simp, intro]: + assumes c: "y \ - \" "x \ - \" and f: "(f ---> x) F" shows "((\x. f x + y::ereal) ---> x + y) F" + apply (intro tendsto_compose[OF _ f]) + apply (auto intro!: order_tendstoI simp: eventually_at_topological) + apply (rule_tac x="{a - y <..}" in exI) + apply (auto split: ereal.split simp: ereal_minus_less_iff c) [] + apply (rule_tac x="{..< a - y}" in exI) + apply (auto split: ereal.split simp: ereal_less_minus_iff c) [] + done + +lemma tendsto_add_left_ereal[tendsto_intros, simp, intro]: + assumes c: "\y\ \ \" and f: "(f ---> x) F" shows "((\x. f x + y::ereal) ---> x + y) F" + apply (intro tendsto_compose[OF _ f]) + apply (auto intro!: order_tendstoI simp: eventually_at_topological) + apply (rule_tac x="{a - y <..}" in exI) + apply (insert c, auto split: ereal.split simp: ereal_minus_less_iff) [] + apply (rule_tac x="{..< a - y}" in exI) + apply (auto split: ereal.split simp: ereal_less_minus_iff c) [] + done + +lemma continuous_at_ereal[continuous_intros]: "continuous F f \ continuous F (\x. ereal (f x))" + unfolding continuous_def by auto + +lemma continuous_on_ereal[continuous_intros]: "continuous_on s f \ continuous_on s (\x. ereal (f x))" + unfolding continuous_on_def by auto lemma ereal_Sup: assumes *: "\SUP a:A. ereal a\ \ \" shows "ereal (Sup A) = (SUP a:A. ereal a)" -proof (rule antisym) +proof (rule continuous_at_Sup_mono) obtain r where r: "ereal r = (SUP a:A. ereal a)" "A \ {}" using * by (force simp: bot_ereal_def) - then have upper: "\a. a \ A \ a \ r" - by (auto intro!: SUP_upper simp add: ereal_less_eq(3)[symmetric] simp del: ereal_less_eq) - - show "ereal (Sup A) \ (SUP a:A. ereal a)" - using upper by (simp add: r[symmetric] cSup_least[OF `A \ {}`]) - show "(SUP a:A. ereal a) \ ereal (Sup A)" - using upper `A \ {}` by (intro SUP_least) (auto intro!: cSup_upper bdd_aboveI) -qed + then show "bdd_above A" "A \ {}" + by (auto intro!: SUP_upper bdd_aboveI[of _ r] simp add: ereal_less_eq(3)[symmetric] simp del: ereal_less_eq) +qed (auto simp: mono_def continuous_at_within continuous_at_ereal) lemma ereal_SUP: "\SUP a:A. ereal (f a)\ \ \ \ ereal (SUP a:A. f a) = (SUP a:A. ereal (f a))" using ereal_Sup[of "f`A"] by auto - + lemma ereal_Inf: assumes *: "\INF a:A. ereal a\ \ \" shows "ereal (Inf A) = (INF a:A. ereal a)" -proof (rule antisym) +proof (rule continuous_at_Inf_mono) obtain r where r: "ereal r = (INF a:A. ereal a)" "A \ {}" using * by (force simp: top_ereal_def) - then have lower: "\a. a \ A \ r \ a" - by (auto intro!: INF_lower simp add: ereal_less_eq(3)[symmetric] simp del: ereal_less_eq) - - show "(INF a:A. ereal a) \ ereal (Inf A)" - using lower by (simp add: r[symmetric] cInf_greatest[OF `A \ {}`]) - show "ereal (Inf A) \ (INF a:A. ereal a)" - using lower `A \ {}` by (intro INF_greatest) (auto intro!: cInf_lower bdd_belowI) -qed + then show "bdd_below A" "A \ {}" + by (auto intro!: INF_lower bdd_belowI[of _ r] simp add: ereal_less_eq(3)[symmetric] simp del: ereal_less_eq) +qed (auto simp: mono_def continuous_at_within continuous_at_ereal) lemma ereal_INF: "\INF a:A. ereal (f a)\ \ \ \ ereal (INF a:A. f a) = (INF a:A. ereal (f a))" using ereal_Inf[of "f`A"] by auto @@ -1660,9 +1766,15 @@ lemma ereal_INF_uminus_eq: fixes f :: "'a \ ereal" - shows "(INF x:S. uminus (f x)) = - (SUP x:S. f x)" + shows "(INF x:S. - f x) = - (SUP x:S. f x)" using ereal_Inf_uminus_image_eq [of "f ` S"] by (simp add: comp_def) +lemma ereal_SUP_uminus: + fixes f :: "'a \ ereal" + shows "(SUP i : R. - f i) = - (INF i : R. f i)" + using ereal_Sup_uminus_image_eq[of "f`R"] + by (simp add: image_image) + lemma ereal_SUP_not_infty: fixes f :: "_ \ ereal" shows "A \ {} \ l \ -\ \ u \ \ \ \a\A. l \ f a \ f a \ u \ \SUPREMUM A f\ \ \" @@ -1675,17 +1787,6 @@ using INF_lower2[of _ A f u] INF_greatest[of A l f] by (cases "INFIMUM A f") auto -lemma ereal_SUP_uminus: - fixes f :: "'a \ ereal" - shows "(SUP i : R. -(f i)) = -(INF i : R. f i)" - using ereal_Sup_uminus_image_eq[of "f`R"] - by (simp add: image_image) - -lemma ereal_INF_uminus: - fixes f :: "'a \ ereal" - shows "(INF i : R. - f i) = - (SUP i : R. f i)" - using ereal_SUP_uminus [of _ "\x. - f x"] by simp - lemma ereal_image_uminus_shift: fixes X Y :: "ereal set" shows "uminus ` X = Y \ X = uminus ` Y" @@ -1697,12 +1798,6 @@ by (simp add: image_image) qed (simp add: image_image) -lemma Inf_ereal_iff: - fixes z :: ereal - shows "(\x. x \ X \ z \ x) \ (\x\X. x < y) \ Inf X < y" - by (metis complete_lattice_class.Inf_greatest complete_lattice_class.Inf_lower - less_le_not_le linear order_less_le_trans) - lemma Sup_eq_MInfty: fixes S :: "ereal set" shows "Sup S = -\ \ S = {} \ S = {-\}" @@ -1742,101 +1837,108 @@ qed lemma SUP_PInfty: - fixes f :: "'a \ ereal" - assumes "\n::nat. \i\A. ereal (real n) \ f i" - shows "(SUP i:A. f i) = \" - unfolding SUP_def Sup_eq_top_iff[where 'a=ereal, unfolded top_ereal_def] - apply simp -proof safe - fix x :: ereal - assume "x \ \" - show "\i\A. x < f i" - proof (cases x) - case PInf - with `x \ \` show ?thesis - by simp - next - case MInf - with assms[of "0"] show ?thesis - by force - next - case (real r) - with less_PInf_Ex_of_nat[of x] obtain n :: nat where "x < ereal (real n)" - by auto - moreover obtain i where "i \ A" "ereal (real n) \ f i" - using assms .. - ultimately show ?thesis - by (auto intro!: bexI[of _ i]) - qed -qed + "(\n::nat. \i\A. ereal (real n) \ f i) \ (SUP i:A. f i :: ereal) = \" + unfolding top_ereal_def[symmetric] SUP_eq_top_iff + by (metis MInfty_neq_PInfty(2) PInfty_neq_ereal(2) less_PInf_Ex_of_nat less_ereal.elims(2) less_le_trans) lemma SUP_nat_Infty: "(SUP i::nat. ereal (real i)) = \" by (rule SUP_PInfty) auto -lemma Inf_less: - fixes x :: ereal - assumes "(INF i:A. f i) < x" - shows "\i. i \ A \ f i \ x" -proof (rule ccontr) - assume "\ ?thesis" - then have "\i\A. f i > x" - by auto - then have "(INF i:A. f i) \ x" - by (subst INF_greatest) auto - then show False - using assms by auto +lemma SUP_ereal_add_left: + assumes "I \ {}" "c \ -\" + shows "(SUP i:I. f i + c :: ereal) = (SUP i:I. f i) + c" +proof cases + assume "(SUP i:I. f i) = - \" + moreover then have "\i. i \ I \ f i = -\" + unfolding Sup_eq_MInfty Sup_image_eq[symmetric] by auto + ultimately show ?thesis + by (cases c) (auto simp: `I \ {}`) +next + assume "(SUP i:I. f i) \ - \" then show ?thesis + unfolding Sup_image_eq[symmetric] + by (subst continuous_at_Sup_mono[where f="\x. x + c"]) + (auto simp: continuous_at_within continuous_at mono_def ereal_add_mono `I \ {}` `c \ -\`) +qed + +lemma SUP_ereal_add_right: + fixes c :: ereal + shows "I \ {} \ c \ -\ \ (SUP i:I. c + f i) = c + (SUP i:I. f i)" + using SUP_ereal_add_left[of I c f] by (simp add: add.commute) + +lemma SUP_ereal_minus_right: + assumes "I \ {}" "c \ -\" + shows "(SUP i:I. c - f i :: ereal) = c - (INF i:I. f i)" + using SUP_ereal_add_right[OF assms, of "\i. - f i"] + by (simp add: ereal_SUP_uminus minus_ereal_def) + +lemma SUP_ereal_minus_left: + assumes "I \ {}" "c \ \" + shows "(SUP i:I. f i - c:: ereal) = (SUP i:I. f i) - c" + using SUP_ereal_add_left[OF `I \ {}`, of "-c" f] by (simp add: `c \ \` minus_ereal_def) + +lemma INF_ereal_minus_right: + assumes "I \ {}" and "\c\ \ \" + shows "(INF i:I. c - f i) = c - (SUP i:I. f i::ereal)" +proof - + { fix b have "(-c) + b = - (c - b)" + using `\c\ \ \` by (cases c b rule: ereal2_cases) auto } + note * = this + show ?thesis + using SUP_ereal_add_right[OF `I \ {}`, of "-c" f] `\c\ \ \` + by (auto simp add: * ereal_SUP_uminus_eq) qed lemma SUP_ereal_le_addI: fixes f :: "'i \ ereal" - assumes "\i. f i + y \ z" - and "y \ -\" + assumes "\i. f i + y \ z" and "y \ -\" shows "SUPREMUM UNIV f + y \ z" -proof (cases y) - case (real r) - then have "\i. f i \ z - y" - using assms by (simp add: ereal_le_minus_iff) - then have "SUPREMUM UNIV f \ z - y" - by (rule SUP_least) - then show ?thesis - using real by (simp add: ereal_le_minus_iff) -qed (insert assms, auto) + unfolding SUP_ereal_add_left[OF UNIV_not_empty `y \ -\`, symmetric] + by (rule SUP_least assms)+ + +lemma SUP_combine: + fixes f :: "'a::semilattice_sup \ 'a::semilattice_sup \ 'b::complete_lattice" + assumes mono: "\a b c d. a \ b \ c \ d \ f a c \ f b d" + shows "(SUP i:UNIV. SUP j:UNIV. f i j) = (SUP i. f i i)" +proof (rule antisym) + show "(SUP i j. f i j) \ (SUP i. f i i)" + by (rule SUP_least SUP_upper2[where i="sup i j" for i j] UNIV_I mono sup_ge1 sup_ge2)+ + show "(SUP i. f i i) \ (SUP i j. f i j)" + by (rule SUP_least SUP_upper2 UNIV_I mono order_refl)+ +qed lemma SUP_ereal_add: fixes f g :: "nat \ ereal" - assumes "incseq f" - and "incseq g" + assumes inc: "incseq f" "incseq g" and pos: "\i. f i \ -\" "\i. g i \ -\" shows "(SUP i. f i + g i) = SUPREMUM UNIV f + SUPREMUM UNIV g" -proof (rule SUP_eqI) - fix y - assume *: "\i. i \ UNIV \ f i + g i \ y" - have f: "SUPREMUM UNIV f \ -\" - using pos - unfolding SUP_def Sup_eq_MInfty - by (auto dest: image_eqD) - { - fix j - { - fix i - have "f i + g j \ f i + g (max i j)" - using `incseq g`[THEN incseqD] - by (rule add_left_mono) auto - also have "\ \ f (max i j) + g (max i j)" - using `incseq f`[THEN incseqD] - by (rule add_right_mono) auto - also have "\ \ y" using * by auto - finally have "f i + g j \ y" . - } - then have "SUPREMUM UNIV f + g j \ y" - using assms(4)[of j] by (intro SUP_ereal_le_addI) auto - then have "g j + SUPREMUM UNIV f \ y" by (simp add: ac_simps) - } - then have "SUPREMUM UNIV g + SUPREMUM UNIV f \ y" - using f by (rule SUP_ereal_le_addI) - then show "SUPREMUM UNIV f + SUPREMUM UNIV g \ y" - by (simp add: ac_simps) -qed (auto intro!: add_mono SUP_upper) + apply (subst SUP_ereal_add_left[symmetric, OF UNIV_not_empty]) + apply (metis SUP_upper UNIV_I assms(4) ereal_infty_less_eq(2)) + apply (subst (2) add.commute) + apply (subst SUP_ereal_add_left[symmetric, OF UNIV_not_empty assms(3)]) + apply (subst (2) add.commute) + apply (rule SUP_combine[symmetric] ereal_add_mono inc[THEN monoD] | assumption)+ + done + +lemma INF_ereal_add: + fixes f :: "nat \ ereal" + assumes "decseq f" "decseq g" + and fin: "\i. f i \ \" "\i. g i \ \" + shows "(INF i. f i + g i) = INFIMUM UNIV f + INFIMUM UNIV g" +proof - + have INF_less: "(INF i. f i) < \" "(INF i. g i) < \" + using assms unfolding INF_less_iff by auto + { fix a b :: ereal assume "a \ \" "b \ \" + then have "- ((- a) + (- b)) = a + b" + by (cases a b rule: ereal2_cases) auto } + note * = this + have "(INF i. f i + g i) = (INF i. - ((- f i) + (- g i)))" + by (simp add: fin *) + also have "\ = INFIMUM UNIV f + INFIMUM UNIV g" + unfolding ereal_INF_uminus_eq + using assms INF_less + by (subst SUP_ereal_add) (auto simp: ereal_SUP_uminus fin *) + finally show ?thesis . +qed lemma SUP_ereal_add_pos: fixes f g :: "nat \ ereal" @@ -1863,313 +1965,85 @@ then show ?thesis by simp qed -lemma SUP_ereal_cmult: - fixes f :: "nat \ ereal" - assumes "\i. 0 \ f i" - and "0 \ c" - shows "(SUP i. c * f i) = c * SUPREMUM UNIV f" -proof (rule SUP_eqI) - fix i - have "f i \ SUPREMUM UNIV f" - by (rule SUP_upper) auto - then show "c * f i \ c * SUPREMUM UNIV f" - using `0 \ c` by (rule ereal_mult_left_mono) -next - fix y - assume "\i. i \ UNIV \ c * f i \ y" - then have *: "\i. c * f i \ y" by simp - show "c * SUPREMUM UNIV f \ y" - proof (cases "0 < c \ c \ \") - case True - with * have "SUPREMUM UNIV f \ y / c" - by (intro SUP_least) (auto simp: ereal_le_divide_pos) - with True show ?thesis - by (auto simp: ereal_le_divide_pos) - next - case False - { - assume "c = \" - have ?thesis - proof (cases "\i. f i = 0") - case True - then have "range f = {0}" - by auto - with True show "c * SUPREMUM UNIV f \ y" - using * by auto - next - case False - then obtain i where "f i \ 0" - by auto - with *[of i] `c = \` `0 \ f i` show ?thesis - by (auto split: split_if_asm) - qed - } - moreover note False - ultimately show ?thesis - using * `0 \ c` by auto - qed -qed - -lemma SUP_ereal_mult_right: +lemma SUP_ereal_mult_left: fixes f :: "'a \ ereal" assumes "I \ {}" - assumes "\i. i \ I \ 0 \ f i" - and "0 \ c" + assumes f: "\i. i \ I \ 0 \ f i" and c: "0 \ c" shows "(SUP i:I. c * f i) = c * (SUP i:I. f i)" -proof (rule SUP_eqI) - fix i assume "i \ I" - then have "f i \ SUPREMUM I f" - by (rule SUP_upper) - then show "c * f i \ c * SUPREMUM I f" - using `0 \ c` by (rule ereal_mult_left_mono) +proof cases + assume "(SUP i:I. f i) = 0" + moreover then have "\i. i \ I \ f i = 0" + by (metis SUP_upper f antisym) + ultimately show ?thesis + by simp next - fix y assume *: "\i. i \ I \ c * f i \ y" - { assume "c = \" have "c * SUPREMUM I f \ y" - proof cases - assume "\i\I. f i = 0" - then show ?thesis - using * `c = \` by (auto simp: SUP_constant bot_ereal_def) - next - assume "\ (\i\I. f i = 0)" - then obtain i where "f i \ 0" "i \ I" - by auto - with *[of i] `c = \` `i \ I \ 0 \ f i` show ?thesis - by (auto split: split_if_asm) - qed } - moreover - { assume "c \ 0" "c \ \" - moreover with `0 \ c` * have "SUPREMUM I f \ y / c" - by (intro SUP_least) (auto simp: ereal_le_divide_pos) - ultimately have "c * SUPREMUM I f \ y" - using `0 \ c` * by (auto simp: ereal_le_divide_pos) } - moreover { assume "c = 0" with * `I \ {}` have "c * SUPREMUM I f \ y" by auto } - ultimately show "c * SUPREMUM I f \ y" - by blast + assume "(SUP i:I. f i) \ 0" then show ?thesis + unfolding SUP_def + by (subst continuous_at_Sup_mono[where f="\x. c * x"]) + (auto simp: mono_def continuous_at continuous_at_within `I \ {}` + intro!: ereal_mult_left_mono c) qed -lemma SUP_ereal_add_left: - fixes f :: "'a \ ereal" - assumes "I \ {}" - assumes "\i. i \ I \ 0 \ f i" - and "0 \ c" - shows "(SUP i:I. f i + c) = SUPREMUM I f + c" -proof (intro SUP_eqI) - fix B assume *: "\i. i \ I \ f i + c \ B" - show "SUPREMUM I f + c \ B" - proof cases - assume "c = \" with `I \ {}` * show ?thesis - by auto - next - assume "c \ \" - with `0 \ c` have [simp]: "\c\ \ \" - by simp - have "SUPREMUM I f \ B - c" - by (simp add: SUP_le_iff ereal_le_minus *) - then show ?thesis - by (simp add: ereal_le_minus) - qed -qed (auto intro: ereal_add_mono SUP_upper) - -lemma SUP_ereal_add_right: - fixes c :: ereal - shows "I \ {} \ (\i. i \ I \ 0 \ f i) \ 0 \ c \ (SUP i:I. c + f i) = c + SUPREMUM I f" - using SUP_ereal_add_left[of I f c] by (simp add: add_ac) +lemma countable_approach: + fixes x :: ereal + assumes "x \ -\" + shows "\f. incseq f \ (\i::nat. f i < x) \ (f ----> x)" +proof (cases x) + case (real r) + moreover have "(\n. r - inverse (real (Suc n))) ----> r - 0" + by (intro tendsto_intros LIMSEQ_inverse_real_of_nat) + ultimately show ?thesis + by (intro exI[of _ "\n. x - inverse (Suc n)"]) (auto simp: incseq_def) +next + case PInf with LIMSEQ_SUP[of "\n::nat. ereal (real n)"] show ?thesis + by (intro exI[of _ "\n. ereal (real n)"]) (auto simp: incseq_def SUP_nat_Infty) +qed (simp add: assms) lemma Sup_countable_SUP: assumes "A \ {}" - shows "\f::nat \ ereal. range f \ A \ Sup A = SUPREMUM UNIV f" -proof (cases "Sup A") - case (real r) - have "\n::nat. \x. x \ A \ Sup A < x + 1 / ereal (real n)" - proof - fix n :: nat - have "\x\A. Sup A - 1 / ereal (real n) < x" - using assms real by (intro Sup_ereal_close) (auto simp: one_ereal_def) - then obtain x where "x \ A" "Sup A - 1 / ereal (real n) < x" .. - then show "\x. x \ A \ Sup A < x + 1 / ereal (real n)" - by (auto intro!: exI[of _ x] simp: ereal_minus_less_iff) - qed - from choice[OF this] obtain f :: "nat \ ereal" - where f: "\x. f x \ A \ Sup A < f x + 1 / ereal (real x)" .. - have "SUPREMUM UNIV f = Sup A" - proof (rule SUP_eqI) - fix i - show "f i \ Sup A" - using f by (auto intro!: complete_lattice_class.Sup_upper) - next - fix y - assume bound: "\i. i \ UNIV \ f i \ y" - show "Sup A \ y" - proof (rule ereal_le_epsilon, intro allI impI) - fix e :: ereal - assume "0 < e" - show "Sup A \ y + e" - proof (cases e) - case (real r) - then have "0 < r" - using `0 < e` by auto - then obtain n :: nat where *: "1 / real n < r" "0 < n" - using ex_inverse_of_nat_less - by (auto simp: real_eq_of_nat inverse_eq_divide) - have "Sup A \ f n + 1 / ereal (real n)" - using f[THEN spec, of n] - by auto - also have "1 / ereal (real n) \ e" - using real * - by (auto simp: one_ereal_def ) - with bound have "f n + 1 / ereal (real n) \ y + e" - by (rule add_mono) simp - finally show "Sup A \ y + e" . - qed (insert `0 < e`, auto) - qed - qed - with f show ?thesis - by (auto intro!: exI[of _ f]) -next - case PInf - from `A \ {}` obtain x where "x \ A" - by auto - show ?thesis - proof (cases "\ \ A") - case True - then have "\ \ Sup A" - by (intro complete_lattice_class.Sup_upper) - with True show ?thesis - by (auto intro!: exI[of _ "\x. \"]) - next - case False - have "\x\A. 0 \ x" - by (metis Infty_neq_0(2) PInf complete_lattice_class.Sup_least ereal_infty_less_eq2(1) linorder_linear) - then obtain x where "x \ A" and "0 \ x" - by auto - have "\n::nat. \f. f \ A \ x + ereal (real n) \ f" - proof (rule ccontr) - assume "\ ?thesis" - then have "\n::nat. Sup A \ x + ereal (real n)" - by (simp add: Sup_le_iff not_le less_imp_le Ball_def) (metis less_imp_le) - then show False using `x \ A` `\ \ A` PInf - by (cases x) auto - qed - from choice[OF this] obtain f :: "nat \ ereal" - where f: "\z. f z \ A \ x + ereal (real z) \ f z" .. - have "SUPREMUM UNIV f = \" - proof (rule SUP_PInfty) - fix n :: nat - show "\i\UNIV. ereal (real n) \ f i" - using f[THEN spec, of n] `0 \ x` - by (cases rule: ereal2_cases[of "f n" x]) (auto intro!: exI[of _ n]) - qed - then show ?thesis - using f PInf by (auto intro!: exI[of _ f]) - qed -next - case MInf + shows "\f::nat \ ereal. incseq f \ range f \ A \ Sup A = (SUP i. f i)" +proof cases + assume "Sup A = -\" with `A \ {}` have "A = {-\}" by (auto simp: Sup_eq_MInfty) then show ?thesis - using MInf by (auto intro!: exI[of _ "\x. -\"]) + by (auto intro!: exI[of _ "\_. -\"] simp: bot_ereal_def) +next + assume "Sup A \ -\" + then obtain l where "incseq l" and l: "\i::nat. l i < Sup A" and l_Sup: "l ----> Sup A" + by (auto dest: countable_approach) + + have "\f. \n. (f n \ A \ l n \ f n) \ (f n \ f (Suc n))" + proof (rule dependent_nat_choice) + show "\x. x \ A \ l 0 \ x" + using l[of 0] by (auto simp: less_Sup_iff) + next + fix x n assume "x \ A \ l n \ x" + moreover from l[of "Suc n"] obtain y where "y \ A" "l (Suc n) < y" + by (auto simp: less_Sup_iff) + ultimately show "\y. (y \ A \ l (Suc n) \ y) \ x \ y" + by (auto intro!: exI[of _ "max x y"] split: split_max) + qed + then guess f .. note f = this + then have "range f \ A" "incseq f" + by (auto simp: incseq_Suc_iff) + moreover + have "(SUP i. f i) = Sup A" + proof (rule tendsto_unique) + show "f ----> (SUP i. f i)" + by (rule LIMSEQ_SUP `incseq f`)+ + show "f ----> Sup A" + using l f + by (intro tendsto_sandwich[OF _ _ l_Sup tendsto_const]) + (auto simp: Sup_upper) + qed simp + ultimately show ?thesis + by auto qed lemma SUP_countable_SUP: "A \ {} \ \f::nat \ ereal. range f \ g`A \ SUPREMUM A g = SUPREMUM UNIV f" - using Sup_countable_SUP [of "g`A"] - by auto - -lemma Sup_ereal_cadd: - fixes A :: "ereal set" - assumes "A \ {}" - and "a \ -\" - shows "Sup ((\x. a + x) ` A) = a + Sup A" -proof (rule antisym) - have *: "\a::ereal. \A. Sup ((\x. a + x) ` A) \ a + Sup A" - by (auto intro!: add_mono complete_lattice_class.SUP_least complete_lattice_class.Sup_upper) - then show "Sup ((\x. a + x) ` A) \ a + Sup A" . - show "a + Sup A \ Sup ((\x. a + x) ` A)" - proof (cases a) - case PInf with `A \ {}` - show ?thesis - by (auto simp: image_constant max.absorb1) - next - case (real r) - then have **: "op + (- a) ` op + a ` A = A" - by (auto simp: image_iff ac_simps zero_ereal_def[symmetric]) - from *[of "-a" "(\x. a + x) ` A"] real show ?thesis - unfolding ** - by (cases rule: ereal2_cases[of "Sup A" "Sup (op + a ` A)"]) auto - qed (insert `a \ -\`, auto) -qed - -lemma Sup_ereal_cminus: - fixes A :: "ereal set" - assumes "A \ {}" - and "a \ -\" - shows "Sup ((\x. a - x) ` A) = a - Inf A" - using Sup_ereal_cadd [of "uminus ` A" a] assms - unfolding image_image minus_ereal_def by (simp add: ereal_SUP_uminus_eq) - -lemma SUP_ereal_cminus: - fixes f :: "'i \ ereal" - fixes A - assumes "A \ {}" - and "a \ -\" - shows "(SUP x:A. a - f x) = a - (INF x:A. f x)" - using Sup_ereal_cminus[of "f`A" a] assms - unfolding SUP_def INF_def image_image by auto - -lemma Inf_ereal_cminus: - fixes A :: "ereal set" - assumes "A \ {}" - and "\a\ \ \" - shows "Inf ((\x. a - x) ` A) = a - Sup A" -proof - - { - fix x - have "-a - -x = -(a - x)" - using assms by (cases x) auto - } note * = this - then have "(\x. -a - x)`uminus`A = uminus ` (\x. a - x) ` A" - by (auto simp: image_image) - with * show ?thesis - using Sup_ereal_cminus [of "uminus ` A" "- a"] assms - by (auto simp add: ereal_INF_uminus_eq ereal_SUP_uminus_eq) -qed - -lemma INF_ereal_cminus: - fixes a :: ereal - assumes "A \ {}" - and "\a\ \ \" - shows "(INF x:A. a - f x) = a - (SUP x:A. f x)" - using Inf_ereal_cminus[of "f`A" a] assms - unfolding SUP_def INF_def image_image - by auto - -lemma uminus_ereal_add_uminus_uminus: - fixes a b :: ereal - shows "a \ \ \ b \ \ \ - (- a + - b) = a + b" - by (cases rule: ereal2_cases[of a b]) auto - -lemma INF_ereal_add: - fixes f :: "nat \ ereal" - assumes "decseq f" "decseq g" - and fin: "\i. f i \ \" "\i. g i \ \" - shows "(INF i. f i + g i) = INFIMUM UNIV f + INFIMUM UNIV g" -proof - - have INF_less: "(INF i. f i) < \" "(INF i. g i) < \" - using assms unfolding INF_less_iff by auto - { - fix i - from fin[of i] have "- ((- f i) + (- g i)) = f i + g i" - by (rule uminus_ereal_add_uminus_uminus) - } - then have "(INF i. f i + g i) = (INF i. - ((- f i) + (- g i)))" - by simp - also have "\ = INFIMUM UNIV f + INFIMUM UNIV g" - unfolding ereal_INF_uminus - using assms INF_less - by (subst SUP_ereal_add) - (auto simp: ereal_SUP_uminus intro!: uminus_ereal_add_uminus_uminus) - finally show ?thesis . -qed + using Sup_countable_SUP [of "g`A"] by auto subsection "Relation to @{typ enat}" @@ -2225,19 +2099,6 @@ subsection "Limits on @{typ ereal}" -subsubsection "Topological space" - -instantiation ereal :: linear_continuum_topology -begin - -definition "open_ereal" :: "ereal set \ bool" where - open_ereal_generated: "open_ereal = generate_topology (range lessThan \ range greaterThan)" - -instance - by default (simp add: open_ereal_generated) - -end - lemma open_PInfty: "open A \ \ \ A \ (\x. {ereal x<..} \ A)" unfolding open_ereal_generated proof (induct rule: generate_topology.induct) @@ -2279,23 +2140,7 @@ qed (fastforce simp add: vimage_Union)+ lemma open_ereal_vimage: "open S \ open (ereal -` S)" - unfolding open_ereal_generated -proof (induct rule: generate_topology.induct) - case (Int A B) - then show ?case - by auto -next - case (Basis S) - { - fix x have - "ereal -` {.. UNIV | MInfty \ {} | ereal r \ {.. {} | MInfty \ UNIV | ereal r \ {r<..})" - by (induct x) auto - } - moreover note Basis - ultimately show ?case - by (auto split: ereal.split) -qed (fastforce simp add: vimage_Union)+ + by (intro open_vimage continuous_intros) lemma open_ereal: "open S \ open (ereal ` S)" unfolding open_generated_order[where 'a=real] @@ -2422,23 +2267,6 @@ subsubsection {* Convergent sequences *} -lemma lim_ereal[simp]: "((\n. ereal (f n)) ---> ereal x) net \ (f ---> x) net" - (is "?l = ?r") -proof (intro iffI topological_tendstoI) - fix S - assume "?l" and "open S" and "x \ S" - then show "eventually (\x. f x \ S) net" - using `?l`[THEN topological_tendstoD, OF open_ereal, OF `open S`] - by (simp add: inj_image_mem_iff) -next - fix S - assume "?r" and "open S" and "ereal x \ S" - show "eventually (\x. ereal (f x) \ S) net" - using `?r`[THEN topological_tendstoD, OF open_ereal_vimage, OF `open S`] - using `ereal x \ S` - by auto -qed - lemma lim_real_of_ereal[simp]: assumes lim: "(f ---> ereal x) net" shows "((\x. real (f x)) ---> x) net" @@ -2454,6 +2282,9 @@ by (rule eventually_mono) qed +lemma lim_ereal[simp]: "((\n. ereal (f n)) ---> ereal x) net \ (f ---> x) net" + by (auto dest!: lim_real_of_ereal) + lemma tendsto_PInfty: "(f ---> \) F \ (\r. eventually (\x. ereal r < f x) F)" proof - { @@ -2763,7 +2594,7 @@ lemma ereal_Limsup_uminus: fixes f :: "'a \ ereal" shows "Limsup net (\x. - (f x)) = - Liminf net f" - unfolding Limsup_def Liminf_def ereal_SUP_uminus ereal_INF_uminus .. + unfolding Limsup_def Liminf_def ereal_SUP_uminus ereal_INF_uminus_eq .. lemma liminf_bounded_iff: fixes x :: "nat \ ereal" diff -r 86be42bb5174 -r 2538b2c51769 src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy --- a/src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy Mon Jan 26 14:40:13 2015 +0100 +++ b/src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy Tue Jan 27 16:12:40 2015 +0100 @@ -250,71 +250,22 @@ and t: "\t\ \ \" shows "open ((\x. m * x + t) ` S)" proof - - obtain r where r[simp]: "m = ereal r" - using m by (cases m) auto - obtain p where p[simp]: "t = ereal p" - using t by auto - have "r \ 0" "0 < r" and m': "m \ \" "m \ -\" "m \ 0" - using m by auto - from `open S` [THEN ereal_openE] - obtain l u where T: - "open (ereal -` S)" - "\ \ S \ {ereal l<..} \ S" - "- \ \ S \ {.. S" - by blast - let ?f = "(\x. m * x + t)" - show ?thesis - unfolding open_ereal_def - proof (intro conjI impI exI subsetI) - have "ereal -` ?f ` S = (\x. r * x + p) ` (ereal -` S)" - proof safe - fix x y - assume "ereal y = m * x + t" "x \ S" - then show "y \ (\x. r * x + p) ` ereal -` S" - using `r \ 0` by (cases x) (auto intro!: image_eqI[of _ _ "real x"] split: split_if_asm) - qed force - then show "open (ereal -` ?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 \ {ereal (r * l + p)<..}" - then have [simp]: "ereal (r * l + p) < x" - by auto - show "x \ ?f`S" - proof (rule image_eqI) - show "x = m * ((x - t) / m) + t" - using m t - by (cases rule: ereal3_cases[of m x t]) auto - have "ereal l < (x - t) / m" - using m t - by (simp add: ereal_less_divide_pos ereal_less_minus) - 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 - fix x assume "x \ {.. ?f`S" - proof (rule image_eqI) - show "x = m * ((x - t) / m) + t" - using m t - by (cases rule: ereal3_cases[of m x t]) auto - have "(x - t)/m < ereal u" - using m t - by (simp add: ereal_divide_less_pos ereal_minus_less) - then show "(x - t)/m \ S" - using T(3)[OF `-\ \ S`] - by auto - qed - qed + have "open ((\x. inverse m * (x + -t)) -` S)" + using m t + apply (intro open_vimage `open S`) + apply (intro continuous_at_imp_continuous_on ballI tendsto_cmult_ereal continuous_at[THEN iffD2] + tendsto_ident_at tendsto_add_left_ereal) + apply auto + done + also have "(\x. inverse m * (x + -t)) -` S = (\x. (x - t) / m) -` S" + using m t by (auto simp: divide_ereal_def mult.commute uminus_ereal.simps[symmetric] minus_ereal_def + simp del: uminus_ereal.simps) + also have "(\x. (x - t) / m) -` S = (\x. m * x + t) ` S" + using m t + by (simp add: set_eq_iff image_iff) + (metis abs_ereal_less0 abs_ereal_uminus ereal_divide_eq ereal_eq_minus ereal_minus(7,8) + ereal_minus_less_minus ereal_mult_eq_PInfty ereal_uminus_uminus ereal_zero_mult) + finally show ?thesis . qed lemma ereal_open_affinity: @@ -340,45 +291,6 @@ unfolding image_image by simp qed -lemma ereal_lim_mult: - fixes X :: "'a \ ereal" - assumes lim: "(X ---> L) net" - and a: "\a\ \ \" - shows "((\i. a * X i) ---> a * L) net" -proof cases - assume "a \ 0" - show ?thesis - proof (rule topological_tendstoI) - fix S - assume "open S" and "a * L \ S" - have "a * L / a = L" - using `a \ 0` a - by (cases rule: ereal2_cases[of a L]) auto - then have L: "L \ ((\x. x / a) ` S)" - using `a * L \ S` - by (force simp: image_iff) - moreover have "open ((\x. x / a) ` S)" - using ereal_open_affinity[OF `open S`, of "inverse a" 0] `a \ 0` a - by (auto simp: ereal_divide_eq ereal_inverse_eq_0 divide_ereal_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: ereal2_cases[of a x]) auto - } - note this[simp] - show "eventually (\x. a * X x \ S) net" - by (rule eventually_mono[OF _ *]) auto - qed -qed auto - -lemma ereal_lim_uminus: - fixes X :: "'a \ ereal" - shows "((\i. - X i) ---> - L) net \ (X ---> L) net" - using ereal_lim_mult[of X L net "ereal (-1)"] - ereal_lim_mult[of "(\i. - X i)" "-L" net "ereal (-1)"] - by (auto simp add: algebra_simps) - lemma ereal_open_atLeast: fixes x :: ereal shows "open {x..} \ x = -\" @@ -409,14 +321,6 @@ shows "Liminf net (\x. - (f x)) = - Limsup net f" using ereal_Limsup_uminus[of _ "(\x. - (f x))"] by auto -lemma ereal_Lim_uminus: - fixes f :: "'a \ ereal" - shows "(f ---> f0) net \ ((\x. - f x) ---> - f0) net" - using - ereal_lim_mult[of f f0 net "- 1"] - ereal_lim_mult[of "\x. - (f x)" "-f0" net "- 1"] - by (auto simp: ereal_uminus_reorder) - lemma Liminf_PInfty: fixes f :: "'a \ ereal" assumes "\ trivial_limit net" @@ -559,9 +463,9 @@ case (real r) then show ?thesis unfolding liminf_SUP_INF limsup_INF_SUP - apply (subst INF_ereal_cminus) + apply (subst INF_ereal_minus_right) apply auto - apply (subst SUP_ereal_cminus) + apply (subst SUP_ereal_minus_right) apply auto done qed (insert `c \ -\`, simp) @@ -889,7 +793,7 @@ shows "(\i. a * f i) = a * suminf f" by (auto simp: setsum_ereal_right_distrib[symmetric] assms ereal_zero_le_0_iff setsum_nonneg suminf_ereal_eq_SUP - intro!: SUP_ereal_cmult) + intro!: SUP_ereal_mult_left) lemma suminf_PInfty: fixes f :: "nat \ ereal" diff -r 86be42bb5174 -r 2538b2c51769 src/HOL/Probability/Bochner_Integration.thy --- a/src/HOL/Probability/Bochner_Integration.thy Mon Jan 26 14:40:13 2015 +0100 +++ b/src/HOL/Probability/Bochner_Integration.thy Tue Jan 27 16:12:40 2015 +0100 @@ -641,7 +641,7 @@ finally show "?f i \ ?g i" . qed show "?g ----> 0" - using ereal_lim_mult[OF f_s, of "ereal K"] by simp + using tendsto_cmult_ereal[OF _ f_s, of "ereal K"] by simp qed assume "(\i. simple_bochner_integral M (s i)) ----> x" diff -r 86be42bb5174 -r 2538b2c51769 src/HOL/Probability/Lebesgue_Integral_Substitution.thy --- a/src/HOL/Probability/Lebesgue_Integral_Substitution.thy Mon Jan 26 14:40:13 2015 +0100 +++ b/src/HOL/Probability/Lebesgue_Integral_Substitution.thy Tue Jan 27 16:12:40 2015 +0100 @@ -566,7 +566,7 @@ (auto simp: incseq_def le_fun_def derivg_nonneg Mf' split: split_indicator intro!: ereal_mult_right_mono) also from sup have "... = \\<^sup>+x. (SUP i. F i (g x)) * ereal (g' x) * indicator {a..b} x \lborel" - by (subst mult.assoc, subst mult.commute, subst SUP_ereal_cmult) + by (subst mult.assoc, subst mult.commute, subst SUP_ereal_mult_left) (auto split: split_indicator simp: derivg_nonneg mult_ac) finally show ?case by simp qed diff -r 86be42bb5174 -r 2538b2c51769 src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy --- a/src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy Mon Jan 26 14:40:13 2015 +0100 +++ b/src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy Tue Jan 27 16:12:40 2015 +0100 @@ -944,11 +944,11 @@ next show "integral\<^sup>S M u = (\i\u ` space M. SUP n. i * (emeasure M) (?B' i n))" using measure_conv u_range B_u unfolding simple_integral_def - by (auto intro!: setsum.cong SUP_ereal_cmult [symmetric]) + by (auto intro!: setsum.cong SUP_ereal_mult_left [symmetric]) qed moreover have "a * (SUP i. integral\<^sup>S M (?uB i)) \ ?S" - apply (subst SUP_ereal_cmult [symmetric]) + apply (subst SUP_ereal_mult_left [symmetric]) proof (safe intro!: SUP_mono bexI) fix i have "a * integral\<^sup>S M (?uB i) = (\\<^sup>Sx. a * ?uB i x \M)" @@ -1115,7 +1115,7 @@ by auto } then have "(SUP i. a * u i x + v i x) = a * (SUP i. u i x) + (SUP i. v i x)" using `0 \ a` u(3) v(3) u(6)[of _ x] v(6)[of _ x] - by (subst SUP_ereal_cmult [symmetric, OF u(6) `0 \ a`]) + by (subst SUP_ereal_mult_left [symmetric, OF _ u(6) `0 \ a`]) (auto intro!: SUP_ereal_add simp: incseq_Suc_iff le_fun_def add_mono ereal_mult_left_mono) } then show "AE x in M. (SUP i. l i x) = (SUP i. ?L' i x)" @@ -1127,8 +1127,10 @@ finally have "(\\<^sup>+ x. max 0 (a * f x + g x) \M) = a * (\\<^sup>+x. max 0 (f x) \M) + (\\<^sup>+x. max 0 (g x) \M)" unfolding l(5)[symmetric] u(5)[symmetric] v(5)[symmetric] unfolding l(1)[symmetric] u(1)[symmetric] v(1)[symmetric] - apply (subst SUP_ereal_cmult [symmetric, OF pos(1) `0 \ a`]) - apply (subst SUP_ereal_add [symmetric, OF inc not_MInf]) . + apply (subst SUP_ereal_mult_left [symmetric, OF _ pos(1) `0 \ a`]) + apply simp + apply (subst SUP_ereal_add [symmetric, OF inc not_MInf]) + . then show ?thesis by (simp add: nn_integral_max_0) qed @@ -2120,7 +2122,7 @@ next case (seq U) from f(2) have eq: "AE x in M. f x * (SUP i. U i x) = (SUP i. f x * U i x)" - by eventually_elim (simp add: SUP_ereal_cmult seq) + by eventually_elim (simp add: SUP_ereal_mult_left seq) from seq f show ?case apply (simp add: nn_integral_monotone_convergence_SUP) apply (subst nn_integral_cong_AE[OF eq]) diff -r 86be42bb5174 -r 2538b2c51769 src/HOL/Probability/Regularity.thy --- a/src/HOL/Probability/Regularity.thy Mon Jan 26 14:40:13 2015 +0100 +++ b/src/HOL/Probability/Regularity.thy Tue Jan 27 16:12:40 2015 +0100 @@ -312,7 +312,7 @@ case 2 have "M (space M - B) = M (space M) - emeasure M B" by (auto simp: emeasure_compl) also have "\ = (INF K:{K. K \ B \ compact K}. M (space M) - M K)" - unfolding inner by (subst INF_ereal_cminus) force+ + unfolding inner by (subst INF_ereal_minus_right) force+ also have "\ = (INF U:{U. U \ B \ compact U}. M (space M - U))" by (rule INF_cong) (auto simp add: emeasure_compl sb compact_imp_closed) also have "\ \ (INF U:{U. U \ B \ closed U}. M (space M - U))" @@ -331,7 +331,7 @@ case 1 have "M (space M - B) = M (space M) - emeasure M B" by (auto simp: emeasure_compl) also have "\ = (SUP U: {U. B \ U \ open U}. M (space M) - M U)" - unfolding outer by (subst SUP_ereal_cminus) auto + unfolding outer by (subst SUP_ereal_minus_right) auto also have "\ = (SUP U:{U. B \ U \ open U}. M (space M - U))" by (rule SUP_cong) (auto simp add: emeasure_compl sb compact_imp_closed) also have "\ = (SUP K:{K. K \ space M - B \ closed K}. emeasure M K)" diff -r 86be42bb5174 -r 2538b2c51769 src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Mon Jan 26 14:40:13 2015 +0100 +++ b/src/HOL/Topological_Spaces.thy Tue Jan 27 16:12:40 2015 +0100 @@ -2789,6 +2789,154 @@ using I[of a x] I[of x b] x less_trans[OF x] by (auto simp add: le_less less_imp_neq neq_iff) qed +lemma continuous_at_Sup_mono: + fixes f :: "'a :: {linorder_topology, conditionally_complete_linorder} \ 'b :: {linorder_topology, conditionally_complete_linorder}" + assumes "mono f" + assumes cont: "continuous (at_left (Sup S)) f" + assumes S: "S \ {}" "bdd_above S" + shows "f (Sup S) = (SUP s:S. f s)" +proof (rule antisym) + have f: "(f ---> f (Sup S)) (at_left (Sup S))" + using cont unfolding continuous_within . + + show "f (Sup S) \ (SUP s:S. f s)" + proof cases + assume "Sup S \ S" then show ?thesis + by (rule cSUP_upper) (auto intro: bdd_above_image_mono S `mono f`) + next + assume "Sup S \ S" + from `S \ {}` obtain s where "s \ S" + by auto + with `Sup S \ S` S have "s < Sup S" + unfolding less_le by (blast intro: cSup_upper) + show ?thesis + proof (rule ccontr) + assume "\ ?thesis" + with order_tendstoD(1)[OF f, of "SUP s:S. f s"] obtain b where "b < Sup S" + and *: "\y. b < y \ y < Sup S \ (SUP s:S. f s) < f y" + by (auto simp: not_le eventually_at_left[OF `s < Sup S`]) + with `S \ {}` obtain c where "c \ S" "b < c" + using less_cSupD[of S b] by auto + with `Sup S \ S` S have "c < Sup S" + unfolding less_le by (blast intro: cSup_upper) + from *[OF `b < c` `c < Sup S`] cSUP_upper[OF `c \ S` bdd_above_image_mono[of f]] + show False + by (auto simp: assms) + qed + qed +qed (intro cSUP_least `mono f`[THEN monoD] cSup_upper S) + +lemma continuous_at_Sup_antimono: + fixes f :: "'a :: {linorder_topology, conditionally_complete_linorder} \ 'b :: {linorder_topology, conditionally_complete_linorder}" + assumes "antimono f" + assumes cont: "continuous (at_left (Sup S)) f" + assumes S: "S \ {}" "bdd_above S" + shows "f (Sup S) = (INF s:S. f s)" +proof (rule antisym) + have f: "(f ---> f (Sup S)) (at_left (Sup S))" + using cont unfolding continuous_within . + + show "(INF s:S. f s) \ f (Sup S)" + proof cases + assume "Sup S \ S" then show ?thesis + by (intro cINF_lower) (auto intro: bdd_below_image_antimono S `antimono f`) + next + assume "Sup S \ S" + from `S \ {}` obtain s where "s \ S" + by auto + with `Sup S \ S` S have "s < Sup S" + unfolding less_le by (blast intro: cSup_upper) + show ?thesis + proof (rule ccontr) + assume "\ ?thesis" + with order_tendstoD(2)[OF f, of "INF s:S. f s"] obtain b where "b < Sup S" + and *: "\y. b < y \ y < Sup S \ f y < (INF s:S. f s)" + by (auto simp: not_le eventually_at_left[OF `s < Sup S`]) + with `S \ {}` obtain c where "c \ S" "b < c" + using less_cSupD[of S b] by auto + with `Sup S \ S` S have "c < Sup S" + unfolding less_le by (blast intro: cSup_upper) + from *[OF `b < c` `c < Sup S`] cINF_lower[OF bdd_below_image_antimono, of f S c] `c \ S` + show False + by (auto simp: assms) + qed + qed +qed (intro cINF_greatest `antimono f`[THEN antimonoD] cSup_upper S) + +lemma continuous_at_Inf_mono: + fixes f :: "'a :: {linorder_topology, conditionally_complete_linorder} \ 'b :: {linorder_topology, conditionally_complete_linorder}" + assumes "mono f" + assumes cont: "continuous (at_right (Inf S)) f" + assumes S: "S \ {}" "bdd_below S" + shows "f (Inf S) = (INF s:S. f s)" +proof (rule antisym) + have f: "(f ---> f (Inf S)) (at_right (Inf S))" + using cont unfolding continuous_within . + + show "(INF s:S. f s) \ f (Inf S)" + proof cases + assume "Inf S \ S" then show ?thesis + by (rule cINF_lower[rotated]) (auto intro: bdd_below_image_mono S `mono f`) + next + assume "Inf S \ S" + from `S \ {}` obtain s where "s \ S" + by auto + with `Inf S \ S` S have "Inf S < s" + unfolding less_le by (blast intro: cInf_lower) + show ?thesis + proof (rule ccontr) + assume "\ ?thesis" + with order_tendstoD(2)[OF f, of "INF s:S. f s"] obtain b where "Inf S < b" + and *: "\y. Inf S < y \ y < b \ f y < (INF s:S. f s)" + by (auto simp: not_le eventually_at_right[OF `Inf S < s`]) + with `S \ {}` obtain c where "c \ S" "c < b" + using cInf_lessD[of S b] by auto + with `Inf S \ S` S have "Inf S < c" + unfolding less_le by (blast intro: cInf_lower) + from *[OF `Inf S < c` `c < b`] cINF_lower[OF bdd_below_image_mono[of f] `c \ S`] + show False + by (auto simp: assms) + qed + qed +qed (intro cINF_greatest `mono f`[THEN monoD] cInf_lower `bdd_below S` `S \ {}`) + +lemma continuous_at_Inf_antimono: + fixes f :: "'a :: {linorder_topology, conditionally_complete_linorder} \ 'b :: {linorder_topology, conditionally_complete_linorder}" + assumes "antimono f" + assumes cont: "continuous (at_right (Inf S)) f" + assumes S: "S \ {}" "bdd_below S" + shows "f (Inf S) = (SUP s:S. f s)" +proof (rule antisym) + have f: "(f ---> f (Inf S)) (at_right (Inf S))" + using cont unfolding continuous_within . + + show "f (Inf S) \ (SUP s:S. f s)" + proof cases + assume "Inf S \ S" then show ?thesis + by (rule cSUP_upper) (auto intro: bdd_above_image_antimono S `antimono f`) + next + assume "Inf S \ S" + from `S \ {}` obtain s where "s \ S" + by auto + with `Inf S \ S` S have "Inf S < s" + unfolding less_le by (blast intro: cInf_lower) + show ?thesis + proof (rule ccontr) + assume "\ ?thesis" + with order_tendstoD(1)[OF f, of "SUP s:S. f s"] obtain b where "Inf S < b" + and *: "\y. Inf S < y \ y < b \ (SUP s:S. f s) < f y" + by (auto simp: not_le eventually_at_right[OF `Inf S < s`]) + with `S \ {}` obtain c where "c \ S" "c < b" + using cInf_lessD[of S b] by auto + with `Inf S \ S` S have "Inf S < c" + unfolding less_le by (blast intro: cInf_lower) + from *[OF `Inf S < c` `c < b`] cSUP_upper[OF `c \ S` bdd_above_image_antimono[of f]] + show False + by (auto simp: assms) + qed + qed +qed (intro cSUP_least `antimono f`[THEN antimonoD] cInf_lower S) + subsection {* Setup @{typ "'a filter"} for lifting and transfer *} context begin interpretation lifting_syntax .