1625 and g'_neq_0: "\<And>x. 0 < x \<Longrightarrow> x < a \<Longrightarrow> g' x \<noteq> 0" |
1625 and g'_neq_0: "\<And>x. 0 < x \<Longrightarrow> x < a \<Longrightarrow> g' x \<noteq> 0" |
1626 and f: "\<And>x. 0 < x \<Longrightarrow> x < a \<Longrightarrow> DERIV f x :> (f' x)" |
1626 and f: "\<And>x. 0 < x \<Longrightarrow> x < a \<Longrightarrow> DERIV f x :> (f' x)" |
1627 and g: "\<And>x. 0 < x \<Longrightarrow> x < a \<Longrightarrow> DERIV g x :> (g' x)" |
1627 and g: "\<And>x. 0 < x \<Longrightarrow> x < a \<Longrightarrow> DERIV g x :> (g' x)" |
1628 unfolding eventually_within eventually_at by (auto simp: dist_real_def) |
1628 unfolding eventually_within eventually_at by (auto simp: dist_real_def) |
1629 |
1629 |
1630 { fix x assume x: "0 \<le> x" "x < a" |
|
1631 from `0 \<le> x` have "isCont f x" |
|
1632 unfolding le_less |
|
1633 proof |
|
1634 assume "0 = x" with `isCont f 0` show "isCont f x" by simp |
|
1635 next |
|
1636 assume "0 < x" with f x show ?thesis by (auto intro!: DERIV_isCont) |
|
1637 qed } |
|
1638 note isCont_f = this |
|
1639 |
|
1640 { fix x assume x: "0 \<le> x" "x < a" |
|
1641 from `0 \<le> x` have "isCont g x" |
|
1642 unfolding le_less |
|
1643 proof |
|
1644 assume "0 = x" with `isCont g 0` show "isCont g x" by simp |
|
1645 next |
|
1646 assume "0 < x" with g x show ?thesis by (auto intro!: DERIV_isCont) |
|
1647 qed } |
|
1648 note isCont_g = this |
|
1649 |
|
1650 have "\<exists>\<zeta>. \<forall>x\<in>{0 <..< a}. 0 < \<zeta> x \<and> \<zeta> x < x \<and> f x / g x = f' (\<zeta> x) / g' (\<zeta> x)" |
1630 have "\<exists>\<zeta>. \<forall>x\<in>{0 <..< a}. 0 < \<zeta> x \<and> \<zeta> x < x \<and> f x / g x = f' (\<zeta> x) / g' (\<zeta> x)" |
1651 proof (rule bchoice, rule) |
1631 proof (rule bchoice, rule) |
1652 fix x assume "x \<in> {0 <..< a}" |
1632 fix x assume "x \<in> {0 <..< a}" |
1653 then have x[arith]: "0 < x" "x < a" by auto |
1633 then have x[arith]: "0 < x" "x < a" by auto |
1654 with g'_neq_0 g_neq_0 `g 0 = 0` have g': "\<And>x. 0 < x \<Longrightarrow> x < a \<Longrightarrow> 0 \<noteq> g' x" "g 0 \<noteq> g x" |
1634 with g'_neq_0 g_neq_0 `g 0 = 0` have g': "\<And>x. 0 < x \<Longrightarrow> x < a \<Longrightarrow> 0 \<noteq> g' x" "g 0 \<noteq> g x" |
1655 by auto |
1635 by auto |
1656 |
1636 have "\<And>x. 0 \<le> x \<Longrightarrow> x < a \<Longrightarrow> isCont f x" |
1657 have "\<exists>c. 0 < c \<and> c < x \<and> (f x - f 0) * g' c = (g x - g 0) * f' c" |
1637 using `isCont f 0` f by (auto intro: DERIV_isCont simp: le_less) |
1658 using isCont_f isCont_g f g `x < a` by (intro GMVT') auto |
1638 moreover have "\<And>x. 0 \<le> x \<Longrightarrow> x < a \<Longrightarrow> isCont g x" |
|
1639 using `isCont g 0` g by (auto intro: DERIV_isCont simp: le_less) |
|
1640 ultimately have "\<exists>c. 0 < c \<and> c < x \<and> (f x - f 0) * g' c = (g x - g 0) * f' c" |
|
1641 using f g `x < a` by (intro GMVT') auto |
1659 then guess c .. |
1642 then guess c .. |
1660 moreover |
1643 moreover |
1661 with g'(1)[of c] g'(2) have "(f x - f 0) / (g x - g 0) = f' c / g' c" |
1644 with g'(1)[of c] g'(2) have "(f x - f 0) / (g x - g 0) = f' c / g' c" |
1662 by (simp add: field_simps) |
1645 by (simp add: field_simps) |
1663 ultimately show "\<exists>y. 0 < y \<and> y < x \<and> f x / g x = f' y / g' y" |
1646 ultimately show "\<exists>y. 0 < y \<and> y < x \<and> f x / g x = f' y / g' y" |
1677 with \<zeta> have "filterlim \<zeta> (at_right 0) (at_right 0)" |
1660 with \<zeta> have "filterlim \<zeta> (at_right 0) (at_right 0)" |
1678 by (auto elim!: eventually_elim1 simp: filterlim_within filterlim_at) |
1661 by (auto elim!: eventually_elim1 simp: filterlim_within filterlim_at) |
1679 from this lim have "((\<lambda>t. f' (\<zeta> t) / g' (\<zeta> t)) ---> x) (at_right 0)" |
1662 from this lim have "((\<lambda>t. f' (\<zeta> t) / g' (\<zeta> t)) ---> x) (at_right 0)" |
1680 by (rule_tac filterlim_compose[of _ _ _ \<zeta>]) |
1663 by (rule_tac filterlim_compose[of _ _ _ \<zeta>]) |
1681 ultimately show "((\<lambda>t. f t / g t) ---> x) (at_right 0)" |
1664 ultimately show "((\<lambda>t. f t / g t) ---> x) (at_right 0)" |
1682 apply (rule_tac filterlim_cong[THEN iffD1, OF refl refl]) |
1665 by (rule_tac filterlim_cong[THEN iffD1, OF refl refl]) |
1683 apply (erule_tac eventually_elim1) |
1666 (auto elim: eventually_elim1) |
1684 apply simp_all |
|
1685 done |
|
1686 qed |
1667 qed |
1687 |
1668 |
1688 lemma lhopital_right_0_at_top: |
1669 lemma lhopital_right_0_at_top: |
1689 fixes f g :: "real \<Rightarrow> real" |
1670 fixes f g :: "real \<Rightarrow> real" |
1690 assumes g_0: "LIM x at_right 0. g x :> at_top" |
1671 assumes g_0: "LIM x at_right 0. g x :> at_top" |
1707 and g0: "\<And>x. 0 < x \<Longrightarrow> x \<le> a \<Longrightarrow> DERIV g x :> (g' x)" |
1688 and g0: "\<And>x. 0 < x \<Longrightarrow> x \<le> a \<Longrightarrow> DERIV g x :> (g' x)" |
1708 and Df: "\<And>t. 0 < t \<Longrightarrow> t < a \<Longrightarrow> dist (f' t / g' t) x < e / 4" |
1689 and Df: "\<And>t. 0 < t \<Longrightarrow> t < a \<Longrightarrow> dist (f' t / g' t) x < e / 4" |
1709 unfolding eventually_within_le by (auto simp: dist_real_def) |
1690 unfolding eventually_within_le by (auto simp: dist_real_def) |
1710 |
1691 |
1711 from Df have |
1692 from Df have |
1712 "eventually (\<lambda>t. t < a) (at_right 0)" |
1693 "eventually (\<lambda>t. t < a) (at_right 0)" "eventually (\<lambda>t::real. 0 < t) (at_right 0)" |
1713 "eventually (\<lambda>t::real. 0 < t) (at_right 0)" |
|
1714 unfolding eventually_within eventually_at by (auto intro!: exI[of _ a] simp: dist_real_def) |
1694 unfolding eventually_within eventually_at by (auto intro!: exI[of _ a] simp: dist_real_def) |
|
1695 |
1715 moreover |
1696 moreover |
1716 |
1697 have "eventually (\<lambda>t. 0 < g t) (at_right 0)" "eventually (\<lambda>t. g a < g t) (at_right 0)" |
1717 have "eventually (\<lambda>t. 0 < g t) (at_right 0)" |
1698 using g_0 by (auto elim: eventually_elim1 simp: filterlim_at_top) |
1718 using g_0[unfolded filterlim_at_top, rule_format, of "1"] by eventually_elim auto |
1699 |
1719 |
|
1720 moreover |
|
1721 |
|
1722 have "eventually (\<lambda>t. g a < g t) (at_right 0)" |
|
1723 using g_0[unfolded filterlim_at_top, rule_format, of "g a + 1"] by eventually_elim auto |
|
1724 moreover |
1700 moreover |
1725 have inv_g: "((\<lambda>x. inverse (g x)) ---> 0) (at_right 0)" |
1701 have inv_g: "((\<lambda>x. inverse (g x)) ---> 0) (at_right 0)" |
1726 using tendsto_inverse_0 filterlim_mono[OF g_0 at_top_le_at_infinity order_refl] |
1702 using tendsto_inverse_0 filterlim_mono[OF g_0 at_top_le_at_infinity order_refl] |
1727 by (rule filterlim_compose) |
1703 by (rule filterlim_compose) |
1728 then have "((\<lambda>x. norm (1 - g a * inverse (g x))) ---> norm (1 - g a * 0)) (at_right 0)" |
1704 then have "((\<lambda>x. norm (1 - g a * inverse (g x))) ---> norm (1 - g a * 0)) (at_right 0)" |