# HG changeset patch # User eberlm # Date 1471443398 -7200 # Node ID 009e176e10103c49a9bff010080bb8dfd974b2c5 # Parent 2606e8c8487d2293e1c2d61de7058de40090341c Tuned L'Hospital diff -r 2606e8c8487d -r 009e176e1010 src/HOL/Deriv.thy --- a/src/HOL/Deriv.thy Wed Aug 17 10:26:12 2016 +0200 +++ b/src/HOL/Deriv.thy Wed Aug 17 16:16:38 2016 +0200 @@ -1744,8 +1744,8 @@ "eventually (\x. g' x \ 0) (at_right 0)" "eventually (\x. DERIV f0 x :> f' x) (at_right 0)" "eventually (\x. DERIV g0 x :> g' x) (at_right 0)" - and lim: "((\ x. (f' x / g' x)) \ x) (at_right 0)" - shows "((\ x. f0 x / g0 x) \ x) (at_right 0)" + and lim: "filterlim (\ x. (f' x / g' x)) F (at_right 0)" + shows "filterlim (\ x. f0 x / g0 x) F (at_right 0)" proof - define f where [abs_def]: "f x = (if x \ 0 then 0 else f0 x)" for x then have "f 0 = 0" by simp @@ -1815,9 +1815,9 @@ by (rule tendsto_norm_zero_cancel) with \ have "filterlim \ (at_right 0) (at_right 0)" by (auto elim!: eventually_mono simp: filterlim_at) - from this lim have "((\t. f' (\ t) / g' (\ t)) \ x) (at_right 0)" + from this lim have "filterlim (\t. f' (\ t) / g' (\ t)) F (at_right 0)" by (rule_tac filterlim_compose[of _ _ _ \]) - ultimately have "((\t. f t / g t) \ x) (at_right 0)" (is ?P) + ultimately have "filterlim (\t. f t / g t) F (at_right 0)" (is ?P) by (rule_tac filterlim_cong[THEN iffD1, OF refl refl]) (auto elim: eventually_mono) also have "?P \ ?thesis" @@ -1831,8 +1831,8 @@ eventually (\x. g' x \ 0) (at_right x) \ eventually (\x. DERIV f x :> f' x) (at_right x) \ eventually (\x. DERIV g x :> g' x) (at_right x) \ - ((\ x. (f' x / g' x)) \ y) (at_right x) \ - ((\ x. f x / g x) \ y) (at_right x)" + filterlim (\ x. (f' x / g' x)) F (at_right x) \ + filterlim (\ x. f x / g x) F (at_right x)" for x :: real unfolding eventually_at_right_to_0[of _ x] filterlim_at_right_to_0[of _ _ x] DERIV_shift by (rule lhopital_right_0) @@ -1843,8 +1843,8 @@ eventually (\x. g' x \ 0) (at_left x) \ eventually (\x. DERIV f x :> f' x) (at_left x) \ eventually (\x. DERIV g x :> g' x) (at_left x) \ - ((\ x. (f' x / g' x)) \ y) (at_left x) \ - ((\ x. f x / g x) \ y) (at_left x)" + filterlim (\ x. (f' x / g' x)) F (at_left x) \ + filterlim (\ x. f x / g x) F (at_left x)" for x :: real unfolding eventually_at_left_to_right filterlim_at_left_to_right DERIV_mirror by (rule lhopital_right[where f'="\x. - f' (- x)"]) (auto simp: DERIV_mirror) @@ -1855,12 +1855,13 @@ eventually (\x. g' x \ 0) (at x) \ eventually (\x. DERIV f x :> f' x) (at x) \ eventually (\x. DERIV g x :> g' x) (at x) \ - ((\ x. (f' x / g' x)) \ y) (at x) \ - ((\ x. f x / g x) \ y) (at x)" + filterlim (\ x. (f' x / g' x)) F (at x) \ + filterlim (\ x. f x / g x) F (at x)" for x :: real unfolding eventually_at_split filterlim_at_split by (auto intro!: lhopital_right[of f x g g' f'] lhopital_left[of f x g g' f']) + lemma lhopital_right_0_at_top: fixes f g :: "real \ real" assumes g_0: "LIM x at_right 0. g x :> at_top" @@ -2015,4 +2016,102 @@ by eventually_elim simp qed +lemma lhopital_right_at_top_at_top: + fixes f g :: "real \ real" + assumes f_0: "LIM x at_right a. f x :> at_top" + assumes g_0: "LIM x at_right a. g x :> at_top" + and ev: + "eventually (\x. DERIV f x :> f' x) (at_right a)" + "eventually (\x. DERIV g x :> g' x) (at_right a)" + and lim: "filterlim (\ x. (f' x / g' x)) at_top (at_right a)" + shows "filterlim (\ x. f x / g x) at_top (at_right a)" +proof - + from lim have pos: "eventually (\x. f' x / g' x > 0) (at_right a)" + unfolding filterlim_at_top_dense by blast + have "((\x. g x / f x) \ 0) (at_right a)" + proof (rule lhopital_right_at_top) + from pos show "eventually (\x. f' x \ 0) (at_right a)" by eventually_elim auto + from tendsto_inverse_0_at_top[OF lim] + show "((\x. g' x / f' x) \ 0) (at_right a)" by simp + qed fact+ + moreover from f_0 g_0 + have "eventually (\x. f x > 0) (at_right a)" "eventually (\x. g x > 0) (at_right a)" + unfolding filterlim_at_top_dense by blast+ + hence "eventually (\x. g x / f x > 0) (at_right a)" by eventually_elim simp + ultimately have "filterlim (\x. inverse (g x / f x)) at_top (at_right a)" + by (rule filterlim_inverse_at_top) + thus ?thesis by simp +qed +find_theorems at_top at_bot uminus +lemma lhopital_right_at_top_at_bot: + fixes f g :: "real \ real" + assumes f_0: "LIM x at_right a. f x :> at_top" + assumes g_0: "LIM x at_right a. g x :> at_bot" + and ev: + "eventually (\x. DERIV f x :> f' x) (at_right a)" + "eventually (\x. DERIV g x :> g' x) (at_right a)" + and lim: "filterlim (\ x. (f' x / g' x)) at_bot (at_right a)" + shows "filterlim (\ x. f x / g x) at_bot (at_right a)" +proof - + from ev(2) have ev': "eventually (\x. DERIV (\x. -g x) x :> -g' x) (at_right a)" + by eventually_elim (auto intro: derivative_intros) + have "filterlim (\x. f x / (-g x)) at_top (at_right a)" + by (rule lhopital_right_at_top_at_top[where f' = f' and g' = "\x. -g' x"]) + (insert assms ev', auto simp: filterlim_uminus_at_bot) + hence "filterlim (\x. -(f x / g x)) at_top (at_right a)" by simp + thus ?thesis by (simp add: filterlim_uminus_at_bot) +qed + +lemma lhopital_left_at_top_at_top: + fixes f g :: "real \ real" + assumes f_0: "LIM x at_left a. f x :> at_top" + assumes g_0: "LIM x at_left a. g x :> at_top" + and ev: + "eventually (\x. DERIV f x :> f' x) (at_left a)" + "eventually (\x. DERIV g x :> g' x) (at_left a)" + and lim: "filterlim (\ x. (f' x / g' x)) at_top (at_left a)" + shows "filterlim (\ x. f x / g x) at_top (at_left a)" + by (insert assms, unfold eventually_at_left_to_right filterlim_at_left_to_right DERIV_mirror, + rule lhopital_right_at_top_at_top[where f'="\x. - f' (- x)"]) + (insert assms, auto simp: DERIV_mirror) + +lemma lhopital_left_at_top_at_bot: + fixes f g :: "real \ real" + assumes f_0: "LIM x at_left a. f x :> at_top" + assumes g_0: "LIM x at_left a. g x :> at_bot" + and ev: + "eventually (\x. DERIV f x :> f' x) (at_left a)" + "eventually (\x. DERIV g x :> g' x) (at_left a)" + and lim: "filterlim (\ x. (f' x / g' x)) at_bot (at_left a)" + shows "filterlim (\ x. f x / g x) at_bot (at_left a)" + by (insert assms, unfold eventually_at_left_to_right filterlim_at_left_to_right DERIV_mirror, + rule lhopital_right_at_top_at_bot[where f'="\x. - f' (- x)"]) + (insert assms, auto simp: DERIV_mirror) + +lemma lhopital_at_top_at_top: + fixes f g :: "real \ real" + assumes f_0: "LIM x at a. f x :> at_top" + assumes g_0: "LIM x at a. g x :> at_top" + and ev: + "eventually (\x. DERIV f x :> f' x) (at a)" + "eventually (\x. DERIV g x :> g' x) (at a)" + and lim: "filterlim (\ x. (f' x / g' x)) at_top (at a)" + shows "filterlim (\ x. f x / g x) at_top (at a)" + using assms unfolding eventually_at_split filterlim_at_split + by (auto intro!: lhopital_right_at_top_at_top[of f a g f' g'] + lhopital_left_at_top_at_top[of f a g f' g']) + +lemma lhopital_at_top_at_bot: + fixes f g :: "real \ real" + assumes f_0: "LIM x at a. f x :> at_top" + assumes g_0: "LIM x at a. g x :> at_bot" + and ev: + "eventually (\x. DERIV f x :> f' x) (at a)" + "eventually (\x. DERIV g x :> g' x) (at a)" + and lim: "filterlim (\ x. (f' x / g' x)) at_bot (at a)" + shows "filterlim (\ x. f x / g x) at_bot (at a)" + using assms unfolding eventually_at_split filterlim_at_split + by (auto intro!: lhopital_right_at_top_at_bot[of f a g f' g'] + lhopital_left_at_top_at_bot[of f a g f' g']) + end diff -r 2606e8c8487d -r 009e176e1010 src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Wed Aug 17 10:26:12 2016 +0200 +++ b/src/HOL/Topological_Spaces.thy Wed Aug 17 16:16:38 2016 +0200 @@ -647,6 +647,16 @@ for x :: "'a::linorder_topology" by (subst at_eq_sup_left_right) (simp add: eventually_sup) +lemma eventually_at_leftI: + assumes "\x. x \ {a<.. P x" "a < b" + shows "eventually P (at_left b)" + using assms unfolding eventually_at_topological by (intro exI[of _ "{a<..}"]) auto + +lemma eventually_at_rightI: + assumes "\x. x \ {a<.. P x" "a < b" + shows "eventually P (at_right a)" + using assms unfolding eventually_at_topological by (intro exI[of _ "{..Tendsto\ @@ -685,6 +695,18 @@ "(LIM x F. f x :> at b within s) \ eventually (\x. f x \ s \ f x \ b) F \ (f \ b) F" by (simp add: at_within_def filterlim_inf filterlim_principal conj_commute) +lemma filterlim_at_withinI: + assumes "filterlim f (nhds c) F" + assumes "eventually (\x. f x \ A - {c}) F" + shows "filterlim f (at c within A) F" + using assms by (simp add: filterlim_at) + +lemma filterlim_atI: + assumes "filterlim f (nhds c) F" + assumes "eventually (\x. f x \ c) F" + shows "filterlim f (at c) F" + using assms by (intro filterlim_at_withinI) simp_all + lemma (in topological_space) topological_tendstoI: "(\S. open S \ l \ S \ eventually (\x. f x \ S) F) \ (f \ l) F" by (auto simp: tendsto_def)