Skip to content

Commit 0042730

Browse files
committed
refactor(NumberTheory): golf Mathlib/NumberTheory/ADEInequality (#38351)
- golfs `ADEInequality` by replacing repeated `inv_le_inv₀` proof blocks with direct applications of `inv_anti₀` - shortens `lt_three`, `lt_four`, and `lt_six` by removing the now-unneeded fixed-denominator positivity witnesses Extracted from #38144 [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)
1 parent dd46575 commit 0042730

1 file changed

Lines changed: 6 additions & 27 deletions

File tree

Mathlib/NumberTheory/ADEInequality.lean

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -152,52 +152,31 @@ theorem Admissible.one_lt_sumInv {pqr : Multiset ℕ+} : Admissible pqr → 1 <
152152
norm_num
153153

154154
theorem lt_three {p q r : ℕ+} (hpq : p ≤ q) (hqr : q ≤ r) (H : 1 < sumInv {p, q, r}) : p < 3 := by
155-
have h3 : (0 : ℚ) < 3 := by simp
156155
contrapose! H
157156
rw [sumInv_pqr]
158157
have h3q := H.trans hpq
159158
have h3r := h3q.trans hqr
160-
have hp : (p : ℚ)⁻¹ ≤ 3⁻¹ := by
161-
rw [inv_le_inv₀ _ h3]
162-
· assumption_mod_cast
163-
· simp
164-
have hq : (q : ℚ)⁻¹ ≤ 3⁻¹ := by
165-
rw [inv_le_inv₀ _ h3]
166-
· assumption_mod_cast
167-
· simp
168-
have hr : (r : ℚ)⁻¹ ≤ 3⁻¹ := by
169-
rw [inv_le_inv₀ _ h3]
170-
· assumption_mod_cast
171-
· simp
159+
have hp : (p : ℚ)⁻¹ ≤ 3⁻¹ := inv_anti₀ (by positivity) (by exact_mod_cast H)
160+
have hq : (q : ℚ)⁻¹ ≤ 3⁻¹ := inv_anti₀ (by positivity) (by exact_mod_cast h3q)
161+
have hr : (r : ℚ)⁻¹ ≤ 3⁻¹ := inv_anti₀ (by positivity) (by exact_mod_cast h3r)
172162
calc
173163
(p : ℚ)⁻¹ + (q : ℚ)⁻¹ + (r : ℚ)⁻¹ ≤ 3⁻¹ + 3⁻¹ + 3⁻¹ := add_le_add (add_le_add hp hq) hr
174164
_ = 1 := by norm_num
175165

176166
theorem lt_four {q r : ℕ+} (hqr : q ≤ r) (H : 1 < sumInv {2, q, r}) : q < 4 := by
177-
have h4 : (0 : ℚ) < 4 := by simp
178167
contrapose! H
179168
rw [sumInv_pqr]
180169
have h4r := H.trans hqr
181-
have hq : (q : ℚ)⁻¹ ≤ 4⁻¹ := by
182-
rw [inv_le_inv₀ _ h4]
183-
· assumption_mod_cast
184-
· simp
185-
have hr : (r : ℚ)⁻¹ ≤ 4⁻¹ := by
186-
rw [inv_le_inv₀ _ h4]
187-
· assumption_mod_cast
188-
· simp
170+
have hq : (q : ℚ)⁻¹ ≤ 4⁻¹ := inv_anti₀ (by positivity) (by exact_mod_cast H)
171+
have hr : (r : ℚ)⁻¹ ≤ 4⁻¹ := inv_anti₀ (by positivity) (by exact_mod_cast h4r)
189172
calc
190173
(2⁻¹ + (q : ℚ)⁻¹ + (r : ℚ)⁻¹) ≤ 2⁻¹ + 4⁻¹ + 4⁻¹ := add_le_add (add_le_add le_rfl hq) hr
191174
_ = 1 := by norm_num
192175

193176
theorem lt_six {r : ℕ+} (H : 1 < sumInv {2, 3, r}) : r < 6 := by
194-
have h6 : (0 : ℚ) < 6 := by simp
195177
contrapose! H
196178
rw [sumInv_pqr]
197-
have hr : (r : ℚ)⁻¹ ≤ 6⁻¹ := by
198-
rw [inv_le_inv₀ _ h6]
199-
· assumption_mod_cast
200-
· simp
179+
have hr : (r : ℚ)⁻¹ ≤ 6⁻¹ := inv_anti₀ (by positivity) (by exact_mod_cast H)
201180
calc
202181
(2⁻¹ + 3⁻¹ + (r : ℚ)⁻¹ : ℚ) ≤ 2⁻¹ + 3⁻¹ + 6⁻¹ := add_le_add (add_le_add le_rfl le_rfl) hr
203182
_ = 1 := by norm_num

0 commit comments

Comments
 (0)