Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit b7148c4

Browse files
committed
feat(analysis/special_functions/pow): Rational powers are dense (#15002)
There is a rational square between any two positive elements of an archimedean ordered field. Co-authored-by: Alex Best <alex.j.best@gmail.com>
1 parent e3e4cc6 commit b7148c4

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

src/analysis/special_functions/pow.lean

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,43 @@ end
13141314

13151315
end nnreal
13161316

1317+
namespace real
1318+
variables {n : ℕ}
1319+
1320+
lemma exists_rat_pow_btwn_rat_aux (hn : n ≠ 0) (x y : ℝ) (h : x < y) (hy : 0 < y) :
1321+
∃ q : ℚ, 0 < q ∧ x < q^n ∧ ↑q^n < y :=
1322+
begin
1323+
have hn' : 0 < (n : ℝ) := by exact_mod_cast hn.bot_lt,
1324+
obtain ⟨q, hxq, hqy⟩ := exists_rat_btwn (rpow_lt_rpow (le_max_left 0 x) (max_lt hy h) $
1325+
inv_pos.mpr hn'),
1326+
have := rpow_nonneg_of_nonneg (le_max_left 0 x) n⁻¹,
1327+
have hq := this.trans_lt hxq,
1328+
replace hxq := rpow_lt_rpow this hxq hn',
1329+
replace hqy := rpow_lt_rpow hq.le hqy hn',
1330+
rw [rpow_nat_cast, rpow_nat_cast, rpow_nat_inv_pow_nat _ hn.bot_lt] at hxq hqy,
1331+
exact ⟨q, by exact_mod_cast hq, (le_max_right _ _).trans_lt hxq, hqy⟩,
1332+
{ exact le_max_left _ _ },
1333+
{ exact hy.le }
1334+
end
1335+
1336+
lemma exists_rat_pow_btwn_rat (hn : n ≠ 0) {x y : ℚ} (h : x < y) (hy : 0 < y) :
1337+
∃ q : ℚ, 0 < q ∧ x < q^n ∧ q^n < y :=
1338+
by apply_mod_cast exists_rat_pow_btwn_rat_aux hn x y; assumption
1339+
1340+
/-- There is a rational power between any two positive elements of an archimedean ordered field. -/
1341+
lemma exists_rat_pow_btwn {α : Type*} [linear_ordered_field α] [archimedean α] (hn : n ≠ 0)
1342+
{x y : α} (h : x < y) (hy : 0 < y) : ∃ q : ℚ, 0 < q ∧ x < q^n ∧ (q^n : α) < y :=
1343+
begin
1344+
obtain ⟨q₂, hx₂, hy₂⟩ := exists_rat_btwn (max_lt h hy),
1345+
obtain ⟨q₁, hx₁, hq₁₂⟩ := exists_rat_btwn hx₂,
1346+
have : (0 : α) < q₂ := (le_max_right _ _).trans_lt hx₂,
1347+
norm_cast at hq₁₂ this,
1348+
obtain ⟨q, hq, hq₁, hq₂⟩ := exists_rat_pow_btwn_rat hn hq₁₂ this,
1349+
refine ⟨q, hq, (le_max_left _ _).trans_lt $ hx₁.trans _, hy₂.trans' _⟩; assumption_mod_cast,
1350+
end
1351+
1352+
end real
1353+
13171354
open filter
13181355

13191356
lemma filter.tendsto.nnrpow {α : Type*} {f : filter α} {u : α → ℝ≥0} {v : α → ℝ} {x : ℝ≥0} {y : ℝ}

src/data/real/sqrt.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ theorem neg_sqrt_lt_of_sq_lt (h : x^2 < y) : -sqrt y < x := (sq_lt.mp h).1
306306

307307
theorem lt_sqrt_of_sq_lt (h : x^2 < y) : x < sqrt y := (sq_lt.mp h).2
308308

309+
lemma lt_sq_of_sqrt_lt {x y : ℝ} (h : sqrt x < y) : x < y ^ 2 :=
310+
by { have hy := x.sqrt_nonneg.trans_lt h,
311+
rwa [←sqrt_lt_sqrt_iff_of_pos (sq_pos_of_pos hy), sqrt_sq hy.le] }
312+
309313
/-- The natural square root is at most the real square root -/
310314
lemma nat_sqrt_le_real_sqrt {a : ℕ} : ↑(nat.sqrt a) ≤ real.sqrt ↑a :=
311315
begin

0 commit comments

Comments
 (0)