Skip to content

Commit fff759c

Browse files
committed
refactor(NumberTheory): golf Mathlib/NumberTheory/Pell (leanprover-community#39378)
- simplifies the `a = 1` case in `eq_pow_of_nonneg` by using `eq_one_or_neg_one_iff_y_eq_zero` instead of a manual contradiction argument Extracted from leanprover-community#38144 [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)
1 parent f50a2d4 commit fff759c

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

Mathlib/NumberTheory/Pell.lean

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -594,15 +594,9 @@ theorem eq_pow_of_nonneg {a₁ : Solution₁ d} (h : IsFundamental a₁) {a : So
594594
rcases hay.eq_or_lt with hy | hy
595595
· -- case 1: `a = 1`
596596
refine ⟨0, ?_⟩
597-
simp only [pow_zero]
598-
ext <;> simp only [x_one, y_one]
599-
· have prop := a.prop
600-
rw [← hy, sq (0 : ℤ), zero_mul, mul_zero, sub_zero,
601-
sq_eq_one_iff] at prop
602-
refine prop.resolve_right fun hf => ?_
603-
have := (hax.trans_eq hax').le.trans_eq hf
604-
norm_num at this
605-
· exact hy.symm
597+
rcases eq_one_or_neg_one_iff_y_eq_zero.2 hy.symm with rfl | rfl
598+
· simp
599+
· simp at hax'
606600
· -- case 2: `a ≥ a₁`
607601
have hx₁ : 1 < a.x := by nlinarith [a.prop, h.d_pos]
608602
have hxx₁ := h.mul_inv_x_pos hx₁ hy

0 commit comments

Comments
 (0)