fact
stringlengths
19
5.66k
type
stringclasses
8 values
library
stringclasses
2 values
imports
listlengths
1
14
filename
stringclasses
160 values
symbolic_name
stringlengths
1
92
docstring
stringlengths
12
499
PNat.pow_add_pow_ne_pow (x y z : ℕ+) (n : ℕ) (hn : n > 2) : x^n + y^n ≠ z^n := PNat.pow_add_pow_ne_pow_of_FermatLastTheorem Wiles_Taylor_Wiles x y z n hn #print axioms PNat.pow_add_pow_ne_pow /- 'PNat.pow_add_pow_ne_pow' depends on axioms: [propext, sorryAx, Classical.choice, Quot.sound] -/ -- The project will be complete when `sorryAx` is no longer -- mentioned in the output of this last command.
theorem
root
[ "import FLT -- import the project files" ]
FermatsLastTheorem.lean
PNat.pow_add_pow_ne_pow
/-- Fermat's Last Theorem for positive naturals. -/
knownin1980s {P : Prop} : P /-- `knownin1980s` is a term which provides a proof of an arbitrary proposition. In this current phase of the FLT project, `knownin1980s` will be allowed as a proof of any theorem which would have been easy for an expert to deduce from the pre-1990 literature. This stretches from standard easy statements about things like elliptic curves to much deeper results which are relatively short derivations from deep results published pre-1990 such as Taylor's theorem attaching Galois representations to Hilbert modular forms, Langlands' work on cyclic base change and so on. An invocation of `knownin1980s` should always be accompanied by comments which indicate how one might prove this theorem using only results which were in the mathematical literature before 1990. Note that it does not have to be a precise reference to the literature; an argument which is not explicitly in the literature but which is relatively short and uses only techniques known in the 1980s is fine. -/ macro "knownin1980s" : tactic => `(tactic| exact knownin1980s)
axiom
FLT
[ "import Mathlib.Init" ]
FLT/Assumptions/KnownIn1980s.lean
knownin1980s
null
Mazur_statement (E : WeierstrassCurve ℚ) [E.IsElliptic] : (AddCommGroup.torsion E⟮ℚ⟯ : Set E⟮ℚ⟯).ncard ≤ 16
axiom
FLT
[ "import Mathlib.GroupTheory.Torsion", "import Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Point" ]
FLT/Assumptions/Mazur.lean
Mazur_statement
/-- Mazur's bound for the size of the torsion subgroup of an elliptic curve over the rationals . -/
Odlyzko_statement (K : Type*) [Field K] [NumberField K] [IsTotallyComplex K] (hdim : finrank ℚ K ≥ 18) : |(discr K : ℝ)| ≥ 8.25 ^ finrank ℚ K
axiom
FLT
[ "import Mathlib.NumberTheory.NumberField.Discriminant.Defs", "import Mathlib.NumberTheory.NumberField.InfinitePlace.TotallyRealComplex" ]
FLT/Assumptions/Odlyzko.lean
Odlyzko_statement
/-- An "Odlyzko bound" for the root discriminant of a totally complex number field of degree 18 and above. -/
PNat.pow_add_pow_ne_pow_of_FermatLastTheorem : FermatLastTheorem → ∀ (a b c : ℕ+) (n : ℕ) (_ : n > 2), a ^ n + b ^ n ≠ c ^ n := by intro h₁ a b c n h₂ specialize h₁ n h₂ a b c (by simp) (by simp) (by simp) assumption_mod_cast /-- If Fermat's Last Theorem is true for primes `p ≥ 5`, then FLT is true. -/
theorem
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
PNat.pow_add_pow_ne_pow_of_FermatLastTheorem
/-- Fermat's Last Theorem as stated in mathlib (a statement `FermatLastTheorem` about naturals) implies Fermat's Last Theorem stated in terms of positive integers. -/
FermatLastTheorem.of_p_ge_5 (H : ∀ p ≥ 5, p.Prime → FermatLastTheoremFor p) : FermatLastTheorem := by apply FermatLastTheorem.of_odd_primes -- this is Fermat's proof for n=4, plus reduction to -- the case n prime. intro p pp p_odd if hp5 : 5 ≤ p then exact H _ hp5 pp else have hp2 := pp.two_le interval_cases p · contradiction · exact fermatLastTheoremThree -- this is Euler's proof for n=3 · contradiction /-- A *Frey Package* is a 4-tuple (a,b,c,p) of integers satisfying $a^p+b^p=c^p$ and some other inequalities and congruences. These facts guarantee that all of the all the results in section 4.1 of Serre's paper [serre] apply to the curve $Y^2=X(X-a^p)(X+b^p).$ -/
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
FermatLastTheorem.of_p_ge_5
/-- If Fermat's Last Theorem is true for primes `p ≥ 5`, then FLT is true. -/
FreyPackage where /-- The integer `a` in the Frey package. -/ a : ℤ /-- The integer `b` in the Frey package. -/ b : ℤ /-- The integer `c` in the Frey package. -/ c : ℤ ha0 : a ≠ 0 hb0 : b ≠ 0 hc0 : c ≠ 0 /-- The prime number `p` in the Frey package. -/ p : ℕ pp : Nat.Prime p hp5 : 5 ≤ p hFLT : a ^ p + b ^ p = c ^ p hgcdab : gcd a b = 1 -- same as saying a,b,c pairwise coprime ha4 : (a : ZMod 4) = 3 hb2 : (b : ZMod 2) = 0 namespace FreyPackage
structure
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
FreyPackage
/-- A *Frey Package* is a 4-tuple (a,b,c,p) of integers satisfying $a^p+b^p=c^p$ and some other inequalities and congruences. These facts guarantee that all of the all the results in section 4.1 of Serre's paper [serre] apply to the curve $Y^2=X(X-a^p)(X+b^p).$ -/
hppos (P : FreyPackage) : 0 < P.p := lt_of_lt_of_le (by omega) P.hp5
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
hppos
/-- The prime number `p` in the Frey package. -/
hp0 (P : FreyPackage) : P.p ≠ 0 := P.hppos.ne'
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
hp0
/-- The prime number `p` in the Frey package. -/
hp_odd (P : FreyPackage) : Odd P.p := Nat.Prime.odd_of_ne_two P.pp <| have := P.hp5; by linarith
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
hp_odd
/-- The prime number `p` in the Frey package. -/
gcdab_eq_gcdac {a b c : ℤ} {p : ℕ} (hp : 0 < p) (h : a ^ p + b ^ p = c ^ p) : gcd a b = gcd a c := by have foo : gcd a b ∣ gcd a c := by apply dvd_gcd (gcd_dvd_left a b) rw [← Int.pow_dvd_pow_iff hp.ne', ← h] apply dvd_add <;> rw [Int.pow_dvd_pow_iff hp.ne'] · exact gcd_dvd_left a b · exact gcd_dvd_right a b have bar : gcd a c ∣ gcd a b := by apply dvd_gcd (gcd_dvd_left a c) have h2 : b ^ p = c ^ p - a ^ p := eq_sub_of_add_eq' h rw [← Int.pow_dvd_pow_iff hp.ne', h2] apply dvd_add · rw [Int.pow_dvd_pow_iff hp.ne'] exact gcd_dvd_right a c · rw [dvd_neg, Int.pow_dvd_pow_iff hp.ne'] exact gcd_dvd_left a c change _ ∣ (Int.gcd a c : ℤ) at foo apply Int.ofNat_dvd.1 at bar apply Int.ofNat_dvd.1 at foo exact congr_arg ((↑) : ℕ → ℤ) <| Nat.dvd_antisymm foo bar
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
gcdab_eq_gcdac
/-- The prime number `p` in the Frey package. -/
hgcdac (P : FreyPackage) : gcd P.a P.c = 1 := by rw [← gcdab_eq_gcdac P.hppos P.hFLT, P.hgcdab]
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
hgcdac
null
hgcdbc (P : FreyPackage) : gcd P.b P.c = 1 := by rw [← gcdab_eq_gcdac P.hppos, gcd_comm, P.hgcdab] rw [add_comm] exact P.hFLT -- for mathlib? I thought I needed it but I got around it -- lemma Int.dvd_div_iff {a b c : ℤ} (hbc : c ∣ b) : a ∣ b / c ↔ c * a ∣ b := by -- constructor -- · rintro ⟨x, hx⟩ -- use x -- rcases hbc with ⟨y, rfl⟩ -- by_cases hc : c = 0 -- · simp [hc] -- · rw [Int.mul_ediv_cancel_left _ hc] at hx -- rw [hx, mul_assoc] -- · rintro ⟨x, rfl⟩ -- rw [mul_assoc] -- by_cases hc : c = 0 -- · simp [hc] -- · simp [Int.mul_ediv_cancel_left _ hc] /-- Given a counterexample a^p+b^p=c^p to Fermat's Last Theorem with p>=5, there exists a Frey package. -/
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
hgcdbc
null
of_not_FermatLastTheorem_p_ge_5 {a b c : ℤ} (ha : a ≠ 0) (hb : b ≠ 0) (hc : c ≠ 0) {p : ℕ} (pp : p.Prime) (hp5 : 5 ≤ p) (H : a ^ p + b ^ p = c ^ p) : Nonempty FreyPackage := by have p_odd := pp.odd_of_ne_two (by omega) -- First, show that we can make a,b coprime by dividing through by gcd a b have ⟨a, b, c, a0, b0, c0, ab, H⟩ : ∃ (a b c : ℤ), a ≠ 0 ∧ b ≠ 0 ∧ c ≠ 0 ∧ Int.gcd a b = 1 ∧ a^p + b^p = c^p := by obtain ⟨d, a', b', d0, cop, a_eq, b_eq⟩ := Int.exists_gcd_one' (Int.gcd_pos_of_ne_zero_left b ha) simp only [a_eq, mul_pow, b_eq] at H rw [← add_mul, mul_comm] at H obtain ⟨c', rfl⟩ := (Int.pow_dvd_pow_iff pp.ne_zero).1 ⟨_, H.symm⟩ rw [mul_pow] at H have a0' := left_ne_zero_of_mul (a_eq ▸ ha) have b0' := left_ne_zero_of_mul (b_eq ▸ hb) have c0' := right_ne_zero_of_mul hc exact ⟨a', b', c', a0', b0', c0', cop, mul_left_cancel₀ (pow_ne_zero _ (mod_cast d0.ne')) H⟩ -- Then show that WLOG we can take b to be even, -- because at least one of a,b,c is even and we can permute if needed have ⟨a, b, c, a0, b0, c0, ab, eb, H⟩ : ∃ (a b c : ℤ), a ≠ 0 ∧ b ≠ 0 ∧ c ≠ 0 ∧ Int.gcd a b = 1 ∧ Even b ∧ a^p + b^p = c^p := by if eb : Even b then exact ⟨a, b, c, a0, b0, c0, ab, eb, H⟩ else if ea : Even a then exact ⟨b, a, c, b0, a0, c0, Int.gcd_comm a b ▸ ab, ea, by rwa [add_comm]⟩ else refine ⟨a, -c, -b, a0, neg_ne_zero.2 c0, neg_ne_zero.2 b0, ?_, even_neg.2 ?_, ?_⟩ · refine Int.gcd_neg.trans (.trans (.symm ?_) ab) exact Nat.cast_inj.1 (gcdab_eq_gcdac pp.pos H) · refine ((Int.even_pow (n := p)).1 (H.symm ▸ Int.even_add.2 (iff_of_false ?_ ?_))).1 · exact fun h => ea (Int.even_pow.1 h).1 · exact fun h => eb (Int.even_pow.1 h).1 · simp [p_odd.neg_pow, ← H] -- We can ensure additionally that a ≡ 3 [ZMOD 4] by negating everything if necessary have ⟨a, b, c, ha0, hb0, hc0, ab, ha3, eb, hFLT⟩ : ∃ (a b c : ℤ), a ≠ 0 ∧ b ≠ 0 ∧ c ≠ 0 ∧ Int.gcd a b = 1 ∧ a ≡ 3 [ZMOD 4] ∧ Even b ∧ a^p + b^p = c^p := by -- Since b is even, a cannot also be even have a_odd' : ∀ {i}, a ≡ i [ZMOD 4] → ¬2 ∣ i := fun ai ei => by have ea := (dvd_sub_right ei).1 (.trans (by decide) (Int.modEq_iff_dvd.1 ai)) simpa (config := {decide := true}) [gcd, ab] using dvd_gcd ea (even_iff_two_dvd.1 eb) mod_cases a_mod : a % 4 · cases a_odd' a_mod (by decide) · exact ⟨-a, -b, -c, neg_ne_zero.2 a0, neg_ne_zero.2 b0, neg_ne_zero.2 c0, by rwa [Int.neg_gcd, Int.gcd_neg], a_mod.neg, eb.neg, by simp [p_odd.neg_pow, ← H, add_comm]⟩ · cases a_odd' a_mod (by decide) · exact ⟨a, b, c, a0, b0, c0, ab, a_mod, eb, H⟩ -- Build the Frey package from the assumptions exact ⟨{ a, b, c, ha0, hb0, hc0, p, pp, hp5, hFLT hgcdab := by simp [gcd, ab] ha4 := (ZMod.intCast_eq_intCast_iff ..).2 ha3 hb2 := (ZMod.intCast_zmod_eq_zero_iff_dvd ..).2 (even_iff_two_dvd.1 eb) }⟩ /-- If Fermat's Last Theorem is false, then there exists a Frey Package. -/
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
of_not_FermatLastTheorem_p_ge_5
/-- Given a counterexample a^p+b^p=c^p to Fermat's Last Theorem with p>=5, there exists a Frey package. -/
of_not_FermatLastTheorem (h : ¬ FermatLastTheorem) : Nonempty (FreyPackage) := by contrapose! h refine FermatLastTheorem.of_p_ge_5 fun p hp5 pp a b c ha hb _ h2 ↦ Nonempty.elim ?_ h.false apply FreyPackage.of_not_FermatLastTheorem_p_ge_5 (a := a) (b := b) (c := c) <;> assumption_mod_cast /-- The Weierstrass curve over `ℤ` associated to a Frey package. The conditions imposed upon a Frey package guarantee that the running hypotheses in Section 4.1 of [Serre] all hold. We put the curve into the form where the equation is semistable at 2, rather than the usual `Y^2=X(X-a^p)(X+b^p)` form. The change of variables is `X=4x` and `Y=8y+4x`, and then divide through by 64. -/
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
of_not_FermatLastTheorem
/-- If Fermat's Last Theorem is false, then there exists a Frey Package. -/
freyCurveInt (P : FreyPackage) : WeierstrassCurve ℤ where a₁ := 1 -- Note that the numerator of a₂ is a multiple of 4 a₂ := (P.b ^ P.p - 1 - P.a ^ P.p) / 4 a₃ := 0 a₄ := -(P.a ^ P.p) * (P.b ^ P.p) / 16 -- Note: numerator is multiple of 16 a₆ := 0 /-- The elliptic curve over `ℚ` associated to a Frey package. The conditions imposed upon a Frey package guarantee that the running hypotheses in Section 4.1 of [Serre] all hold. We put the curve into the form where the equation is semistable at 2, rather than the usual `Y^2=X(X-a^p)(X+b^p)` form. The change of variables is `X=4x` and `Y=8y+4x`, and then divide through by 64. -/
def
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
freyCurveInt
/-- The Weierstrass curve over `ℤ` associated to a Frey package. The conditions imposed upon a Frey package guarantee that the running hypotheses in Section 4.1 of [Serre] all hold. We put the curve into the form where the equation is semistable at 2, rather than the usual `Y^2=X(X-a^p)(X+b^p)` form. The change of variables is `X=4x` and `Y=8y+4x`, and then divide through by 64. -/
freyCurve (P : FreyPackage) : WeierstrassCurve ℚ where a₁ := 1 -- a₂ is an integer because of the congruences assumed e.g. P.ha4 a₂ := (P.b ^ P.p - 1 - P.a ^ P.p) / 4 a₃ := 0 a₄ := -(P.a ^ P.p) * (P.b ^ P.p) / 16 -- this is also an integer a₆ := 0
def
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
freyCurve
/-- The elliptic curve over `ℚ` associated to a Frey package. The conditions imposed upon a Frey package guarantee that the running hypotheses in Section 4.1 of [Serre] all hold. We put the curve into the form where the equation is semistable at 2, rather than the usual `Y^2=X(X-a^p)(X+b^p)` form. The change of variables is `X=4x` and `Y=8y+4x`, and then divide through by 64. -/
map (P : FreyPackage) : (freyCurveInt P).map (algebraMap ℤ ℚ) = freyCurve P := by have two_dvd_b : 2 ∣ P.b := (ZMod.intCast_zmod_eq_zero_iff_dvd P.b 2).1 P.hb2 ext · rfl · change (((P.b ^ P.p - 1 - P.a ^ P.p) / 4 : ℤ) : ℚ) = (P.b ^ P.p - 1 - P.a ^ P.p) / 4 rw [Rat.intCast_div] · norm_cast · rw [sub_sub] apply Int.dvd_sub · calc (4 : ℤ) = 2 ^ 2 := by norm_num _ ∣ P.b ^ 2 := pow_dvd_pow_of_dvd two_dvd_b 2 _ ∣ P.b ^ P.p := pow_dvd_pow P.b (by linarith [P.hp5]) · apply (ZMod.intCast_zmod_eq_zero_iff_dvd _ 4).1 push_cast rw [P.ha4, show (3 : ZMod 4) = -1 from rfl, neg_one_pow_eq_ite, if_neg] · norm_num · rw [Nat.Prime.even_iff P.pp] linarith [P.hp5] · rfl · change ((-(P.a ^ P.p) * (P.b ^ P.p) / 16 : ℤ) : ℚ) = -(P.a ^ P.p) * (P.b ^ P.p) / 16 rw [Rat.intCast_div] · norm_cast · calc (16 : ℤ) = 2 ^ 4 := by norm_num _ ∣ P.b ^ 4 := pow_dvd_pow_of_dvd two_dvd_b 4 _ ∣ P.b ^ P.p := pow_dvd_pow P.b (by linarith [P.hp5]) _ ∣ _ := Int.dvd_mul_left _ _ · rfl
theorem
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
map
null
Δ (P : FreyPackage) : P.freyCurve.Δ = (P.a*P.b*P.c)^(2*P.p) / 2 ^ 8 := by trans (P.a ^ P.p) ^ 2 * (P.b ^ P.p) ^ 2 * (P.c ^ P.p) ^ 2 / 2 ^ 8 · field_simp norm_cast simp [← P.hFLT, WeierstrassCurve.Δ, freyCurve, WeierstrassCurve.b₂, WeierstrassCurve.b₄, WeierstrassCurve.b₆, WeierstrassCurve.b₈] ring · simp [← mul_pow, ← pow_mul, mul_comm 2]
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
Δ
null
b₂ (P : FreyPackage) : P.freyCurve.b₂ = P.b ^ P.p - P.a ^ P.p := by simp [freyCurve, WeierstrassCurve.b₂] ring
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
b₂
null
b₄ (P : FreyPackage) : P.freyCurve.b₄ = - (P.a * P.b) ^ P.p / 8 := by simp [freyCurve, WeierstrassCurve.b₄] ring
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
b₄
null
c₄ (P : FreyPackage) : P.freyCurve.c₄ = (P.a ^ P.p) ^ 2 + P.a ^ P.p * P.b ^ P.p + (P.b ^ P.p) ^ 2 := by simp [FreyCurve.b₂, FreyCurve.b₄, WeierstrassCurve.c₄] ring
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
c₄
null
c₄' (P : FreyPackage) : P.freyCurve.c₄ = P.c ^ (2 * P.p) - (P.a * P.b) ^ P.p := by rw [FreyCurve.c₄] rw_mod_cast [pow_mul', ← hFLT] ring
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
c₄'
null
Δ'inv (P : FreyPackage) : (↑(P.freyCurve.Δ'⁻¹) : ℚ) = 2 ^ 8 / (P.a*P.b*P.c)^(2*P.p) := by simp [FreyCurve.Δ]
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
Δ'inv
null
j (P : FreyPackage) : P.freyCurve.j = 2^8*(P.c^(2*P.p)-(P.a*P.b)^P.p) ^ 3 /(P.a*P.b*P.c)^(2*P.p) := by rw [mul_div_right_comm, WeierstrassCurve.j, FreyCurve.Δ'inv, FreyCurve.c₄']
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
j
null
j_pos_aux (a b : ℤ) (hb : b ≠ 0) : 0 < (a + b) ^ 2 - a * b := by rify calc (0 : ℝ) < (a ^ 2 + (a + b) ^ 2 + b ^ 2) / 2 := by positivity _ = (a + b) ^ 2 - a * b := by ring /-- The q-adic valuation of the j-invariant of the Frey curve is a multiple of p if 2 < q is a prime of bad reduction. -/
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
j_pos_aux
null
j_valuation_of_bad_prime (P : FreyPackage) {q : ℕ} (hqPrime : q.Prime) (hqbad : (q : ℤ) ∣ P.a * P.b * P.c) (hqodd : 2 < q) : (P.p : ℤ) ∣ padicValRat q P.freyCurve.j := by have := Fact.mk hqPrime have hqPrime' := Nat.prime_iff_prime_int.mp hqPrime have h₀ : ((P.c ^ (2 * P.p) - (P.a * P.b) ^ P.p) ^ 3 : ℚ) ≠ 0 := by rw_mod_cast [pow_mul', ← P.hFLT, mul_pow] exact pow_ne_zero _ <| ne_of_gt <| j_pos_aux _ _ (pow_ne_zero _ P.hb0) have h₁ : P.a * P.b * P.c ≠ 0 := mul_ne_zero (mul_ne_zero P.ha0 P.hb0) P.hc0 rw [FreyCurve.j, padicValRat.div (mul_ne_zero (by norm_num) h₀) (pow_ne_zero _ (mod_cast h₁)), padicValRat.mul (by norm_num) h₀, padicValRat.pow two_ne_zero, ← Nat.cast_two, ← padicValRat_of_nat, padicValNat_primes hqodd.ne', Nat.cast_zero, mul_zero, zero_add] have : ¬ (q : ℤ) ∣ (P.c^(2*P.p)-(P.a*P.b)^P.p) ^ 3 := by rw [hqPrime'.dvd_pow_iff_dvd three_ne_zero] have hq' : Xor' ((q : ℤ) ∣ P.a * P.b) ((q : ℤ) ∣ P.c) := by rw [xor_iff_not_iff, iff_iff_and_or_not_and_not] rintro (⟨hab, hc⟩ | ⟨hab, hc⟩) · rw [hqPrime'.dvd_mul] at hab apply hqPrime'.not_dvd_one cases hab with | inl ha => rw [← P.hgcdac]; exact dvd_gcd ha hc | inr hb => rw [← P.hgcdbc]; exact dvd_gcd hb hc · rw [hqPrime'.dvd_mul] at hqbad exact hqbad.rec hab hc have h2p0 := mul_ne_zero two_ne_zero P.hp0 cases hq' with | inl h => rw [dvd_sub_left (dvd_pow h.1 P.hp0), hqPrime'.dvd_pow_iff_dvd h2p0] exact h.2 | inr h => rw [dvd_sub_right (dvd_pow h.1 h2p0), hqPrime'.dvd_pow_iff_dvd P.hp0] exact h.2 norm_cast rw [padicValRat.of_int, padicValInt.eq_zero_of_not_dvd this, Nat.cast_zero, zero_sub, Int.cast_pow, padicValRat.pow (mod_cast h₁), dvd_neg, Nat.cast_mul] exact dvd_mul_of_dvd_left (dvd_mul_left _ _) _
lemma
FLT
[ "import Mathlib.Algebra.Polynomial.Bivariate", "import Mathlib.AlgebraicGeometry.EllipticCurve.Weierstrass", "import Mathlib.AlgebraicGeometry.EllipticCurve.VariableChange", "import Mathlib.Data.PNat.Basic", "import Mathlib.NumberTheory.FLT.Four", "import Mathlib.NumberTheory.FLT.Three", "import Mathlib.RepresentationTheory.Basic", "import Mathlib.RingTheory.SimpleModule.Basic", "import Mathlib.Tactic.ModCases", "import FLT.EllipticCurve.Torsion" ]
FLT/Basic/FreyPackage.lean
j_valuation_of_bad_prime
/-- The q-adic valuation of the j-invariant of the Frey curve is a multiple of p if 2 < q is a prime of bad reduction. -/
Mazur_Frey (P : FreyPackage) : haveI : Fact P.p.Prime := ⟨P.pp⟩ GaloisRep.IsIrreducible (P.freyCurve.galoisRep P.p P.hppos) := sorry /-! But it follows from a profound theorem of Ribet, and the even more profound theorem (proved by Wiles) that the representation cannot be irreducible. -/
theorem
FLT
[ "import FLT.GaloisRepresentation.HardlyRamified.Frey" ]
FLT/Basic/Reductions.lean
Mazur_Frey
/-- A classical decidable instance on `AlgebraicClosure ℚ`, given that there is no hope of a constructive one with the current definition of algebraic closure. -/
Wiles_Frey (P : FreyPackage) : haveI : Fact P.p.Prime := ⟨P.pp⟩ ¬ GaloisRep.IsIrreducible (P.freyCurve.galoisRep P.p P.hppos) := FreyCurve.torsion_not_isIrreducible P /-! It follows that there is no Frey package. -/ /-- There is no Frey package. This profound result is proved using work of Mazur and Wiles/Ribet to rule out all possibilities for the $p$-torsion in the corresponding Frey curve. -/
theorem
FLT
[ "import FLT.GaloisRepresentation.HardlyRamified.Frey" ]
FLT/Basic/Reductions.lean
Wiles_Frey
null
FreyPackage.false (P : FreyPackage) : False := by -- by Wiles' result, the p-torsion is not irreducible apply Wiles_Frey P -- but by Mazur's result, the p-torsion is irreducible! exact Mazur_Frey P -- Contradiction! /-- Fermat's Last Theorem is true -/
theorem
FLT
[ "import FLT.GaloisRepresentation.HardlyRamified.Frey" ]
FLT/Basic/Reductions.lean
FreyPackage.false
/-- There is no Frey package. This profound result is proved using work of Mazur and Wiles/Ribet to rule out all possibilities for the $p$-torsion in the corresponding Frey curve. -/
Wiles_Taylor_Wiles : FermatLastTheorem := by -- Suppose Fermat's Last Theorem is false by_contra h -- then there exists a Frey package obtain ⟨P : FreyPackage⟩ := FreyPackage.of_not_FermatLastTheorem h -- but there is no Frey package exact P.false
theorem
FLT
[ "import FLT.GaloisRepresentation.HardlyRamified.Frey" ]
FLT/Basic/Reductions.lean
Wiles_Taylor_Wiles
/-- Fermat's Last Theorem is true -/
Hurwitz : Type where re : ℤ -- 1 im_o : ℤ -- ω im_i : ℤ -- i im_oi : ℤ -- ωi -- note iω + ωi + 1 + i = 0 notation "𝓞" => Hurwitz -- 𝓞 = \MCO namespace Hurwitz open Quaternion in
structure
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
Hurwitz
null
toQuaternion (z : 𝓞) : ℍ where re := z.re - 2⁻¹ * z.im_o - 2⁻¹ * z.im_oi imI := z.im_i + 2⁻¹ * z.im_o - 2⁻¹ * z.im_oi imJ := 2⁻¹ * z.im_o + 2⁻¹ * z.im_oi imK := 2⁻¹ * z.im_o - 2⁻¹ * z.im_oi open Quaternion in
def
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion
null
fromQuaternion (z : ℍ) : 𝓞 where re := Int.floor <| z.re + z.imJ im_o := Int.floor <| z.imJ + z.imK im_i := Int.floor <| z.imI - z.imK im_oi := Int.floor <| z.imJ - z.imK
def
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
fromQuaternion
null
leftInverse_fromQuaternion_toQuaternion : Function.LeftInverse fromQuaternion toQuaternion := by intro z simp only [fromQuaternion, toQuaternion, sub_add_add_cancel, sub_add_cancel, Int.floor_intCast, add_add_sub_cancel, ← two_mul, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, mul_inv_cancel_left₀, sub_sub_sub_cancel_right, add_sub_cancel_right, add_sub_sub_cancel]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
leftInverse_fromQuaternion_toQuaternion
null
toQuaternion_injective : Function.Injective toQuaternion := leftInverse_fromQuaternion_toQuaternion.injective open Quaternion in
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_injective
null
leftInvOn_toQuaternion_fromQuaternion : Set.LeftInvOn toQuaternion fromQuaternion { q : ℍ | ∃ a b c d : ℤ, q = ⟨a, b, c, d⟩ ∨ q = ⟨a + 2⁻¹, b + 2⁻¹, c + 2⁻¹, d + 2⁻¹⟩ } := by have h₀ (x y : ℤ) : (x + 2 ⁻¹ : ℝ) + (y + 2⁻¹) = ↑(x + y + 1) := by field_simp; norm_cast; ring intro q hq simp only [Set.mem_setOf] at hq simp only [toQuaternion, fromQuaternion] obtain ⟨a, b, c, d, rfl|rfl⟩ := hq <;> ext <;> simp only [h₀, add_sub_add_right_eq_sub, Int.floor_sub_intCast, Int.floor_intCast, Int.cast_sub, Int.cast_add, Int.cast_one, Int.floor_add_one, Int.floor_sub_intCast] <;> simp only [Int.floor_add_intCast, Int.floor_intCast, Int.cast_add] <;> field_simp <;> norm_cast <;> ring open Quaternion in
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
leftInvOn_toQuaternion_fromQuaternion
null
fromQuaternion_injOn : Set.InjOn fromQuaternion { q : ℍ | ∃ a b c d : ℤ, q = ⟨a, b, c, d⟩ ∨ q = ⟨a + 2⁻¹, b + 2⁻¹, c + 2⁻¹, d + 2⁻¹⟩ } := leftInvOn_toQuaternion_fromQuaternion.injOn /-! ## zero (0) -/ /-- The Hurwitz number 0 -/
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
fromQuaternion_injOn
null
zero : 𝓞 := ⟨0, 0, 0, 0⟩ /-- notation `0` for `zero` -/
def
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
zero
/-- The Hurwitz number 0 -/
zero_re : re (0 : 𝓞) = 0 := rfl @[simp] lemma zero_im_o : im_o (0 : 𝓞) = 0 := rfl @[simp] lemma zero_im_i : im_i (0 : 𝓞) = 0 := rfl @[simp] lemma zero_im_oi : im_oi (0 : 𝓞) = 0 := rfl
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
zero_re
/-- notation `0` for `zero` -/
toQuaternion_zero : toQuaternion 0 = 0 := by ext <;> (simp [toQuaternion]) @[simp]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_zero
/-- notation `0` for `zero` -/
toQuaternion_eq_zero_iff {z} : toQuaternion z = 0 ↔ z = 0 := toQuaternion_injective.eq_iff' toQuaternion_zero
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_eq_zero_iff
/-- notation `0` for `zero` -/
toQuaternion_ne_zero_iff {z} : toQuaternion z ≠ 0 ↔ z ≠ 0 := toQuaternion_injective.ne_iff' toQuaternion_zero /-! ## one (1) -/
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_ne_zero_iff
/-- notation `0` for `zero` -/
one : 𝓞 := ⟨1, 0, 0, 0⟩ /-- Notation `1` for `one` -/
def
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
one
null
one_re : re (1 : 𝓞) = 1 := rfl @[simp] lemma one_im_o : im_o (1 : 𝓞) = 0 := rfl @[simp] lemma one_im_i : im_i (1 : 𝓞) = 0 := rfl @[simp] lemma one_im_oi : im_oi (1 : 𝓞) = 0 := rfl
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
one_re
/-- Notation `1` for `one` -/
toQuaternion_one : toQuaternion 1 = 1 := by ext <;> (simp [toQuaternion]) /-! ## Neg (-) -/ -- negation /-- The negation `-z` of a Hurwitz number -/
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_one
/-- Notation `1` for `one` -/
neg (z : 𝓞) : 𝓞 := ⟨-re z, -im_o z, -im_i z, -im_oi z⟩ /-- Notation `-` for negation -/
def
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
neg
/-- The negation `-z` of a Hurwitz number -/
neg_re (z : 𝓞) : re (-z) = -re z := rfl @[simp] lemma neg_im_o (z : 𝓞) : im_o (-z) = -im_o z := rfl @[simp] lemma neg_im_i (z : 𝓞) : im_i (-z) = -im_i z := rfl @[simp] lemma neg_im_oi (z : 𝓞) : im_oi (-z) = -im_oi z := rfl
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
neg_re
/-- Notation `-` for negation -/
toQuaternion_neg (z : 𝓞) : toQuaternion (-z) = - toQuaternion z := by ext <;> simp [toQuaternion] <;> ring /-! ## add (+) -/ -- Now let's define addition /-- addition `z+w` of complex numbers -/
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_neg
/-- Notation `-` for negation -/
add (z w : 𝓞) : 𝓞 := ⟨z.re + w.re, z.im_o + w.im_o, z.im_i + w.im_i, z.im_oi + w.im_oi⟩ /-- Notation `+` for addition -/
def
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
add
/-- addition `z+w` of complex numbers -/
add_re (z w : 𝓞) : re (z + w) = re z + re w := rfl @[simp] lemma add_im_o (z w : 𝓞) : im_o (z + w) = im_o z + im_o w := rfl @[simp] lemma add_im_i (z w : 𝓞) : im_i (z + w) = im_i z + im_i w := rfl @[simp] lemma add_im_oi (z w : 𝓞) : im_oi (z + w) = im_oi z + im_oi w := rfl
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
add_re
/-- Notation `+` for addition -/
toQuaternion_add (z w : 𝓞) : toQuaternion (z + w) = toQuaternion z + toQuaternion w := by ext <;> simp [toQuaternion] <;> ring /-- Notation `+` for addition -/
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_add
/-- Notation `+` for addition -/
toQuaternion_sub (z w : 𝓞) : toQuaternion (z - w) = toQuaternion z - toQuaternion w := by convert toQuaternion_add z (-w) using 1 rw [sub_eq_add_neg, toQuaternion_neg] -- instance : AddCommGroup 𝓞 where -- add_assoc := by intros; ext <;> simp [add_assoc] -- zero_add := by intros; ext <;> simp -- add_zero := by intros; ext <;> simp -- nsmul := nsmulRec -- zsmul := zsmulRec -- add_left_neg := by intros; ext <;> simp -- add_comm := by intros; ext <;> simp [add_comm]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_sub
/-- Notation `+` for addition -/
preserves_nsmulRec {M N : Type*} [Zero M] [Add M] [AddMonoid N] (f : M → N) (zero : f 0 = 0) (add : ∀ x y, f (x + y) = f x + f y) (n : ℕ) (x : M) : f (nsmulRec n x) = n • f x := by induction n with | zero => rw [nsmulRec, zero, zero_smul] | succ n ih => rw [nsmulRec, add, add_nsmul, one_nsmul, ih]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
preserves_nsmulRec
null
toQuaternion_nsmul (z : 𝓞) (n : ℕ) : toQuaternion (n • z) = n • toQuaternion z := preserves_nsmulRec _ toQuaternion_zero toQuaternion_add _ _
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_nsmul
null
preserves_zsmul {G H : Type*} [Zero G] [Add G] [Neg G] [SMul ℕ G] [SubNegMonoid H] (f : G → H) (nsmul : ∀ (g : G) (n : ℕ), f (n • g) = n • f g) (neg : ∀ x, f (-x) = -f x) (z : ℤ) (g : G) : f (zsmulRec (· • ·) z g) = z • f g := by cases z with | ofNat n => rw [zsmulRec, nsmul, Int.ofNat_eq_natCast, natCast_zsmul] | negSucc n => rw [zsmulRec, neg, nsmul, negSucc_zsmul]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
preserves_zsmul
null
toQuaternion_zsmul (z : 𝓞) (n : ℤ) : toQuaternion (n • z) = n • toQuaternion z := preserves_zsmul _ toQuaternion_nsmul toQuaternion_neg n z -- noncomputable instance : AddCommGroup 𝓞 := -- toQuaternion_injective.addCommGroup -- _ -- toQuaternion_zero -- toQuaternion_add -- toQuaternion_neg -- toQuaternion_sub -- toQuaternion_nsmul -- toQuaternion_zsmul /-! ## mul (*) -/ -- multiplication /-- Multiplication `z*w` of two Hurwitz numbers -/
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_zsmul
null
mul (z w : 𝓞) : 𝓞 where re := z.re * w.re - z.im_o * w.im_o - z.im_i * w.im_o - z.im_i * w.im_i + z.im_i * w.im_oi - z.im_oi * w.im_oi im_o := z.im_o * w.re + z.re * w.im_o - z.im_o * w.im_o - z.im_oi * w.im_o - z.im_oi * w.im_i + z.im_i * w.im_oi im_i := z.im_i * w.re - z.im_i * w.im_o + z.im_oi * w.im_o + z.re * w.im_i - z.im_o * w.im_oi - z.im_i * w.im_oi im_oi := z.im_oi * w.re - z.im_i * w.im_o + z.im_o * w.im_i + z.re * w.im_oi - z.im_o * w.im_oi - z.im_oi * w.im_oi /-- Notation `*` for multiplication -/
def
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
mul
/-- Multiplication `z*w` of two Hurwitz numbers -/
mul_re (z w : 𝓞) : re (z * w) = z.re * w.re - z.im_o * w.im_o - z.im_i * w.im_o - z.im_i * w.im_i + z.im_i * w.im_oi - z.im_oi * w.im_oi := rfl @[simp] lemma mul_im_o (z w : 𝓞) : im_o (z * w) = z.im_o * w.re + z.re * w.im_o - z.im_o * w.im_o - z.im_oi * w.im_o - z.im_oi * w.im_i + z.im_i * w.im_oi := rfl @[simp] lemma mul_im_i (z w : 𝓞) : im_i (z * w) = z.im_i * w.re - z.im_i * w.im_o + z.im_oi * w.im_o + z.re * w.im_i - z.im_o * w.im_oi - z.im_i * w.im_oi := rfl @[simp] lemma mul_im_oi (z w : 𝓞) : im_oi (z * w) = z.im_oi * w.re - z.im_i * w.im_o + z.im_o * w.im_i + z.re * w.im_oi - z.im_o * w.im_oi - z.im_oi * w.im_oi := rfl
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
mul_re
/-- Notation `*` for multiplication -/
toQuaternion_mul (z w : 𝓞) : toQuaternion (z * w) = toQuaternion z * toQuaternion w := by ext <;> simp [toQuaternion] <;> ring
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_mul
null
o_mul_i : { re := 0, im_o := 1, im_i := 0, im_oi := 0 } * { re := 0, im_o := 0, im_i := 1, im_oi := 0 } = ({ re := 0, im_o := 0, im_i := 0, im_oi := 1 } : 𝓞) := by ext <;> simp
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
o_mul_i
null
preserves_npowRec {M N : Type*} [One M] [Mul M] [Monoid N] (f : M → N) (one : f 1 = 1) (mul : ∀ x y : M, f (x * y) = f x * f y) (z : M) (n : ℕ) : f (npowRec n z) = (f z) ^ n := by induction n with | zero => rw [npowRec, one, pow_zero] | succ n ih => rw [npowRec, pow_succ, mul, ih]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
preserves_npowRec
null
toQuaternion_npow (z : 𝓞) (n : ℕ) : toQuaternion (z ^ n) = (toQuaternion z) ^ n := preserves_npowRec toQuaternion toQuaternion_one toQuaternion_mul z n
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_npow
null
preserves_unaryCast {R S : Type*} [One R] [Zero R] [Add R] [AddMonoidWithOne S] (f : R → S) (zero : f 0 = 0) (one : f 1 = 1) (add : ∀ x y, f (x + y) = f x + f y) (n : ℕ) : f (Nat.unaryCast n) = n := by induction n with | zero => rw [Nat.unaryCast, zero, Nat.cast_zero] | succ n ih => rw [Nat.unaryCast, add, one, Nat.cast_add, Nat.cast_one, ih]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
preserves_unaryCast
null
toQuaternion_natCast (n : ℕ) : toQuaternion n = n := preserves_unaryCast _ toQuaternion_zero toQuaternion_one toQuaternion_add n
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_natCast
null
Int.castDef_ofNat {R : Type*} [NatCast R] [Neg R] (n : ℕ) : (Int.castDef (Int.ofNat n) : R) = n := rfl
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
Int.castDef_ofNat
null
Int.castDef_negSucc {R : Type*} [NatCast R] [Neg R] (n : ℕ) : (Int.castDef (Int.negSucc n) : R) = -(n + 1 : ℕ) := rfl
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
Int.castDef_negSucc
null
preserves_castDef {R S : Type*} [NatCast R] [Neg R] [AddGroupWithOne S] (f : R → S) (natCast : ∀ n : ℕ, f n = n) (neg : ∀ x, f (-x) = - f x) (n : ℤ) : f (Int.castDef n) = n := by cases n with | ofNat n => rw [Int.castDef_ofNat, natCast, Int.ofNat_eq_natCast, Int.cast_natCast] | negSucc _ => rw [Int.castDef_negSucc, neg, natCast, Int.cast_negSucc]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
preserves_castDef
null
toQuaternion_intCast (n : ℤ) : toQuaternion n = n := preserves_castDef _ toQuaternion_natCast toQuaternion_neg n
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_intCast
null
ring : Ring 𝓞 := toQuaternion_injective.ring _ toQuaternion_zero toQuaternion_one toQuaternion_add toQuaternion_mul toQuaternion_neg toQuaternion_sub (fun _ _ => toQuaternion_nsmul _ _) -- TODO for Yaël: these are inconsistent with addCommGroup (fun _ _ => toQuaternion_zsmul _ _) -- TODO for Yaël: these are inconsistent with addCommGroup toQuaternion_npow toQuaternion_natCast toQuaternion_intCast @[simp] lemma natCast_re (n : ℕ) : (n : 𝓞).re = n := by induction n with | zero => simp | succ n ih => simpa @[simp] lemma natCast_im_o (n : ℕ) : (n : 𝓞).im_o = 0 := by induction n with | zero => simp | succ n ih => simpa @[simp] lemma natCast_im_i (n : ℕ) : (n : 𝓞).im_i = 0 := by induction n with | zero => simp | succ n ih => simpa @[simp] lemma natCast_im_oi (n : ℕ) : (n : 𝓞).im_oi = 0 := by induction n with | zero => simp | succ n ih => simpa @[simp] lemma intCast_re (n : ℤ) : (n : 𝓞).re = n := by cases n with | ofNat _ => simp | negSucc _ => simp [← Int.neg_ofNat_succ] @[simp] lemma intCast_im_o (n : ℤ) : (n : 𝓞).im_o = 0 := by cases n with | ofNat _ => simp | negSucc _ => simp [← Int.neg_ofNat_succ] @[simp] lemma intCast_im_i (n : ℤ) : (n : 𝓞).im_i = 0 := by cases n with | ofNat _ => simp | negSucc _ => simp [← Int.neg_ofNat_succ] @[simp] lemma intCast_im_oi (n : ℤ) : (n : 𝓞).im_oi = 0 := by cases n with | ofNat _ => simp | negSucc _ => simp [← Int.neg_ofNat_succ] /-- Conjugate; sends $a+bi+cj+dk$ to $a-bi-cj-dk$. -/
instance
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
ring
null
starRing : StarRing 𝓞 where star z := ⟨z.re - z.im_o - z.im_oi, -z.im_o, -z.im_i, -z.im_oi⟩ star_involutive x := by ext <;> simp only <;> ring star_mul x y := by ext <;> simp <;> ring star_add x y := by ext <;> simp <;> ring @[simp] lemma star_re (z : 𝓞) : (star z).re = z.re - z.im_o - z.im_oi := rfl @[simp] lemma star_im_o (z : 𝓞) : (star z).im_o = -z.im_o := rfl @[simp] lemma star_im_i (z : 𝓞) : (star z).im_i = -z.im_i := rfl @[simp] lemma star_im_oi (z : 𝓞) : (star z).im_oi = -z.im_oi := rfl
instance
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
starRing
/-- Conjugate; sends $a+bi+cj+dk$ to $a-bi-cj-dk$. -/
toQuaternion_star (z : 𝓞) : toQuaternion (star z) = star (toQuaternion z) := by ext <;> simp only [star_re, star_im_o, star_im_i, star_im_oi, toQuaternion, Quaternion.re_star, Quaternion.imI_star, Quaternion.imJ_star, Quaternion.imK_star] <;> field_simp <;> norm_cast <;> ring
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
toQuaternion_star
null
star_eq (z : 𝓞) : star z = (fromQuaternion ∘ star ∘ toQuaternion) z := by simp only [Function.comp_apply, ← toQuaternion_star] rw [leftInverse_fromQuaternion_toQuaternion]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
star_eq
null
norm (z : 𝓞) : ℤ := z.re * z.re + z.im_o * z.im_o + z.im_i * z.im_i + z.im_oi * z.im_oi - z.re * (z.im_o + z.im_oi) + z.im_i * (z.im_o - z.im_oi)
def
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
norm
null
norm_eq_mul_conj (z : 𝓞) : (norm z : 𝓞) = z * star z := by ext <;> simp only [norm, intCast_re, intCast_im_o, intCast_im_i, intCast_im_oi, mul_re, mul_im_o, mul_im_i, mul_im_oi, star_re, star_im_o, star_im_i, star_im_oi] <;> ring
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
norm_eq_mul_conj
null
coe_norm (z : 𝓞) : (norm z : ℝ) = (z.re - 2⁻¹ * z.im_o - 2⁻¹ * z.im_oi) ^ 2 + (z.im_i + 2⁻¹ * z.im_o - 2⁻¹ * z.im_oi) ^ 2 + (2⁻¹ * z.im_o + 2⁻¹ * z.im_oi) ^ 2 + (2⁻¹ * z.im_o - 2⁻¹ * z.im_oi) ^ 2 := by rw [norm] field_simp norm_cast ring
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
coe_norm
null
norm_zero : norm 0 = 0 := by simp [norm]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
norm_zero
null
norm_one : norm 1 = 1 := by simp [norm]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
norm_one
null
norm_mul (x y : 𝓞) : norm (x * y) = norm x * norm y := by rw [← Int.cast_inj (α := 𝓞)] simp_rw [norm_eq_mul_conj, star_mul] rw [mul_assoc, ← mul_assoc y, ← norm_eq_mul_conj] rw [Int.cast_comm, ← mul_assoc, ← norm_eq_mul_conj, Int.cast_mul]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
norm_mul
null
norm_nonneg (x : 𝓞) : 0 ≤ norm x := by rw [← Int.cast_nonneg_iff (R := ℝ), coe_norm] positivity
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
norm_nonneg
null
norm_eq_zero (x : 𝓞) : norm x = 0 ↔ x = 0 := by constructor swap · rintro rfl; exact norm_zero intro h rw [← Int.cast_eq_zero (α := ℝ), coe_norm] at h field_simp at h norm_cast at h have h4 := eq_zero_of_add_nonpos_right (by positivity) (by positivity) h.le rw [sq_eq_zero_iff, sub_eq_zero] at h4 have h1 := eq_zero_of_add_nonpos_left (by positivity) (by positivity) h.le have h3 := eq_zero_of_add_nonpos_right (by positivity) (by positivity) h1.le rw [h4] at h3 simp only [ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, pow_eq_zero_iff, add_self_eq_zero] at h3 rw [h3] at h4 simp only [h4, sub_zero, h3, add_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow] at h1 have h2 := eq_zero_of_add_nonpos_right (by positivity) (by positivity) h1.le simp only [ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, pow_eq_zero_iff, mul_eq_zero, false_or] at h2 simp only [h2, mul_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, add_zero, pow_eq_zero_iff, mul_eq_zero, or_false] at h1 ext <;> assumption open Quaternion in
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
norm_eq_zero
null
normSq_toQuaternion (z : 𝓞) : normSq (toQuaternion z) = norm z := by apply coe_injective rw [← self_mul_star, ← toQuaternion_star, ← toQuaternion_mul, ← norm_eq_mul_conj, toQuaternion_intCast, coe_intCast]
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
normSq_toQuaternion
null
aux (x y z w : ℤ) : toQuaternion (fromQuaternion ⟨x,y,z,w⟩) = ⟨x,y,z,w⟩ := by apply leftInvOn_toQuaternion_fromQuaternion simp only [Set.mem_setOf] use x, y, z, w simp
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
aux
null
aux2 (a b c d : ℝ) (ha : a ≤ 4⁻¹) (hb : b ≤ 4⁻¹) (hc : c ≤ 4⁻¹) (hd : d ≤ 4⁻¹) (H : ¬ (a = 4⁻¹ ∧ b = 4⁻¹ ∧ c = 4⁻¹ ∧ d = 4⁻¹)) : a + b + c + d < 1 := by apply lt_of_le_of_ne · calc _ ≤ (4 : ℝ)⁻¹ + 4⁻¹ + 4⁻¹ + 4⁻¹ := by gcongr _ = 1 := by norm_num contrapose! H have invs : (1 : ℝ) - 4⁻¹ = 4⁻¹ + 4⁻¹ + 4⁻¹ := by norm_num refine ⟨?_, ?_, ?_, ?_⟩ <;> apply le_antisymm ‹_› <;> [ (have : a = 1 - (b + c + d) := by rw [← H]; ring); (have : b = 1 - (a + c + d) := by rw [← H]; ring); (have : c = 1 - (a + b + d) := by rw [← H]; ring); (have : d = 1 - (a + b + c) := by rw [← H]; ring) ] <;> rw [this, le_sub_comm, invs] <;> gcongr open Quaternion in
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
aux2
null
exists_near (a : ℍ) : ∃ q : 𝓞, dist a (toQuaternion q) < 1 := by have four_inv : (4⁻¹ : ℝ) = 2⁻¹ ^ 2 := by norm_num have (r : ℝ) : (r - round r) ^ 2 ≤ 4⁻¹ := by rw [four_inv, sq_le_sq] apply (abs_sub_round _).trans_eq rw [abs_of_nonneg] all_goals norm_num let x := round a.re let y := round a.imI let z := round a.imJ let w := round a.imK by_cases H : |a.re - x| = 2⁻¹ ∧ |a.imI - y| = 2⁻¹ ∧ |a.imJ - z| = 2⁻¹ ∧ |a.imK - w| = 2⁻¹ · use fromQuaternion a convert zero_lt_one' ℝ rw [NormedRing.dist_eq, ← sq_eq_zero_iff, sq, ← Quaternion.normSq_eq_norm_mul_self, normSq_def'] rw [add_eq_zero_iff_of_nonneg (by positivity) (by positivity)] rw [add_eq_zero_iff_of_nonneg (by positivity) (by positivity)] rw [add_eq_zero_iff_of_nonneg (by positivity) (by positivity)] simp_rw [and_assoc, sq_eq_zero_iff, re_sub, imI_sub, imJ_sub, imK_sub, sub_eq_zero, ← Quaternion.ext_iff] symm apply leftInvOn_toQuaternion_fromQuaternion · simp only [Set.mem_setOf] have {r : ℝ} {z : ℤ} (h : |r - z| = 2⁻¹) : ∃ z' : ℤ, r = z' + 2⁻¹ := by cases (abs_eq (by positivity)).mp h with (rw [sub_eq_iff_eq_add'] at h) | inl h => use z | inr h => use z - 1; rw [h, Int.cast_sub, Int.cast_one, add_comm_sub]; norm_num obtain ⟨x', hx'⟩ := this H.1 obtain ⟨y', hy'⟩ := this H.2.1 obtain ⟨z', hz'⟩ := this H.2.2.1 obtain ⟨w', hw'⟩ := this H.2.2.2 use x', y', z', w', Or.inr ?_ ext <;> simp [*] use fromQuaternion ⟨x,y,z,w⟩ rw [aux] rw [NormedRing.dist_eq, ← sq_lt_one_iff₀ (_root_.norm_nonneg _), sq, ← Quaternion.normSq_eq_norm_mul_self, normSq_def'] simp only [re_sub, imI_sub, imJ_sub, imK_sub] apply aux2 <;> try apply this contrapose! H suffices ∀ r : ℝ, |r| = 2⁻¹ ↔ r ^ 2 = 4⁻¹ by simpa [this] intro r rw [four_inv, sq_eq_sq_iff_abs_eq_abs, abs_of_nonneg (a := (2⁻¹ : ℝ))] norm_num open Quaternion in
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
exists_near
null
quot_rem (a b : 𝓞) (hb : b ≠ 0) : ∃ q r : 𝓞, a = q * b + r ∧ norm r < norm b := by let a' := toQuaternion a let b' := toQuaternion b have hb' : b' ≠ 0 := toQuaternion_ne_zero_iff.mpr hb let q' := a' / b' obtain ⟨q : 𝓞, hq : dist q' (toQuaternion q) < 1⟩ : ∃ _, _ := exists_near q' refine ⟨q, a - q * b, (add_sub_cancel _ _).symm, ?_⟩ rw [← Int.cast_lt (R := ℝ), ← normSq_toQuaternion, ← normSq_toQuaternion] rw [normSq_eq_norm_mul_self, normSq_eq_norm_mul_self] refine mul_self_lt_mul_self ?_ ?_ · exact _root_.norm_nonneg (a - q * b).toQuaternion rw [toQuaternion_sub, ← dist_eq_norm] calc _ = dist (q' * b') (q.toQuaternion * b') := ?_ _ = dist q' (q.toQuaternion) * ‖b'‖ := ?_ _ < _ := ?_ · rw [toQuaternion_mul] dsimp only [b', q'] rw [div_mul_cancel₀ a' hb'] · -- Surprised that this doesn't seem to exist in mathlib. rw [dist_eq_norm_sub', ← sub_mul, _root_.norm_mul, ← dist_eq_norm_sub'] · rw [← norm_pos_iff] at hb' exact mul_lt_of_lt_one_left hb' hq
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
quot_rem
null
left_ideal_princ (I : Submodule 𝓞 𝓞) : ∃ a : 𝓞, I = Submodule.span 𝓞 {a} := by by_cases h_bot : I = ⊥ · use 0 rw [Eq.comm] simp only [h_bot, Submodule.span_singleton_eq_bot] let S := {a : 𝓞 // a ∈ I ∧ a ≠ 0} have : Nonempty S := by simp only [ne_eq, nonempty_subtype, S] exact Submodule.exists_mem_ne_zero_of_ne_bot h_bot have hbdd : BddBelow <| Set.range (fun i : S ↦ norm i) := by use 0 simp only [ne_eq, mem_lowerBounds, Set.mem_range] rintro _ ⟨_, rfl⟩ exact norm_nonneg _ obtain ⟨a, ha⟩ : ∃ a : S, norm a = ⨅ i : S, norm i := exists_eq_ciInf_of_not_isPredPrelimit hbdd (Order.not_isPredPrelimit) use a apply le_antisymm · intro i hi rw [Submodule.mem_span_singleton] simp only [ne_eq] obtain ⟨q, r, hqr⟩ := quot_rem i a a.2.2 rw [ha] at hqr have hrI : r ∈ I := by rw [show r = i - q • a by apply eq_sub_of_add_eq; rw [add_comm]; exact hqr.1.symm ] apply I.sub_mem hi (I.smul_mem _ a.2.1) have hr : r = 0 := by by_contra hr lift r to S using ⟨hrI, hr⟩ apply (ciInf_le hbdd r).not_gt hqr.2 rw [hr, add_zero] at hqr refine ⟨q, hqr.1.symm⟩ · rw [Submodule.span_singleton_le_iff_mem] exact a.2.1
lemma
FLT
[ "import Mathlib.Analysis.Quaternion" ]
FLT/Data/Hurwitz.lean
left_ideal_princ
null
HurwitzHat : Type := 𝓞 ⊗[ℤ] ZHat namespace HurwitzHat /-- The base change of the Hurwitz quaternions to ZHat. -/ scoped notation "𝓞^" => HurwitzHat
def
FLT
[ "import FLT.Data.Hurwitz", "import FLT.Data.QHat" ]
FLT/Data/HurwitzRatHat.lean
HurwitzHat
/-- The base change of the Hurwitz quaternions to ZHat. -/
HurwitzRat : Type := ℚ ⊗[ℤ] 𝓞 namespace HurwitzRat /-- The quaternion algebra ℚ + ℚi + ℚj + ℚk. -/ scoped notation "D" => HurwitzRat
def
FLT
[ "import FLT.Data.Hurwitz", "import FLT.Data.QHat" ]
FLT/Data/HurwitzRatHat.lean
HurwitzRat
/-- The quaternion algebra ℚ + ℚi + ℚj + ℚk. -/
HurwitzRatHat : Type := D ⊗[ℤ] ZHat namespace HurwitzRatHat /-- The "profinite Hurwitz quaternions" over the finite adeles of ℚ; a free rank 4 module generated by 1, i, j, and (1+i+j+k)/2. -/ scoped notation "D^" => HurwitzRatHat
def
FLT
[ "import FLT.Data.Hurwitz", "import FLT.Data.QHat" ]
FLT/Data/HurwitzRatHat.lean
HurwitzRatHat
/-- The "profinite Hurwitz quaternions" over the finite adeles of ℚ; a free rank 4 module generated by 1, i, j, and (1+i+j+k)/2. -/
j₁ : D →ₐ[ℤ] D^ := Algebra.TensorProduct.includeLeft -- (Algebra.TensorProduct.assoc ℤ ℚ 𝓞 ZHat).symm.trans Algebra.TensorProduct.includeLeft
abbrev
FLT
[ "import FLT.Data.Hurwitz", "import FLT.Data.QHat" ]
FLT/Data/HurwitzRatHat.lean
j₁
/-- The inclusion from D=ℚ+ℚi+ℚj+ℚk to D ⊗ 𝔸, with 𝔸 the finite adeles of ℚ. -/
injective_hRat : Function.Injective j₁ := sorry -- flatness /-- The inclusion from the profinite Hurwitz quaternions to to 𝔸+𝔸i+𝔸j+𝔸k, with 𝔸 the finite adeles of ℚ. -/
lemma
FLT
[ "import FLT.Data.Hurwitz", "import FLT.Data.QHat" ]
FLT/Data/HurwitzRatHat.lean
injective_hRat
/-- The inclusion from D=ℚ+ℚi+ℚj+ℚk to D ⊗ 𝔸, with 𝔸 the finite adeles of ℚ. -/
j₂ : 𝓞^ →ₐ[ℤ] D^ := ((Algebra.TensorProduct.assoc ℤ ℤ ℚ 𝓞 ZHat).symm : ℚ ⊗ 𝓞^ ≃ₐ[ℤ] D ⊗ ZHat).toAlgHom.comp (Algebra.TensorProduct.includeRight : 𝓞^ →ₐ[ℤ] ℚ ⊗ 𝓞^)
abbrev
FLT
[ "import FLT.Data.Hurwitz", "import FLT.Data.QHat" ]
FLT/Data/HurwitzRatHat.lean
j₂
/-- The inclusion from the profinite Hurwitz quaternions to to 𝔸+𝔸i+𝔸j+𝔸k, with 𝔸 the finite adeles of ℚ. -/
injective_zHat : Function.Injective j₂ := sorry -- flatness -- should I rearrange tensors? Not sure if D^ should be (ℚ ⊗ 𝓞) ⊗ ℤhat or ℚ ⊗ (𝓞 ⊗ Zhat)
lemma
FLT
[ "import FLT.Data.Hurwitz", "import FLT.Data.QHat" ]
FLT/Data/HurwitzRatHat.lean
injective_zHat
/-- The inclusion from the profinite Hurwitz quaternions to to 𝔸+𝔸i+𝔸j+𝔸k, with 𝔸 the finite adeles of ℚ. -/
canonicalForm (z : D^) : ∃ (N : ℕ+) (z' : 𝓞^), z = j₁ ((N⁻¹ : ℚ) ⊗ₜ 1 : D) * j₂ z' := by sorry
lemma
FLT
[ "import FLT.Data.Hurwitz", "import FLT.Data.QHat" ]
FLT/Data/HurwitzRatHat.lean
canonicalForm
/-- The inclusion from the profinite Hurwitz quaternions to to 𝔸+𝔸i+𝔸j+𝔸k, with 𝔸 the finite adeles of ℚ. -/
completed_units (z : D^ˣ) : ∃ (u : Dˣ) (v : 𝓞^ˣ), (z : D^) = j₁ u * j₂ v := sorry
lemma
FLT
[ "import FLT.Data.Hurwitz", "import FLT.Data.QHat" ]
FLT/Data/HurwitzRatHat.lean
completed_units
null
ZHat : Type := { carrier := { f : Π M : ℕ+, ZMod M | ∀ (D N : ℕ+) (h : (D : ℕ) ∣ N), ZMod.castHom h (ZMod D) (f N) = f D }, zero_mem' := by simp neg_mem' := fun {x} hx => by simp only [ZMod.castHom_apply, Set.mem_setOf_eq, Pi.neg_apply] at * peel hx with D N hD hx rw [ZMod.cast_neg hD, hx] add_mem' := fun {a b} ha hb => by simp only [ZMod.castHom_apply, Set.mem_setOf_eq, Pi.add_apply] at * intro D N hD rw [ZMod.cast_add hD, ha _ _ hD, hb _ _ hD] one_mem' := by simp only [ZMod.castHom_apply, Set.mem_setOf_eq, Pi.one_apply] intro D N hD rw [ZMod.cast_one hD] mul_mem' := fun {a b} ha hb => by simp only [ZMod.castHom_apply, Set.mem_setOf_eq, Pi.mul_apply] at * intro D N hD rw [ZMod.cast_mul hD, ha _ _ hD, hb _ _ hD] : Subring (Π n : ℕ+, ZMod n)} deriving CommRing namespace ZHat
def
FLT
[ "import Mathlib.Algebra.Order.Star.Basic", "import Mathlib.Analysis.Normed.Field.Lemmas", "import Mathlib.Data.PNat.Prime", "import Mathlib.RingTheory.Flat.TorsionFree" ]
FLT/Data/QHat.lean
ZHat
/-- We define the profinite completion of ℤ explicitly as compatible elements of ℤ/Nℤ for all positive integers `N`. We declare it as a subring of `∏_{N ≥ 1} (ℤ/Nℤ)`, and then promote it to a type. -/
prop (z : ZHat) (D N : ℕ+) (h : (D : ℕ) ∣ N) : ZMod.castHom h (ZMod D) (z N) = z D := z.2 .. @[ext]
lemma
FLT
[ "import Mathlib.Algebra.Order.Star.Basic", "import Mathlib.Analysis.Normed.Field.Lemmas", "import Mathlib.Data.PNat.Prime", "import Mathlib.RingTheory.Flat.TorsionFree" ]
FLT/Data/QHat.lean
prop
null
ext (x y : ZHat) (h : ∀ n : ℕ+, x n = y n) : x = y := Subtype.ext <| funext <| h @[simp] lemma zero_val (n : ℕ+) : (0 : ZHat) n = 0 := rfl @[simp] lemma one_val (n : ℕ+) : (1 : ZHat) n = 1 := rfl @[simp] lemma ofNat_val (m : ℕ) [m.AtLeastTwo] (n : ℕ+) : (OfNat.ofNat m : ZHat) n = (OfNat.ofNat m : ZMod n) := rfl @[simp] lemma natCast_val (m : ℕ) (n : ℕ+) : (m : ZHat) n = (m : ZMod n) := rfl @[simp] lemma intCast_val (m : ℤ) (n : ℕ+) : (m : ZHat) n = (m : ZMod n) := rfl
lemma
FLT
[ "import Mathlib.Algebra.Order.Star.Basic", "import Mathlib.Analysis.Normed.Field.Lemmas", "import Mathlib.Data.PNat.Prime", "import Mathlib.RingTheory.Flat.TorsionFree" ]
FLT/Data/QHat.lean
ext
null
commRing : CommRing ZHat := inferInstance
instance
FLT
[ "import Mathlib.Algebra.Order.Star.Basic", "import Mathlib.Analysis.Normed.Field.Lemmas", "import Mathlib.Data.PNat.Prime", "import Mathlib.RingTheory.Flat.TorsionFree" ]
FLT/Data/QHat.lean
commRing
null