@@ -1365,26 +1365,32 @@ theorem has_deriv_within_at_inv (x_ne_zero : x ≠ 0) (s : set 𝕜) :
1365
1365
has_deriv_within_at (λx, x⁻¹) (-(x^2 )⁻¹) s x :=
1366
1366
(has_deriv_at_inv x_ne_zero).has_deriv_within_at
1367
1367
1368
- lemma differentiable_at_inv (x_ne_zero : x ≠ 0 ) :
1369
- differentiable_at 𝕜 (λx, x⁻¹) x :=
1370
- (has_deriv_at_inv x_ne_zero).differentiable_at
1368
+ lemma differentiable_at_inv :
1369
+ differentiable_at 𝕜 (λx, x⁻¹) x ↔ x ≠ 0 :=
1370
+ ⟨λ H, normed_field.continuous_at_inv.1 H.continuous_at,
1371
+ λ H, (has_deriv_at_inv H).differentiable_at⟩
1371
1372
1372
1373
lemma differentiable_within_at_inv (x_ne_zero : x ≠ 0 ) :
1373
1374
differentiable_within_at 𝕜 (λx, x⁻¹) s x :=
1374
- (differentiable_at_inv x_ne_zero).differentiable_within_at
1375
+ (differentiable_at_inv. 2 x_ne_zero).differentiable_within_at
1375
1376
1376
1377
lemma differentiable_on_inv : differentiable_on 𝕜 (λx:𝕜, x⁻¹) {x | x ≠ 0 } :=
1377
1378
λx hx, differentiable_within_at_inv hx
1378
1379
1379
- lemma deriv_inv (x_ne_zero : x ≠ 0 ) :
1380
- deriv (λx, x⁻¹) x = -(x^2 )⁻¹ :=
1381
- (has_deriv_at_inv x_ne_zero).deriv
1380
+ lemma deriv_inv : deriv (λx, x⁻¹) x = -(x^2 )⁻¹ :=
1381
+ begin
1382
+ rcases eq_or_ne x 0 with rfl|hne,
1383
+ { simp [deriv_zero_of_not_differentiable_at (mt differentiable_at_inv.1 (not_not.2 rfl))] },
1384
+ { exact (has_deriv_at_inv hne).deriv }
1385
+ end
1386
+
1387
+ @[simp] lemma deriv_inv' : deriv (λ x : 𝕜, x⁻¹) = λ x, -(x ^ 2 )⁻¹ := funext (λ x, deriv_inv)
1382
1388
1383
1389
lemma deriv_within_inv (x_ne_zero : x ≠ 0 ) (hxs : unique_diff_within_at 𝕜 s x) :
1384
1390
deriv_within (λx, x⁻¹) s x = -(x^2 )⁻¹ :=
1385
1391
begin
1386
- rw differentiable_at.deriv_within (differentiable_at_inv x_ne_zero) hxs,
1387
- exact deriv_inv x_ne_zero
1392
+ rw differentiable_at.deriv_within (differentiable_at_inv. 2 x_ne_zero) hxs,
1393
+ exact deriv_inv
1388
1394
end
1389
1395
1390
1396
lemma has_fderiv_at_inv (x_ne_zero : x ≠ 0 ) :
@@ -1395,15 +1401,15 @@ lemma has_fderiv_within_at_inv (x_ne_zero : x ≠ 0) :
1395
1401
has_fderiv_within_at (λx, x⁻¹) (smul_right (1 : 𝕜 →L[𝕜] 𝕜) (-(x^2 )⁻¹) : 𝕜 →L[𝕜] 𝕜) s x :=
1396
1402
(has_fderiv_at_inv x_ne_zero).has_fderiv_within_at
1397
1403
1398
- lemma fderiv_inv (x_ne_zero : x ≠ 0 ) :
1404
+ lemma fderiv_inv :
1399
1405
fderiv 𝕜 (λx, x⁻¹) x = smul_right (1 : 𝕜 →L[𝕜] 𝕜) (-(x^2 )⁻¹) :=
1400
- (has_fderiv_at_inv x_ne_zero).fderiv
1406
+ by rw [← deriv_fderiv, deriv_inv]
1401
1407
1402
1408
lemma fderiv_within_inv (x_ne_zero : x ≠ 0 ) (hxs : unique_diff_within_at 𝕜 s x) :
1403
1409
fderiv_within 𝕜 (λx, x⁻¹) s x = smul_right (1 : 𝕜 →L[𝕜] 𝕜) (-(x^2 )⁻¹) :=
1404
1410
begin
1405
- rw differentiable_at.fderiv_within (differentiable_at_inv x_ne_zero) hxs,
1406
- exact fderiv_inv x_ne_zero
1411
+ rw differentiable_at.fderiv_within (differentiable_at_inv. 2 x_ne_zero) hxs,
1412
+ exact fderiv_inv
1407
1413
end
1408
1414
1409
1415
variables {c : 𝕜 → 𝕜} {c' : 𝕜}
@@ -1444,7 +1450,7 @@ lemma deriv_within_inv' (hc : differentiable_within_at 𝕜 c s x) (hx : c x ≠
1444
1450
deriv_within (λx, (c x)⁻¹) s x = - (deriv_within c s x) / (c x)^2 :=
1445
1451
(hc.has_deriv_within_at.inv hx).deriv_within hxs
1446
1452
1447
- @[simp] lemma deriv_inv' (hc : differentiable_at 𝕜 c x) (hx : c x ≠ 0 ) :
1453
+ @[simp] lemma deriv_inv'' (hc : differentiable_at 𝕜 c x) (hx : c x ≠ 0 ) :
1448
1454
deriv (λx, (c x)⁻¹) x = - (deriv c x) / (c x)^2 :=
1449
1455
(hc.has_deriv_at.inv hx).deriv
1450
1456
@@ -1732,21 +1738,6 @@ lemma deriv_within_pow (hxs : unique_diff_within_at 𝕜 s x) :
1732
1738
deriv_within (λx, x^n) s x = (n : 𝕜) * x^(n-1 ) :=
1733
1739
(has_deriv_within_at_pow n x s).deriv_within hxs
1734
1740
1735
- lemma iter_deriv_pow' {k : ℕ} :
1736
- deriv^[k] (λx:𝕜, x^n) = λ x, (∏ i in finset.range k, (n - i) : ℕ) * x^(n-k) :=
1737
- begin
1738
- induction k with k ihk,
1739
- { simp only [one_mul, finset.prod_range_zero, function.iterate_zero_apply, nat.sub_zero,
1740
- nat.cast_one] },
1741
- { simp only [function.iterate_succ_apply', ihk, finset.prod_range_succ],
1742
- ext x,
1743
- rw [((has_deriv_at_pow (n - k) x).const_mul _).deriv, nat.cast_mul, mul_assoc, nat.sub_sub] }
1744
- end
1745
-
1746
- lemma iter_deriv_pow {k : ℕ} :
1747
- deriv^[k] (λx:𝕜, x^n) x = (∏ i in finset.range k, (n - i) : ℕ) * x^(n-k) :=
1748
- congr_fun iter_deriv_pow' x
1749
-
1750
1741
lemma has_deriv_within_at.pow (hc : has_deriv_within_at c c' s x) :
1751
1742
has_deriv_within_at (λ y, (c y)^n) ((n : 𝕜) * (c x)^(n-1 ) * c') s x :=
1752
1743
(has_deriv_at_pow n (c x)).comp_has_deriv_within_at x hc
@@ -1784,10 +1775,9 @@ end pow
1784
1775
1785
1776
section fpow
1786
1777
/-! ### Derivative of `x ↦ x^m` for `m : ℤ` -/
1787
- variables {x : 𝕜} {s : set 𝕜}
1788
- variable {m : ℤ}
1778
+ variables {x : 𝕜} {s : set 𝕜} {m : ℤ}
1789
1779
1790
- lemma has_strict_deriv_at_fpow (m : ℤ) (hx : x ≠ 0 ) :
1780
+ lemma has_strict_deriv_at_fpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m ) :
1791
1781
has_strict_deriv_at (λx, x^m) ((m : 𝕜) * x^(m-1 )) x :=
1792
1782
begin
1793
1783
have : ∀ m : ℤ, 0 < m → has_strict_deriv_at (λx, x^m) ((m:𝕜) * x^(m-1 )) x,
@@ -1799,7 +1789,8 @@ begin
1799
1789
norm_cast at hm,
1800
1790
exact nat.succ_le_of_lt hm },
1801
1791
rcases lt_trichotomy m 0 with hm|hm|hm,
1802
- { have := (has_strict_deriv_at_inv _).scomp _ (this (-m) (neg_pos.2 hm));
1792
+ { have hx : x ≠ 0 , from h.resolve_right hm.not_le,
1793
+ have := (has_strict_deriv_at_inv _).scomp _ (this (-m) (neg_pos.2 hm));
1803
1794
[skip, exact fpow_ne_zero_of_ne_zero hx _],
1804
1795
simp only [(∘), fpow_neg, one_div, inv_inv', smul_eq_mul] at this ,
1805
1796
convert this using 1 ,
@@ -1809,43 +1800,80 @@ begin
1809
1800
{ exact this m hm }
1810
1801
end
1811
1802
1812
- lemma has_deriv_at_fpow (m : ℤ) (hx : x ≠ 0 ) :
1803
+ lemma has_deriv_at_fpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m ) :
1813
1804
has_deriv_at (λx, x^m) ((m : 𝕜) * x^(m-1 )) x :=
1814
- (has_strict_deriv_at_fpow m hx ).has_deriv_at
1805
+ (has_strict_deriv_at_fpow m x h ).has_deriv_at
1815
1806
1816
- theorem has_deriv_within_at_fpow (m : ℤ) (hx : x ≠ 0 ) (s : set 𝕜) :
1807
+ theorem has_deriv_within_at_fpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m ) (s : set 𝕜) :
1817
1808
has_deriv_within_at (λx, x^m) ((m : 𝕜) * x^(m-1 )) s x :=
1818
- (has_deriv_at_fpow m hx ).has_deriv_within_at
1809
+ (has_deriv_at_fpow m x h ).has_deriv_within_at
1819
1810
1820
- lemma differentiable_at_fpow (hx : x ≠ 0 ) : differentiable_at 𝕜 (λx, x^m) x :=
1821
- (has_deriv_at_fpow m hx).differentiable_at
1811
+ lemma differentiable_at_fpow : differentiable_at 𝕜 (λx, x^m) x ↔ x ≠ 0 ∨ 0 ≤ m :=
1812
+ ⟨λ H, normed_field.continuous_at_fpow.1 H.continuous_at,
1813
+ λ H, (has_deriv_at_fpow m x H).differentiable_at⟩
1822
1814
1823
- lemma differentiable_within_at_fpow (hx : x ≠ 0 ) :
1815
+ lemma differentiable_within_at_fpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m ) :
1824
1816
differentiable_within_at 𝕜 (λx, x^m) s x :=
1825
- (differentiable_at_fpow hx).differentiable_within_at
1817
+ (differentiable_at_fpow.mpr h).differentiable_within_at
1818
+
1819
+ lemma differentiable_on_fpow (m : ℤ) (s : set 𝕜) (h : (0 : 𝕜) ∉ s ∨ 0 ≤ m) :
1820
+ differentiable_on 𝕜 (λx, x^m) s :=
1821
+ λ x hxs, differentiable_within_at_fpow m x $ h.imp_left $ ne_of_mem_of_not_mem hxs
1826
1822
1827
- lemma differentiable_on_fpow (hs : (0 :𝕜) ∉ s) : differentiable_on 𝕜 (λx, x^m) s :=
1828
- λ x hxs, differentiable_within_at_fpow (λ hx, hs $ hx ▸ hxs)
1823
+ lemma deriv_fpow (m : ℤ) (x : 𝕜) : deriv (λ x, x ^ m) x = m * x ^ (m - 1 ) :=
1824
+ begin
1825
+ by_cases H : x ≠ 0 ∨ 0 ≤ m,
1826
+ { exact (has_deriv_at_fpow m x H).deriv },
1827
+ { rw deriv_zero_of_not_differentiable_at (mt differentiable_at_fpow.1 H),
1828
+ push_neg at H, rcases H with ⟨rfl, hm⟩,
1829
+ rw [zero_fpow _ ((sub_one_lt _).trans hm).ne, mul_zero] }
1830
+ end
1829
1831
1830
- -- TODO : this is true at `x=0` as well
1831
- lemma deriv_fpow (hx : x ≠ 0 ) : deriv (λx, x^m) x = (m : 𝕜) * x^(m-1 ) :=
1832
- (has_deriv_at_fpow m hx).deriv
1832
+ @[simp] lemma deriv_fpow' (m : ℤ) : deriv (λ x : 𝕜, x ^ m) = λ x, m * x ^ (m - 1 ) :=
1833
+ funext $ deriv_fpow m
1833
1834
1834
- lemma deriv_within_fpow (hxs : unique_diff_within_at 𝕜 s x) (hx : x ≠ 0 ) :
1835
+ lemma deriv_within_fpow (hxs : unique_diff_within_at 𝕜 s x) (h : x ≠ 0 ∨ 0 ≤ m ) :
1835
1836
deriv_within (λx, x^m) s x = (m : 𝕜) * x^(m-1 ) :=
1836
- (has_deriv_within_at_fpow m hx s).deriv_within hxs
1837
+ (has_deriv_within_at_fpow m x h s).deriv_within hxs
1838
+
1839
+ @[simp] lemma iter_deriv_fpow' (m : ℤ) (k : ℕ) :
1840
+ deriv^[k] (λ x : 𝕜, x ^ m) = λ x, (∏ i in finset.range k, (m - i)) * x ^ (m - k) :=
1841
+ begin
1842
+ induction k with k ihk,
1843
+ { simp only [one_mul, int.coe_nat_zero, id, sub_zero, finset.prod_range_zero,
1844
+ function.iterate_zero] },
1845
+ { simp only [function.iterate_succ_apply', ihk, deriv_const_mul', deriv_fpow',
1846
+ finset.prod_range_succ, int.coe_nat_succ, ← sub_sub, int.cast_sub, int.cast_coe_nat,
1847
+ mul_assoc], }
1848
+ end
1849
+
1850
+ lemma iter_deriv_fpow (m : ℤ) (x : 𝕜) (k : ℕ) :
1851
+ deriv^[k] (λ y, y ^ m) x = (∏ i in finset.range k, (m - i)) * x ^ (m - k) :=
1852
+ congr_fun (iter_deriv_fpow' m k) x
1837
1853
1838
- lemma iter_deriv_fpow {k : ℕ} (hx : x ≠ 0 ) :
1839
- deriv^[k] (λx:𝕜, x^m ) x = (∏ i in finset.range k, (m - i) : ℤ ) * x^(m -k) :=
1854
+ lemma iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ ) :
1855
+ deriv^[k] (λx:𝕜, x^n ) x = (∏ i in finset.range k, (n - i)) * x^(n -k) :=
1840
1856
begin
1841
- induction k with k ihk generalizing x hx ,
1842
- { simp only [one_mul, finset.prod_range_zero, function.iterate_zero_apply, int.coe_nat_zero ,
1843
- sub_zero, int.cast_one] },
1844
- { rw [function.iterate_succ', finset.prod_range_succ, int.cast_mul, mul_assoc ,
1845
- int.coe_nat_succ, ← sub_sub, ← ((has_deriv_at_fpow _ hx).const_mul _).deriv] ,
1846
- exact filter.eventually_eq.deriv_eq (eventually.mono (is_open.mem_nhds is_open_ne hx) @ihk) }
1857
+ simp only [← gpow_coe_nat, iter_deriv_fpow, int.cast_coe_nat] ,
1858
+ cases le_or_lt k n with hkn hnk ,
1859
+ { rw int.coe_nat_sub hkn },
1860
+ { have : ∏ i in finset.range k, (n - i : 𝕜) = 0 ,
1861
+ from finset.prod_eq_zero (finset.mem_range. 2 hnk) (sub_self _) ,
1862
+ simp only [ this , zero_mul] }
1847
1863
end
1848
1864
1865
+ @[simp] lemma iter_deriv_pow' (n k : ℕ) :
1866
+ deriv^[k] (λ x : 𝕜, x ^ n) = λ x, (∏ i in finset.range k, (n - i)) * x ^ (n - k) :=
1867
+ funext $ λ x, iter_deriv_pow n x k
1868
+
1869
+ lemma iter_deriv_inv (k : ℕ) (x : 𝕜) :
1870
+ deriv^[k] has_inv.inv x = (∏ i in finset.range k, (-1 - i)) * x ^ (-1 - k : ℤ) :=
1871
+ by simpa only [fpow_neg_one, int.cast_neg, int.cast_one] using iter_deriv_fpow (-1 ) x k
1872
+
1873
+ @[simp] lemma iter_deriv_inv' (k : ℕ) :
1874
+ deriv^[k] has_inv.inv = λ x : 𝕜, (∏ i in finset.range k, (-1 - i)) * x ^ (-1 - k : ℤ) :=
1875
+ funext (iter_deriv_inv k)
1876
+
1849
1877
end fpow
1850
1878
1851
1879
/-! ### Upper estimates on liminf and limsup -/
0 commit comments