Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

YukonModule.ProximityPrize.SubmissionLower.HFreeDefer6812.part0

Definition
Yukon_1994a5a4fe112e6c7d911069

by yukon · Oct 2, 2026 · Mathlib 0df444a (Lean v4.33.1)

better-codes

Source module ProximityPrize.SubmissionLower.HFreeDefer6812.

Definition code
import Definitions.Def_Yukon_88acd699d7b2611ef3b71a58

import Definitions.Def_Yukon_764c0ea7bc9f2561ee2ad916

import Definitions.Def_Yukon_92756c7c5028ffe108a201de

import Mathlib.FieldTheory.AlgebraicClosure

































































































































































































































































































































































































set_option backward.isDefEq.respectTransparency.types false
/-!
# H-free bridge, pieces 3 and 4 on the slice: `hdefer_holds`

At every normalized place `v` of `L0 = Frac(K[X,Y,Y',Γ]/(F₀))` over the slice (`ν ∘ ψ = v^e`),
`v` is trivial on `k = K(ℓ, X)`, `(ℓ, X)` is algebraically independent, and one of the two
free coordinates `x_a` (the slice form eliminates `x_i`) is transcendental over `k`: at a pole
of a free coordinate, that coordinate; at an affine place, `Y` or `Γ` (`q 1 = 0` or `i = 1`).
The other free coordinate satisfies the slice relation of degree `≤ N` (`core_poly`), and the
Dedekind `engine` gives `CrudeBound` and `ResiduallySeparable`.
-/

namespace ProximityPrize.SubmissionLower.HFree6812

open WithZero MvPolynomial
open RCN002 RCN208 RCN202 RCN135 RCN136 RCN219 RCN341 RCN313 RCN055 RCN095 RCN204

section SliceField

variable {K : Type} [Field K] (F₀ : MvPolynomial (Fin 4) K) [Fact (Irreducible F₀)]

/-- `L0` is generated by `K`, `X` and the coordinates. -/
theorem slice_gen (E' : Subfield (SliceField F₀))
    (hK : ∀ a : K, algebraMap K (SliceField F₀) a ∈ E') (hX : sliceProj F₀ (MvPolynomial.X 0) ∈ E')
    (hc : ∀ j, sliceCoord F₀ j ∈ E') : ∀ z, z ∈ E' := by
  have hP : ∀ P : MvPolynomial (Fin 4) K, sliceProj F₀ P ∈ E' := by
    intro P
    induction P using MvPolynomial.induction_on with
    | C a => rw [sliceProj_C]; exact hK a
    | add p q hp hq => rw [map_add]; exact E'.add_mem hp hq
    | mul_X p j hp =>
      rw [map_mul]
      refine E'.mul_mem hp ?_
      refine Fin.cases hX (fun m => hc m) j
  intro z
  obtain ⟨r, s, -, rfl⟩ := IsFractionRing.div_surjective (A := SliceRing F₀) z
  obtain ⟨P, rfl⟩ := Ideal.Quotient.mk_surjective r
  obtain ⟨Q, rfl⟩ := Ideal.Quotient.mk_surjective s
  exact E'.div_mem (hP P) (hP Q)

/-- `sliceProj` as a `K`-algebra map evaluates polynomials at `(X, coordinates)`. -/
theorem aeval_slice (P : MvPolynomial (Fin 4) K) :
    aeval (Fin.cons (sliceProj F₀ (MvPolynomial.X 0)) (sliceCoord F₀) : Fin 4 → SliceField F₀) P =
      sliceProj F₀ P := by
  induction P using MvPolynomial.induction_on with
  | C a => rw [aeval_C, sliceProj_C]
  | add p q hp hq => rw [map_add, map_add, hp, hq]
  | mul_X p j hp =>
    rw [map_mul, map_mul, hp, aeval_X]
    congr 1
    refine Fin.cases rfl (fun m => rfl) j




/-- Elements algebraic over a subfield on which `v` is trivial are `v`-units. -/
theorem v_eq_one_of_isAlgebraic {L : Type*} [Field L] (v : Valuation L ℤᵐ⁰) {k : Type*}
    [Field k] [Algebra k L] (hk : ∀ a : k, v (algebraMap k L a) ≤ 1) {z : L} (hz0 : z ≠ 0)
    (hz : IsAlgebraic k z) : v z = 1 := by
  have h1 := le_one_of_isIntegral v hk hz.isIntegral
  have h2 := le_one_of_isIntegral v hk (IsAlgebraic.inv_iff.2 hz).isIntegral
  rw [map_inv₀] at h2
  have hv0 : v z ≠ 0 := (Valuation.ne_zero_iff v).2 hz0
  refine le_antisymm h1 ?_
  by_contra h
  rw [not_le] at h
  exact absurd h2 (not_le.2 ((one_lt_inv₀ (zero_lt_iff.2 hv0)).2 h))

theorem vars_aeval_X0 (p : Polynomial K) :
    (Polynomial.aeval (MvPolynomial.X 0 : MvPolynomial (Fin 4) K) p).vars ⊆ {0} := by
  classical
  induction p using Polynomial.induction_on' with
  | add p q hp hq => rw [map_add]; exact (vars_add_subset _ _).trans (Finset.union_subset hp hq)
  | monomial n a =>
    rw [Polynomial.aeval_monomial, algebraMap_eq]
    refine (vars_mul _ _).trans (Finset.union_subset (by rw [vars_C]; exact Finset.empty_subset _) ?_)
    exact (vars_pow _ _).trans (by rw [vars_X])

/-- **(X, x_a, ℓ) independence when `ℓ` avoids `Y'`.**  `F₀` involves `Y'` (`2 ∈ vars F₀`); if
`q 1 = 0` and `a, i ≠ 1`, a relation among `x_a, ℓ, X` pulls back to a multiple of `F₀` free of
`Y'`, hence zero. -/
theorem algInd_of_Y'_free (q : Fin 3 → Polynomial K) (i a : Fin 3) (hia : i ≠ a) (hi1 : i ≠ 1)
    (ha1 : a ≠ 1) (hqi : q i = 1) (hq1 : q 1 = 0) (h2 : (2 : Fin 4) ∈ F₀.vars) :
    AlgebraicIndependent K (fun o : Option (Fin 2) =>
      o.elim (sliceCoord F₀ a) ![sliceLinearL F₀ q, sliceProj F₀ (MvPolynomial.X 0)]) := by
  classical
  rw [algebraicIndependent_iff_injective_aeval, injective_iff_map_eq_zero]
  intro Q hQ
  set ℓp : MvPolynomial (Fin 4) K :=
    ∑ m, Polynomial.aeval (MvPolynomial.X 0) (q m) * MvPolynomial.X m.succ
  let ρv : Option (Fin 2) → MvPolynomial (Fin 4) K :=
    fun o => o.elim (MvPolynomial.X a.succ) ![ℓp, MvPolynomial.X 0]
  have hfun : (fun o => aeval (Fin.cons (sliceProj F₀ (MvPolynomial.X 0)) (sliceCoord F₀) :
      Fin 4 → SliceField F₀) (ρv o)) =
      fun o => o.elim (sliceCoord F₀ a) ![sliceLinearL F₀ q, sliceProj F₀ (MvPolynomial.X 0)] := by
    funext o
    rcases o with _ | j
    · simp [ρv]
    · fin_cases j
      · show aeval (Fin.cons (sliceProj F₀ (MvPolynomial.X 0)) (sliceCoord F₀) :
          Fin 4 → SliceField F₀) ℓp = sliceLinearL F₀ q
        simp only [ℓp, map_sum, map_mul, ← Polynomial.aeval_algHom_apply, aeval_X, Fin.cons_zero,
          Fin.cons_succ]
        rfl
      · simp [ρv]
  have hρ : sliceProj F₀ (aeval ρv Q) = 0 := by
    rw [← aeval_slice, comp_aeval_apply, hfun, hQ]
  have hdvd : F₀ ∣ aeval ρv Q := (sliceProj_eq_zero_iff F₀ _).1 hρ
  have hv : (2 : Fin 4) ∉ (aeval ρv Q).vars := by
    rw [aeval_eq_bind₁]
    intro hmem
    obtain ⟨o, -, ho⟩ := Finset.mem_biUnion.1 (vars_bind₁ _ _ hmem)
    rcases o with _ | j
    · rw [show ρv none = MvPolynomial.X a.succ from rfl, vars_X, Finset.mem_singleton] at ho
      exact ha1 (Fin.succ_injective _ (by simpa using ho.symm))
    · fin_cases j
      · have hsub := vars_sum_subset (Finset.univ : Finset (Fin 3))
          (fun m => Polynomial.aeval (MvPolynomial.X 0 : MvPolynomial (Fin 4) K) (q m) *
            MvPolynomial.X m.succ)
        obtain ⟨m, -, hm⟩ := Finset.mem_biUnion.1 (hsub ho)
        rcases Finset.mem_union.1 (vars_mul _ _ hm) with h | h
        · have := vars_aeval_X0 (q m) h
          simp at this
        · rw [vars_X, Finset.mem_singleton] at h
          have hm1 : m = 1 := Fin.succ_injective _ (by simpa using h.symm)
          subst hm1
          rw [hq1, map_zero, zero_mul, vars_0] at hm
          exact Finset.notMem_empty _ hm
      · simp [ρv] at ho
  have hzero : aeval ρv Q = 0 := by
    obtain ⟨G, hG⟩ := hdvd
    by_contra hne
    have hG0 : G ≠ 0 := by rintro rfl; rw [mul_zero] at hG; exact hne hG
    have hF0 : F₀ ≠ 0 := (Fact.out : Irreducible F₀).ne_zero
    apply hv
    rw [hG, mem_vars_iff_degreeOf_ne_zero, degreeOf_mul_eq hF0 hG0]
    have := mem_vars_iff_degreeOf_ne_zero.1 h2
    omega
  -- left inverse
  let τv : Fin 4 → MvPolynomial (Option (Fin 2)) K := Fin.cons (MvPolynomial.X (some 1))
    fun m => if m = a then MvPolynomial.X none else if m = i then
      MvPolynomial.X (some 0) - Polynomial.aeval (MvPolynomial.X (some 1)) (q a) *
        MvPolynomial.X none else 0
  have hτρ : ∀ o, aeval τv (ρv o) = MvPolynomial.X o := by
    rintro (_ | j)
    · simp [ρv, τv]
    · fin_cases j
      · show aeval τv ℓp = MvPolynomial.X (some 0)
        simp only [ℓp, map_sum, map_mul, ← Polynomial.aeval_algHom_apply, aeval_X]
        rw [sum_fin3_distinct _ i a 1 hia hi1 ha1]
        have t1 : τv i.succ = MvPolynomial.X (some 0) -
            Polynomial.aeval (MvPolynomial.X (some 1)) (q a) * MvPolynomial.X none := by
          simp [τv, hia]
        have t2 : τv a.succ = MvPolynomial.X none := by simp [τv]
        have t0 : τv 0 = MvPolynomial.X (some 1) := rfl
        rw [t0, t1, t2, hqi, hq1, map_one, map_zero]
        simp
      · simp [ρv, τv]
  have h := congrArg (aeval τv) hzero
  rw [comp_aeval_apply, show (fun o => aeval τv (ρv o)) = MvPolynomial.X from funext hτρ,
    aeval_X_left_apply, map_zero] at h
  exact h

end SliceField

section Slice

variable {K : Type} [Field K] {E : Type} [Field E] [Algebra (GenericField K) E]
  [Algebra (RatFunc (GenericField K)) E]
  [IsScalarTower (GenericField K) (RatFunc (GenericField K)) E]
  (D : Ideal (MvPolynomial (Fin 3) E)) [D.IsPrime] (F₀ : MvPolynomial (Fin 4) K)
  [Fact (Irreducible F₀)] (hker : RingHom.ker (sliceMap (K := K) D) = Ideal.span {F₀})

/-- `k = K(ℓ, X)`. -/
noncomputable abbrev kField (q : Fin 3 → Polynomial K) : IntermediateField K (SliceField F₀) :=
  IntermediateField.adjoin K (Set.range ![sliceLinearL F₀ q, sliceProj F₀ (MvPolynomial.X 0)])

omit [Algebra (RatFunc (GenericField K)) E]
  [IsScalarTower (GenericField K) (RatFunc (GenericField K)) E] in
theorem psi_aeval_X0 (p : Polynomial K) :
    sliceEmbedding D F₀ hker (Polynomial.aeval (sliceProj F₀ (MvPolynomial.X 0)) p) =
      algebraMap E (CoordinateField E D) (phiE K E p) := by
  refine Polynomial.induction_on p (fun a => ?_) (fun p r hp hr => ?_) (fun n a h => ?_)
  · rw [Polynomial.aeval_C, psi_const]
  · rw [map_add, map_add, hp, hr, map_add, map_add]
  · rw [pow_succ, ← mul_assoc, map_mul, map_mul, h, Polynomial.aeval_X, psi_X0]
    simp only [map_mul]

omit [IsScalarTower (GenericField K) (RatFunc (GenericField K)) E] in
/-- `ψ ℓ = t`. -/
theorem psi_ell (c : Fin 3 → GenericField K) (q : Fin 3 → Polynomial K)
    (hq : ∀ m, polynomialEmbedding K (q m) = c m)
    (hslice : MvPolynomial.C (sliceValue (GenericField K) E) -
      scalarPolynomialMap (GenericField K) E
        (∑ m, MvPolynomial.C (c m) * MvPolynomial.X m) ∈ D) :
    sliceEmbedding D F₀ hker (sliceLinearL F₀ q) =
      algebraMap E (CoordinateField E D) (sliceValue (GenericField K) E) := by
  have hev : ∀ P : MvPolynomial (Fin 3) (GenericField K),
      aeval (coordinate E D) P = coordinateEvaluation E D (scalarPolynomialMap (GenericField K) E P) := by
    intro P
    rw [coordinateEvaluation_eq_aeval, scalarPolynomialMap, aeval_map_algebraMap]
  have hsl : ∑ m, algebraMap (GenericField K) (CoordinateField E D) (c m) * coordinate E D m =
      algebraMap E (CoordinateField E D) (sliceValue (GenericField K) E) := by
    have h1 := (coordEval_eq_zero_iff D _).2 hslice
    rw [map_sub, sub_eq_zero, ← hev] at h1
    have h2 : coordinateEvaluation E D (MvPolynomial.C (sliceValue (GenericField K) E)) =
        algebraMap E (CoordinateField E D) (sliceValue (GenericField K) E) :=
      (coordinateEvaluation E D).commutes _
    rw [h2] at h1
    rw [h1]
    simp only [map_sum, map_mul, aeval_C, aeval_X]
  rw [sliceLinearL, map_sum, ← hsl]
  refine Finset.sum_congr rfl fun m _ => ?_
  rw [map_mul, psi_aeval_X0, psi_coord, ← hq m,
    IsScalarTower.algebraMap_apply (GenericField K) E (CoordinateField E D)]
  rfl

omit [IsScalarTower (GenericField K) (RatFunc (GenericField K)) E] in
theorem psi_kField (c : Fin 3 → GenericField K) (q : Fin 3 → Polynomial K)
    (hq : ∀ m, polynomialEmbedding K (q m) = c m)
    (hslice : MvPolynomial.C (sliceValue (GenericField K) E) -
      scalarPolynomialMap (GenericField K) E
        (∑ m, MvPolynomial.C (c m) * MvPolynomial.X m) ∈ D) :
    ∀ z ∈ kField F₀ q, sliceEmbedding D F₀ hker z ∈
      (algebraMap E (CoordinateField E D)).fieldRange := by
  let T : Subfield (SliceField F₀) :=
    (algebraMap E (CoordinateField E D)).fieldRange.comap (sliceEmbedding D F₀ hker)
  have hT : kField F₀ q ≤ T.toIntermediateField (fun a =>
      show sliceEmbedding D F₀ hker (algebraMap K _ a) ∈
        (algebraMap E (CoordinateField E D)).fieldRange from by
      rw [psi_const]; exact ⟨_, rfl⟩) := by
    rw [IntermediateField.adjoin_le_iff]
    rintro _ ⟨j, rfl⟩
    fin_cases j
    · show sliceEmbedding D F₀ hker (sliceLinearL F₀ q) ∈
        (algebraMap E (CoordinateField E D)).fieldRange
      rw [psi_ell D F₀ hker c q hq hslice]; exact ⟨_, rfl⟩
    · show sliceEmbedding D F₀ hker (sliceProj F₀ (MvPolynomial.X 0)) ∈
        (algebraMap E (CoordinateField E D)).fieldRange
      rw [psi_X0]; exact ⟨_, rfl⟩
  exact fun z hz => hT hz

/-- `v` is trivial on `k`. -/
theorem v_trivial_kField (c : Fin 3 → GenericField K) (q : Fin 3 → Polynomial K)
    (hq : ∀ m, polynomialEmbedding K (q m) = c m)
    (hslice : MvPolynomial.C (sliceValue (GenericField K) E) -
      scalarPolynomialMap (GenericField K) E
        (∑ m, MvPolynomial.C (c m) * MvPolynomial.X m) ∈ D)
    (ν : RCN026.Place E (CoordinateField E D)) (e : ℕ) (v : Valuation (SliceField F₀) ℤᵐ⁰)
    (he : 1 ≤ e) (hwve : ∀ x, ν.val (sliceEmbedding D F₀ hker x) = v x ^ e) :
    ∀ z ∈ kField F₀ q, z ≠ 0 → v z = 1 := by
  intro z hz hz0
  obtain ⟨y, hy⟩ := psi_kField D F₀ hker c q hq hslice z hz
  have hy0 : y ≠ 0 := by
    rintro rfl
    rw [map_zero, eq_comm, map_eq_zero_iff _ (sliceEmbedding D F₀ hker).injective] at hy
    exact hz0 hy
  have h1 : ν.val (sliceEmbedding D F₀ hker z) = 1 := by
    rw [← hy]; exact (ν.property.2).eq_one y hy0
  rw [hwve] at h1
  have he0 : e ≠ 0 := by omega
  exact le_antisymm ((zm_pow_le_one he0).1 h1.le)
    (not_lt.1 fun hlt => absurd h1 (ne_of_lt ((zm_pow_lt_one he0).2 hlt)))

omit [D.IsPrime] [Fact (Irreducible F₀)] in
theorem transcendental_sliceValue_adjoin :
    letI : Algebra K E := ((phiE K E).comp Polynomial.C).toAlgebra
    Transcendental (Algebra.adjoin K (Set.range ![phiE K E Polynomial.X]))
      (sliceValue (GenericField K) E) := by
  letI : Algebra K E := ((phiE K E).comp Polynomial.C).toAlgebra
  rw [transcendental_iff]
  intro p hp
  have hsub : ∀ y ∈ Algebra.adjoin K (Set.range ![phiE K E Polynomial.X]),
      y ∈ (algebraMap (GenericField K) E).range := by
    intro y hy
    induction hy using Algebra.adjoin_induction with
    | mem y hy =>
      obtain ⟨j, rfl⟩ := hy
      fin_cases j
      exact ⟨polynomialEmbedding K Polynomial.X, rfl⟩
    | algebraMap r => exact ⟨polynomialEmbedding K (Polynomial.C r), rfl⟩
    | add y z _ _ hy hz => exact (algebraMap (GenericField K) E).range.add_mem hy hz
    | mul y z _ _ hy hz => exact (algebraMap (GenericField K) E).range.mul_mem hy hz
  have hlift : p.map (algebraMap (Algebra.adjoin K (Set.range ![phiE K E Polynomial.X])) E) ∈
      Polynomial.lifts (algebraMap (GenericField K) E) := by
    rw [Polynomial.lifts_iff_coeff_lifts]
    intro n
    rw [Polynomial.coeff_map]
    exact hsub _ (p.coeff n).2
  obtain ⟨p', hp'⟩ := (Polynomial.mem_lifts _).1 hlift
  have hp'0 : p' = 0 := by
    refine (transcendental_iff.1 (sliceValue_transcendental (Ω := GenericField K) (E := E))) p' ?_
    rw [Polynomial.aeval_def, ← Polynomial.eval_map, hp', Polynomial.eval_map, ← Polynomial.aeval_def]
    exact hp
  rw [hp'0, Polynomial.map_zero, eq_comm, Polynomial.map_eq_zero_iff Subtype.val_injective] at hp'
  exact hp'

include hker in
/-- `(ℓ, X)` is algebraically independent over `K`. -/
theorem algInd_ell_X0 (c : Fin 3 → GenericField K) (q : Fin 3 → Polynomial K)
    (hq : ∀ m, polynomialEmbedding K (q m) = c m)
    (hslice : MvPolynomial.C (sliceValue (GenericField K) E) -
      scalarPolynomialMap (GenericField K) E
        (∑ m, MvPolynomial.C (c m) * MvPolynomial.X m) ∈ D) :
    AlgebraicIndependent K ![sliceLinearL F₀ q, sliceProj F₀ (MvPolynomial.X 0)] := by
  classical
  letI iKE : Algebra K E := ((phiE K E).comp Polynomial.C).toAlgebra
  have hφinj : Function.Injective (phiE K E) :=
    (algebraMap (GenericField K) E).injective.comp (polynomialEmbedding_injective K)
  have hx : Transcendental K (phiE K E Polynomial.X) := by
    rw [transcendental_iff_injective]
    have : ∀ p : Polynomial K, Polynomial.aeval (phiE K E Polynomial.X) p = phiE K E p := by
      intro p
      rw [Polynomial.aeval_def]
      conv_rhs => rw [← Polynomial.eval₂_C_X (p := p)]
      rw [Polynomial.hom_eval₂]
      rfl
    intro p r h
    exact hφinj ((this p).symm.trans (h.trans (this r)))
  have h := (AlgebraicIndependent.option_iff (x := ![phiE K E Polynomial.X])
    (a := sliceValue (GenericField K) E)).2
    ⟨algebraicIndependent_unique_type_iff.2 hx, transcendental_sliceValue_adjoin⟩
  have hE : AlgebraicIndependent K ![sliceValue (GenericField K) E, phiE K E Polynomial.X] := by
    refine (algebraicIndependent_equiv' (finSuccEquiv 1) ?_).2 h
    funext j
    fin_cases j <;> rfl
  have hψQ : ∀ Q, sliceEmbedding D F₀ hker
      (aeval ![sliceLinearL F₀ q, sliceProj F₀ (MvPolynomial.X 0)] Q) =
      algebraMap E (CoordinateField E D)
        (aeval (R := K) ![sliceValue (GenericField K) E, phiE K E Polynomial.X] Q) := by
    intro Q
    induction Q using MvPolynomial.induction_on with
    | C a => rw [aeval_C, aeval_C, psi_const]; rfl
    | add p r hp hr => rw [map_add, map_add, hp, hr, map_add, map_add]
    | mul_X p j hp =>
      rw [map_mul, map_mul, map_mul, hp, aeval_X, aeval_X, map_mul]
      congr 1
      fin_cases j
      · exact psi_ell D F₀ hker c q hq hslice
      · exact psi_X0 D F₀ hker
  rw [algebraicIndependent_iff_injective_aeval, injective_iff_map_eq_zero]
  rw [algebraicIndependent_iff_injective_aeval, injective_iff_map_eq_zero] at hE
  intro Q hQ
  refine hE Q ?_
  have h1 := hψQ Q
  rw [hQ, map_zero, eq_comm, map_eq_zero_iff _ (algebraMap E (CoordinateField E D)).injective] at h1
  exact h1

end Slice

section Main

theorem exists_third (i a : Fin 3) (h : a ≠ i) : ∃ c, c ≠ i ∧ c ≠ a := by
  revert h; revert i a; decide

theorem exists_two_others (i : Fin 3) : ∃ a c : Fin 3, i ≠ a ∧ i ≠ c ∧ a ≠ c := by
  revert i; decide

theorem exists_not_one (i : Fin 3) (hi : i ≠ 1) : ∃ a : Fin 3, i ≠ a ∧ a ≠ 1 := by
  revert hi; revert i; decide

theorem split_sum' {K M : Type*} [Field K] [CommRing M] [Algebra K M] (q : Fin 3 → Polynomial K)
    (i a c : Fin 3) (hia : i ≠ a) (hic : i ≠ c) (hac : a ≠ c) (hqi : q i = 1) (z : M)
    (y : Fin 3 → M) :
    y i = ∑ m, Polynomial.aeval z (q m) * y m - Polynomial.aeval z (q a) * y a -
      Polynomial.aeval z (q c) * y c := by
  rw [sum_fin3_distinct _ i a c hia hic hac, hqi, map_one, one_mul]; ring

variable {K : Type} [Field K] {E : Type} [Field E] [Algebra (GenericField K) E]
  [Algebra (RatFunc (GenericField K)) E]
  [IsScalarTower (GenericField K) (RatFunc (GenericField K)) E]

/-- **`hdefer`**: pieces 3 and 4 at every place of `L0` over the slice.  The conclusion is
exactly the `hdefer` input of `hfree_slice_budget`. -/
theorem hdefer_holds (F : MvPolynomial (Fin 4) K) (D : Ideal (MvPolynomial (Fin 3) E))
    [D.IsPrime] (hHD : surfaceMap (phiE K E) (polyH K F) ∉ D)
    (c : Fin 3 → GenericField K) (i : Fin 3) (hci : c i = 1) (q : Fin 3 → Polynomial K)
    (hq : ∀ m, polynomialEmbedding K (q m) = c m) (hq1 : i = 1 ∨ q 1 = 0)
    (hslice : MvPolynomial.C (sliceValue (GenericField K) E) -
      scalarPolynomialMap (GenericField K) E
        (∑ m, MvPolynomial.C (c m) * MvPolynomial.X m) ∈ D)
    (N : ℕ) (hN : MvPolynomial.weightedTotalDegree ![0, 1, 1, 1] F ≤ N)
    (hNK : ∀ n : ℕ, 0 < n → n ≤ N → (n : K) ≠ 0) :
    ∀ (F₀ : MvPolynomial (Fin 4) K) [Fact (Irreducible F₀)] (hdvd : F₀ ∣ F)
      (hker : RingHom.ker (sliceMap (K := K) D) = Ideal.span {F₀})
      (ν : RCN026.Place E (CoordinateField E D)) (e : ℕ) (v : Valuation (SliceField F₀) ℤᵐ⁰),
      1 ≤ e → (∃ x, v x = exp (-1)) →
      (∀ x, ν.val (sliceEmbedding D F₀ hker x) = v x ^ e) →
      (∃ C, CrudeBound v (sliceDerivation F F₀ hdvd) C) ∧
      ResiduallySeparable v (sliceDerivation F F₀ hdvd)
        (exp (vpole v (sliceDerivation F F₀ hdvd (sliceLinearL F₀ q)))) := by
  intro F₀ _ hdvd hker ν e v he hvn hwve
  classical
  set Dd := sliceDerivation F F₀ hdvd with hDd
  set X0 := sliceProj F₀ (MvPolynomial.X 0) with hX0
  set x := sliceCoord F₀ with hx
  set ℓ := sliceLinearL F₀ q with hℓ
  set k := kField F₀ q with hk
  set Λ0 := vpole v (Dd ℓ) with hΛ0
  have hqi : q i = 1 := polynomialEmbedding_injective K (by rw [hq, hci, map_one])
  have hH : sliceProj F₀ (polyH K F) ≠ 0 := by
    intro h
    apply hHD
    have h1 : sliceEmbedding D F₀ hker (sliceProj F₀ (polyH K F)) = 0 := by rw [h, map_zero]
    rw [sliceEmbedding_proj] at h1
    exact (coordEval_eq_zero_iff D _).1 h1
  have hF : F ≠ 0 := by rintro rfl; apply hHD; simp [polyH]
  have hkv : ∀ z ∈ k, z ≠ 0 → v z = 1 := v_trivial_kField D F₀ hker c q hq hslice ν e v he hwve
  have hkle : ∀ z ∈ k, v z ≤ 1 := fun z hz => by
    by_cases h0 : z = 0
    · rw [h0, v.map_zero]; exact zero_le
    · exact (hkv z hz h0).le
  have hkle' : ∀ r : k, v (algebraMap k (SliceField F₀) r) ≤ 1 := fun r => hkle r r.2
  have hAI1 := algInd_ell_X0 D F₀ hker c q hq hslice
  have hΛ0nn : 0 ≤ Λ0 := vpole_nonneg _ _
  have hℓk : ℓ ∈ k := IntermediateField.subset_adjoin K _ ⟨0, rfl⟩
  have hX0k : X0 ∈ k := IntermediateField.subset_adjoin K _ ⟨1, rfl⟩
  have hkT : ∀ z ∈ k, Tame v Dd (exp Λ0) z := by
    intro z hz
    induction hz using IntermediateField.adjoin_induction with
    | mem z hz =>
      obtain ⟨j, rfl⟩ := hz
      fin_cases j
      · exact ⟨hkle _ hℓk, v_le_exp_vpole v _⟩
      · refine ⟨hkle _ hX0k, ?_⟩
        show v (Dd X0) ≤ _
        rw [hDd, sliceDerivation_X0 F F₀ hdvd hH, v.map_one, ← exp_zero, exp_le_exp]
        exact hΛ0nn
    | algebraMap r =>
      refine ⟨hkle _ (k.algebraMap_mem r), ?_⟩
      rw [Derivation.map_algebraMap, v.map_zero]; exact zero_le
    | add z w _ _ hz hw => exact (tameSubring v Dd _).add_mem hz hw
    | mul z w _ _ hz hw => exact (tameSubring v Dd _).mul_mem hz hw
    | inv z hzk hz =>
      by_cases h0 : z = 0
      · rw [h0, inv_zero]; exact (tameSubring v Dd _).zero_mem
      · exact tame_inv v Dd _ z hz (hkv z hzk h0)
  have hkD : ∀ z ∈ k, v (Dd z) ≤ exp Λ0 := fun z hz => (hkT z hz).2
  have hN' := support_bound_of_weighted F N hN
  have hFx : aeval (Fin.cons X0 x : Fin 4 → SliceField F₀) F = 0 := by
    rw [aeval_slice]; exact (sliceProj_eq_zero_iff F₀ F).2 hdvd
  have haevk : ∀ p : Polynomial K, Polynomial.aeval X0 p ∈ k := by
    intro p
    have h1 := Polynomial.aeval_algebraMap_apply (SliceField F₀) (⟨X0, hX0k⟩ : k) p
    rw [show algebraMap k (SliceField F₀) ⟨X0, hX0k⟩ = X0 from rfl] at h1
    rw [h1]; exact (Polynomial.aeval (⟨X0, hX0k⟩ : k) p).2
  -- the engine, for a free coordinate `x a` transcendental over `k`
  have key : ∀ a c', i ≠ a → i ≠ c' → a ≠ c' →
      AlgebraicIndependent K (fun o : Option (Fin 2) => o.elim (x a) ![ℓ, X0]) →
      ∀ s : SliceField F₀, (s = x a ∨ s * x a = 1) → v s ≤ 1 →
      ∀ s₀, Tame v Dd (exp Λ0) s₀ → v (s - s₀) < 1 →
      (∃ C, CrudeBound v Dd C) ∧ ResiduallySeparable v Dd (exp Λ0) := by
    intro a c' hia hic hac hind s hs hs1 s₀ hs₀ hss₀
    obtain ⟨P, hP0, hPb, hPN, hPc⟩ :=
      core_poly F hF N hN' X0 x hFx q i a c' hia hic hac hqi hind
    have htr : Transcendental k (x a) :=
      IntermediateField.transcendental_adjoin_iff.2 (AlgebraicIndependent.option_iff.1 hind).2
    have hinv : s * x a = 1 → x a = s⁻¹ := fun h => eq_inv_of_mul_eq_one_right h
    have hxa : x a ∈ IntermediateField.adjoin k {s} := by
      rcases hs with rfl | hs
      · exact IntermediateField.mem_adjoin_simple_self k _
      · rw [hinv hs]; exact inv_mem (IntermediateField.mem_adjoin_simple_self k s)
    have hst : Transcendental k s := by
      rcases hs with rfl | hs
      · exact htr
      · have h1 : s = (x a)⁻¹ := by rw [hinv hs, inv_inv]
        rw [h1]; exact fun h => htr (IsAlgebraic.inv_iff.1 h)
    have hkin : ∀ z ∈ k, z ∈ IntermediateField.adjoin k {s} := fun z hz =>
      (IntermediateField.adjoin k {s}).algebraMap_mem ⟨z, hz⟩
    have hPc' : ∀ n, P.coeff n ∈ IntermediateField.adjoin k {s} := by
      intro n
      have hle : Algebra.adjoin K {X0, ℓ, x a} ≤
          ((IntermediateField.adjoin k {s}).restrictScalars K).toSubalgebra := by
        rw [Algebra.adjoin_le_iff]
        rintro z (rfl | rfl | rfl)
        · exact hkin _ hX0k
        · exact hkin _ hℓk
        · exact hxa
      exact hle (hPc n)
    have hgen : ∀ E' : Subfield (SliceField F₀), (∀ z ∈ k, z ∈ E') → s ∈ E' → x c' ∈ E' →
        ∀ z, z ∈ E' := by
      intro E' hkE hsE hcE
      have haE : x a ∈ E' := by
        rcases hs with rfl | hs
        · exact hsE
        · rw [hinv hs]; exact E'.inv_mem hsE
      refine slice_gen F₀ E' (fun r => hkE _ (k.algebraMap_mem r)) (hkE _ hX0k) fun j => ?_
      by_cases hja : j = a
      · rw [hja]; exact haE
      by_cases hjc : j = c'
      · rw [hjc]; exact hcE
      rw [eq_of_ne_of_ne hia hic hac hja hjc]
      change x i ∈ E'
      rw [split_sum' q i a c' hia hic hac hqi X0 x]
      exact E'.sub_mem (E'.sub_mem (hkE _ hℓk) (E'.mul_mem (hkE _ (haevk _)) haE))
        (E'.mul_mem (hkE _ (haevk _)) hcE)
    have hen := engine v Dd k hkv Λ0 hkD s hs1 hst (x c') hgen P hP0 hPb hPc' N hPN hNK hvn
    exact ⟨hen.1, hen.2 s₀ hs₀ hss₀⟩
  obtain ⟨π, hπ⟩ := hvn
  by_cases hinf : ∃ j, j ≠ i ∧ 1 < v (x j)
  · -- a pole of a free coordinate
    obtain ⟨a, hai, ha⟩ := hinf
    obtain ⟨c', hci', hca⟩ := exists_third i a hai
    have hxa0 : x a ≠ 0 := by
      intro h; rw [h, v.map_zero] at ha; exact not_lt.2 zero_le ha
    have htr : Transcendental k (x a) := fun halg =>
      (ne_of_gt ha) (v_eq_one_of_isAlgebraic v hkle' hxa0 halg)
    have hind := AlgebraicIndependent.option_iff.2
      ⟨hAI1, IntermediateField.transcendental_adjoin_iff.1 htr⟩
    have hvs : v (x a)⁻¹ < 1 := by
      rw [map_inv₀]; exact inv_lt_one_of_one_lt₀ ha
    refine key a c' (Ne.symm hai) (Ne.symm hci') (Ne.symm hca) hind (x a)⁻¹
      (Or.inr (inv_mul_cancel₀ hxa0)) hvs.le 0 (tameSubring v Dd _).zero_mem (by rwa [sub_zero])
  -- affine place
  push Not at hinf
  obtain ⟨a1, a2, h1, h2, h12⟩ := exists_two_others i
  have hall : ∀ j, v (x j) ≤ 1 := by
    intro j
    by_cases hji : j = i
    · rw [hji, split_sum' q i a1 a2 h1 h2 h12 hqi X0 x]
      have hq' : ∀ m, v (Polynomial.aeval X0 (q m)) ≤ 1 := fun m => hkle _ (haevk _)
      refine (v.map_sub _ _).trans (max_le ((v.map_sub _ _).trans (max_le (hkle _ hℓk) ?_)) ?_)
      · rw [v.map_mul]; exact mul_le_one' (hq' _) (hinf a1 (Ne.symm h1))
      · rw [v.map_mul]; exact mul_le_one' (hq' _) (hinf a2 (Ne.symm h2))
    · exact hinf j hji
  have htame : ∀ a : Fin 3, a ≠ 1 → Tame v Dd (exp Λ0) (x a) := by
    intro a ha1
    refine ⟨hall a, ?_⟩
    fin_cases a
    · show v (Dd (sliceCoord F₀ 0)) ≤ _
      rw [hDd, sliceDerivation_coord0 F F₀ hdvd hH]
      exact (hall 1).trans (by rw [← exp_zero, exp_le_exp]; exact hΛ0nn)
    · exact absurd rfl ha1
    · show v (Dd (sliceCoord F₀ 2)) ≤ _
      rw [hDd, sliceDerivation_coord2 F F₀ hdvd hH, v.map_zero]; exact zero_le
  have hself : ∀ a : Fin 3, v (x a - x a) < 1 := fun a => by
    rw [sub_self, v.map_zero]; exact zero_lt_one
  by_cases hi1 : i = 1
  · subst hi1
    by_cases ht0 : Transcendental k (x 0)
    · exact key 0 2 (by decide) (by decide) (by decide) (AlgebraicIndependent.option_iff.2
        ⟨hAI1, IntermediateField.transcendental_adjoin_iff.1 ht0⟩) (x 0) (Or.inl rfl) (hall 0)
        (x 0) (htame 0 (by decide)) (hself 0)
    by_cases ht2 : Transcendental k (x 2)
    · exact key 2 0 (by decide) (by decide) (by decide) (AlgebraicIndependent.option_iff.2
        ⟨hAI1, IntermediateField.transcendental_adjoin_iff.1 ht2⟩) (x 2) (Or.inl rfl) (hall 2)
        (x 2) (htame 2 (by decide)) (hself 2)
    exfalso
    have hA : ∀ z, z ∈ (algebraicClosure k (SliceField F₀)).toSubfield := by
      have hkA : ∀ z ∈ k, z ∈ (algebraicClosure k (SliceField F₀)).toSubfield := fun z hz =>
        mem_algebraicClosure_iff.2 (isAlgebraic_algebraMap (⟨z, hz⟩ : k))
      set A := (algebraicClosure k (SliceField F₀)).toSubfield
      have h0 : x 0 ∈ A := mem_algebraicClosure_iff.2 (not_not.1 ht0)
      have h2' : x 2 ∈ A := mem_algebraicClosure_iff.2 (not_not.1 ht2)
      refine slice_gen F₀ A (fun r => hkA _ (k.algebraMap_mem r)) (hkA _ hX0k) fun j => ?_
      fin_cases j
      · exact h0
      · change x 1 ∈ A
        rw [split_sum' q 1 0 2 (by decide) (by decide) (by decide) hqi X0 x]
        exact A.sub_mem (A.sub_mem (hkA _ hℓk) (A.mul_mem (hkA _ (haevk _)) h0))
          (A.mul_mem (hkA _ (haevk _)) h2')
      · exact h2'
    have hπ0 : π ≠ 0 := by rintro rfl; rw [v.map_zero] at hπ; exact exp_ne_zero hπ.symm
    have h1 := v_eq_one_of_isAlgebraic v hkle' hπ0 (mem_algebraicClosure_iff.1 (hA π))
    rw [hπ, ← exp_zero, exp_inj] at h1
    omega
  · have hq10 : q 1 = 0 := hq1.resolve_left hi1
    have h2vars : (2 : Fin 4) ∈ F₀.vars := by
      obtain ⟨F₁, hF₁⟩ := sliceProj_H_eq F F₀ hdvd
      by_contra h
      rw [pderiv_eq_zero_of_notMem_vars h, map_zero, mul_zero] at hF₁
      exact hH hF₁
    obtain ⟨a, hia, ha1⟩ := exists_not_one i hi1
    exact key a 1 hia hi1 ha1 (algInd_of_Y'_free F₀ q i a hia hi1 ha1 hqi hq10 h2vars) (x a)
      (Or.inl rfl) (hall a) (x a) (htame a ha1) (hself a)

end Main

end ProximityPrize.SubmissionLower.HFree6812


Source
https://github.com/proximity-prize/proximity-prize/blob/9008f0e2b2edb0647da15baac454a68072f0ba29/ProximityPrize/SubmissionLower/HFreeDefer6812.lean yukon-proof-operation:foundation-direct-ea6bf0f952dfc53f4e96848538c5f7066ff092774649463bf8da625d03bab5f8 [yukon-proof-receipt:eyJlbnZpcm9ubWVudCI6eyJtYXRobGliUmV2IjoiMGRmNDQ0YTM2MGVhYTYwYWI4YzExZGNhNTFhODZhZjY5Mjk1NTQ3NCIsInRvb2xjaGFpbiI6ImxlYW5wcm92ZXIvbGVhbjQ6djQuMzMuMSJ9LCJoYXNoIjoiNzNjZjBhYWIxNTE0NzUxMzVjODg0ODBkODRlMTg1Njk1NWQ3NzhjZjg1NzkxNDdkNTM4MDM4M2ExMzk5OTUyZSIsImtpbmQiOiJkZWZpbml0aW9uIiwibWFya2VyIjoieXVrb24tcHJvb2Ytb3BlcmF0aW9uOmZvdW5kYXRpb24tZGlyZWN0LWVhNmJmMGY5NTJkZmM1M2Y0ZTk2ODQ4NTM4YzVmNzA2NmZmMDkyNzc0NjQ5NDYzYmY4ZGE2MjVkMDNiYWI1ZjgiLCJ0YWciOiJiZXR0ZXItY29kZXMiLCJ0YXJnZXQiOiJZdWtvbl8xOTk0YTVhNGZlMTEyZTZjN2Q5MTEwNjkiLCJ2IjoyfQ]

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me