File: Mathlib/NumberTheory/FLT/Three.lean

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.cube_of_castHom_ne_zero
code: private lemma cube_of_castHom_ne_zero {n : ZMod 9} :
    castHom (show 3 ∣ 9 by norm_num) (ZMod 3) n ≠ 0 → n ^ 3 = 1 ∨ n ^ 3 = 8 
goal: (ZMod.castHom ⋯ (ZMod 3)) n ≠ 0 → n ^ 3 = 1 ∨ n ^ 3 = 8

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.cube_of_not_dvd
code: private lemma cube_of_not_dvd {n : ℤ} (h : ¬ 3 ∣ n) :
    (n : ZMod 9) ^ 3 = 1 ∨ (n : ZMod 9) ^ 3 = 8 
goal: ↑n ^ 3 = 1 ∨ ↑n ^ 3 = 8

full_name: fermatLastTheoremThree_case_1
code: /-- If `a b c : ℤ` are such that `¬ 3 ∣ a * b * c`, then `a ^ 3 + b ^ 3 ≠ c ^ 3`. -/
theorem fermatLastTheoremThree_case_1 {a b c : ℤ} (hdvd : ¬ 3 ∣ a * b * c) :
    a ^ 3 + b ^ 3 ≠ c ^ 3 
goal: a ^ 3 + b ^ 3 ≠ c ^ 3

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.three_dvd_b_of_dvd_a_of_gcd_eq_one_of_case2
code: private lemma three_dvd_b_of_dvd_a_of_gcd_eq_one_of_case2 {a b c : ℤ} (ha : a ≠ 0)
    (Hgcd : Finset.gcd {a, b, c} id = 1) (h3a : 3 ∣ a) (HF : a ^ 3 + b ^ 3 + c ^ 3 = 0)
    (H : ∀ a b c : ℤ, c ≠ 0 → ¬ 3 ∣ a → ¬ 3 ∣ b  → 3 ∣ c → IsCoprime a b → a ^ 3 + b ^ 3 ≠ c ^ 3) :
    3 ∣ b 
goal: 3 ∣ b

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.fermatLastTheoremThree_of_dvd_a_of_gcd_eq_one_of_case2
code: private lemma fermatLastTheoremThree_of_dvd_a_of_gcd_eq_one_of_case2 {a b c : ℤ} (ha : a ≠ 0)
    (h3a : 3 ∣ a) (Hgcd : Finset.gcd {a, b, c} id = 1)
    (H : ∀ a b c : ℤ, c ≠ 0 → ¬ 3 ∣ a → ¬ 3 ∣ b  → 3 ∣ c → IsCoprime a b → a ^ 3 + b ^ 3 ≠ c ^ 3) :
    a ^ 3 + b ^ 3 + c ^ 3 ≠ 0 
goal: a ^ 3 + b ^ 3 + c ^ 3 ≠ 0

full_name: fermatLastTheoremThree_of_three_dvd_only_c
code: /--
  To prove Fermat's Last Theorem for `n = 3`, it is enough to show that that for all `a`, `b`, `c`
  in `ℤ` such that `c ≠ 0`, `¬ 3 ∣ a`, `¬ 3 ∣ b`, `a` and `b` are coprime and `3 ∣ c`, we have
  `a ^ 3 + b ^ 3 ≠ c ^ 3`.
-/
theorem fermatLastTheoremThree_of_three_dvd_only_c
    (H : ∀ a b c : ℤ, c ≠ 0 → ¬ 3 ∣ a → ¬ 3 ∣ b  → 3 ∣ c → IsCoprime a b → a ^ 3 + b ^ 3 ≠ c ^ 3) :
    FermatLastTheoremFor 3 
goal: FermatLastTheoremFor 3

full_name: _aux_Mathlib_NumberTheory_FLT_Three___macroRules_termη_1
code: local notation3 "η" => (IsPrimitiveRoot.isUnit (hζ.toInteger_isPrimitiveRoot) (by decide)).unit
goal: Lean.Macro

full_name: «_aux_Mathlib_NumberTheory_FLT_Three___macroRules_termλ_1»
code: local notation3 "λ" => hζ.toInteger - 1
goal: Lean.Macro

full_name: FermatLastTheoremForThreeGen
code: /-- `FermatLastTheoremForThreeGen` is the statement that `a ^ 3 + b ^ 3 = u * c ^ 3` has no
nontrivial solutions in `𝓞 K` for all `u : (𝓞 K)ˣ` such that `¬ λ ∣ a`, `¬ λ ∣ b` and `λ ∣ c`.
The reason to consider `FermatLastTheoremForThreeGen` is to make a descent argument working. -/
def FermatLastTheoremForThreeGen : Prop 
goal: Prop

full_name: FermatLastTheoremForThree_of_FermatLastTheoremThreeGen
code: /-- To prove `FermatLastTheoremFor 3`, it is enough to prove `FermatLastTheoremForThreeGen`. -/
lemma FermatLastTheoremForThree_of_FermatLastTheoremThreeGen :
    FermatLastTheoremForThreeGen hζ → FermatLastTheoremFor 3 
goal: FermatLastTheoremForThreeGen hζ → FermatLastTheoremFor 3

full_name: FermatLastTheoremForThreeGen.Solution'.hc
code: /-- `Solution'` is a tuple given by a solution to `a ^ 3 + b ^ 3 = u * c ^ 3`,
where `a`, `b`, `c` and `u` are as in `FermatLastTheoremForThreeGen`.
See `Solution` for the actual structure on which we will do the descent. -/
structure Solution' where
  a : 𝓞 K
  b : 𝓞 K
  c : 𝓞 K
  u : (𝓞 K)ˣ
  ha : ¬ λ ∣ a
  hb : ¬ λ ∣ b
  hc : c ≠ 0
  coprime : IsCoprime a b
  hcdvd : λ ∣ c
  H : a ^ 3 + b ^ 3 = u * c ^ 3
goal: self.c ≠ 0

full_name: FermatLastTheoremForThreeGen.Solution'.ha
code: /-- `Solution'` is a tuple given by a solution to `a ^ 3 + b ^ 3 = u * c ^ 3`,
where `a`, `b`, `c` and `u` are as in `FermatLastTheoremForThreeGen`.
See `Solution` for the actual structure on which we will do the descent. -/
structure Solution' where
  a : 𝓞 K
  b : 𝓞 K
  c : 𝓞 K
  u : (𝓞 K)ˣ
  ha : ¬ λ ∣ a
  hb : ¬ λ ∣ b
  hc : c ≠ 0
  coprime : IsCoprime a b
  hcdvd : λ ∣ c
  H : a ^ 3 + b ^ 3 = u * c ^ 3
goal: ¬hζ.toInteger - 1 ∣ self.a

full_name: FermatLastTheoremForThreeGen.Solution'.coprime
code: /-- `Solution'` is a tuple given by a solution to `a ^ 3 + b ^ 3 = u * c ^ 3`,
where `a`, `b`, `c` and `u` are as in `FermatLastTheoremForThreeGen`.
See `Solution` for the actual structure on which we will do the descent. -/
structure Solution' where
  a : 𝓞 K
  b : 𝓞 K
  c : 𝓞 K
  u : (𝓞 K)ˣ
  ha : ¬ λ ∣ a
  hb : ¬ λ ∣ b
  hc : c ≠ 0
  coprime : IsCoprime a b
  hcdvd : λ ∣ c
  H : a ^ 3 + b ^ 3 = u * c ^ 3
goal: IsCoprime self.a self.b

full_name: FermatLastTheoremForThreeGen.Solution'.u
code: /-- `Solution'` is a tuple given by a solution to `a ^ 3 + b ^ 3 = u * c ^ 3`,
where `a`, `b`, `c` and `u` are as in `FermatLastTheoremForThreeGen`.
See `Solution` for the actual structure on which we will do the descent. -/
structure Solution' where
  a : 𝓞 K
  b : 𝓞 K
  c : 𝓞 K
  u : (𝓞 K)ˣ
  ha : ¬ λ ∣ a
  hb : ¬ λ ∣ b
  hc : c ≠ 0
  coprime : IsCoprime a b
  hcdvd : λ ∣ c
  H : a ^ 3 + b ^ 3 = u * c ^ 3
goal: (NumberField.RingOfIntegers K)ˣ

full_name: FermatLastTheoremForThreeGen.Solution'.hb
code: /-- `Solution'` is a tuple given by a solution to `a ^ 3 + b ^ 3 = u * c ^ 3`,
where `a`, `b`, `c` and `u` are as in `FermatLastTheoremForThreeGen`.
See `Solution` for the actual structure on which we will do the descent. -/
structure Solution' where
  a : 𝓞 K
  b : 𝓞 K
  c : 𝓞 K
  u : (𝓞 K)ˣ
  ha : ¬ λ ∣ a
  hb : ¬ λ ∣ b
  hc : c ≠ 0
  coprime : IsCoprime a b
  hcdvd : λ ∣ c
  H : a ^ 3 + b ^ 3 = u * c ^ 3
goal: ¬hζ.toInteger - 1 ∣ self.b

full_name: FermatLastTheoremForThreeGen.Solution'.b
code: /-- `Solution'` is a tuple given by a solution to `a ^ 3 + b ^ 3 = u * c ^ 3`,
where `a`, `b`, `c` and `u` are as in `FermatLastTheoremForThreeGen`.
See `Solution` for the actual structure on which we will do the descent. -/
structure Solution' where
  a : 𝓞 K
  b : 𝓞 K
  c : 𝓞 K
  u : (𝓞 K)ˣ
  ha : ¬ λ ∣ a
  hb : ¬ λ ∣ b
  hc : c ≠ 0
  coprime : IsCoprime a b
  hcdvd : λ ∣ c
  H : a ^ 3 + b ^ 3 = u * c ^ 3
goal: NumberField.RingOfIntegers K

full_name: FermatLastTheoremForThreeGen.Solution'.a
code: /-- `Solution'` is a tuple given by a solution to `a ^ 3 + b ^ 3 = u * c ^ 3`,
where `a`, `b`, `c` and `u` are as in `FermatLastTheoremForThreeGen`.
See `Solution` for the actual structure on which we will do the descent. -/
structure Solution' where
  a : 𝓞 K
  b : 𝓞 K
  c : 𝓞 K
  u : (𝓞 K)ˣ
  ha : ¬ λ ∣ a
  hb : ¬ λ ∣ b
  hc : c ≠ 0
  coprime : IsCoprime a b
  hcdvd : λ ∣ c
  H : a ^ 3 + b ^ 3 = u * c ^ 3
goal: NumberField.RingOfIntegers K

full_name: FermatLastTheoremForThreeGen.Solution'.c
code: /-- `Solution'` is a tuple given by a solution to `a ^ 3 + b ^ 3 = u * c ^ 3`,
where `a`, `b`, `c` and `u` are as in `FermatLastTheoremForThreeGen`.
See `Solution` for the actual structure on which we will do the descent. -/
structure Solution' where
  a : 𝓞 K
  b : 𝓞 K
  c : 𝓞 K
  u : (𝓞 K)ˣ
  ha : ¬ λ ∣ a
  hb : ¬ λ ∣ b
  hc : c ≠ 0
  coprime : IsCoprime a b
  hcdvd : λ ∣ c
  H : a ^ 3 + b ^ 3 = u * c ^ 3
goal: NumberField.RingOfIntegers K

full_name: FermatLastTheoremForThreeGen.Solution'.hcdvd
code: /-- `Solution'` is a tuple given by a solution to `a ^ 3 + b ^ 3 = u * c ^ 3`,
where `a`, `b`, `c` and `u` are as in `FermatLastTheoremForThreeGen`.
See `Solution` for the actual structure on which we will do the descent. -/
structure Solution' where
  a : 𝓞 K
  b : 𝓞 K
  c : 𝓞 K
  u : (𝓞 K)ˣ
  ha : ¬ λ ∣ a
  hb : ¬ λ ∣ b
  hc : c ≠ 0
  coprime : IsCoprime a b
  hcdvd : λ ∣ c
  H : a ^ 3 + b ^ 3 = u * c ^ 3
goal: hζ.toInteger - 1 ∣ self.c

full_name: FermatLastTheoremForThreeGen.Solution'.H
code: /-- `Solution'` is a tuple given by a solution to `a ^ 3 + b ^ 3 = u * c ^ 3`,
where `a`, `b`, `c` and `u` are as in `FermatLastTheoremForThreeGen`.
See `Solution` for the actual structure on which we will do the descent. -/
structure Solution' where
  a : 𝓞 K
  b : 𝓞 K
  c : 𝓞 K
  u : (𝓞 K)ˣ
  ha : ¬ λ ∣ a
  hb : ¬ λ ∣ b
  hc : c ≠ 0
  coprime : IsCoprime a b
  hcdvd : λ ∣ c
  H : a ^ 3 + b ^ 3 = u * c ^ 3
goal: self.a ^ 3 + self.b ^ 3 = ↑self.u * self.c ^ 3

full_name: FermatLastTheoremForThreeGen.Solution'
code: /-- `Solution'` is a tuple given by a solution to `a ^ 3 + b ^ 3 = u * c ^ 3`,
where `a`, `b`, `c` and `u` are as in `FermatLastTheoremForThreeGen`.
See `Solution` for the actual structure on which we will do the descent. -/
structure Solution' where
  a : 𝓞 K
  b : 𝓞 K
  c : 𝓞 K
  u : (𝓞 K)ˣ
  ha : ¬ λ ∣ a
  hb : ¬ λ ∣ b
  hc : c ≠ 0
  coprime : IsCoprime a b
  hcdvd : λ ∣ c
  H : a ^ 3 + b ^ 3 = u * c ^ 3
goal: Type u_1

full_name: FermatLastTheoremForThreeGen.Solution.hab
code: /-- `Solution` is the same as `Solution'` with the additional assumption that `λ ^ 2 ∣ a + b`. -/
structure Solution extends Solution' hζ where
  hab : λ ^ 2 ∣ a + b
goal: (hζ.toInteger - 1) ^ 2 ∣ self.a + self.b

full_name: FermatLastTheoremForThreeGen.Solution
code: /-- `Solution` is the same as `Solution'` with the additional assumption that `λ ^ 2 ∣ a + b`. -/
structure Solution extends Solution' hζ where
  hab : λ ^ 2 ∣ a + b
goal: Type u_1

full_name: FermatLastTheoremForThreeGen.Solution'.multiplicity_lambda_c_finite
code: /-- For any `S' : Solution'`, the multiplicity of `λ` in `S'.c` is finite. -/
lemma Solution'.multiplicity_lambda_c_finite :
    multiplicity.Finite (hζ.toInteger - 1) S'.c 
goal: multiplicity.Finite (hζ.toInteger - 1) S'.c

full_name: FermatLastTheoremForThreeGen.Solution'.multiplicity
code: /-- Given `S' : Solution'`, `S'.multiplicity` is the multiplicity of `λ` in `S'.c`, as a natural
number. -/
def Solution'.multiplicity 
goal: ℕ

full_name: FermatLastTheoremForThreeGen.Solution.multiplicity
code: /-- Given `S : Solution`, `S.multiplicity` is the multiplicity of `λ` in `S.c`, as a natural
number. -/
def Solution.multiplicity 
goal: ℕ

full_name: FermatLastTheoremForThreeGen.Solution.isMinimal
code: /-- We say that `S : Solution` is minimal if for all `S₁ : Solution`, the multiplicity of `λ` in
`S.c` is less or equal than the multiplicity in `S₁.c`. -/
def Solution.isMinimal : Prop 
goal: Prop

full_name: FermatLastTheoremForThreeGen.Solution.exists_minimal
code: /-- If there is a solution then there is a minimal one. -/
lemma Solution.exists_minimal : ∃ (S₁ : Solution hζ), S₁.isMinimal 
goal: ∃ S₁, S₁.isMinimal

full_name: FermatLastTheoremForThreeGen.a_cube_b_cube_congr_one_or_neg_one
code: /-- Given `S' : Solution'`, then `S'.a` and `S'.b` are both congruent to `1` modulo `λ ^ 4` or are
both congruent to `-1`.  -/
lemma a_cube_b_cube_congr_one_or_neg_one :
    λ ^ 4 ∣ S'.a ^ 3 - 1 ∧ λ ^ 4 ∣ S'.b ^ 3 + 1 ∨ λ ^ 4 ∣ S'.a ^ 3 + 1 ∧ λ ^ 4 ∣ S'.b ^ 3 - 1 
goal: (hζ.toInteger - 1) ^ 4 ∣ S'.a ^ 3 - 1 ∧ (hζ.toInteger - 1) ^ 4 ∣ S'.b ^ 3 + 1 ∨
  (hζ.toInteger - 1) ^ 4 ∣ S'.a ^ 3 + 1 ∧ (hζ.toInteger - 1) ^ 4 ∣ S'.b ^ 3 - 1

full_name: FermatLastTheoremForThreeGen.lambda_pow_four_dvd_c_cube
code: /-- Given `S' : Solution'`, we have that `λ ^ 4` divides `S'.c ^ 3`. -/
lemma lambda_pow_four_dvd_c_cube : λ ^ 4 ∣ S'.c ^ 3 
goal: (hζ.toInteger - 1) ^ 4 ∣ S'.c ^ 3

full_name: FermatLastTheoremForThreeGen.lambda_sq_dvd_c
code: /-- Given `S' : Solution'`, we have that `λ ^ 2` divides `S'.c`. -/
lemma lambda_sq_dvd_c : λ ^ 2 ∣ S'.c 
goal: (hζ.toInteger - 1) ^ 2 ∣ S'.c

full_name: FermatLastTheoremForThreeGen.Solution'.two_le_multiplicity
code: /-- Given `S' : Solution'`, we have that `2 ≤ S'.multiplicity`. -/
lemma Solution'.two_le_multiplicity : 2 ≤ S'.multiplicity 
goal: 2 ≤ S'.multiplicity

full_name: FermatLastTheoremForThreeGen.Solution.two_le_multiplicity
code: /-- Given `S : Solution`, we have that `2 ≤ S.multiplicity`. -/
lemma Solution.two_le_multiplicity : 2 ≤ S.multiplicity 
goal: 2 ≤ S.multiplicity

full_name: FermatLastTheoremForThreeGen.a_cube_add_b_cube_eq_mul
code: /-- Given `S' : Solution'`, the key factorization of `S'.a ^ 3 + S'.b ^ 3`. -/
lemma a_cube_add_b_cube_eq_mul :
    S'.a ^ 3 + S'.b ^ 3 = (S'.a + S'.b) * (S'.a + η * S'.b) * (S'.a + η ^ 2 * S'.b) 
goal: S'.a ^ 3 + S'.b ^ 3 = (S'.a + S'.b) * (S'.a + ↑⋯.unit * S'.b) * (S'.a + ↑⋯.unit ^ 2 * S'.b)

full_name: FermatLastTheoremForThreeGen.lambda_sq_dvd_or_dvd_or_dvd
code: /-- Given `S' : Solution'`, we have that `λ ^ 2` divides one amongst `S'.a + S'.b`,
`S'.a + η * S'.b` and `S'.a + η ^ 2 * S'.b`. -/
lemma lambda_sq_dvd_or_dvd_or_dvd :
    λ ^ 2 ∣ S'.a + S'.b ∨ λ ^ 2 ∣ S'.a + η * S'.b ∨ λ ^ 2 ∣ S'.a + η ^ 2 * S'.b 
goal: (hζ.toInteger - 1) ^ 2 ∣ S'.a + S'.b ∨
  (hζ.toInteger - 1) ^ 2 ∣ S'.a + ↑⋯.unit * S'.b ∨ (hζ.toInteger - 1) ^ 2 ∣ S'.a + ↑⋯.unit ^ 2 * S'.b

full_name: FermatLastTheoremForThreeGen.ex_cube_add_cube_eq_and_isCoprime_and_not_dvd_and_dvd
code: /-- Given `S' : Solution'`, we may assume that `λ ^ 2` divides `S'.a + S'.b ∨ λ ^ 2` (see also the
result below). -/
lemma ex_cube_add_cube_eq_and_isCoprime_and_not_dvd_and_dvd :
    ∃ (a' b' : 𝓞 K), a' ^ 3 + b' ^ 3 = S'.u * S'.c ^ 3 ∧ IsCoprime a' b' ∧ ¬ λ ∣ a' ∧
      ¬ λ ∣ b' ∧ λ ^ 2 ∣ a' + b' 
goal: ∃ a' b',
  a' ^ 3 + b' ^ 3 = ↑S'.u * S'.c ^ 3 ∧
    IsCoprime a' b' ∧ ¬hζ.toInteger - 1 ∣ a' ∧ ¬hζ.toInteger - 1 ∣ b' ∧ (hζ.toInteger - 1) ^ 2 ∣ a' + b'

full_name: FermatLastTheoremForThreeGen.exists_Solution_of_Solution'
code: /-- Given `S' : Solution'`, then there is `S₁ : Solution` such that
`S₁.multiplicity = S'.multiplicity`. -/
lemma exists_Solution_of_Solution' : ∃ (S₁ : Solution hζ), S₁.multiplicity = S'.multiplicity 
goal: ∃ S₁, S₁.multiplicity = S'.multiplicity

full_name: FermatLastTheoremForThreeGen.Solution.a_add_eta_mul_b
code: lemma a_add_eta_mul_b : S.a + η * S.b = (S.a + S.b) + λ * S.b 
goal: S.a + ↑⋯.unit * S.b = S.a + S.b + (hζ.toInteger - 1) * S.b

full_name: FermatLastTheoremForThreeGen.Solution.lambda_dvd_a_add_eta_mul_b
code: /-- Given `(S : Solution)`, we have that `λ ∣ (S.a + η * S.b)`. -/
lemma lambda_dvd_a_add_eta_mul_b : λ ∣ (S.a + η * S.b) 
goal: hζ.toInteger - 1 ∣ S.a + ↑⋯.unit * S.b

full_name: FermatLastTheoremForThreeGen.Solution.lambda_dvd_a_add_eta_sq_mul_b
code: /-- Given `(S : Solution)`, we have that `λ ∣ (S.a + η ^ 2 * S.b)`. -/
lemma lambda_dvd_a_add_eta_sq_mul_b : λ ∣ (S.a + η ^ 2 * S.b) 
goal: hζ.toInteger - 1 ∣ S.a + ↑⋯.unit ^ 2 * S.b

full_name: FermatLastTheoremForThreeGen.Solution.lambda_sq_not_dvd_a_add_eta_mul_b
code: /-- Given `(S : Solution)`, we have that `λ ^ 2` does not divide `S.a + η * S.b`. -/
lemma lambda_sq_not_dvd_a_add_eta_mul_b : ¬ λ ^ 2 ∣ (S.a + η * S.b) 
goal: ¬(hζ.toInteger - 1) ^ 2 ∣ S.a + ↑⋯.unit * S.b

full_name: FermatLastTheoremForThreeGen.Solution.lambda_sq_not_dvd_a_add_eta_sq_mul_b
code: /-- Given `(S : Solution)`, we have that `λ ^ 2` does not divide `S.a + η ^ 2 * S.b`. -/
lemma lambda_sq_not_dvd_a_add_eta_sq_mul_b : ¬ λ ^ 2 ∣ (S.a + η ^ 2 * S.b) 
goal: ¬(hζ.toInteger - 1) ^ 2 ∣ S.a + ↑⋯.unit ^ 2 * S.b

full_name: FermatLastTheoremForThreeGen.Solution.associated_of_dvd_a_add_b_of_dvd_a_add_eta_mul_b
code: /-- If `p : 𝓞 K` is a prime that divides both `S.a + S.b` and `S.a + η * S.b`, then `p`
is associated with `λ`. -/
lemma associated_of_dvd_a_add_b_of_dvd_a_add_eta_mul_b {p : 𝓞 K} (hp : Prime p)
    (hpab : p ∣ S.a + S.b) (hpaηb : p ∣ S.a + η * S.b) : Associated p λ 
goal: Associated p (hζ.toInteger - 1)

full_name: FermatLastTheoremForThreeGen.Solution.associated_of_dvd_a_add_b_of_dvd_a_add_eta_sq_mul_b
code: /-- If `p : 𝓞 K` is a prime that divides both `S.a + S.b` and `S.a + η ^ 2 * S.b`, then `p`
is associated with `λ`. -/
lemma associated_of_dvd_a_add_b_of_dvd_a_add_eta_sq_mul_b {p : 𝓞 K} (hp : Prime p)
    (hpab : p ∣ (S.a + S.b)) (hpaηsqb : p ∣ (S.a + η ^ 2 * S.b)) : Associated p λ 
goal: Associated p (hζ.toInteger - 1)

full_name: FermatLastTheoremForThreeGen.Solution.associated_of_dvd_a_add_eta_mul_b_of_dvd_a_add_eta_sq_mul_b
code: /-- If `p : 𝓞 K` is a prime that divides both `S.a + η * S.b` and `S.a + η ^ 2 * S.b`, then `p`
is associated with `λ`. -/
lemma associated_of_dvd_a_add_eta_mul_b_of_dvd_a_add_eta_sq_mul_b {p : 𝓞 K} (hp : Prime p)
    (hpaηb : p ∣ S.a + η * S.b) (hpaηsqb : p ∣ S.a + η ^ 2 * S.b) : Associated p λ 
goal: Associated p (hζ.toInteger - 1)

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.y
code: /-- Given `S : Solution`, we let `S.y` be any element such that `S.a + η * S.b = λ * S.y` -/
private noncomputable def y 
goal: NumberField.RingOfIntegers K

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.y_spec
code: private lemma y_spec : S.a + η * S.b = λ * S.y 
goal: S.a + ↑⋯.unit * S.b = (hζ.toInteger - 1) * FermatLastTheoremForThreeGen.Solution.y S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.z
code: /-- Given `S : Solution`, we let `S.z` be any element such that `S.a + η ^ 2 * S.b = λ * S.z` -/
private noncomputable def z 
goal: NumberField.RingOfIntegers K

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.z_spec
code: private lemma z_spec : S.a + η ^ 2 * S.b = λ * S.z 
goal: S.a + ↑⋯.unit ^ 2 * S.b = (hζ.toInteger - 1) * FermatLastTheoremForThreeGen.Solution.z S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.lambda_not_dvd_y
code: private lemma lambda_not_dvd_y : ¬ λ ∣ S.y 
goal: ¬hζ.toInteger - 1 ∣ FermatLastTheoremForThreeGen.Solution.y S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.lambda_not_dvd_z
code: private lemma lambda_not_dvd_z : ¬ λ ∣ S.z 
goal: ¬hζ.toInteger - 1 ∣ FermatLastTheoremForThreeGen.Solution.z S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.lambda_pow_dvd_a_add_b
code: /-- We have that `λ ^ (3*S.multiplicity-2)` divides `S.a + S.b`. -/
private lemma lambda_pow_dvd_a_add_b : λ ^ (3 * S.multiplicity - 2) ∣ S.a + S.b 
goal: (hζ.toInteger - 1) ^ (3 * S.multiplicity - 2) ∣ S.a + S.b

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.x
code: /-- Given `S : Solution`, we let `S.x` be any element such that
`S.a + S.b = λ ^ (3*S.multiplicity-2) * S.x` -/
private noncomputable def x 
goal: NumberField.RingOfIntegers K

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.x_spec
code: private lemma x_spec : S.a + S.b = λ ^ (3 * S.multiplicity - 2) * S.x 
goal: S.a + S.b = (hζ.toInteger - 1) ^ (3 * S.multiplicity - 2) * FermatLastTheoremForThreeGen.Solution.x S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.w
code: /-- Given `S : Solution`, we let `S.w` be any element such that `S.c = λ ^ S.multiplicity * S.w` -/
private noncomputable def w 
goal: NumberField.RingOfIntegers K

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.w_spec
code: private lemma w_spec : S.c = λ ^ S.multiplicity * S.w 
goal: S.c = (hζ.toInteger - 1) ^ S.multiplicity * FermatLastTheoremForThreeGen.Solution.w S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.lambda_not_dvd_w
code: private lemma lambda_not_dvd_w : ¬ λ ∣ S.w 
goal: ¬hζ.toInteger - 1 ∣ FermatLastTheoremForThreeGen.Solution.w S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.lambda_not_dvd_x
code: private lemma lambda_not_dvd_x : ¬ λ ∣ S.x 
goal: ¬hζ.toInteger - 1 ∣ FermatLastTheoremForThreeGen.Solution.x S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.isCoprime_helper
code: private lemma isCoprime_helper {r s t w : 𝓞 K} (hr : ¬ λ ∣ r) (hs : ¬ λ ∣ s)
    (Hp : ∀ {p}, Prime p → p ∣ t → p ∣ w → Associated p λ) (H₁ : ∀ {q}, q ∣ r → q ∣ t)
    (H₂ : ∀ {q}, q ∣ s → q ∣ w) : IsCoprime r s 
goal: IsCoprime r s

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.isCoprime_x_y
code: private lemma isCoprime_x_y : IsCoprime S.x S.y 
goal: IsCoprime (FermatLastTheoremForThreeGen.Solution.x S) (FermatLastTheoremForThreeGen.Solution.y S)

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.isCoprime_x_z
code: private lemma isCoprime_x_z : IsCoprime S.x S.z 
goal: IsCoprime (FermatLastTheoremForThreeGen.Solution.x S) (FermatLastTheoremForThreeGen.Solution.z S)

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.isCoprime_y_z
code: private lemma isCoprime_y_z : IsCoprime S.y S.z 
goal: IsCoprime (FermatLastTheoremForThreeGen.Solution.y S) (FermatLastTheoremForThreeGen.Solution.z S)

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.x_mul_y_mul_z_eq_u_mul_w_cube
code: private lemma x_mul_y_mul_z_eq_u_mul_w_cube : S.x * S.y * S.z = S.u * S.w ^ 3 
goal: FermatLastTheoremForThreeGen.Solution.x S * FermatLastTheoremForThreeGen.Solution.y S *
    FermatLastTheoremForThreeGen.Solution.z S =
  ↑S.u * FermatLastTheoremForThreeGen.Solution.w S ^ 3

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.exists_cube_associated
code: private lemma exists_cube_associated :
    (∃ X, Associated (X ^ 3) S.x) ∧ (∃ Y, Associated (Y ^ 3) S.y) ∧
      ∃ Z, Associated (Z ^ 3) S.z 
goal: (∃ X, Associated (X ^ 3) (FermatLastTheoremForThreeGen.Solution.x S)) ∧
  (∃ Y, Associated (Y ^ 3) (FermatLastTheoremForThreeGen.Solution.y S)) ∧
    ∃ Z, Associated (Z ^ 3) (FermatLastTheoremForThreeGen.Solution.z S)

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.X
code: /-- Given `S : Solution`, we let `S.u₁` and `S.X` be any elements such that
`S.X ^ 3 * S.u₁ = S.x` -/
private noncomputable def X 
goal: NumberField.RingOfIntegers K

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.u₁
code: private noncomputable def u₁ 
goal: (NumberField.RingOfIntegers K)ˣ

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.X_u₁_spec
code: private lemma X_u₁_spec : S.X ^ 3 * S.u₁ = S.x 
goal: FermatLastTheoremForThreeGen.Solution.X S ^ 3 * ↑(FermatLastTheoremForThreeGen.Solution.u₁ S) =
  FermatLastTheoremForThreeGen.Solution.x S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.Y
code: /-- Given `S : Solution`, we let `S.u₂` and `S.Y` be any elements such that
`S.Y ^ 3 * S.u₂ = S.y` -/
private noncomputable def Y 
goal: NumberField.RingOfIntegers K

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.u₂
code: private noncomputable def u₂ 
goal: (NumberField.RingOfIntegers K)ˣ

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.Y_u₂_spec
code: private lemma Y_u₂_spec : S.Y ^ 3 * S.u₂ = S.y 
goal: FermatLastTheoremForThreeGen.Solution.Y S ^ 3 * ↑(FermatLastTheoremForThreeGen.Solution.u₂ S) =
  FermatLastTheoremForThreeGen.Solution.y S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.Z
code: /-- Given `S : Solution`, we let `S.u₃` and `S.Z` be any elements such that
`S.Z ^ 3 * S.u₃ = S.z` -/
private noncomputable def Z 
goal: NumberField.RingOfIntegers K

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.u₃
code: private noncomputable def u₃ 
goal: (NumberField.RingOfIntegers K)ˣ

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.Z_u₃_spec
code: private lemma Z_u₃_spec : S.Z ^ 3 * S.u₃ = S.z 
goal: FermatLastTheoremForThreeGen.Solution.Z S ^ 3 * ↑(FermatLastTheoremForThreeGen.Solution.u₃ S) =
  FermatLastTheoremForThreeGen.Solution.z S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.X_ne_zero
code: private lemma X_ne_zero : S.X ≠ 0 
goal: FermatLastTheoremForThreeGen.Solution.X S ≠ 0

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.lambda_not_dvd_X
code: private lemma lambda_not_dvd_X : ¬ λ ∣ S.X 
goal: ¬hζ.toInteger - 1 ∣ FermatLastTheoremForThreeGen.Solution.X S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.lambda_not_dvd_Y
code: private lemma lambda_not_dvd_Y : ¬ λ ∣ S.Y 
goal: ¬hζ.toInteger - 1 ∣ FermatLastTheoremForThreeGen.Solution.Y S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.lambda_not_dvd_Z
code: private lemma lambda_not_dvd_Z : ¬ λ ∣ S.Z 
goal: ¬hζ.toInteger - 1 ∣ FermatLastTheoremForThreeGen.Solution.Z S

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.isCoprime_Y_Z
code: private lemma isCoprime_Y_Z : IsCoprime S.Y S.Z 
goal: IsCoprime (FermatLastTheoremForThreeGen.Solution.Y S) (FermatLastTheoremForThreeGen.Solution.Z S)

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.formula1
code: private lemma formula1 : S.X^3*S.u₁*λ^(3*S.multiplicity-2)+S.Y^3*S.u₂*λ*η+S.Z^3*S.u₃*λ*η^2 = 0 
goal: FermatLastTheoremForThreeGen.Solution.X S ^ 3 * ↑(FermatLastTheoremForThreeGen.Solution.u₁ S) *
        (hζ.toInteger - 1) ^ (3 * S.multiplicity - 2) +
      FermatLastTheoremForThreeGen.Solution.Y S ^ 3 * ↑(FermatLastTheoremForThreeGen.Solution.u₂ S) *
          (hζ.toInteger - 1) *
        ↑⋯.unit +
    FermatLastTheoremForThreeGen.Solution.Z S ^ 3 * ↑(FermatLastTheoremForThreeGen.Solution.u₃ S) * (hζ.toInteger - 1) *
      ↑⋯.unit ^ 2 =
  0

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.u₄
code: /-- Let `u₄ := η * S.u₃ * S.u₂⁻¹` -/
private noncomputable def u₄ 
goal: (NumberField.RingOfIntegers K)ˣ

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.u₄_def
code: private lemma u₄_def : S.u₄ = η * S.u₃ * S.u₂⁻¹ 
goal: FermatLastTheoremForThreeGen.Solution.u₄ S =
  ⋯.unit * FermatLastTheoremForThreeGen.Solution.u₃ S * (FermatLastTheoremForThreeGen.Solution.u₂ S)⁻¹

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.u₅
code: /-- Let `u₅ := -η ^ 2 * S.u₁ * S.u₂⁻¹` -/
private noncomputable def u₅ 
goal: (NumberField.RingOfIntegers K)ˣ

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.u₅_def
code: private lemma u₅_def : S.u₅ = -η ^ 2 * S.u₁ * S.u₂⁻¹ 
goal: FermatLastTheoremForThreeGen.Solution.u₅ S =
  -⋯.unit ^ 2 * FermatLastTheoremForThreeGen.Solution.u₁ S * (FermatLastTheoremForThreeGen.Solution.u₂ S)⁻¹

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.formula2
code: private lemma formula2 :
    S.Y ^ 3 + S.u₄ * S.Z ^ 3 = S.u₅ * (λ ^ (S.multiplicity - 1) * S.X) ^ 3 
goal: FermatLastTheoremForThreeGen.Solution.Y S ^ 3 +
    ↑(FermatLastTheoremForThreeGen.Solution.u₄ S) * FermatLastTheoremForThreeGen.Solution.Z S ^ 3 =
  ↑(FermatLastTheoremForThreeGen.Solution.u₅ S) *
    ((hζ.toInteger - 1) ^ (S.multiplicity - 1) * FermatLastTheoremForThreeGen.Solution.X S) ^ 3

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.lambda_sq_div_u₅_mul
code: private lemma lambda_sq_div_u₅_mul : λ ^ 2 ∣ S.u₅ * (λ ^ (S.multiplicity - 1) * S.X) ^ 3 
goal: (hζ.toInteger - 1) ^ 2 ∣
  ↑(FermatLastTheoremForThreeGen.Solution.u₅ S) *
    ((hζ.toInteger - 1) ^ (S.multiplicity - 1) * FermatLastTheoremForThreeGen.Solution.X S) ^ 3

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.u₄_eq_one_or_neg_one
code: private lemma u₄_eq_one_or_neg_one : S.u₄ = 1 ∨ S.u₄ = -1 
goal: FermatLastTheoremForThreeGen.Solution.u₄ S = 1 ∨ FermatLastTheoremForThreeGen.Solution.u₄ S = -1

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.u₄_sq
code: private lemma u₄_sq : S.u₄ ^ 2 = 1 
goal: FermatLastTheoremForThreeGen.Solution.u₄ S ^ 2 = 1

full_name: _private.Mathlib.NumberTheory.FLT.Three.0.FermatLastTheoremForThreeGen.Solution.formula3
code: /-- Given `S : Solution`, we have that
`S.Y ^ 3 + (S.u₄ * S.Z) ^ 3 = S.u₅ * (λ ^ (S.multiplicity - 1) * S.X) ^ 3`. -/
private lemma formula3 :
    S.Y ^ 3 + (S.u₄ * S.Z) ^ 3 = S.u₅ * (λ ^ (S.multiplicity - 1) * S.X) ^ 3 
goal: FermatLastTheoremForThreeGen.Solution.Y S ^ 3 +
    (↑(FermatLastTheoremForThreeGen.Solution.u₄ S) * FermatLastTheoremForThreeGen.Solution.Z S) ^ 3 =
  ↑(FermatLastTheoremForThreeGen.Solution.u₅ S) *
    ((hζ.toInteger - 1) ^ (S.multiplicity - 1) * FermatLastTheoremForThreeGen.Solution.X S) ^ 3

full_name: FermatLastTheoremForThreeGen.Solution.Solution'_descent
code: /-- Given `S : Solution`, we construct `S₁ : Solution'`, with smaller multiplicity of `λ` in
  `c` (see `Solution'_descent_multiplicity_lt` below.). -/
noncomputable def Solution'_descent : Solution' hζ 
goal: FermatLastTheoremForThreeGen.Solution' hζ

full_name: FermatLastTheoremForThreeGen.Solution.Solution'_descent_multiplicity
code: /-- We have that `S.Solution'_descent.multiplicity = S.multiplicity - 1`. -/
lemma Solution'_descent_multiplicity : S.Solution'_descent.multiplicity = S.multiplicity - 1 
goal: S.Solution'_descent.multiplicity = S.multiplicity - 1

full_name: FermatLastTheoremForThreeGen.Solution.Solution'_descent_multiplicity_lt
code: /-- We have that `S.Solution'_descent.multiplicity < S.multiplicity`. -/
lemma Solution'_descent_multiplicity_lt :
    (Solution'_descent S).multiplicity < S.multiplicity 
goal: S.Solution'_descent.multiplicity < S.multiplicity

full_name: FermatLastTheoremForThreeGen.Solution.exists_Solution_multiplicity_lt
code: /-- Given any `S : Solution`, there is another `S₁ : Solution` such that
  `S₁.multiplicity < S.multiplicity` -/
theorem exists_Solution_multiplicity_lt :
    ∃ S₁ : Solution hζ, S₁.multiplicity < S.multiplicity 
goal: ∃ S₁, S₁.multiplicity < S.multiplicity

full_name: fermatLastTheoremThree
code: /-- Fermat's Last Theorem for `n = 3`: if `a b c : ℕ` are all non-zero then
`a ^ 3 + b ^ 3 ≠ c ^ 3`. -/
theorem fermatLastTheoremThree : FermatLastTheoremFor 3 
goal: FermatLastTheoremFor 3