diff -r 3793c3a11378 -r ef949192e5d6 src/HOL/Deriv.thy --- a/src/HOL/Deriv.thy Fri Mar 22 10:41:43 2013 +0100 +++ b/src/HOL/Deriv.thy Fri Mar 22 10:41:43 2013 +0100 @@ -831,16 +831,7 @@ lemma lemma_MVT: "f a - (f b - f a)/(b-a) * a = f b - (f b - f a)/(b-a) * (b::real)" -proof cases - assume "a=b" thus ?thesis by simp -next - assume "a\b" - hence ba: "b-a \ 0" by arith - show ?thesis - by (rule real_mult_left_cancel [OF ba, THEN iffD1], - simp add: right_diff_distrib, - simp add: left_diff_distrib) -qed + by (cases "a = b") (simp_all add: field_simps) theorem MVT: assumes lt: "a < b" @@ -1090,152 +1081,47 @@ by simp qed -subsection {* Continuous injective functions *} - -text{*Dull lemma: an continuous injection on an interval must have a -strict maximum at an end point, not in the middle.*} - -lemma lemma_isCont_inj: - fixes f :: "real \ real" - assumes d: "0 < d" - and inj [rule_format]: "\z. \z-x\ \ d --> g(f z) = z" - and cont: "\z. \z-x\ \ d --> isCont f z" - shows "\z. \z-x\ \ d & f x < f z" -proof (rule ccontr) - assume "~ (\z. \z-x\ \ d & f x < f z)" - hence all [rule_format]: "\z. \z - x\ \ d --> f z \ f x" by auto - show False - proof (cases rule: linorder_le_cases [of "f(x-d)" "f(x+d)"]) - case le - from d cont all [of "x+d"] - have flef: "f(x+d) \ f x" - and xlex: "x - d \ x" - and cont': "\z. x - d \ z \ z \ x \ isCont f z" - by (auto simp add: abs_if) - from IVT [OF le flef xlex cont'] - obtain x' where "x-d \ x'" "x' \ x" "f x' = f(x+d)" by blast - moreover - hence "g(f x') = g (f(x+d))" by simp - ultimately show False using d inj [of x'] inj [of "x+d"] - by (simp add: abs_le_iff) - next - case ge - from d cont all [of "x-d"] - have flef: "f(x-d) \ f x" - and xlex: "x \ x+d" - and cont': "\z. x \ z \ z \ x+d \ isCont f z" - by (auto simp add: abs_if) - from IVT2 [OF ge flef xlex cont'] - obtain x' where "x \ x'" "x' \ x+d" "f x' = f(x-d)" by blast - moreover - hence "g(f x') = g (f(x-d))" by simp - ultimately show False using d inj [of x'] inj [of "x-d"] - by (simp add: abs_le_iff) - qed -qed - - -text{*Similar version for lower bound.*} - -lemma lemma_isCont_inj2: - fixes f g :: "real \ real" - shows "[|0 < d; \z. \z-x\ \ d --> g(f z) = z; - \z. \z-x\ \ d --> isCont f z |] - ==> \z. \z-x\ \ d & f z < f x" -apply (insert lemma_isCont_inj - [where f = "%x. - f x" and g = "%y. g(-y)" and x = x and d = d]) -apply (simp add: linorder_not_le) -done - -text{*Show there's an interval surrounding @{term "f(x)"} in -@{text "f[[x - d, x + d]]"} .*} - -lemma isCont_inj_range: - fixes f :: "real \ real" - assumes d: "0 < d" - and inj: "\z. \z-x\ \ d --> g(f z) = z" - and cont: "\z. \z-x\ \ d --> isCont f z" - shows "\e>0. \y. \y - f x\ \ e --> (\z. \z-x\ \ d & f z = y)" -proof - - have "x-d \ x+d" "\z. x-d \ z \ z \ x+d \ isCont f z" using cont d - by (auto simp add: abs_le_iff) - from isCont_Lb_Ub [OF this] - obtain L M - where all1 [rule_format]: "\z. x-d \ z \ z \ x+d \ L \ f z \ f z \ M" - and all2 [rule_format]: - "\y. L \ y \ y \ M \ (\z. x-d \ z \ z \ x+d \ f z = y)" - by auto - with d have "L \ f x & f x \ M" by simp - moreover have "L \ f x" - proof - - from lemma_isCont_inj2 [OF d inj cont] - obtain u where "\u - x\ \ d" "f u < f x" by auto - thus ?thesis using all1 [of u] by arith - qed - moreover have "f x \ M" - proof - - from lemma_isCont_inj [OF d inj cont] - obtain u where "\u - x\ \ d" "f x < f u" by auto - thus ?thesis using all1 [of u] by arith - qed - ultimately have "L < f x & f x < M" by arith - hence "0 < f x - L" "0 < M - f x" by arith+ - from real_lbound_gt_zero [OF this] - obtain e where e: "0 < e" "e < f x - L" "e < M - f x" by auto - thus ?thesis - proof (intro exI conjI) - show "0y. \y - f x\ \ e \ (\z. \z - x\ \ d \ f z = y)" - proof (intro strip) - fix y::real - assume "\y - f x\ \ e" - with e have "L \ y \ y \ M" by arith - from all2 [OF this] - obtain z where "x - d \ z" "z \ x + d" "f z = y" by blast - thus "\z. \z - x\ \ d \ f z = y" - by (force simp add: abs_le_iff) - qed - qed -qed - - text{*Continuity of inverse function*} lemma isCont_inverse_function: fixes f g :: "real \ real" assumes d: "0 < d" - and inj: "\z. \z-x\ \ d --> g(f z) = z" - and cont: "\z. \z-x\ \ d --> isCont f z" + and inj: "\z. \z-x\ \ d \ g (f z) = z" + and cont: "\z. \z-x\ \ d \ isCont f z" shows "isCont g (f x)" -proof (simp add: isCont_iff LIM_eq) - show "\r. 0 < r \ - (\s>0. \z. z\0 \ \z\ < s \ \g(f x + z) - g(f x)\ < r)" - proof (intro strip) - fix r::real - assume r: "0 e < d" by blast - with inj cont - have e_simps: "\z. \z-x\ \ e --> g (f z) = z" - "\z. \z-x\ \ e --> isCont f z" by auto - from isCont_inj_range [OF e this] - obtain e' where e': "0 < e'" - and all: "\y. \y - f x\ \ e' \ (\z. \z - x\ \ e \ f z = y)" - by blast - show "\s>0. \z. z\0 \ \z\ < s \ \g(f x + z) - g(f x)\ < r" - proof (intro exI conjI) - show "0z. z \ 0 \ \z\ < e' \ \g (f x + z) - g (f x)\ < r" - proof (intro strip) - fix z::real - assume z: "z \ 0 \ \z\ < e'" - with e e_lt e_simps all [rule_format, of "f x + z"] - show "\g (f x + z) - g (f x)\ < r" by force - qed - qed - qed +proof - + let ?A = "f (x - d)" and ?B = "f (x + d)" and ?D = "{x - d..x + d}" + + have f: "continuous_on ?D f" + using cont by (intro continuous_at_imp_continuous_on ballI) auto + then have g: "continuous_on (f`?D) g" + using inj by (intro continuous_on_inv) auto + + from d f have "{min ?A ?B <..< max ?A ?B} \ f ` ?D" + by (intro connected_contains_Ioo connected_continuous_image) (auto split: split_min split_max) + with g have "continuous_on {min ?A ?B <..< max ?A ?B} g" + by (rule continuous_on_subset) + moreover + have "(?A < f x \ f x < ?B) \ (?B < f x \ f x < ?A)" + using d inj by (intro continuous_inj_imp_mono[OF _ _ f] inj_on_imageI2[of g, OF inj_onI]) auto + then have "f x \ {min ?A ?B <..< max ?A ?B}" + by auto + ultimately + show ?thesis + by (simp add: continuous_on_eq_continuous_at) qed +lemma isCont_inverse_function2: + fixes f g :: "real \ real" shows + "\a < x; x < b; + \z. a \ z \ z \ b \ g (f z) = z; + \z. a \ z \ z \ b \ isCont f z\ + \ isCont g (f x)" +apply (rule isCont_inverse_function + [where f=f and d="min (x - a) (b - x)"]) +apply (simp_all add: abs_le_iff) +done + text {* Derivative of inverse function *} lemma DERIV_inverse_function: @@ -1285,7 +1171,6 @@ using neq by (rule tendsto_inverse) qed - subsection {* Generalized Mean Value Theorem *} theorem GMVT: @@ -1355,21 +1240,6 @@ ==> isCont g (f x)" by (rule isCont_inverse_function) -lemma isCont_inv_fun_inv: - fixes f g :: "real \ real" - shows "[| 0 < d; - \z. \z - x\ \ d --> g(f(z)) = z; - \z. \z - x\ \ d --> isCont f z |] - ==> \e. 0 < e & - (\y. 0 < \y - f(x)\ & \y - f(x)\ < e --> f(g(y)) = y)" -apply (drule isCont_inj_range) -prefer 2 apply (assumption, assumption, auto) -apply (rule_tac x = e in exI, auto) -apply (rotate_tac 2) -apply (drule_tac x = y in spec, auto) -done - - text{*Bartle/Sherbert: Introduction to Real Analysis, Theorem 4.2.9, p. 110*} lemma LIM_fun_gt_zero: "[| f -- c --> (l::real); 0 < l |]