Planar unit distancesBlueprintDependency graphGitHub
Contents

An explicit power saving for planar unit distances

Let u ( n ) be the largest number of unordered unit-distance pairs among n distinct points in the Euclidean plane. Theorem 1.1 gives an absolute C > 0 and an explicit Δ > 0 for which u ( n ) ≤ C n 4 / 3 − Δ for every n ≥ 2 .

The short-history estimate in Lemma 3.17 fixes the value of Δ . In the remaining case, Theorem 4.51 gives the moment estimates for the original common-center walk. Selecting a scale produces many ordered pairs with large ratio height and small four-cycle quotient heights.

Theorem 6.14 bounds the height of a stationary ratio. At the selected scale this bound is strictly smaller than the height of every retained edge. Lemma 5.38 puts all the resulting compatible eight-by-four grids in a proper algebraic subset. The upper and lower counts are incompatible for sufficiently large configurations.

The dependency graph follows the Lean proof of Theorem 1.1. Each vertex represents the first Lean declaration linked at its statement. An arrow joins two displayed declarations when the second uses the first through its type or proof and no other displayed declaration lies strictly between them.

151 blueprint statements have proofs checked in Lean 4.35.0. Each green tick marks the precise statement proved, including its hypotheses.

Kernel replay

Download the Lean replay, instructions, kernel output and declaration tables (ZIP).

1 The exact question

In this chapter

1.1 One pair of points, two ways to count it

Theorem 1.1 The explicit power saving

Lean verified

For every integer n ≥ 2 , let u ( n ) be the greatest number of unordered pairs at Euclidean distance one among exactly n distinct points of R 2 . Set

H 0 = 226 ( 2 2100 + 1 ) , N 0 = ⌈ 32 exp ⁡ ( 19 H 0 ) ⌉ , Δ = 1 30600 ( 7200 N 0 ) 4 log ⁡ ( 1 + N 0 4 ) .

There exists a single real C > 0 such that u ( n ) ≤ C n 4 / 3 − Δ for all n ≥ 2 .

Proof

The height estimate of Theorem 6.14 supplies the premise of Lemma 6.15. Its strict inequality rules out a dense graph at the scale selected by the common-center walk. Algebraic specialization and the uniform finite-set count give the assertion on every real planar configuration.

Inspect the Lean declarations

PlanarUnitDistances.IntegralGrid.exact_unconditional

PlanarUnitDistances.TheoremA
Lean source · PlanarUnitDistances/ExactUnconditional.lean, lines 58–60
/-- The manuscript's exact Theorem A, for unrestricted planar configurations. -/
theorem exact_unconditional : TheoremA :=
  ResearchPhysical.exact_from_affine_stationary_heights (le_refl _) (le_refl _) stationary_height_unconditional

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.TheoremA

Prop
Lean source · PlanarUnitDistances/Main.lean, lines 13–14
/-- Theorem A, including the absolute-constant quantifier. -/
def TheoremA : Prop := PowerSaving exactGap

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.PowerSaving

ℝ → Prop
Lean source · PlanarUnitDistances/Counting.lean, lines 7–9
/-- The exponent is a fixed input. Both the constant and the cut-off 2 are uniform in n. -/
def PowerSaving (δ : ℝ) : Prop :=
  ∃ C : ℝ, 0 < C ∧ ∀ n : ℕ, 2 ≤ n → (u n : ℝ) ≤ C * (n : ℝ) ^ (4 / 3 - δ)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.u

ℕ → ℕ
Lean source · PlanarUnitDistances/Specialization.lean, lines 17–18
noncomputable def u (n : ℕ) : ℕ :=
  sSup {m : ℕ | ∃ X : Finset Plane, X.card = n ∧ unitPairCount X = m}

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.unitPairCount

Finset OAI.PlanarUnitDistances.Plane → ℕ
Lean source · PlanarUnitDistances/Specialization.lean, lines 13–15
noncomputable def unitPairCount (X : Finset Plane) : ℕ := by
  classical
  exact (X.sym2.filter IsUnitPair).card

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.IsUnitPair

Sym2 OAI.PlanarUnitDistances.Plane → Prop
Lean source · PlanarUnitDistances/Specialization.lean, lines 10–11
def IsUnitPair : Sym2 Plane → Prop :=
  Sym2.lift ⟨fun x y => dist x y = 1, fun x y => by dsimp; rw [dist_comm]⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.Plane

Type
Lean source · PlanarUnitDistances/Specialization.lean, lines 8–8
abbrev Plane := EuclideanSpace ℝ (Fin 2)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 1.2 Counting the same configurations

Lean verified

The supremum defining u ( n ) is attained. A fixed-exponent estimate for u is equivalent to the uniform estimate on finite point sets with at least two elements. For each such set P , the ordered unit-pair count equals twice its unordered unit-pair count.

Proof

Distances are symmetric, and a point has distance zero from itself. The map from the ordered pairs to the symmetric square of P has exactly two elements over each unit pair. The attainable counts form a nonempty set of integers bounded by n 2 , so one configuration attains the maximum.

Inspect the Lean declarations

PlanarUnitDistances.powerSaving_iff_uniform

∀ (δ : ℝ),
  PlanarUnitDistances.PowerSaving δ ↔
    ∃ C,
      0 < C ∧
        ∀ (P : Finset OAI.PlanarUnitDistances.Plane),
          2 ≤ P.card → ↑(OAI.PlanarUnitDistances.unitPairCount P) ≤ C * ↑P.card ^ (4 / 3 - δ)
Lean source · PlanarUnitDistances/Counting.lean, lines 45–54
theorem powerSaving_iff_uniform (δ : ℝ) : PowerSaving δ ↔
    ∃ C : ℝ, 0 < C ∧ ∀ P : Finset Plane, 2 ≤ P.card →
      (unitPairCount P : ℝ) ≤ C * (P.card : ℝ) ^ (4 / 3 - δ) := by
  constructor
  · rintro ⟨C, hC, h⟩
    exact ⟨C, hC, fun P hP => (Nat.cast_le.mpr (unitPairCount_le_u P)).trans (h _ hP)⟩
  · rintro ⟨C, hC, h⟩
    refine ⟨C, hC, fun n hn => ?_⟩
    obtain ⟨P, hP, hu⟩ := exists_maximizer n
    simpa only [hu, hP] using h P (hP ▸ hn)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.exists_maximizer

∀ (n : ℕ), ∃ X, X.card = n ∧ OAI.PlanarUnitDistances.unitPairCount X = OAI.PlanarUnitDistances.u n
Lean source · PlanarUnitDistances/Specialization.lean, lines 42–44
theorem exists_maximizer (n : ℕ) :
    ∃ X : Finset Plane, X.card = n ∧ unitPairCount X = u n :=
  Nat.sSup_mem (attainable_nonempty n) (attainable_bddAbove n)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.orderedPairs_card

∀ (P : Finset OAI.PlanarUnitDistances.Plane),
  (PlanarUnitDistances.orderedPairs P).card = 2 * OAI.PlanarUnitDistances.unitPairCount P
Lean source · PlanarUnitDistances/Counting.lean, lines 16–43
theorem orderedPairs_card (P : Finset Plane) :
    (orderedPairs P).card = 2 * unitPairCount P := by
  classical
  let U := P.sym2.filter IsUnitPair
  let f : Plane × Plane → Sym2 Plane := fun e => s(e.1,e.2)
  have hf : ∀ e ∈ orderedPairs P, f e ∈ U := by
    intro e he
    rcases Finset.mem_filter.mp he with ⟨hP, hu⟩
    exact Finset.mem_filter.mpr ⟨Finset.mk_mem_sym2_iff.mpr (Finset.mem_product.mp hP), hu⟩
  have fibers (a : Sym2 Plane) (ha : a ∈ U) : ((orderedPairs P).filter (f · = a)).card = 2 := by
    induction a using Sym2.ind with
    | _ p q =>
      obtain ⟨hm, hu⟩ := Finset.mem_filter.mp ha
      obtain ⟨hp, hq⟩ := Finset.mk_mem_sym2_iff.mp hm
      change dist p q = 1 at hu
      have hne : p ≠ q := by rintro rfl; simp at hu
      have hset : (orderedPairs P).filter (f · = s(p,q)) = {(p,q),(q,p)} := by
        ext e
        have hsym : f e = s(p,q) ↔ e = (p,q) ∨ e = (q,p) := Sym2.mk_eq_mk_iff (p := e) (q := (p,q))
        simp only [Finset.mem_filter, hsym, Finset.mem_insert, Finset.mem_singleton]
        constructor
        · exact And.right
        · rintro (rfl | rfl) <;> simp [orderedPairs, hp, hq, hu, dist_comm q p]
      rw [hset, Finset.card_pair (fun h => hne (congrArg Prod.fst h) : (p,q) ≠ (q,p))]
  calc
    _ = ∑ a ∈ U, ((orderedPairs P).filter (f · = a)).card := Finset.card_eq_sum_card_fiberwise hf
    _ = ∑ _a ∈ U, 2 := Finset.sum_congr rfl fibers
    _ = 2 * unitPairCount P := by simp [U, unitPairCount, Nat.mul_comm]

Kernel axioms used: propext, Classical.choice, Quot.sound.

1.2 The reciprocal chord

Lemma 1.3 One center and two reciprocal differences

Lean verified

Put z p = x p + i y p and w p = z p ― . If p , r both have distance one from q , write d = z p − z q , e = z r − z q , λ = d / e and L = dist ( p , r ) 2 . Then

L = 2 − λ − λ − 1 , ( λ − 1 − λ ) 2 = L ( L − 4 ) .
Proof

Both differences are nonzero and d d ¯ = e e ¯ = 1 . Expand ( d − e ) ( d − 1 − e − 1 ) . Squaring λ − 1 − λ gives the discriminant identity. These identities also hold at a coincident pair p = r , where λ = 1 and L = 0 .

Inspect the Lean declarations

PlanarUnitDistances.planar_chord_identities

∀ {p r q : OAI.PlanarUnitDistances.Plane},
  dist p q = 1 →
    dist r q = 1 →
      have lam :=
        (PlanarUnitDistances.zCoord p - PlanarUnitDistances.zCoord q) /
          (PlanarUnitDistances.zCoord r - PlanarUnitDistances.zCoord q);
      have L := ↑(dist p r ^ 2);
      L = 2 - lam - lam⁻¹ ∧ (lam⁻¹ - lam) ^ 2 = L * (L - 4)
Lean source · PlanarUnitDistances/Geometry.lean, lines 31–37
theorem planar_chord_identities {p r q : Plane} (hp : dist p q = 1) (hr : dist r q = 1) :
    let lam := (zCoord p - zCoord q) / (zCoord r - zCoord q)
    let L : ℂ := (dist p r ^ 2 : ℝ)
    L = 2 - lam - lam⁻¹ ∧ (lam⁻¹ - lam)^2 = L * (L - 4) := by
  have h := chord_identity (unit_edge_reciprocal hp) (unit_edge_reciprocal hr)
  simp only [sub_sub_sub_cancel_right, ← map_sub, Complex.mul_conj, zCoord_sub_normSq] at h
  exact h

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.unit_edge_reciprocal

∀ {p q : OAI.PlanarUnitDistances.Plane},
  dist p q = 1 →
    (PlanarUnitDistances.zCoord p - PlanarUnitDistances.zCoord q) *
        ((starRingEnd ℂ) (PlanarUnitDistances.zCoord p) - (starRingEnd ℂ) (PlanarUnitDistances.zCoord q)) =
      1
Lean source · PlanarUnitDistances/Geometry.lean, lines 14–17
theorem unit_edge_reciprocal {p q : Plane} (h : dist p q = 1) :
    (zCoord p - zCoord q) * (conj (zCoord p) - conj (zCoord q)) = 1 := by
  rw [← map_sub, Complex.mul_conj, zCoord_sub_normSq, h]
  norm_num

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 1.4 The three-center contradiction

Lean verified

Over a field, take points ( z p , w p ) , ( z r , w r ) with z r ≠ z p . Among a finite set of centers with distinct first coordinates, at most two satisfy both reciprocal unit equations.

Proof

Set u = z r − z p , v = w r − w p and d = z p − z q . Eliminate w q to get v d 2 + u v d + u = 0 . The constant term u is nonzero, even if v = 0 . Three centers would give three different roots of a nonzero polynomial of degree at most two. Using the constant coefficient avoids an unnecessary case split at v = 0 .

Inspect the Lean declarations

PlanarUnitDistances.common_centers_le_two

∀ {K : Type u_1} {ι : Type u_2} [inst : Field K] (s : Finset ι) (z w : ι → K),
  Set.InjOn z ↑s →
    ∀ {zp zr wp wr : K},
      zr ≠ zp → (∀ q ∈ s, (zp - z q) * (wp - w q) = 1) → (∀ q ∈ s, (zr - z q) * (wr - w q) = 1) → s.card ≤ 2
Lean source · PlanarUnitDistances/Geometry.lean, lines 39–76
/-- The degree-two obstruction in the three-center test, valid before any embedding.
The two point coordinates in the second slot may be equal. -/
theorem common_centers_le_two {K ι : Type*} [Field K]
    (s : Finset ι) (z w : ι → K) (hinj : Set.InjOn z (s : Set ι))
    {zp zr wp wr : K} (hpr : zr ≠ zp)
    (hp : ∀ q ∈ s, (zp - z q) * (wp - w q) = 1)
    (hr : ∀ q ∈ s, (zr - z q) * (wr - w q) = 1) :
    s.card ≤ 2 := by
  classical
  let u := zr-zp
  let v := wr-wp
  let d := fun q => zp-z q
  have hu : u ≠ 0 := sub_ne_zero.mpr hpr
  have root (q : ι) (hq : q ∈ s) : v * (d q)^2 + u*v*d q + u = 0 := by
    dsimp [u,v,d]
    linear_combination (zp-z q)*(hr q hq) - (zr-z q)*(hp q hq)
  have hdinj : Set.InjOn d (s : Set ι) := fun _ ha _ hb hab =>
    hinj ha hb (sub_right_inj.mp hab)
  let f : Polynomial K := Polynomial.C v * Polynomial.X^2 +
    Polynomial.C (u*v) * Polynomial.X + Polynomial.C u
  have hf : f ≠ 0 := by
    intro h
    have he := congrArg (Polynomial.eval 0) h
    simp [f, hu] at he
  have hdeg : f.natDegree ≤ 2 := by
    apply (Polynomial.natDegree_add_le _ _).trans
    apply max_le _ (by simp)
    apply (Polynomial.natDegree_add_le _ _).trans
    apply max_le
    · exact Polynomial.natDegree_mul_le.trans (by simp only [Polynomial.natDegree_C, Polynomial.natDegree_X_pow]; decide)
    · exact Polynomial.natDegree_mul_le.trans (by simp only [Polynomial.natDegree_C, Polynomial.natDegree_X]; decide)
  rw [← Finset.card_image_of_injOn hdinj]
  apply le_trans (b := f.natDegree) _ hdeg
  apply Polynomial.card_le_degree_of_subset_roots
  intro x hx
  obtain ⟨q,hq,rfl⟩ := Finset.mem_image.mp hx
  apply (Polynomial.mem_roots hf).mpr
  simpa [f] using root q hq

Kernel axioms used: propext, Classical.choice, Quot.sound.

2 The incidence restriction

In this chapter

2.1 Constants and quantifiers

Definition 2.1 The exact exponent

Definition in Lean

Let

H 0 = 226 ( 2 2100 + 1 ) , N 0 = ⌈ 32 exp ⁡ ( 19 H 0 ) ⌉ , A = ( 7200 N 0 ) 4 , M = 1 + N 0 4 .

Set Δ = ( 30600 A log ⁡ M ) − 1 . The ceiling is a natural number. All logarithms and subsequent powers of nonintegral exponents are real, with natural logarithm throughout.

Inspect the Lean declarations

PlanarUnitDistances.exactGap

ℝ
Lean source · PlanarUnitDistances/Constants.lean, lines 16–16
def exactGap : ℝ := 1 / (30600 * (7200 * (N0 : ℝ)) ^ 4 * Real.log (1 + (N0 : ℝ) ^ 4))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.H0

ℝ
Lean source · PlanarUnitDistances/Constants.lean, lines 12–12
def H0 : ℝ := 226 * (2 ^ 2100 + 1)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.N0

ℕ
Lean source · PlanarUnitDistances/Constants.lean, lines 14–14
def N0 : ℕ := ⌈32 * Real.exp (19 * H0)⌉₊

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 2.2 Size and normalization of the exact saving

Lean verified

The exact gap Δ is positive, 30600 Δ A log ⁡ M = 1 , and

76 H 0 < − log ⁡ Δ < 77 H 0 + log ⁡ 30600 , 0 < Δ < 2 − 594036 .
Proof

The ceiling gives 32 e 19 H 0 ≤ N 0 ≤ 33 e 19 H 0 . Hence log ⁡ N 0 ≤ 19 H 0 + 32 and log ⁡ ( 1 + N 0 4 ) ≤ 100 H 0 . Taking two successive logarithms in the last inequality is unnecessary. Use log ⁡ log ⁡ ( 1 + N 0 4 ) ≤ log ⁡ 100 + log ⁡ H 0 and log ⁡ H 0 = log ⁡ 2 + log ⁡ ( H 0 / 2 ) ≤ H 0 / 2 + 1 . The inequality H 0 ≥ 10 6 absorbs the additive constants. The lower bound follows from N 0 ≥ 32 e 19 H 0 and log ⁡ M > 1 . The relation defining Δ gives the normalization by cancellation of positive factors.

Inspect the Lean declarations

PlanarUnitDistances.exactGap_lt_largeHeightGap

PlanarUnitDistances.exactGap < 2 ^ (-594036)
Lean source · PlanarUnitDistances/Constants.lean, lines 96–100
/-- The same exact saving fits the large-height argument's separate parameter range. -/
theorem exactGap_lt_largeHeightGap : exactGap < (2 : ℝ) ^ (-(594036 : ℝ)) := by
  apply (Real.log_lt_log_iff exactGap_pos (Real.rpow_pos_of_pos (by norm_num) _)).mp
  rw [Real.log_rpow (by norm_num)]
  linarith [exactGap_log_bounds.1, H0_large, Real.log_two_lt_d9]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.exactGap_pos

0 < PlanarUnitDistances.exactGap
Lean source · PlanarUnitDistances/Constants.lean, lines 44–48
theorem exactGap_pos : 0 < exactGap := by
  have hN : 0 < (N0 : ℝ) := by linarith [N0_large]
  have hM : 0 < Real.log (1 + (N0 : ℝ) ^ 4) := by linarith [logM_gt_one]
  unfold exactGap
  positivity

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.exactGap_log_bounds

76 * PlanarUnitDistances.H0 < -Real.log PlanarUnitDistances.exactGap ∧
  -Real.log PlanarUnitDistances.exactGap < 77 * PlanarUnitDistances.H0 + Real.log 30600
Lean source · PlanarUnitDistances/Constants.lean, lines 61–93
/-- The strict logarithmic bounds used in the manuscript, before rounding. -/
theorem exactGap_log_bounds :
    76 * H0 < -Real.log exactGap ∧ -Real.log exactGap < 77 * H0 + Real.log 30600 := by
  have hN : 0 < (N0 : ℝ) := by linarith [N0_large]
  have hH : 0 < H0 := by linarith [H0_large]
  have hNlower := Real.log_le_log (by positivity) N0_bounds.1
  have hNupper := Real.log_le_log hN N0_bounds.2
  rw [Real.log_mul (by norm_num) (Real.exp_pos _).ne', Real.log_exp] at hNlower hNupper
  have hlogN : Real.log (N0 : ℝ) ≤ 19 * H0 + 32 := by
    linarith [Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 33)]
  have hpow : 1 ≤ (N0 : ℝ) ^ 4 := one_le_pow₀ (by linarith [N0_large])
  have hLM := Real.log_le_log (by positivity : 0 < 1 + (N0 : ℝ) ^ 4)
    (show 1 + (N0 : ℝ) ^ 4 ≤ 2 * (N0 : ℝ) ^ 4 by linarith)
  rw [Real.log_mul (by norm_num) (by positivity), Real.log_pow] at hLM
  have hMupper : Real.log (1 + (N0 : ℝ) ^ 4) ≤ 100 * H0 := by
    norm_num only [Nat.cast_ofNat] at hLM
    linarith [H0_large, Real.log_two_lt_d9]
  have hloglog := Real.log_le_log (by linarith [logM_gt_one]) hMupper
  rw [Real.log_mul (by norm_num) hH.ne'] at hloglog
  have hlogH : Real.log H0 ≤ H0 / 2 + 1 := by
    have heq : H0 = 2 * (H0 / 2) := by ring
    calc
      Real.log H0 = Real.log 2 + Real.log (H0 / 2) := by
        rw [← Real.log_mul (by norm_num) (by positivity : H0 / 2 ≠ 0), ← heq]
      _ ≤ H0 / 2 + 1 := by
        linarith [Real.log_two_lt_d9, Real.log_le_sub_one_of_pos (by positivity : 0 < H0 / 2)]
  rw [neg_log_exactGap_eq]
  constructor
  · linarith [Real.log_pos (by norm_num : (1 : ℝ) < 32),
      Real.log_nonneg (by norm_num : (1 : ℝ) ≤ 7200),
      Real.log_nonneg (by norm_num : (1 : ℝ) ≤ 30600), Real.log_nonneg logM_gt_one.le]
  · linarith [Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 100),
      Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 7200), H0_large]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.exactGap_normalization

30600 * PlanarUnitDistances.exactGap * (7200 * ↑PlanarUnitDistances.N0) ^ 4 *
    Real.log (1 + ↑PlanarUnitDistances.N0 ^ 4) =
  1
Lean source · PlanarUnitDistances/Constants.lean, lines 102–107
theorem exactGap_normalization :
    30600 * exactGap * (7200 * (N0 : ℝ)) ^ 4 * Real.log (1 + (N0 : ℝ) ^ 4) = 1 := by
  have hN : 0 < (N0 : ℝ) := by linarith [N0_large]
  have hM : 0 < Real.log (1 + (N0 : ℝ) ^ 4) := by linarith [logM_gt_one]
  unfold exactGap
  field_simp

Kernel axioms used: propext, Classical.choice, Quot.sound.

2.2 Geometric inputs and the rectangle before maximization

Lemma 2.3 Two points have at most two common unit neighbors

Lean verified

Let p i and q j be two injectively labelled finite collections of points in the real Euclidean plane. Given any retained incidence relation E such that ( i , j ) ∈ E implies dist ( p i , q j ) = 1 , each pair of distinct point labels has at most two common center labels. The two collections may overlap.

Proof

Write z ( p ) = p 1 + i p 2 and w ( p ) = z ( p ) ― ; z is injective. For distinct points p , r , put u = z ( r ) − z ( p ) ≠ 0 and v = w ( r ) − w ( p ) . At each common center q , subtract the two reciprocal unit-edge equations after clearing denominators. This gives v d 2 + u v d + u = 0 for d = z ( p ) − z ( q ) . The polynomial is nonzero by its constant term and has degree at most two. Distinct centers give distinct values of d . The Lean count is the cardinality of the common-neighbor filter on the retained neighborhoods.

Inspect the Lean declarations

PlanarUnitDistances.euclidean_unit_graph_codegree

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype Q] [inst_1 : DecidableEq P]
  (point : P → OAI.PlanarUnitDistances.Plane) (center : Q → OAI.PlanarUnitDistances.Plane),
  Function.Injective point →
    Function.Injective center →
      ∀ (neighbors : Q → Finset P),
        (∀ (q : Q), ∀ i ∈ neighbors q, dist (point i) (center q) = 1) →
          ∀ (i j : P), i ≠ j → {q | i ∈ neighbors q ∧ j ∈ neighbors q}.card ≤ 2
Lean source · PlanarUnitDistances/GeometricCodegree.lean, lines 34–47
/-- Exact codegree input of the graph entropy theorem. The neighborhoods
may retain any subset of the geometric unit edges. -/
theorem euclidean_unit_graph_codegree {P Q : Type*} [Fintype Q] [DecidableEq P]
    (point : P → Plane) (center : Q → Plane)
    (hp : Function.Injective point) (hc : Function.Injective center)
    (neighbors : Q → Finset P)
    (hunit : ∀ q i, i ∈ neighbors q → dist (point i) (center q) = 1)
    (i j : P) (hij : i ≠ j) :
    (Finset.univ.filter fun q ↦ i ∈ neighbors q ∧ j ∈ neighbors q).card ≤ 2 := by
  apply planar_common_centers_le_two _ center hc.injOn (hp.ne hij)
  · intro q hq
    exact hunit q _ (Finset.mem_filter.mp hq).2.1
  · intro q hq
    exact hunit q _ (Finset.mem_filter.mp hq).2.2

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.zCoord_injective

Function.Injective PlanarUnitDistances.zCoord
Lean source · PlanarUnitDistances/GeometricCodegree.lean, lines 15–20
theorem zCoord_injective : Function.Injective zCoord := by
  intro p q h
  ext i
  fin_cases i
  · exact congrArg Complex.re h
  · exact congrArg Complex.im h

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.planar_common_centers_le_two

∀ {Q : Type u_1} (s : Finset Q) (center : Q → OAI.PlanarUnitDistances.Plane),
  Set.InjOn center ↑s →
    ∀ {p r : OAI.PlanarUnitDistances.Plane},
      p ≠ r → (∀ q ∈ s, dist p (center q) = 1) → (∀ q ∈ s, dist r (center q) = 1) → s.card ≤ 2
Lean source · PlanarUnitDistances/GeometricCodegree.lean, lines 22–32
/-- Two distinct real Euclidean points have at most two common unit centers
in any finite set of injectively labelled centers. Subgraphs are permitted. -/
theorem planar_common_centers_le_two {Q : Type*} (s : Finset Q) (center : Q → Plane)
    (hc : Set.InjOn center (s : Set Q)) {p r : Plane} (hpr : p ≠ r)
    (hp : ∀ q ∈ s, dist p (center q) = 1) (hr : ∀ q ∈ s, dist r (center q) = 1) :
    s.card ≤ 2 := by
  apply common_centers_le_two s (fun q ↦ zCoord (center q)) (fun q ↦ conj (zCoord (center q)))
    (fun _ hx _ hy hh ↦ hc hx hy (zCoord_injective hh))
    (wp := conj (zCoord p)) (wr := conj (zCoord r)) (zCoord_injective.ne hpr.symm)
  · exact fun q hq ↦ unit_edge_reciprocal (hp q hq)
  · exact fun q hq ↦ unit_edge_reciprocal (hr q hq)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 2.4 Preserving every real unit edge under specialization

Lean verified

Given a finite injectively labelled real planar configuration and a positive ϵ , there is an injectively labelled configuration of real algebraic points within ϵ of the originals, preserving every original unit edge. In particular the specialized point set has the same cardinality and at least as many unordered unit pairs.

Proof

Choose a primitive-element chart over a transcendence basis for the field generated by the coordinates. The derivative of its defining polynomial at the chosen real root is nonzero. Approximate the parameters rationally and use opposite signs on the two sides of the root to obtain a nearby real algebraic root. Preserve the polynomial relations after clearing finitely many nonzero denominators. Choose the approximation radius below the separation of distinct positions. The proof works on the original labels, so each ordered edge can be retained individually.

Inspect the Lean declarations

OAI.PlanarUnitDistances.algebraic_set_specialization

∀ (X : Finset OAI.PlanarUnitDistances.Plane),
  ∃ Y,
    Y.card = X.card ∧
      OAI.PlanarUnitDistances.unitPairCount X ≤ OAI.PlanarUnitDistances.unitPairCount Y ∧
        ∀ p ∈ Y, ∀ (k : Fin 2), IsAlgebraic ℚ (p.ofLp k)
Lean source · PlanarUnitDistances/Specialization.lean, lines 606–624
theorem algebraic_set_specialization (X : Finset Plane) :
    ∃ Y : Finset Plane, Y.card = X.card ∧ unitPairCount X ≤ unitPairCount Y ∧
      ∀ p ∈ Y, ∀ k, IsAlgebraic ℚ (p k) := by
  classical
  obtain ⟨q,hq,ha,hu⟩ := PrimitiveChart.algebraic_planar_specialization
    (fun p : X => (p : Plane)) Subtype.val_injective (show (0 : ℝ) < 1 by norm_num)
  let e : X ↪ Plane := ⟨q,hq⟩
  let v : X ↪ Plane := ⟨Subtype.val,Subtype.val_injective⟩
  have hv : (Finset.univ : Finset X).map v = X := by
    ext p
    simp [v]
  refine ⟨Finset.univ.map e,?_,?_,?_⟩
  · simp
  · have hm := unitPairCount_map_mono Finset.univ v e hu
    rw [hv] at hm
    exact hm
  · intro p hp
    obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hp
    exact (ha i).2

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PrimitiveChart.algebraic_planar_specialization

∀ {κ : Type u_1} [Finite κ] (p : κ → EuclideanSpace ℝ (Fin 2)),
  Function.Injective p →
    ∀ {ε : ℝ},
      0 < ε →
        ∃ q,
          Function.Injective q ∧
            (∀ (i : κ), dist (q i) (p i) < ε ∧ ∀ (k : Fin 2), IsAlgebraic ℚ ((q i).ofLp k)) ∧
              ∀ (i j : κ), dist (p i) (p j) = 1 → dist (q i) (q j) = 1
Lean source · PlanarUnitDistances/Specialization.lean, lines 559–588
theorem algebraic_planar_specialization {κ : Type*} [Finite κ]
    (p : κ → EuclideanSpace ℝ (Fin 2)) (hp : Function.Injective p)
    {ε : ℝ} (hε : 0 < ε) :
    ∃ q : κ → EuclideanSpace ℝ (Fin 2), Function.Injective q ∧
      (∀ i, dist (q i) (p i) < ε ∧ ∀ k, IsAlgebraic ℚ (q i k)) ∧
      ∀ i j, dist (p i) (p j) = 1 → dist (q i) (q j) = 1 := by
  classical
  obtain ⟨ρ,hρ,hsep⟩ := finite_separation p hp
  let δ := min (ε/3) (ρ/6)
  have hδ : 0 < δ := lt_min (by positivity) (by positivity)
  obtain ⟨y,hy,heq⟩ := algebraic_unit_approximation (fun k => p k.1 k.2) hδ
  let q : κ → EuclideanSpace ℝ (Fin 2) := fun i => WithLp.toLp 2 (fun k => y (i,k))
  have hclose (i : κ) : dist (q i) (p i) < 2*δ :=
    plane_close_of_coordinates hδ _ _ (fun k => (hy (i,k)).2)
  have hερ : 2*δ < ε := by have := min_le_left (ε/3) (ρ/6); dsimp [δ]; linarith
  have hρδ : 4*δ < ρ := by have := min_le_right (ε/3) (ρ/6); dsimp [δ]; linarith
  refine ⟨q,?_,?_,?_⟩
  · intro i j hij
    by_contra hne
    have hdist := dist_triangle (p i) (q i) (p j)
    rw [dist_comm (p i) (q i)] at hdist
    have hi := hclose i
    have hj := hclose j
    have hs := hsep i j hne
    rw [← hij] at hj
    linarith
  · intro i
    exact ⟨(hclose i).trans hερ,fun k => (hy (i,k)).1⟩
  · intro i j h
    exact (plane_unit_iff q i j).mpr (heq i j ((plane_unit_iff p i j).mp h))

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 2.5 One field for the selected real incidences

Lean verified

Let P , Q be the selected finite real algebraic sets. There is a finite normal extension K / Q inside C containing i and both null coordinates of every point and center. At the distinguished embedding they equal the original z = x + i y and w = x − i y .

Proof

The Cartesian coordinates are algebraic. Finite sums, differences and products with i preserve algebraicity, so the coordinates on the finite disjoint union P ⊔ Q are algebraic too. Adjoin them and i , then take a finite normal extension containing the resulting field. The original vertex labels supply both evaluations. The unit-edge product and the finite sampling law still refer to those same real points.

Inspect the Lean declarations

OAI.PlanarUnitDistances.CommonFieldModel.exists_model

∀ {P Q : Finset OAI.PlanarUnitDistances.CommonFieldModel.Plane},
  (∀ p ∈ P, ∀ (i : Fin 2), IsAlgebraic ℚ (p.ofLp i)) →
    (∀ q ∈ Q, ∀ (i : Fin 2), IsAlgebraic ℚ (q.ofLp i)) →
      Nonempty (OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
Lean source · PlanarUnitDistances/CommonCoordinates.lean, lines 64–92
theorem exists_model
    (hP : ∀p∈P,∀i,IsAlgebraic ℚ (p i))
    (hQ : ∀q∈Q,∀i,IsAlgebraic ℚ (q i)) : Nonempty (Model P Q) := by
  let Z := fun v : P⊕Q => _root_.PlanarUnitDistances.zCoord (location P Q v)
  let W := fun v : P⊕Q => star (Z v)
  have ha (v : P⊕Q) : IsAlgebraic ℚ (Z v) ∧ IsAlgebraic ℚ (W v) := by
    have h : ∀i,IsAlgebraic ℚ (location P Q v i) := by
      cases v with
      | inl p => exact hP p p.property
      | inr q => exact hQ q q.property
    have hh := CommonField.algebraic_coordinates (location P Q v) h
    have hz (x : Plane) : _root_.PlanarUnitDistances.zCoord x = (x 0 : ℂ)+(x 1 : ℂ)*Complex.I := by
      exact Complex.mk_eq_add_mul_I _ _
    simpa [Z,W,hz,sub_eq_add_neg] using hh
  let S : Finset ℂ := insert Complex.I (Finset.univ.image Z ∪ Finset.univ.image W)
  have halg : ∀z∈S,IsAlgebraic ℚ z := by
    intro z hz
    rcases Finset.mem_insert.mp hz with rfl | hz
    · exact CommonField.integral_I.isAlgebraic
    rcases Finset.mem_union.mp hz with hz|hz
    · obtain ⟨v,_,rfl⟩ := Finset.mem_image.mp hz
      exact (ha v).1
    · obtain ⟨v,_,rfl⟩ := Finset.mem_image.mp hz
      exact (ha v).2
  obtain ⟨F,hF,hfin,hnorm⟩ := CommonField.exists_normal_field S halg
  refine ⟨⟨F,hfin,hnorm,hF _ (Finset.mem_insert_self ..),fun v => ⟨Z v,hF _ ?_⟩,fun v => ⟨W v,hF _ ?_⟩,
    fun _ => rfl,fun _ => rfl⟩⟩
  · exact Finset.mem_insert_of_mem (Finset.mem_union_left _ (Finset.mem_image.mpr ⟨v,Finset.mem_univ _,rfl⟩))
  · exact Finset.mem_insert_of_mem (Finset.mem_union_right _ (Finset.mem_image.mpr ⟨v,Finset.mem_univ _,rfl⟩))

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.CommonFieldModel.Model

Finset OAI.PlanarUnitDistances.CommonFieldModel.Plane →
  Finset OAI.PlanarUnitDistances.CommonFieldModel.Plane → Type
Lean source · PlanarUnitDistances/CommonCoordinates.lean, lines 49–57
structure Model where
  field : IntermediateField ℚ ℂ
  finite : FiniteDimensional ℚ field
  normal : Normal ℚ field
  i_mem : Complex.I ∈ field
  z : P ⊕ Q → field
  w : P ⊕ Q → field
  z_eq : ∀v,(z v:ℂ)=_root_.PlanarUnitDistances.zCoord (location P Q v)
  w_eq : ∀v,(w v:ℂ)=star (_root_.PlanarUnitDistances.zCoord (location P Q v))

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 2.6 A random sample cuts the circle arrangement

Lean verified

Let P be a finite prescribed point set, Q a nonempty finite set of l unit-circle centers, R > 0 , and w a nonnegative cost on Q . Put L ( l ) = log ⁡ ( 10 ( 81 ( 1 + l ) 6 + 1 ) ) . There are a sample of s ≤ R L ( l ) + 1 draws, a set T ⊆ Q of sampled centers with | T | ≤ s , and at most 43 ( 1 + s 2 ) open regions. Each region meets at most l / R original circles. Every prescribed point off all circles in T lies in one of these regions. Moreover ∑ c ∈ T w ( c ) ≤ ( 2 s / l ) ∑ c ∈ Q w ( c ) .

Proof

Choose a generic horizontal direction relative to the finite input. Decompose the complement of the sampled circles into vertical strips, continuing a gap past an event when neither boundary nor the closed limiting segment changes at the event. Charge new gaps to extrema and pairwise intersections. There are at most 43 ( 1 + s 2 ) strips, including at multiple intersections. The possible strip descriptions form a family of size at most 81 ( 1 + l ) 6 . A fixed candidate meeting more than l / R circles survives with probability at most exp ⁡ ( − s / R ) . A union bound and a bound for the expected cost give a sample with both properties. Rotating the regions back preserves openness and incidences.

Inspect the Lean declarations

OAI.PlanarUnitDistances.CircleCutting.cutting_with_cost

∀ (P Q : Finset OAI.PlanarUnitDistances.CircleCutting.Plane),
  Q.Nonempty →
    ∀ (w : OAI.PlanarUnitDistances.CircleCutting.Plane → ℝ),
      (∀ c ∈ Q, 0 ≤ w c) →
        ∀ {R : ℝ},
          0 < R →
            ∃ s T D,
              ↑s ≤ R * OAI.PlanarUnitDistances.CircleCutting.cuttingLog Q.card + 1 ∧
                T ⊆ Q ∧
                  T.card ≤ s ∧
                    ∑ c ∈ T, w c ≤ 2 * ↑s * ((∑ c ∈ Q, w c) / ↑Q.card) ∧
                      D.card ≤ 43 * (1 + s ^ 2) ∧
                        (∀ U ∈ D,
                            IsOpen U ∧
                              ↑(OAI.PlanarUnitDistances.CircleCutting.conflicts Q U).card ≤ ↑Q.card / R) ∧
                          ∀ p ∈ P, (∀ c ∈ T, dist p c ≠ 1) → ∃ U ∈ D, p ∈ U
Lean source · PlanarUnitDistances/CircleSampling.lean, lines 255–311
theorem cutting_with_cost (P Q : Finset Plane) (hQ : Q.Nonempty)
    (w : Plane → ℝ) (hw : ∀ c ∈ Q, 0≤w c) {R : ℝ} (hR : 0<R) :
    ∃ (s : ℕ) (T : Finset Plane) (D : Finset (Set Plane)),
      (s : ℝ) ≤ R*cuttingLog Q.card+1 ∧ T ⊆ Q ∧ T.card ≤ s ∧
      (∑ c ∈ T, w c ≤ 2*(s : ℝ)*((∑ c ∈ Q, w c)/Q.card)) ∧
      D.card ≤ 43*(1+s^2) ∧
      (∀ U ∈ D, IsOpen U ∧ ((conflicts Q U).card : ℝ)≤(Q.card : ℝ)/R) ∧
      (∀ p ∈ P, (∀ c ∈ T, dist p c≠1) → ∃ U ∈ D, p ∈ U) := by
  obtain ⟨e,he,hpos⟩ := good_rotated_position P Q
  let v : Plane ≃ Plane := Equiv.ofBijective (rotate e) ⟨rotate_injective e he,rotate_surjective e he⟩
  have hv (p : Plane) : v p=rotate e p := rfl
  let Q' := Q.image (rotate e)
  obtain ⟨f,D,hf,hcost,hD,hconf,hcover⟩ := cutting_good_position
    (P.image (rotate e)) Q' (Finset.Nonempty.image hQ _) hpos (fun c => w (v.symm c))
    (by intro c hc; change c ∈ Q.image (rotate e) at hc
        obtain ⟨c₀,hc₀,heq⟩ := Finset.mem_image.mp hc
        rw [← heq,← hv,Equiv.symm_apply_apply]
        exact hw c₀ hc₀) hR
  let s := FiniteSampling.sampleSize R (candidateCodes Q').card
  let g : Fin s → Plane := fun j => v.symm (f j)
  let T := univ.image g
  let D' := D.image (fun U => (rotate e) ⁻¹' U)
  have hcQ : Q'.card=Q.card := Finset.card_image_of_injective Q (rotate_injective e he)
  have hsum : ∑ c ∈ Q', (fun c => w (v.symm c)) c=∑ c ∈ Q, w c := by
    rw [Finset.sum_image (rotate_injective e he).injOn]
    simp only [← hv,Equiv.symm_apply_apply]
  have hg (j : Fin s) : g j ∈ Q := by
    obtain ⟨c,hc,hcf⟩ := Finset.mem_image.mp (hf j)
    have hh : g j=c := by change v.symm (f j)=c; rw [← hcf,← hv,v.symm_apply_apply]
    rwa [hh]
  refine ⟨s,T,D',?_,?_,?_,?_,?_,?_,?_⟩
  · have hh := FiniteSampling.sampleSize_le hR (candidateCodes_card Q')
    simpa only [hcQ,Nat.cast_mul,Nat.cast_add,Nat.cast_one,Nat.cast_pow,cuttingLog,Nat.cast_ofNat] using hh
  · intro c hc
    obtain ⟨j,_,rfl⟩ := Finset.mem_image.mp hc
    exact hg j
  · exact Finset.card_image_le.trans_eq (by simp)
  · have hh : ∑ c ∈ T, w c ≤ ∑ j, w (g j) :=
      Finset.sum_image_le_of_nonneg (fun c hc => by
        obtain ⟨j,_,rfl⟩ := Finset.mem_image.mp hc
        exact hw _ (hg j))
    exact hh.trans (by simpa only [hsum,hcQ,Function.comp_apply] using hcost)
  · exact Finset.card_image_le.trans hD
  · intro U hU
    obtain ⟨V,hV,rfl⟩ := Finset.mem_image.mp hU
    refine ⟨(hconf V hV).1.preimage (rotate_continuous e),?_⟩
    have hh := (hconf V hV).2
    rw [conflicts_rotate Q e he,Finset.card_image_of_injective _ (rotate_injective e he),hcQ] at hh
    exact hh
  · intro p hp havoid
    have ha : ∀ j, dist (rotate e p) (f j)≠1 := by
      intro j hj
      have hh : f j=rotate e (g j) := (v.apply_symm_apply (f j)).symm
      rw [hh,rotate_dist e he] at hj
      exact havoid (g j) (Finset.mem_image.mpr ⟨j,Finset.mem_univ _,rfl⟩) hj
    obtain ⟨U,hU,hpU⟩ := hcover (rotate e p) (Finset.mem_image.mpr ⟨p,hp,rfl⟩) ha
    exact ⟨_,Finset.mem_image.mpr ⟨U,hU,rfl⟩,hpU⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.CircleCutting.cutting_good_position

∀ (P Q : Finset OAI.PlanarUnitDistances.CircleCutting.Plane),
  Q.Nonempty →
    (∀ T ⊆ Q,
        ∀ p ∈ P,
          (∀ c ∈ T, dist p c ≠ 1) → p.ofLp 0 ∉ OAI.PlanarUnitDistances.CircleCutting.eventAbscissas T) →
      ∀ (w : OAI.PlanarUnitDistances.CircleCutting.Plane → ℝ),
        (∀ c ∈ Q, 0 ≤ w c) →
          ∀ {R : ℝ},
            0 < R →
              ∃ f D,
                (∀
                    (j :
                      Fin
                        (OAI.PlanarUnitDistances.FiniteSampling.sampleSize R
                          (OAI.PlanarUnitDistances.CircleCutting.candidateCodes Q).card)),
                    f j ∈ Q) ∧
                  ∑ j, w (f j) ≤
                      2 *
                          ↑(OAI.PlanarUnitDistances.FiniteSampling.sampleSize R
                              (OAI.PlanarUnitDistances.CircleCutting.candidateCodes Q).card) *
                        ((∑ c ∈ Q, w c) / ↑Q.card) ∧
                    D.card ≤
                        43 *
                          (1 +
                            OAI.PlanarUnitDistances.FiniteSampling.sampleSize R
                                (OAI.PlanarUnitDistances.CircleCutting.candidateCodes Q).card ^
                              2) ∧
                      (∀ U ∈ D,
                          IsOpen U ∧
                            ↑(OAI.PlanarUnitDistances.CircleCutting.conflicts Q U).card ≤ ↑Q.card / R) ∧
                        ∀ p ∈ P,
                          (∀
                              (j :
                                Fin
                                  (OAI.PlanarUnitDistances.FiniteSampling.sampleSize R
                                    (OAI.PlanarUnitDistances.CircleCutting.candidateCodes Q).card)),
                              dist p (f j) ≠ 1) →
                            ∃ U ∈ D, p ∈ U
Lean source · PlanarUnitDistances/CircleSampling.lean, lines 189–235
theorem cutting_good_position (P Q : Finset Plane) (hQ : Q.Nonempty)
    (hpos : ∀ T ⊆ Q, ∀ p ∈ P, (∀ c ∈ T, dist p c≠1) → p 0 ∉ eventAbscissas T)
    (w : Plane → ℝ) (hw : ∀ c ∈ Q, 0≤w c) {R : ℝ} (hR : 0<R) :
    ∃ (f : Fin (FiniteSampling.sampleSize R (candidateCodes Q).card) → Plane)
      (D : Finset (Set Plane)),
      (∀ j, f j ∈ Q) ∧
      (∑ j, w (f j) ≤ 2*(FiniteSampling.sampleSize R (candidateCodes Q).card : ℝ)*
        ((∑ c ∈ Q, w c)/Q.card)) ∧
      D.card ≤ 43*(1+(FiniteSampling.sampleSize R (candidateCodes Q).card)^2) ∧
      (∀ U ∈ D, IsOpen U ∧ ((conflicts Q U).card : ℝ)≤(Q.card : ℝ)/R) ∧
      (∀ p ∈ P, (∀ j, dist p (f j)≠1) → ∃ U ∈ D, p ∈ U) := by
  let C (r : RegionCode) : Finset Q := univ.filter (fun (c : Q) => ∃ p ∈ codeRegion r, dist p (c : Plane)=1)
  have hl : 0<Fintype.card Q := by simpa using hQ.card_pos
  obtain ⟨f,hf,hcost⟩ := FiniteSampling.exists_hit_large_conflicts_with_cost hl (candidateCodes Q)
    C (fun c => w c) (fun c => hw c c.property) hR
  let T := univ.image (fun j => (f j : Plane))
  have hT : T ⊆ Q := by
    intro c hc
    obtain ⟨j,_,rfl⟩ := Finset.mem_image.mp hc
    exact (f j).property
  obtain ⟨d⟩ := arrangement_exists T
  let D := d.pieces.image (fun r => region d.a r.1 r.2.1 r.2.2)
  refine ⟨fun j => f j,D,fun j => (f j).property,?_,?_,?_,?_⟩
  · have hs : ∑ c ∈ Q, w c=∑ c : Q, w c := Finset.sum_subtype Q (fun _ => Iff.rfl) w
    simpa only [hs,Fintype.card_coe] using hcost
  · apply Finset.card_image_le.trans (d.pieces_card.trans ?_)
    have ht : T.card ≤ FiniteSampling.sampleSize R (candidateCodes Q).card := by
      exact Finset.card_image_le.trans_eq (by simp)
    gcongr
  · intro U hU
    obtain ⟨r,hr,rfl⟩ := Finset.mem_image.mp hU
    refine ⟨region_open _ _ _ _,?_⟩
    obtain ⟨c,hc,he⟩ := d.piece_description hT hr
    by_contra! hbad
    have hbig : (Fintype.card Q : ℝ)/R < ((C c).card : ℝ) := by
      simpa only [C,conflicts_subtype_card,Fintype.card_coe,← he] using hbad
    obtain ⟨j,hj⟩ := hf c hc hbig
    obtain ⟨p,hp,hpf⟩ := (Finset.mem_filter.mp hj).2
    rw [← he] at hp
    exact d.piece_avoids hr p hp (f j) (Finset.mem_image.mpr ⟨j,Finset.mem_univ _,rfl⟩) hpf
  · intro p hp havoid
    have hpT : ∀ c ∈ T, dist p c≠1 := by
      intro c hc
      obtain ⟨j,_,rfl⟩ := Finset.mem_image.mp hc
      exact havoid j
    obtain ⟨r,hr,hpr⟩ := d.pieces_cover (hpos T hT p hp hpT) hpT
    exact ⟨_,Finset.mem_image.mpr ⟨r,hr,rfl⟩,hpr⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 2.7 A uniform incidence estimate with logarithmic factors

Lean verified

For m planar points P and l unit circles centered at Q , one has

I ( P , Q ) ≤ 1000 L ( m + l ) 2 ( ( m l ) 2 / 3 + m + l ) .

For l > 0 , R > 0 , and a positive integer B , set S = R L ( l ) + 1 . There are F ⊆ P , G ⊆ Q with | F | ≤ B , | G | ≤ l / R , and

I ( P , Q ) ≤ S ( m + 2 l ) + { 43 ( 1 + S 2 ) + m / B } I ( F , G ) .
Proof

Assign each surviving point to one covering region and partition the points assigned there into blocks. Deleting sample-circle points costs at most S ( m + 2 l ) incidences: each pair of distinct circles meets at most twice. The displayed block inequality follows by averaging over the remaining blocks and their conflict sets. For the incidence upper bound, apply the cutting with degree costs and the elementary bound I ( P , Q ) ≤ 2 m l + 2 l within the regions. Optimize the cutting parameter, treating the small and large parameter ranges separately. Fixed positive exponent losses can absorb the factor L ( m + l ) 2 .

Inspect the Lean declarations

OAI.PlanarUnitDistances.CircleIncidence.incidence_bound_enlarged

∀ (P Q : Finset OAI.PlanarUnitDistances.Plane) {L m n : ℝ},
  1 ≤ L →
    OAI.PlanarUnitDistances.CircleCutting.cuttingLog P.card ≤ L →
      OAI.PlanarUnitDistances.CircleCutting.cuttingLog Q.card ≤ L →
        ↑P.card ≤ m →
          ↑Q.card ≤ n →
            OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ≤
              1000 * L ^ 2 * ((m * n) ^ (2 / 3) + m + n)
Lean source · PlanarUnitDistances/CircleRegularization.lean, lines 20–36
lemma incidence_bound_enlarged (P Q : Finset Plane) {L m n : ℝ}
    (hL : 1 ≤ L) (hlP : cuttingLog P.card ≤ L) (hlQ : cuttingLog Q.card ≤ L)
    (hm : (P.card : ℝ) ≤ m) (hn : (Q.card : ℝ) ≤ n) :
    incidences P Q ≤ 1000*L^2*((m*n)^((2:ℝ)/3)+m+n) := by
  have h0 := (Nat.cast_nonneg P.card : (0:ℝ) ≤ P.card)
  have h1 := (Nat.cast_nonneg Q.card : (0:ℝ) ≤ Q.card)
  have hi : incidences P Q ≤ 1000*L^2*(((P.card:ℝ)*Q.card)^((2:ℝ)/3)+P.card+Q.card) := by
    rcases le_total P.card Q.card with h | h
    · exact incidence_bound_oriented P Q h hL hlQ
    · have he := incidence_bound_oriented Q P h hL hlP
      rw [incidences_comm Q P] at he
      convert he using 1; ring_nf
  apply hi.trans
  apply mul_le_mul_of_nonneg_left _ (by positivity)
  have hp := Real.rpow_le_rpow (mul_nonneg h0 h1)
    (mul_le_mul hm hn h1 (h0.trans hm)) (by norm_num : (0:ℝ) ≤ 2/3)
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.CircleIncidence.exists_incidence_piece

∀ (P Q : Finset OAI.PlanarUnitDistances.Plane),
  Q.Nonempty →
    ∀ {R : ℝ},
      0 < R →
        ∀ {B : ℕ},
          0 < B →
            ∃ F ⊆ P,
              ∃ G ⊆ Q,
                F.card ≤ B ∧
                  ↑G.card ≤ ↑Q.card / R ∧
                    OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ≤
                      (R * OAI.PlanarUnitDistances.CircleCutting.cuttingLog Q.card + 1) *
                          (↑P.card + 2 * ↑Q.card) +
                        (43 * (1 + (R * OAI.PlanarUnitDistances.CircleCutting.cuttingLog Q.card + 1) ^ 2) +
                            ↑P.card / ↑B) *
                          OAI.PlanarUnitDistances.CircleIncidence.incidences F G
Lean source · PlanarUnitDistances/CircleSampling.lean, lines 825–862
theorem exists_incidence_piece (P Q : Finset Plane) (hQ : Q.Nonempty)
    {R : ℝ} (hR : 0<R) {B : ℕ} (hB : 0<B) :
    ∃ F ⊆ P, ∃ G ⊆ Q, F.card ≤ B ∧ (G.card : ℝ) ≤ (Q.card : ℝ)/R ∧
      incidences P Q ≤ (R*cuttingLog Q.card+1)*((P.card : ℝ)+2*Q.card)+
        (43*(1+(R*cuttingLog Q.card+1)^2)+(P.card : ℝ)/B)*incidences F G := by
  obtain ⟨s,T,D,hs,hT,hTs,_,hD,hconf,hcover⟩ :=
    cutting_with_cost P Q hQ (degree P) (fun q _ => degree_nonneg P q) hR
  have hsn : (0 : ℝ) ≤ s := Nat.cast_nonneg _
  have hTl : (T.card : ℝ) ≤ R*cuttingLog Q.card+1 := (Nat.cast_le.mpr hTs).trans hs
  have hrl : 0 ≤ R*cuttingLog Q.card+1 := hsn.trans hs
  have hdel : incidences (deleted P T) Q ≤
      (R*cuttingLog Q.card+1)*((P.card : ℝ)+2*Q.card) :=
    (deleted_incidence_trivial P Q T hT).trans
      (mul_le_mul_of_nonneg_right hTl (by positivity))
  have hrP : ((retained P T).card : ℝ) ≤ (P.card : ℝ) :=
    Nat.cast_le.mpr (Finset.card_filter_le _ _)
  have hDc : (D.card : ℝ) ≤ 43*(1+(R*cuttingLog Q.card+1)^2) := by
    have hh : (D.card : ℝ) ≤ 43*(1+(s : ℝ)^2) := by exact_mod_cast hD
    have hh' := (sq_le_sq₀ hsn hrl).mpr hs
    linarith
  by_cases hp : (retained P T).Nonempty
  · obtain ⟨F,hF,G,hG,hFB,hGR,hFG⟩ := dense_region_subset (retained P T) Q hp D hB
      (fun U hU => (hconf U hU).2)
      (fun p hp => hcover p (Finset.mem_filter.mp hp).1 (Finset.mem_filter.mp hp).2)
    refine ⟨F,hF.trans (Finset.filter_subset _ _),G,hG,hFB,hGR,?_⟩
    have hcoef : (D.card : ℝ)+((retained P T).card : ℝ)/B ≤
        43*(1+(R*cuttingLog Q.card+1)^2)+(P.card : ℝ)/B :=
      add_le_add hDc (div_le_div_of_nonneg_right hrP (Nat.cast_nonneg _))
    have hm := mul_le_mul_of_nonneg_right hcoef (incidences_nonneg F G)
    have hsplit := incidence_deletion_split P Q T
    linarith
  · refine ⟨∅,Finset.empty_subset _,∅,Finset.empty_subset _,by simp,by simp; positivity,?_⟩
    have he : retained P T=∅ := Finset.not_nonempty_iff_eq_empty.mp hp
    have hz : incidences (retained P T) Q=0 := by simp [he,incidences,degree]
    have hz' : incidences ∅ ∅=0 := by simp [incidences]
    rw [hz',mul_zero,add_zero]
    have hsplit := incidence_deletion_split P Q T
    linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 2.8 The first restricted incidence graph

Lean verified

Fix g > 0 , set a = 10000 g ≤ 1 / 10 , and let t = n 1 / 3 for the actual integer cardinality n . For sufficiently large t , at least t 4 − g ordered unit pairs yield a trimmed bipartite incidence graph with e edges and

t 1 + 2 a − 13 g ≤ | P 0 | ≤ 2 t 1 + 2 a , t 2 + a − 13 g ≤ | Q 0 | ≤ t 2 + a , e ≥ t 2 + 2 a − 3 g , d P , max ≤ t 1 + 10 g , d Q , max ≤ t a + 10 g .

For each rectangle let u , v be its fractions of the two vertex classes and w its fraction of edges. With T = t 20 g ,

w ≤ T ( ( u v ) 2 / 3 + t − a v + t − 1 u ) , w ≤ T min ( u , v ) .
Proof

Use R = t 1 − a . Points on any sampled circle cost at most 3 t 3 incidences, including incidences with other circles. Break remaining regions into blocks with at most 2 t 1 + 2 a points per block, choose a block by averaging, and delete vertices whose pre-deletion degrees exceed the displayed maxima. The point–circle bound controls each deletion. The logarithm-squared incidence estimate of Lemma 2.7 suffices. The cutting loss has exponent 4 − a < 4 − g , and either trimming loss has exponent at most 2 + 2 a − 5 g < 2 + 2 a − g , up to arbitrarily small losses in the exponents. Thus the retained incidence count has exponent at least 2 + 2 a − g up to arbitrarily small losses. Taking a further loss of 2 g gives the displayed finite bound. The rectangle coefficient has exponent at most 11 g up to arbitrarily small losses, so 20 g suffices. The threshold is uniform over all configurations for fixed g .

Inspect the Lean declarations

PlanarUnitDistances.fixed_initial_rectangle

∀ {g : ℝ},
  0 < g →
    10000 * g ≤ 1 / 10 →
      have a := 10000 * g;
      ∀ᶠ (t : ℝ) in Filter.atTop,
        ∀ (X : Finset OAI.PlanarUnitDistances.Plane),
          ↑X.card = t ^ 3 →
            t ^ (4 - g) ≤ ↑(PlanarUnitDistances.orderedPairs X).card →
              ∃ P ⊆ X,
                ∃ Q ⊆ X,
                  t ^ (1 + 2 * a - 13 * g) ≤ ↑P.card ∧
                    ↑P.card ≤ 2 * t ^ (1 + 2 * a) ∧
                      t ^ (2 + a - 13 * g) ≤ ↑Q.card ∧
                        ↑Q.card ≤ t ^ (2 + a) ∧
                          t ^ (2 + 2 * a - 3 * g) ≤ OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ∧
                            (∀ p ∈ P, OAI.PlanarUnitDistances.CircleIncidence.degree Q p ≤ t ^ (1 + 10 * g)) ∧
                              (∀ q ∈ Q,
                                  OAI.PlanarUnitDistances.CircleIncidence.degree P q ≤ t ^ (a + 10 * g)) ∧
                                OAI.PlanarUnitDistances.GeometricExpansion.factor (↑P.card) (↑Q.card)
                                      (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q)
                                      (OAI.PlanarUnitDistances.CircleCutting.cuttingLog X.card)
                                      (t ^ (1 + 10 * g)) (t ^ (a + 10 * g)) t a ≤
                                    t ^ (20 * g) ∧
                                  ∀ A ⊆ P,
                                    ∀ B ⊆ Q,
                                      have u := ↑A.card / ↑P.card;
                                      have v := ↑B.card / ↑Q.card;
                                      have w :=
                                        OAI.PlanarUnitDistances.CircleIncidence.incidences A B /
                                          OAI.PlanarUnitDistances.CircleIncidence.incidences P Q;
                                      w ≤ t ^ (20 * g) * ((u * v) ^ (2 / 3) + t ^ (-a) * v + t ^ (-1) * u) ∧
                                        w ≤ t ^ (20 * g) * min u v
Lean source · PlanarUnitDistances/FixedCutting.lean, lines 477–581
/-- The actual trimmed Euclidean incidence graph, uniformly for all large real t
and all dense finite configurations of cardinality t³. -/
theorem fixed_initial_rectangle {g : ℝ} (hg : 0 < g) (ha1 : 10000*g ≤ 1/10) :
    let a := 10000*g
    ∀ᶠ t : ℝ in atTop, ∀ X : Finset Plane, (X.card:ℝ) = t^3 →
      t^(4-g) ≤ ((orderedPairs X).card:ℝ) →
      ∃ P ⊆ X, ∃ Q ⊆ X,
        t^(1+2*a-13*g) ≤ (P.card:ℝ) ∧ (P.card:ℝ) ≤ 2*t^(1+2*a) ∧
        t^(2+a-13*g) ≤ (Q.card:ℝ) ∧ (Q.card:ℝ) ≤ t^(2+a) ∧
        t^(2+2*a-3*g) ≤ incidences P Q ∧
        (∀ p ∈ P, degree Q p ≤ t^(1+10*g)) ∧ (∀ q ∈ Q, degree P q ≤ t^(a+10*g)) ∧
        factor P.card Q.card (incidences P Q) (cuttingLog X.card) (t^(1+10*g)) (t^(a+10*g)) t a ≤ t^(20*g) ∧
        (∀ A ⊆ P, ∀ B ⊆ Q,
          let u := (A.card:ℝ)/P.card
          let v := (B.card:ℝ)/Q.card
          let w := incidences A B/incidences P Q
          w ≤ t^(20*g)*((u*v)^(2/3:ℝ)+t^(-a)*v+t^(-1:ℝ)*u) ∧
          w ≤ t^(20*g)*min u v) := by
  let a := 10000*g
  let I := {z : ℝ × Finset Plane // 1 ≤ z.1 ∧ (z.2.card:ℝ)=z.1^3 ∧
    z.1^(4-g) ≤ ((orderedPairs z.2).card:ℝ)}
  let t : I → ℝ := fun i => i.1.1
  let X : I → Finset Plane := fun i => i.1.2
  let f := Filter.comap t atTop
  have ht : Tendsto t f atTop := tendsto_comap
  have ht1 (i : I) : 1≤t i := i.2.1
  have ht0 (i : I) : 0<t i := zero_lt_one.trans_le (ht1 i)
  have hcard (i : I) : ((X i).card:ℝ)=(t i)^3 := i.2.2.1
  have hX0 (i : I) : (X i).Nonempty := by
    apply Finset.card_pos.mp
    apply (Nat.cast_pos (α := ℝ)).mp
    rw [hcard]
    exact pow_pos (ht0 i) _
  have hX : Upper f t (fun i => ((X i).card:ℝ)) 3 := by
    apply (upper_rpow ht 3).mono
    exact Eventually.of_forall fun i => (hcard i).le.trans_eq (Real.rpow_natCast (t i) 3).symm
  have hE : Lower f t (fun i => incidences (X i) (X i)) (4-g) := by
    apply (lower_rpow ht _).mono
    exact Eventually.of_forall fun i => (i.2.2.2).trans_eq (orderedPairs_card_eq_incidences (X i))
  have ha : 0<a := by dsimp [a]; positivity
  have ha' : a<1 := by dsimp [a]; linarith
  obtain ⟨P,Q,hPQ,hPc,hQc,hPu,hQu,hEl⟩ :=
    exists_cut_fixed_deficit X ht ht1 hX0 hX hcard hE (by dsimp [a]; linarith : g<a) ha ha'
  obtain ⟨F,G,hFG,hdF,hdG,hFu,hGu,hFinal⟩ :=
    trim_fixed_deficit ht ht1 hX (fun i => (hPQ i).1) (fun i => (hPQ i).2)
      (by linarith : g<10*g/2) ha ha' (by linarith : 0<10*g)
      (by dsimp [a]; linarith : 10*g<a) hPu hQu hEl
  have hbound : ∀ᶠ i in f, (t i)^(2+2*a-3*g) ≤ incidences (F i) (G i) := by
    simpa only [show 2+2*a-g-2*g=2+2*a-3*g by ring] using hFinal (2*g) (by positivity)
  let L := fun i => cuttingLog (X i).card
  let T := fun i => factor (F i).card (G i).card (incidences (F i) (G i))
    (L i) ((t i)^(1+10*g)) ((t i)^(a+10*g)) (t i) a
  have hTu := factor_upper_fixed hg.le ht ha ha' (show 0<10*g by linarith)
    hFu hGu hFinal (cuttingLog_upper ht hX)
    (Eventually.of_forall fun i => Nat.cast_nonneg _) (Eventually.of_forall fun i => Nat.cast_nonneg _)
    (Eventually.of_forall fun i => zero_le_one.trans (cuttingLog_one_le _))
  have hT : ∀ᶠ i in f, T i ≤ (t i)^(20*g) := by
    have hh := hTu (9*g) (by positivity)
    have he : 10*g+g+9*g=20*g := by ring
    simpa only [he,T,L] using hh
  have hall : ∀ᶠ i in f,
      ∃ F₀ ⊆ X i, ∃ G₀ ⊆ X i,
        (t i)^(1+2*a-13*g) ≤ (F₀.card:ℝ) ∧ (F₀.card:ℝ) ≤ 2*(t i)^(1+2*a) ∧
        (t i)^(2+a-13*g) ≤ (G₀.card:ℝ) ∧ (G₀.card:ℝ) ≤ (t i)^(2+a) ∧
        (t i)^(2+2*a-3*g) ≤ incidences F₀ G₀ ∧
        (∀ p ∈ F₀, degree G₀ p ≤ (t i)^(1+10*g)) ∧
        (∀ q ∈ G₀, degree F₀ q ≤ (t i)^(a+10*g)) ∧
        factor F₀.card G₀.card (incidences F₀ G₀) (L i) ((t i)^(1+10*g)) ((t i)^(a+10*g)) (t i) a ≤ (t i)^(20*g) ∧
        (∀ A ⊆ F₀, ∀ B ⊆ G₀,
          let u := (A.card:ℝ)/F₀.card
          let v := (B.card:ℝ)/G₀.card
          let w := incidences A B/incidences F₀ G₀
          w ≤ (t i)^(20*g)*((u*v)^(2/3:ℝ)+(t i)^(-a)*v+(t i)^(-1:ℝ)*u) ∧
          w ≤ (t i)^(20*g)*min u v) := by
    filter_upwards [hbound,hT] with i hi hTi
    refine ⟨F i,(hFG i).1.trans (hPQ i).1,G i,(hFG i).2.trans (hPQ i).2,?_,
      (Nat.cast_le.mpr (Finset.card_le_card (hFG i).1)).trans (hPc i),?_,
      (Nat.cast_le.mpr (Finset.card_le_card (hFG i).2)).trans (hQc i),hi,hdF i,hdG i,hTi,?_⟩
    · have h := hi.trans (incidence_degree_le (F i) (G i) (hdF i))
      have hd := Real.rpow_pos_of_pos (ht0 i) (1+10*g)
      have hdiv := (div_le_iff₀ hd).mpr h
      rw [← Real.rpow_sub (ht0 i)] at hdiv
      rwa [show 2+2*a-3*g-(1+10*g) = 1+2*a-13*g by ring] at hdiv
    · have h := incidence_degree_le (G i) (F i) (hdG i)
      rw [incidences_comm (G i) (F i)] at h
      have hd := Real.rpow_pos_of_pos (ht0 i) (a+10*g)
      have hdiv := (div_le_iff₀ hd).mpr (hi.trans h)
      rw [← Real.rpow_sub (ht0 i)] at hdiv
      rwa [show 2+2*a-3*g-(a+10*g) = 2+a-13*g by ring] at hdiv
    · intro A hA B hB
      have hed := (Real.rpow_pos_of_pos (ht0 i) _).trans_le hi
      have hAF := cuttingLog_mono (Finset.card_le_card ((hFG i).1.trans (hPQ i).1))
      have hBG := cuttingLog_mono (Finset.card_le_card ((hFG i).2.trans (hPQ i).2))
      have hs := preliminary_bounds (F i) (G i) (a := a) hed (cuttingLog_one_le _) hAF hBG
        (Real.rpow_nonneg (ht0 i).le _) (Real.rpow_nonneg (ht0 i).le _)
        (ht0 i) (hdF i) (hdG i) A hA B hB
      have htPos := ht0 i
      dsimp only at hs ⊢
      constructor
      · exact hs.1.trans (mul_le_mul_of_nonneg_right hTi (by positivity))
      · exact hs.2.1.trans (mul_le_mul_of_nonneg_right hTi (le_min (by positivity) (by positivity)))
  change ∀ᶠ i in Filter.comap t atTop, _ at hall
  filter_upwards [eventually_comap.mp hall, eventually_ge_atTop (1:ℝ)] with b hb hb1
  intro Y hc hDense
  exact hb (⟨(b,Y),hb1,hc,hDense⟩ : I) rfl

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.orderedPairs_card_eq_incidences

∀ (X : Finset OAI.PlanarUnitDistances.Plane),
  ↑(PlanarUnitDistances.orderedPairs X).card = OAI.PlanarUnitDistances.CircleIncidence.incidences X X
Lean source · PlanarUnitDistances/FixedCutting.lean, lines 470–475
/-- The cutting input counts ordered pairs, with exactly the project's unit-pair convention. -/
theorem orderedPairs_card_eq_incidences (X : Finset Plane) :
    ((orderedPairs X).card : ℝ) = incidences X X := by
  classical
  simp only [orderedPairs, Finset.card_filter, Nat.cast_sum, Nat.cast_ite, Nat.cast_one,
    Nat.cast_zero, Finset.sum_product, incidences, degree_sum, dist_comm]

Kernel axioms used: propext, Classical.choice, Quot.sound.

2.3 Restriction to a maximizing rectangle

Lemma 2.9 Absorbing the two linear error terms

Lean verified

Let u , v ≥ 0 , T > 0 , 0 ≤ y ≤ x , and suppose w ≤ T ( ( u v ) 2 / 3 + x v + y u ) and w ≤ T min ( u , v ) . Then

w ≤ T u v ( ( u v ) 1 / 6 + 2 x ) .
Proof

Bound w / T by ( u v ) 2 / 3 + min ( u , x v ) + min ( v , y u ) , by considering which term realizes each minimum. The two minima are bounded by x u v and y u v . This includes empty vertex classes.

Inspect the Lean declarations

PlanarUnitDistances.trim_linear_terms

∀ {u v w T x y : ℝ},
  0 ≤ u →
    0 ≤ v →
      0 < T →
        0 ≤ y →
          y ≤ x →
            w ≤ T * ((u * v) ^ (2 / 3) + x * v + y * u) →
              w ≤ T * min u v → w ≤ T * √(u * v) * ((u * v) ^ (1 / 6) + 2 * √x)
Lean source · PlanarUnitDistances/Rectangle.lean, lines 23–63
/-- Convert the two linear terms of the incidence estimate into the
square-root remainder. In the application x=t^(-a) and y=t^(-1). -/
theorem trim_linear_terms {u v w T x y : ℝ} (hu : 0 ≤ u) (hv : 0 ≤ v)
    (hT : 0 < T) (hy : 0 ≤ y) (hyx : y ≤ x)
    (hinc : w ≤ T * ((u * v) ^ (2 / 3 : ℝ) + x * v + y * u))
    (hdegree : w ≤ T * min u v) :
    w ≤ T * Real.sqrt (u * v) * ((u * v) ^ (1 / 6 : ℝ) + 2 * Real.sqrt x) := by
  have huv : 0 ≤ u * v := mul_nonneg hu hv
  have hx := hy.trans hyx
  have hinc' := (div_le_iff₀ hT).mpr (hinc.trans_eq (mul_comm T _))
  have hdegree' := (div_le_iff₀ hT).mpr (hdegree.trans_eq (mul_comm T _))
  have hlinear : w / T ≤ (u * v) ^ (2 / 3 : ℝ) + min u (x * v) + min v (y * u) := by
    have hmain := Real.rpow_nonneg huv (2 / 3 : ℝ)
    have h₁ := hdegree'.trans (min_le_left _ _)
    have h₂ := hdegree'.trans (min_le_right _ _)
    have hxv := mul_nonneg hx hv
    have hyu := mul_nonneg hy hu
    rcases le_total u (x * v) with h | h
    · rw [min_eq_left h]
      have hmin : 0 ≤ min v (y*u) := le_min hv hyu
      linarith
    · rw [min_eq_right h]
      rcases le_total v (y*u) with k | k
      · rw [min_eq_left k]; linarith
      · rw [min_eq_right k]; exact hinc'
  have hm₁ : min u (x * v) ≤ Real.sqrt x * Real.sqrt (u * v) := by
    rw [← Real.sqrt_mul hx, show x * (u * v) = u * (x * v) by ring]
    exact min_le_geometric _ _ hu (mul_nonneg hx hv)
  have hm₂ : min v (y * u) ≤ Real.sqrt x * Real.sqrt (u * v) := by
    calc
      _ ≤ Real.sqrt (v * (y * u)) := min_le_geometric _ _ hv (mul_nonneg hy hu)
      _ = Real.sqrt y * Real.sqrt (u * v) := by
        rw [← Real.sqrt_mul hy, show v * (y * u) = y * (u * v) by ring]
      _ ≤ _ := by gcongr
  have hpow : (u * v) ^ (2 / 3 : ℝ) = Real.sqrt (u * v) * (u * v) ^ (1 / 6 : ℝ) := by
    rw [Real.sqrt_eq_rpow, ← Real.rpow_add' huv (by norm_num : (1 / 2 : ℝ) + 1 / 6 ≠ 0)]
    norm_num
  rw [hpow] at hlinear
  have h := (div_le_iff₀ hT).mp (show w / T ≤ Real.sqrt (u*v) *
    ((u*v) ^ (1/6 : ℝ) + 2 * Real.sqrt x) by linarith)
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 2.10 A lower bound for the maximizing area

Lean verified

For z , T > 0 , suppose z 27 / 50 ≤ T z ( z 1 / 6 + 2 b ) and 2 T b z − 1 / 25 ≤ 1 / 2 . Then z ≥ ( 2 T ) − 150 / 19 .

Proof

Divide by z 27 / 50 . The two powers become z 19 / 150 and z − 1 / 25 . Subtracting the small term gives ( 2 T ) − 1 ≤ z 19 / 150 . Raise to the positive reciprocal exponent.

Inspect the Lean declarations

PlanarUnitDistances.winning_rectangle_product

∀ {z T b : ℝ},
  0 < z →
    0 < T →
      z ^ (27 / 50) ≤ T * √z * (z ^ (1 / 6) + 2 * b) →
        2 * T * b * z ^ (-(1 / 25)) ≤ 1 / 2 → (2 * T) ^ (-(150 / 19)) ≤ z
Lean source · PlanarUnitDistances/Rectangle.lean, lines 65–89
/-- Positivity of the winner and a small second term force a lower bound on
its product UV. This is the inversion producing the factor 150/19. -/
theorem winning_rectangle_product {z T b : ℝ} (hz : 0 < z) (hT : 0 < T)
    (hwin : z ^ (27 / 50 : ℝ) ≤ T * Real.sqrt z * (z ^ (1/6 : ℝ) + 2*b))
    (hsmall : 2*T*b*z^(-(1/25 : ℝ)) ≤ 1/2) :
    (2*T)^(-(150/19 : ℝ)) ≤ z := by
  have hp := Real.rpow_pos_of_pos hz (27/50 : ℝ)
  have heq₁ : z^(27/50 : ℝ) * z^(19/150 : ℝ) = Real.sqrt z * z^(1/6 : ℝ) := by
    rw [← Real.rpow_add hz, Real.sqrt_eq_rpow, ← Real.rpow_add hz]
    norm_num
  have heq₂ : z^(27/50 : ℝ) * z^(-(1/25 : ℝ)) = Real.sqrt z := by
    rw [← Real.rpow_add hz, Real.sqrt_eq_rpow]; norm_num
  have hdivide : 1 ≤ T*z^(19/150 : ℝ) + 2*T*b*z^(-(1/25 : ℝ)) := by
    apply (mul_le_mul_iff_right₀ hp).mp
    rw [mul_one]
    calc
      _ ≤ _ := hwin
      _ = T * (Real.sqrt z * z^(1/6 : ℝ)) + 2*T*b*Real.sqrt z := by ring
      _ = _ := by rw [← heq₁, ← heq₂]; ring
  have hsmall' : (2*T)⁻¹ ≤ z^(19/150 : ℝ) := by
    rw [← one_div, div_le_iff₀ (by positivity : 0 < 2*T)]; linarith
  have h := Real.rpow_le_rpow (by positivity) hsmall' (by norm_num : (0:ℝ) ≤ 150/19)
  rw [Real.inv_rpow (by positivity), ← Real.rpow_neg (by positivity),
    ← Real.rpow_mul hz.le, show (19/150 : ℝ)*(150/19) = 1 by norm_num, Real.rpow_one] at h
  exact h

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 2.11 Choosing a maximizing rectangle in the finite graph

Lean verified

Let P 0 , Q 0 be finite point and center sets of positive incidence count, with left and right degree caps d P , d Q . Fix t > 0 , a ∈ R , 0 < τ ≤ 1 and take L ≥ max ( 1 , L ( | P 0 | ) , L ( | Q 0 | ) ) . For the rectangle maximizing w / ( u v ) 27 / 50 among u , v ≥ τ , the winning fractions U , V , W satisfy W ≥ ( U V ) 27 / 50 > 0 . If τ ≤ U − 1 / | P 0 | , each winning point has marginal at least ( 27 / 50 ) / | P | in the uniform edge law of the winning graph. If τ ≤ V − 1 / | Q 0 | , the corresponding center marginal is at least ( 27 / 50 ) / | Q | . Both conclusions hold for the same rectangle.

Proof

There are finitely many eligible rectangles, and the full rectangle has objective 1 . Delete one point in the winner when the displayed inequality permits it. The optimality inequality for the remaining rectangle bounds its edge fraction by ( 1 − 1 / | P | ) 27 / 50 . Concavity bounds this by 1 − ( 27 / 50 ) / | P | . Transposition gives the center statement. The Lean theorem constructs actual subsets of the original Euclidean sets.

Inspect the Lean declarations

OAI.PlanarUnitDistances.GeometricOptimizer.exists_rectangle

∀ (P Q : Finset OAI.PlanarUnitDistances.Plane) {L dP dQ t a τ : ℝ},
  0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q →
    1 ≤ L →
      OAI.PlanarUnitDistances.CircleCutting.cuttingLog P.card ≤ L →
        OAI.PlanarUnitDistances.CircleCutting.cuttingLog Q.card ≤ L →
          0 ≤ dP →
            0 ≤ dQ →
              0 < t →
                (∀ p ∈ P, OAI.PlanarUnitDistances.CircleIncidence.degree Q p ≤ dP) →
                  (∀ q ∈ Q, OAI.PlanarUnitDistances.CircleIncidence.degree P q ≤ dQ) →
                    0 < τ →
                      τ ≤ 1 →
                        ∃ F ⊆ P,
                          ∃ G ⊆ Q,
                            have U := ↑F.card / ↑P.card;
                            have V := ↑G.card / ↑Q.card;
                            have W :=
                              OAI.PlanarUnitDistances.CircleIncidence.incidences F G /
                                OAI.PlanarUnitDistances.CircleIncidence.incidences P Q;
                            have T :=
                              OAI.PlanarUnitDistances.GeometricExpansion.factor (↑P.card) (↑Q.card)
                                (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) L dP dQ t a;
                            have e := √(t ^ (-a)) + √(t ^ (-1));
                            have ξ := T * √(U * V) / W * ((τ / min U V) ^ (1 / 6) + e);
                            τ ≤ U ∧
                              τ ≤ V ∧
                                0 < W ∧
                                  (U * V) ^ (27 / 50) ≤ W ∧
                                    (∀ A ⊆ F,
                                        ∀ B ⊆ G,
                                          OAI.PlanarUnitDistances.CircleIncidence.incidences A B /
                                              OAI.PlanarUnitDistances.CircleIncidence.incidences F G ≤
                                            √(↑A.card / ↑F.card * (↑B.card / ↑G.card)) *
                                              ((↑A.card / ↑F.card * (↑B.card / ↑G.card)) ^ (1 / 25) + ξ)) ∧
                                      (τ ≤ U - 1 / ↑P.card →
                                          ∀ p ∈ F,
                                            27 / 50 / ↑F.card ≤
                                              OAI.PlanarUnitDistances.CircleIncidence.degree G p /
                                                OAI.PlanarUnitDistances.CircleIncidence.incidences F G) ∧
                                        (τ ≤ V - 1 / ↑Q.card →
                                          ∀ q ∈ G,
                                            27 / 50 / ↑G.card ≤
                                              OAI.PlanarUnitDistances.CircleIncidence.degree F q /
                                                OAI.PlanarUnitDistances.CircleIncidence.incidences F G)
Lean source · PlanarUnitDistances/CircleRegularization.lean, lines 574–694
theorem exists_rectangle (P Q : Finset Plane) {L dP dQ t a τ : ℝ}
    (hE : 0< incidences P Q) (hL : 1≤ L)
    (hlP : cuttingLog P.card≤ L) (hlQ : cuttingLog Q.card≤ L)
    (hdP : 0≤ dP) (hdQ : 0≤ dQ) (ht : 0< t)
    (hP : ∀p∈P,degree Q p≤ dP) (hQ : ∀q∈Q,degree P q≤ dQ)
    (hτ : 0< τ) (hτ1 : τ≤ 1) :
    ∃F⊆P,∃G⊆Q,
      let U := (F.card:ℝ)/(P.card:ℝ)
      let V := (G.card:ℝ)/(Q.card:ℝ)
      let W := incidences F G/incidences P Q
      let T := factor (P.card:ℝ) (Q.card:ℝ) (incidences P Q) L dP dQ t a
      let e := Real.sqrt (t^(-a))+Real.sqrt (t^(-1:ℝ))
      let ξ := (T*Real.sqrt (U*V)/W)*((τ/min U V)^(1/6:ℝ)+e)
      τ≤ U ∧ τ≤ V ∧ 0< W ∧ (U*V)^(27/50:ℝ)≤ W ∧
      (∀A⊆F,∀B⊆G,incidences A B/incidences F G≤
        Real.sqrt ((A.card:ℝ)/F.card*((B.card:ℝ)/G.card))*
          (((A.card:ℝ)/F.card*((B.card:ℝ)/G.card))^(1/25:ℝ)+ξ)) ∧
      (τ≤ U-1/(P.card:ℝ) → ∀p∈F,(27/50:ℝ)/(F.card:ℝ)≤ degree G p/incidences F G) ∧
      (τ≤ V-1/(Q.card:ℝ) → ∀q∈G,(27/50:ℝ)/(G.card:ℝ)≤ degree F q/incidences F G) := by
  have hmn : 0<(P.card:ℝ)*(Q.card:ℝ) := hE.trans_le (incidences_le P Q)
  have hm : 0<(P.card:ℝ) := pos_of_mul_pos_left hmn (Nat.cast_nonneg _)
  have hn : 0<(Q.card:ℝ) := pos_of_mul_pos_right hmn (Nat.cast_nonneg _)
  have hμ : ∀p,0≤ counting P p := fun _ => div_nonneg zero_le_one (Nat.cast_nonneg _)
  have hν : ∀q,0≤ counting Q q := fun _ => div_nonneg zero_le_one (Nat.cast_nonneg _)
  have hμs : ∑p,counting P p=1 := by
    change mass (counting P) Finset.univ=1
    rw [counting_mass,lift_univ,div_self hm.ne']
  have hνs : ∑q,counting Q q=1 := by
    change mass (counting Q) Finset.univ=1
    rw [counting_mass,lift_univ,div_self hn.ne']
  have hws : ∑p,∑q,weight P Q p q=1 := by
    change rect (weight P Q) Finset.univ Finset.univ=1
    rw [weight_rect,lift_univ,lift_univ,div_self hE.ne']
  obtain ⟨F,G,hmax,hwin⟩ := exists_maximizing (counting P) (counting Q) (weight P Q)
    (γ:=(1/2:ℝ)+1/25) hτ1 hμs hνs hws
  obtain ⟨hU,hV,hW,hpow⟩ := winner_positive (counting P) (counting Q) (weight P Q) hτ hmax hwin
  let T := factor (P.card:ℝ) (Q.card:ℝ) (incidences P Q) L dP dQ t a
  let err := Real.sqrt (t^(-a))+Real.sqrt (t^(-1:ℝ))
  have hT0 : 0≤ T := zero_le_one.trans (factor_bounds (Nat.cast_nonneg _) (Nat.cast_nonneg _)
    hE hdP hdQ ht (a:=a) (L:=L)).1
  have hpre (A : Finset P) (B : Finset Q) : rect (weight P Q) A B≤
      T*Real.sqrt (mass (counting P) A*mass (counting Q) B)*
        ((mass (counting P) A*mass (counting Q) B)^(1/6:ℝ)+err) := by
    rw [weight_rect,counting_mass,counting_mass]
    simpa only [T,err,add_assoc] using preliminary (a:=a) P Q hE hL hlP hlQ hdP hdQ ht hP hQ (lift P A) (lift_subset P A)
      (lift Q B) (lift_subset Q B)
  have hexp := maximizing_expansion (counting P) (counting Q) (weight P Q)
    hμ hν hμs hνs hτ (by norm_num : (0:ℝ)≤ 1/25) (by norm_num : (0:ℝ)≤ 1/6)
    hT0 (show 0≤ err by dsimp [err]; positivity) hmax hW hpre
  let FP := lift P F
  let GQ := lift Q G
  have hFP : 0<(FP.card:ℝ) := by
    have hh := hU
    rw [counting_mass] at hh
    exact (div_pos_iff_of_pos_right hm).mp hh
  have hGQ : 0<(GQ.card:ℝ) := by
    have hh := hV
    rw [counting_mass] at hh
    exact (div_pos_iff_of_pos_right hn).mp hh
  have hFG : 0< incidences FP GQ := by
    rw [weight_rect] at hW
    exact (div_pos_iff_of_pos_right hE).mp hW
  refine ⟨FP,lift_subset P F,GQ,lift_subset Q G,?_,?_,?_,?_,?_,?_,?_⟩
  · simpa only [counting_mass] using hmax.1
  · simpa only [counting_mass] using hmax.2.1
  · simpa only [weight_rect] using hW
  · norm_num only at hpow
    simpa only [counting_mass,weight_rect] using hpow
  · intro A hA B hB
    let As := A.subtype (·∈P)
    let Bs := B.subtype (·∈Q)
    have hAP : A⊆P := hA.trans (lift_subset P F)
    have hBQ : B⊆Q := hB.trans (lift_subset Q G)
    have hAs : lift P As=A := lift_subtype P A hAP
    have hBs : lift Q Bs=B := lift_subtype Q B hBQ
    have hh := hexp As (subtype_subset hA) Bs (subtype_subset hB)
    simp only [counting_mass,weight_rect,hAs,hBs] at hh
    have hnormA : ((A.card:ℝ)/P.card)/((FP.card:ℝ)/P.card)=(A.card:ℝ)/FP.card := by field_simp [hm.ne',hn.ne',hFP.ne',hGQ.ne',hE.ne',hFG.ne']
    have hnormB : ((B.card:ℝ)/Q.card)/((GQ.card:ℝ)/Q.card)=(B.card:ℝ)/GQ.card := by field_simp [hm.ne',hn.ne',hFP.ne',hGQ.ne',hE.ne',hFG.ne']
    have hnormE : (incidences A B/incidences P Q)/(incidences FP GQ/incidences P Q)=
        incidences A B/incidences FP GQ := by field_simp [hm.ne',hn.ne',hFP.ne',hGQ.ne',hE.ne',hFG.ne']
    dsimp only [FP,GQ] at hnormA hnormB hnormE
    simpa only [hnormA,hnormB,hnormE,FP,GQ,T,err] using hh
  · intro he p hp
    obtain ⟨ps,hps,hpseq⟩ := Finset.mem_map.mp hp
    have her : τ≤ mass (counting P) (F.erase ps) := by
      have hh : mass (counting P) (F.erase ps)+counting P ps=mass (counting P) F :=
        Finset.sum_erase_add _ _ hps
      simp only [counting_mass,counting] at hh ⊢
      dsimp only [FP,GQ] at he
      linarith
    have hh := left_atom_bound (counting P) (counting Q) (weight P Q) hμ hτ
      (by norm_num : (0:ℝ)≤ 1/2+1/25) (by norm_num : (1/2:ℝ)+1/25≤ 1) hmax hW hps her
    rw [counting_mass,weight_row,weight_rect] at hh
    norm_num only at hh
    have hca : counting P ps/((FP.card:ℝ)/P.card)=1/(FP.card:ℝ) := by dsimp [counting]; field_simp [hm.ne',hn.ne',hFP.ne',hGQ.ne']
    have hce : (degree GQ ps/incidences P Q)/(incidences FP GQ/incidences P Q)=degree GQ ps/incidences FP GQ := by field_simp [hm.ne',hn.ne',hFP.ne',hGQ.ne',hE.ne',hFG.ne']
    rw [hca,hce] at hh
    change (ps:Plane)=p at hpseq
    simpa only [hpseq,mul_one_div] using hh
  · intro he q hq
    obtain ⟨qs,hqs,hqseq⟩ := Finset.mem_map.mp hq
    have her : τ≤ mass (counting Q) (G.erase qs) := by
      have hh : mass (counting Q) (G.erase qs)+counting Q qs=mass (counting Q) G :=
        Finset.sum_erase_add _ _ hqs
      simp only [counting_mass,counting] at hh ⊢
      dsimp only [FP,GQ] at he
      linarith
    have hh := right_atom_bound (counting P) (counting Q) (weight P Q) hν hτ
      (by norm_num : (0:ℝ)≤ 1/2+1/25) (by norm_num : (1/2:ℝ)+1/25≤ 1) hmax hW hqs her
    have hcol : (∑p∈F,weight P Q p qs)=degree FP qs/incidences P Q := by
      simp only [weight,←Finset.sum_div,degree_sum,FP,lift,Finset.sum_map,Function.Embedding.coe_subtype]
      congr 1

    rw [counting_mass,hcol,weight_rect] at hh
    norm_num only at hh
    have hca : counting Q qs/((GQ.card:ℝ)/Q.card)=1/(GQ.card:ℝ) := by dsimp [counting]; field_simp [hm.ne',hn.ne',hFP.ne',hGQ.ne']
    have hce : (degree FP qs/incidences P Q)/(incidences FP GQ/incidences P Q)=degree FP qs/incidences FP GQ := by field_simp [hm.ne',hn.ne',hFP.ne',hGQ.ne',hE.ne',hFG.ne']
    rw [hca,hce] at hh
    change (qs:Plane)=q at hqseq
    simpa only [hqseq,mul_one_div] using hh

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.IncidenceRegularization.exists_maximizing

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q] (μ : P → ℝ) (ν : Q → ℝ)
  (w : P → Q → ℝ) {τ γ : ℝ},
  τ ≤ 1 →
    ∑ p, μ p = 1 →
      ∑ q, ν q = 1 →
        ∑ p, ∑ q, w p q = 1 →
          ∃ F G,
            OAI.PlanarUnitDistances.IncidenceRegularization.IsMaximizing μ ν w τ γ F G ∧
              1 ≤ OAI.PlanarUnitDistances.IncidenceRegularization.objective μ ν w γ F G
Lean source · PlanarUnitDistances/CircleRegularization.lean, lines 105–122
theorem exists_maximizing {τ γ : ℝ} (hτ : τ ≤ 1)
    (hμ : ∑ p, μ p = 1) (hν : ∑ q, ν q = 1)
    (hw : ∑ p, ∑ q, w p q = 1) :
    ∃ F G, IsMaximizing μ ν w τ γ F G ∧ 1 ≤ objective μ ν w γ F G := by
  classical
  let S : Finset (Finset P × Finset Q) := univ.filter fun x =>
    τ ≤ mass μ x.1 ∧ τ ≤ mass ν x.2
  have hfull : ((univ : Finset P), (univ : Finset Q)) ∈ S := by
    apply mem_filter.mpr
    exact ⟨mem_univ _, by simpa [mass,hμ,hν] using And.intro hτ hτ⟩
  obtain ⟨⟨F,G⟩,hFG,hmax⟩ := S.exists_max_image
    (fun x => objective μ ν w γ x.1 x.2) ⟨_,hfull⟩
  have hfeas := (mem_filter.mp hFG).2
  refine ⟨F,G,⟨hfeas.1,hfeas.2,?_⟩,?_⟩
  · intro A B hA hB
    exact hmax (A,B) (by simp [S,hA,hB])
  · have hh := hmax (univ,univ) hfull
    simpa [objective, mass, rect, hμ, hν, hw] using hh

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 2.12 Marginal bounds inside the maximizing rectangle

Lean verified

Set τ = t − a / 8 and γ = 27 / 50 . Maximize w / ( u v ) γ over all rectangles with u , v ≥ τ , and denote one maximizer by ( U , V , W ) . For sufficiently large t ,

W ≥ ( U V ) γ , U V ≥ ( 2 T ) − 150 / 19 ≥ t − 160 g , W ≥ t − 87 g .

Every singleton point and center of the maximizer has edge marginal at least γ / | P | and γ / | Q | , respectively.

Proof

The full rectangle gives objective 1 . We have U V ≥ t − a / 4 , so 2 T t − a / 2 ( U V ) − 1 / 25 ≤ 2 T t − 49 a / 100 ≤ 1 / 2 eventually. Apply Lemma 2.10. Since U , V ≤ 1 , each exceeds t − 160 g . Deleting a single vertex stays feasible for sufficiently large t , using the lower vertex counts of Lemma 2.8. Optimality and concavity give 1 − μ ( p ) ≤ ( 1 − 1 / | P | ) γ ≤ 1 − γ / | P | . For each ambient size m , the lower bound on m gives 1 / m ≤ τ , and 2 τ ≤ t − 160 g eventually. Thus the singleton deletion tests hold simultaneously on the actual maximizing rectangle. Lean constructs the winning graph as subsets of the original Euclidean configuration and retains both marginal estimates on it.

Inspect the Lean declarations

PlanarUnitDistances.fixed_winning_graph

∀ {g : ℝ},
  0 < g →
    10000 * g ≤ 1 / 10 →
      have a := 10000 * g;
      ∀ᶠ (t : ℝ) in Filter.atTop,
        ∀ (X : Finset OAI.PlanarUnitDistances.Plane),
          ↑X.card = t ^ 3 →
            t ^ (4 - g) ≤ ↑(PlanarUnitDistances.orderedPairs X).card →
              ∃ F ⊆ X,
                ∃ G ⊆ X,
                  t ^ (1 + 2 * a - 173 * g) ≤ ↑F.card ∧
                    ↑F.card ≤ 2 * t ^ (1 + 2 * a) ∧
                      ↑G.card ≤ t ^ (2 + a) ∧
                        t ^ (2 + 2 * a - 90 * g) ≤ OAI.PlanarUnitDistances.CircleIncidence.incidences F G ∧
                          (∀ p ∈ F,
                              OAI.PlanarUnitDistances.CircleIncidence.degree G p ≤ t ^ (1 + 10 * g) ∧
                                27 / 50 / ↑F.card ≤
                                  OAI.PlanarUnitDistances.CircleIncidence.degree G p /
                                    OAI.PlanarUnitDistances.CircleIncidence.incidences F G) ∧
                            (∀ q ∈ G,
                                OAI.PlanarUnitDistances.CircleIncidence.degree F q ≤ t ^ (a + 10 * g) ∧
                                  27 / 50 / ↑G.card ≤
                                    OAI.PlanarUnitDistances.CircleIncidence.degree F q /
                                      OAI.PlanarUnitDistances.CircleIncidence.incidences F G) ∧
                              ∀ A ⊆ F,
                                ∀ B ⊆ G,
                                  have z := ↑A.card / ↑F.card * (↑B.card / ↑G.card);
                                  OAI.PlanarUnitDistances.CircleIncidence.incidences A B /
                                      OAI.PlanarUnitDistances.CircleIncidence.incidences F G ≤
                                    √z * (z ^ (1 / 25) + t ^ (-150 * g))
Lean source · PlanarUnitDistances/WinningGraph.lean, lines 11–74
/-- Simultaneously extract both marginal lower bounds and the stated size,
edge, and maximum-degree estimates on a single Euclidean unit-incidence graph. -/
theorem fixed_winning_graph {g : ℝ} (hg : 0<g) (ha1 : 10000*g≤1/10) :
    let a := 10000*g
    ∀ᶠ t : ℝ in atTop, ∀ X : Finset Plane, (X.card:ℝ)=t^3 →
      t^(4-g) ≤ ((orderedPairs X).card:ℝ) →
      ∃ F ⊆ X, ∃ G ⊆ X,
        t^(1+2*a-173*g) ≤ (F.card:ℝ) ∧ (F.card:ℝ) ≤ 2*t^(1+2*a) ∧
        (G.card:ℝ) ≤ t^(2+a) ∧ t^(2+2*a-90*g) ≤ incidences F G ∧
        (∀ p ∈ F, degree G p ≤ t^(1+10*g) ∧ (27/50:ℝ)/F.card ≤ degree G p/incidences F G) ∧
        (∀ q ∈ G, degree F q ≤ t^(a+10*g) ∧ (27/50:ℝ)/G.card ≤ degree F q/incidences F G) ∧
        (∀ A ⊆ F, ∀ B ⊆ G,
          let z := (A.card:ℝ)/F.card*((B.card:ℝ)/G.card)
          incidences A B/incidences F G ≤ Real.sqrt z*(z^(1/25:ℝ)+t^(-150*g))) := by
  let a := 10000*g
  filter_upwards [fixed_initial_rectangle hg ha1,fixed_winner_scales hg,winning_error_bound hg ha1,eventually_ge_atTop (1:ℝ)]
    with t htrim hsc herror ht
  have ht0 := zero_lt_one.trans_le ht
  have ha : 0<a := by dsimp [a]; positivity
  intro X hc hDense
  obtain ⟨P,hPX,Q,hQX,hm,hm',hn,hn',he,hdP,hdQ,hT,hraw⟩ := htrim X hc hDense
  have hm0 : 0<(P.card:ℝ) := (Real.rpow_pos_of_pos ht0 _).trans_le hm
  have hn0 : 0<(Q.card:ℝ) := (Real.rpow_pos_of_pos ht0 _).trans_le hn
  have he0 : 0 < incidences P Q := (Real.rpow_pos_of_pos ht0 _).trans_le he
  have hτ0 := Real.rpow_pos_of_pos ht0 (-a/8)
  have hτ1 : t^(-a/8) ≤ 1 := Real.rpow_le_one_of_one_le_of_nonpos ht (by linarith)
  obtain ⟨F,hFP,G,hGQ,hOpt⟩ := exists_rectangle P Q (t:=t) (a:=a) he0
    (cuttingLog_one_le X.card)
    (cuttingLog_mono (Finset.card_le_card hPX)) (cuttingLog_mono (Finset.card_le_card hQX))
    (Real.rpow_nonneg ht0.le _) (Real.rpow_nonneg ht0.le _) ht0 hdP hdQ hτ0 hτ1
  dsimp only at hOpt
  obtain ⟨hU,hV,_,hwin,hExp,hatF,hatG⟩ := hOpt
  let U : ℝ := F.card/(P.card:ℝ)
  let V : ℝ := G.card/(Q.card:ℝ)
  have hu0 : 0≤U := div_nonneg (Nat.cast_nonneg _) hm0.le
  have hv0 : 0≤V := div_nonneg (Nat.cast_nonneg _) hn0.le
  have hu1 : U≤1 := (div_le_one hm0).mpr (Nat.cast_le.mpr (Finset.card_le_card hFP))
  have hv1 : V≤1 := (div_le_one hn0).mpr (Nat.cast_le.mpr (Finset.card_le_card hGQ))
  have hr := hraw F hFP G hGQ
  have hy : t^(-1:ℝ)≤t^(-a) := Real.rpow_le_rpow_of_exponent_le ht (by dsimp [a]; linarith)
  have hb := trim_linear_terms hu0 hv0 (Real.rpow_pos_of_pos ht0 (20*g))
    (Real.rpow_nonneg ht0.le (-1)) hy hr.1 hr.2
  have hs : Real.sqrt (t^(-a))=t^(-a/2) := by
    rw [Real.sqrt_eq_rpow,← Real.rpow_mul ht0.le]; congr 1; ring
  rw [hs] at hb
  obtain ⟨_,hUVw,hUw,hVw,hWw,hFdel,hGdel⟩ := hsc hU hV hu1 hv1 hwin hb hm hn
  have hcoef0 := (OAI.PlanarUnitDistances.GeometricExpansion.factor_bounds (Nat.cast_nonneg P.card)
    (Nat.cast_nonneg Q.card) he0 (Real.rpow_nonneg ht0.le (1+10*g))
    (Real.rpow_nonneg ht0.le (a+10*g)) ht0 (a:=a) (L:=cuttingLog X.card)).1
  have hErr := herror (zero_le_one.trans hcoef0) hT hUw hVw hUVw hwin
  have hfcount := (le_div_iff₀ hm0).mp hUw
  have hcount := (mul_le_mul_of_nonneg_left hm (Real.rpow_nonneg ht0.le (-160*g))).trans hfcount
  have hecount := (le_div_iff₀ he0).mp hWw
  have hedge := (mul_le_mul_of_nonneg_left he (Real.rpow_nonneg ht0.le (-87*g))).trans hecount
  rw [← Real.rpow_add ht0] at hcount hedge
  refine ⟨F,hFP.trans hPX,G,hGQ.trans hQX,?_,
    (Nat.cast_le.mpr (Finset.card_le_card hFP)).trans hm',
    (Nat.cast_le.mpr (Finset.card_le_card hGQ)).trans hn',?_,?_,?_,?_⟩
  · simpa only [show -160*g+(1+2*(10000*g)-13*g)=1+2*(10000*g)-173*g by ring] using hcount
  · simpa only [show -87*g+(2+2*(10000*g)-3*g)=2+2*(10000*g)-90*g by ring] using hedge
  · exact fun p hp => ⟨(degree_mono hGQ p).trans (hdP p (hFP hp)),hatF hFdel p hp⟩
  · exact fun q hq => ⟨(degree_mono hFP q).trans (hdQ q (hGQ hq)),hatG hGdel q hq⟩
  · intro A hA B hB
    exact (hExp A hA B hB).trans (mul_le_mul_of_nonneg_left (add_le_add_right hErr _) (Real.sqrt_nonneg _))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.fixed_winner_scales

∀ {g : ℝ},
  0 < g →
    have a := 10000 * g;
    ∀ᶠ (t : ℝ) in Filter.atTop,
      ∀ {U V W m n : ℝ},
        t ^ (-a / 8) ≤ U →
          t ^ (-a / 8) ≤ V →
            U ≤ 1 →
              V ≤ 1 →
                (U * V) ^ (27 / 50) ≤ W →
                  W ≤ t ^ (20 * g) * √(U * V) * ((U * V) ^ (1 / 6) + 2 * t ^ (-a / 2)) →
                    t ^ (1 + 2 * a - 13 * g) ≤ m →
                      t ^ (2 + a - 13 * g) ≤ n →
                        (2 * t ^ (20 * g)) ^ (-(150 / 19)) ≤ U * V ∧
                          t ^ (-160 * g) ≤ U * V ∧
                            t ^ (-160 * g) ≤ U ∧
                              t ^ (-160 * g) ≤ V ∧
                                t ^ (-87 * g) ≤ W ∧ t ^ (-a / 8) ≤ U - 1 / m ∧ t ^ (-a / 8) ≤ V - 1 / n
Lean source · PlanarUnitDistances/WinningScales.lean, lines 14–72
/-- All fixed-g winner fractions and the two singleton deletion tests for the
actual sizes of the trimmed graph. The hypotheses below concern the selected
winner and its ambient vertex counts, so the conclusion applies to that same winner. -/
theorem fixed_winner_scales {g : ℝ} (hg : 0<g) :
    let a := 10000*g
    ∀ᶠ t : ℝ in atTop, ∀ {U V W m n : ℝ},
      t^(-a/8) ≤ U → t^(-a/8) ≤ V → U≤1 → V≤1 →
      (U*V)^(27/50:ℝ) ≤ W →
      W ≤ t^(20*g)*Real.sqrt (U*V)*((U*V)^(1/6:ℝ)+2*t^(-a/2)) →
      t^(1+2*a-13*g) ≤ m → t^(2+a-13*g) ≤ n →
      (2*t^(20*g))^(-(150/19:ℝ)) ≤ U*V ∧ t^(-160*g) ≤ U*V ∧
      t^(-160*g) ≤ U ∧ t^(-160*g) ≤ V ∧ t^(-87*g) ≤ W ∧
      t^(-a/8) ≤ U-1/m ∧ t^(-a/8) ≤ V-1/n := by
  let a := 10000*g
  have eSmall : 20*g-a/2+a/100<0 := by dsimp [a]; linarith
  have hsmall := eventually_const_mul_rpow_le eSmall 4
  have eProd : -(160:ℝ)*g < 20*g*(-(150/19:ℝ)) := by linarith
  have hprod := eventually_const_mul_rpow_le eProd ((2:ℝ)^(150/19:ℝ))
  have edel : -a/8 < -160*g := by dsimp [a]; linarith
  have hdel := eventually_const_mul_rpow_le edel 2
  filter_upwards [hsmall,hprod,hdel,eventually_ge_atTop (1:ℝ)] with t hsmall hprod hdel ht
  have ht0 := zero_lt_one.trans_le ht
  intro U V W m n hu hv hu1 hv1 hW hpre hm hn
  have hτ := Real.rpow_pos_of_pos ht0 (-a/8)
  have hu0 := hτ.trans_le hu
  have hv0 := hτ.trans_le hv
  have hz := mul_pos hu0 hv0
  have hcut := mul_le_mul hu hv hτ.le hu0.le
  have hp := Real.rpow_le_rpow_of_nonpos (mul_pos hτ hτ) hcut (by norm_num : -(1/25:ℝ)≤0)
  have hfpow : (t^(-a/8)*t^(-a/8))^(-(1/25:ℝ)) = t^(a/100) := by
    rw [← Real.rpow_add ht0,← Real.rpow_mul ht0.le]; congr 1; ring
  rw [hfpow] at hp
  have hcalc : 2*t^(20*g)*t^(-a/2)*(U*V)^(-(1/25:ℝ)) ≤ 1/2 := by
    calc
      _ ≤ 2*t^(20*g)*t^(-a/2)*t^(a/100) := mul_le_mul_of_nonneg_left hp (by positivity)
      _ = 2*t^(20*g-a/2+a/100) := by rw [show 20*g-a/2+a/100 = (20*g+(-a/2))+a/100 by ring, Real.rpow_add ht0,Real.rpow_add ht0]; ring
      _ ≤ 1/2 := by rw [Real.rpow_zero] at hsmall; linarith
  have hMin := winning_rectangle_product hz (Real.rpow_pos_of_pos ht0 _) (hW.trans hpre) hcalc
  have hscaled : t^(-160*g) ≤ (2*t^(20*g))^(-(150/19:ℝ)) := by
    rw [Real.mul_rpow (by norm_num : (0:ℝ)≤2) (Real.rpow_nonneg ht0.le _),
      ← Real.rpow_mul ht0.le, Real.rpow_neg (by norm_num : (0:ℝ)≤2), inv_mul_eq_div]
    exact (le_div_iff₀ (Real.rpow_pos_of_pos (by norm_num : (0:ℝ)<2) _)).mpr (by linarith)
  have hzMin := hscaled.trans hMin
  have hU := hzMin.trans (mul_le_of_le_one_right hu0.le hv1)
  have hV := hzMin.trans (mul_le_of_le_one_left hv0.le hu1)
  have hWMin : t^(-87*g) ≤ W := by
    have hw := Real.rpow_le_rpow (Real.rpow_nonneg ht0.le _) hzMin (by norm_num : 0≤(27/50:ℝ))
    rw [← Real.rpow_mul ht0.le] at hw
    exact (Real.rpow_le_rpow_of_exponent_le ht (by linarith)).trans (hw.trans hW)
  have hdelany (k z e : ℝ) (hSize : t^e ≤ k) (hexp : -a/8 ≥ -e)
      (hZ : t^(-160*g) ≤ z) : t^(-a/8) ≤ z-1/k := by
    have hk : 0<k := (Real.rpow_pos_of_pos ht0 _).trans_le hSize
    have hr := one_div_le_one_div_of_le (Real.rpow_pos_of_pos ht0 e) hSize
    rw [one_div (t^e),← Real.rpow_neg ht0.le] at hr
    have hpart := hr.trans (Real.rpow_le_rpow_of_exponent_le ht hexp)
    linarith
  exact ⟨hMin,hzMin,hU,hV,hWMin,
    hdelany m U _ hm (by dsimp [a]; linarith) hU,
    hdelany n V _ hn (by dsimp [a]; linarith) hV⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

2.4 The extracted law and the endpoint

Proposition 2.13 How much one endpoint reveals about the other

Lean verified

Write e = | E | , let p , r be independent uniform neighbors of a center q sampled with probability d ( q ) / e . Assume all vertices are incident, the point class is nonempty, and distinct points have at most two common centers. Put d ∗ = min q d ( q ) and b d i a g = | Q | / e . Then

I ( p ; r ) ≤ 2 log ⁡ | P | − ( 1 − b d i a g ) log ⁡ ( e d ∗ / 2 ) .
Proof

A triple has probability 1 / ( e d ( q ) ) . Off the diagonal, summing over centers gives mass at most 2 / ( e d ∗ ) for an ordered pair. On the diagonal, summing the conditional collision probabilities 1 / d ( q ) gives total mass | Q | / e . The off-diagonal contribution to the joint entropy is at least ( 1 − b d i a g ) log ⁡ ( e d ∗ / 2 ) , and each marginal entropy is at most log ⁡ | P | . In Lean the latter bound comes from nonnegativity of relative entropy with respect to the uniform law. The joint law used here is the same law used by the prediction theorem. For injectively labelled Euclidean unit incidences, Lemma 2.3 proves the geometric premise from the edge equations themselves.

Inspect the Lean declarations

PlanarUnitDistances.euclidean_unit_graph_mutual_information

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [Nonempty P] [inst_2 : Fintype Q] [inst_3 : DecidableEq P]
  (point : P → OAI.PlanarUnitDistances.Plane) (center : Q → OAI.PlanarUnitDistances.Plane),
  Function.Injective point →
    Function.Injective center →
      ∀ (neighbors : Q → Finset P),
        (∀ (q : Q), ∀ i ∈ neighbors q, dist (point i) (center q) = 1) →
          ∀ {d : ℝ},
            0 < d →
              (∀ (q : Q), d ≤ ↑(neighbors q).card) →
                ∀ {e : ℝ},
                  0 < e →
                    ∑ q, ↑(neighbors q).card = e →
                      (∀ (i : P), ∃ q, i ∈ neighbors q) →
                        have κ := fun q => ↑(neighbors q).card / e;
                        have w := fun q i => if i ∈ neighbors q then (↑(neighbors q).card)⁻¹ else 0;
                        (OAI.PlanarUnitDistances.FiniteInformation.KL
                            (OAI.PlanarUnitDistances.FiniteInformation.wedge κ w) fun z =>
                            OAI.PlanarUnitDistances.FiniteInformation.marginal κ w z.1 *
                              OAI.PlanarUnitDistances.FiniteInformation.marginal κ w z.2) ≤
                          2 * Real.log ↑(Fintype.card P) - (1 - ↑(Fintype.card Q) / e) * Real.log (e * d / 2)
Lean source · PlanarUnitDistances/GeometricCodegree.lean, lines 49–65
/-- The two-edge information inequality for the Euclidean unit graph, with
centers sampled in proportion to degree and their neighbors uniformly and
independently. The asymptotic cardinality and degree bounds are separate inputs. -/
theorem euclidean_unit_graph_mutual_information {P Q : Type*} [Fintype P] [Nonempty P]
    [Fintype Q] [DecidableEq P] (point : P → Plane) (center : Q → Plane)
    (hp : Function.Injective point) (hc : Function.Injective center)
    (neighbors : Q → Finset P)
    (hunit : ∀ q i, i ∈ neighbors q → dist (point i) (center q) = 1)
    {d : ℝ} (hd : 0 < d) (hmin : ∀ q, d ≤ ((neighbors q).card : ℝ))
    {e : ℝ} (he : 0 < e) (hsum : ∑ q, ((neighbors q).card : ℝ) = e)
    (hpoint : ∀ i, ∃ q, i ∈ neighbors q) :
    let κ := fun q ↦ ((neighbors q).card : ℝ) / e
    let w := fun q i ↦ if i ∈ neighbors q then ((neighbors q).card : ℝ)⁻¹ else 0
    KL (wedge κ w) (fun z ↦ marginal κ w z.1 * marginal κ w z.2) ≤
      2 * Real.log (Fintype.card P) - (1 - (Fintype.card Q : ℝ)/e) * Real.log (e*d/2) :=
  graph_wedge_mutual_information_bound neighbors hd hmin
    (euclidean_unit_graph_codegree point center hp hc neighbors hunit) he hsum hpoint

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.graph_wedge_mutual_information_bound

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [Nonempty P] [inst_2 : Fintype Q] [inst_3 : DecidableEq P]
  (neighbors : Q → Finset P) {d : ℝ},
  0 < d →
    (∀ (q : Q), d ≤ ↑(neighbors q).card) →
      (∀ (i j : P), i ≠ j → {q | i ∈ neighbors q ∧ j ∈ neighbors q}.card ≤ 2) →
        ∀ {e : ℝ},
          0 < e →
            ∑ q, ↑(neighbors q).card = e →
              (∀ (i : P), ∃ q, i ∈ neighbors q) →
                have κ := fun q => ↑(neighbors q).card / e;
                have w := fun q i => if i ∈ neighbors q then (↑(neighbors q).card)⁻¹ else 0;
                (OAI.PlanarUnitDistances.FiniteInformation.KL
                    (OAI.PlanarUnitDistances.FiniteInformation.wedge κ w) fun z =>
                    OAI.PlanarUnitDistances.FiniteInformation.marginal κ w z.1 *
                      OAI.PlanarUnitDistances.FiniteInformation.marginal κ w z.2) ≤
                  2 * Real.log ↑(Fintype.card P) - (1 - ↑(Fintype.card Q) / e) * Real.log (e * d / 2)
Lean source · PlanarUnitDistances/IncidenceEntropy.lean, lines 102–164
/-- The entropy estimate directly on a finite bipartite graph. The parameter
`d` is a positive lower bound for the center degrees. The joint law here
is exactly center sampling proportional to degree followed by independent
uniform sampling on the two copies of its neighborhood. -/
theorem graph_wedge_mutual_information_bound {P Q : Type*} [Fintype P] [Nonempty P]
    [Fintype Q] [DecidableEq P] (neighbors : Q → Finset P) {d : ℝ} (hd : 0 < d)
    (hmin : ∀ q, d ≤ ((neighbors q).card : ℝ))
    (hcodeg : ∀ i j, i ≠ j →
      ((Finset.univ.filter fun q ↦ i ∈ neighbors q ∧ j ∈ neighbors q).card) ≤ 2)
    {e : ℝ} (he : 0 < e) (hsum : ∑ q, ((neighbors q).card : ℝ) = e)
    (hpoint : ∀ i, ∃ q, i ∈ neighbors q) :
    let κ := fun q ↦ ((neighbors q).card : ℝ) / e
    let w := fun q i ↦ if i ∈ neighbors q then ((neighbors q).card : ℝ)⁻¹ else 0
    KL (wedge κ w) (fun z ↦ marginal κ w z.1 * marginal κ w z.2) ≤
      2 * Real.log (Fintype.card P) - (1 - (Fintype.card Q : ℝ)/e) * Real.log (e*d/2) := by
  classical
  let n (q : Q) : ℝ := (neighbors q).card
  let κ (q : Q) := n q / e
  let w (q : Q) (i : P) := if i ∈ neighbors q then (n q)⁻¹ else 0
  change KL (wedge κ w) _ ≤ _
  have hn (q : Q) : 0 < n q := hd.trans_le (hmin q)
  have hκ (q : Q) : 0 < κ q := div_pos (hn q) he
  have hw (q : Q) (i : P) : 0 ≤ w q i := by
    dsimp [w]; split_ifs
    · exact (inv_pos.mpr (hn q)).le
    · exact le_rfl
  have hsκ : ∑ q, κ q = 1 := by
    dsimp [κ,n]; rw [← sum_div, hsum, div_self he.ne']
  have hsw (q : Q) : ∑ i, w q i = 1 := by
    simp [w]
    exact mul_inv_cancel₀ (hn q).ne'
  have hμ (i : P) : 0 < marginal κ w i := by
    obtain ⟨q,hq⟩ := hpoint i
    have hpos : 0 < κ q * w q i := by
      rw [show w q i = (n q)⁻¹ by simp [w,hq]]
      exact mul_pos (hκ q) (inv_pos.mpr (hn q))
    exact hpos.trans_le (single_le_sum (fun q _ ↦ mul_nonneg (hκ q).le (hw q i)) (mem_univ q))
  have hstep (q : Q) (i j : P) :
      κ q * w q i * w q j =
        if i ∈ neighbors q ∧ j ∈ neighbors q then (e*n q)⁻¹ else 0 := by
    by_cases hi : i ∈ neighbors q <;> by_cases hj : j ∈ neighbors q <;>
      simp [κ,w,hi,hj,(hn q).ne',div_eq_mul_inv,mul_inv_rev,mul_comm]
  have hdiag : (∑ i, wedge κ w (i,i)) = (Fintype.card Q : ℝ)/e := by
    simp only [wedge, hstep, and_self, sum_comm (s := univ (α := P)) (t := univ (α := Q))]
    have hf (q : Q) : (∑ i : P, if i ∈ neighbors q then (e * n q)⁻¹ else 0) = e⁻¹ := by
      simp
      change n q * ((n q)⁻¹ * e⁻¹) = e⁻¹
      rw [← mul_assoc, mul_inv_cancel₀ (hn q).ne', one_mul]
    simp only [hf]
    simp [div_eq_mul_inv]
  have hcap (i j : P) (hij : i ≠ j) : wedge κ w (i,j) ≤ (e*d/2)⁻¹ := by
    let common := univ.filter fun q ↦ i ∈ neighbors q ∧ j ∈ neighbors q
    have hcount : (common.card : ℝ) ≤ 2 := by exact_mod_cast hcodeg i j hij
    have hfit (q : Q) : (e*n q)⁻¹ ≤ (e*d)⁻¹ := inv_anti₀ (mul_pos he hd)
      (mul_le_mul_of_nonneg_left (hmin q) he.le)
    calc
      wedge κ w (i,j) = ∑ q ∈ common, (e*n q)⁻¹ := by simp [wedge,hstep,common,sum_filter]
      _ ≤ ∑ _q ∈ common, (e*d)⁻¹ := sum_le_sum fun q _ ↦ hfit q
      _ ≤ 2 * (e*d)⁻¹ := by simp; gcongr
      _ = (e*d/2)⁻¹ := by field_simp
  have h := wedge_mutual_information_bound κ w (fun q ↦ (hκ q).le) hw hsκ hsw hμ
    (by positivity : 0 < e*d/2) hcap
  rwa [hdiag] at h

Kernel axioms used: propext, Classical.choice, Quot.sound.

Proposition 2.14 All incidence estimates on a single graph

Lean verified

Fix g > 0 with a = 10000 g ≤ 1 / 10 . For all sufficiently large t = n 1 / 3 , a configuration of n distinct planar points with at least t 4 − g ordered unit pairs yields finite real algebraic point and center sets and a simple unit-incidence graph E ⊆ P × Q satisfying

t 1 + 2 a − 173 g ≤ | P | ≤ 2 t 1 + 2 a , | Q | ≤ t 2 + a , | E | ≥ t 2 + 2 a − 90 g , ( γ / 2 ) t 1 − 90 g ≤ d P ≤ t 1 + 10 g , γ t a − 90 g ≤ d Q ≤ t a + 10 g .

The uniform edge law has marginals μ , κ with μ ( p ) ≥ γ / | P | , κ ( q ) ≥ γ / | Q | and max p μ ( p ) ≤ t − 1 − 2 a + 100 g ≤ t − 1 . The edge mass between any two subsets of counting fractions u , v obeys w ≤ u v ( ( u v ) 1 / 25 + ξ ) for some ξ ≤ t − 150 g . For the two-edge walk of Proposition 2.13, D = I ( p ; r ) satisfies D + 1 ≤ 10200 g log ⁡ t .

Proof

Restrict the trimmed graph to the maximizing rectangle. For example | P | ≥ t 1 + 2 a − 13 g t − 160 g and | E | ≥ t 2 + 2 a − 3 g t − 87 g . Obtain minimum degrees from the marginal lower bounds. The diagonal probability is at most t − a + 90 g , which tends to zero polynomially for fixed g . In the entropy bound, 2 log ⁡ | P | − log ⁡ ( | E | d ∗ / 2 ) ≤ ( a + 180 g ) log ⁡ t + O ( 1 ) . Since a + 180 g = 10180 g , the remaining 20 g log ⁡ t absorbs the fixed errors and the extra 1 for sufficiently large t . More precisely, Lean uses | Q | / | E | ≤ g eventually and bounds log ⁡ ( ( 27 / 100 ) t 2 + 3 a − 180 g ) between 0 and 3 log ⁡ t . This costs at most 3 g log ⁡ t in the diagonal term and leaves 17 g log ⁡ t for the constant terms. The marginal in the two-stage law equals d P ( p ) / | E | by direct summation over the centers.

The checked optimizer also gives a direct bound on its own error term. It has coefficient T U V / W ≤ t 20 g + 32 g / 5 . Since U , V ≥ t − 160 g , its parenthesis is at most 3 t ( − a / 8 + 160 g ) / 6 , including the two square-root terms. The product is at most 3 t − 155 g ≤ t − 150 g eventually. Thus one may choose ξ = t − 150 g for every pair of subsets of the same extracted vertex sets. The real-algebraic output follows by first preserving all original unit pairs in Lemma 2.4, then taking subsets.

Inspect the Lean declarations

PlanarUnitDistances.algebraic_incidence_piece

∀ {g : ℝ},
  0 < g →
    10000 * g ≤ 1 / 10 →
      have a := 10000 * g;
      ∀ᶠ (t : ℝ) in Filter.atTop,
        ∀ (X : Finset OAI.PlanarUnitDistances.Plane),
          ↑X.card = t ^ 3 →
            t ^ (4 - g) ≤ ↑(PlanarUnitDistances.orderedPairs X).card →
              ∃ P Q,
                (∀ p ∈ P, ∀ (i : Fin 2), IsAlgebraic ℚ (p.ofLp i)) ∧
                  (∀ q ∈ Q, ∀ (i : Fin 2), IsAlgebraic ℚ (q.ofLp i)) ∧
                    t ^ (1 + 2 * a - 173 * g) ≤ ↑P.card ∧
                      ↑P.card ≤ 2 * t ^ (1 + 2 * a) ∧
                        ↑Q.card ≤ t ^ (2 + a) ∧
                          t ^ (2 + 2 * a - 90 * g) ≤ OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ∧
                            (∀ p ∈ P,
                                27 / 100 * t ^ (1 - 90 * g) ≤
                                    OAI.PlanarUnitDistances.CircleIncidence.degree Q p ∧
                                  OAI.PlanarUnitDistances.CircleIncidence.degree Q p ≤ t ^ (1 + 10 * g) ∧
                                    27 / 50 / ↑P.card ≤
                                        OAI.PlanarUnitDistances.CircleIncidence.degree Q p /
                                          OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ∧
                                      OAI.PlanarUnitDistances.CircleIncidence.degree Q p /
                                          OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ≤
                                        t ^ (-1 - 2 * a + 100 * g)) ∧
                              t ^ (-1 - 2 * a + 100 * g) ≤ t ^ (-1) ∧
                                (∀ q ∈ Q,
                                    27 / 50 * t ^ (a - 90 * g) ≤
                                        OAI.PlanarUnitDistances.CircleIncidence.degree P q ∧
                                      OAI.PlanarUnitDistances.CircleIncidence.degree P q ≤ t ^ (a + 10 * g) ∧
                                        27 / 50 / ↑Q.card ≤
                                          OAI.PlanarUnitDistances.CircleIncidence.degree P q /
                                            OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) ∧
                                  (∀ A ⊆ P,
                                      ∀ B ⊆ Q,
                                        have z := ↑A.card / ↑P.card * (↑B.card / ↑Q.card);
                                        OAI.PlanarUnitDistances.CircleIncidence.incidences A B /
                                            OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ≤
                                          √z * (z ^ (1 / 25) + t ^ (-150 * g))) ∧
                                    PlanarUnitDistances.unitWalkInformation P Q + 1 ≤ 10200 * g * Real.log t
Lean source · PlanarUnitDistances/IncidencePiece.lean, lines 69–96
/-- The unrestricted real-input and real-algebraic-output version of cb:finite-piece. -/
theorem algebraic_incidence_piece {g : ℝ} (hg : 0<g) (ha1 : 10000*g≤1/10) :
    let a := 10000*g
    ∀ᶠ t : ℝ in atTop, ∀ X : Finset Plane, (X.card:ℝ)=t^3 →
      t^(4-g) ≤ ((orderedPairs X).card:ℝ) →
      ∃ P Q : Finset Plane,
        (∀ p ∈ P, ∀ i, IsAlgebraic ℚ (p i)) ∧ (∀ q ∈ Q, ∀ i, IsAlgebraic ℚ (q i)) ∧
        t^(1+2*a-173*g) ≤ (P.card:ℝ) ∧ (P.card:ℝ) ≤ 2*t^(1+2*a) ∧
        (Q.card:ℝ) ≤ t^(2+a) ∧ t^(2+2*a-90*g) ≤ incidences P Q ∧
        (∀ p ∈ P, (27/100:ℝ)*t^(1-90*g) ≤ degree Q p ∧ degree Q p ≤ t^(1+10*g) ∧
          (27/50:ℝ)/P.card ≤ degree Q p/incidences P Q ∧
          degree Q p/incidences P Q ≤ t^(-1-2*a+100*g)) ∧
        t^(-1-2*a+100*g) ≤ t^(-1:ℝ) ∧
        (∀ q ∈ Q, (27/50:ℝ)*t^(a-90*g) ≤ degree P q ∧ degree P q ≤ t^(a+10*g) ∧
          (27/50:ℝ)/Q.card ≤ degree P q/incidences P Q) ∧
        (∀ A ⊆ P, ∀ B ⊆ Q,
          let z := (A.card:ℝ)/P.card*((B.card:ℝ)/Q.card)
          incidences A B/incidences P Q ≤ Real.sqrt z*(z^(1/25:ℝ)+t^(-150*g))) ∧
        unitWalkInformation P Q+1 ≤ 10200*g*Real.log t := by
  filter_upwards [fixed_incidence_piece hg ha1] with t hpiece
  intro X hc hXdense
  obtain ⟨Y,hcard,hXY,hAlg⟩ := algebraic_set_specialization X
  have hdense : t^(4-g) ≤ ((orderedPairs Y).card:ℝ) := by
    apply hXdense.trans
    exact_mod_cast (by rw [orderedPairs_card,orderedPairs_card]; omega :
      (orderedPairs X).card ≤ (orderedPairs Y).card)
  obtain ⟨P,hP,Q,hQ,hpiece⟩ := hpiece Y (by rwa [hcard]) hdense
  exact ⟨P,Q,fun p hp => hAlg p (hP hp),fun q hq => hAlg q (hQ hq),hpiece⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.fixed_incidence_piece

∀ {g : ℝ},
  0 < g →
    10000 * g ≤ 1 / 10 →
      have a := 10000 * g;
      ∀ᶠ (t : ℝ) in Filter.atTop,
        ∀ (X : Finset OAI.PlanarUnitDistances.Plane),
          ↑X.card = t ^ 3 →
            t ^ (4 - g) ≤ ↑(PlanarUnitDistances.orderedPairs X).card →
              ∃ P ⊆ X,
                ∃ Q ⊆ X,
                  t ^ (1 + 2 * a - 173 * g) ≤ ↑P.card ∧
                    ↑P.card ≤ 2 * t ^ (1 + 2 * a) ∧
                      ↑Q.card ≤ t ^ (2 + a) ∧
                        t ^ (2 + 2 * a - 90 * g) ≤ OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ∧
                          (∀ p ∈ P,
                              27 / 100 * t ^ (1 - 90 * g) ≤
                                  OAI.PlanarUnitDistances.CircleIncidence.degree Q p ∧
                                OAI.PlanarUnitDistances.CircleIncidence.degree Q p ≤ t ^ (1 + 10 * g) ∧
                                  27 / 50 / ↑P.card ≤
                                      OAI.PlanarUnitDistances.CircleIncidence.degree Q p /
                                        OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ∧
                                    OAI.PlanarUnitDistances.CircleIncidence.degree Q p /
                                        OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ≤
                                      t ^ (-1 - 2 * a + 100 * g)) ∧
                            t ^ (-1 - 2 * a + 100 * g) ≤ t ^ (-1) ∧
                              (∀ q ∈ Q,
                                  27 / 50 * t ^ (a - 90 * g) ≤
                                      OAI.PlanarUnitDistances.CircleIncidence.degree P q ∧
                                    OAI.PlanarUnitDistances.CircleIncidence.degree P q ≤ t ^ (a + 10 * g) ∧
                                      27 / 50 / ↑Q.card ≤
                                        OAI.PlanarUnitDistances.CircleIncidence.degree P q /
                                          OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) ∧
                                (∀ A ⊆ P,
                                    ∀ B ⊆ Q,
                                      have z := ↑A.card / ↑P.card * (↑B.card / ↑Q.card);
                                      OAI.PlanarUnitDistances.CircleIncidence.incidences A B /
                                          OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ≤
                                        √z * (z ^ (1 / 25) + t ^ (-150 * g))) ∧
                                  PlanarUnitDistances.unitWalkInformation P Q + 1 ≤ 10200 * g * Real.log t
Lean source · PlanarUnitDistances/IncidencePiece.lean, lines 7–66
/-- Proposition cb:finite-piece on the actual Euclidean uniform unit-edge law.
P and Q are both subsets of the same specialized input. The information,
expansion, and individual degrees/marginals all concern these same two sets. -/
theorem fixed_incidence_piece {g : ℝ} (hg : 0<g) (ha1 : 10000*g≤1/10) :
    let a := 10000*g
    ∀ᶠ t : ℝ in atTop, ∀ X : Finset Plane, (X.card:ℝ)=t^3 →
      t^(4-g) ≤ ((orderedPairs X).card:ℝ) →
      ∃ P ⊆ X, ∃ Q ⊆ X,
        t^(1+2*a-173*g) ≤ (P.card:ℝ) ∧ (P.card:ℝ) ≤ 2*t^(1+2*a) ∧
        (Q.card:ℝ) ≤ t^(2+a) ∧ t^(2+2*a-90*g) ≤ incidences P Q ∧
        (∀ p ∈ P, (27/100:ℝ)*t^(1-90*g) ≤ degree Q p ∧ degree Q p ≤ t^(1+10*g) ∧
          (27/50:ℝ)/P.card ≤ degree Q p/incidences P Q ∧
          degree Q p/incidences P Q ≤ t^(-1-2*a+100*g)) ∧
        t^(-1-2*a+100*g) ≤ t^(-1:ℝ) ∧
        (∀ q ∈ Q, (27/50:ℝ)*t^(a-90*g) ≤ degree P q ∧ degree P q ≤ t^(a+10*g) ∧
          (27/50:ℝ)/Q.card ≤ degree P q/incidences P Q) ∧
        (∀ A ⊆ P, ∀ B ⊆ Q,
          let z := (A.card:ℝ)/P.card*((B.card:ℝ)/Q.card)
          incidences A B/incidences P Q ≤ Real.sqrt z*(z^(1/25:ℝ)+t^(-150*g))) ∧
        unitWalkInformation P Q+1 ≤ 10200*g*Real.log t := by
  let a := 10000*g
  filter_upwards [fixed_winning_graph hg ha1,fixed_information_bound hg ha1,
    eventually_ge_atTop (1:ℝ)] with t hwin hbudget ht
  have ht0 := zero_lt_one.trans_le ht
  intro X hcard hdense
  obtain ⟨P,hPX,Q,hQX,hm,hm',hn,he,hp,hq,hexp⟩ := hwin X hcard hdense
  have hm0 : 0<(P.card:ℝ) := (Real.rpow_pos_of_pos ht0 _).trans_le hm
  have he0 : 0 < incidences P Q := (Real.rpow_pos_of_pos ht0 _).trans_le he
  have hn0 : 0<(Q.card:ℝ) := pos_of_mul_pos_right
    (he0.trans_le (incidences_le P Q)) (Nat.cast_nonneg _)
  have low (k x b c : ℝ) (hk : 0<k) (hcap : k≤c*t^b) (hc : 0<c)
      (hx : (27/50:ℝ)/k ≤ x/incidences P Q) :
      ((27/50:ℝ)/c)*t^(2+2*a-90*g-b) ≤ x := by
    have hmult := (le_div_iff₀ he0).mp hx
    have hden := div_le_div_of_nonneg_left (by norm_num : 0≤(27/50:ℝ)) hk hcap
    have hboth := mul_le_mul hden he (Real.rpow_nonneg ht0.le _) (div_nonneg (by norm_num) hk.le)
    apply le_trans _ (hboth.trans hmult)
    dsimp only [a]
    rw [Real.rpow_sub ht0]
    field_simp [(Real.rpow_pos_of_pos ht0 b).ne',hc.ne']
    ring_nf
    exact le_rfl
  have lowP (p : Plane) (hpP : p∈P) : (27/100:ℝ)*t^(1-90*g)≤degree Q p := by
    have hh := low _ _ (1+2*a) 2 hm0 hm' (by norm_num) (hp p hpP).2
    simpa only [show (27/50:ℝ)/2=27/100 by norm_num,show 2+2*a-90*g-(1+2*a)=1-90*g by ring] using hh
  have lowQ (q : Plane) (hqQ : q∈Q) : (27/50:ℝ)*t^(a-90*g)≤degree P q := by
    have hh := low _ _ (2+a) 1 hn0 (by simpa only [one_mul] using hn) (by norm_num) (hq q hqQ).2
    simpa only [div_one,show 2+2*a-90*g-(2+a)=a-90*g by ring] using hh
  have upperP (p : Plane) (hpP : p∈P) : degree Q p/incidences P Q ≤ t^(-1-2*a+100*g) := by
    have hh := div_le_div₀ (Real.rpow_nonneg ht0.le _) (hp p hpP).1 (Real.rpow_pos_of_pos ht0 _) he
    rw [←Real.rpow_sub ht0] at hh
    exact hh.trans_eq (congrArg (fun x : ℝ => t^x) (by dsimp [a]; ring))
  have hinfo := unitWalkInformation_bound P Q (Finset.card_pos.mp (Nat.cast_pos.mp hm0))
    (d:=(27/50:ℝ)*t^(a-90*g)) (by positivity) he0 lowQ
    (fun p hpP => (show 0<(27/100:ℝ)*t^(1-90*g) by positivity).trans_le (lowP p hpP))
  refine ⟨P,hPX,Q,hQX,hm,hm',hn,he,?_,?_,?_,hexp,?_⟩
  · exact fun p hpP => ⟨lowP p hpP,(hp p hpP).1,(hp p hpP).2,upperP p hpP⟩
  · apply Real.rpow_le_rpow_of_exponent_le ht; linarith
  · exact fun q hqQ => ⟨lowQ q hqQ,(hq q hqQ).1,(hq q hqQ).2⟩
  · exact hbudget hm0 (Nat.cast_nonneg _) hm' hn he hinfo

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.unitWalk_marginal_eq_degree

∀ (P Q : Finset OAI.PlanarUnitDistances.Plane) (p : ↥P),
  OAI.PlanarUnitDistances.FiniteInformation.marginal (PlanarUnitDistances.unitCenterLaw P Q)
      (fun q => PlanarUnitDistances.unitNeighborLaw P ↑q) p =
    OAI.PlanarUnitDistances.CircleIncidence.degree Q ↑p /
      OAI.PlanarUnitDistances.CircleIncidence.incidences P Q
Lean source · PlanarUnitDistances/WalkBudget.lean, lines 54–74
/-- The marginal of the explicit two-stage law is the uniform-edge degree marginal. -/
theorem unitWalk_marginal_eq_degree (P Q : Finset Plane) (p : P) :
    marginal (unitCenterLaw P Q) (fun q : Q => unitNeighborLaw P q) p =
      degree Q p/incidences P Q := by
  unfold marginal
  have hterm (q : Q) : unitCenterLaw P Q q * unitNeighborLaw P q p =
      (if dist (p:Plane) (q:Plane)=1 then (1:ℝ) else 0)/incidences P Q := by
    by_cases h : dist (p:Plane) (q:Plane)=1
    · have hm : p ∈ unitNeighbors P q := Finset.mem_filter.mpr ⟨Finset.mem_univ _,h⟩
      have hd := (Nat.cast_pos.mpr (Finset.card_pos.mpr ⟨p,hm⟩) :
        0 < ((unitNeighbors P q).card:ℝ))
      rw [unitNeighbors_card] at hd
      simp only [unitCenterLaw,unitNeighborLaw,if_pos hm,if_pos h,div_eq_mul_inv]
      field_simp [hd.ne']
    · have hm : p ∉ unitNeighbors P q := fun hp => h (Finset.mem_filter.mp hp).2
      simp [unitNeighborLaw,hm,h]
  simp only [hterm,← Finset.sum_div,degree_sum]
  congr 1
  rw [show (Finset.univ : Finset Q) = Q.attach by ext; simp]
  simpa only [dist_comm (p:Plane)] using
    Finset.sum_attach Q (fun q => if dist (p:Plane) q=1 then (1:ℝ) else 0)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.winning_error_bound

∀ {g : ℝ},
  0 < g →
    10000 * g ≤ 1 / 10 →
      have a := 10000 * g;
      ∀ᶠ (t : ℝ) in Filter.atTop,
        ∀ {U V W T : ℝ},
          0 ≤ T →
            T ≤ t ^ (20 * g) →
              t ^ (-160 * g) ≤ U →
                t ^ (-160 * g) ≤ V →
                  t ^ (-160 * g) ≤ U * V →
                    (U * V) ^ (27 / 50) ≤ W →
                      T * √(U * V) / W * ((t ^ (-a / 8) / min U V) ^ (1 / 6) + (√(t ^ (-a)) + √(t ^ (-1)))) ≤
                        t ^ (-150 * g)
Lean source · PlanarUnitDistances/WinningError.lean, lines 6–53
theorem winning_error_bound {g : ℝ} (hg : 0<g) (ha1 : 10000*g≤1/10) :
    let a := 10000*g
    ∀ᶠ t : ℝ in atTop, ∀ {U V W T : ℝ},
      0≤T → T≤t^(20*g) → t^(-160*g)≤U → t^(-160*g)≤V →
      t^(-160*g)≤U*V → (U*V)^(27/50:ℝ)≤W →
      (T*Real.sqrt (U*V)/W)*((t^(-a/8)/min U V)^(1/6:ℝ)+
        (Real.sqrt (t^(-a))+Real.sqrt (t^(-1:ℝ)))) ≤ t^(-150*g) := by
  let a := 10000*g
  filter_upwards [(tendsto_rpow_atTop (show 0<5*g by linarith)).eventually_ge_atTop (3:ℝ),
    eventually_ge_atTop (1:ℝ)] with t h3 ht
  have ht0 := zero_lt_one.trans_le ht
  intro U V W T hT0 hT hU hV hUV hW
  have hlow := Real.rpow_pos_of_pos ht0 (-160*g)
  have hz := hlow.trans_le hUV
  have hw := (Real.rpow_pos_of_pos hz _).trans_le hW
  have hbase : Real.sqrt (U*V)/W ≤ t^(32*g/5) := by
    calc
      _ ≤ Real.sqrt (U*V)/(U*V)^(27/50:ℝ) :=
        div_le_div_of_nonneg_left (Real.sqrt_nonneg _) (Real.rpow_pos_of_pos hz _) hW
      _ = (U*V)^(-(1/25:ℝ)) := by rw [Real.sqrt_eq_rpow,← Real.rpow_sub hz]; norm_num
      _ ≤ (t^(-160*g))^(-(1/25:ℝ)) := Real.rpow_le_rpow_of_nonpos hlow hUV (by norm_num)
      _ = t^(32*g/5) := by rw [←Real.rpow_mul ht0.le]; congr 1; ring
  have hcoef : T*Real.sqrt (U*V)/W ≤ t^(20*g+32*g/5) := by
    rw [mul_div_assoc,Real.rpow_add ht0]
    exact mul_le_mul hT hbase (div_nonneg (Real.sqrt_nonneg _) hw.le) (by positivity)
  have hsmall : (t^(-a/8)/min U V)^(1/6:ℝ) ≤ t^((-a/8+160*g)/6) := by
    have hh := div_le_div_of_nonneg_left (Real.rpow_nonneg ht0.le (-a/8)) hlow (le_min hU hV)
    have hh' := Real.rpow_le_rpow (div_nonneg (Real.rpow_nonneg ht0.le _) (hlow.trans_le (le_min hU hV)).le)
      hh (by norm_num : 0≤(1/6:ℝ))
    rw [←Real.rpow_sub ht0,←Real.rpow_mul ht0.le] at hh'
    exact hh'.trans_eq (congrArg (fun x : ℝ => t^x) (by ring))
  have hS (b : ℝ) : Real.sqrt (t^b) = t^(b/2) := by
    rw [Real.sqrt_eq_rpow,←Real.rpow_mul ht0.le]; congr 1; ring
  have hSa : Real.sqrt (t^(-a)) ≤ t^((-a/8+160*g)/6) := by
    rw [hS]; apply Real.rpow_le_rpow_of_exponent_le ht; dsimp [a]; linarith
  have hS1 : Real.sqrt (t^(-1:ℝ)) ≤ t^((-a/8+160*g)/6) := by
    rw [hS]; apply Real.rpow_le_rpow_of_exponent_le ht; dsimp [a]; linarith
  have hsPos : 0≤(t^(-a/8)/min U V)^(1/6:ℝ) :=
    Real.rpow_nonneg (div_nonneg (Real.rpow_nonneg ht0.le _) (hlow.trans_le (le_min hU hV)).le) _
  have hsum : (t^(-a/8)/min U V)^(1/6:ℝ)+(Real.sqrt (t^(-a))+Real.sqrt (t^(-1:ℝ))) ≤
      3*t^((-a/8+160*g)/6) := by linarith
  have hh := mul_le_mul hcoef hsum (by positivity) (Real.rpow_nonneg ht0.le _)
  apply hh.trans
  calc
    _ = 3*t^(20*g+32*g/5+(-a/8+160*g)/6) := by rw [Real.rpow_add ht0 (20*g+32*g/5) ((-a/8+160*g)/6)]; ring
    _ ≤ 3*t^(-155*g) := by apply mul_le_mul_of_nonneg_left _ (by norm_num); apply Real.rpow_le_rpow_of_exponent_le ht; dsimp [a]; linarith
    _ ≤ t^(5*g)*t^(-155*g) := mul_le_mul_of_nonneg_right h3 (by positivity)
    _ = t^(-150*g) := by rw [←Real.rpow_add ht0]; congr 1; ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.fixed_information_bound

∀ {g : ℝ},
  0 < g →
    10000 * g ≤ 1 / 10 →
      have a := 10000 * g;
      ∀ᶠ (t : ℝ) in Filter.atTop,
        ∀ {m n e D : ℝ},
          0 < m →
            0 ≤ n →
              m ≤ 2 * t ^ (1 + 2 * a) →
                n ≤ t ^ (2 + a) →
                  t ^ (2 + 2 * a - 90 * g) ≤ e →
                    D ≤ 2 * Real.log m - (1 - n / e) * Real.log (e * (27 / 50 * t ^ (a - 90 * g)) / 2) →
                      D + 1 ≤ 10200 * g * Real.log t
Lean source · PlanarUnitDistances/WalkBudget.lean, lines 76–135
/-- Fixed-exponent information budget with the exact diagonal correction retained. -/
theorem fixed_information_bound {g : ℝ} (hg : 0<g) (ha1 : 10000*g ≤ 1/10) :
    let a := 10000*g
    ∀ᶠ t : ℝ in atTop, ∀ {m n e D : ℝ}, 0 < m → 0 ≤ n →
      m≤2*t^(1+2*a) → n≤t^(2+a) → t^(2+2*a-90*g)≤e →
      D ≤ 2*Real.log m-(1-n/e)*Real.log (e*((27/50:ℝ)*t^(a-90*g))/2) →
      D+1 ≤ 10200*g*Real.log t := by
  let a := 10000*g
  let v := 2+3*a-180*g
  let c : ℝ := 27/100
  have hv : 0<v := by dsimp [v,a]; linarith
  have hv3 : v≤3 := by dsimp [v,a]; linarith
  have hc : 0<c := by norm_num [c]
  have hneg : -(a-90*g)<0 := by dsimp [a]; linarith
  have hdiag := (tendsto_rpow_neg_atTop (neg_pos.mpr hneg)).eventually_le_const
    (show (0:ℝ)<g by exact hg)
  have hlog := Real.tendsto_log_atTop.eventually_ge_atTop ((2*Real.log 2-Real.log c+1)/(17*g))
  have hK := (tendsto_rpow_atTop hv).eventually_ge_atTop c⁻¹
  filter_upwards [hdiag,hlog,hK,eventually_ge_atTop (1:ℝ)] with t hdiag hlog hK ht
  have ht0 := zero_lt_one.trans_le ht
  have hlog0 := Real.log_nonneg ht
  have hd := Real.rpow_pos_of_pos ht0 (a-90*g)
  intro m n e D hm hn hm' hn' he hD
  have he0 := (Real.rpow_pos_of_pos ht0 _).trans_le he
  have hoff := div_le_div₀ (Real.rpow_nonneg ht0.le _) hn' (Real.rpow_pos_of_pos ht0 _) he
  rw [←Real.rpow_sub ht0] at hoff
  have hx : 2+a-(2+2*a-90*g) = -(a-90*g) := by ring
  have hdiag' : t^(-(a-90*g))≤g := by simpa only [neg_neg] using hdiag
  change t^(2+2*a-90*g)≤e at he
  change n≤t^(2+a) at hn'
  change n/e≤t^(2+a-(2+2*a-90*g)) at hoff
  rw [hx] at hoff
  have hprob := hoff.trans hdiag'
  have hprob1 : n/e≤1 := by dsimp [a] at *; linarith
  have hprob0 := div_nonneg hn he0.le
  have hlm := Real.log_le_log hm hm'
  rw [Real.log_mul (by norm_num) (Real.rpow_pos_of_pos ht0 _).ne',Real.log_rpow ht0] at hlm
  have hscale : c*t^v ≤ e*((27/50:ℝ)*t^(a-90*g))/2 := by
    have hh := mul_le_mul_of_nonneg_right he hd.le
    rw [←Real.rpow_add ht0] at hh
    have hvv : 2+2*a-90*g+(a-90*g)=v := by dsimp [v]; ring
    rw [hvv] at hh
    dsimp [c]; linarith
  have hclog := Real.log_le_log (mul_pos hc (Real.rpow_pos_of_pos ht0 _)) hscale
  rw [Real.log_mul hc.ne' (Real.rpow_pos_of_pos ht0 _).ne',Real.log_rpow ht0] at hclog
  have hcl0 : 0 ≤ Real.log c + v*Real.log t := by
    rw [←Real.log_rpow ht0,←Real.log_mul hc.ne' (Real.rpow_pos_of_pos ht0 _).ne']
    apply Real.log_nonneg
    have h := mul_le_mul_of_nonneg_left hK hc.le
    rwa [mul_inv_cancel₀ hc.ne'] at h
  have hclUpper : Real.log c+v*Real.log t ≤ 3*Real.log t := by
    have hc1 : c≤1 := by norm_num [c]
    linarith [Real.log_nonpos hc.le hc1,mul_le_mul_of_nonneg_right hv3 hlog0]
  have hcorr := mul_le_mul hprob hclUpper hcl0 hg.le
  have hcst := (div_le_iff₀ (show 0<17*g by linarith)).mp hlog
  have hretain := mul_le_mul_of_nonneg_left hclog (sub_nonneg.mpr hprob1)
  change D ≤ 2*Real.log m-(1-n/e)*Real.log (e*((27/50:ℝ)*t^(a-90*g))/2) at hD
  change Real.log m≤Real.log 2+(1+2*a)*Real.log t at hlm
  dsimp [v,a] at hcorr hretain hlm
  nlinarith only [hD,hretain,hlm,hcorr,hcst]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 2.15 The ceiling at the limiting exponent

Lean verified

Suppose D ≥ 0 and D + 1 ≤ 30600 Δ log ⁡ t . For K = ⌈ A ( D + 1 ) ⌉ , we have ( K − 1 ) log ⁡ M < log ⁡ t .

Proof

The ceiling gives K − 1 < A ( D + 1 ) . Multiply by log ⁡ M > 0 and use 30600 Δ A log ⁡ M = 1 . In the theorem’s application g = 3 Δ , so the information bound of Proposition 2.14 has exactly the required coefficient. With θ ≤ t − 1 − 19900 g this yields the posterior collision estimate M K − 1 θ ≤ t − 19900 g . The Lean declaration of this lemma ends with the strict logarithmic inequality.

Inspect the Lean declarations

PlanarUnitDistances.smallHeight_history_log_lt

∀ {D t : ℝ},
  0 ≤ D →
    D + 1 ≤ 30600 * PlanarUnitDistances.exactGap * Real.log t →
      have A := (7200 * ↑PlanarUnitDistances.N0) ^ 4;
      have M := 1 + ↑PlanarUnitDistances.N0 ^ 4;
      have K := ⌈A * (D + 1)⌉₊;
      (↑K - 1) * Real.log M < Real.log t
Lean source · PlanarUnitDistances/Constants.lean, lines 109–130
/-- Endpoint in equation (K−1) log M < log t. The natural ceiling models the
number of samples; subtracting one after casting keeps the strict inequality. -/
theorem smallHeight_history_log_lt {D t : ℝ} (hD : 0 ≤ D)
    (hMI : D + 1 ≤ 30600 * exactGap * Real.log t) :
    let A := (7200 * (N0 : ℝ)) ^ 4
    let M := 1 + (N0 : ℝ) ^ 4
    let K := ⌈A * (D + 1)⌉₊
    ((K : ℝ) - 1) * Real.log M < Real.log t := by
  dsimp only
  let A : ℝ := (7200 * (N0 : ℝ)) ^ 4
  let M : ℝ := 1 + (N0 : ℝ) ^ 4
  have hN : 0 < (N0 : ℝ) := by linarith [N0_large]
  have hA : 0 < A := by dsimp [A]; positivity
  have hM : 0 < Real.log M := by dsimp [M]; linarith [logM_gt_one]
  have hceil := Nat.ceil_lt_add_one (show 0 ≤ A * (D + 1) by positivity)
  change ((⌈A * (D + 1)⌉₊ : ℝ) - 1) * Real.log M < Real.log t
  calc
    _ < A * (D + 1) * Real.log M := by gcongr; linarith
    _ ≤ A * (30600 * exactGap * Real.log t) * Real.log M := by gcongr
    _ = (30600 * exactGap * A * Real.log M) * Real.log t := by ring
    _ = Real.log t := by rw [show 30600 * exactGap * A * Real.log M = 1
      from exactGap_normalization, one_mul]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 2.16 All ordered lists of the chosen history length

Lean verified

Let k = 2 18000 , L = 2 144000 , and D = I ( P 1 ; P 2 ) for the two-edge walk. Put K = ⌈ 2 576000 ( D + 1 ) ⌉ . For every original large piece at sufficiently large t , and every 0 ≤ n < K , let T n consist of all ordered lists of k histories of length n , each observation having two colors in { 1 , … , L } . Then | T n | ≤ t 1 / 4 , and every point p ∈ P satisfies | T n | / d ( p ) ≤ 2 − 144000 = k − 8 .

Proof

There are ( L 2 ) n histories and ( ( L 2 ) n ) k lists, including lists with repetitions. The strict inequality n < K gives n < 2 576000 ( D + 1 ) directly, even when the expression on the right is integral. The incidence piece gives D + 1 ≤ 30600 Δ log ⁡ t . Using log ⁡ 2 ≤ 1 therefore yields

log ⁡ | T n | ≤ ( 2 594000 Δ ) ( 30600 ⋅ 288000 ) log ⁡ t ≤ 30600 ⋅ 288000 2 36 log ⁡ t ≤ 1 4 log ⁡ t .

Also 1 − 90 g ≥ 3 / 4 at the stated saving, so d ( p ) ≥ ( 27 / 100 ) t 3 / 4 . The ratio is at most ( 100 / 27 ) t − 1 / 2 , uniformly in the field, graph, point, and choice of the history length.

Inspect the Lean declarations

PlanarUnitDistances.ComparisonConstants.eventual_full_list_collision

∀ᶠ (t : ℝ) in Filter.atTop,
  ∀ (P Q : Finset OAI.PlanarUnitDistances.Plane) (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q),
    PlanarUnitDistances.ProofAssembly.LargePiece t P Q M →
      ∀
        n <
          PlanarUnitDistances.ComparisonConstants.historyDepth (PlanarUnitDistances.unitWalkInformation P Q),
        ↑(Fintype.card (PlanarUnitDistances.ComparisonConstants.FullList n)) ≤ t ^ (1 / 4) ∧
          ∀ p ∈ P,
            ↑(Fintype.card (PlanarUnitDistances.ComparisonConstants.FullList n)) /
                OAI.PlanarUnitDistances.CircleIncidence.degree Q p ≤
              PlanarUnitDistances.ComparisonConstants.dy 144000
Lean source · PlanarUnitDistances/FullHistoryLists.lean, lines 56–84
/-- At every point in the original incidence piece, the list-type factor
in the collision term divided by its actual degree is at most k^{-8}. -/
theorem eventual_full_list_collision :
    ∀ᶠt : ℝ in atTop, ∀(P Q : Finset Plane) (M : CommonFieldModel.Model P Q),
      ProofAssembly.LargePiece t P Q M → ∀n<historyDepth (unitWalkInformation P Q),
      (Fintype.card (FullList n):ℝ)≤t^(1/4:ℝ) ∧
      ∀p∈P,(Fintype.card (FullList n):ℝ)/degree Q p≤dy 144000 := by
  have hl := exactGap_lt_largeHeightGap.trans_le (Real.rpow_le_rpow_of_exponent_le
    (by norm_num : (1:ℝ)≤2) (by norm_num : -(594036:ℝ)≤ -32))
  have power : (3/4:ℝ) ≤ 1-90*(3*exactGap) := by norm_num [Real.rpow_neg] at hl; linarith
  have small := (tendsto_rpow_neg_atTop (by norm_num : (0:ℝ)<1/2)).eventually
    (eventually_le_nhds (mul_pos (by norm_num : (0:ℝ)<27/100) (pos 144000)))
  filter_upwards [eventually_ge_atTop (1:ℝ),small] with t ht hs
  intro P Q M piece n hn
  obtain ⟨_,_,_,_,_,deg,_,_,_,info,_⟩ := piece
  have ip : unitWalkInformation P Q+1≤30600*exactGap*log t := by convert info using 1 <;> ring
  have cap := full_list_card ht ip hn
  refine ⟨cap,?_⟩
  intro p hp
  have ht' : 0<t := zero_lt_one.trans_le ht
  have ppos : 0<degree Q p := (mul_pos (by norm_num) (Real.rpow_pos_of_pos ht' _)).trans_le (deg p hp).1
  apply (div_le_iff₀ ppos).mpr
  calc
    _ ≤ t^(1/4:ℝ) := cap
    _ = t^(3/4:ℝ)*t^(-(1/2):ℝ) := by rw [←Real.rpow_add ht']; norm_num
    _ ≤ t^(1-90*(3*exactGap))*((27/100)*dy 144000) :=
      mul_le_mul (rpow_le_rpow_of_exponent_le ht power) hs (Real.rpow_nonneg ht'.le _) (Real.rpow_nonneg ht'.le _)
    _ = dy 144000*((27/100)*t^(1-90*(3*exactGap))) := by ac_rfl
    _ ≤ dy 144000*degree Q p := mul_le_mul_of_nonneg_left (deg p hp).1 (pos _).le

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ComparisonConstants.full_list_card

∀ {t D : ℝ},
  1 ≤ t →
    D + 1 ≤ 30600 * PlanarUnitDistances.exactGap * Real.log t →
      ∀ {n : ℕ},
        n < PlanarUnitDistances.ComparisonConstants.historyDepth D →
          ↑(Fintype.card (PlanarUnitDistances.ComparisonConstants.FullList n)) ≤ t ^ (1 / 4)
Lean source · PlanarUnitDistances/FullHistoryLists.lean, lines 26–54
/-- The size of the whole list, with the exact saving and unrounded
ceiling. The strict prefix length removes the manuscript's extra factor two. -/
theorem full_list_card {t D : ℝ} (ht : 1≤t) (hi : D+1≤30600*exactGap*log t)
    {n : ℕ} (hn : n<historyDepth D) : (Fintype.card (FullList n):ℝ) ≤ t^(1/4:ℝ) := by
  let k := (2:ℝ)^18000
  let L := (2:ℝ)^144000
  have ht' : 0<t := zero_lt_one.trans_le ht
  have idx : (n:ℝ)≤(2:ℝ)^576000*(D+1) := (Nat.lt_ceil.mp hn).le
  have lk : log 2≤1 := by linarith [log_le_sub_one_of_pos (by norm_num : (0:ℝ)<2)]
  have coeff : k*(n:ℝ)*(288000*log 2) ≤ (1/4)*log t := calc
    _ ≤ k*(n:ℝ)*288000 := mul_le_mul_of_nonneg_left (by linarith only [lk]) (by dsimp [k]; positivity)
    _ ≤ k*((2:ℝ)^576000*(30600*exactGap*log t))*288000 := by
      exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left
        (idx.trans (mul_le_mul_of_nonneg_left hi (by positivity))) (by dsimp [k]; positivity)) (by norm_num)
    _ = (((2:ℝ)^594000*exactGap)*(30600*288000))*log t := by
      rw [show (2:ℝ)^594000=(2:ℝ)^18000*(2:ℝ)^576000 from pow_add 2 18000 576000]
      dsimp only [k]; ac_rfl
    _ ≤ _ := mul_le_mul_of_nonneg_right list_gap (log_nonneg ht)
  have card : (Fintype.card (FullList n):ℝ) = ((L*L)^n)^(2^18000:ℕ) := by
    simp only [FullList,Fintype.card_fun,FiniteInformation.history_card,Fintype.card_prod,
      Fintype.card_fin,Nat.cast_pow,Nat.cast_mul,Nat.cast_ofNat,L]
  have Lpos : 0<L := by dsimp [L]; positivity
  rw [card,←Real.exp_log (show 0<((L*L)^n)^(2^18000:ℕ) by positivity),
    Real.log_pow,Real.log_pow,Real.log_mul Lpos.ne' Lpos.ne',Real.rpow_def_of_pos ht',exp_le_exp]
  have logL : log L=144000*log 2 := Real.log_pow _ _
  rw [logL]
  push_cast
  change k*((n:ℝ)*(144000*log 2+144000*log 2))≤log t*(1/4)
  linarith only [coeff]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Corollary 2.17 Both ordinary posterior diagonals

Lean verified

For all sufficiently large t , the same large piece satisfies ξ = t − 150 g ≤ 2 − 144000 , and every point and every center has degree at least 2 144000 . For its uniform edge ( p , q ) , the sums ∑ q Pr ( q ∣ p ) 2 and ∑ p Pr ( p ∣ q ) 2 are each at most 2 − 144000 , at every fixed base point or center respectively.

Proof

The point degrees are at least ( 27 / 100 ) t 1 − 90 g , and the center degrees at least ( 27 / 50 ) t 10000 g − 90 g . Both exponents are strictly positive at g = 3 Δ , while t − 150 g tends to zero. The conditional law is uniform on the actual neighbors. Each atom is at most the reciprocal of the base degree, and all atoms sum to one.

Inspect the Lean declarations

PlanarUnitDistances.ComparisonConstants.eventual_ordinary_collisions

∀ᶠ (t : ℝ) in Filter.atTop,
  ∀ (P Q : Finset OAI.PlanarUnitDistances.Plane) (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q),
    PlanarUnitDistances.ProofAssembly.LargePiece t P Q M →
      ∀ (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q),
        have G :=
          PlanarUnitDistances.UniformPhysical.edgeLaw (PlanarUnitDistances.unitRows P Q)
            (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) he ⋯;
        (∀ (p : ↥P),
            ∑ q, (OAI.PlanarUnitDistances.FiniteStarCoupling.row G p).val q ^ 2 ≤
              PlanarUnitDistances.ComparisonConstants.dy 144000) ∧
          ∀ (q : ↥Q),
            ∑ p, (OAI.PlanarUnitDistances.FiniteStarCoupling.col G q).val p ^ 2 ≤
              PlanarUnitDistances.ComparisonConstants.dy 144000
Lean source · PlanarUnitDistances/OrdinaryPosteriorCollisions.lean, lines 46–86
/-- Both posterior diagonal probabilities on the actual uniform unit
graph are bounded at every chosen base, even before averaging the bases. -/
theorem eventual_ordinary_collisions :
    ∀ᶠt : ℝ in atTop, ∀(P Q : Finset Plane) (M : CommonFieldModel.Model P Q),
    ProofAssembly.LargePiece t P Q M → ∀(he : 0 < incidences P Q),
    let G := edgeLaw (unitRows P Q) (incidences P Q) he (unitRows_total P Q)
    (∀p : P,∑q,((row G p).val q)^2≤dy 144000) ∧
    (∀q : Q,∑p,((col G q).val p)^2≤dy 144000) := by
  filter_upwards [eventual_ordinary_degrees] with t ht
  intro P Q M piece he
  obtain ⟨dp,dq⟩ := ht.2 P Q M piece
  let G := edgeLaw (unitRows P Q) (incidences P Q) he (unitRows_total P Q)
  dsimp only
  have cap {d : ℝ} (hd : (2:ℝ)^144000≤d) : d⁻¹≤dy 144000 := inv_anti₀ (by positivity) hd
  constructor
  · intro p
    apply diagonal_le_max
    intro q
    have hp : 0<degree Q p := (pow_pos (by norm_num : (0:ℝ)<2) _).trans_le (dp p p.prop)
    have e : (left G).val p=degree Q p/incidences P Q := by rw [edge_left,unitRows_point_degree]
    change (row G p).val q≤_
    rw [row_val G (e.symm ▸ div_pos hp he) q,e]
    apply le_trans _ (cap (dp p p.prop))
    change UniformNormalization.weight (unitRows P Q) (incidences P Q) p q / _≤_
    unfold UniformNormalization.weight
    by_cases h : p∈unitRows P Q q
    · rw [ite_eq_left h]; exact le_of_eq (by field_simp)
    · rw [ite_eq_right h,zero_div]; positivity
  · intro q
    apply diagonal_le_max
    intro p
    have hq : 0<degree P q := (pow_pos (by norm_num : (0:ℝ)<2) _).trans_le (dq q q.prop)
    have e : (right G).val q=degree P q/incidences P Q := by rw [edge_right,BoundedHeight.centerLaw,unitRows_center_degree]
    change (col G q).val p≤_
    rw [col_val G (e.symm ▸ div_pos hq he) p,e]
    apply le_trans _ (cap (dq q q.prop))
    change UniformNormalization.weight (unitRows P Q) (incidences P Q) p q / _≤_
    unfold UniformNormalization.weight
    by_cases h : p∈unitRows P Q q
    · rw [ite_eq_left h]; exact le_of_eq (by field_simp)
    · rw [ite_eq_right h,zero_div]; positivity

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ComparisonConstants.eventual_ordinary_degrees

∀ᶠ (t : ℝ) in Filter.atTop,
  t ^ (-150 * (3 * PlanarUnitDistances.exactGap)) ≤ PlanarUnitDistances.ComparisonConstants.dy 144000 ∧
    ∀ (P Q : Finset OAI.PlanarUnitDistances.Plane) (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q),
      PlanarUnitDistances.ProofAssembly.LargePiece t P Q M →
        (∀ p ∈ P, 2 ^ 144000 ≤ OAI.PlanarUnitDistances.CircleIncidence.degree Q p) ∧
          ∀ q ∈ Q, 2 ^ 144000 ≤ OAI.PlanarUnitDistances.CircleIncidence.degree P q
Lean source · PlanarUnitDistances/OrdinaryPosteriorCollisions.lean, lines 10–38
/-- All size parameters behind ordinary posterior collisions, uniformly
in the number field and in the particular configuration. -/
theorem eventual_ordinary_degrees :
    ∀ᶠt : ℝ in atTop, t^(-150*(3*exactGap))≤dy 144000 ∧
      ∀(P Q : Finset Plane) (M : CommonFieldModel.Model P Q), ProofAssembly.LargePiece t P Q M →
      (∀p∈P,(2:ℝ)^144000≤degree Q p) ∧ (∀q∈Q,(2:ℝ)^144000≤degree P q) := by
  let g := 3*exactGap
  have gp : 0<g := by dsimp [g]; positivity [exactGap_pos]
  have hl := exactGap_lt_largeHeightGap.trans_le (Real.rpow_le_rpow_of_exponent_le
    (by norm_num : (1:ℝ)≤2) (by norm_num : -(594036:ℝ)≤ -32))
  have ppos : 0<1-90*g := by dsimp [g]; norm_num [Real.rpow_neg] at hl; linarith
  have qpos : 0<10000*g-90*g := by linarith only [gp]
  have small := (tendsto_rpow_neg_atTop (show 0<150*g by positivity)).eventually
    (eventually_le_nhds (pos 144000))
  have pbig := (tendsto_rpow_atTop ppos).eventually_ge_atTop ((100/27:ℝ)*(2:ℝ)^144000)
  have qbig := (tendsto_rpow_atTop qpos).eventually_ge_atTop ((50/27:ℝ)*(2:ℝ)^144000)
  filter_upwards [small,pbig,qbig] with t hx hp hq
  refine ⟨by simpa only [neg_mul,g] using hx,?_⟩
  intro P Q M piece
  obtain ⟨_,_,_,_,_,degP,_,degQ,_,_,_⟩ := piece
  constructor
  · intro p mem
    have bound := mul_le_mul_of_nonneg_left hp (by norm_num : (0:ℝ)≤27/100)
    rw [←mul_assoc,show (27/100:ℝ)*(100/27)=1 by norm_num,one_mul] at bound
    exact bound.trans (degP p mem).1
  · intro q mem
    have bound := mul_le_mul_of_nonneg_left hq (by norm_num : (0:ℝ)≤27/50)
    rw [←mul_assoc,show (27/50:ℝ)*(50/27)=1 by norm_num,one_mul] at bound
    exact bound.trans (degQ q mem).1

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 2.18 The strict inequality that absorbs fixed constants

Lean verified

If δ ≤ 2 − 594036 , g = 3 δ and a = 10000 g , then

( 2 − 1 / 100000 ) ( 1 + 2 a ) < 2 + 3 a − 180 g .
Proof

The difference is 1 / 100000 − a − 180 g + 2 a / 100000 . Use δ ≤ 2 − 32 and check the resulting rational inequality. Since 2 − 1 / 2000 < 2 − 1 / 100000 and 1 + 2 a > 0 at δ = Δ , this also gives the strict inequality for the final grid count. Taking δ = Δ is justified by Lemma 2.2.

Inspect the Lean declarations

PlanarUnitDistances.graph_density_exponent

∀ {δ : ℝ},
  δ ≤ 2 ^ (-594036) →
    have g := 3 * δ;
    have a := 10000 * g;
    (2 - 1 / 100000) * (1 + 2 * a) < 2 + 3 * a - 180 * g
Lean source · PlanarUnitDistances/Constants.lean, lines 132–147
/-- The final graph density exponent comparison holds for the full range
0 < δ ≤ 2^(-594036), including Theorem A and the number-field version. -/
theorem graph_density_exponent {δ : ℝ} (hδ : δ ≤ (2 : ℝ) ^ (-(594036 : ℝ))) :
    let g := 3 * δ
    let a := 10000 * g
    (2 - 1 / 100000) * (1 + 2 * a) < 2 + 3 * a - 180 * g := by
  have hpower : (2 : ℝ) ^ (-(594036 : ℝ)) ≤ (2 : ℝ) ^ (-(32 : ℝ)) := by
    apply Real.rpow_le_rpow_of_exponent_le (by norm_num)
    norm_num
  have h32 : (2 : ℝ) ^ (-(32 : ℝ)) = 1 / 4294967296 := by
    rw [Real.rpow_neg (by norm_num), ← Nat.cast_ofNat (R := ℝ) (n := 32),
      Real.rpow_natCast]
    norm_num
  rw [h32] at hpower
  dsimp only
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

3 Heights at an embedding

In this chapter

3.1 The height of a unit direction

Definition 3.1 Normalized height

Definition in Lean

For a number field K , the height used here divides Mathlib’s logarithmic height of a field element by [ K : Q ] . Each complex place carries multiplicity two before this division, each real place multiplicity one. At a finite prime the normalized prime-ideal norm incorporates its residue degree.

Inspect the Lean declarations

PlanarUnitDistances.weilHeight

{K : Type u_1} → [inst : Field K] → [NumberField K] → K → ℝ
Lean source · PlanarUnitDistances/Heights.lean, lines 11–12
/-- Mathlib uses the relative height in K. Divide by [K:ℚ] to obtain the absolute logarithmic height. In particular each complex place has weight two before division. -/
def weilHeight (x : K) : ℝ := logHeight₁ x / (Module.finrank ℚ K : ℝ)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.2 Average size at embeddings and small nonzero values

Lean verified

For a uniform embedding σ : K → C , the mean of log + ⁡ | σ x | is at most h ( x ) . For x ≠ 0 and s > 0 , the probability that | σ x | ≤ e − s is at most h ( x ) / s .

Proof

Group the embeddings by infinite place. Their positive logarithms give exactly the archimedean part of the normalized height. The finite part is nonnegative. Apply the first inequality to x − 1 and use h ( x − 1 ) = h ( x ) . Each embedding in the specified event contributes at least s to the sum for the inverse. This works in the original number field, including a nonnormal one.

Inspect the Lean declarations

PlanarUnitDistances.small_embedding_fraction

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] {x : K},
  x ≠ 0 →
    ∀ {s : ℝ},
      0 < s →
        have E := {φ | ‖φ x‖ ≤ Real.exp (-s)};
        ↑E.card / ↑(Module.finrank ℚ K) ≤ PlanarUnitDistances.weilHeight x / s
Lean source · PlanarUnitDistances/Heights.lean, lines 71–92
/-- If a nonzero residual is tiny at an embedding, its inverse pays for it
in the normalized height. The bound uses the *fraction* of all embeddings. -/
theorem small_embedding_fraction {x : K} (hx : x ≠ 0) {s : ℝ} (hs : 0 < s) :
    let E := Finset.univ.filter fun φ : K →+* ℂ => ‖φ x‖ ≤ exp (-s)
    (E.card : ℝ) / (Module.finrank ℚ K : ℝ) ≤ weilHeight x / s := by
  classical
  let E := Finset.univ.filter fun φ : K →+* ℂ => ‖φ x‖ ≤ exp (-s)
  have hnorm (φ : K →+* ℂ) (hφ : φ ∈ E) : s ≤ log⁺ ‖φ x⁻¹‖ := by
    have hpos : 0 < ‖φ x‖ := norm_pos_iff.mpr ((map_ne_zero φ).mpr hx)
    have hlog := log_le_log hpos (Finset.mem_filter.mp hφ).2
    rw [log_exp] at hlog
    rw [map_inv₀, norm_inv, Real.posLog_apply, log_inv]
    exact le_max_of_le_right (by linarith)
  have hsum : (E.card : ℝ)*s ≤ ∑ φ : K →+* ℂ, log⁺ ‖φ x⁻¹‖ := by
    calc
      _ = ∑ _φ ∈ E, s := by simp
      _ ≤ ∑ φ ∈ E, log⁺ ‖φ x⁻¹‖ := Finset.sum_le_sum hnorm
      _ ≤ _ := Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) (fun _ _ _ => Real.posLog_nonneg)
  change (E.card : ℝ) / _ ≤ _
  rw [le_div_iff₀ hs, div_mul_eq_mul_div]
  exact ((div_le_div_of_nonneg_right hsum (Nat.cast_nonneg _)).trans
    (average_embedding_posLog_le_height x⁻¹)).trans_eq (weilHeight_inv x)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.average_embedding_posLog_le_height

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] (x : K),
  (∑ φ, ‖φ x‖.posLog) / ↑(Module.finrank ℚ K) ≤ PlanarUnitDistances.weilHeight x
Lean source · PlanarUnitDistances/Heights.lean, lines 47–69
/-- The random embedding is uniform on individual complex embeddings, including
both members of a conjugate pair. No choice of Galois closure is necessary. -/
theorem average_embedding_posLog_le_height (x : K) :
    (∑ φ : K →+* ℂ, log⁺ ‖φ x‖) / (Module.finrank ℚ K : ℝ) ≤ weilHeight x := by
  classical
  unfold weilHeight
  apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _)
  rw [NumberField.logHeight₁_eq]
  have harch : (∑ φ : K →+* ℂ, log⁺ ‖φ x‖) =
      ∑ v : InfinitePlace K, (v.mult : ℝ) * log⁺ (v x) := by
    rw [← Finset.univ.sum_fiberwise (fun φ : K →+* ℂ => InfinitePlace.mk φ)]
    apply Finset.sum_congr rfl
    intro v _
    calc
      _ = ∑ _φ ∈ Finset.univ.filter (fun φ : K →+* ℂ => InfinitePlace.mk φ = v),
            log⁺ (v x) := by
        apply Finset.sum_congr rfl
        intro φ hφ
        rw [← (Finset.mem_filter.mp hφ).2]
        rfl
      _ = _ := by rw [Finset.sum_const, nsmul_eq_mul, InfinitePlace.card_filter_mk_eq]
  rw [harch]
  exact le_add_of_nonneg_right (finsum_nonneg (fun _ => Real.posLog_nonneg))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.weilHeight_inv

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] (x : K),
  PlanarUnitDistances.weilHeight x⁻¹ = PlanarUnitDistances.weilHeight x
Lean source · PlanarUnitDistances/Heights.lean, lines 23–24
@[simp] theorem weilHeight_inv (x : K) : weilHeight x⁻¹ = weilHeight x := by
  simp [weilHeight, logHeight₁_inv]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.3 The normalized absolute-log sum

Lean verified

Let x ≠ 0 belong to a number field K . In the finite-prime sum use Mathlib’s normalized prime-ideal absolute value | x | p = ( N p ) − ord p ( x ) . Write m v = 1 for real places and m v = 2 for complex places. Then

2 h ( x ) = ∑ v ∣ ∞ m v | log ⁡ | x | v | + ∑ p | log ⁡ | x | p | [ K : Q ] .
Proof

Apply the place decomposition of the logarithmic height to both x and x − 1 . The heights agree. At each place the two positive logarithms sum to the absolute value of the logarithm. At all but finitely many finite primes x is a unit, so the two finite-prime sums may be combined. The normalized finite absolute value already accounts for the local degree convention in the manuscript.

Inspect the Lean declarations

PlanarUnitDistances.twice_weilHeight_eq_absLog

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] {x : K},
  x ≠ 0 →
    2 * PlanarUnitDistances.weilHeight x =
      (∑ v, ↑v.mult * |Real.log (v x)| + ∑ᶠ (v : NumberField.FinitePlace K), |Real.log (v x)|) /
        ↑(Module.finrank ℚ K)
Lean source · PlanarUnitDistances/LogHeight.lean, lines 25–50
/-- Product formula with Mathlib's normalized finite absolute values.
Complex multiplicity occurs exactly once, as the coefficient of the sum over
infinite places. All finite sums below have genuine finite support. -/
theorem twice_weilHeight_eq_absLog {x : K} (hx : x ≠ 0) :
    2 * weilHeight x =
      ((∑ v : InfinitePlace K, (v.mult : ℝ) * |Real.log (v x)|) +
       ∑ᶠ v : FinitePlace K, |Real.log (v x)|) / Module.finrank ℚ K := by
  have infinite : (∑ v : InfinitePlace K, (v.mult : ℝ) * |Real.log (v x)|) =
      (∑ v : InfinitePlace K, (v.mult : ℝ) * log⁺ (v x)) +
      ∑ v : InfinitePlace K, (v.mult : ℝ) * log⁺ (v x⁻¹) := by
    rw [← Finset.sum_add_distrib]
    apply Finset.sum_congr rfl
    intro v _
    rw [absLog_split, map_inv₀, mul_add]
  have finite : (∑ᶠ v : FinitePlace K, |Real.log (v x)|) =
      (∑ᶠ v : FinitePlace K, log⁺ (v x)) + ∑ᶠ v : FinitePlace K, log⁺ (v x⁻¹) := by
    rw [← finsum_add_distrib (finitePosLog hx) (finitePosLog (inv_ne_zero hx))]
    apply finsum_congr
    intro v
    rw [absLog_split, map_inv₀]
  unfold weilHeight
  rw [infinite, finite]
  have h := (NumberField.logHeight₁_eq x)
  have hi := NumberField.logHeight₁_eq x⁻¹
  rw [Height.logHeight₁_inv] at hi
  linear_combination ((1 : ℝ) / Module.finrank ℚ K) * (h + hi)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.4 Four-cycle quotient height

Lean verified

Put ℓ ( x ) v = log ⁡ | x | v and give real place-vectors the weighted sum norm from Lemma 3.3. Take nonzero a , b , c , d ∈ K in row-major order on a rectangle. Assign vectors P , P ′ to the two rows and R , R ′ to the two columns, each supported at finitely many finite primes. Suppose

‖ ℓ ( a ) − ( R − P ) ‖ ,   ‖ ℓ ( b ) − ( R ′ − P ) ‖ , ‖ ℓ ( c ) − ( R − P ′ ) ‖ ,   ‖ ℓ ( d ) − ( R ′ − P ′ ) ‖   ≤ s .

Then h ( a d / ( b c ) ) ≤ 2 s . In particular s = J / ( 648 B ) gives exactly J / ( 324 B ) .

Proof

Locally ℓ ( a d / ( b c ) ) = ℓ ( a ) + ℓ ( d ) − ℓ ( b ) − ℓ ( c ) . The four endpoint differences cancel in this alternating sum. By the triangle inequality the sum norm is at most 4 s . The finite-prime triangle inequality uses finite support for the local logarithms and for every endpoint vector before rearranging the sums. Divide by two using Lemma 3.3. The common-center walk supplies the endpoint vectors.

Inspect the Lean declarations

PlanarUnitDistances.quotient_height_of_endpoint_errors

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] {a b c d : K},
  a ≠ 0 →
    b ≠ 0 →
      c ≠ 0 →
        d ≠ 0 →
          ∀ (P P' R R' : PlanarUnitDistances.HeightPlace K → ℝ),
            PlanarUnitDistances.FiniteAtPrimes P →
              PlanarUnitDistances.FiniteAtPrimes P' →
                PlanarUnitDistances.FiniteAtPrimes R →
                  PlanarUnitDistances.FiniteAtPrimes R' →
                    ∀ (s : ℝ),
                      PlanarUnitDistances.placeNorm (PlanarUnitDistances.localLog a - (R - P)) ≤ s →
                        PlanarUnitDistances.placeNorm (PlanarUnitDistances.localLog b - (R' - P)) ≤ s →
                          PlanarUnitDistances.placeNorm (PlanarUnitDistances.localLog c - (R - P')) ≤ s →
                            PlanarUnitDistances.placeNorm (PlanarUnitDistances.localLog d - (R' - P')) ≤ s →
                              PlanarUnitDistances.weilHeight (a * d / (b * c)) ≤ 2 * s
Lean source · PlanarUnitDistances/LogHeight.lean, lines 119–159
/-- The concrete height estimate on a four-cycle.
The four units are the four assigned ratio values in row-major order.
One vector is attached to each endpoint; finite prime supports permit genuine
sums, and the same error bound is used on all four incidences. -/
theorem quotient_height_of_endpoint_errors {a b c d : K}
    (ha : a ≠ 0) (hb : b ≠ 0) (hc : c ≠ 0) (hd : d ≠ 0)
    (P P' R R' : HeightPlace K → ℝ)
    (hP : FiniteAtPrimes P) (hP' : FiniteAtPrimes P')
    (hR : FiniteAtPrimes R) (hR' : FiniteAtPrimes R') (s : ℝ)
    (ea : placeNorm (localLog a - (R-P)) ≤ s)
    (eb : placeNorm (localLog b - (R'-P)) ≤ s)
    (ec : placeNorm (localLog c - (R-P')) ≤ s)
    (ed : placeNorm (localLog d - (R'-P')) ≤ s) :
    weilHeight (a*d/(b*c)) ≤ 2*s := by
  let A := localLog a - (R-P)
  let B := localLog b - (R'-P)
  let C := localLog c - (R-P')
  let D := localLog d - (R'-P')
  have fs {u v : HeightPlace K → ℝ} (h₁ : FiniteAtPrimes u) (h₂ : FiniteAtPrimes v) :
      FiniteAtPrimes (u-v) := by rw [sub_eq_add_neg]; exact finite_add h₁ (finite_neg h₂)
  have h₁ : FiniteAtPrimes A := fs (finiteLog ha) (fs hR hP)
  have h₂ : FiniteAtPrimes B := fs (finiteLog hb) (fs hR' hP)
  have h₃ : FiniteAtPrimes C := fs (finiteLog hc) (fs hR hP')
  have h₄ : FiniteAtPrimes D := fs (finiteLog hd) (fs hR' hP')
  have h := twice_weilHeight_eq_absLog (div_ne_zero (mul_ne_zero ha hd) (mul_ne_zero hb hc))
  change 2 * weilHeight (a*d/(b*c)) = placeNorm (localLog (a*d/(b*c))) at h
  have cancel : localLog (a*d/(b*c)) = ((A+D)+(-B))+(-C) := by
    rw [localLog_rectangle ha hb hc hd]
    dsimp only [A,B,C,D]
    abel
  rw [cancel] at h
  have first := placeNorm_add A D h₁ h₄
  have second := placeNorm_add (A+D) (-B) (finite_add h₁ h₄) (finite_neg h₂)
  have third := placeNorm_add ((A+D)+(-B)) (-C) (finite_add (finite_add h₁ h₄) (finite_neg h₂))
    (finite_neg h₃)
  simp only [placeNorm_neg] at second third
  change placeNorm A ≤ s at ea
  change placeNorm B ≤ s at eb
  change placeNorm C ≤ s at ec
  change placeNorm D ≤ s at ed
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.5 The circle residual

Lean verified

For F = ( z − a ) ( w − b ) − 1 one has

h ( F ) ≤ h ( z ) + h ( w ) + h ( a ) + h ( b ) + 3 log ⁡ 2 .
Proof

Each subtraction contributes at most log ⁡ 2 in addition to the two heights. Multiplication adds the two upper bounds, and the coefficient 1 has height zero. This inequality also covers F = 0 . Only on the event F ≠ 0 is the inverse estimate needed.

Inspect the Lean declarations

PlanarUnitDistances.circle_residual_height

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] (z w a b : K),
  PlanarUnitDistances.weilHeight ((z - a) * (w - b) - 1) ≤
    PlanarUnitDistances.weilHeight z + PlanarUnitDistances.weilHeight w + PlanarUnitDistances.weilHeight a +
        PlanarUnitDistances.weilHeight b +
      3 * Real.log 2
Lean source · PlanarUnitDistances/Heights.lean, lines 40–45
theorem circle_residual_height (z w a b : K) :
    weilHeight ((z-a)*(w-b)-1) ≤
      weilHeight z + weilHeight w + weilHeight a + weilHeight b + 3*log 2 := by
  have h := weilHeight_sub ((z-a)*(w-b)) 1
  rw [weilHeight_one] at h
  linarith [weilHeight_mul (z-a) (w-b), weilHeight_sub z a, weilHeight_sub w b]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.weilHeight_sub

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] (x y : K),
  PlanarUnitDistances.weilHeight (x - y) ≤
    PlanarUnitDistances.weilHeight x + PlanarUnitDistances.weilHeight y + Real.log 2
Lean source · PlanarUnitDistances/Heights.lean, lines 32–38
theorem weilHeight_sub (x y : K) : weilHeight (x-y) ≤ weilHeight x + weilHeight y + log 2 := by
  have h := logHeight₁_sub_le x y
  rw [NumberField.totalWeight_eq_finrank] at h
  unfold weilHeight
  rw [← add_div, div_add' _ _ _ (ne_of_gt (degree_pos (K := K)))]
  apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _)
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.weilHeight_mul

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] (x y : K),
  PlanarUnitDistances.weilHeight (x * y) ≤ PlanarUnitDistances.weilHeight x + PlanarUnitDistances.weilHeight y
Lean source · PlanarUnitDistances/Heights.lean, lines 26–30
theorem weilHeight_mul (x y : K) : weilHeight (x*y) ≤ weilHeight x + weilHeight y := by
  unfold weilHeight
  rw [← add_div]
  gcongr
  exact logHeight₁_mul_le x y

Kernel axioms used: propext, Classical.choice, Quot.sound.

3.2 From rectangles to four coordinate means

Lemma 3.6 Applying matching to a graph marginal

Lean verified

Let w be a joint probability law on two finite vertex sets with reference laws U , V . Assume the rectangle and lower marginal estimates of Lemma 4.2 for all vertex subsets, with ξ ≤ 2 − 100 . For every vertex labeling, two independent draws from the point marginal disagree with probability at most 28 times the probability of disagreement across an edge.

Proof

Push U , V forward to the finite range of the labeling. A single-label rectangle and its complementary rectangle give the two estimates required by matching. If the point-label masses are m i , the independent disagreement is 1 − ∑ i m i 2 . The edge disagreement uses the original joint law, including its zero-weight pairs.

Inspect the Lean declarations

PlanarUnitDistances.HeightTransfer.label_control_of_rectangles

∀ {P Q : Type} [inst : Fintype P] [inst_1 : Fintype Q] (w : P → Q → ℝ) (U : P → ℝ) (V : Q → ℝ),
  (∀ (p : P) (q : Q), 0 ≤ w p q) →
    ∑ p, ∑ q, w p q = 1 →
      (∀ (p : P), 0 ≤ U p) →
        (∀ (q : Q), 0 ≤ V q) →
          ∑ p, U p = 1 →
            ∑ q, V q = 1 →
              ∀ {ξ : ℝ},
                0 ≤ ξ →
                  ξ ≤ 1 / 2 ^ 100 →
                    (∀ (F : P → Prop) (G : Q → Prop),
                        (PlanarUnitDistances.labelEvent (fun x => w x.1 x.2) fun x => F x.1 ∧ G x.2) ≤
                          have b :=
                            √(PlanarUnitDistances.labelEvent U F * PlanarUnitDistances.labelEvent V G);
                          b * (b ^ (2 / 25) + ξ)) →
                      (∀ (F : P → Prop),
                          27 / 50 * PlanarUnitDistances.labelEvent U F ≤
                            PlanarUnitDistances.labelEvent (fun x => w x.1 x.2) fun x => F x.1) →
                        (∀ (G : Q → Prop),
                            27 / 50 * PlanarUnitDistances.labelEvent V G ≤
                              PlanarUnitDistances.labelEvent (fun x => w x.1 x.2) fun x => G x.2) →
                          OAI.PlanarUnitDistances.LocalHeightTransfer.LabelControl 28 w
Lean source · PlanarUnitDistances/GraphHeightTransfer.lean, lines 55–110
/-- The graph hypotheses used for coordinate transfer are precisely rectangle expansion
and the two lower marginal comparisons with the vertex counting distributions.
The distributions U,V may in fact be arbitrary probability laws. -/
theorem label_control_of_rectangles (w : P → Q → ℝ) (U : P → ℝ) (V : Q → ℝ)
    (hw : ∀ p q, 0 ≤ w p q) (hs : ∑ p, ∑ q, w p q = 1)
    (hU : ∀ p, 0 ≤ U p) (hV : ∀ q, 0 ≤ V q) (uSum : ∑ p, U p = 1) (vSum : ∑ q, V q = 1)
    {ξ : ℝ} (hξ : 0 ≤ ξ) (hξsmall : ξ ≤ 1/(2:ℝ)^100)
    (rect : ∀ (F : P → Prop) (G : Q → Prop),
      labelEvent (fun x : P × Q => w x.1 x.2) (fun x => F x.1 ∧ G x.2) ≤
      let b := sqrt (labelEvent U F * labelEvent V G)
      b*(b^(2/25:ℝ)+ξ))
    (lowP : ∀ (F : P → Prop), (27/50:ℝ)*labelEvent U F ≤
      labelEvent (fun x : P × Q => w x.1 x.2) (fun x => F x.1))
    (lowQ : ∀ (G : Q → Prop), (27/50:ℝ)*labelEvent V G ≤
      labelEvent (fun x : P × Q => w x.1 x.2) (fun x => G x.2)) :
    LabelControl 28 w := by
  intro L
  have hn : Nonempty P := by
    by_contra! he
    haveI : IsEmpty P := he
    simp at hs
  let T := Set.range L
  letI : Fintype T := Fintype.ofFinite _
  letI : Nonempty T := ⟨⟨L (.inl hn.some),Set.mem_range_self _⟩⟩
  let f (p : P) : T := ⟨L (.inl p),Set.mem_range_self _⟩
  let g (q : Q) : T := ⟨L (.inr q),Set.mem_range_self _⟩
  let m (x : P × Q) := w x.1 x.2
  let u (a : T) := labelEvent U (fun p => f p = a)
  let v (a : T) := labelEvent V (fun q => g q = a)
  have sm : ∑ x, m x = 1 := by rw [Fintype.sum_prod_type]; exact hs
  have cp (a : T) := complement_mass U uSum (fun p => f p = a)
  have cq (a : T) := complement_mass V vSum (fun q => g q = a)
  have hh := matching_for_edge_law m (fun x => f x.1) (fun x => g x.2) u v ξ
    (fun x => hw _ _) sm (fun a => fiber_nonneg hU _) (fun a => fiber_nonneg hV _)
    (fiber_mass_total U uSum f) (fiber_mass_total V vSum g) hξ hξsmall
    (fun a => rect (fun p => f p = a) (fun q => g q = a))
    (fun a => by simpa only [u,v,← cp,← cq] using rect (fun p => f p ≠ a) (fun q => g q ≠ a))
    (fun a => by simpa only [u,← cp] using lowP (fun p => f p ≠ a))
    (fun a => by simpa only [v,← cq] using lowQ (fun q => g q ≠ a))
  have marg (a : T) : labelEvent m (fun x => f x.1 = a) = labelEvent (left w) (fun p => f p = a) := by
    simp only [labelEvent,Fintype.sum_prod_type,m,left]
    apply sum_congr rfl
    intro p _
    by_cases h : f p = a <;> simp [h]
  have eqd : (∑ p, ∑ r, left w p * left w r * dis (L (.inl p)) (L (.inl r))) =
      1 - ∑ a, (labelEvent m (fun x => f x.1 = a))^2 := by
    simpa only [marg,dis,f,Subtype.mk.injEq] using pair_disagreement (left w) hs f
  rw [eqd]
  refine hh.2.1.trans_eq ?_
  congr 1
  simp only [labelEvent,Fintype.sum_prod_type,m,f,g,ne_eq,Subtype.mk.injEq,dis]
  apply sum_congr rfl
  intro p _
  apply sum_congr rfl
  intro q _
  split_ifs <;> simp_all

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.7 The laws of the extracted Euclidean graph

Lean verified

Given finite P , Q ⊆ R 2 , let S ( q ) = { p ∈ P : ‖ p − q ‖ = 1 } . The degree of either vertex and the sum of the center degrees equal the corresponding geometric counts in Proposition 2.14. If each center has positive degree, the two-edge mutual information on the geometric graph agrees with the arithmetic test’s mutual information for the rows S ( q ) . If the two sides have positive cardinalities and satisfy that proposition’s cut bound and lower degree-marginal bounds with 0 ≤ ξ ≤ 2 − 100 , then the weight assigning 1 / | E | to each unit edge satisfies the label inequality with constant 28.

Proof

For subsets A , B of the two vertex types, the uniform edge law gives mass | E ∩ ( A × B ) | / | E | to the rectangle and counting fractions | A | / | P | , | B | / | Q | to its two sides. Their product z is nonnegative, so ( z ) 2 / 25 = z 1 / 25 . Sum the given degree inequalities over each event to recover the two lower marginal comparisons. Finally, the two transition probabilities agree term by term, both for selecting a center and for sampling a point from its neighborhood.

Inspect the Lean declarations

PlanarUnitDistances.unitRows_label_control

∀ (P Q : Finset OAI.PlanarUnitDistances.Plane),
  0 < ↑P.card →
    0 < ↑Q.card →
      0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q →
        ∀ {ξ : ℝ},
          0 ≤ ξ →
            ξ ≤ 1 / 2 ^ 100 →
              (∀ p ∈ P,
                  27 / 50 / ↑P.card ≤
                    OAI.PlanarUnitDistances.CircleIncidence.degree Q p /
                      OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) →
                (∀ q ∈ Q,
                    27 / 50 / ↑Q.card ≤
                      OAI.PlanarUnitDistances.CircleIncidence.degree P q /
                        OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) →
                  (∀ A ⊆ P,
                      ∀ B ⊆ Q,
                        have z := ↑A.card / ↑P.card * (↑B.card / ↑Q.card);
                        OAI.PlanarUnitDistances.CircleIncidence.incidences A B /
                            OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ≤
                          √z * (z ^ (1 / 25) + ξ)) →
                    OAI.PlanarUnitDistances.LocalHeightTransfer.LabelControl 28
                      (PlanarUnitDistances.UniformNormalization.weight (PlanarUnitDistances.unitRows P Q)
                        (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q))
Lean source · PlanarUnitDistances/GeometricHeightLaw.lean, lines 82–129
/-- The rectangle expansion and lower marginal inequalities from the actual
Euclidean graph imply the label-control hypothesis for its arithmetic normalization. -/
theorem unitRows_label_control (P Q : Finset Plane) (hP : 0 < (P.card:ℝ)) (hQ : 0 < (Q.card:ℝ))
    (he : 0 < incidences P Q) {ξ : ℝ} (hξ : 0 ≤ ξ) (hξs : ξ ≤ 1/(2:ℝ)^100)
    (hp : ∀ p ∈ P, (27/50:ℝ)/P.card ≤ degree Q p/incidences P Q)
    (hq : ∀ q ∈ Q, (27/50:ℝ)/Q.card ≤ degree P q/incidences P Q)
    (hcut : ∀ A ⊆ P, ∀ B ⊆ Q, let z := (A.card:ℝ)/P.card*((B.card:ℝ)/Q.card)
      incidences A B/incidences P Q ≤ sqrt z*(z^(1/25:ℝ)+ξ)) :
    LabelControl 28 (weight (unitRows P Q) (incidences P Q)) := by
  let w := weight (unitRows P Q) (incidences P Q)
  have mw (p : P) : (∑ q, w p q) = degree Q p/incidences P Q := by
    change left (weight _ _) p = _
    rw [weight_left,unitRows_point_degree]
  have nw (q : Q) : (∑ p, w p q) = degree P q/incidences P Q := by
    rw [show (∑ p, w p q) = centerLaw (unitRows P Q) (incidences P Q) q from weight_right _ _ q]
    rw [centerLaw,unitRows_center_degree]
  have mass : ∑ p, ∑ q, w p q = 1 := by
    rw [sum_comm]
    simp only [nw,← sum_div, ← unitRows_center_degree P Q,unitRows_total,div_self he.ne']
  apply HeightTransfer.label_control_of_rectangles w (fun _ => (P.card:ℝ)⁻¹) (fun _ => (Q.card:ℝ)⁻¹)
    (fun p q => by dsimp [w,weight]; split_ifs <;> positivity) mass (fun _ => by positivity)
    (fun _ => by positivity) (by simp [hP.ne']) (by simp [hQ.ne']) hξ hξs
  · intro F G
    rw [incidenceEvent, countEvent,countEvent]
    let z := ((subsetOf P F).card:ℝ)/P.card*(((subsetOf Q G).card:ℝ)/Q.card)
    have hz : 0 ≤ z := by dsimp [z]; positivity
    have eqpow : (sqrt z)^(2/25:ℝ) = z^(1/25:ℝ) := by
      rw [sqrt_eq_rpow, ← rpow_mul hz]
      norm_num
    exact (hcut _ (subsetOf_subset P F) _ (subsetOf_subset Q G)).trans_eq (by rw [← eqpow])
  · intro F
    unfold labelEvent
    rw [Fintype.sum_prod_type, Finset.mul_sum]
    apply sum_le_sum
    intro p _
    by_cases hf : F p
    · simp only [hf,if_true,mw]
      simpa only [div_eq_mul_inv] using hp p p.2
    · simp [hf]
  · intro G
    unfold labelEvent
    rw [Fintype.sum_prod_type, Finset.sum_comm, Finset.mul_sum]
    apply sum_le_sum
    intro q _
    by_cases hg : G q
    · simp only [hg,if_true,nw]
      simpa only [div_eq_mul_inv] using hq q q.2
    · simp [hg]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.unitRows_point_degree

∀ (P Q : Finset OAI.PlanarUnitDistances.Plane) (p : ↥P),
  ↑(PlanarUnitDistances.BoundedHeight.pointCenters (PlanarUnitDistances.unitRows P Q) p).card =
    OAI.PlanarUnitDistances.CircleIncidence.degree Q ↑p
Lean source · PlanarUnitDistances/GeometricHeightLaw.lean, lines 15–20
theorem unitRows_point_degree (P Q : Finset Plane) (p : P) :
    ((pointCenters (unitRows P Q) p).card:ℝ) = degree Q p := by
  rw [← unitNeighbors_card Q p]
  congr 2
  ext q
  simp [pointCenters,unitRows,unitNeighbors,dist_comm (p:Plane)]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.unitRows_center_degree

∀ (P Q : Finset OAI.PlanarUnitDistances.Plane) (q : ↥Q),
  ↑(PlanarUnitDistances.unitRows P Q q).card = OAI.PlanarUnitDistances.CircleIncidence.degree P ↑q
Lean source · PlanarUnitDistances/GeometricHeightLaw.lean, lines 12–13
theorem unitRows_center_degree (P Q : Finset Plane) (q : Q) :
    ((unitRows P Q q).card:ℝ) = degree P q := unitNeighbors_card P q

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.unitRows_total

∀ (P Q : Finset OAI.PlanarUnitDistances.Plane),
  ∑ q, ↑(PlanarUnitDistances.unitRows P Q q).card = OAI.PlanarUnitDistances.CircleIncidence.incidences P Q
Lean source · PlanarUnitDistances/GeometricHeightLaw.lean, lines 22–25
theorem unitRows_total (P Q : Finset Plane) :
    (∑ q, ((unitRows P Q q).card:ℝ)) = incidences P Q := by
  simp only [unitRows_center_degree,incidences]
  exact Finset.sum_attach Q _

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.unitRows_information

∀ (P Q : Finset OAI.PlanarUnitDistances.Plane),
  (∀ q ∈ Q, 0 < OAI.PlanarUnitDistances.CircleIncidence.degree P q) →
    PlanarUnitDistances.unitWalkInformation P Q =
      PlanarUnitDistances.BoundedHeight.twoEdgeInformation (PlanarUnitDistances.unitRows P Q)
        (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q)
Lean source · PlanarUnitDistances/GeometricHeightLaw.lean, lines 27–37
theorem unitRows_information (P Q : Finset Plane) (hq : ∀ q ∈ Q, 0 < degree P q) :
    unitWalkInformation P Q = twoEdgeInformation (unitRows P Q) (incidences P Q) := by
  have nonemp (q : Q) : (unitRows P Q q).Nonempty := card_pos.mp (Nat.cast_pos.mp
    ((unitRows_center_degree P Q q).symm ▸ hq q q.2))
  have κ : unitCenterLaw P Q = centerLaw (unitRows P Q) (incidences P Q) := by
    funext q; simp only [unitCenterLaw, centerLaw, unitRows_center_degree]
  have w : (fun q : Q => unitNeighborLaw P q) = neighborLaw (unitRows P Q) := by
    funext q p
    rw [neighborLaw, if_pos (nonemp q), unitRows_center_degree]
    by_cases hp : p ∈ unitNeighbors P q <;> simp [unitNeighborLaw,unitRows,hp]
  simp only [unitWalkInformation,twoEdgeInformation,κ,w]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.8 Transferring a height bound from edges to independent points

Lean verified

Let U be a number-field coordinate on both vertex sets. Suppose the disagreement probability for two independent point labels is at most C times the edge disagreement for every labeling, with C ≥ 1 . Write μ for the point marginal of the edge law. Then

E p , p ′ ∼ μ h ( U p − U p ′ ) ≤ 2 C { E ( p , q ) ∼ w h ( U p − U q ) + 1 } .
Proof

At a finite place, label by the ultrametric ball at radius e s . Integrating disagreement over s ≥ 0 gives the positive logarithm exactly. At an infinite place, a uniformly shifted square mesh of side e s separates two entries at distance b with probability at most min ( 1 , 3 b e − s / 2 ) . Entries in the same cell are at distance at most 3 e s / 2 . Both bounds follow by squaring the corresponding inequalities in two real coordinates. The integral of min ( 1 , a e − s ) is at most 1 + log + ⁡ a .

Let E = E w h ( U p − U q ) and k = log ⁡ ( 3 / 2 ) . Sum the place inequalities with complex multiplicity two and divide by [ K : Q ] . Only finitely many finite places contribute. The resulting bound is C E + C ( 1 + k ) + k . Since k ≤ 1 / 2 , C ≥ 1 and E ≥ 0 , this is at most 2 C ( E + 1 ) . The manuscript uses 2 for the two mesh bounds. The rational choice 3 / 2 proves the same final coefficient, including at C = 1 .

Inspect the Lean declarations

PlanarUnitDistances.HeightTransfer.coordinate_height_transfer

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] {P Q : Type} [inst_2 : Fintype P]
  [inst_3 : Fintype Q] {C : ℝ},
  1 ≤ C →
    ∀ {w : P → Q → ℝ},
      (∀ (p : P) (q : Q), 0 ≤ w p q) →
        ∑ p, ∑ q, w p q = 1 →
          OAI.PlanarUnitDistances.LocalHeightTransfer.LabelControl C w →
            ∀ (U : P ⊕ Q → K),
              ∑ p,
                  ∑ r,
                    OAI.PlanarUnitDistances.LocalHeightTransfer.left w p *
                        OAI.PlanarUnitDistances.LocalHeightTransfer.left w r *
                      PlanarUnitDistances.weilHeight (U (Sum.inl p) - U (Sum.inl r)) ≤
                2 * C * (∑ p, ∑ q, w p q * PlanarUnitDistances.weilHeight (U (Sum.inl p) - U (Sum.inr q)) + 1)
Lean source · PlanarUnitDistances/HeightTransfer.lean, lines 57–112
/-- The coordinate height-transfer inequality in the manuscript, with coefficient 2C. -/
theorem coordinate_height_transfer {C : ℝ} (hC : 1 ≤ C) {w : P → Q → ℝ}
    (hw : ∀ p q, 0 ≤ w p q) (hs : ∑ p, ∑ q, w p q = 1)
    (hc : LabelControl C w) (U : P ⊕ Q → K) :
    (∑ p, ∑ r, left w p * left w r * weilHeight (U (.inl p) - U (.inl r))) ≤
    2*C*((∑ p, ∑ q, w p q * weilHeight (U (.inl p) - U (.inr q))) + 1) := by
  classical
  let a : P × P → K := fun x => U (.inl x.1)-U (.inl x.2)
  let b : P × Q → K := fun x => U (.inl x.1)-U (.inr x.2)
  let μ : P × P → ℝ := fun x => left w x.1 * left w x.2
  let e : P × Q → ℝ := fun x => w x.1 x.2
  let A : InfinitePlace K → ℝ := fun v => ∑ x, μ x * log⁺ (v (a x))
  let B : InfinitePlace K → ℝ := fun v => ∑ x, e x * log⁺ (v (b x))
  let F : FinitePlace K → ℝ := fun v => ∑ x, μ x * log⁺ (v (a x))
  let G : FinitePlace K → ℝ := fun v => ∑ x, e x * log⁺ (v (b x))
  let k := log (3/2 : ℝ)
  let d : ℝ := Module.finrank ℚ K
  have hp : 0 < d := by dsimp only [d]; exact_mod_cast Module.finrank_pos (R := ℚ) (M := K)
  have harch (v : InfinitePlace K) : A v ≤ C*(B v+k+1)+k := by
    simpa only [A,B,a,b,μ,e,k,Fintype.sum_prod_type,← map_sub,InfinitePlace.norm_embedding_eq] using
      archimedean_transfer (by linarith : 0 ≤ C) hw hs hc (fun i => v.embedding (U i))
  have hfinite (v : FinitePlace K) : F v ≤ C*G v := by
    simpa only [F,G,a,b,μ,e,Fintype.sum_prod_type,FinitePlace.coe_apply] using
      nonarchimedean_transfer v.val (FinitePlace.add_le v) hc U
  have ha : (∑ v : InfinitePlace K, (v.mult : ℝ) * A v) ≤
      C * (∑ v : InfinitePlace K, (v.mult : ℝ) * B v) + d * (C*(k+1)+k) := by
    calc
      _ ≤ ∑ v : InfinitePlace K, (v.mult : ℝ) * (C*(B v+k+1)+k) :=
        sum_le_sum fun v _ => mul_le_mul_of_nonneg_left (harch v) (by positivity)
      _ = ∑ v : InfinitePlace K, (C*((v.mult : ℝ)*B v) + (v.mult : ℝ)*(C*(k+1)+k)) := by
        apply sum_congr rfl
        intro v _
        ring
      _ = _ := by rw [sum_add_distrib,← mul_sum,← sum_mul,← Nat.cast_sum,InfinitePlace.sum_mult_eq]
  have hf : (∑ᶠ v, F v) ≤ C*∑ᶠ v, G v := by
    have h := finsum_le_finsum' (weighted_finite_support μ a)
      ((weighted_finite_support e b).mul_right (fun _ => C)) hfinite
    simpa only [Pi.mul_apply,← mul_finsum,F,G] using h
  have ht : (∑ x, μ x * weilHeight (a x)) ≤ C*(∑ x, e x * weilHeight (b x)) + (C*(k+1)+k) := by
    rw [weighted_height_identity,weighted_height_identity]
    change ((∑ v : InfinitePlace K, (v.mult : ℝ)*A v)+(∑ᶠ v,F v))/d ≤
      C*(((∑ v : InfinitePlace K, (v.mult : ℝ)*B v)+(∑ᶠ v,G v))/d)+(C*(k+1)+k)
    calc
      _ ≤ (C*(∑ v : InfinitePlace K, (v.mult : ℝ)*B v)+d*(C*(k+1)+k)+C*(∑ᶠ v,G v))/d :=
        div_le_div_of_nonneg_right (add_le_add ha hf) hp.le
      _ = _ := by field_simp; ring
  have hk : k ≤ 1/2 := by
    have h := Real.log_le_sub_one_of_pos (by norm_num : (0:ℝ) < 3/2)
    dsimp [k]
    linarith
  have hC0 : 0 ≤ C := by linarith
  have he_nonneg : 0 ≤ ∑ x, e x * weilHeight (b x) :=
    sum_nonneg fun x _ => mul_nonneg (hw _ _) (weilHeight_nonneg _)
  have hend : (∑ x, μ x * weilHeight (a x)) ≤ 2*C*((∑ x, e x * weilHeight (b x))+1) := by
    nlinarith only [ht,mul_le_mul_of_nonneg_left hk hC0,hk,hC,mul_nonneg hC0 he_nonneg]
  simpa only [Fintype.sum_prod_type,a,b,μ,e] using hend

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.HeightTransfer.weighted_height_identity

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] {A : Type u_2} [inst_2 : Fintype A] (w : A → ℝ)
  (x : A → K),
  ∑ a, w a * PlanarUnitDistances.weilHeight (x a) =
    (∑ v, ↑v.mult * ∑ a, w a * (v (x a)).posLog +
        ∑ᶠ (v : NumberField.FinitePlace K), ∑ a, w a * (v (x a)).posLog) /
      ↑(Module.finrank ℚ K)
Lean source · PlanarUnitDistances/HeightTransfer.lean, lines 26–53
/-- A finite expectation of the absolute height split into expectations at all places. -/
theorem weighted_height_identity {A : Type*} [Fintype A] (w : A → ℝ) (x : A → K) :
    (∑ a, w a * weilHeight (x a)) =
      ((∑ v : InfinitePlace K, (v.mult : ℝ) * ∑ a, w a * log⁺ (v (x a))) +
       (∑ᶠ v : FinitePlace K, ∑ a, w a * log⁺ (v (x a)))) / (Module.finrank ℚ K : ℝ) := by
  classical
  have ha : (∑ v : InfinitePlace K, (v.mult : ℝ) * ∑ a, w a * log⁺ (v (x a))) =
      ∑ a, w a * ∑ v : InfinitePlace K, (v.mult : ℝ) * log⁺ (v (x a)) := by
    simp only [mul_sum]
    rw [sum_comm]
    apply sum_congr rfl
    intro a _
    apply sum_congr rfl
    intro v _
    ring
  have hf : (∑ᶠ v : FinitePlace K, ∑ a, w a * log⁺ (v (x a))) =
      ∑ a, w a * ∑ᶠ v : FinitePlace K, log⁺ (v (x a)) := by
    have hi := finsum_sum_comm (α := FinitePlace K) (β := A) (M := ℝ)
      univ (fun v a => w a * log⁺ (v (x a)))
      (fun a _ => (finite_log_support (x a)).mul_right (fun _ => w a))
    rw [hi]
    apply sum_congr rfl
    intro a _
    exact (mul_finsum _ _).symm
  rw [ha,hf,← sum_add_distrib,sum_div]
  apply sum_congr rfl
  intro a _
  rw [← mul_add,mul_div_assoc,weilHeight,NumberField.logHeight₁_eq]

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.LocalHeightTransfer.archimedean_transfer

∀ {P Q : Type} [inst : Fintype P] [inst_1 : Fintype Q] {C : ℝ} {w : P → Q → ℝ},
  0 ≤ C →
    (∀ (p : P) (q : Q), 0 ≤ w p q) →
      ∑ p, ∑ q, w p q = 1 →
        OAI.PlanarUnitDistances.LocalHeightTransfer.LabelControl C w →
          ∀ (z : P ⊕ Q → ℂ),
            ∑ p,
                ∑ p',
                  OAI.PlanarUnitDistances.LocalHeightTransfer.left w p *
                      OAI.PlanarUnitDistances.LocalHeightTransfer.left w p' *
                    ‖z (Sum.inl p) - z (Sum.inl p')‖.posLog ≤
              C * (∑ p, ∑ q, w p q * ‖z (Sum.inl p) - z (Sum.inr q)‖.posLog + Real.log (3 / 2) + 1) +
                Real.log (3 / 2)
Lean source · PlanarUnitDistances/HeightMesh.lean, lines 402–457
lemma archimedean_transfer {C : ℝ} {w : P → Q → ℝ} (hC : 0 ≤ C)
    (hw : ∀ p q, 0 ≤ w p q) (hs : ∑ p, ∑ q, w p q = 1)
    (hc : LabelControl C w) (z : P ⊕ Q → ℂ) :
    (∑ p, ∑ p', left w p * left w p' * log⁺ ‖z (.inl p)-z (.inl p')‖) ≤
    C * ((∑ p, ∑ q, w p q * log⁺ ‖z (.inl p)-z (.inr q)‖)+log (3/2)+1)+log (3/2) := by
  classical
  let a : P × P → ℝ := fun x => ‖z (.inl x.1)-z (.inl x.2)‖/(3/2)
  let b : P × Q → ℝ := fun x => (3/2:ℝ)*‖z (.inl x.1)-z (.inr x.2)‖
  let v : P × P → ℝ := fun x => left w x.1 * left w x.2
  let e : P × Q → ℝ := fun x => w x.1 x.2
  obtain ⟨T,hT⟩ := Finite.exists_le (fun x : P × P => log⁺ (a x))
  let D := max 0 T
  have hD : 0 ≤ D := le_max_left _ _
  have ha (x) : 0 ≤ a x := div_nonneg (norm_nonneg _) (by norm_num)
  have hb (x) : 0 ≤ b x := mul_nonneg (by norm_num) (norm_nonneg _)
  have he (x) : 0 ≤ e x := hw _ _
  have hv (x) : 0 ≤ v x := mul_nonneg (left_nonneg hw _) (left_nonneg hw _)
  have hl (s : ℝ) : (∑ x, v x * if exp s < a x then (1:ℝ) else 0) ≤
      C * ∑ x, e x * min 1 (b x*exp (-s)) := by
    simpa only [Fintype.sum_prod_type,a,b,v,e,lt_div_iff₀ (by norm_num : (0:ℝ)<3/2),
      mul_comm (exp s) (3/2)] using grid_level hC hw hc z s
  have hi := setIntegral_mono_on (weighted_tails_integrable v a D)
    ((weighted_kernel_integrable e b D).const_mul C) measurableSet_Icc (fun s _ => hl s)
  rw [weighted_tails_integral v a ha (fun x => (hT x).trans (le_max_right _ _)),
    integral_const_mul] at hi
  have hib := hi.trans (mul_le_mul_of_nonneg_left
    (weighted_kernel_integral_le e b he hb hD) hC)
  have hsum : ∑ p, left w p = 1 := hs
  have hvsum : ∑ x, v x = 1 := by
    simp only [v,Fintype.sum_prod_type,← mul_sum,hsum,mul_one]
  have hesum : ∑ x, e x = 1 := by
    change (∑ x : P × Q, w x.1 x.2) = 1
    rw [Fintype.sum_prod_type]; exact hs
  have haBound : (∑ p, ∑ p', left w p * left w p' * log⁺ ‖z (.inl p)-z (.inl p')‖) ≤
      (∑ x, v x * log⁺ (a x))+log (3/2) := by
    calc
      _ ≤ ∑ p, ∑ p', left w p * left w p' * (log⁺ (a (p,p'))+log (3/2)) := by
        apply sum_le_sum; intro p _; apply sum_le_sum; intro p' _
        exact mul_le_mul_of_nonneg_left (log_mesh_control _) (hv (p,p'))
      _ = _ := by
        rw [← Fintype.sum_prod_type (fun x : P × P => v x*(log⁺ (a x)+log (3/2)))]
        simp only [mul_add,sum_add_distrib,← sum_mul,hvsum,one_mul]
  have hbBound : (∑ x, e x*(log⁺ (b x)+1)) ≤
      (∑ p, ∑ q, w p q*log⁺ ‖z (.inl p)-z (.inr q)‖)+log (3/2)+1 := by
    calc
      _ ≤ ∑ x, e x * (log⁺ ‖z (.inl x.1)-z (.inr x.2)‖+log (3/2)+1) := by
        apply sum_le_sum; intro x _; apply mul_le_mul_of_nonneg_left _ (he x)
        have hp : log⁺ (b x) ≤ log⁺ ‖z (.inl x.1)-z (.inr x.2)‖+log (3/2) := by
          have h := posLog_mul (x := 3/2) (y := ‖z (.inl x.1)-z (.inr x.2)‖)
          rw [posLog_eq_log (by norm_num : (1:ℝ) ≤ |3/2|)] at h
          simpa only [b,add_comm] using h
        linarith
      _ = _ := by
        simp only [mul_add,sum_add_distrib,← sum_mul,mul_one,hesum,one_mul]
        rw [Fintype.sum_prod_type]
  linarith [mul_le_mul_of_nonneg_left hbBound hC]

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.LocalHeightTransfer.nonarchimedean_transfer

∀ {P Q : Type} [inst : Fintype P] [inst_1 : Fintype Q] {K : Type u_1} [inst_2 : Field K]
  (v : AbsoluteValue K ℝ),
  IsNonarchimedean ⇑v →
    ∀ {C : ℝ} {w : P → Q → ℝ},
      OAI.PlanarUnitDistances.LocalHeightTransfer.LabelControl C w →
        ∀ (z : P ⊕ Q → K),
          ∑ p,
              ∑ p',
                OAI.PlanarUnitDistances.LocalHeightTransfer.left w p *
                    OAI.PlanarUnitDistances.LocalHeightTransfer.left w p' *
                  (v (z (Sum.inl p) - z (Sum.inl p'))).posLog ≤
            C * ∑ p, ∑ q, w p q * (v (z (Sum.inl p) - z (Sum.inr q))).posLog
Lean source · PlanarUnitDistances/HeightMesh.lean, lines 483–504
lemma nonarchimedean_transfer {K : Type*} [Field K] (v : AbsoluteValue K ℝ)
    (hv : IsNonarchimedean v) {C : ℝ} {w : P → Q → ℝ}
    (hc : LabelControl C w) (z : P ⊕ Q → K) :
    (∑ p, ∑ p', left w p * left w p' * log⁺ (v (z (.inl p)-z (.inl p')))) ≤
    C * ∑ p, ∑ q, w p q * log⁺ (v (z (.inl p)-z (.inr q))) := by
  classical
  let a : P × P → ℝ := fun x => v (z (.inl x.1)-z (.inl x.2))
  let b : P × Q → ℝ := fun x => v (z (.inl x.1)-z (.inr x.2))
  let μ : P × P → ℝ := fun x => left w x.1 * left w x.2
  let e : P × Q → ℝ := fun x => w x.1 x.2
  obtain ⟨T,hT⟩ := Finite.exists_le (fun x : P × P => log⁺ (a x))
  obtain ⟨S,hS⟩ := Finite.exists_le (fun x : P × Q => log⁺ (b x))
  let D := max T S
  have hl (s : ℝ) : (∑ x, μ x * if exp s < a x then (1:ℝ) else 0) ≤
      C * ∑ x, e x * if exp s < b x then (1:ℝ) else 0 := by
    simpa only [Fintype.sum_prod_type,a,b,μ,e] using nonarchimedean_level v hv hc z s
  have hi := setIntegral_mono_on (weighted_tails_integrable μ a D)
    ((weighted_tails_integrable e b D).const_mul C) measurableSet_Icc (fun s _ => hl s)
  rw [weighted_tails_integral μ a (fun x => v.nonneg _) (fun x => (hT x).trans (le_max_left _ _)),
    integral_const_mul,weighted_tails_integral e b (fun x => v.nonneg _)
      (fun x => (hS x).trans (le_max_right _ _))] at hi
  simpa only [Fintype.sum_prod_type,a,b,μ,e] using hi

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.GridShift.gridMismatch_integral_le

∀ {r : ℝ},
  0 < r →
    ∀ (z w : ℂ),
      ∫ (u : ℝ × ℝ),
          OAI.PlanarUnitDistances.GridShift.gridMismatch r z w
            u ∂OAI.PlanarUnitDistances.GridShift.squareShift ≤
        min 1 (3 / 2 * ‖z - w‖ / r)
Lean source · PlanarUnitDistances/HeightMesh.lean, lines 162–185
lemma gridMismatch_integral_le {r : ℝ} (hr : 0 < r) (z w : ℂ) :
    (∫ u, gridMismatch r z w u ∂squareShift) ≤ min 1 ((3/2:ℝ)*‖z-w‖/r) := by
  apply le_min
  · calc
      _ ≤ ∫ _u, (1:ℝ) ∂squareShift := integral_mono
        (gridMismatch_integrable r z w) (integrable_const _) (by
          intro u; unfold gridMismatch; split <;> norm_num)
      _ = 1 := by simp
  · have h := integral_mono (gridMismatch_integrable r z w)
      ((coordinate_mismatch_integrable (z.re/r) (w.re/r) Prod.fst measurable_fst).add
      (coordinate_mismatch_integrable (z.im/r) (w.im/r) Prod.snd measurable_snd))
      (gridMismatch_le_coordinates r z w)
    have he := integral_add
      (coordinate_mismatch_integrable (z.re/r) (w.re/r) Prod.fst measurable_fst)
      (coordinate_mismatch_integrable (z.im/r) (w.im/r) Prod.snd measurable_snd)
    dsimp only [Pi.add_apply] at h he
    rw [he,integral_mismatch_fst,integral_mismatch_snd] at h
    calc
      _ ≤ |z.re/r-w.re/r| + |z.im/r-w.im/r| := h.trans
        (add_le_add (mismatch_integral_le_abs _ _) (mismatch_integral_le_abs _ _))
      _ = (|(z-w).re|+|(z-w).im|)/r := by
        rw [← sub_div,← sub_div,abs_div,abs_div,abs_of_pos hr,← add_div]
        rfl
      _ ≤ ((3/2:ℝ)*‖z-w‖)/r := div_le_div_of_nonneg_right (coordinate_sum _) hr.le

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.9 Choosing an actual edge direction as scale

Lean verified

Give finitely many nonzero number-field directions d e edge weights summing to one. At a place v , set a e = − log ⁡ | d e | v and π v ( s ) = Pr ( a e > s ) . Integrate over any interval containing all these thresholds. With the normalized place weights,

E e , f h ( d e / d f ) = ∑ v ∗ ∫ π v ( s ) ( 1 − π v ( s ) ) d s ≤ S = ∑ v ∗ ∫ min ( π v ( s ) , 1 − π v ( s ) ) d s .

There is an edge f of positive probability for which E e h ( d e / d f ) ≤ S .

Proof

For two threshold values the length of the interval where their indicators differ is | a e − a f | . At each level two independent draws disagree with probability 2 π v ( 1 − π v ) . The positive log of d e / d f and that of d f / d e sum to | a e − a f | . Exchanging e , f makes their expectations equal, cancelling the factor two. At any finite prime where all directions are units, every threshold is zero and both integrands vanish. Finally average first over e and then over f ; if every positive-mass f exceeded S , so would the double average.

Inspect the Lean declarations

PlanarUnitDistances.EdgeHeightScale.exists_reference_edge

∀ {E : Type u_1} [inst : Fintype E] {K : Type u_2} [inst_1 : Field K] [inst_2 : NumberField K] (p : E → ℝ),
  (∀ (e : E), 0 ≤ p e) →
    ∑ e, p e = 1 →
      ∀ (d : E → K),
        (∀ (e : E), d e ≠ 0) →
          ∀ (l u : AbsoluteValue K ℝ → ℝ),
            (∀ (v : AbsoluteValue K ℝ) (e : E), l v ≤ PlanarUnitDistances.EdgeHeightScale.threshold v d e) →
              (∀ (v : AbsoluteValue K ℝ) (e : E), PlanarUnitDistances.EdgeHeightScale.threshold v d e ≤ u v) →
                ∃ f,
                  0 < p f ∧
                    ∑ e, p e * PlanarUnitDistances.weilHeight (d e / d f) ≤
                      PlanarUnitDistances.EdgeHeightScale.placeSum
                        (PlanarUnitDistances.EdgeHeightScale.minorityIntegral p d l u)
Lean source · PlanarUnitDistances/EdgeHeightScale.lean, lines 98–130
/-- The reference direction is selected among edges of positive probability. -/
theorem exists_reference_edge (p : E → ℝ) (hp : ∀ e, 0 ≤ p e) (hs : ∑ e,p e = 1)
    (d : E → K) (hd : ∀ e, d e ≠ 0) (l u : AbsoluteValue K ℝ → ℝ)
    (hl : ∀ v e, l v ≤ threshold v d e) (hu : ∀ v e, threshold v d e ≤ u v) :
    ∃ f, 0 < p f ∧ (∑ e, p e * weilHeight (d e/d f)) ≤ placeSum (minorityIntegral p d l u) := by
  classical
  let S := placeSum (minorityIntegral p d l u)
  let F (f : E) := ∑ e, p e * weilHeight (d e/d f)
  have hav : (∑ f, p f * F f) ≤ S := by
    have h := expected_height_le_scale p hp hs d hd l u hl hu
    change _ ≤ S at h
    refine le_trans (le_of_eq ?_) h
    simp only [F,mul_sum]
    rw [sum_comm]
    apply sum_congr rfl
    intro e _
    apply sum_congr rfl
    intro f _
    ring
  obtain ⟨i,_,hi⟩ : ∃ i ∈ univ, 0 < p i := by
    by_contra! hh
    have z : ∀ i, p i = 0 := fun i => le_antisymm (hh i (mem_univ i)) (hp i)
    simp [z] at hs
  by_contra! hb
  have strict : (∑ f, p f * S) < ∑ f, p f * F f := by
    apply sum_lt_sum
    · intro f _
      by_cases hf : 0 < p f
      · exact mul_le_mul_of_nonneg_left (hb f hf).le (hp f)
      · simp [le_antisymm (le_of_not_gt hf) (hp f)]
    · exact ⟨i,mem_univ _,mul_lt_mul_of_pos_left (hb i hi) hi⟩
  rw [← sum_mul,hs,one_mul] at strict
  exact (not_lt_of_ge hav) strict

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.EdgeHeightScale.expected_height_eq_integral

∀ {E : Type u_1} [inst : Fintype E] {K : Type u_2} [inst_1 : Field K] [inst_2 : NumberField K] (p : E → ℝ),
  ∑ e, p e = 1 →
    ∀ (d : E → K),
      (∀ (e : E), d e ≠ 0) →
        ∀ (l u : AbsoluteValue K ℝ → ℝ),
          (∀ (v : AbsoluteValue K ℝ) (e : E), l v ≤ PlanarUnitDistances.EdgeHeightScale.threshold v d e) →
            (∀ (v : AbsoluteValue K ℝ) (e : E), PlanarUnitDistances.EdgeHeightScale.threshold v d e ≤ u v) →
              ∑ e, ∑ f, p e * p f * PlanarUnitDistances.weilHeight (d e / d f) =
                PlanarUnitDistances.EdgeHeightScale.placeSum
                  (PlanarUnitDistances.EdgeHeightScale.varianceIntegral p d l u)
Lean source · PlanarUnitDistances/EdgeHeightScale.lean, lines 55–63
theorem expected_height_eq_integral (p : E → ℝ) (hs : ∑ e,p e = 1)
    (d : E → K) (hd : ∀ e, d e ≠ 0) (l u : AbsoluteValue K ℝ → ℝ)
    (hl : ∀ v e, l v ≤ threshold v d e) (hu : ∀ v e, threshold v d e ≤ u v) :
    (∑ e, ∑ f, p e*p f*weilHeight (d e/d f)) = placeSum (varianceIntegral p d l u) := by
  rw [← Fintype.sum_prod_type (fun x : E × E => p x.1*p x.2*weilHeight (d x.1/d x.2))]
  rw [HeightTransfer.weighted_height_identity (fun x : E × E => p x.1*p x.2) (fun x => d x.1/d x.2)]
  unfold placeSum varianceIntegral
  simp only [InfinitePlace.coe_apply, FinitePlace.coe_apply,
    expected_local_height p hs d hd _ (hl _) (hu _)]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.EdgeHeightScale.expected_height_le_scale

∀ {E : Type u_1} [inst : Fintype E] {K : Type u_2} [inst_1 : Field K] [inst_2 : NumberField K] (p : E → ℝ),
  (∀ (e : E), 0 ≤ p e) →
    ∑ e, p e = 1 →
      ∀ (d : E → K),
        (∀ (e : E), d e ≠ 0) →
          ∀ (l u : AbsoluteValue K ℝ → ℝ),
            (∀ (v : AbsoluteValue K ℝ) (e : E), l v ≤ PlanarUnitDistances.EdgeHeightScale.threshold v d e) →
              (∀ (v : AbsoluteValue K ℝ) (e : E), PlanarUnitDistances.EdgeHeightScale.threshold v d e ≤ u v) →
                ∑ e, ∑ f, p e * p f * PlanarUnitDistances.weilHeight (d e / d f) ≤
                  PlanarUnitDistances.EdgeHeightScale.placeSum
                    (PlanarUnitDistances.EdgeHeightScale.minorityIntegral p d l u)
Lean source · PlanarUnitDistances/EdgeHeightScale.lean, lines 65–96
theorem expected_height_le_scale (p : E → ℝ) (hp : ∀ e, 0 ≤ p e) (hs : ∑ e,p e = 1)
    (d : E → K) (hd : ∀ e, d e ≠ 0) (l u : AbsoluteValue K ℝ → ℝ)
    (hl : ∀ v e, l v ≤ threshold v d e) (hu : ∀ v e, threshold v d e ≤ u v) :
    (∑ e, ∑ f, p e*p f*weilHeight (d e/d f)) ≤ placeSum (minorityIntegral p d l u) := by
  have local_bound (v : AbsoluteValue K ℝ) : varianceIntegral p d l u v ≤ minorityIntegral p d l u v := by
    have h := expected_distance_le p (threshold v d) hp hs (hl v) (hu v)
    rw [expected_distance_identity p (threshold v d) hs (hl v) (hu v)] at h
    exact le_of_mul_le_mul_left h (by norm_num)
  have finT (e : E) : Function.HasFiniteSupport (fun v : FinitePlace K => threshold v.val d e) := by
    apply (FinitePlace.hasFiniteMulSupport (hd e)).subset
    intro v hv
    change v (d e) ≠ 1
    intro he
    apply hv
    change -log (v (d e)) = 0
    simp [he]
  have finMinor : Function.HasFiniteSupport (fun v : FinitePlace K => minorityIntegral p d l u v.val) :=
    finiteSupport_minorIntegral p hs (fun e (v : FinitePlace K) => threshold v.val d e) finT
      (fun v => l v.val) (fun v => u v.val)
  have finVar : Function.HasFiniteSupport (fun v : FinitePlace K => varianceIntegral p d l u v.val) := by
    apply finiteSupport_profile (fun e (v : FinitePlace K) => threshold v.val d e) finT
      (fun v a => ∫ s in Icc (l v.val) (u v.val), frequency p a s * (1-frequency p a s))
    intro v
    have zeroAt (s : ℝ) : frequency p (fun _ => 0) s * (1-frequency p (fun _ => 0) s) = 0 := by
      simp only [frequency,← sum_mul,hs,one_mul,bit]
      split <;> norm_num
    simp only [zeroAt,integral_zero]
  rw [expected_height_eq_integral p hs d hd l u hl hu]
  unfold placeSum
  apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _)
  exact add_le_add (sum_le_sum fun v _ => mul_le_mul_of_nonneg_left (local_bound v.val) (Nat.cast_nonneg _))
    (finsum_le_finsum' finVar finMinor fun v => local_bound v.val)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.ThresholdProfiles.expected_distance_identity

∀ {E : Type u_1} [inst : Fintype E] (p a : E → ℝ),
  ∑ e, p e = 1 →
    ∀ {l u : ℝ},
      (∀ (e : E), l ≤ a e) →
        (∀ (e : E), a e ≤ u) →
          ∑ e, ∑ f, p e * p f * |a e - a f| =
            2 *
              ∫ (s : ℝ) in Set.Icc l u,
                OAI.PlanarUnitDistances.ThresholdProfiles.frequency p a s *
                  (1 - OAI.PlanarUnitDistances.ThresholdProfiles.frequency p a s)
Lean source · PlanarUnitDistances/ThresholdProfiles.lean, lines 133–139
lemma expected_distance_identity (p a : E → ℝ) (hs : ∑ e, p e = 1) {l u : ℝ}
    (hla : ∀ e, l ≤ a e) (hua : ∀ e, a e ≤ u) :
    (∑ e, ∑ f, p e*p f*|a e-a f|) =
      2 * ∫ s in Icc l u, frequency p a s * (1-frequency p a s) := by
  rw [← integrated_mismatch p a hla hua]
  simp_rw [independent_mismatch p hs,mul_assoc (2 : ℝ)]
  exact integral_const_mul _ _

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.10 One scale and one origin for all four means

Lean verified

Let ( Z p − Z q ) ( W p − W q ) = 1 on the support of the edge law and assume matching with constant 28 . If d 0 ≠ 0 satisfies E E h ( ( Z p − Z q ) / d 0 ) ≤ S , one can choose a point o so that

z x = ( Z x − Z o ) / d 0 , u x = d 0 ( W x − W o )

still satisfy the unit equation on each supported edge, and the sum of the point and center means of h ( z ) + h ( u ) is at most 226 ( S + 1 ) .

Proof

The second normalized edge difference is the inverse of the first, so its mean height is also at most S . Transfer gives 56 ( S + 1 ) for each independent point-pair difference. Average the sum of these two bounds over candidate origins. One origin makes the point mean at most 112 ( S + 1 ) . At each edge, subtract its coordinate difference from the translated point coordinate to recover the translated center coordinate. Its two heights cost at most the point contribution plus the two edge heights and 2 log ⁡ 2 . Averaging over the very same edge law gives at most 224 ( S + 1 ) + 2 S + 2 log ⁡ 2 ≤ 226 ( S + 1 ) for the four means.

Inspect the Lean declarations

PlanarUnitDistances.HeightTransfer.edge_scale_normalization

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] {P Q : Type} [inst_2 : Fintype P]
  [inst_3 : Fintype Q] {w : P → Q → ℝ},
  (∀ (p : P) (q : Q), 0 ≤ w p q) →
    ∑ p, ∑ q, w p q = 1 →
      OAI.PlanarUnitDistances.LocalHeightTransfer.LabelControl 28 w →
        ∀ (Z W : P ⊕ Q → K),
          (∀ (p : P) (q : Q),
              w p q ≠ 0 → (Z (Sum.inl p) - Z (Sum.inr q)) * (W (Sum.inl p) - W (Sum.inr q)) = 1) →
            ∀ {d₀ : K},
              d₀ ≠ 0 →
                ∀ {S : ℝ},
                  ∑ p, ∑ q, w p q * PlanarUnitDistances.weilHeight ((Z (Sum.inl p) - Z (Sum.inr q)) / d₀) ≤
                      S →
                    ∃ o,
                      have z := fun i => (Z i - Z (Sum.inl o)) / d₀;
                      have u := fun i => d₀ * (W i - W (Sum.inl o));
                      (∀ (p : P) (q : Q),
                          w p q ≠ 0 → (z (Sum.inl p) - z (Sum.inr q)) * (u (Sum.inl p) - u (Sum.inr q)) = 1) ∧
                        ∑ p,
                              OAI.PlanarUnitDistances.LocalHeightTransfer.left w p *
                                (PlanarUnitDistances.weilHeight (z (Sum.inl p)) +
                                  PlanarUnitDistances.weilHeight (u (Sum.inl p))) +
                            ∑ q,
                              (∑ p, w p q) *
                                (PlanarUnitDistances.weilHeight (z (Sum.inr q)) +
                                  PlanarUnitDistances.weilHeight (u (Sum.inr q))) ≤
                          226 * (S + 1)
Lean source · PlanarUnitDistances/HeightNormalization.lean, lines 79–121
/-- Rescaling about an edge uses reciprocal scale factors. On the support of the
edge law the second normalized difference is the inverse of the first. -/
theorem edge_scale_normalization {w : P → Q → ℝ} (hw : ∀ p q, 0 ≤ w p q)
    (hs : ∑ p, ∑ q, w p q = 1) (hc : LabelControl 28 w) (Z W : P ⊕ Q → K)
    (unitEdge : ∀ p q, w p q ≠ 0 →
      (Z (.inl p) - Z (.inr q)) * (W (.inl p) - W (.inr q)) = 1)
    {d₀ : K} (hd : d₀ ≠ 0) {S : ℝ}
    (scale : (∑ p, ∑ q, w p q * weilHeight ((Z (.inl p) - Z (.inr q))/d₀)) ≤ S) :
    ∃ o : P,
      let z := fun i : P ⊕ Q => (Z i - Z (.inl o))/d₀
      let u := fun i : P ⊕ Q => d₀*(W i - W (.inl o))
      (∀ p q, w p q ≠ 0 → (z (.inl p)-z (.inr q))*(u (.inl p)-u (.inr q))=1) ∧
      (∑ p, left w p * (weilHeight (z (.inl p)) + weilHeight (u (.inl p)))) +
      (∑ q, (∑ p, w p q) * (weilHeight (z (.inr q)) + weilHeight (u (.inr q)))) ≤
      226*(S+1) := by
  let z := fun i => Z i / d₀
  let u := fun i => d₀ * W i
  have eprod (p q) (h : w p q ≠ 0) :
      (z (.inl p) - z (.inr q))*(u (.inl p) - u (.inr q)) = 1 := by
    dsimp [z,u]
    rw [← sub_div,← mul_sub]
    calc
      _ = (Z (.inl p)-Z (.inr q))*(W (.inl p)-W (.inr q)) := by field_simp
      _ = _ := unitEdge p q h
  have hz : (∑ p, ∑ q, w p q * weilHeight (z (.inl p)-z (.inr q))) ≤ S := by
    simpa only [z,← sub_div] using scale
  have hu : (∑ p, ∑ q, w p q * weilHeight (u (.inl p)-u (.inr q))) ≤ S := by
    refine le_trans (le_of_eq ?_) hz
    apply sum_congr rfl
    intro p _
    apply sum_congr rfl
    intro q _
    by_cases h : w p q = 0
    · simp [h]
    · have hi := inv_eq_of_mul_eq_one_right (eprod p q h)
      rw [← hi,weilHeight_inv]
  obtain ⟨o,ho⟩ := normalized_four_means hw hs hc z u hz hu
  refine ⟨o, ?_, ?_⟩
  · intro p q h
    convert eprod p q h using 1
    dsimp only [z,u]
    ring
  · simpa only [z,u,← sub_div,← mul_sub] using ho

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.HeightTransfer.normalized_four_means

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] {P Q : Type} [inst_2 : Fintype P]
  [inst_3 : Fintype Q] {w : P → Q → ℝ},
  (∀ (p : P) (q : Q), 0 ≤ w p q) →
    ∑ p, ∑ q, w p q = 1 →
      OAI.PlanarUnitDistances.LocalHeightTransfer.LabelControl 28 w →
        ∀ (Z W : P ⊕ Q → K) {S : ℝ},
          ∑ p, ∑ q, w p q * PlanarUnitDistances.weilHeight (Z (Sum.inl p) - Z (Sum.inr q)) ≤ S →
            ∑ p, ∑ q, w p q * PlanarUnitDistances.weilHeight (W (Sum.inl p) - W (Sum.inr q)) ≤ S →
              ∃ o,
                ∑ p,
                      OAI.PlanarUnitDistances.LocalHeightTransfer.left w p *
                        (PlanarUnitDistances.weilHeight (Z (Sum.inl p) - Z (Sum.inl o)) +
                          PlanarUnitDistances.weilHeight (W (Sum.inl p) - W (Sum.inl o))) +
                    ∑ q,
                      (∑ p, w p q) *
                        (PlanarUnitDistances.weilHeight (Z (Sum.inr q) - Z (Sum.inl o)) +
                          PlanarUnitDistances.weilHeight (W (Sum.inr q) - W (Sum.inl o))) ≤
                  226 * (S + 1)
Lean source · PlanarUnitDistances/HeightNormalization.lean, lines 24–77
/-- A single origin works for both coordinates and for both sides. The point and
center averages below are taken using the two marginals of the same edge law. -/
theorem normalized_four_means {w : P → Q → ℝ} (hw : ∀ p q, 0 ≤ w p q)
    (hs : ∑ p, ∑ q, w p q = 1) (hc : LabelControl 28 w) (Z W : P ⊕ Q → K) {S : ℝ}
    (hz : (∑ p, ∑ q, w p q * weilHeight (Z (.inl p) - Z (.inr q))) ≤ S)
    (hw' : (∑ p, ∑ q, w p q * weilHeight (W (.inl p) - W (.inr q))) ≤ S) :
    ∃ o : P,
      (∑ p, left w p * (weilHeight (Z (.inl p) - Z (.inl o)) +
        weilHeight (W (.inl p) - W (.inl o)))) +
      (∑ q, (∑ p, w p q) * (weilHeight (Z (.inr q) - Z (.inl o)) +
        weilHeight (W (.inr q) - W (.inl o)))) ≤ 226*(S+1) := by
  classical
  let D (x y : P ⊕ Q) :=
    weilHeight (Z x - Z y) + weilHeight (W x - W y)
  have hcZ := coordinate_height_transfer (by norm_num : (1:ℝ) ≤ 28) hw hs hc Z
  have hcW := coordinate_height_transfer (by norm_num : (1:ℝ) ≤ 28) hw hs hc W
  have hp : (∑ o, left w o * ∑ p, left w p * D (.inl p) (.inl o)) ≤ 112*(S+1) := by
    rw [show (∑ o, left w o * ∑ p, left w p * D (.inl p) (.inl o)) =
      ∑ p, ∑ o, left w p * left w o * D (.inl p) (.inl o) by
        simp only [mul_sum]
        rw [sum_comm]
        apply sum_congr rfl
        intro p _
        apply sum_congr rfl
        intro o _
        ring]
    simp only [D,mul_add,sum_add_distrib]
    linarith
  obtain ⟨o, ho⟩ := average_anchor (left w) (fun o => ∑ p, left w p * D (.inl p) (.inl o))
    (left_nonneg hw) hs
  refine ⟨o,?_⟩
  let pt := ∑ p, left w p * D (.inl p) (.inl o)
  have small : pt ≤ 112*(S+1) := ho.trans hp
  have on_edge (p : P) (q : Q) :
      D (.inr q) (.inl o) ≤ D (.inl p) (.inl o) + D (.inl p) (.inr q) + 2*log 2 := by
    have bound (U : P ⊕ Q → K) := weilHeight_sub
      (U (.inl p)-U (.inl o)) (U (.inl p)-U (.inr q))
    have identity (U : P ⊕ Q → K) :
        (U (.inl p)-U (.inl o))-(U (.inl p)-U (.inr q)) = U (.inr q)-U (.inl o) := by ring
    simp only [identity] at bound
    dsimp only [D]
    linarith [bound Z,bound W]
  have hcent : (∑ q, (∑ p, w p q) * D (.inr q) (.inl o)) ≤ pt + 2*S + 2*log 2 := by
    calc
      _ = ∑ p, ∑ q, w p q * D (.inr q) (.inl o) := by simp only [sum_mul]; rw [sum_comm]
      _ ≤ ∑ p, ∑ q, w p q * (D (.inl p) (.inl o) + D (.inl p) (.inr q) + 2*log 2) :=
        sum_le_sum fun p _ => sum_le_sum fun q _ => mul_le_mul_of_nonneg_left (on_edge p q) (hw p q)
      _ = pt + ((∑ p, ∑ q, w p q * weilHeight (Z (.inl p) - Z (.inr q))) +
        (∑ p, ∑ q, w p q * weilHeight (W (.inl p) - W (.inr q)))) + 2*log 2 := by
        simp only [D,pt,left,mul_add,sum_add_distrib,← sum_mul,hs,one_mul]
      _ ≤ _ := by linarith
  have hlog := Real.log_le_sub_one_of_pos (by norm_num : (0:ℝ) < 2)
  change pt + (∑ q, (∑ p, w p q) * D (.inr q) (.inl o)) ≤ _
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

3.3 A predictor chosen before the test

Lemma 3.11 One history for a vector-valued test

Lean verified

Let a center q have law κ and let p , r be independent neighbors with the same conditional law given q . Write D = I ( p ; r ) . A fresh, independent test T supplies a code c T ( p ) with M possible values and a vector f T ( c T ( p ) ) of norm at most B . For every integer K ≥ 1 , one can fix fewer than K earlier tests with a transcript H taking at most M K − 1 values so that

E T , q ‖ E p ∣ q [ f T ( c T ( p ) ) − E x ∣ H ( x ) = H ( p ) f T ( c T ( x ) ) ] ‖ ≤ 4 B ( D / K ) 1 / 4 .

The statement in Lean specifies measurability of the codes and of the integrated discrepancy. Finite test spaces with their discrete structures satisfy these requirements.

Proof

Freeze a sequence of tests. The divergence increments for successive transcript pairs telescope to at most D . Conditional independence at the center turns the expected inner product of two residuals into the squared norm of their conditional mean. Pair that mean with its own normalized direction, taking zero at zero. This recovers the norm with a vector of norm at most one. The bound for frozen tests now survives averaging over the independent tests. Some actual prefix has the desired fresh-test expectation. Taking the norm before selecting the prefix permits later center-dependent pairings of the same predictor.

Inspect the Lean declarations

OAI.PlanarUnitDistances.FiniteInformation.exists_vector_prediction_history

∀ {P : Type u_1} {Q : Type u_2} {C : Type u_3} {V : Type u_4} [inst : Fintype P] [inst_1 : Fintype Q]
  [inst_2 : Fintype C] [inst_3 : DecidableEq C] [inst_4 : NormedAddCommGroup V]
  [inst_5 : InnerProductSpace ℝ V] [inst_6 : MeasurableSpace C] {T : Type u_6} [inst_7 : MeasurableSpace T]
  {ν : MeasureTheory.Measure T} [MeasureTheory.IsProbabilityMeasure ν] [Nonempty C] (κ : Q → ℝ)
  (w : Q → P → ℝ),
  (∀ (q : Q), 0 ≤ κ q) →
    (∀ (q : Q) (p : P), 0 ≤ w q p) →
      ∑ q, κ q = 1 →
        (∀ (q : Q), ∑ p, w q p = 1) →
          ∀ (c : T → P → C) (v : T → C → V),
            (∀ (p : P), Measurable fun t => c t p) →
              (∀ (n : ℕ),
                  Measurable fun z =>
                    OAI.PlanarUnitDistances.FiniteInformation.predictionNorm κ w z.1 (c z.2) (v z.2)) →
                ∀ {B : ℝ},
                  0 ≤ B →
                    (∀ (t : T) (c : C), ‖v t c‖ ≤ B) →
                      ∀ (K : ℕ),
                        0 < K →
                          ∃ n < K,
                            ∃ tPast,
                              have h :=
                                OAI.PlanarUnitDistances.FiniteInformation.transcript (fun j => c (tPast j)) n;
                              (Finset.image h Finset.univ).card ≤ Fintype.card C ^ (K - 1) ∧
                                ∫ (t : T),
                                    OAI.PlanarUnitDistances.FiniteInformation.predictionNorm κ w h (c t)
                                      (v t) ∂ν ≤
                                  4 * B *
                                    ((OAI.PlanarUnitDistances.FiniteInformation.KL
                                          (OAI.PlanarUnitDistances.FiniteInformation.wedge κ w) fun pr =>
                                          OAI.PlanarUnitDistances.FiniteInformation.marginal κ w pr.1 *
                                            OAI.PlanarUnitDistances.FiniteInformation.marginal κ w pr.2) /
                                        ↑K) ^
                                      (1 / 4)
Lean source · PlanarUnitDistances/Prediction.lean, lines 108–164
theorem exists_vector_prediction_history [Nonempty C]
    (κ : Q → ℝ) (w : Q → P → ℝ)
    (hκ : ∀ q, 0 ≤ κ q) (hw : ∀ q p, 0 ≤ w q p)
    (hsκ : ∑ q, κ q = 1) (hsw : ∀ q, ∑ p, w q p = 1)
    (c : T → P → C) (v : T → C → V)
    (hc : ∀ p, Measurable (fun t => c t p))
    (hδ : ∀ n, Measurable (fun z : (P → History C n) × T =>
      predictionNorm κ w z.1 (c z.2) (v z.2)))
    {B : ℝ} (hB : 0 ≤ B)
    (hv : ∀ t c, ‖v t c‖ ≤ B)
    (K : ℕ) (hK : 0 < K) :
    ∃ n < K, ∃ tPast : ℕ → T,
      let h := transcript (fun j => c (tPast j)) n
      (univ.image h).card ≤ (Fintype.card C)^(K-1) ∧
      (∫ t, predictionNorm κ w h (c t) (v t) ∂ν) ≤
        4*B*(KL (wedge κ w)
          (fun pr : P × P => marginal κ w pr.1 * marginal κ w pr.2)/(K:ℝ))^(1/4:ℝ) := by
  classical
  let ρ : Measure (ℕ → T) := Measure.infinitePi (fun _ : ℕ => ν)
  let tests := fun n (ω : ℕ → T) => ω n
  have ht : ∀ n, Measurable (tests n) := fun n => measurable_pi_apply n
  have hind : iIndepFun tests ρ := iIndepFun_infinitePi (fun _ => measurable_id)
  have hlaw : ∀ n, ρ.map (tests n) = ν := fun n =>
    (measurePreserving_eval_infinitePi (fun _ : ℕ => ν) n).map_eq
  let t0 : T := Classical.choice (nonempty_of_isProbabilityMeasure ν)
  have hpred := random_norm_prediction κ w hκ hw hsκ hsw tests ht hind hlaw t0 c v hc hδ
    hB hv K hK
  have hD : 0 ≤ KL (wedge κ w) (fun pr : P × P => marginal κ w pr.1 * marginal κ w pr.2) := by
    have hm := marginal_nonneg κ w hκ hw
    have hs := marginal_sum κ w hsκ hsw
    apply KL_nonneg _ _ (wedge_nonneg κ w hκ hw) (fun pr => mul_nonneg (hm _) (hm _))
      (wedge_sum κ w hsκ hsw) _ (wedge_ac κ w hκ hw)
    rw [Fintype.sum_prod_type, ← sum_mul_sum, hs, one_mul]
  rw [sqrt_sqrt_eq_quarter (div_nonneg hD (Nat.cast_nonneg K))] at hpred
  let R := 4*B*(KL (wedge κ w)
    (fun pr : P × P => marginal κ w pr.1 * marginal κ w pr.2)/(K:ℝ))^(1/4:ℝ)
  let H := fun n ω p => transcript (fun k => c (tests k ω)) n p
  let F := fun n (ω : ℕ → T) => ∫ t, predictionNorm κ w (H n ω) (c t) (v t) ∂ν
  have hsum : (∑ n ∈ range K, ∫ ω, F n ω ∂ρ) ≤ ∑ _ ∈ range K, R := by
    have he := (div_le_iff₀ (show (0:ℝ) < K by exact_mod_cast hK)).mp hpred
    simpa only [sum_const, card_range, nsmul_eq_mul, mul_comm, R, F, H] using he
  obtain ⟨n,hn,hnb⟩ := exists_le_of_sum_le (nonempty_range_iff.mpr (Nat.ne_of_gt hK)) hsum
  have hH : Measurable (H n) := measurable_transcript _ (fun k p => (hc p).comp (ht k)) n
  have hpair : Measurable (fun z : (ℕ → T) × T => (H n z.1,z.2)) :=
    (hH.comp measurable_fst).prodMk measurable_snd
  have hi : Integrable (fun z : (ℕ → T) × T =>
      predictionNorm κ w (H n z.1) (c z.2) (v z.2)) (ρ.prod ν) :=
    Integrable.of_bound ((hδ n).comp hpair).aestronglyMeasurable (2*B)
      (Filter.Eventually.of_forall fun z => predictionNorm_bound κ w hκ hw hsκ hsw
        (H n z.1) (c z.2) (v z.2) hB (hv z.2))
  obtain ⟨ω,hω⟩ := exists_le_integral hi.integral_prod_left
  have hn' : n < K := mem_range.mp hn
  refine ⟨n,hn',ω,?_,hω.trans hnb⟩
  calc
    _ ≤ Fintype.card (History C n) := card_le_univ _
    _ = (Fintype.card C)^n := history_card C n
    _ ≤ _ := Nat.pow_le_pow_right Fintype.card_pos (by omega)

Kernel axioms used: propext, Classical.choice, Quot.sound.

3.4 The number of codes accepted by a circle

For a height budget H ≥ 1000 , set R = e 6 H , η = e − 7 H , τ = η / ( 16 R ) , and N = ⌈ 2 R / τ ⌉ . At an embedding, each of the four real components of ( z , w ) receives one of N grid indices. A point outside the modulus bound receives an overflow symbol. A bounded center accepts overflow and cells inhabited by genuine neighbors.

Lemma 3.12 The number of accepted codes

Lean verified

For a bounded center, the code space has N 4 + 1 symbols and at most 32 N 2 + 1 symbols are accepted.

Proof

Split the reciprocal curve according as | Z − Z q | ≥ 1 or | Z − Z q | < 1 . On the first part, subtraction of reciprocals gives | W 1 − W 2 | ≤ | Z 1 − Z 2 | . For fixed complex Z -cell there are at most sixteen possible W -cells. On the other part use the symmetric estimate with Z , W interchanged. There are N 2 complex cells in each projection and one overflow symbol. The endpoint of the final mesh interval belongs to that interval.

Inspect the Lean declarations

PlanarUnitDistances.CircleCells.accepted_card_le

∀ {ι : Type u_1} (S : Finset ι) (z w : ι → ℂ) (c d : ℂ) {R : ℝ} {N : ℕ},
  0 < R →
    ∀ (hN : 0 < N),
      (∀ i ∈ S, (z i - c) * (w i - d) = 1) →
        (PlanarUnitDistances.CircleCells.accepted S z w R N hN).card ≤ 32 * N ^ 2 + 1
Lean source · PlanarUnitDistances/CircleCells.lean, lines 213–253
/-- Sharp bookkeeping of the manuscript's test alphabet. -/
theorem accepted_card_le {ι : Type*} (S : Finset ι) (z w : ι → ℂ) (c d : ℂ)
    {R : ℝ} {N : ℕ} (hR : 0 < R) (hN : 0 < N)
    (true_edge : ∀ i ∈ S, (z i-c)*(w i-d) = 1) :
    (accepted S z w R N hN).card ≤ 32*N^2+1 := by
  classical
  let S₀ := S.filter fun i => ‖z i‖ ≤ R ∧ ‖w i‖ ≤ R
  let U := S₀.filter fun i => 1 ≤ ‖z i-c‖
  let V := S₀.filter fun i => ¬ 1 ≤ ‖z i-c‖
  let f i := (cell R N hN (z i), cell R N hN (w i))
  have uf : (U.image f).card ≤ 16*N^2 := by
    apply branch_count U z w hR hN
    · intro i hi; exact (mem_filter.mp (mem_filter.mp hi).1).2
    · intro i hi j hj
      exact reciprocal_contraction _ _ _ _ _ _ (true_edge i (mem_filter.mp (mem_filter.mp hi).1).1)
        (true_edge j (mem_filter.mp (mem_filter.mp hj).1).1) (mem_filter.mp hi).2 (mem_filter.mp hj).2
  have flip (i) (hi : i ∈ V) : 1 ≤ ‖w i-d‖ := by
    obtain ⟨hi₀,hz⟩ := mem_filter.mp hi
    have h := congrArg norm (true_edge i (mem_filter.mp hi₀).1)
    rw [norm_mul, norm_one] at h
    by_contra! hw
    have ht := mul_le_mul_of_nonneg_right (le_of_lt (lt_of_not_ge hz)) (norm_nonneg (w i-d))
    rw [one_mul] at ht
    linarith
  have vv : (V.image fun i => (f i).swap).card ≤ 16*N^2 := by
    apply branch_count V w z hR hN
    · intro i hi; exact (mem_filter.mp (mem_filter.mp hi).1).2.symm
    · intro i hi j hj
      exact reciprocal_contraction _ _ _ _ _ _ ((mul_comm _ _).trans
        (true_edge i (mem_filter.mp (mem_filter.mp hi).1).1)) ((mul_comm _ _).trans
        (true_edge j (mem_filter.mp (mem_filter.mp hj).1).1)) (flip i hi) (flip j hj)
  have vf : (V.image f).card ≤ 16*N^2 := by
    rw [← card_image_of_injective (V.image f) (f := Prod.swap) Prod.swap_injective]
    simpa [Finset.image_image, Function.comp_def] using vv
  have split : S₀ = U ∪ V := (filter_union_filter_not_eq _ _).symm
  have hc : (boundedCells S z w R N hN).card ≤ 32*N^2 := by
    change (S₀.image f).card ≤ _
    rw [split, image_union]
    exact (card_union_le _ _).trans (by omega)
  exact (card_insert_le _ _).trans
    (Nat.add_le_add_right ((card_image_le).trans hc) 1)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CircleCells.alphabet_card

∀ (N : ℕ),
  Fintype.card (Option (PlanarUnitDistances.CircleCells.Cell N × PlanarUnitDistances.CircleCells.Cell N)) =
    N ^ 4 + 1
Lean source · PlanarUnitDistances/CircleCells.lean, lines 208–211
/-- The real and imaginary parts of each bounded coordinate give four
indices in Fin N, beside one common overflow symbol. -/
theorem alphabet_card (N : ℕ) : Fintype.card (Option (Cell N × Cell N)) = N^4+1 := by
  simp [Cell]; ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.13 From an accepted bounded cell to an arithmetic residual

Lean verified

Fix a point and a center with coordinates a , b , c , d in one number field. Write F = ( a − c ) ( b − d ) − 1 , and suppose F ≠ 0 . At a uniform embedding test the actual code against the cells of the center’s genuine neighbors. If the mesh width ℓ satisfies 8 R ℓ ≤ e − s with s > 0 , the probability that the four coordinates are bounded by R and the code is accepted is at most h ( F ) / s .

Proof

For a bounded accepted cell choose the neighbor whose coordinates z , w occupy it. The differences in each complex coordinate have norm at most 2 ℓ . Expand

F = ( a − z ) ( b − d ) + ( z − c ) ( b − w ) .

The factors b − d , z − c have norm at most 2 R , giving | F | ≤ 8 R ℓ . With the manuscript’s choice ℓ ≤ η / ( 16 R ) this is already at most η / 2 . Thus no sharp complex-cell diameter is needed. If F ≠ 0 , apply Lemma 3.2 to the actual embeddings passing the bounded test. Lemma 3.15 includes overflow and averages this estimate over the predicted point and the center.

Inspect the Lean declarations

PlanarUnitDistances.CircleCells.bounded_false_acceptance

∀ {K : Type u_1} {ι : Type u_2} [inst : Field K] [inst_1 : NumberField K] (S : Finset ι) (z w : ι → K)
  (a b c d : K),
  (∀ i ∈ S, (z i - c) * (w i - d) = 1) →
    (a - c) * (b - d) - 1 ≠ 0 →
      ∀ {R s : ℝ} {N : ℕ},
        0 < R →
          0 < s →
            ∀ (hN : 0 < N),
              8 * R * PlanarUnitDistances.CircleCells.width R N ≤ Real.exp (-s) →
                have E :=
                  {φ |
                    ‖φ a‖ ≤ R ∧
                      ‖φ b‖ ≤ R ∧
                        ‖φ c‖ ≤ R ∧
                          ‖φ d‖ ≤ R ∧
                            PlanarUnitDistances.CircleCells.code R N hN (φ a) (φ b) ∈
                              PlanarUnitDistances.CircleCells.accepted S (⇑φ ∘ z) (⇑φ ∘ w) R N hN};
                ↑E.card / ↑(Module.finrank ℚ K) ≤ PlanarUnitDistances.weilHeight ((a - c) * (b - d) - 1) / s
Lean source · PlanarUnitDistances/ResidualTest.lean, lines 40–69
/-- At a *uniform number-field embedding*, for a fixed nonedge, bound the
fraction of embeddings where all four coordinates are bounded and the actual
acceptance test passes. This is the component before averaging a coupling
and adding the probability of overflow. -/
theorem bounded_false_acceptance {K ι : Type*} [Field K] [NumberField K]
    (S : Finset ι) (z w : ι → K) (a b c d : K)
    (hedge : ∀ i ∈ S, (z i-c)*(w i-d) = 1) (hfalse : (a-c)*(b-d)-1 ≠ 0)
    {R s : ℝ} {N : ℕ} (hR : 0 < R) (hs : 0 < s) (hN : 0 < N)
    (hmesh : 8*R*width R N ≤ exp (-s)) :
    let E := univ.filter fun φ : K →+* ℂ =>
      ‖φ a‖ ≤ R ∧ ‖φ b‖ ≤ R ∧ ‖φ c‖ ≤ R ∧ ‖φ d‖ ≤ R ∧
      code R N hN (φ a) (φ b) ∈ accepted S (φ ∘ z) (φ ∘ w) R N hN
    (E.card : ℝ) / (Module.finrank ℚ K : ℝ) ≤ weilHeight ((a-c)*(b-d)-1) / s := by
  classical
  let F := (a-c)*(b-d)-1
  let small := univ.filter fun φ : K →+* ℂ => ‖φ F‖ ≤ exp (-s)
  intro E
  have hsub : E ⊆ small := by
    intro φ hφ
    obtain ⟨_,ha,hb,hc,hd,haccept⟩ := mem_filter.mp hφ
    have hk (i : ι) (hi : i ∈ S) :
        ((φ ∘ z) i-φ c)*((φ ∘ w) i-φ d) = 1 := by
      simpa using congrArg φ (hedge i hi)
    apply mem_filter.mpr ⟨mem_univ _, ?_⟩
    simpa [F] using (bounded_accepted_residual S _ _ hR hN _ _ _ _
      ha hb hc hd hk haccept).trans hmesh
  calc
    _ ≤ (small.card : ℝ) / (Module.finrank ℚ K : ℝ) := by
      exact div_le_div_of_nonneg_right (Nat.cast_le.mpr (card_le_card hsub)) (Nat.cast_nonneg _)
    _ ≤ _ := small_embedding_fraction hfalse hs

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CircleCells.bounded_accepted_residual

∀ {ι : Type u_1} (S : Finset ι) (z w : ι → ℂ) {R : ℝ} {N : ℕ},
  0 < R →
    ∀ (hN : 0 < N) (a b c d : ℂ),
      ‖a‖ ≤ R →
        ‖b‖ ≤ R →
          ‖c‖ ≤ R →
            ‖d‖ ≤ R →
              (∀ i ∈ S, (z i - c) * (w i - d) = 1) →
                PlanarUnitDistances.CircleCells.code R N hN a b ∈
                    PlanarUnitDistances.CircleCells.accepted S z w R N hN →
                  ‖(a - c) * (b - d) - 1‖ ≤ 8 * R * PlanarUnitDistances.CircleCells.width R N
Lean source · PlanarUnitDistances/ResidualTest.lean, lines 10–38
/-- A bounded accepted query has a genuine neighbor in the same pair of
cells. A diameter bound of twice the mesh width suffices in each coordinate. -/
theorem bounded_accepted_residual {ι : Type*} (S : Finset ι) (z w : ι → ℂ)
    {R : ℝ} {N : ℕ} (hR : 0 < R) (hN : 0 < N) (a b c d : ℂ)
    (ha : ‖a‖ ≤ R) (hb : ‖b‖ ≤ R) (hc : ‖c‖ ≤ R) (hd : ‖d‖ ≤ R)
    (hedge : ∀ i ∈ S, (z i-c)*(w i-d) = 1)
    (haccept : code R N hN a b ∈ accepted S z w R N hN) :
    ‖(a-c)*(b-d)-1‖ ≤ 8 * R * width R N := by
  classical
  rw [code, if_pos ⟨ha,hb⟩, accepted] at haccept
  obtain h | h := mem_insert.mp haccept
  · contradiction
  obtain ⟨t,ht,ht'⟩ := mem_image.mp h
  obtain ⟨i,hi,hpair⟩ := mem_image.mp ht
  obtain ⟨hiS,hz,hw⟩ := mem_filter.mp hi
  have hp := hpair.trans (Option.some.inj ht')
  have hnz := same_cell_near hR hN ha hz (congrArg Prod.fst hp.symm)
  have hnw := same_cell_near hR hN hb hw (congrArg Prod.snd hp.symm)
  have hbd : ‖b-d‖ ≤ 2*R := (norm_sub_le b d).trans (by linarith)
  have hzc : ‖z i-c‖ ≤ 2*R := (norm_sub_le (z i) c).trans (by linarith)
  have he : (a-c)*(b-d)-1 = (a-z i)*(b-d) + (z i-c)*(b-w i) := by
    rw [← hedge i hiS]
    ring
  rw [he]
  apply (norm_add_le _ _).trans
  rw [norm_mul, norm_mul]
  have h₁ := mul_le_mul hnz hbd (norm_nonneg _) (by unfold width; positivity : 0 ≤ 2 * width R N)
  have h₂ := mul_le_mul hzc hnw (norm_nonneg _) (by positivity : 0 ≤ 2*R)
  nlinarith only [h₁,h₂]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.14 Prediction for the actual circle test

Lean verified

Let w ( q , p ) be the conditional point law at center q , supported on its true neighbors, and take one of the [ K : Q ] complex embeddings uniformly. Use N ≥ 1 intervals per real component and write M = N 4 + 1 . For each L ≥ 1 there is a record map with at most M L − 1 occupied records such that the following experiment rejects with probability at most 36 N ( D / L ) 1 / 4 . Draw ( q , p ) from the true edge law. Given p , independently resample r from the point marginal conditional on the record of p . Test r against q at a fresh uniform embedding. A center coordinate above the cutoff accepts automatically. Every other center uses the accepted set in Lemma 3.12.

Proof

Represent a point code c by ( 1 , e c ) . Use ( 1 , 0 ) for an overflowing center and ( 0 , 1 A ) for a bounded center with accepted set A . The inner product is the indicator of acceptance, and the product of the two norm bounds is at most 9 N because | A | ≤ 32 N 2 + 1 . True neighbors always pass. The finite-information estimate applied to these specified vectors gives the bound. The average in Lean runs over the embeddings of the coordinate field itself.

Inspect the Lean declarations

PlanarUnitDistances.BoundedHeight.exists_circle_history

∀ {P : Type u_1} {Q : Type u_2} {F : Type u_3} [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : Field F]
  [inst_3 : NumberField F] (κ : Q → ℝ) (w : Q → P → ℝ),
  (∀ (q : Q), 0 ≤ κ q) →
    (∀ (q : Q) (p : P), 0 ≤ w q p) →
      ∑ q, κ q = 1 →
        (∀ (q : Q), ∑ p, w q p = 1) →
          ∀ (zp wp : P → F) (zq wq : Q → F) (S : Q → Finset P),
            (∀ (q : Q) (p : P), w q p ≠ 0 → p ∈ S q) →
              (∀ (q : Q), ∀ p ∈ S q, (zp p - zq q) * (wp p - wq q) = 1) →
                ∀ {a : ℝ} {N L : ℕ} (hN : 0 < N),
                  0 < L →
                    ∃ n < L,
                      ∃ hist,
                        (Finset.image hist Finset.univ).card ≤ (N ^ 4 + 1) ^ (L - 1) ∧
                          1 -
                              (∑ t,
                                  ∑ q,
                                    κ q *
                                      ∑ p,
                                        w q p *
                                          ∑ r,
                                            OAI.PlanarUnitDistances.FiniteInformation.posterior
                                                (OAI.PlanarUnitDistances.FiniteInformation.marginal κ w) hist
                                                (hist p) r *
                                              if
                                                  PlanarUnitDistances.BoundedHeight.passes (S q) zp wp (zp r)
                                                    (wp r) (zq q) (wq q) (Real.exp a) N hN t then
                                                1
                                              else 0) /
                                ↑(Module.finrank ℚ F) ≤
                            36 * ↑N *
                              ((OAI.PlanarUnitDistances.FiniteInformation.KL
                                    (OAI.PlanarUnitDistances.FiniteInformation.wedge κ w) fun pr =>
                                    OAI.PlanarUnitDistances.FiniteInformation.marginal κ w pr.1 *
                                      OAI.PlanarUnitDistances.FiniteInformation.marginal κ w pr.2) /
                                  ↑L) ^
                                (1 / 4)
Lean source · PlanarUnitDistances/CirclePrediction.lean, lines 10–60
/-- The fresh test is a uniform embedding of the actual coordinate field.
The transcript is chosen for the circle predicates and the given edge law. -/
theorem exists_circle_history {P Q F : Type*} [Fintype P] [Fintype Q] [Field F] [NumberField F]
    (κ : Q → ℝ) (w : Q → P → ℝ) (hk : ∀ q, 0 ≤ κ q) (hw : ∀ q p, 0 ≤ w q p)
    (hsκ : ∑ q, κ q = 1) (hsw : ∀ q, ∑ p, w q p = 1)
    (zp wp : P → F) (zq wq : Q → F) (S : Q → Finset P)
    (hsup : ∀ q p, w q p ≠ 0 → p ∈ S q)
    (hedge : ∀ q p, p ∈ S q → (zp p-zq q)*(wp p-wq q) = 1)
    {a : ℝ} {N L : ℕ} (hN : 0 < N) (hL : 0 < L) :
    ∃ n < L, ∃ hist : P → History (Option (Cell N × Cell N)) n,
      (Finset.univ.image hist).card ≤ (N^4+1)^(L-1) ∧
      1 - (∑ t : F →+* ℂ, ∑ q, κ q * ∑ p, w q p * ∑ r,
        posterior (marginal κ w) hist (hist p) r *
        (if passes (S q) zp wp (zp r) (wp r) (zq q) (wq q) (exp a) N hN t then 1 else 0)) /
        Module.finrank ℚ F ≤
      36*N*(KL (wedge κ w) (fun pr : P×P => marginal κ w pr.1*marginal κ w pr.2)/(L:ℝ))^(1/4:ℝ) := by
  classical
  let Z (t : F →+* ℂ) (p : P) := t (zp p)
  let W (t : F →+* ℂ) (p : P) := t (wp p)
  let flag (t : F →+* ℂ) (q : Q) := exp a < ‖t (zq q)‖ ∨ exp a < ‖t (wq q)‖
  let B t q := accepted (S q) (Z t) (W t) (exp a) N hN
  let c t p := code (exp a) N hN (Z t p) (W t p)
  have card (t : F →+* ℂ) (q : Q) : (B t q).card ≤ 32*N^2+1 := by
    apply accepted_card_le (S q) (Z t) (W t) (t (zq q)) (t (wq q)) (exp_pos a) hN
    intro p hp
    simpa [Z,W] using congrArg t (hedge q p hp)
  have ever (t : F →+* ℂ) (q : Q) (p : P) (hp : w q p ≠ 0) : flag t q ∨ c t p ∈ B t q :=
    Or.inr (code_mem_accepted (S q) (Z t) (W t) (exp a) N hN (hsup q p hp))
  obtain ⟨n,hn,h,hsize,bd⟩ := exists_sparse_test_history κ w hk hw hsκ hsw c flag B N L hN hL card ever
  refine ⟨n,hn,h,?_,?_⟩
  · simpa only [alphabet_card] using hsize
  · have eqv (t : F →+* ℂ) (q : Q) (r : P) : (flag t q ∨ c t r ∈ B t q) ↔
          passes (S q) zp wp (zp r) (wp r) (zq q) (wq q) (exp a) N hN t := by
        simp only [passes, flag, c, B, Z, W, Function.comp_def, or_assoc]
    rw [NumberField.Embeddings.card] at bd
    convert bd using 1
    congr 2
    apply sum_congr rfl
    intro t _
    apply sum_congr rfl
    intro q _
    congr 1
    apply sum_congr rfl
    intro p _
    congr 1
    apply sum_congr rfl
    intro r _
    congr 1
    by_cases ht : flag t q ∨ c t r ∈ B t q
    · rw [if_pos ht, if_pos ((eqv t q r).mp ht)]
    · rw [if_neg ht, if_neg ((eqv t q r).not.mp ht)]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.BoundedHeight.membership_inner

∀ {C : Type u_1} [inst : Fintype C] [inst_1 : DecidableEq C] (c : C) (o : Prop) (A : Finset C),
  inner ℝ (PlanarUnitDistances.BoundedHeight.codeVector c)
      (PlanarUnitDistances.BoundedHeight.testVector o A) =
    if o ∨ c ∈ A then 1 else 0
Lean source · PlanarUnitDistances/SparseTest.lean, lines 21–28
theorem membership_inner {C : Type*} [Fintype C] [DecidableEq C]
    (c : C) (o : Prop) (A : Finset C) :
    inner ℝ (codeVector c) (testVector o A) = if o ∨ c ∈ A then 1 else 0 := by
  classical
  rw [PiLp.inner_apply]
  simp only [codeVector, testVector, WithLp.ofLp_toLp, Fintype.sum_option, RCLike.inner_apply,
    conj_trivial, Option.some_ne_none, false_or, Option.some.injEq, true_or, if_true, mul_one]
  by_cases ho : o <;> by_cases hc : c ∈ A <;> simp [ho,hc,mul_ite]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.15 False acceptance and exact acceptance under one center

Lean verified

Let the true center conditional on p be uniform on at least d > 0 neighbors. Draw one predicted point from the marginal conditioned on the record of p , independently of that center given p . Suppose point atoms are bounded by θ , the record map occupies m values, and the Z coordinates distinguish vertices on both sides. Then the probability that ( Z r − Z q ) ( W r − W q ) = 1 is at most m θ + 2 / d . If the sum of the four mean heights is at most H , the probability of acceptance with nonzero residual is at most H / a + ( H + 3 log ⁡ 2 ) / s for a fresh uniform embedding, when a , s > 0 and 8 e a ( 2 e a / N ) ≤ e − s .

Proof

Conditional on distinct p , r , at most two centers in the neighborhood of p solve the exact equation with r . On p = r use the history collision estimate. The joint law has weights κ ( q ) w ( q , p ) μ ( r ∣ h ( r ) = h ( p ) ) , and summing the weights gives center marginal κ and predicted-point marginal μ . For a fixed nonedge, first remove all four coordinate overflows by bounding each one’s probability by its height divided by a . On a remaining accepting embedding the nonzero residual has modulus at most e − s . Apply the embedding bound to its inverse before averaging over the joint law. This order permits the test result to depend on the embedding.

Inspect the Lean declarations

PlanarUnitDistances.BoundedHeight.false_acceptance_coupling

∀ {K : Type u_1} {P : Type u_2} {Ω : Type u_3} [inst : Field K] [inst_1 : NumberField K] [inst_2 : Fintype Ω]
  (mass : Ω → ℝ) (S : Ω → Finset P) (zp wp : P → K) (x y c d : Ω → K),
  (∀ (ω : Ω), 0 ≤ mass ω) →
    ∑ ω, mass ω = 1 →
      (∀ (ω : Ω), ∀ i ∈ S ω, (zp i - c ω) * (wp i - d ω) = 1) →
        ∀ {H a s : ℝ},
          0 < a →
            0 < s →
              ∀ {N : ℕ} (hN : 0 < N),
                8 * Real.exp a * PlanarUnitDistances.CircleCells.width (Real.exp a) N ≤ Real.exp (-s) →
                  ∑ ω,
                        mass ω *
                          (PlanarUnitDistances.weilHeight (x ω) + PlanarUnitDistances.weilHeight (y ω) +
                              PlanarUnitDistances.weilHeight (c ω) +
                            PlanarUnitDistances.weilHeight (d ω)) ≤
                      H →
                    have G := fun ω =>
                      Finset.filter
                        (PlanarUnitDistances.BoundedHeight.passes (S ω) zp wp (x ω) (y ω) (c ω) (d ω)
                          (Real.exp a) N hN)
                        Finset.univ;
                    (∑ ω,
                        mass ω *
                          if (x ω - c ω) * (y ω - d ω) = 1 then 0 else ↑(G ω).card / ↑(Module.finrank ℚ K)) ≤
                      H / a + (H + 3 * Real.log 2) / s
Lean source · PlanarUnitDistances/BoundedHeight.lean, lines 120–152
/-- Averaging the false-positive estimate over an arbitrary finite coupling,
independent of the uniform embedding. It suffices to bound the sum of the
four mean coordinate heights under that coupling. -/
theorem false_acceptance_coupling {K P Ω : Type*} [Field K] [NumberField K] [Fintype Ω]
    (mass : Ω → ℝ) (S : Ω → Finset P) (zp wp : P → K) (x y c d : Ω → K)
    (hm : ∀ ω, 0 ≤ mass ω) (htotal : ∑ ω, mass ω = 1)
    (hedge : ∀ ω i, i ∈ S ω → (zp i-c ω)*(wp i-d ω)=1)
    {H a s : ℝ} (ha : 0 < a) (hs : 0 < s) {N : ℕ} (hN : 0 < N)
    (hmesh : 8*exp a*CircleCells.width (exp a) N ≤ exp (-s))
    (hmean : (∑ ω, mass ω * (weilHeight (x ω)+weilHeight (y ω)+weilHeight (c ω)+weilHeight (d ω))) ≤ H) :
    let G := fun ω => Finset.univ.filter (passes (S ω) zp wp (x ω) (y ω) (c ω) (d ω) (exp a) N hN)
    (∑ ω, mass ω * (if (x ω-c ω)*(y ω-d ω) = 1 then 0 else
      ((G ω).card : ℝ) / Module.finrank ℚ K)) ≤ H/a + (H+3*log 2)/s := by
  classical
  intro G
  let ht (ω : Ω) := weilHeight (x ω)+weilHeight (y ω)+weilHeight (c ω)+weilHeight (d ω)
  have nn (ω : Ω) : 0 ≤ ht ω := by
    dsimp [ht]
    linarith only [weilHeight_nonneg (x ω), weilHeight_nonneg (y ω),
      weilHeight_nonneg (c ω), weilHeight_nonneg (d ω)]
  have bound (ω : Ω) : (if (x ω-c ω)*(y ω-d ω) = 1 then (0:ℝ) else
      ((G ω).card : ℝ) / Module.finrank ℚ K) ≤ ht ω/a+(ht ω+3*log 2)/s := by
    split_ifs with h
    · positivity [nn ω, Real.log_nonneg (by norm_num : (1:ℝ) ≤ 2)]
    · exact false_fraction (S ω) zp wp _ _ _ _ (hedge ω) h ha hs hN hmesh
  have big := Finset.sum_le_sum (s := Finset.univ) (fun ω _ => mul_le_mul_of_nonneg_left (bound ω) (hm ω))
  have split (ω : Ω) : mass ω*(ht ω/a+(ht ω+3*log 2)/s) =
      mass ω * ht ω/a + mass ω * ht ω/s + mass ω*(3*log 2/s) := by ring
  simp only [split, Finset.sum_add_distrib, ← Finset.sum_div, ← Finset.sum_mul,
    htotal, one_mul] at big
  change (∑ ω, mass ω * ht ω) ≤ H at hmean
  rw [add_div]
  linarith [div_le_div_of_nonneg_right hmean ha.le, div_le_div_of_nonneg_right hmean hs.le]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.BoundedHeight.joint_center

∀ {Q : Type u_1} {P : Type u_2} {A : Type u_3} [inst : Fintype Q] [inst_1 : Fintype P]
  [inst_2 : DecidableEq A] (κ : Q → ℝ) (w : Q → P → ℝ) (h : P → A),
  (∀ (p : P), 0 < OAI.PlanarUnitDistances.FiniteInformation.marginal κ w p) →
    (∀ (q : Q), ∑ p, w q p = 1) →
      ∀ (f : Q → ℝ), ∑ ω, PlanarUnitDistances.BoundedHeight.joint κ w h ω * f ω.1 = ∑ q, κ q * f q
Lean source · PlanarUnitDistances/CoupledCenters.lean, lines 19–27
theorem joint_center (κ : Q → ℝ) (w : Q → P → ℝ) (h : P → A)
    (hm : ∀ p, 0 < marginal κ w p) (hsw : ∀ q, ∑ p, w q p = 1) (f : Q → ℝ) :
    ∑ ω, joint κ w h ω * f ω.1 = ∑ q, κ q * f q := by
  have row (q : Q) (p : P) : (∑ r, joint κ w h (q,p,r) * f q) = (κ q * w q p) * f q := by
    simp only [joint, ← Finset.sum_mul, ← Finset.mul_sum]
    rw [posterior_sum _ hm h p, mul_one]
  simp only [Fintype.sum_prod_type]
  simp_rw [row]
  simp only [← Finset.sum_mul, ← Finset.mul_sum, hsw, mul_one]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.BoundedHeight.joint_predicted

∀ {Q : Type u_1} {P : Type u_2} {A : Type u_3} [inst : Fintype Q] [inst_1 : Fintype P]
  [inst_2 : DecidableEq A] (κ : Q → ℝ) (w : Q → P → ℝ) (h : P → A),
  (∀ (p : P), 0 < OAI.PlanarUnitDistances.FiniteInformation.marginal κ w p) →
    ∀ (f : P → ℝ),
      ∑ ω, PlanarUnitDistances.BoundedHeight.joint κ w h ω * f ω.2.2 =
        ∑ p, OAI.PlanarUnitDistances.FiniteInformation.marginal κ w p * f p
Lean source · PlanarUnitDistances/CoupledCenters.lean, lines 29–38
theorem joint_predicted (κ : Q → ℝ) (w : Q → P → ℝ) (h : P → A)
    (hm : ∀ p, 0 < marginal κ w p) (f : P → ℝ) :
    ∑ ω, joint κ w h ω * f ω.2.2 = ∑ p, marginal κ w p * f p := by
  simp only [Fintype.sum_prod_type, joint]
  rw [Finset.sum_comm]
  simp_rw [swap (I := Q) (J := P)]
  simp only [← Finset.sum_mul]
  change (∑ p, ∑ r, marginal κ w p * posterior (marginal κ w) h (h p) r * f r) = _
  rw [Finset.sum_comm]
  simp only [← Finset.sum_mul, posterior_stationary _ hm]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.BoundedHeight.joint_exact

∀ {Q : Type u_1} {P : Type u_2} {A : Type u_3} [inst : Fintype Q] [inst_1 : Fintype P]
  [inst_2 : DecidableEq A] {K : Type u_4} [inst_3 : Field K] (κ : Q → ℝ) (w : Q → P → ℝ) (h : P → A),
  (∀ (p : P), 0 < OAI.PlanarUnitDistances.FiniteInformation.marginal κ w p) →
    ∑ p, OAI.PlanarUnitDistances.FiniteInformation.marginal κ w p = 1 →
      ∀ (centers : P → Finset Q),
        (∀ (q : Q) (p : P),
            κ q * w q p =
              OAI.PlanarUnitDistances.FiniteInformation.marginal κ w p *
                if q ∈ centers p then 1 / ↑(centers p).card else 0) →
          ∀ (zp wp : P → K) (zq wq : Q → K),
            Function.Injective zp →
              Function.Injective zq →
                (∀ (p : P), ∀ q ∈ centers p, (zp p - zq q) * (wp p - wq q) = 1) →
                  ∀ {θ d : ℝ},
                    0 ≤ θ →
                      (∀ (p : P), OAI.PlanarUnitDistances.FiniteInformation.marginal κ w p ≤ θ) →
                        0 < d →
                          (∀ (p : P), d ≤ ↑(centers p).card) →
                            (∑ ω,
                                PlanarUnitDistances.BoundedHeight.joint κ w h ω *
                                  if (zp ω.2.2 - zq ω.1) * (wp ω.2.2 - wq ω.1) = 1 then 1 else 0) ≤
                              ↑(Finset.image h Finset.univ).card * θ + 2 / d
Lean source · PlanarUnitDistances/CoupledCenters.lean, lines 40–91
theorem joint_exact {K : Type*} [Field K] (κ : Q → ℝ) (w : Q → P → ℝ) (h : P → A)
    (hm : ∀ p, 0 < marginal κ w p) (hsμ : ∑ p, marginal κ w p = 1)
    (centers : P → Finset Q)
    (hrev : ∀ q p, κ q * w q p = marginal κ w p *
      (if q ∈ centers p then 1/((centers p).card : ℝ) else 0))
    (zp wp : P → K) (zq wq : Q → K)
    (hzp : Function.Injective zp) (hzq : Function.Injective zq)
    (hedge : ∀ p q, q ∈ centers p → (zp p-zq q)*(wp p-wq q) = 1)
    {θ d : ℝ} (hθ : 0 ≤ θ) (hatom : ∀ p, marginal κ w p ≤ θ)
    (hd : 0 < d) (hdeg : ∀ p, d ≤ (centers p).card) :
    (∑ ω, joint κ w h ω * (if (zp ω.2.2-zq ω.1)*(wp ω.2.2-wq ω.1) = 1 then 1 else 0)) ≤
      ((univ.image h).card : ℝ) * θ + 2/d := by
  classical
  let μ := marginal κ w
  let π p r := posterior μ h (h p) r
  let e r q := (zp r-zq q)*(wp r-wq q) = 1
  let hit p r := ((centers p).filter (fun q => e r q)).card / ((centers p).card : ℝ)
  have each (p r : P) : (∑ q, joint κ w h (q,p,r) * (if e r q then 1 else 0)) =
      μ p * π p r * hit p r := by
    have term (q : Q) : joint κ w h (q,p,r) * (if e r q then 1 else 0) =
        if q ∈ centers p ∧ e r q then μ p * π p r / (centers p).card else 0 := by
      unfold joint
      dsimp only
      rw [hrev]
      by_cases hq : q ∈ centers p <;> by_cases he : e r q <;> simp [hq,he,μ,π]
      ring
    simp only [term, ← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul]
    have sets : (univ.filter fun q => q ∈ centers p ∧ e r q) = (centers p).filter (e r) := by
      ext q
      simp
    rw [sets]
    dsimp [hit]
    ring
  show (∑ ω : Q×P×P, joint κ w h ω * (if e ω.2.2 ω.1 then 1 else 0)) ≤ _
  simp only [Fintype.sum_prod_type]
  rw [Finset.sum_comm]
  simp_rw [swap (I := Q) (J := P)]
  simp only [each]
  have bd (p r : P) : μ p * π p r * hit p r ≤
      μ p * π p r * ((if p=r then 1 else 0) + 2/d) :=
    mul_le_mul_of_nonneg_left (single_center centers zp wp zq wq hzp hzq hedge p r d hd (hdeg p))
      (mul_nonneg (hm p).le (posterior_nonneg μ hm h p r))
  refine (sum_le_sum (fun p _ => sum_le_sum (fun r _ => bd p r))).trans ?_
  have row (p : P) : (∑ r, μ p * π p r * ((if p=r then 1 else 0) + 2/d)) =
      μ p * π p p + μ p*(2/d) := by
    simp only [mul_add, Finset.sum_add_distrib, mul_ite, mul_one, mul_zero,
      Finset.sum_ite_eq, Finset.mem_univ, if_true, ← Finset.sum_mul, ← Finset.mul_sum,
      π]
    rw [posterior_sum μ hm h p, mul_one]
  have ss : ∑ p, μ p = 1 := hsμ
  simp only [row, Finset.sum_add_distrib, ← Finset.sum_mul, ss, one_mul]
  linarith only [posterior_collision μ hm h hθ hatom]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.16 Resampling a point from its history

Lean verified

Let μ be a finite point law with largest atom at most θ , and fix a record map H . Conditional on the record of p ∼ μ , draw a second point independently from that conditional law. Its probability of equalling p is at most | H ( P ) | θ .

Proof

In each record class of mass m > 0 , the contribution is the sum of the squared point masses divided by m . It is at most θ since each squared mass is at most θ times the mass. The classes of mass zero contribute zero.

Inspect the Lean declarations

PlanarUnitDistances.history_resampling_collision

∀ {P : Type u_1} {H : Type u_2} [inst : Fintype P] [inst_1 : DecidableEq H] (μ : P → ℝ) (hist : P → H)
  {θ : ℝ},
  (∀ (p : P), 0 ≤ μ p) →
    0 ≤ θ →
      (∀ (p : P), μ p ≤ θ) →
        have records := Finset.image hist Finset.univ;
        have classMass := fun a => ∑ p with hist p = a, μ p;
        ∑ p, μ p * (μ p / classMass (hist p)) ≤ ↑records.card * θ
Lean source · PlanarUnitDistances/ThreeCenters.lean, lines 15–46
/-- When the independent history-class resampling is used, its diagonal mass
is the displayed sum. An occupied record contributes at most one point atom. -/
theorem history_resampling_collision {P H : Type*} [Fintype P] [DecidableEq H]
    (μ : P → ℝ) (hist : P → H) {θ : ℝ}
    (hμ : ∀ p, 0 ≤ μ p) (hθ : 0 ≤ θ) (hatom : ∀ p, μ p ≤ θ) :
    let records := Finset.univ.image hist
    let classMass := fun a => ∑ p ∈ Finset.univ.filter (fun p => hist p = a), μ p
    (∑ p, μ p * (μ p / classMass (hist p))) ≤ (records.card : ℝ) * θ := by
  classical
  intro records classMass
  have each (a : H) :
      (∑ p ∈ Finset.univ.filter (fun p => hist p = a), μ p * (μ p / classMass (hist p))) ≤ θ := by
    let F := Finset.univ.filter (fun p => hist p = a)
    have eqv (p : P) (hp : p ∈ F) : hist p = a := (Finset.mem_filter.mp hp).2
    have sumEq : (∑ p ∈ F, μ p * (μ p / classMass (hist p))) =
        (∑ p ∈ F, μ p * μ p) / classMass a := by
      rw [Finset.sum_div]
      exact Finset.sum_congr rfl (fun p hp => by rw [eqv p hp]; ring)
    change (∑ p ∈ F, μ p * (μ p / classMass (hist p))) ≤ θ
    rw [sumEq]
    by_cases hz : classMass a = 0
    · simpa [hz] using hθ
    have ha : 0 < classMass a := lt_of_le_of_ne (Finset.sum_nonneg fun p _ => hμ p) (Ne.symm hz)
    apply (div_le_iff₀ ha).2
    change (∑ p ∈ F, μ p * μ p) ≤ θ * ∑ p ∈ F, μ p
    rw [Finset.mul_sum]; exact Finset.sum_le_sum fun p _ => mul_le_mul_of_nonneg_right (hatom p) (hμ p)
  have split := Finset.sum_fiberwise_of_maps_to (g := hist) (s := Finset.univ) (t := records)
    (fun p hp => Finset.mem_image_of_mem hist hp) (fun p => μ p * (μ p / classMass (hist p)))
  calc
    _ = _ := split.symm
    _ ≤ ∑ _a ∈ records, θ := Finset.sum_le_sum fun a _ => each a
    _ = _ := by simp [nsmul_eq_mul]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 3.17 The sharp cutoff at the exact exponent

Lean verified

Give a finite bipartite graph with at least one edge and positive degree at every center its uniform edge law, with marginals μ , κ . Let point and center coordinates Z , W lie in a common number field, with Z injective on each side and ( Z p − Z q ) ( W p − W q ) = 1 on each edge. Let D denote the mutual information of two independently drawn neighbors of the same random center. Put H 0 = 226 ( 2 2100 + 1 ) and take the exact Δ of Theorem 1.1. Suppose d min ≥ 300 , D + 1 ≤ 30600 Δ log ⁡ t , and the point marginal satisfies μ ( p ) ≤ θ for every p , with t > 0 and t θ ≤ 1 / 100 . Then the sum of the four coordinate mean heights is strictly greater than H 0 .

Proof

Put M = 1 + N 0 4 and L = ⌈ ( 7200 N 0 ) 4 ( D + 1 ) ⌉ . Lemma 2.15 gives ( L − 1 ) log ⁡ M < log ⁡ t , hence M L − 1 θ ≤ t θ ≤ 1 / 100 . Suppose the four-height sum were at most H 0 . Under the single-center law every outcome is an exact acceptance, a false acceptance or a rejection. Lemmas 3.15 and 3.14 bound the sum of their probabilities by

1 100 + 2 300 + 1 6 + H 0 + 3 log ⁡ 2 7 H 0 + 1 200 < 1.

Here the first two terms bound exact acceptance, the next two bound false acceptance, and the last bounds rejection. This contradicts total mass one.

Inspect the Lean declarations

PlanarUnitDistances.BoundedHeight.small_height_endpoint

∀ {P : Type u_1} {Q : Type u_2} {F : Type u_3} [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : Field F]
  [inst_3 : NumberField F] (S : Q → Finset P),
  (∀ (q : Q), (S q).Nonempty) →
    ∀ {e : ℝ},
      0 < e →
        ∑ q, ↑(S q).card = e →
          ∀ (zp wp : P → F) (zq wq : Q → F),
            Function.Injective zp →
              Function.Injective zq →
                (∀ (q : Q), ∀ p ∈ S q, (zp p - zq q) * (wp p - wq q) = 1) →
                  ∀ {θ t : ℝ},
                    0 ≤ θ →
                      0 < t →
                        t * θ ≤ 1 / 100 →
                          (∀ (p : P), ↑(PlanarUnitDistances.BoundedHeight.pointCenters S p).card / e ≤ θ) →
                            (∀ (p : P), 300 ≤ ↑(PlanarUnitDistances.BoundedHeight.pointCenters S p).card) →
                              PlanarUnitDistances.BoundedHeight.twoEdgeInformation S e + 1 ≤
                                  30600 * PlanarUnitDistances.exactGap * Real.log t →
                                PlanarUnitDistances.H0 <
                                  ∑ p,
                                      ↑(PlanarUnitDistances.BoundedHeight.pointCenters S p).card / e *
                                        (PlanarUnitDistances.weilHeight (zp p) +
                                          PlanarUnitDistances.weilHeight (wp p)) +
                                    ∑ q,
                                      PlanarUnitDistances.BoundedHeight.centerLaw S e q *
                                        (PlanarUnitDistances.weilHeight (zq q) +
                                          PlanarUnitDistances.weilHeight (wq q))
Lean source · PlanarUnitDistances/BoundedHeightTheorem.lean, lines 10–47
/-- The small-height contradiction at the exact exponent. The atom estimate
is written as t·θ≤0.01, so callers can supply any decay beyond t⁻¹. -/
theorem small_height_endpoint {P Q F : Type*} [Fintype P] [Fintype Q] [Field F] [NumberField F]
    (S : Q → Finset P) (hrow : ∀ q, (S q).Nonempty) {e : ℝ} (he : 0 < e)
    (heq : ∑ q, ((S q).card : ℝ) = e)
    (zp wp : P → F) (zq wq : Q → F) (hzp : Function.Injective zp) (hzq : Function.Injective zq)
    (hedge : ∀ q p, p ∈ S q → (zp p-zq q)*(wp p-wq q)=1)
    {θ t : ℝ} (hθ : 0 ≤ θ) (ht : 0 < t) (htθ : t*θ ≤ 1/100)
    (hatom : ∀ p, ((pointCenters S p).card : ℝ)/e ≤ θ)
    (hdeg : ∀ p, (300:ℝ) ≤ (pointCenters S p).card)
    (hD : twoEdgeInformation S e + 1 ≤ 30600*exactGap*log t) :
    H0 < (∑ p, ((pointCenters S p).card : ℝ)/e * (weilHeight (zp p)+weilHeight (wp p))) +
      (∑ q, centerLaw S e q * (weilHeight (zq q)+weilHeight (wq q))) := by
  let D := twoEdgeInformation S e
  let N := gridSize H0
  let M := N^4+1
  let L := sampleSize N D
  have hH : (1000:ℝ) ≤ H0 := by
    have h : (2:ℝ)^3 ≤ 2^2100 := pow_le_pow_right₀ (by norm_num) (by decide)
    norm_num only [show (2:ℝ)^3=8 by norm_num] at h
    unfold H0
    exact (show ∀ x : ℝ, 8 ≤ x → 1000 ≤ 226*(x+1) by intros; linarith) _ h
  have dpos : 0 ≤ D := twoEdgeInformation_nonneg S hrow he heq
  have nn := grid_positive H0
  have ll : 0 < L := sample_positive N nn D dpos
  have hlog := smallHeight_history_log_lt dpos hD
  change ((L:ℝ)-1)*log (1+(N:ℝ)^4) < log t at hlog
  have mp : 0 < (M:ℝ) := by dsimp [M]; positivity
  have size : ((M^(L-1) : ℕ) : ℝ) ≤ t := by
    apply (log_le_log_iff (by positivity) ht).mp
    rw [Nat.cast_pow, log_pow, Nat.cast_sub (by omega : 1 ≤ L), Nat.cast_one]
    simpa only [M, Nat.cast_add, Nat.cast_one, Nat.cast_pow, add_comm ((N:ℝ)^4)] using hlog.le
  have col := (mul_le_mul_of_nonneg_right size hθ).trans htθ
  by_contra! low
  exact budget_impossible hH dpos col
    (uniform_graph_budget S hrow he heq zp wp zq wq hzp hzq hedge hθ hatom
      (by norm_num : (0:ℝ) < 300) hdeg (by linarith : 0 < 6*H0) (by linarith : 0 < 7*H0)
      N L nn ll (grid_mesh H0) low)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.BoundedHeight.uniform_graph_budget

∀ {P : Type u_1} {Q : Type u_2} {F : Type u_3} [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : Field F]
  [inst_3 : NumberField F] (S : Q → Finset P),
  (∀ (q : Q), (S q).Nonempty) →
    ∀ {e : ℝ},
      0 < e →
        ∑ q, ↑(S q).card = e →
          ∀ (zp wp : P → F) (zq wq : Q → F),
            Function.Injective zp →
              Function.Injective zq →
                (∀ (q : Q), ∀ p ∈ S q, (zp p - zq q) * (wp p - wq q) = 1) →
                  ∀ {θ d H a s : ℝ},
                    0 ≤ θ →
                      (∀ (p : P), ↑(PlanarUnitDistances.BoundedHeight.pointCenters S p).card / e ≤ θ) →
                        0 < d →
                          (∀ (p : P), d ≤ ↑(PlanarUnitDistances.BoundedHeight.pointCenters S p).card) →
                            0 < a →
                              0 < s →
                                ∀ (N L : ℕ),
                                  0 < N →
                                    0 < L →
                                      8 * Real.exp a * PlanarUnitDistances.CircleCells.width (Real.exp a) N ≤
                                          Real.exp (-s) →
                                        ∑ p,
                                                ↑(PlanarUnitDistances.BoundedHeight.pointCenters S p).card /
                                                    e *
                                                  (PlanarUnitDistances.weilHeight (zp p) +
                                                    PlanarUnitDistances.weilHeight (wp p)) +
                                              ∑ q,
                                                PlanarUnitDistances.BoundedHeight.centerLaw S e q *
                                                  (PlanarUnitDistances.weilHeight (zq q) +
                                                    PlanarUnitDistances.weilHeight (wq q)) ≤
                                            H →
                                          1 ≤
                                            ↑((N ^ 4 + 1) ^ (L - 1)) * θ + 2 / d + H / a +
                                                (H + 3 * Real.log 2) / s +
                                              36 * ↑N *
                                                (PlanarUnitDistances.BoundedHeight.twoEdgeInformation S e /
                                                    ↑L) ^
                                                  (1 / 4)
Lean source · PlanarUnitDistances/UniformGraphHeight.lean, lines 24–68
/-- On the support of the center marginal this is its actual neighborhood.
Adding every point to an isolated center's row would create spurious cell
constraints, so we use a formulation restricted to the incident centers. -/
theorem uniform_graph_budget {P Q F : Type*} [Fintype P] [Fintype Q] [Field F] [NumberField F]
    (S : Q → Finset P) (hrow : ∀ q, (S q).Nonempty) {e : ℝ} (he : 0 < e)
    (heq : ∑ q, ((S q).card : ℝ) = e)
    (zp wp : P → F) (zq wq : Q → F) (hzp : Function.Injective zp) (hzq : Function.Injective zq)
    (hedge : ∀ q p, p ∈ S q → (zp p-zq q)*(wp p-wq q)=1)
    {θ d H a s : ℝ} (hθ : 0 ≤ θ) (hatom : ∀ p, ((pointCenters S p).card : ℝ)/e ≤ θ)
    (hd : 0 < d) (hdeg : ∀ p, d ≤ (pointCenters S p).card) (ha : 0 < a) (hs : 0 < s)
    (N L : ℕ) (hN : 0 < N) (hL : 0 < L) (hmesh : 8*exp a*CircleCells.width (exp a) N ≤ exp (-s))
    (hmean : (∑ p, ((pointCenters S p).card : ℝ)/e * (weilHeight (zp p)+weilHeight (wp p))) +
      (∑ q, centerLaw S e q * (weilHeight (zq q)+weilHeight (wq q))) ≤ H) :
    1 ≤ (((N^4+1)^(L-1) : ℕ) : ℝ)*θ + 2/d + H/a + (H+3*log 2)/s +
      36*N*(twoEdgeInformation S e/(L:ℝ))^(1/4:ℝ) := by
  classical
  let κ := centerLaw S e
  let w := neighborLaw S
  have nk (q : Q) : (0:ℝ) < (S q).card := Nat.cast_pos.mpr (card_pos.mpr (hrow q))
  have hk (q : Q) : 0 ≤ κ q := (div_pos (nk q) he).le
  have hw (q : Q) (p : P) : 0 ≤ w q p := by
    dsimp [w,neighborLaw]; rw [if_pos (hrow q)]; split_ifs <;> positivity
  have hsk : ∑ q, κ q = 1 := by dsimp [κ,centerLaw]; rw [← Finset.sum_div, heq, div_self he.ne']
  have hsw (q : Q) : ∑ p, w q p = 1 := by
    simp [w,neighborLaw,hrow, (nk q).ne']
  have step (q : Q) (p : P) : κ q*w q p = if p ∈ S q then e⁻¹ else 0 := by
    by_cases hp : p ∈ S q <;> simp [κ,w,neighborLaw,centerLaw,hrow,hp,div_eq_mul_inv]
    field_simp [(nk q).ne']
  have marg (p : P) : marginal κ w p = ((pointCenters S p).card : ℝ)/e := by
    simp [marginal, step, pointCenters, ← Finset.sum_filter, div_eq_mul_inv]
  have pm (p : P) : 0 < marginal κ w p := by rw [marg]; exact div_pos (hd.trans_le (hdeg p)) he
  have supp (q : Q) (p : P) : w q p ≠ 0 → p ∈ S q := by
    intro h
    by_contra hp
    exact h (by simp [w,neighborLaw,hrow,hp])
  have rev (q : Q) (p : P) : κ q*w q p = marginal κ w p *
      (if q ∈ pointCenters S p then 1/((pointCenters S p).card:ℝ) else 0) := by
    rw [marg,step]
    have hv : q ∈ pointCenters S p ↔ p ∈ S q := by simp [pointCenters]
    have np := (hd.trans_le (hdeg p)).ne'
    by_cases hp : p ∈ S q <;> simp [hp,hv,div_eq_mul_inv]
    field_simp [np]
  exact bounded_height_budget κ w hk hw hsk hsw pm (pointCenters S) S (by simp [pointCenters]) supp rev
    zp wp zq wq hzp hzq hedge hθ (fun p => (marg p).le.trans (hatom p)) hd hdeg ha hs N L hN hL hmesh
    (by simpa only [marg] using hmean)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.BoundedHeight.budget_impossible

∀ {H D θ : ℝ},
  1000 ≤ H →
    0 ≤ D →
      ↑((PlanarUnitDistances.BoundedHeight.gridSize H ^ 4 + 1) ^
                (PlanarUnitDistances.BoundedHeight.sampleSize (PlanarUnitDistances.BoundedHeight.gridSize H)
                    D -
                  1)) *
            θ ≤
          1 / 100 →
        ¬1 ≤
            ↑((PlanarUnitDistances.BoundedHeight.gridSize H ^ 4 + 1) ^
                          (PlanarUnitDistances.BoundedHeight.sampleSize
                              (PlanarUnitDistances.BoundedHeight.gridSize H) D -
                            1)) *
                      θ +
                    2 / 300 +
                  H / (6 * H) +
                (H + 3 * Real.log 2) / (7 * H) +
              36 * ↑(PlanarUnitDistances.BoundedHeight.gridSize H) *
                (D /
                    ↑(PlanarUnitDistances.BoundedHeight.sampleSize
                        (PlanarUnitDistances.BoundedHeight.gridSize H) D)) ^
                  (1 / 4)
Lean source · PlanarUnitDistances/HeightParameters.lean, lines 44–56
/-- The small-height endpoint uses this condition directly for its own
atom bound, so it retains the full power saved in the degree estimate. -/
theorem budget_impossible {H D θ : ℝ} (hH : 1000 ≤ H) (hD : 0 ≤ D)
    (hcollision : ((((gridSize H)^4+1)^(sampleSize (gridSize H) D-1) : ℕ) : ℝ)*θ ≤ 1/100) :
    ¬ (1 ≤ ((((gridSize H)^4+1)^(sampleSize (gridSize H) D-1) : ℕ) : ℝ)*θ +
      2/300 + H/(6*H) + (H+3*log 2)/(7*H) +
      36*(gridSize H : ℝ)*(D/(sampleSize (gridSize H) D : ℝ))^(1/4:ℝ)) := by
  have hp : 0 < H := by linarith
  have h₆ : H/(6*H)=1/6 := by field_simp
  have h₇ : (H+3*log 2)/(7*H) ≤ 1/6 := by
    rw [div_le_iff₀ (by positivity)]; linarith [Real.log_two_lt_d9]
  rw [h₆]
  linarith [rejection_small _ (grid_positive H) D hD]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Proposition 3.18 Why the proof enters the large-height case

Lean verified

Take g = 3 Δ , a = 10000 g . For all sufficiently large real t , suppose a configuration of t 3 real plane points has at least t 4 − g ordered unit pairs. There exist algebraic point and center sets P , Q as in Proposition 2.14 and a common number field for their coordinates. For their original unit directions and the uniform law on the incidences, the integrated minority mass satisfies S > 2 2100 .

Proof

For each place, choose a symmetric level interval whose radius is the sum of the absolute logarithms of all directions and of both coordinate differences of all point pairs, assigning the Lean value log ⁡ 0 = 0 to a vanishing difference. All required thresholds lie in these intervals. Only finitely many finite places have a nonzero radius. Lemma 3.9 gives a reference edge of positive mass with average ratio height at most S . Reciprocal scaling and one translation then give a total of four mean heights at most 226 ( S + 1 ) . These changes preserve all unit identities and both injectivity properties. The graph from Proposition 2.14 has minimum point degree at least 300 eventually. Its information satisfies D + 1 ≤ 30600 Δ log ⁡ t and its largest point mass satisfies t θ ≤ t − 19900 g ≤ 1 / 100 eventually. Lemma 3.17 forces the height total to exceed H 0 . This contradicts S ≤ 2 2100 . The definition of S in the conclusion uses the directions before rescaling.

Inspect the Lean declarations

PlanarUnitDistances.dense_large_profile

have g := 3 * PlanarUnitDistances.exactGap;
have a := 10000 * g;
∀ᶠ (t : ℝ) in Filter.atTop,
  ∀ (X : Finset OAI.PlanarUnitDistances.Plane),
    ↑X.card = t ^ 3 →
      t ^ (4 - g) ≤ ↑(PlanarUnitDistances.orderedPairs X).card →
        ∃ P Q M,
          (∀ p ∈ P, ∀ (i : Fin 2), IsAlgebraic ℚ (p.ofLp i)) ∧
            t ^ (1 + 2 * a - 173 * g) ≤ ↑P.card ∧
              ↑P.card ≤ 2 * t ^ (1 + 2 * a) ∧
                ↑Q.card ≤ t ^ (2 + a) ∧
                  t ^ (2 + 2 * a - 90 * g) ≤ OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ∧
                    (∀ p ∈ P,
                        27 / 100 * t ^ (1 - 90 * g) ≤ OAI.PlanarUnitDistances.CircleIncidence.degree Q p ∧
                          OAI.PlanarUnitDistances.CircleIncidence.degree Q p ≤ t ^ (1 + 10 * g) ∧
                            27 / 50 / ↑P.card ≤
                                OAI.PlanarUnitDistances.CircleIncidence.degree Q p /
                                  OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ∧
                              OAI.PlanarUnitDistances.CircleIncidence.degree Q p /
                                  OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ≤
                                t ^ (-1 - 2 * a + 100 * g)) ∧
                      t ^ (-1 - 2 * a + 100 * g) ≤ t ^ (-1) ∧
                        (∀ q ∈ Q,
                            27 / 50 * t ^ (a - 90 * g) ≤ OAI.PlanarUnitDistances.CircleIncidence.degree P q ∧
                              OAI.PlanarUnitDistances.CircleIncidence.degree P q ≤ t ^ (a + 10 * g) ∧
                                27 / 50 / ↑Q.card ≤
                                  OAI.PlanarUnitDistances.CircleIncidence.degree P q /
                                    OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) ∧
                          (∀ A ⊆ P,
                              ∀ B ⊆ Q,
                                have z := ↑A.card / ↑P.card * (↑B.card / ↑Q.card);
                                OAI.PlanarUnitDistances.CircleIncidence.incidences A B /
                                    OAI.PlanarUnitDistances.CircleIncidence.incidences P Q ≤
                                  √z * (z ^ (1 / 25) + t ^ (-150 * g))) ∧
                            PlanarUnitDistances.unitWalkInformation P Q + 1 ≤ 10200 * g * Real.log t ∧
                              have r :=
                                PlanarUnitDistances.profileRadius (PlanarUnitDistances.unitRows P Q) M.z M.w;
                              2 ^ 2100 <
                                PlanarUnitDistances.UniformNormalization.profileScale
                                  (PlanarUnitDistances.unitRows P Q)
                                  (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) M.z (fun v => -r v)
                                  r
Lean source · PlanarUnitDistances/GeometricLargeProfile.lean, lines 62–136
/-- The real-plane dense input at the stated exponent yields actual original
unit directions with minority integral greater than 2^2100. The same two
sets retain the crucial size, edge, expansion and information conclusions. -/
theorem dense_large_profile :
    let g := 3*exactGap
    let a := 10000*g
    ∀ᶠ t : ℝ in atTop, ∀ X : Finset Plane, (X.card:ℝ)=t^3 →
      t^(4-g) ≤ ((orderedPairs X).card:ℝ) →
      ∃ (P Q : Finset Plane) (M : CommonFieldModel.Model P Q),
        (∀ p ∈ P, ∀ i, IsAlgebraic ℚ (p i)) ∧
        t^(1+2*a-173*g) ≤ (P.card:ℝ) ∧ (P.card:ℝ) ≤ 2*t^(1+2*a) ∧
        (Q.card:ℝ) ≤ t^(2+a) ∧ t^(2+2*a-90*g) ≤ incidences P Q ∧
        (∀ p ∈ P, (27/100:ℝ)*t^(1-90*g) ≤ degree Q p ∧ degree Q p ≤ t^(1+10*g) ∧
          (27/50:ℝ)/P.card ≤ degree Q p/incidences P Q ∧
          degree Q p/incidences P Q ≤ t^(-1-2*a+100*g)) ∧
        t^(-1-2*a+100*g) ≤ t^(-1:ℝ) ∧
        (∀ q ∈ Q, (27/50:ℝ)*t^(a-90*g) ≤ degree P q ∧ degree P q ≤ t^(a+10*g) ∧
          (27/50:ℝ)/Q.card ≤ degree P q/incidences P Q) ∧
        (∀ A ⊆ P, ∀ B ⊆ Q, let z := (A.card:ℝ)/P.card*((B.card:ℝ)/Q.card)
          incidences A B/incidences P Q ≤ Real.sqrt z*(z^(1/25:ℝ)+t^(-150*g))) ∧
        unitWalkInformation P Q+1 ≤ 10200*g*Real.log t ∧
        let r := profileRadius (unitRows P Q) M.z M.w
        (2:ℝ)^2100 < profileScale (unitRows P Q) (incidences P Q) M.z (fun v => -r v) r := by
  dsimp only
  let g := 3*exactGap
  let a := 10000*g
  have hg : 0 < g := mul_pos (by norm_num) exactGap_pos
  have hgsmall : a ≤ 1/10 := by
    have hb := exactGap_lt_largeHeightGap.trans_le
      (Real.rpow_le_rpow_of_exponent_le (by norm_num : (1:ℝ) ≤ 2)
      (by norm_num : (-(594036:ℝ)) ≤ -(32:ℝ)))
    rw [Real.rpow_neg (by norm_num),← Nat.cast_ofNat (R := ℝ) (n:=32),Real.rpow_natCast] at hb
    norm_num1 at hb
    dsimp [a,g]
    linarith
  have hdeg : 0 < 1-90*g := by dsimp [a] at hgsmall; linarith
  have hlev := (tendsto_rpow_neg_atTop (by linarith : 0 < 150*g)).eventually
    (eventually_le_nhds (by positivity : (0:ℝ) < 1/2^100))
  have hcol := (tendsto_rpow_neg_atTop (by linarith : 0 < 19900*g)).eventually
    (eventually_le_nhds (by norm_num : (0:ℝ) < 1/100))
  filter_upwards [algebraic_incidence_piece hg hgsmall, eventually_gt_atTop (0:ℝ),hlev,hcol,
    (tendsto_rpow_atTop hdeg).eventually_ge_atTop (300/(27/100):ℝ)] with t piece ht hlev hcol dlarge
  intro X hc hdense
  obtain ⟨P,Q,hPAlg,hQAlg,mlo,mhi,qhi,edge,degP,thetaSmall,degQ,cut,info⟩ := piece X hc hdense
  obtain ⟨M⟩ := CommonFieldModel.exists_model hPAlg hQAlg
  refine ⟨P,Q,M,hPAlg,mlo,mhi,qhi,edge,degP,thetaSmall,degQ,cut,info,?_⟩
  have ep := (Real.rpow_pos_of_pos ht _).trans_le edge
  have mp := (Real.rpow_pos_of_pos ht _).trans_le mlo
  have qp := pos_of_mul_pos_right (ep.trans_le (incidences_le P Q)) (Nat.cast_nonneg _)
  have rowpos (q : Plane) (hq : q∈Q) : 0 < degree P q :=
    lt_of_lt_of_le (mul_pos (by norm_num) (Real.rpow_pos_of_pos ht _)) (degQ q hq).1
  have nonemp (q : Q) : (unitRows P Q q).Nonempty := Finset.card_pos.mp (Nat.cast_pos.mp
    (by rw [unitRows_center_degree]; exact rowpos q q.prop : (0:ℝ) < (unitRows P Q q).card))
  let r := profileRadius (unitRows P Q) M.z M.w
  have ctrl := unitRows_label_control P Q mp qp ep (Real.rpow_nonneg ht.le (-150*g))
    (by simpa only [neg_mul] using hlev) (fun p hp => (degP p hp).2.2.1)
    (fun q hq => (degQ q hq).2.2) cut
  apply scale_large (unitRows P Q) nonemp ep (unitRows_total P Q) ctrl M.z M.w
    M.point_injective M.center_injective (fun q p hp => M.unit_identity p q (Finset.mem_filter.mp hp).2)
    (fun v => -r v) r
    (fun v x => (abs_le.mp ((radius_bounds _ M.z M.w v).1 x)).1)
    (fun v x => (abs_le.mp ((radius_bounds _ M.z M.w v).1 x)).2)
    (θ := t^(-1-2*a+100*g)) (t := t) (Real.rpow_nonneg ht.le _) ht
  · calc
      _ = t^(1+(-1-2*a+100*g)) := by rw [Real.rpow_add ht 1 (-1-2*a+100*g),Real.rpow_one]
      _ = t^(-(19900*g)) := by congr 1; dsimp [a]; ring
      _ ≤ _ := hcol
  · intro p
    rw [unitRows_point_degree]
    exact (degP p p.prop).2.2.2
  · intro p
    rw [unitRows_point_degree]
    exact le_trans (by linarith : (300:ℝ) ≤ 27/100*t^(1-90*g)) (degP p p.prop).1
  · rw [← unitRows_information P Q rowpos]
    simpa only [g,show ∀ x : ℝ, 10200*(3*x)=30600*x by intro; ring] using info

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.profileRadius

{P Q : Type} →
  [Fintype P] →
    [Fintype Q] →
      {K : Type u_1} → [inst : Field K] → (Q → Finset P) → (P ⊕ Q → K) → (P ⊕ Q → K) → AbsoluteValue K ℝ → ℝ
Lean source · PlanarUnitDistances/GeometricLargeProfile.lean, lines 12–18
/-- The interval contains every edge threshold as well as both endpoint
quantities needed for distinct point pairs in the later two-coordinate comparison. -/
def profileRadius {P Q : Type} [Fintype P] [Fintype Q] {K : Type*} [Field K]
    (S : Q → Finset P) (Z W : P ⊕ Q → K) (v : AbsoluteValue K ℝ) :=
  (∑ x : P × Q, |-Real.log (v (direction S Z x))|) +
  (∑ x : P × P, (|Real.log (v (Z (.inl x.1)-Z (.inl x.2)))| +
    |Real.log (v (W (.inl x.1)-W (.inl x.2)))|))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.radius_bounds

∀ {P Q : Type} [inst : Fintype P] [inst_1 : Fintype Q] {K : Type u_1} [inst_2 : Field K] (S : Q → Finset P)
  (Z W : P ⊕ Q → K) (v : AbsoluteValue K ℝ),
  (∀ (x : P × Q),
      |PlanarUnitDistances.EdgeHeightScale.threshold v
            (PlanarUnitDistances.UniformNormalization.direction S Z) x| ≤
        PlanarUnitDistances.profileRadius S Z W v) ∧
    ∀ (p r : P),
      |Real.log (v (Z (Sum.inl p) - Z (Sum.inl r)))| ≤ PlanarUnitDistances.profileRadius S Z W v ∧
        |Real.log (v (W (Sum.inl p) - W (Sum.inl r)))| ≤ PlanarUnitDistances.profileRadius S Z W v
Lean source · PlanarUnitDistances/GeometricLargeProfile.lean, lines 20–38
theorem radius_bounds {P Q : Type} [Fintype P] [Fintype Q] {K : Type*} [Field K]
    (S : Q → Finset P) (Z W : P ⊕ Q → K) (v : AbsoluteValue K ℝ) :
    (∀ x, |threshold v (direction S Z) x| ≤ profileRadius S Z W v) ∧
    (∀ p r, |Real.log (v (Z (.inl p)-Z (.inl r)))| ≤ profileRadius S Z W v ∧
      |Real.log (v (W (.inl p)-W (.inl r)))| ≤ profileRadius S Z W v) := by
  unfold profileRadius
  constructor
  · intro x
    exact (Finset.single_le_sum (fun y _ => abs_nonneg (-Real.log (v (direction S Z y)))) (Finset.mem_univ x)).trans
      (le_add_of_nonneg_right (Finset.sum_nonneg fun _ _ => add_nonneg (abs_nonneg _) (abs_nonneg _)))
  · intro p r
    let f (x : P × P) := |Real.log (v (Z (.inl x.1)-Z (.inl x.2)))|+
      |Real.log (v (W (.inl x.1)-W (.inl x.2)))|
    have hf (y : P × P) (_ : y ∈ Finset.univ) : 0 ≤ f y := add_nonneg (abs_nonneg _) (abs_nonneg _)
    have h := Finset.single_le_sum hf (Finset.mem_univ (p,r))
    have hpos := Finset.sum_nonneg (s := Finset.univ) (fun (y : P × Q) _ => abs_nonneg (-Real.log (v (direction S Z y))))
    dsimp [f] at h
    constructor <;> linarith [abs_nonneg (Real.log (v (W (.inl p)-W (.inl r)))),
      abs_nonneg (Real.log (v (Z (.inl p)-Z (.inl r))))]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.radius_finite_support

∀ {P Q : Type} [inst : Fintype P] [inst_1 : Fintype Q] {K : Type u_1} [inst_2 : Field K]
  [inst_3 : NumberField K] (S : Q → Finset P) (Z W : P ⊕ Q → K),
  Function.HasFiniteSupport fun v => PlanarUnitDistances.profileRadius S Z W ↑v
Lean source · PlanarUnitDistances/GeometricLargeProfile.lean, lines 40–60
/-- With finitely many directions and point differences only finitely many finite
primes require nondegenerate level intervals. This includes zero coordinates. -/
theorem radius_finite_support {P Q : Type} [Fintype P] [Fintype Q] {K : Type*}
    [Field K] [NumberField K] (S : Q → Finset P) (Z W : P ⊕ Q → K) :
    Function.HasFiniteSupport (fun v : NumberField.FinitePlace K => profileRadius S Z W v.val) := by
  have logSupport (x : K) :
      Function.HasFiniteSupport (fun v : NumberField.FinitePlace K => |Real.log (v x)|) := by
    by_cases h : x = 0
    · subst x
      simp [Function.HasFiniteSupport,Function.support]
    · apply (NumberField.FinitePlace.hasFiniteMulSupport h).subset
      intro v hv
      change v x ≠ 1
      intro one
      exact hv (by simp [one])
  unfold profileRadius
  simp only [abs_neg,← NumberField.FinitePlace.coe_apply]
  apply Function.HasFiniteSupport.fun_add
  · exact Function.HasFiniteSupport.sum (fun x => logSupport (direction S Z x)) Finset.univ
  · exact Function.HasFiniteSupport.sum (fun x : P × P => Function.HasFiniteSupport.fun_add
      (logSupport (Z (.inl x.1)-Z (.inl x.2))) (logSupport (W (.inl x.1)-W (.inl x.2)))) Finset.univ

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.UniformNormalization.scale_large

∀ {P Q : Type} [inst : Fintype P] [inst_1 : Fintype Q] {K : Type u_1} [inst_2 : Field K]
  [inst_3 : NumberField K] (S : Q → Finset P),
  (∀ (q : Q), (S q).Nonempty) →
    ∀ {e : ℝ},
      0 < e →
        ∑ q, ↑(S q).card = e →
          OAI.PlanarUnitDistances.LocalHeightTransfer.LabelControl 28
              (PlanarUnitDistances.UniformNormalization.weight S e) →
            ∀ (Z W : P ⊕ Q → K),
              Function.Injective (Z ∘ Sum.inl) →
                Function.Injective (Z ∘ Sum.inr) →
                  (∀ (q : Q),
                      ∀ p ∈ S q, (Z (Sum.inl p) - Z (Sum.inr q)) * (W (Sum.inl p) - W (Sum.inr q)) = 1) →
                    ∀ (l u : AbsoluteValue K ℝ → ℝ),
                      (∀ (v : AbsoluteValue K ℝ) (x : P × Q),
                          l v ≤
                            PlanarUnitDistances.EdgeHeightScale.threshold v
                              (PlanarUnitDistances.UniformNormalization.direction S Z) x) →
                        (∀ (v : AbsoluteValue K ℝ) (x : P × Q),
                            PlanarUnitDistances.EdgeHeightScale.threshold v
                                (PlanarUnitDistances.UniformNormalization.direction S Z) x ≤
                              u v) →
                          ∀ {θ t : ℝ},
                            0 ≤ θ →
                              0 < t →
                                t * θ ≤ 1 / 100 →
                                  (∀ (p : P),
                                      ↑(PlanarUnitDistances.BoundedHeight.pointCenters S p).card / e ≤ θ) →
                                    (∀ (p : P),
                                        300 ≤ ↑(PlanarUnitDistances.BoundedHeight.pointCenters S p).card) →
                                      PlanarUnitDistances.BoundedHeight.twoEdgeInformation S e + 1 ≤
                                          30600 * PlanarUnitDistances.exactGap * Real.log t →
                                        2 ^ 2100 <
                                          PlanarUnitDistances.UniformNormalization.profileScale S e Z l u
Lean source · PlanarUnitDistances/LargeProfile.lean, lines 7–28
/-- The small-height branch is excluded at the manuscript's exact exponent, for
the original directions of the same edge law. In particular the normalization
cannot change the scale appearing in the conclusion. -/
theorem scale_large {P Q : Type} [Fintype P] [Fintype Q] {K : Type*} [Field K] [NumberField K]
    (S : Q → Finset P) (hrow : ∀ q, (S q).Nonempty) {e : ℝ} (he : 0 < e)
    (hm : ∑ q, ((S q).card : ℝ) = e) (hc : LabelControl 28 (weight S e))
    (Z W : P ⊕ Q → K) (hinjP : Function.Injective (Z ∘ Sum.inl))
    (hinjQ : Function.Injective (Z ∘ Sum.inr))
    (hedge : ∀ q p, p ∈ S q → (Z (.inl p)-Z (.inr q))*(W (.inl p)-W (.inr q))=1)
    (l u : AbsoluteValue K ℝ → ℝ) (hl : ∀ v x, l v ≤ threshold v (direction S Z) x)
    (hu : ∀ v x, threshold v (direction S Z) x ≤ u v)
    {θ t : ℝ} (hθ : 0 ≤ θ) (ht : 0 < t) (htθ : t*θ ≤ 1/100)
    (hatom : ∀ p, ((pointCenters S p).card : ℝ)/e ≤ θ)
    (hdeg : ∀ p, (300:ℝ) ≤ (pointCenters S p).card)
    (hD : twoEdgeInformation S e + 1 ≤ 30600*exactGap*Real.log t) :
    (2:ℝ)^2100 < profileScale S e Z l u := by
  obtain ⟨z,w,hp,hq,unit,hh⟩ := normalize S he hm hc Z W hinjP hinjQ hedge l u hl hu
  have h := small_height_endpoint S hrow he hm (z ∘ Sum.inl) (w ∘ Sum.inl)
    (z ∘ Sum.inr) (w ∘ Sum.inr) hp hq unit hθ ht htθ hatom hdeg hD
  have htotal := lt_of_lt_of_le h hh
  change 226*((2:ℝ)^2100+1) < 226*(profileScale S e Z l u + 1) at htotal
  exact (add_lt_add_iff_right 1).mp ((mul_lt_mul_iff_right₀ (by norm_num : (0:ℝ)<226)).mp htotal)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.CommonFieldModel.exists_model

∀ {P Q : Finset OAI.PlanarUnitDistances.CommonFieldModel.Plane},
  (∀ p ∈ P, ∀ (i : Fin 2), IsAlgebraic ℚ (p.ofLp i)) →
    (∀ q ∈ Q, ∀ (i : Fin 2), IsAlgebraic ℚ (q.ofLp i)) →
      Nonempty (OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
Lean source · PlanarUnitDistances/CommonCoordinates.lean, lines 64–92
theorem exists_model
    (hP : ∀p∈P,∀i,IsAlgebraic ℚ (p i))
    (hQ : ∀q∈Q,∀i,IsAlgebraic ℚ (q i)) : Nonempty (Model P Q) := by
  let Z := fun v : P⊕Q => _root_.PlanarUnitDistances.zCoord (location P Q v)
  let W := fun v : P⊕Q => star (Z v)
  have ha (v : P⊕Q) : IsAlgebraic ℚ (Z v) ∧ IsAlgebraic ℚ (W v) := by
    have h : ∀i,IsAlgebraic ℚ (location P Q v i) := by
      cases v with
      | inl p => exact hP p p.property
      | inr q => exact hQ q q.property
    have hh := CommonField.algebraic_coordinates (location P Q v) h
    have hz (x : Plane) : _root_.PlanarUnitDistances.zCoord x = (x 0 : ℂ)+(x 1 : ℂ)*Complex.I := by
      exact Complex.mk_eq_add_mul_I _ _
    simpa [Z,W,hz,sub_eq_add_neg] using hh
  let S : Finset ℂ := insert Complex.I (Finset.univ.image Z ∪ Finset.univ.image W)
  have halg : ∀z∈S,IsAlgebraic ℚ z := by
    intro z hz
    rcases Finset.mem_insert.mp hz with rfl | hz
    · exact CommonField.integral_I.isAlgebraic
    rcases Finset.mem_union.mp hz with hz|hz
    · obtain ⟨v,_,rfl⟩ := Finset.mem_image.mp hz
      exact (ha v).1
    · obtain ⟨v,_,rfl⟩ := Finset.mem_image.mp hz
      exact (ha v).2
  obtain ⟨F,hF,hfin,hnorm⟩ := CommonField.exists_normal_field S halg
  refine ⟨⟨F,hfin,hnorm,hF _ (Finset.mem_insert_self ..),fun v => ⟨Z v,hF _ ?_⟩,fun v => ⟨W v,hF _ ?_⟩,
    fun _ => rfl,fun _ => rfl⟩⟩
  · exact Finset.mem_insert_of_mem (Finset.mem_union_left _ (Finset.mem_image.mpr ⟨v,Finset.mem_univ _,rfl⟩))
  · exact Finset.mem_insert_of_mem (Finset.mem_union_right _ (Finset.mem_image.mpr ⟨v,Finset.mem_univ _,rfl⟩))

Kernel axioms used: propext, Classical.choice, Quot.sound.

4 The common-center walk

In this chapter

All logarithms are natural. In the comparison and truncation results below the fixed numerical parameters are

k = 2 18000 , ϵ = k − 1 / 10 = 2 − 1800 , e 0 = k − 1 / 125 = 2 − 144 , S 0 = 2 2100 .

The standalone scale lemma permits every ϵ > 0 . Write x + = max ( x , 0 ) . For a finite nonnegative measure, the mass of an event is the sum of its weights; the graph and path laws have total mass one. At a vertex of zero marginal probability any conditional distribution can be defined arbitrarily. Equivalently, discard vertices of zero marginal mass before forming finite conditional laws.

4.1 Sampling two neighbors of a common center

Definition 4.1 Edge law and two-edge law

Definition in Lean

Give every edge of a nonempty bipartite graph E ⊆ P × Q mass 1 / | E | . Let μ , κ be the point and center marginals. Draw q according to κ , then draw p , r independently and uniformly from its neighbors. Each permitted triple has mass 1 / ( | E | d ( q ) ) . More generally, for a stochastic matrix w ( q , p ) the joint point law is π ( p , r ) = ∑ q κ ( q ) w ( q , p ) w ( q , r ) . Both marginals are μ . Write D = ∑ p , r π ( p , r ) log ⁡ ( π ( p , r ) / ( μ ( p ) μ ( r ) ) ) , omitting zero-mass summands.

Inspect the Lean declarations

PlanarUnitDistances.ProofAssembly.tripleWeight

(P Q : Finset OAI.PlanarUnitDistances.Plane) → PlanarUnitDistances.ProofAssembly.UnitTriple P Q → ℝ
Lean source · PlanarUnitDistances/TripleSelection.lean, lines 11–15
/-- The original experiment has mass 1/(e deg(q)) on each triple consisting
of an ordered pair of neighbors of q; all other triples have mass zero. -/
def tripleWeight (P Q : Finset Plane) (x : UnitTriple P Q) : ℝ :=
  if x.1.1 ∈ unitRows P Q x.2 ∧ x.1.2 ∈ unitRows P Q x.2 then
    (incidences P Q * degree P x.2)⁻¹ else 0

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.BoundedHeight.centerLaw

{P : Type u_1} → {Q : Type u_2} → (Q → Finset P) → ℝ → Q → ℝ
Lean source · PlanarUnitDistances/UniformGraphHeight.lean, lines 9–11
/-- A finite edge set via a neighborhood on the center side. Isolated centers
are allowed and given an arbitrary probability row, since their marginal is zero. -/
def centerLaw {P Q : Type*} (S : Q → Finset P) (e : ℝ) (q : Q) : ℝ := (S q).card/e

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.BoundedHeight.neighborLaw

{P : Type u_1} → {Q : Type u_2} → [Fintype P] → (Q → Finset P) → Q → P → ℝ
Lean source · PlanarUnitDistances/UniformGraphHeight.lean, lines 13–14
def neighborLaw {P Q : Type*} [Fintype P] (S : Q → Finset P) (q : Q) (p : P) : ℝ :=
  if (S q).Nonempty then (if p ∈ S q then ((S q).card : ℝ)⁻¹ else 0) else (Fintype.card P : ℝ)⁻¹

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.BoundedHeight.twoEdgeInformation

{P : Type u_1} → {Q : Type u_2} → [Fintype P] → [Fintype Q] → (Q → Finset P) → ℝ → ℝ
Lean source · PlanarUnitDistances/UniformGraphHeight.lean, lines 19–22
def twoEdgeInformation {P Q : Type*} [Fintype P] [Fintype Q] (S : Q → Finset P) (e : ℝ) : ℝ :=
  let κ := centerLaw S e
  let w := neighborLaw S
  KL (wedge κ w) (fun z : P×P => marginal κ w z.1 * marginal κ w z.2)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.FiniteInformation.wedge

{P : Type u_1} → {Q : Type u_2} → [Fintype Q] → (Q → ℝ) → (Q → P → ℝ) → P × P → ℝ
Lean source · PlanarUnitDistances/Information.lean, lines 544–545
noncomputable def wedge (κ : Q → ℝ) (w : Q → P → ℝ) (pr : P × P) : ℝ :=
  ∑ q, κ q * w q pr.1 * w q pr.2

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.FiniteInformation.marginal

{P : Type u_1} → {Q : Type u_2} → [Fintype Q] → (Q → ℝ) → (Q → P → ℝ) → P → ℝ
Lean source · PlanarUnitDistances/Information.lean, lines 670–671
noncomputable def marginal (κ : Q → ℝ) (w : Q → P → ℝ) (p : P) : ℝ :=
  ∑ q, κ q * w q p

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.FiniteInformation.KL

{α : Type u_1} → [Fintype α] → (α → ℝ) → (α → ℝ) → ℝ
Lean source · PlanarUnitDistances/Information.lean, lines 10–11
noncomputable def KL {α : Type*} [Fintype α] (p q : α → ℝ) : ℝ :=
  ∑ a, p a * log (p a / q a)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.2 A common label

Lean verified

Let a finite probability space carry labels ℓ , r in the same nonempty finite set. Let s = Pr ( ℓ ≠ r ) , let u a , v a be counting probabilities on the label set, and assume 0 ≤ ξ ≤ 2 − 100 . Put B ( u , v ) = u v ( ( u v ) 2 / 25 + ξ ) . Assume for every a that

Pr ( ℓ = a , r = a ) ≤ B ( u a , v a ) , Pr ( ℓ ≠ a , r ≠ a ) ≤ B ( 1 − u a , 1 − v a ) , Pr ( ℓ ≠ a ) ≥ ( 27 / 50 ) ( 1 − u a ) , Pr ( r ≠ a ) ≥ ( 27 / 50 ) ( 1 − v a ) .

If s ≤ 2 − 52 , some a has Pr ( ℓ ≠ a ) + Pr ( r ≠ a ) ≤ 2 s . For every s , two independent draws from either one of the two marginal label laws disagree with probability at most 28 s . In the application u a , v a are the fractions of vertices with label a . The four hypotheses specialize the graph’s rectangle bounds and lower marginal bounds.

Proof

Put x a = u a v a and choose a maximizer a . Summing matched rectangles and using ∑ b x b ≤ 1 gives 1 − s ≤ x a 2 / 25 + ξ . Bernoulli’s inequality and the arithmetic-geometric mean inequality yield z := ( 1 − u a ) ( 1 − v a ) ≤ 1 − x a ≤ ( 25 / 2 ) ( s + ξ ) when s + ξ ≤ 1 . For small s this yields z ≤ 2 − 25 and z 2 / 25 ≤ 1 / 4 . Let h , k be the two exception probabilities and j their joint probability. Then j ≤ ( 27 / 100 ) z and h + k ≥ ( 27 / 25 ) z . Edges with precisely one exception disagree, so s ≥ h + k − 2 j ≥ ( h + k ) / 2 . This argument avoids separate upper bounds for h and k . Independent disagreement is at most 2 h on the left or 2 k on the right. For 2 − 52 < s < 1 / 28 use j ≤ ( 1 + ξ ) z and h , k ≤ s + j . For s ≥ 1 / 28 use probability at most one.

Inspect the Lean declarations

PlanarUnitDistances.matching_for_edge_law

∀ {Ω : Type u_1} {ι : Type u_2} [inst : Fintype Ω] [inst_1 : Fintype ι] [Nonempty ι] (mass : Ω → ℝ)
  (left right : Ω → ι) (u v : ι → ℝ) (ξ : ℝ),
  (∀ (e : Ω), 0 ≤ mass e) →
    ∑ e, mass e = 1 →
      (∀ (a : ι), 0 ≤ u a) →
        (∀ (a : ι), 0 ≤ v a) →
          ∑ a, u a = 1 →
            ∑ a, v a = 1 →
              0 ≤ ξ →
                ξ ≤ 1 / 2 ^ 100 →
                  (∀ (a : ι),
                      (PlanarUnitDistances.labelEvent mass fun e => left e = a ∧ right e = a) ≤
                        √(u a * v a) * (√(u a * v a) ^ (2 / 25) + ξ)) →
                    (∀ (a : ι),
                        (PlanarUnitDistances.labelEvent mass fun e => left e ≠ a ∧ right e ≠ a) ≤
                          √((1 - u a) * (1 - v a)) * (√((1 - u a) * (1 - v a)) ^ (2 / 25) + ξ)) →
                      (∀ (a : ι),
                          27 / 50 * (1 - u a) ≤ PlanarUnitDistances.labelEvent mass fun e => left e ≠ a) →
                        (∀ (a : ι),
                            27 / 50 * (1 - v a) ≤ PlanarUnitDistances.labelEvent mass fun e => right e ≠ a) →
                          have s := PlanarUnitDistances.labelEvent mass fun e => left e ≠ right e;
                          (s ≤ 1 / 2 ^ 52 →
                              ∃ a,
                                ((PlanarUnitDistances.labelEvent mass fun e => left e ≠ a) +
                                    PlanarUnitDistances.labelEvent mass fun e => right e ≠ a) ≤
                                  2 * s) ∧
                            1 - ∑ a, (PlanarUnitDistances.labelEvent mass fun e => left e = a) ^ 2 ≤ 28 * s ∧
                              1 - ∑ a, (PlanarUnitDistances.labelEvent mass fun e => right e = a) ^ 2 ≤ 28 * s
Lean source · PlanarUnitDistances/Matching.lean, lines 162–240
/-- Both conclusions of the manuscript's finite matching lemma, for actual
label maps on a finite edge probability space. The expansion and degree
premises are needed only for a single label and the two complementary sets.
They are the corresponding instances of the graph's rectangle and marginal
bounds, after pushing vertex counting measures to the finite label set. -/
theorem matching_for_edge_law {Ω ι : Type*} [Fintype Ω] [Fintype ι] [Nonempty ι]
    (mass : Ω → ℝ) (left right : Ω → ι) (u v : ι → ℝ) (ξ : ℝ)
    (hm : ∀ e, 0 ≤ mass e) (hΩ : ∑ e, mass e = 1)
    (hu : ∀ a, 0 ≤ u a) (hv : ∀ a, 0 ≤ v a)
    (hU : ∑ a, u a = 1) (hV : ∑ a, v a = 1)
    (hξ : 0 ≤ ξ) (hξsmall : ξ ≤ 1/(2 : ℝ)^100)
    (hcut : ∀ a, labelEvent mass (fun e => left e = a ∧ right e = a) ≤
      Real.sqrt (u a * v a) * ((Real.sqrt (u a * v a)) ^ (2/25 : ℝ) + ξ))
    (hcomp : ∀ a, labelEvent mass (fun e => left e ≠ a ∧ right e ≠ a) ≤
      Real.sqrt ((1-u a)*(1-v a)) * ((Real.sqrt ((1-u a)*(1-v a))) ^ (2/25 : ℝ) + ξ))
    (hleft : ∀ a, (27/50 : ℝ)*(1-u a) ≤ labelEvent mass (fun e => left e ≠ a))
    (hright : ∀ a, (27/50 : ℝ)*(1-v a) ≤ labelEvent mass (fun e => right e ≠ a)) :
    let s := labelEvent mass (fun e => left e ≠ right e)
    (s ≤ 1 / (2 : ℝ)^52 → ∃ a,
      labelEvent mass (fun e => left e ≠ a) + labelEvent mass (fun e => right e ≠ a) ≤ 2*s) ∧
    (1 - (∑ a, (labelEvent mass (fun e => left e = a))^2) ≤ 28*s ∧
     1 - (∑ a, (labelEvent mass (fun e => right e = a))^2) ≤ 28*s) := by
  classical
  let s := labelEvent mass (fun e => left e ≠ right e)
  let p (a : ι) := labelEvent mass (fun e => left e = a)
  let q (a : ι) := labelEvent mass (fun e => right e = a)
  let d (a : ι) := labelEvent mass (fun e => left e = a ∧ right e = a)
  let j (a : ι) := labelEvent mass (fun e => left e ≠ a ∧ right e ≠ a)
  let E := labelEvent mass
  have nonneg (F : Ω → Prop) : 0 ≤ E F := by
    unfold E labelEvent
    apply Finset.sum_nonneg
    intro e _
    split_ifs <;> simp [hm]
  have compl (F : Ω → Prop) : 1 - E F = E (fun e => ¬F e) := by
    rw [sub_eq_iff_eq_add, ← hΩ]
    simp only [E, labelEvent, ← Finset.sum_add_distrib]
    exact Finset.sum_congr rfl fun e _ => by by_cases he : F e <;> simp [he]
  have hdiag : 1 - s = ∑ a, d a := by
    rw [show s = E (fun e => left e ≠ right e) from rfl, compl]
    simp only [d, E, labelEvent, not_not]
    rw [Finset.sum_comm]
    apply Finset.sum_congr rfl
    intro e _
    by_cases lr : left e = right e
    · simp [lr, eq_comm]
    · have impossible (a : ι) : ¬(left e = a ∧ right e = a) :=
        fun ha => lr (ha.1.trans ha.2.symm)
      simp [lr, impossible]
  have families (a : ι) :
      (1-p a) + (1-q a) - 2*j a ≤ s ∧
      1-p a ≤ s+j a ∧ 1-q a ≤ s+j a := by
    change (1-E (fun e => left e = a)) + (1-E (fun e => right e = a)) - 2*j a ≤ s ∧
      1-E (fun e => left e = a) ≤ s+j a ∧ 1-E (fun e => right e = a) ≤ s+j a
    rw [compl, compl]
    simp only [j, s, E, labelEvent, Finset.mul_sum, ← Finset.sum_sub_distrib, ← Finset.sum_add_distrib]
    constructor
    · apply Finset.sum_le_sum
      intro e _
      by_cases h₁ : left e = a <;> by_cases h₂ : right e = a <;>
        by_cases h₃ : left e = right e <;> simp_all <;> linarith [hm e]
    · constructor <;> apply Finset.sum_le_sum <;> intro e _ <;>
        by_cases h₁ : left e = a <;> by_cases h₂ : right e = a <;>
        by_cases h₃ : left e = right e <;> simp_all
  have loL (a : ι) : 27/50*(1-u a) ≤ 1-p a := (compl (fun e => left e = a)).symm ▸ hleft a
  have loR (a : ι) : 27/50*(1-v a) ≤ 1-q a := (compl (fun e => right e = a)).symm ▸ hright a
  have np (a : ι) : p a ≤ 1 := by linarith [compl (fun e => left e = a), nonneg (fun e => left e ≠ a)]
  have nq (a : ι) : q a ≤ 1 := by linarith [compl (fun e => right e = a), nonneg (fun e => right e ≠ a)]
  have hs : 0 ≤ s := nonneg _
  constructor
  · intro ht
    obtain ⟨a, ha⟩ := small_mismatch_dominant_label u v d (fun a => 1-p a) (fun a => 1-q a)
      j hu hv hU hV hξ hξsmall ht hdiag hcut hcomp loL loR (fun a => (families a).1)
    refine ⟨a, ?_⟩
    change E (fun e => left e ≠ a) + E (fun e => right e ≠ a) ≤ 2*s
    rw [← compl (fun e => left e = a), ← compl (fun e => right e = a)]
    exact ha
  · exact independent_mismatch_le_twenty_eight u v d p q j hu hv hU hV np nq hξ hξsmall hs hdiag
      hcut hcomp loL loR (fun a => (families a).1) (fun a => (families a).2)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.3 Two rare neighbors

Lean verified

Let f ( q ) ∈ [ 0 , 1 ] be the conditional probability that a neighbor of q belongs to a fixed set of points. Let b q ≥ 0 be the center weights and h = ∑ q b q f ( q ) , where h ≤ δ ≤ 1 and 0 ≤ ξ ≤ 1 . For each subset G of centers write k G = ∑ q ∈ G b q . Assume

∑ q ∈ G b q f ( q ) ≤ 2 h 27 / 50 k G 27 / 50 + 2 ξ h k G .

Then the two-neighbor coincidence obeys

∑ q b q f ( q ) 2 ≤ 256 h max ( δ 4 / 27 , ξ ) .

When ∑ q b q = 1 , conditional independence identifies the left side with the probability that both neighbors lie in the fixed set. Lean also verifies ( 27 / 50 ) − 27 / 25 ≤ 2 and ( 27 / 50 ) − 1 ≤ 2 for the rectangle coefficients.

Proof

Use the set G t = { q : f ( q ) ≥ t } with t > 0 . For k t = ∑ G t b q , either t k t ≤ 4 h 27 / 50 k t 27 / 50 or t k t ≤ 4 ξ h k t . This yields

k t ≤ 4 50 / 23 h 27 / 23 t − 50 / 23 + 16 ξ 2 h t − 2 .

The exact identity ∑ b q f ( q ) 2 = ∫ 0 1 2 t k t d t follows by integrating finite interval indicators, including endpoint equalities. Below r = max ( δ 4 / 27 , ξ ) use t k t ≤ h ; above it integrate the two summands. Since h 4 / 27 ≤ r , one has h 27 / 23 r − 4 / 23 ≤ h r . Also r log ⁡ ( 1 / r ) ≤ 3 / 8 , by the tangent-line inequality for log at e and e ≥ 8 / 3 . Finally 4 50 / 23 ≤ 21 , so the three coefficients sum to at most 2 + ( 23 / 2 ) 21 + 12 < 256 . The case h = 0 follows immediately from f 2 ≤ f .

Inspect the Lean declarations

PlanarUnitDistances.rare_two_neighbors

∀ {ι : Type u_1} [inst : Fintype ι] (mass f : ι → ℝ) (h δ ξ : ℝ),
  (∀ (i : ι), 0 ≤ mass i) →
    (∀ (i : ι), f i ∈ Set.Icc 0 1) →
      ∑ i, mass i * f i = h →
        h ≤ δ →
          δ ≤ 1 →
            0 ≤ ξ →
              ξ ≤ 1 →
                (∀ (G : Finset ι),
                    ∑ i ∈ G, mass i * f i ≤
                      2 * h ^ (27 / 50) * (∑ i ∈ G, mass i) ^ (27 / 50) + 2 * ξ * √(h * ∑ i ∈ G, mass i)) →
                  ∑ i, mass i * f i ^ 2 ≤ 256 * h * max (δ ^ (4 / 27)) ξ
Lean source · PlanarUnitDistances/Rare.lean, lines 175–246
/-- Both neighbors of the same random center land in a small fixed set with
probability at most the manuscript's explicit \`256 h max(δ^(4/27),ξ)\`.
Here \`f i\` is the probability of that set conditional on center \`i\`.
The hypothesis tests the actual weighted center subsets. -/
theorem rare_two_neighbors {ι : Type*} [Fintype ι] (mass f : ι → ℝ)
    (h δ ξ : ℝ) (hm : ∀ i, 0 ≤ mass i) (hf : ∀ i, f i ∈ Icc (0:ℝ) 1)
    (hmean : ∑ i, mass i * f i = h) (hδ : h ≤ δ) (hδ1 : δ ≤ 1)
    (hξ : 0 ≤ ξ) (hξ1 : ξ ≤ 1)
    (hexp : ∀ G : Finset ι, (∑ i ∈ G, mass i * f i) ≤
      2*h^(27/50:ℝ)*(∑ i ∈ G, mass i)^(27/50:ℝ) +
      2*ξ*Real.sqrt (h*(∑ i ∈ G, mass i))) :
    (∑ i, mass i * (f i)^2) ≤ 256*h*max (δ^(4/27:ℝ)) ξ := by
  classical
  have hh : 0 ≤ h := hmean ▸ Finset.sum_nonneg (fun i _ => mul_nonneg (hm i) (hf i).1)
  let r := max (δ^(4/27:ℝ)) ξ
  have hd : δ^(4/27:ℝ) ≤ r := le_max_left _ _
  have hx : ξ ≤ r := le_max_right _ _
  have hr1 : r ≤ 1 := max_le (Real.rpow_le_one (hh.trans hδ) hδ1 (by norm_num)) hξ1
  have hhzero (hz : h = 0) : (∑ i, mass i * (f i)^2) ≤ 256*h*r := by
    have g (i : ι) : (f i)^2 ≤ f i := by
      have b := mul_nonneg (hf i).1 (sub_nonneg.mpr (hf i).2)
      nlinarith
    have small := Finset.sum_le_sum (s := Finset.univ) (fun i _ =>
      mul_le_mul_of_nonneg_left (g i) (hm i))
    rw [hmean, hz] at small
    simpa [hz] using small
  by_cases hz : h = 0
  · exact hhzero hz
  have hhp := lt_of_le_of_ne hh (Ne.symm hz)
  have hr : 0 < r := (Real.rpow_pos_of_pos (hhp.trans_le hδ) _).trans_le hd
  let T (t : ℝ) := ∑ i, if t ≤ f i then 2*t*mass i else 0
  have intT (a b : ℝ) : IntervalIntegrable T volume a b := by
    let F (i : ι) (t : ℝ) := if t ≤ f i then 2*t*mass i else 0
    have eqT : T = ∑ i, F i := by funext t; simp [T, F, Finset.sum_apply]
    rw [eqT]
    apply IntervalIntegrable.sum
    intro i _
    rw [intervalIntegrable_iff]
    change IntegrableOn ((Iic (f i)).indicator (fun t => 2*t*mass i)) _ _
    apply (integrableOn_indicator_iff measurableSet_Iic.nullMeasurableSet).2
    have hc : Continuous (fun t : ℝ => 2*t*mass i) := by fun_prop
    exact (intervalIntegrable_iff.mp (hc.intervalIntegrable a b)).mono_set inter_subset_right
  have low (t : ℝ) (_ : t ∈ Icc 0 r) : T t ≤ 2*h := by
    dsimp [T]
    rw [← hmean, Finset.mul_sum]
    apply Finset.sum_le_sum
    intro i _
    split_ifs with hft
    · nlinarith [mul_le_mul_of_nonneg_right hft (hm i)]
    · exact mul_nonneg (by norm_num) (mul_nonneg (hm i) (hf i).1)
  have high (t : ℝ) (ht : t ∈ Icc r 1) : T t ≤
      2*((4:ℝ)^(50/23:ℝ)*h^(27/23:ℝ))*t^(-27/23:ℝ) + 2*(16*ξ^2*h)*t⁻¹ := by
    have tp : 0 < t := hr.trans_le ht.1
    have tail := rare_tail_of_rectangles mass f h ξ hm hh hξ hexp t tp
    have ht' := mul_le_mul_of_nonneg_left tail (by positivity : 0 ≤ 2*t)
    have repr : T t = 2*t*(∑ i, if t ≤ f i then mass i else 0) := by
      dsimp [T]
      rw [Finset.mul_sum]
      exact Finset.sum_congr rfl (fun i _ => by split_ifs <;> simp)
    rw [repr]
    apply ht'.trans_eq
    have powid : t * (t^(50/23:ℝ))⁻¹ = t^(-27/23:ℝ) := by
      rw [← Real.rpow_neg tp.le]
      calc
        _ = t^(1:ℝ) * t^(-(50/23):ℝ) := by rw [Real.rpow_one]
        _ = _ := by rw [← Real.rpow_add tp]; norm_num
    have invid : t * (t^2)⁻¹ = t⁻¹ := by field_simp
    rw [← powid, ← invid]
    ring
  rw [rare_second_moment_integral mass f hf]
  exact (integrate_rare_tails T hr hr1 (by positivity) intT low high).trans
    (rare_cutoff_arithmetic hh hδ hr hξ hx hd)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.rare_marginal_constants

(27 / 50) ^ (-(1 + 2 / 25)) ≤ 2 ∧ (27 / 50)⁻¹ ≤ 2
Lean source · PlanarUnitDistances/Rare.lean, lines 267–275
/-- The two numerical multipliers rounding the marginal form of graph
expansion to a coefficient of two. -/
theorem rare_marginal_constants :
    (27/50 : ℝ)^(-(1+2/25):ℝ) ≤ 2 ∧ (27/50:ℝ)⁻¹ ≤ 2 := by
  constructor
  · apply (Real.rpow_le_rpow_iff (by positivity) (by norm_num) (by norm_num : 0 < (25:ℝ))).mp
    rw [← Real.rpow_mul (by norm_num)]
    norm_num
  · norm_num

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.4 Prediction for a prescribed scalar test

Lean verified

Let a fresh independent random test t have a finite code c t ( p ) from an alphabet of size M , a real inner-product space feature v t ( c ) of norm at most B , and a fixed center feature g t ( q ) of norm at most B ′ . Assume the codes and the resulting discrepancies are measurable as in the Lean statement. For each positive integer K there is a history H of length less than K , with at most M K − 1 values, for which the fresh-test average of

| ∑ q κ ( q ) ⟨ ∑ p w ( q , p ) ( v t ( c t ( p ) ) − E μ [ v t ( c t ( x ) ) ∣ H ( x ) = H ( p ) ] ) , g t ( q ) ⟩ |

is at most 4 B B ′ ( D / K ) 1 / 4 .

Proof

Sum the conditional relative entropies of consecutive code pairs. Their sum is at most the original relative entropy by the chain rule and data processing. Centered correlation under the two-edge law is an average of squares of conditional vector means. Cauchy–Schwarz and total variation bounds give the fourth root. Averaging over a prefix of independent tests and an independent fresh test gives a history for this prescribed pairing.

Inspect the Lean declarations

OAI.PlanarUnitDistances.FiniteInformation.exists_prediction_history

∀ {P : Type u_1} {Q : Type u_2} {C : Type u_3} {V : Type u_4} [inst : Fintype P] [inst_1 : Fintype Q]
  [inst_2 : Fintype C] [inst_3 : DecidableEq C] [inst_4 : NormedAddCommGroup V]
  [inst_5 : InnerProductSpace ℝ V] [inst_6 : MeasurableSpace C] {T : Type u_6} [inst_7 : MeasurableSpace T]
  {ν : MeasureTheory.Measure T} [MeasureTheory.IsProbabilityMeasure ν] [Nonempty C] (κ : Q → ℝ)
  (w : Q → P → ℝ),
  (∀ (q : Q), 0 ≤ κ q) →
    (∀ (q : Q) (p : P), 0 ≤ w q p) →
      ∑ q, κ q = 1 →
        (∀ (q : Q), ∑ p, w q p = 1) →
          ∀ (c : T → P → C) (v : T → C → V) (g : T → Q → V),
            (∀ (p : P), Measurable fun t => c t p) →
              (∀ (n : ℕ),
                  Measurable fun z =>
                    OAI.PlanarUnitDistances.FiniteInformation.testDiscrepancy κ w z.1 (c z.2) (v z.2)
                      (g z.2)) →
                ∀ {B B' : ℝ},
                  0 ≤ B →
                    0 ≤ B' →
                      (∀ (t : T) (c : C), ‖v t c‖ ≤ B) →
                        (∀ (t : T) (q : Q), ‖g t q‖ ≤ B') →
                          ∀ (K : ℕ),
                            0 < K →
                              ∃ n < K,
                                ∃ h,
                                  (Finset.image h Finset.univ).card ≤ Fintype.card C ^ (K - 1) ∧
                                    ∫ (t : T),
                                        OAI.PlanarUnitDistances.FiniteInformation.testDiscrepancy κ w h (c t)
                                          (v t) (g t) ∂ν ≤
                                      4 * B * B' *
                                        ((OAI.PlanarUnitDistances.FiniteInformation.KL
                                              (OAI.PlanarUnitDistances.FiniteInformation.wedge κ w) fun pr =>
                                              OAI.PlanarUnitDistances.FiniteInformation.marginal κ w pr.1 *
                                                OAI.PlanarUnitDistances.FiniteInformation.marginal κ w pr.2) /
                                            ↑K) ^
                                          (1 / 4)
Lean source · PlanarUnitDistances/Information.lean, lines 1030–1085
theorem exists_prediction_history [Nonempty C]
    (κ : Q → ℝ) (w : Q → P → ℝ)
    (hκ : ∀ q, 0 ≤ κ q) (hw : ∀ q p, 0 ≤ w q p)
    (hsκ : ∑ q, κ q = 1) (hsw : ∀ q, ∑ p, w q p = 1)
    (c : T → P → C) (v : T → C → V) (g : T → Q → V)
    (hc : ∀ p, Measurable (fun t => c t p))
    (hδ : ∀ n, Measurable (fun z : (P → History C n) × T =>
      testDiscrepancy κ w z.1 (c z.2) (v z.2) (g z.2)))
    {B B' : ℝ} (hB : 0 ≤ B) (hB' : 0 ≤ B')
    (hv : ∀ t c, ‖v t c‖ ≤ B) (hg : ∀ t q, ‖g t q‖ ≤ B')
    (K : ℕ) (hK : 0 < K) :
    ∃ n < K, ∃ h : P → History C n,
      (univ.image h).card ≤ (Fintype.card C)^(K-1) ∧
      (∫ t, testDiscrepancy κ w h (c t) (v t) (g t) ∂ν) ≤
        4*B*B'*(KL (wedge κ w)
          (fun pr : P × P => marginal κ w pr.1 * marginal κ w pr.2)/(K:ℝ))^(1/4:ℝ) := by
  classical
  let ρ : Measure (ℕ → T) := Measure.infinitePi (fun _ : ℕ => ν)
  let tests := fun n (ω : ℕ → T) => ω n
  have ht : ∀ n, Measurable (tests n) := fun n => measurable_pi_apply n
  have hind : iIndepFun tests ρ := iIndepFun_infinitePi (fun _ => measurable_id)
  have hlaw : ∀ n, ρ.map (tests n) = ν := fun n =>
    (measurePreserving_eval_infinitePi (fun _ : ℕ => ν) n).map_eq
  let t0 : T := Classical.choice (nonempty_of_isProbabilityMeasure ν)
  have hpred := random_prediction κ w hκ hw hsκ hsw tests ht hind hlaw t0 c v g hc hδ
    hB hB' hv hg K hK
  have hD : 0 ≤ KL (wedge κ w) (fun pr : P × P => marginal κ w pr.1 * marginal κ w pr.2) := by
    have hm := marginal_nonneg κ w hκ hw
    have hs := marginal_sum κ w hsκ hsw
    apply KL_nonneg _ _ (wedge_nonneg κ w hκ hw) (fun pr => mul_nonneg (hm _) (hm _))
      (wedge_sum κ w hsκ hsw) _ (wedge_ac κ w hκ hw)
    rw [Fintype.sum_prod_type, ← sum_mul_sum, hs, one_mul]
  rw [sqrt_sqrt_eq_quarter (div_nonneg hD (Nat.cast_nonneg K))] at hpred
  let R := 4*B*B'*(KL (wedge κ w)
    (fun pr : P × P => marginal κ w pr.1 * marginal κ w pr.2)/(K:ℝ))^(1/4:ℝ)
  let H := fun n ω p => transcript (fun k => c (tests k ω)) n p
  let F := fun n (ω : ℕ → T) => ∫ t, testDiscrepancy κ w (H n ω) (c t) (v t) (g t) ∂ν
  have hsum : (∑ n ∈ range K, ∫ ω, F n ω ∂ρ) ≤ ∑ _ ∈ range K, R := by
    have he := (div_le_iff₀ (show (0:ℝ) < K by exact_mod_cast hK)).mp hpred
    simpa only [sum_const, card_range, nsmul_eq_mul, mul_comm, R, F, H] using he
  obtain ⟨n,hn,hnb⟩ := exists_le_of_sum_le (nonempty_range_iff.mpr (Nat.ne_of_gt hK)) hsum
  have hH : Measurable (H n) := measurable_transcript _ (fun k p => (hc p).comp (ht k)) n
  have hpair : Measurable (fun z : (ℕ → T) × T => (H n z.1,z.2)) :=
    (hH.comp measurable_fst).prodMk measurable_snd
  have hi : Integrable (fun z : (ℕ → T) × T =>
      testDiscrepancy κ w (H n z.1) (c z.2) (v z.2) (g z.2)) (ρ.prod ν) :=
    Integrable.of_bound ((hδ n).comp hpair).aestronglyMeasurable (2*B*B')
      (Filter.Eventually.of_forall fun z => testDiscrepancy_bound κ w hκ hw hsκ hsw
        (H n z.1) (c z.2) (v z.2) (g z.2) hB hB' (hv z.2) (hg z.2))
  obtain ⟨ω,hω⟩ := exists_le_integral hi.integral_prod_left
  have hn' : n < K := mem_range.mp hn
  refine ⟨n,hn',H n ω,?_,hω.trans hnb⟩
  calc
    _ ≤ Fintype.card (History C n) := card_le_univ _
    _ = (Fintype.card C)^n := history_card C n
    _ ≤ _ := Nat.pow_le_pow_right Fintype.card_pos (by omega)

Kernel axioms used: propext, Classical.choice, Quot.sound.

4.2 The two threshold intervals

Lemma 4.5 The two threshold intervals and their arithmetic contribution

Lean verified

Let d , d ′ be distinct nonzero jumps in a number field. At a place v , sort b = − log ⁡ | d | v ≤ b ′ = − log ⁡ | d ′ | v , interchanging the jumps as necessary. Put c v = log ⁡ 2 at infinity and c v = 0 otherwise and T v = − log ⁡ | d − d ′ | v − b + c v . Then T v ≥ 0 . If the bits are both one, a reciprocal-coordinate match satisfying | 1 / d − 1 / d ′ | v ≤ e s + c v forces s ∈ [ b − T v , b ] . If they are both zero, a direct-coordinate match satisfying | d − d ′ | v ≤ e − s + c v forces s ∈ [ b ′ , b ′ + T v ] . With the usual place multiplicities and division by the field degree, the sum of 2 T v − ( b ′ − b ) is exactly 2 log ⁡ 2 .

Proof

The (ultra)metric triangle inequality gives T v ≥ 0 . The identity | 1 / d − 1 / d ′ | v = | d − d ′ | v / ( | d | v | d ′ | v ) gives the two endpoints. Locally the charge equals − log ⁡ | ( d − d ′ ) ( 1 / d − 1 / d ′ ) | v + 2 c v . The argument of the logarithm is nonzero, so Mathlib’s number-field product formula cancels the logarithmic terms. The sum of archimedean multiplicities equals the field degree.

Inspect the Lean declarations

OAI.PlanarUnitDistances.BudgetPlaces.normalized_flank_charge

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] {d d' : K},
  d ≠ 0 →
    d' ≠ 0 →
      d ≠ d' →
        (∑ v, ↑v.mult * OAI.PlanarUnitDistances.BudgetPlaces.flankCharge (↑v) (Real.log 2) d d' +
              ∑ᶠ (v : NumberField.FinitePlace K),
                OAI.PlanarUnitDistances.BudgetPlaces.flankCharge (↑v) 0 d d') /
            ↑(Module.finrank ℚ K) =
          2 * Real.log 2
Lean source · PlanarUnitDistances/FlankCharge.lean, lines 122–147
theorem normalized_flank_charge {d d' : K} (hd : d≠0) (hd' : d'≠0) (hdd : d≠d') :
    ((∑v : InfinitePlace K,(v.mult:ℝ)*flankCharge v.1 (log 2) d d')+
     ∑ᶠv : FinitePlace K,flankCharge v.1 0 d d')/(Module.finrank ℚ K:ℝ)=2*log 2 := by
  let y := differenceProduct d d'
  have hy : y≠0 := differenceProduct_ne_zero hdd
  have hi (v : InfinitePlace K) : 0 < v y := v.1.pos hy
  have hf (v : FinitePlace K) : 0 < v y := v.1.pos hy
  have hp := congrArg log (prod_abs_eq_one hy)
  have hi' : 0<(∏v : InfinitePlace K,v y^v.mult) := Finset.prod_pos (fun v _ => pow_pos (hi v) _)
  have hf' : 0<(∏ᶠv : FinitePlace K,v y) := by
    rw [finprod_eq_prod _ (FinitePlace.hasFiniteMulSupport hy)]
    exact Finset.prod_pos (fun v _ => hf v)
  rw [log_mul hi'.ne' hf'.ne',log_prod (fun v _ => (pow_pos (hi v) _).ne'),log_finprod hf,log_one] at hp
  simp only [log_pow] at hp
  have hI (v : InfinitePlace K) : flankCharge v.1 (log 2) d d' = -log (v y)+2*log 2 := flankCharge_eq v.1 _ hd hd' hdd
  have hF (v : FinitePlace K) : flankCharge v.1 0 d d' = -log (v y)+2*0 := flankCharge_eq v.1 _ hd hd' hdd
  simp_rw [hI,hF]
  change ((∑v : InfinitePlace K,(v.mult:ℝ)*(-log (v y)+2*log 2))+
    ∑ᶠ v : FinitePlace K,(-log (v y)+2*0))/(Module.finrank ℚ K:ℝ)=2*log 2
  simp only [mul_zero,add_zero,mul_add,mul_neg,Finset.sum_add_distrib,
    Finset.sum_neg_distrib,finsum_neg_distrib,←Finset.sum_mul] 
  have hm : (∑v : InfinitePlace K,(v.mult:ℝ))=(Module.finrank ℚ K:ℝ) := by
    exact_mod_cast (InfinitePlace.sum_mult_eq (K:=K))
  rw [hm]
  apply (div_eq_iff (Nat.cast_ne_zero.mpr (Module.finrank_pos (R:=ℚ) (M:=K)).ne')).mpr
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.BudgetPlaces.reciprocal_match_lower_flank

∀ {K : Type u_1} [inst : Field K] (v : AbsoluteValue K ℝ) {c s : ℝ} {d d' : K},
  d ≠ 0 →
    d' ≠ 0 →
      d ≠ d' →
        OAI.PlanarUnitDistances.BudgetPlaces.threshold v d ≤
            OAI.PlanarUnitDistances.BudgetPlaces.threshold v d' →
          s < OAI.PlanarUnitDistances.BudgetPlaces.threshold v d →
            v (d⁻¹ - d'⁻¹) ≤ Real.exp (s + c) →
              s ∈
                Set.Icc
                  (OAI.PlanarUnitDistances.BudgetPlaces.threshold v d -
                    (OAI.PlanarUnitDistances.BudgetPlaces.alpha v d d' + c))
                  (OAI.PlanarUnitDistances.BudgetPlaces.threshold v d)
Lean source · PlanarUnitDistances/FlankCharge.lean, lines 85–97
/-- On a bit-one pair, a match in the reciprocal coordinate forces the level
into the lower flank, including on the boundary. -/
theorem reciprocal_match_lower_flank (v : AbsoluteValue K ℝ) {c s : ℝ} {d d' : K}
    (hd : d≠0) (hd' : d'≠0) (hdd : d≠d') (hord : threshold v d ≤ threshold v d')
    (hbit : s < threshold v d) (hmatch : v (d⁻¹-d'⁻¹) ≤ exp (s+c)) :
    s ∈ Set.Icc (threshold v d-(alpha v d d'+c)) (threshold v d) := by
  have hi := v.pos (sub_ne_zero.mpr (inv_injective.ne hdd))
  have hm := log_le_log hi hmatch
  rw [log_exp,inv_difference_abs v hd hd',log_div (v.pos (sub_ne_zero.mpr hdd)).ne'
    (mul_ne_zero (v.pos hd).ne' (v.pos hd').ne'),log_mul (v.pos hd).ne' (v.pos hd').ne'] at hm
  constructor
  · unfold alpha; rw [min_eq_left hord]; unfold threshold at hord ⊢; linarith
  · exact hbit.le

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.BudgetPlaces.direct_match_upper_flank

∀ {K : Type u_1} [inst : Field K] (v : AbsoluteValue K ℝ) {c s : ℝ} {d d' : K},
  d ≠ d' →
    OAI.PlanarUnitDistances.BudgetPlaces.threshold v d ≤ OAI.PlanarUnitDistances.BudgetPlaces.threshold v d' →
      OAI.PlanarUnitDistances.BudgetPlaces.threshold v d' ≤ s →
        v (d - d') ≤ Real.exp (-s + c) →
          s ∈
            Set.Icc (OAI.PlanarUnitDistances.BudgetPlaces.threshold v d')
              (OAI.PlanarUnitDistances.BudgetPlaces.threshold v d' +
                (OAI.PlanarUnitDistances.BudgetPlaces.alpha v d d' + c))
Lean source · PlanarUnitDistances/FlankCharge.lean, lines 99–107
/-- On a bit-zero pair, a match in the direct coordinate forces the upper flank. -/
theorem direct_match_upper_flank (v : AbsoluteValue K ℝ) {c s : ℝ} {d d' : K}
    (hdd : d≠d') (hord : threshold v d ≤ threshold v d')
    (hbit : threshold v d' ≤ s) (hmatch : v (d-d') ≤ exp (-s+c)) :
    s ∈ Set.Icc (threshold v d') (threshold v d'+(alpha v d d'+c)) := by
  have hm := log_le_log (v.pos (sub_ne_zero.mpr hdd)) hmatch
  rw [log_exp] at hm
  refine ⟨hbit,?_⟩
  unfold alpha; rw [min_eq_left hord]; unfold threshold at hord ⊢; linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.6 Integrating the two threshold intervals

Lean verified

Let f be a nonincreasing global bit frequency, ϵ ≤ 1 / 2 , 0 ≤ ℓ ≤ 1 , T ≥ 0 , and b ≤ b ′ . Write I − = [ b − T , b ] , I + = [ b ′ , b ′ + T ] , and J = [ l , r ] . Rare-one contributions of value 2 are confined to I − ∩ { f < ϵ } , and rare-zero contributions to I + ∩ { f > 1 − ϵ } . Suppose the nonzero common contributions are confined to ( I − ∪ I + ) ∩ { ϵ ≤ f ≤ 1 − ϵ } and are at most 1 + ℓ on J and 1 − ℓ off J . For an integrable total contribution, its integral is at most

2 T + ℓ max ( 0 , r − l ) 1 { b , b ′ ∈ ( l , r ) } .
Proof

A rare-one occurrence prevents any common or rare-zero contribution to its right on I + ; a rare-zero occurrence similarly excludes the other flank. The total there is at most 2 pointwise on one interval of length T . In the remaining case let A , B denote the lengths of the intersections of J with the two flanks. The integral is at most 2 ( 1 − ℓ ) T + 2 ℓ ( A + B ) . If A + B > T , both overlaps have positive length and b , b ′ ∈ ( l , r ) . Their disjoint interiors give A + B ≤ r − l and each has length at most T , so 2 ( A + B − T ) ≤ r − l . This includes b = b ′ . Lemma 4.8 identifies the window of balanced common levels and averages its boundary contribution over the conditional neighbor law.

Inspect the Lean declarations

PlanarUnitDistances.Flanks.antitone_level_budget

∀ {b b' T l r ε ℓ : ℝ} {f : ℝ → ℝ},
  Antitone f →
    b ≤ b' →
      0 ≤ T →
        ε ≤ 1 / 2 →
          0 ≤ ℓ →
            ℓ ≤ 1 →
              ∀ (one zero : ℝ → Prop) (common : ℝ → ℝ),
                (∀ (s : ℝ), one s → s ∈ Set.Icc (b - T) b ∧ f s < ε) →
                  (∀ (s : ℝ), zero s → s ∈ Set.Icc b' (b' + T) ∧ 1 - ε < f s) →
                    (∀ (s : ℝ),
                        common s ≠ 0 →
                          ε ≤ f s ∧
                            f s ≤ 1 - ε ∧
                              (s ∈ Set.Icc (b - T) b ∨ s ∈ Set.Icc b' (b' + T)) ∧
                                common s ≤ if s ∈ Set.Icc l r then 1 + ℓ else 1 - ℓ) →
                      MeasureTheory.Integrable (fun s => (if one s ∨ zero s then 2 else 0) + common s)
                          MeasureTheory.volume →
                        ∫ (s : ℝ), (if one s ∨ zero s then 2 else 0) + common s ≤
                          2 * T + ℓ * if b ∈ Set.Ioo l r ∧ b' ∈ Set.Ioo l r then max 0 (r - l) else 0
Lean source · PlanarUnitDistances/FlankIntervals.lean, lines 85–164
/-- A rare occurrence of either orientation fixes the only remaining flank;
the other flank is too late (respectively too early) by monotonicity of the
global bit-one frequency. The common-only case uses the exact overlap bound. -/
theorem antitone_level_budget {b b' T l r ε ℓ : ℝ} {f : ℝ → ℝ} (hf : Antitone f)
    (hbb : b≤b') (hT : 0≤T) (hε : ε≤1/2) (hℓ : 0≤ℓ) (hℓ1 : ℓ≤1)
    (one zero : ℝ → Prop) (common : ℝ → ℝ)
    (h1 : ∀s,one s → s∈Icc (b-T) b ∧ f s<ε)
    (h0 : ∀s,zero s → s∈Icc b' (b'+T) ∧ 1-ε<f s)
    (hc : ∀s,common s≠0 → ε≤f s ∧ f s≤1-ε ∧
      (s∈Icc (b-T) b ∨ s∈Icc b' (b'+T)) ∧
      common s≤(if s∈Icc l r then 1+ℓ else 1-ℓ))
    (hInt : Integrable (fun s => (if one s ∨ zero s then (2:ℝ) else 0)+common s)) :
    (∫s, (if one s ∨ zero s then (2:ℝ) else 0)+common s) ≤
      2*T+ℓ*(if b∈Ioo l r ∧ b'∈Ioo l r then max 0 (r-l) else 0) := by
  classical
  let g := fun s => (if one s ∨ zero s then (2:ℝ) else 0)+common s
  have hbound (s : ℝ) : g s≤2 := by
    by_cases hr : one s ∨ zero s
    · have z : common s=0 := by
        by_contra hh
        obtain ⟨hlo,hhi,_⟩ := hc s hh
        rcases hr with h | h
        · linarith [(h1 s h).2]
        · linarith [(h0 s h).2]
      simp [g,hr,z]
    · simp only [g,if_neg hr,zero_add]
      by_cases hz : common s=0
      · simp [hz]
      · have h := (hc s hz).2.2.2; split_ifs at h <;> linarith
  have hCap : 2*T ≤ 2*T+ℓ*(if b∈Ioo l r ∧ b'∈Ioo l r then max 0 (r-l) else 0) := by
    apply le_add_of_nonneg_right; split_ifs <;> positivity
  have hSingle (x y : ℝ) (hxy : y-x=T) (hs : ∀s,s∉Icc x y → g s=0) :
      (∫s,g s)≤2*T := by
    have hh := integral_mono hInt (interval_integrable x y 2) (fun s => show g s≤_ from by
      by_cases h : s∈Icc x y
      · simpa only [indicator_of_mem h] using hbound s
      · simp [indicator_of_notMem h,hs s h])
    rw [interval_integral,hxy,max_eq_right hT] at hh
    linarith
  change (∫s,g s)≤_
  by_cases hOne : ∃s,one s
  · obtain ⟨s₀,hs₀⟩ := hOne
    obtain ⟨hsL,hfs⟩ := h1 s₀ hs₀
    apply le_trans (hSingle (b-T) b (by ring) ?_) hCap
    intro s hs
    have hn1 : ¬one s := fun h => hs (h1 s h).1
    have hn0 : ¬zero s := by
      intro h
      have he := hf (hsL.2.trans (hbb.trans (h0 s h).1.1))
      linarith [(h0 s h).2]
    have hnC : common s=0 := by
      by_contra h
      obtain ⟨hl,_,hS,_⟩ := hc s h
      have hR := hS.resolve_left hs
      linarith [hf (hsL.2.trans (hbb.trans hR.1))]
    simp [g,hn1,hn0,hnC]
  · have hn1 : ∀s,¬one s := fun s h => hOne ⟨s,h⟩
    by_cases hZero : ∃s,zero s
    · obtain ⟨s₀,hs₀⟩ := hZero
      obtain ⟨hsR,hfs⟩ := h0 s₀ hs₀
      apply le_trans (hSingle b' (b'+T) (by ring) ?_) hCap
      intro s hs
      have hn0 : ¬zero s := fun h => hs (h0 s h).1
      have hnC : common s=0 := by
        by_contra h
        obtain ⟨_,hu,hS,_⟩ := hc s h
        have hL := hS.resolve_right hs
        linarith [hf (hL.2.trans (hbb.trans hsR.1))]
      simp [g,hn1,hn0,hnC]
    · have hn0 : ∀s,¬zero s := fun s h => hZero ⟨s,h⟩
      have hfi (x y : ℝ) : Integrable (flankDensity x y l r ℓ) :=
        (interval_integrable ..).add (interval_integrable ..)
      apply le_trans _ (integrated_common_flanks hbb hT hℓ)
      apply integral_mono hInt ((hfi ..).add (hfi ..))
      intro s
      simp only [if_neg (not_or.mpr ⟨hn1 s,hn0 s⟩),zero_add,Pi.add_apply,flankDensity_eq]
      by_cases hh : common s=0
      · rw [hh]; split_ifs <;> linarith
      · obtain ⟨_,_,hs,hg⟩ := hc s hh
        split_ifs at hg ⊢ <;> simp_all <;> linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Flanks.integrated_common_flanks

∀ {b b' T l r ℓ : ℝ},
  b ≤ b' →
    0 ≤ T →
      0 ≤ ℓ →
        ∫ (s : ℝ),
            PlanarUnitDistances.Flanks.flankDensity (b - T) b l r ℓ s +
              PlanarUnitDistances.Flanks.flankDensity b' (b' + T) l r ℓ s ≤
          2 * T + ℓ * if b ∈ Set.Ioo l r ∧ b' ∈ Set.Ioo l r then max 0 (r - l) else 0
Lean source · PlanarUnitDistances/FlankIntervals.lean, lines 63–71
lemma integrated_common_flanks {b b' T l r ℓ : ℝ}
    (hbb : b≤b') (hT : 0≤T) (hℓ : 0≤ℓ) :
    (∫s,flankDensity (b-T) b l r ℓ s+flankDensity b' (b'+T) l r ℓ s) ≤
      2*T+ℓ*(if b ∈ Ioo l r ∧ b' ∈ Ioo l r then max 0 (r-l) else 0) := by
  have hf (x y : ℝ) : Integrable (flankDensity x y l r ℓ) :=
    (interval_integrable ..).add (interval_integrable ..)
  rw [integral_add (hf ..) (hf ..), flankDensity_integral,flankDensity_integral,
    show b-(b-T)=T by ring,show b'+T-b'=T by ring,max_eq_right hT]
  linarith [overlap_budget (l:=l) (r:=r) hbb hT hℓ]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.7 The signed score for a fixed pair

Lean verified

Let d , d ′ be distinct nonzero jumps in a field with absolute value | ⋅ | v . Write b = − log ⁡ | d | v ≤ b ′ = − log ⁡ | d ′ | v and let T = α + c v ≥ 0 as in the two-interval estimate. The first-coordinate match at level s must imply | d − d ′ | v ≤ e − s + c v and the second must imply | d − 1 − d ′ − 1 | v ≤ e s + c v . Use the actual common coefficient 1 ± 1 / 6 and any good-level and exceptional-base test for the rare coefficient 2 . Suppose the global bit tail is nonincreasing, the common balanced levels lie in [ l , r ] , and the sum of the two positive terms is integrable. Its integral minus | b − b ′ | is at most

2 T − ( b ′ − b ) + 1 6 max ( 0 , r − l ) 1 { b , b ′ ∈ ( l , r ) } .
Proof

For two equal one bits use the reciprocal match bound, and for two equal zero bits use the direct match bound. These implications place the positive terms on the two closed flanks. On a common level the larger coefficient occurs only in the balanced window. Apply the two-interval integral bound and subtract b ′ − b .

Inspect the Lean declarations

PlanarUnitDistances.Flanks.sorted_slot_bound

∀ {K : Type u_1} [inst : Field K] (v : AbsoluteValue K ℝ) {d d' : K},
  d ≠ 0 →
    d' ≠ 0 →
      d ≠ d' →
        OAI.PlanarUnitDistances.BudgetPlaces.threshold v d ≤
            OAI.PlanarUnitDistances.BudgetPlaces.threshold v d' →
          ∀ {lo hi ε c l r : ℝ},
            ε ≤ 1 / 2 →
              0 ≤ OAI.PlanarUnitDistances.BudgetPlaces.alpha v d d' + c →
                ∀ {f g : ℝ → ℝ},
                  Antitone f →
                    PlanarUnitDistances.Flanks.balancedRegion lo hi ε (1 / √24) f g ⊆ Set.Icc l r →
                      ∀ (zMatch wMatch keep : ℝ → Prop),
                        (∀ (s : ℝ), zMatch s → v (d - d') ≤ Real.exp (-s + c)) →
                          (∀ (s : ℝ), wMatch s → v (d⁻¹ - d'⁻¹) ≤ Real.exp (s + c)) →
                            MeasureTheory.Integrable
                                (PlanarUnitDistances.Flanks.positive lo hi ε
                                  (OAI.PlanarUnitDistances.BudgetPlaces.threshold v d)
                                  (OAI.PlanarUnitDistances.BudgetPlaces.threshold v d') f g zMatch wMatch
                                  keep)
                                MeasureTheory.volume →
                              (∫ (s : ℝ),
                                    PlanarUnitDistances.Flanks.positive lo hi ε
                                      (OAI.PlanarUnitDistances.BudgetPlaces.threshold v d)
                                      (OAI.PlanarUnitDistances.BudgetPlaces.threshold v d') f g zMatch wMatch
                                      keep s) -
                                  |OAI.PlanarUnitDistances.BudgetPlaces.threshold v d -
                                      OAI.PlanarUnitDistances.BudgetPlaces.threshold v d'| ≤
                                OAI.PlanarUnitDistances.BudgetPlaces.flankCharge v c d d' +
                                  1 / 6 *
                                    if
                                        OAI.PlanarUnitDistances.BudgetPlaces.threshold v d ∈ Set.Ioo l r ∧
                                          OAI.PlanarUnitDistances.BudgetPlaces.threshold v d' ∈
                                            Set.Ioo l r then
                                      max 0 (r - l)
                                    else 0
Lean source · PlanarUnitDistances/FlankSlot.lean, lines 22–80
/-- The fixed-pair calculation, using literal direct and reciprocal matches,
the actual coefficient of the conditional bias, and the complete bit
disagreement. The exceptional/good test is arbitrary in this upper bound. -/
theorem sorted_slot_bound {K : Type*} [Field K] (v : AbsoluteValue K ℝ) {d d' : K}
    (hd : d≠0) (hd' : d'≠0) (hne : d≠d') (ord : BudgetPlaces.threshold v d ≤ BudgetPlaces.threshold v d')
    {lo hi ε c l r : ℝ} (he : ε≤1/2) (hT : 0≤BudgetPlaces.alpha v d d'+c)
    {f g : ℝ → ℝ} (hf : Antitone f)
    (win : balancedRegion lo hi ε (1/sqrt 24) f g ⊆ Icc l r)
    (zMatch wMatch keep : ℝ → Prop)
    (hz : ∀s,zMatch s → v (d-d')≤exp (-s+c)) (hw : ∀s,wMatch s → v (d⁻¹-d'⁻¹)≤exp (s+c))
    (hint : Integrable (positive lo hi ε (BudgetPlaces.threshold v d) (BudgetPlaces.threshold v d')
      f g zMatch wMatch keep)) :
    (∫s,positive lo hi ε (BudgetPlaces.threshold v d) (BudgetPlaces.threshold v d') f g zMatch wMatch keep s)-
      |BudgetPlaces.threshold v d-BudgetPlaces.threshold v d'| ≤
      BudgetPlaces.flankCharge v c d d'+(1/6:ℝ)*
      (if BudgetPlaces.threshold v d∈Ioo l r ∧ BudgetPlaces.threshold v d'∈Ioo l r then max 0 (r-l) else 0) := by
  let b := BudgetPlaces.threshold v d
  let b' := BudgetPlaces.threshold v d'
  let T := BudgetPlaces.alpha v d d'+c
  let A := fun s => s∈Icc lo hi ∧ keep s ∧ f s<ε ∧ bothOne b b' wMatch s
  let B := fun s => s∈Icc lo hi ∧ keep s ∧ 1-ε<f s ∧ bothZero b b' zMatch s
  have leftInt (s : ℝ) (h : bothOne b b' wMatch s) : s∈Icc (b-T) b :=
    BudgetPlaces.reciprocal_match_lower_flank v hd hd' hne ord h.1 (hw s h.2.2)
  have rightInt (s : ℝ) (h : bothZero b b' zMatch s) : s∈Icc b' (b'+T) :=
    BudgetPlaces.direct_match_upper_flank v hne ord h.2.1 (hz s h.2.2)
  have cap (s : ℝ) (hh : commonPositive lo hi ε b b' f g zMatch wMatch s≠0) :
      ε≤f s ∧ f s≤1-ε ∧ (s∈Icc (b-T) b ∨ s∈Icc b' (b'+T)) ∧
      commonPositive lo hi ε b b' f g zMatch wMatch s≤(if s∈Icc l r then 1+1/6 else 1-1/6) := by
    unfold commonPositive at hh ⊢
    split_ifs at hh with h
    · rw [if_pos h]
      refine ⟨h.1.2.1,h.1.2.2,h.2.imp (leftInt s) (rightInt s),?_⟩
      unfold StrictCross.coefficient
      by_cases bal : |g s-1/2|≤1/sqrt 24
      · rw [if_pos bal,if_pos (win ⟨h.1,bal⟩)]
      · rw [if_neg bal]; split_ifs <;> norm_num
    · exact (hh rfl).elim
  have eqp (s : ℝ) (D : Decidable (A s ∨ B s)) :
      (@ite ℝ (A s ∨ B s) D 2 0)+commonPositive lo hi ε b b' f g zMatch wMatch s =
      positive lo hi ε b b' f g zMatch wMatch keep s := by
    unfold positive rarePositive
    by_cases h : A s ∨ B s
    · rw [if_pos h]
      dsimp only [A,B] at h
      rw [if_pos h]
    · rw [if_neg h]
      dsimp only [A,B] at h
      rw [if_neg h]
  have p := antitone_level_budget hf ord hT he (by norm_num : (0:ℝ)≤1/6)
    (by norm_num : (1/6:ℝ)≤1) A B (commonPositive lo hi ε b b' f g zMatch wMatch)
    (fun s h => ⟨leftInt s h.2.2.2,h.2.2.1⟩) (fun s h => ⟨rightInt s h.2.2.2,h.2.2.1⟩) cap
    (by simp_rw [eqp]; exact hint)
  simp_rw [eqp] at p
  change (∫s,positive lo hi ε b b' f g zMatch wMatch keep s) ≤ 2*T+_ at p
  change (∫s,positive lo hi ε b b' f g zMatch wMatch keep s)-|b-b'|≤_+_
  unfold BudgetPlaces.flankCharge
  change _ ≤ 2*T-(max b b'-min b b')+_
  rw [max_eq_right ord,min_eq_left ord,abs_of_nonpos (sub_nonpos.mpr ord)]
  linarith only [p]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.8 Averaging the balanced-window boundary term

Lean verified

Let Z be a real threshold with a finite conditional distribution μ and write f ( s ) = Pr ( Z > s ) . Suppose | f ( s ) − 1 / 2 | ≤ 1 / 24 throughout J = ( l , r ) . If Z ′ is an independent draw from the same conditional law, then

max ( 0 , r − l ) 6 Pr ( Z , Z ′ ∈ J ) ≤ 1 15 ∫ J 2 f ( s ) ( 1 − f ( s ) ) d s .

At any place, intersect its bounded range of levels with the global common-level condition and | f ( s ) − 1 / 2 | ≤ 1 / 24 . The resulting set is contained in [ l , r ] and contains ( l , r ) for a choice of endpoints, with an inverted interval allowed in the empty case. The same bound then holds with the full common region on the right.

Proof

If J contains an atom, take its smallest and largest attained thresholds. Evaluating the tail immediately before the smallest threshold, still in J , and at the largest threshold bounds the mass inside J by 2 / 24 . The double-interior probability is its square, at most 1 / 6 . On J , 2 f ( 1 − f ) = 1 / 2 − 2 ( f − 1 / 2 ) 2 ≥ 5 / 12 . The left side is thus at most | J | / 36 and the right side is at least | J | / 36 . If J contains no atom then the left side is zero. The finite tail sum is measurable, and 2 f ( 1 − f ) is bounded on this balanced interval, which gives integrability there.

Inspect the Lean declarations

PlanarUnitDistances.Flanks.finite_balanced_window

∀ {X : Type u_1} [inst : Fintype X] (μ Z : X → ℝ),
  (∀ (x : X), 0 ≤ μ x) →
    ∑ x, μ x = 1 →
      ∀ (lo hi ε : ℝ) {f : ℝ → ℝ},
        Antitone f →
          ∃ l r,
            PlanarUnitDistances.Flanks.balancedRegion lo hi ε (1 / √24) f
                  (PlanarUnitDistances.Flanks.thresholdTail μ Z) ⊆
                Set.Icc l r ∧
              Set.Ioo l r ⊆
                  PlanarUnitDistances.Flanks.balancedRegion lo hi ε (1 / √24) f
                    (PlanarUnitDistances.Flanks.thresholdTail μ Z) ∧
                (1 / 6 * max 0 (r - l) *
                    ∑ x, ∑ y, if Z x ∈ Set.Ioo l r ∧ Z y ∈ Set.Ioo l r then μ x * μ y else 0) ≤
                  1 / 15 *
                    ∫ (s : ℝ) in PlanarUnitDistances.Flanks.commonRegion lo hi ε f,
                      2 * PlanarUnitDistances.Flanks.thresholdTail μ Z s *
                        (1 - PlanarUnitDistances.Flanks.thresholdTail μ Z s)
Lean source · PlanarUnitDistances/BalancedWindow.lean, lines 51–75
/-- The interval and the precise 1/15 correction are simultaneously available
for the actual global and conditional tails, including atoms at endpoints. -/
theorem finite_balanced_window {X : Type*} [Fintype X] (μ Z : X → ℝ)
    (hμ : ∀x,0≤μ x) (total : ∑x,μ x=1) (lo hi ε : ℝ) {f : ℝ → ℝ} (hf : Antitone f) :
    ∃ l r : ℝ, balancedRegion lo hi ε (1/sqrt 24) f (thresholdTail μ Z) ⊆ Icc l r ∧
      Ioo l r ⊆ balancedRegion lo hi ε (1/sqrt 24) f (thresholdTail μ Z) ∧
      (1/6:ℝ)*max 0 (r-l)*(∑x,∑y,if Z x∈Ioo l r ∧ Z y∈Ioo l r then μ x*μ y else 0) ≤
      (1/15:ℝ)*∫s in commonRegion lo hi ε f,2*thresholdTail μ Z s*(1-thresholdTail μ Z s) := by
  obtain ⟨l,r,hc,hi'⟩ := exists_balanced_window lo hi ε (1/sqrt 24) hf (tail_antitone μ Z hμ)
  refine ⟨l,r,hc,hi', (balanced_window_pair_charge μ Z hμ l r (fun s hs => (hi' hs).2)).trans ?_⟩
  apply mul_le_mul_of_nonneg_left _ (by norm_num)
  have hm : Measurable (thresholdTail μ Z) :=
    Finset.measurable_fun_sum _ (fun x _ => Measurable.ite measurableSet_Iio measurable_const measurable_const)
  have hb (s : ℝ) := tail_bounds μ Z hμ total s
  have hn (s : ℝ) : 0≤2*thresholdTail μ Z s*(1-thresholdTail μ Z s) :=
    mul_nonneg (mul_nonneg (by norm_num) (hb s).1) (sub_nonneg.mpr (hb s).2)
  have hsubset : commonRegion lo hi ε f ⊆ Icc lo hi := fun _ h => h.1
  have hfin := (measure_mono (μ:=volume) hsubset).trans_lt (measure_Icc_lt_top (μ:=volume))
  have hint := IntegrableOn.of_bound (f:=fun s => 2*thresholdTail μ Z s*(1-thresholdTail μ Z s)) hfin
    ((measurable_const.mul hm).mul (measurable_const.sub hm)).aestronglyMeasurable 1
    (Filter.Eventually.of_forall fun s => by
      rw [Real.norm_eq_abs,abs_of_nonneg (hn s)]
      nlinarith [sq_nonneg (thresholdTail μ Z s-1/2)])
  exact setIntegral_mono_set hint (Filter.Eventually.of_forall hn)
    (Filter.Eventually.of_forall fun _ hs => (hi' hs).1)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Flanks.interiorMass_le

∀ {X : Type u_1} [inst : Fintype X] (μ Z : X → ℝ) {l r δ : ℝ},
  0 ≤ δ →
    (∀ s ∈ Set.Ioo l r, |PlanarUnitDistances.Flanks.thresholdTail μ Z s - 1 / 2| ≤ δ) →
      PlanarUnitDistances.Flanks.interiorMass μ Z l r ≤ 2 * δ
Lean source · PlanarUnitDistances/BalancedFlank.lean, lines 14–54
lemma interiorMass_le {X : Type*} [Fintype X] (μ Z : X → ℝ)
    {l r δ : ℝ} (hδ : 0≤δ) (h : ∀s∈Ioo l r, |thresholdTail μ Z s-1/2|≤δ) :
    interiorMass μ Z l r ≤ 2*δ := by
  classical
  let A := univ.filter (fun x => Z x∈Ioo l r)
  by_cases ha : A.Nonempty
  · obtain ⟨m,hm,hmin⟩ := exists_min_image A Z ha
    obtain ⟨M,hM,hmax⟩ := exists_max_image A Z ha
    have hmi := (mem_filter.mp hm).2
    have hMi := (mem_filter.mp hM).2
    let s := (l+Z m)/2
    have hs₁ : l<s := by dsimp [s]; linarith [hmi.1]
    have hs₂ : s<Z m := by dsimp [s]; linarith [hmi.1]
    have hRange : s∈Ioo l r := ⟨hs₁,hs₂.trans hmi.2⟩
    have hid : interiorMass μ Z l r = thresholdTail μ Z s-thresholdTail μ Z (Z M) := by
      unfold interiorMass thresholdTail
      rw [←sum_sub_distrib]
      apply sum_congr rfl
      intro x _
      by_cases hx : Z x∈Ioo l r
      · have hxA : x∈A := mem_filter.mpr ⟨mem_univ _,hx⟩
        simp only [if_pos hx,if_pos (hs₂.trans_le (hmin x hxA)),if_neg (not_lt.mpr (hmax x hxA)),sub_zero]
      · rw [if_neg hx]
        by_cases hxs : s<Z x
        · have hxM : Z M<Z x := by
            by_contra! hn
            exact hx ⟨hs₁.trans hxs,hn.trans_lt hMi.2⟩
          rw [if_pos hxs,if_pos hxM,sub_self]
        · have hxM : ¬Z M<Z x := by
            intro hxy
            exact hxs (hs₂.trans_le (hmin M hM) |>.trans hxy)
          rw [if_neg hxs,if_neg hxM,sub_zero]
    rw [hid]
    linarith [(abs_le.mp (h s hRange)).2,(abs_le.mp (h (Z M) hMi)).1]
  · have hz : interiorMass μ Z l r=0 := by
      unfold interiorMass
      apply sum_eq_zero
      intro x _
      apply if_neg
      exact fun hx => ha ⟨x,mem_filter.mpr ⟨mem_univ _,hx⟩⟩
    rw [hz]; linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Flanks.balanced_window_pair_charge

∀ {X : Type u_1} [inst : Fintype X] (μ Z : X → ℝ),
  (∀ (x : X), 0 ≤ μ x) →
    ∀ (l r : ℝ),
      (∀ s ∈ Set.Ioo l r, |PlanarUnitDistances.Flanks.thresholdTail μ Z s - 1 / 2| ≤ 1 / √24) →
        (1 / 6 * max 0 (r - l) * ∑ x, ∑ y, if Z x ∈ Set.Ioo l r ∧ Z y ∈ Set.Ioo l r then μ x * μ y else 0) ≤
          1 / 15 *
            ∫ (s : ℝ) in Set.Ioo l r,
              2 * PlanarUnitDistances.Flanks.thresholdTail μ Z s *
                (1 - PlanarUnitDistances.Flanks.thresholdTail μ Z s)
Lean source · PlanarUnitDistances/BalancedFlank.lean, lines 56–99
/-- On a balanced common window, averaging the indicator that both independent
thresholds lie strictly inside costs at most one fifteenth of the integrated
conditional disagreement. Window length is zero for reversed endpoints. -/
theorem balanced_window_pair_charge {X : Type*} [Fintype X] (μ Z : X → ℝ)
    (hμ : ∀x,0≤μ x) (l r : ℝ)
    (hbal : ∀s∈Ioo l r,|thresholdTail μ Z s-1/2|≤1/sqrt 24) :
    (1/6:ℝ)*max 0 (r-l)* (∑ x,∑ y,if Z x∈Ioo l r ∧ Z y∈Ioo l r then μ x*μ y else 0)
      ≤ (1/15:ℝ)*∫s in Ioo l r,2*thresholdTail μ Z s*(1-thresholdTail μ Z s) := by
  classical
  have hδ : 0≤1/sqrt (24:ℝ) := by positivity
  have hmass := interiorMass_le μ Z hδ hbal
  have hmass0 : 0 ≤ interiorMass μ Z l r := Finset.sum_nonneg (fun x _ => by split_ifs; exact hμ x; exact le_rfl)
  have hsq := (sq_le_sq₀ hmass0 (by positivity)).mpr hmass
  have hs := Real.sq_sqrt (by norm_num : (0:ℝ)≤24)
  have hδsq : (1/Real.sqrt 24)^2=(1/24:ℝ) := by rw [div_pow,hs]; norm_num
  have hsimp : (2*(1/Real.sqrt 24))^2=(1/6:ℝ) := by rw [mul_pow,hδsq]; norm_num
  have hp : (∑ x,∑ y,if Z x∈Ioo l r ∧ Z y∈Ioo l r then μ x*μ y else 0)=
      (interiorMass μ Z l r)^2 := by
    unfold interiorMass
    rw [pow_two,sum_mul]
    apply sum_congr rfl; intro x _
    rw [mul_sum]
    apply sum_congr rfl; intro y _
    by_cases hx : Z x∈Ioo l r <;> by_cases hy : Z y∈Ioo l r <;> simp [hx,hy]
  have hlow (s : ℝ) (hsin : s∈Ioo l r) : (5/12:ℝ) ≤ 2*thresholdTail μ Z s*(1-thresholdTail μ Z s) := by
    have hh := (sq_le_sq₀ (abs_nonneg _) hδ).mpr (hbal s hsin)
    rw [sq_abs,hδsq] at hh
    nlinarith
  have hmeas : Measurable (thresholdTail μ Z) :=
    Finset.measurable_fun_sum _ (fun x _ => Measurable.ite measurableSet_Iio measurable_const measurable_const)
  have hint : IntegrableOn (fun s => 2*thresholdTail μ Z s*(1-thresholdTail μ Z s)) (Ioo l r) := by
    apply IntegrableOn.of_bound measure_Ioo_lt_top
      ((measurable_const.mul hmeas).mul (measurable_const.sub hmeas)).aestronglyMeasurable 1
    filter_upwards [ae_restrict_mem measurableSet_Ioo] with s hsin
    change ‖2*thresholdTail μ Z s*(1-thresholdTail μ Z s)‖ ≤ 1
    rw [Real.norm_eq_abs,abs_of_nonneg (le_trans (by norm_num) (hlow s hsin))]
    nlinarith [sq_nonneg (thresholdTail μ Z s-1/2)]
  have hInt := setIntegral_mono_on (f:=fun _ : ℝ => (5/12:ℝ))
    (by exact integrableOn_const (measure_Ioo_lt_top.ne)) hint measurableSet_Ioo hlow
  rw [setIntegral_const,Real.volume_real_Ioo,smul_eq_mul,max_comm] at hInt
  rw [hp]
  rw [hsimp] at hsq
  have hmul := mul_le_mul_of_nonneg_left hsq (le_max_left 0 (r-l))
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Flanks.exists_balanced_window

∀ (lo hi ε δ : ℝ) {f g : ℝ → ℝ},
  Antitone f →
    Antitone g →
      ∃ l r,
        PlanarUnitDistances.Flanks.balancedRegion lo hi ε δ f g ⊆ Set.Icc l r ∧
          Set.Ioo l r ⊆ PlanarUnitDistances.Flanks.balancedRegion lo hi ε δ f g
Lean source · PlanarUnitDistances/BalancedWindow.lean, lines 12–31
/-- A balanced window may be open at either end, a singleton, or empty.
Its endpoints suffice for two different uses: closed containment for matching
events and open containment for the conditional probability estimate. -/
theorem exists_balanced_window (lo hi ε δ : ℝ) {f g : ℝ → ℝ} (hf : Antitone f) (hg : Antitone g) :
    ∃ l r : ℝ, balancedRegion lo hi ε δ f g ⊆ Icc l r ∧ Ioo l r ⊆ balancedRegion lo hi ε δ f g := by
  let J := balancedRegion lo hi ε δ f g
  by_cases hj : J.Nonempty
  · have hL : BddBelow J := ⟨lo,fun _ h => h.1.1.1⟩
    have hU : BddAbove J := ⟨hi,fun _ h => h.1.1.2⟩
    refine ⟨sInf J,sSup J,fun _ h => ⟨csInf_le hL h,le_csSup hU h⟩,?_⟩
    intro s hs
    obtain ⟨a,ha,has⟩ := exists_lt_of_csInf_lt hj hs.1
    obtain ⟨b,hb,hsb⟩ := exists_lt_of_lt_csSup hj hs.2
    exact ⟨⟨⟨ha.1.1.1.trans has.le,hsb.le.trans hb.1.1.2⟩,
      hb.1.2.1.trans (hf hsb.le),(hf has.le).trans ha.1.2.2⟩,
      abs_le.mpr ⟨(abs_le.mp hb.2).1.trans (sub_le_sub_right (hg hsb.le) _),
        (sub_le_sub_right (hg has.le) _).trans (abs_le.mp ha.2).2⟩⟩
  · refine ⟨1,0,fun s hs => (hj ⟨s,hs⟩).elim,fun s hs => ?_⟩
    exfalso
    linarith [hs.1,hs.2]

Kernel axioms used: propext, Classical.choice, Quot.sound.

4.3 Conditional comparisons on a common history

Lemma 4.9 An empirical list controls all center crosses

Lean verified

Fix a center. Let h i be k ≥ 1 independent draws from its neighbor-history law λ , and let ν h be any conditional law of two coordinate labels. Put ν ¯ = E λ ν h and ν ^ = k − 1 ∑ i ν h i . For u > 0 the probability that some y satisfies | ν ^ ( R y ) − ν ¯ ( R y ) | > u is at most 16 / ( k u 2 ) . If Y = { y : ν ^ ( R y ) ≥ 1 − ζ } , the chance that a specified y is omitted is at most ( 1 − ν ¯ ( R y ) ) / ζ for ζ > 0 . Using just the list, choose a set U which is the full space, a row, a column, or a set of at most two states. Outside the simultaneous error event, ν ¯ ( U ) ≥ 1 − 3 ( ζ + u ) , and the compatible pairs of states in U × Y have one of the four patterns in the next lemma.

Proof

For one coordinate of any probability vector, the centered empirical mean has second moment equal to the single-draw variance divided by k . This follows by expanding the actual product law of the list; distinct sampled indices have zero centered cross term. Summing over all coordinates bounds the squared Euclidean error by 1 / k in expectation. Write a cross probability as row mass plus column mass minus twice its atom. The inequality ( a + b − 2 c ) 2 ≤ 4 a 2 + 4 b 2 + 8 c 2 then gives one majorant of mean at most 16 / k valid for every y . Apply Markov to this majorant. For omission apply Markov separately to 1 − ν ^ ( R y ) . At most three crosses witness the restriction on U . Their complements have mixture mass at most ζ + u each on the accuracy event. The same U works for every center whose mixture meets this event.

Inspect the Lean declarations

OAI.PlanarUnitDistances.CommonTemplate.list_choice

∀ {A : Type u_3} {B : Type u_4} {H : Type u_5} {I : Type u_6} [inst : Fintype A] [inst_1 : Fintype B]
  [inst_2 : Fintype H] [inst_3 : Fintype I] (ν : H → OAI.PlanarUnitDistances.FiniteLaw.Law (A × B)) {ζ u : ℝ},
  0 ≤ ζ →
    0 ≤ u →
      ∀ (θ : I → H),
        ∃ U,
          (U = Finset.univ ∨ OAI.PlanarUnitDistances.RestrictedTransfer.Permitted U) ∧
            OAI.PlanarUnitDistances.CrossStructure.Shape
                (OAI.PlanarUnitDistances.CommonTemplate.candidates ν ζ θ) U ∧
              ∀ (μ : OAI.PlanarUnitDistances.FiniteLaw.Law H),
                OAI.PlanarUnitDistances.CommonTemplate.accurate μ ν u θ →
                  1 - 3 * (ζ + u) ≤
                    OAI.PlanarUnitDistances.FiniteLaw.event (OAI.PlanarUnitDistances.FiniteLaw.mix μ ν)
                      fun x => x ∈ U
Lean source · PlanarUnitDistances/CommonListSelection.lean, lines 93–100
theorem list_choice (ν : H → Law (A×B)) {ζ u : ℝ} (hζ : 0 ≤ ζ) (hu : 0 ≤ u) (θ : I → H) :
    ∃ U : Finset (A×B), (U=univ ∨ RestrictedTransfer.Permitted U) ∧
      Shape (candidates ν ζ θ) U ∧
      ∀ μ : Law H, accurate μ ν u θ → 1-3*(ζ+u) ≤ event (mix μ ν) (fun x => x∈U) := by
  obtain ⟨W,U,sub,hc,perm,inter,shape⟩ := witnesses (candidates ν ζ θ)
  exact ⟨U,perm,shape,fun μ h =>
    witness_mass (mix μ ν) W U (add_nonneg hζ hu) hc inter
      (fun y hy => candidate_mass μ ν θ h (sub hy))⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.CrossSampling.empirical_cross_tail

∀ {X : Type u_1} {A : Type u_2} {B : Type u_3} {I : Type u_4} [inst : Fintype X] [inst_1 : Fintype A]
  [inst_2 : Fintype B] [inst_3 : Fintype I] [Nonempty I] (μ : OAI.PlanarUnitDistances.FiniteLaw.Law X)
  (v : X → OAI.PlanarUnitDistances.FiniteLaw.Law (A × B)) {u : ℝ},
  0 < u →
    (OAI.PlanarUnitDistances.FiniteLaw.event (OAI.PlanarUnitDistances.FiniteLaw.independent μ I) fun xs =>
        ∃ y,
          u <
            |OAI.PlanarUnitDistances.FiniteLaw.empiricalError μ
                (fun x => OAI.PlanarUnitDistances.CrossSampling.crossMass (v x) y) xs|) ≤
      16 / (↑(Fintype.card I) * u ^ 2)
Lean source · PlanarUnitDistances/EmpiricalCross.lean, lines 124–169
/-- One event controls all row-column crosses simultaneously, including a
cross subsequently chosen from the observed empirical distribution. -/
theorem empirical_cross_tail (μ : Law X) (v : X → Law (A×B)) {u : ℝ} (hu : 0 < u) :
    event (independent μ I) (fun xs => ∃ y : A×B, u < |empiricalError μ (fun x => crossMass (v x) y) xs|) ≤
      16/((Fintype.card I:ℝ)*u^2) := by
  let a x := push (v x) Prod.fst
  let b x := push (v x) Prod.snd
  let F (xs : I → X) := 4*vectorError μ a xs + 4*vectorError μ b xs + 8*vectorError μ v xs
  have nn (xs : I → X) : 0 ≤ F xs := by
    dsimp [F,vectorError]; positivity
  have point (xs : I → X) (y : A×B) : (empiricalError μ (fun x => crossMass (v x) y) xs)^2 ≤ F xs := by
    let A := empiricalError μ (fun x => (a x).val y.1) xs
    let B := empiricalError μ (fun x => (b x).val y.2) xs
    let C := empiricalError μ (fun x => (v x).val y) xs
    have he : empiricalError μ (fun x => crossMass (v x) y) xs = A+B-2*C := by
      simp only [empiricalError,A,B,C,a,b,strict_cross_formula,Finset.sum_add_distrib,Finset.sum_sub_distrib,
        ← Finset.mul_sum, avg_add,avg_sub,avg_smul]
      ring
    rw [he]
    have hA := coordinate_bound μ a xs y.1
    have hB := coordinate_bound μ b xs y.2
    have hC := coordinate_bound μ v xs y
    change A^2 ≤ _ at hA
    change B^2 ≤ _ at hB
    change C^2 ≤ _ at hC
    dsimp only [F]
    nlinarith only [hA,hB,hC,sq_nonneg (A-B),sq_nonneg (A+C),sq_nonneg (B+C)]
  have sb : avg (independent μ I) F ≤ 16/(Fintype.card I:ℝ) := by
    simp only [F,avg_add,avg_smul]
    have hA := empirical_vector_square (I := I) μ a
    have hB := empirical_vector_square (I := I) μ b
    have hC := empirical_vector_square (I := I) μ v
    change _*avg _ (vectorError μ a) + _*avg _ (vectorError μ b) + _*avg _ (vectorError μ v) ≤ _
    unfold vectorError
    simp only [div_eq_mul_inv,one_mul] at hA hB hC ⊢
    linarith only [hA,hB,hC]
  have sub := event_mono (independent μ I) (P := fun xs => ∃ y : A×B, u < |empiricalError μ (fun x => crossMass (v x) y) xs|)
    (Q := fun xs => u^2 < F xs) (fun xs h => by
      obtain ⟨y,hy⟩ := h
      have hsq := (sq_lt_sq₀ hu.le (abs_nonneg _)).mpr hy
      rw [sq_abs] at hsq
      exact hsq.trans_le (point xs y))
  calc
    _ ≤ avg (independent μ I) F/u^2 := sub.trans (event_markov _ F nn (sq_pos_of_pos hu))
    _ ≤ (16/(Fintype.card I:ℝ))/u^2 := div_le_div_of_nonneg_right sb (sq_nonneg _)
    _ = _ := by ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.CommonTemplate.omitted_center

∀ {A : Type u_3} {B : Type u_4} {H : Type u_5} {I : Type u_6} [inst : Fintype A] [inst_1 : Fintype B]
  [inst_2 : Fintype H] [inst_3 : Fintype I] [Nonempty I] (μ : OAI.PlanarUnitDistances.FiniteLaw.Law H)
  (ν : H → OAI.PlanarUnitDistances.FiniteLaw.Law (A × B)) (y : A × B) {ζ : ℝ},
  0 < ζ →
    (OAI.PlanarUnitDistances.FiniteLaw.event (OAI.PlanarUnitDistances.FiniteLaw.independent μ I) fun θ =>
        y ∉ OAI.PlanarUnitDistances.CommonTemplate.candidates ν ζ θ) ≤
      (1 -
          OAI.PlanarUnitDistances.FiniteLaw.avg μ fun a =>
            OAI.PlanarUnitDistances.CrossSampling.crossMass (ν a) y) /
        ζ
Lean source · PlanarUnitDistances/CommonListSelection.lean, lines 39–57
theorem omitted_center (μ : Law H) (ν : H → Law (A×B)) (y : A×B) {ζ : ℝ} (hζ : 0 < ζ) :
    event (independent μ I) (fun θ => y ∉ candidates ν ζ θ) ≤
      (1 - avg μ (fun a => crossMass (ν a) y))/ζ := by
  let f (θ : I → H) := (∑ i, crossMass (ν (θ i)) y)/(Fintype.card I:ℝ)
  have le1 (θ : I → H) : f θ ≤ 1 := by
    apply (div_le_one (Nat.cast_pos.mpr Fintype.card_pos)).mpr
    calc
      _ ≤ ∑ _i : I, (1:ℝ) := sum_le_sum fun i _ => event_le_one (ν (θ i)) _
      _ = _ := by simp
  have eqv : avg (independent μ I) f = avg μ (fun a => crossMass (ν a) y) := by
    dsimp [f]
    have hv (i : I) := independent_single μ i (fun a => crossMass (ν a) y)
    simp only [div_eq_inv_mul,avg_smul,avg_sum,hv,Finset.sum_const,card_univ,nsmul_eq_mul,← mul_assoc]
    rw [inv_mul_cancel₀ (Nat.cast_ne_zero.mpr Fintype.card_ne_zero : (Fintype.card I:ℝ) ≠ 0),one_mul]
  have h := event_markov (independent μ I) (fun θ => 1-f θ) (fun θ => sub_nonneg.mpr (le1 θ)) hζ
  rw [avg_sub,avg_const,eqv] at h
  apply (event_mono _ (fun θ (hbad : y ∉ candidates ν ζ θ) => ?_)).trans h
  have hb : ¬1-ζ ≤ f θ := fun h => hbad (mem_filter.mpr ⟨mem_univ _,h⟩)
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.10 The two conditional score inequalities

Lean verified

Work at one level, with an arbitrary finite joint edge law π , coordinate pairs x ( p ) , y ( q ) , and bits. Write d for the expectation of the coefficient c ( ρ ) on an equal-bit pair with matching other labels, minus the unequal-bit probability V . The coefficient is 7 / 6 when | ρ − 1 / 2 | ≤ 1 / 24 and 5 / 6 otherwise. Draw a list with a law depending only on q . In the experiment T , condition on p and that very list when drawing two centers. If the successful edges have consistent bits, lie in the chosen U × Y , and satisfy its four-pattern classification, then

d Q + d T   ≥   ( V Q + V T ) / 6 − 16 Pr ( unsuccessful edge ) .

Independently, for a specified history h ( p ) let ν h ( p ) be the distribution of x for a point resampled from its history class. Write m for edge inconsistency, a = E p , q [ 1 − ν h ( p ) ( R y ( q ) ) ] , and F ( ν ) = ∑ i ν A ( i ) 2 + ∑ j ν B ( j ) 2 − 1 . For every ζ > 0 the ordinary point experiment satisfies

d P + E μ F ( ν h ( p ) )   ≥   V P / 6 − 16 ( m + a / ζ + ζ ) .
Proof

Two distinct center labels in one row force their common compatible states into that row. A third label outside the row leaves at most one state. The column case is symmetric. For two labels differing in both coordinates the two opposite corners are the only possibilities; a third label disjoint in both coordinates eliminates them. The remaining cases contain at most one center label. In each case, either the successful bit is constant, the opposite state is constant on successful edges, or the bit determines the opposite state on those edges. In the last case the checked polynomial inequality gives d ≥ V / 6 − 6 b for a one-edge failure probability b . The union bound uses the same single-edge failure law for Q and T conditional on the list. Summing over actual list probabilities restores the original Q statistic. For P , take the successful centers at p to be those consistent with p and having posterior cross mass at least 1 − ζ . Markov bounds their mean failure rate by m + a / ζ .

Inspect the Lean declarations

OAI.PlanarUnitDistances.CommonTemplate.marginal_score

∀ {P : Type u_1} {Q : Type u_2} {H : Type u_3} {A : Type u_4} {B : Type u_5} [inst : Fintype P]
  [inst_1 : Fintype Q] [inst_2 : Fintype A] [inst_3 : Fintype B]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q)) (h : P → H) (bit : P → Q → Bool) (x : P → A × B)
  (y : Q → A × B) {ε : ℝ},
  0 < ε →
    OAI.PlanarUnitDistances.FiniteStarCoupling.VP π bit / 6 ≤
      (OAI.PlanarUnitDistances.FiniteStarCoupling.DP π bit y +
          OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.FiniteStarCoupling.left π) fun p =>
            OAI.PlanarUnitDistances.FiniteMarginalScore.tau
              (OAI.PlanarUnitDistances.CommonTemplate.posteriorState π h x (h p))) +
        16 *
          ((OAI.PlanarUnitDistances.FiniteLaw.event π fun pq =>
                ¬OAI.PlanarUnitDistances.CrossStructure.Consistent (bit pq.1 pq.2) (x pq.1) (y pq.2)) +
              OAI.PlanarUnitDistances.CommonTemplate.predictionError π h x y / ε +
            ε)
Lean source · PlanarUnitDistances/PosteriorComparison.lean, lines 35–62
theorem marginal_score (π : Law (P×Q)) (h : P → H) (bit : P → Q → Bool)
    (x : P → A×B) (y : Q → A×B) {ε : ℝ} (hε : 0<ε) :
    VP π bit/6≤DP π bit y+avg (left π) (fun p => tau (posteriorState π h x (h p)))+
      16*(event π (fun pq => ¬Consistent (bit pq.1 pq.2) (x pq.1) (y pq.2))+
        predictionError π h x y/ε+ε) := by
  let good : P → Q → Prop := fun p q => Consistent (bit p q) (x p) (y q) ∧
    1-ε≤crossMass (posteriorState π h x (h p)) (y q)
  have hs := avg_mono (left π) (fun p => second_slice (row π p) (bit p) y
    (posteriorState π h x (h p)) (x p) (good p) hε.le
    (fun _ hg => hg.1) (fun _ hg => hg.2))
  simp only [avg_sub,div_eq_mul_inv,avg_add,avg_smul,avg_const] at hs
  have hv : avg (left π) (fun p => StarScore.variation (row π p) (bit p)*6⁻¹)=VP π bit*6⁻¹ := by
    simp [VP,avg,Finset.sum_mul,mul_assoc]
  rw [hv,row_event] at hs
  have hb : event π (fun pq => ¬good pq.1 pq.2)≤
      event π (fun pq => ¬Consistent (bit pq.1 pq.2) (x pq.1) (y pq.2))+
      predictionError π h x y/ε := by
    refine (event_mono π ?_).trans ((event_union_le π _ _).trans (add_le_add_right
      (event_markov π (fun pq => 1-crossMass (posteriorState π h x (h pq.1)) (y pq.2))
        (fun pq => sub_nonneg.mpr (event_le_one _ _)) hε) _))
    intro pq hg
    by_cases hc : Consistent (bit pq.1 pq.2) (x pq.1) (y pq.2)
    · right
      have hn : ¬1-ε≤crossMass (posteriorState π h x (h pq.1)) (y pq.2) := fun hp => hg ⟨hc,hp⟩
      linarith
    · exact Or.inl hc
  change _≤DP π bit y+_ at hs
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.FiniteStarCoupling.slice_score

∀ {P : Type u_1} {Q : Type u_2} {A : Type u_3} {B : Type u_4} [inst : Fintype P] [inst_1 : Fintype Q]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q)) (bit : P → Q → Bool) (x : P → A × B) (y : Q → A × B)
  (good : P → Q → Prop) (Y U : Finset (A × B)),
  OAI.PlanarUnitDistances.CrossStructure.Shape Y U →
    (∀ (p : P) (q : Q),
        good p q →
          x p ∈ U ∧ y q ∈ Y ∧ OAI.PlanarUnitDistances.CrossStructure.Consistent (bit p q) (x p) (y q)) →
      (OAI.PlanarUnitDistances.FiniteStarCoupling.VP π bit +
              OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π bit) /
            6 -
          16 * OAI.PlanarUnitDistances.FiniteStarCoupling.bad π good ≤
        OAI.PlanarUnitDistances.FiniteStarCoupling.DP π bit y +
          OAI.PlanarUnitDistances.FiniteStarCoupling.DQ π bit x
Lean source · PlanarUnitDistances/CrossComparisons.lean, lines 246–300
theorem slice_score (π : Law (P×Q)) (bit : P → Q → Bool) (x : P → A×B) (y : Q → A×B)
    (good : P → Q → Prop) (Y U : Finset (A×B)) (hs : Shape Y U)
    (hg : ∀ p q,good p q → x p∈U ∧ y q∈Y ∧ Consistent (bit p q) (x p) (y q)) :
    (VP π bit+VQ π bit)/6-16*bad π good ≤ DP π bit y+DQ π bit x := by
  have hbad : 0≤bad π good := event_nonneg _ _
  have hvp := vp_le π bit
  have hvq := vq_le π bit
  have hdp := dp_lower π bit y
  have hdq := dq_lower π bit x
  rcases hs with hs|hs|⟨b,hs⟩|⟨hsP,hsQ⟩
  · have h (p : P) := constant_good (row π p) (bit p) y (good p) (by
      intro q r hq hr
      have hy := hs (y q) (hg p q hq).2.1 (y r) (hg p r hr).2.1
      refine ⟨?_,hy⟩
      exact bit_unique (hg p q hq).2.2 (hy ▸ (hg p r hr).2.2))
    have ha := avg_mono (left π) h
    rw [avg_sub,avg_const,avg_smul,row_event] at ha
    change (1-1/6:ℝ)-4*bad π good ≤ DP π bit y at ha
    linarith
  · have h (q : Q) := constant_good (col π q) (fun p => bit p q) x (fun p => good p q) (by
      intro p r hp hr
      have hx := hs (x p) (hg p q hp).1 (x r) (hg r q hr).1
      refine ⟨?_,hx⟩
      exact bit_unique (hg p q hp).2.2 (hx ▸ (hg r q hr).2.2))
    have ha := avg_mono (right π) h
    rw [avg_sub,avg_const,avg_smul,col_event] at ha
    change (1-1/6:ℝ)-4*bad π good ≤ DQ π bit x at ha
    linarith
  · have hc : ∀p q,good p q → bit p q=b := by
      intro p q hp
      exact hs (x p) (hg p q hp).1 (y q) (hg p q hp).2.1 _ (hg p q hp).2.2
    have hp := avg_mono (left π) (fun p => constant_bit (row π p) (bit p) (good p)
      (by intro q r hq hr; exact (hc p q hq).trans (hc p r hr).symm))
    have hq := avg_mono (right π) (fun q => constant_bit (col π q) (fun p => bit p q) (fun p => good p q)
      (by intro p r hp hr; exact (hc p q hp).trans (hc r q hr).symm))
    rw [avg_smul,row_event] at hp
    rw [avg_smul,col_event] at hq
    change VP π bit ≤ 2*bad π good at hp
    change VQ π bit ≤ 2*bad π good at hq
    linarith
  · have hp := avg_mono (left π) (fun p => determined (row π p) (bit p) y (good p) (by
      intro q r hq hr hb
      apply hsP (x p) (hg p q hq).1 (y q) (hg p q hq).2.1 (y r) (hg p r hr).2.1 (bit p q)
      · exact (hg p q hq).2.2
      · exact hb ▸ (hg p r hr).2.2))
    have hq := avg_mono (right π) (fun q => determined (col π q) (fun p => bit p q) x (fun p => good p q) (by
      intro p r hp hr hb
      apply hsQ (y q) (hg p q hp).2.1 (x p) (hg p q hp).1 (x r) (hg r q hr).1 (bit p q)
      · exact (hg p q hp).2.2
      · exact hb ▸ (hg r q hr).2.2))
    simp only [div_eq_mul_inv, mul_comm _ (6:ℝ)⁻¹,avg_sub,avg_smul,row_event] at hp
    simp only [div_eq_mul_inv, mul_comm _ (6:ℝ)⁻¹,avg_sub,avg_smul,col_event] at hq
    change (6:ℝ)⁻¹*VP π bit-6*bad π good ≤ DP π bit y at hp
    change (6:ℝ)⁻¹*VQ π bit-6*bad π good ≤ DQ π bit x at hq
    linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.CommonTemplate.aggregate_score

∀ {P : Type u_1} {Q : Type u_2} {A : Type u_3} {B : Type u_4} {Θ : Type u_5} [inst : Fintype P]
  [inst_1 : Fintype Q] [inst_2 : Fintype Θ] (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (a : Q → OAI.PlanarUnitDistances.FiniteLaw.Law Θ) (bit : P → Q → Bool) (x : P → A × B) (y : Q → A × B)
  (Y U : Θ → Finset (A × B)) (good : Θ → P → Q → Prop),
  (∀ (θ : Θ), OAI.PlanarUnitDistances.CrossStructure.Shape (Y θ) (U θ)) →
    (∀ (θ : Θ) (p : P) (q : Q),
        good θ p q →
          x p ∈ U θ ∧ y q ∈ Y θ ∧ OAI.PlanarUnitDistances.CrossStructure.Consistent (bit p q) (x p) (y q)) →
      (((OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.TemplateCoupling.templates π a)
                fun θ =>
                OAI.PlanarUnitDistances.FiniteStarCoupling.VP
                  (OAI.PlanarUnitDistances.TemplateCoupling.slice π a θ) bit) +
              OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π bit) /
            6 -
          16 *
            OAI.PlanarUnitDistances.FiniteLaw.avg π fun pq =>
              OAI.PlanarUnitDistances.FiniteLaw.event (a pq.2) fun θ => ¬good θ pq.1 pq.2) ≤
        (OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.TemplateCoupling.templates π a)
            fun θ =>
            OAI.PlanarUnitDistances.FiniteStarCoupling.DP
              (OAI.PlanarUnitDistances.TemplateCoupling.slice π a θ) bit y) +
          OAI.PlanarUnitDistances.FiniteStarCoupling.DQ π bit x
Lean source · PlanarUnitDistances/ListComparisons.lean, lines 149–163
theorem aggregate_score (π : Law (P×Q)) (a : Q → Law Θ) (bit : P → Q → Bool)
    (x : P → A×B) (y : Q → A×B) (Y U : Θ → Finset (A×B))
    (good : Θ → P → Q → Prop) (hs : ∀θ,Shape (Y θ) (U θ))
    (hg : ∀θ p q,good θ p q → x p∈U θ ∧ y q∈Y θ ∧ Consistent (bit p q) (x p) (y q)) :
    (avg (templates π a) (fun θ => VP (slice π a θ) bit)+VQ π bit)/6 -
      16*avg π (fun pq => event (a pq.2) (fun θ => ¬good θ pq.1 pq.2)) ≤
      avg (templates π a) (fun θ => DP (slice π a θ) bit y)+DQ π bit x := by
  have ht := avg_mono (templates π a) (fun θ => slice_score (slice π a θ) bit x y
    (good θ) (Y θ) (U θ) (hs θ) (hg θ))
  have he : avg (templates π a) (fun θ => (VP (slice π a θ) bit+VQ (slice π a θ) bit)/6)=
      (avg (templates π a) (fun θ => VP (slice π a θ) bit)+VQ π bit)/6 := by
    simp only [div_eq_mul_inv,mul_comm _ (6:ℝ)⁻¹,avg_smul,avg_add,center_variation]
  rw [avg_sub,he,avg_smul,avg_add,center_score] at ht
  simp only [bad,slice_event] at ht
  exact ht

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.FiniteMarginalScore.second_slice

∀ {A : Type u_1} {B : Type u_2} {Q : Type u_3} [inst : Fintype A] [inst_1 : Fintype B] [inst_2 : Fintype Q]
  (μ : OAI.PlanarUnitDistances.FiniteLaw.Law Q) (bit : Q → Bool) (state : Q → A × B)
  (ν : OAI.PlanarUnitDistances.FiniteLaw.Law (A × B)) (x : A × B) (good : Q → Prop) {ε : ℝ},
  0 ≤ ε →
    (∀ (q : Q), good q → OAI.PlanarUnitDistances.CrossStructure.Consistent (bit q) x (state q)) →
      (∀ (q : Q), good q → 1 - ε ≤ OAI.PlanarUnitDistances.CrossSampling.crossMass ν (state q)) →
        OAI.PlanarUnitDistances.StarScore.variation μ bit / 6 -
            16 * ((OAI.PlanarUnitDistances.FiniteLaw.event μ fun q => ¬good q) + ε) ≤
          OAI.PlanarUnitDistances.StarScore.score μ bit state +
            OAI.PlanarUnitDistances.FiniteMarginalScore.tau ν
Lean source · PlanarUnitDistances/CrossComparisons.lean, lines 443–548
theorem second_slice (μ : Law Q) (bit : Q → Bool) (state : Q → A×B)
    (ν : Law (A×B)) (x : A×B) (good : Q → Prop) {ε : ℝ} (hε : 0≤ε)
    (hcons : ∀q,good q → Consistent (bit q) x (state q))
    (hprob : ∀q,good q → 1-ε≤crossMass ν (state q)) :
    variation μ bit/6-16*(event μ (fun q => ¬good q)+ε) ≤ score μ bit state+tau ν := by
  let b := event μ (fun q => ¬good q)
  let v := variation μ bit
  let d := score μ bit state
  have hb : 0≤b := event_nonneg _ _
  have hv : v≤1/2 := variation_le_half _ _
  have hd : -v≤d := score_lower _ _ _
  have hd' : -1/2≤d := by simpa only [neg_div] using score_ge_half_neg μ bit state
  have ht := tau_lower ν
  change v/6-16*(b+ε)≤d+tau ν
  by_cases hg : ∃q,good q
  swap
  · have he : b=1 := by
      dsimp [b]
      calc
        _ = event μ (fun _ => True) := event_congr _ (fun q => by simp only [not_exists] at hg; simp [hg q])
        _ = 1 := event_true _
    rw [he]
    linarith
  obtain ⟨q₀,hq₀⟩ := hg
  let Y := (univ.filter good).image state
  have memY {y : A×B} : y∈Y ↔ ∃q,good q ∧ state q=y := by simp only [Y,mem_image,mem_filter,mem_univ,true_and]
  have hmem (q : Q) (hq : good q) : state q∈Y := memY.mpr ⟨q,hq,rfl⟩
  have hx (y : A×B) (hy : y∈Y) : Adj x y := by
    obtain ⟨q,hq,rfl⟩ := memY.mp hy
    exact consistent_adj (hcons q hq)
  have hm (y : A×B) (hy : y∈Y) : 1-ε≤crossMass ν y := by
    obtain ⟨q,hq,rfl⟩ := memY.mp hy
    exact hprob q hq
  rcases classification Y with hs|hs|hs|hs
  · have hd₁ := constant_good μ bit state good (by
      intro q r hq hr
      have he := card_le_one.mp hs _ (hmem q hq) _ (hmem r hr)
      exact ⟨bit_unique (hcons q hq) (he ▸ hcons r hr),he⟩)
    have ht₁ := tau_cross ν (state q₀)
    have ht₂ := hprob q₀ hq₀
    change (1-1/6:ℝ)-4*b≤d at hd₁
    linarith
  · obtain ⟨y,hy,z,hz,hyz,he,hw⟩ := hs
    have hn : y.2≠z.2 := by intro hh; exact hyz (Prod.ext he hh)
    have hzx : Adj x (y.1,z.2) := by simpa only [Adj,←he] using hx z hz
    have hxr : x.1=y.1 := ((same_row hn x).mp ⟨hx y hy,hzx⟩).1
    have hr : 1-2*ε≤rowMass ν y.1 := by
      refine (two_cross_mass ν (hm y hy) (hm z hz)).trans (event_mono ν ?_)
      intro u hu
      exact ((same_row hn u).mp ⟨hu.1,by simpa only [Adj,←he] using hu.2⟩).1
    rcases hw with hall|⟨w,hw,hwy⟩
    · have hc : ∀q,good q → bit q=true := by
        intro q hq
        exact bit_true (hcons q hq) (hxr.trans (hall _ (hmem q hq)).symm)
      have hcv := constant_bit μ bit good (fun q r hq hr => (hc q hq).trans (hc r hr).symm)
      have ht₁ := tau_row ν y.1
      change v≤2*b at hcv
      linarith
    · have ha : 1-3*ε≤event ν (fun u => u=(y.1,w.2)) := by
        refine (three_cross_mass ν (hm y hy) (hm z hz) (hm w hw)).trans (event_mono ν ?_)
        intro u hu
        exact third_off_row hn hwy.symm u hu.1 (by simpa only [Adj,←he] using hu.2.1) hu.2.2
      have ht₁ := tau_atom ν (y.1,w.2)
      linarith
  · obtain ⟨y,hy,z,hz,hyz,he,hw⟩ := hs
    have hn : y.1≠z.1 := by intro hh; exact hyz (Prod.ext hh he)
    have hzx : Adj x (z.1,y.2) := by simpa only [Adj,←he] using hx z hz
    have hxc : x.2=y.2 := ((same_column hn x).mp ⟨hx y hy,hzx⟩).1
    have hr : 1-2*ε≤colMass ν y.2 := by
      refine (two_cross_mass ν (hm y hy) (hm z hz)).trans (event_mono ν ?_)
      intro u hu
      exact ((same_column hn u).mp ⟨hu.1,by simpa only [Adj,←he] using hu.2⟩).1
    rcases hw with hall|⟨w,hw,hwy⟩
    · have hc : ∀q,good q → bit q=false := by
        intro q hq
        exact bit_false (hcons q hq) (hxc.trans (hall _ (hmem q hq)).symm)
      have hcv := constant_bit μ bit good (fun q r hq hr => (hc q hq).trans (hc r hr).symm)
      have ht₁ := tau_col ν y.2
      change v≤2*b at hcv
      linarith
    · have ha : 1-3*ε≤event ν (fun u => u=(w.1,y.2)) := by
        refine (three_cross_mass ν (hm y hy) (hm z hz) (hm w hw)).trans (event_mono ν ?_)
        intro u hu
        have huy := (swap_iff u y).mpr hu.1
        have huz := (swap_iff u z).mpr hu.2.1
        have huw := (swap_iff u w).mpr hu.2.2
        have he' := third_off_row hn hwy.symm u.swap huy
          (by simpa only [Prod.swap,←he] using huz) huw
        exact Prod.ext (congrArg Prod.snd he') (congrArg Prod.fst he')
      have ht₁ := tau_atom ν (w.1,y.2)
      linarith
  · obtain ⟨y,hy,z,hz,h₁,h₂,hw⟩ := hs
    rcases hw with hall|⟨w,hw,hyw,hzw,hyw',hzw'⟩
    · have ha : 1-2*ε≤event ν (fun u => u=(y.1,z.2)∨u=(z.1,y.2)) := by
        refine (two_cross_mass ν (hm y hy) (hm z hz)).trans (event_mono ν ?_)
        intro u hu
        exact (corners h₁ h₂ u).mp hu
      have ht₁ := tau_two ν (y := (y.1,z.2)) (z := (z.1,y.2)) h₁ h₂.symm
      have hinj := pair_coord_inj hall h₁ h₂
      have hdet := determined μ bit state good (by
        intro q r hq hr hbit
        exact determined_of_inj hinj x (state q) (hmem q hq) (state r) (hmem r hr)
          (bit q) (hcons q hq) (hbit ▸ hcons r hr))
      change v/6-6*b≤d at hdet
      linarith
    · exact (three_independent h₁ hyw hzw h₂ hyw' hzw' x ⟨hx y hy,hx z hz,hx w hw⟩).elim

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.11 The first comparison with its actual random list

Lean verified

Fix a finite joint edge law with positive point marginals, a point history, the two vertex label pairs and the edge bits at one level. Let m be its inconsistency probability and a the posterior cross rejection defined in Lemma 4.10. At center q independently sample k ≥ 1 neighbor histories. For u , ζ > 0 write N for the mean conditional residual norm after fresh independent hashing into L ≥ 1 labels. With T formed by conditioning on both the point and this list,

V Q + V T 6 ≤ d Q + d T + 16 ( m + a ζ + 16 k u 2 + 3 ( ζ + u ) + 4 L + 2 N ) .
Proof

For the actual list choose its family of candidate center labels and the single permitted set U furnished by the classification. The event on which transfer is needed is that the empirical estimate holds and U is a proper restriction. On that event the posterior mixture gives U c probability at most 3 ( ζ + u ) . Apply the event-dependent transfer to the actual point. An edge can fail through inconsistency, omission of its center, empirical inaccuracy, or failed membership on the active event. These four probabilities are taken in the same one-edge/list law. Their union has probability at most the displayed bracket. Condition this law on the list, apply the local score inequality and average over the lists.

Inspect the Lean declarations

OAI.PlanarUnitDistances.CommonTemplate.first_comparison

∀ {P : Type u_1} {Q : Type u_2} {A : Type u_3} {B : Type u_4} {H : Type u_5} {I : Type u_6} {L : Type u_7}
  [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : Fintype A] [inst_3 : Fintype B] [inst_4 : Fintype H]
  [inst_5 : Fintype I] [Nonempty I] [inst_7 : Fintype L] [inst_8 : Nonempty L]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q)) (h : P → H),
  (∀ (p : P), 0 < (OAI.PlanarUnitDistances.FiniteStarCoupling.left π).val p) →
    ∀ (bit : P → Q → Bool) (x : P → A × B) (y : Q → A × B) {ζ u : ℝ},
      0 < ζ →
        0 < u →
          have a := OAI.PlanarUnitDistances.CommonTemplate.listLaw π h;
          ((OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.TemplateCoupling.templates π a)
                  fun θ =>
                  OAI.PlanarUnitDistances.FiniteStarCoupling.VP
                    (OAI.PlanarUnitDistances.TemplateCoupling.slice π a θ) bit) +
                OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π bit) /
              6 ≤
            (OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.TemplateCoupling.templates π a)
                  fun θ =>
                  OAI.PlanarUnitDistances.FiniteStarCoupling.DP
                    (OAI.PlanarUnitDistances.TemplateCoupling.slice π a θ) bit y) +
                OAI.PlanarUnitDistances.FiniteStarCoupling.DQ π bit x +
              16 *
                (OAI.PlanarUnitDistances.CommonTemplate.inconsistency π bit x y +
                          OAI.PlanarUnitDistances.CommonTemplate.predictionError π h x y / ζ +
                        16 / (↑(Fintype.card I) * u ^ 2) +
                      3 * (ζ + u) +
                    4 / ↑(Fintype.card L) +
                  √2 *
                    OAI.PlanarUnitDistances.CrossPrediction.hashNorm
                      (OAI.PlanarUnitDistances.FiniteStarCoupling.right π)
                      (OAI.PlanarUnitDistances.FiniteStarCoupling.col π) h x)
Lean source · PlanarUnitDistances/FirstComparison.lean, lines 26–140
/-- A single common level with an actual iid center list and the original edge
law. The common row, column or two-atom restriction is constructed internally. -/
theorem first_comparison (π : Law (P×Q)) (h : P → H) (hp : ∀p,0<(left π).val p)
    (bit : P → Q → Bool) (x : P → A×B) (y : Q → A×B)
    {ζ u : ℝ} (hζ : 0<ζ) (hu : 0<u) :
    let a := listLaw (I := I) π h
    (avg (templates π a) (fun θ => VP (slice π a θ) bit)+VQ π bit)/6 ≤
      avg (templates π a) (fun θ => DP (slice π a θ) bit y)+DQ π bit x +
      16*(inconsistency π bit x y+predictionError π h x y/ζ+
        16/((Fintype.card I:ℝ)*u^2)+3*(ζ+u)+4/(Fintype.card L:ℝ)+
        Real.sqrt 2*hashNorm (C := L) (right π) (col π) h x) := by
  let a := listLaw (I := I) π h
  let ν := posteriorState π h x
  let νH := historyLaw π h
  let Y := candidates (I := I) ν ζ
  let ok := fun q => accurate (I := I) (νH q) ν u
  choose U perm shape margin using list_choice (I := I) ν hζ.le hu.le
  have choice (θ : I → H) : ∃ query : Query A B, U θ ≠ univ → ∀z, accepts query z ↔ z∈U θ := by
    by_cases hs : U θ=univ
    · exact ⟨.few ∅ (by simp),fun hn => (hn hs).elim⟩
    obtain ⟨v,he⟩ := permitted_query (U θ) ((perm θ).resolve_left hs)
    exact ⟨v, fun _ => he⟩
  choose qr hqr using choice
  let good (θ : I → H) (p : P) (q : Q) :=
    Consistent (bit p q) (x p) (y q) ∧ y q∈Y θ ∧ ok q θ ∧ x p∈U θ
  have localScore := aggregate_score π a bit x y Y U good shape (fun _ _ _ hg => ⟨hg.2.2.2,hg.2.1,hg.1⟩)
  let ρ : Law ((P×Q)×(I→H)) := joint π a
  have disint (f : P → Q → (I→H) → ℝ) :
      avg ρ (fun z => f z.1.1 z.1.2 z.2) =
      avg (right π) (fun q => avg (a q) (fun θ => avg (col π q) (fun p => f p q θ))) := by
    rw [show avg ρ (fun z => f z.1.1 z.1.2 z.2) = avg π (fun pq => avg (a pq.2) (fun θ => f pq.1 pq.2 θ)) from dependent_avg ..,
      ←col_avg π (fun p q => avg (a q) (fun θ => f p q θ))]
    exact avg_congr _ (fun q => avg_comm ..)
  let B₀ (z : (P×Q)×(I→H)) := ¬Consistent (bit z.1.1 z.1.2) (x z.1.1) (y z.1.2)
  let B₁ (z : (P×Q)×(I→H)) := y z.1.2 ∉ Y z.2
  let B₂ (z : (P×Q)×(I→H)) := ¬ok z.1.2 z.2
  let B₃ (z : (P×Q)×(I→H)) := ok z.1.2 z.2 ∧ U z.2 ≠ univ ∧ x z.1.1 ∉ U z.2
  have union := (event_mono ρ (P := fun z => ¬good z.2 z.1.1 z.1.2)
    (Q := fun z => ((B₀ z ∨ B₁ z) ∨ B₂ z) ∨ B₃ z) (by
    intro z hz
    by_cases hc : Consistent (bit z.1.1 z.1.2) (x z.1.1) (y z.1.2)
    · by_cases hy : y z.1.2∈Y z.2
      · by_cases ho : ok z.1.2 z.2
        · have hn : x z.1.1∉U z.2 := fun he => hz ⟨hc,hy,ho,he⟩
          exact Or.inr ⟨ho,fun he => hn (he ▸ mem_univ _),hn⟩
        · exact Or.inl (Or.inr ho)
      · exact Or.inl (Or.inl (Or.inr hy))
    · exact Or.inl (Or.inl (Or.inl hc))))
  have total : event ρ (fun z => ¬good z.2 z.1.1 z.1.2) ≤ event ρ B₀+event ρ B₁+event ρ B₂+event ρ B₃ := by
    linarith [event_union_le ρ (fun z => (B₀ z ∨ B₁ z) ∨ B₂ z) B₃,
      event_union_le ρ (fun z => B₀ z ∨ B₁ z) B₂,event_union_le ρ B₀ B₁]
  have evdis (f : P → Q → (I→H) → Prop) :
      event ρ (fun z => f z.1.1 z.1.2 z.2) =
      avg (right π) (fun q => avg (a q) (fun θ => event (col π q) (fun p => f p q θ))) := by
    unfold event
    exact disint (fun p q θ => @ite ℝ (f p q θ) (Classical.propDecidable _) 1 0)
  have listOnly (f : Q → (I→H) → Prop) : event ρ (fun z => f z.1.2 z.2) =
      avg (right π) (fun q => event (a q) (f q)) := by
    rw [evdis (fun _ q θ => f q θ)]
    apply avg_congr; intro q
    unfold event
    apply avg_congr; intro θ
    by_cases hh : f q θ <;> simp [hh,avg_const]
  have m₀ : event ρ B₀ = inconsistency π bit x y := by
    unfold event inconsistency
    change avg (dependent π _) _ = _
    rw [dependent_avg]
    unfold event
    apply avg_congr; intro pq
    by_cases hc : Consistent (bit pq.1 pq.2) (x pq.1) (y pq.2) <;> simp [B₀,hc,avg_const]
  have m₁ : event ρ B₁ ≤ predictionError π h x y/ζ := by
    rw [listOnly (fun q θ => y q∉Y θ)]
    have omitted (q : Q) := omitted_center (I := I) (νH q) ν (y q) hζ
    apply (avg_mono (right π) omitted).trans_eq
    have sub (q : Q) : 1 - avg (νH q) (fun t => crossMass (ν t) (y q)) =
        avg (col π q) (fun p => 1-crossMass (ν (h p)) (y q)) := by
      rw [avg_sub,avg_const]; simp [νH,historyLaw,push_avg]
    simp_rw [sub,div_eq_inv_mul,avg_smul]
    rw [col_avg]
    rfl
  have m₂ : event ρ B₂ ≤ 16/((Fintype.card I:ℝ)*u^2) := by
    rw [listOnly (fun q θ => ¬ok q θ)]
    exact avg_le_const _ (fun q => empirical_list_failure (νH q) ν u hu)
  let active (q : Q) (θ : I→H) := ok q θ ∧ U θ≠univ
  have m₃ : event ρ B₃ ≤ 3*(ζ+u)+4/(Fintype.card L:ℝ)+
      Real.sqrt 2*hashNorm (C := L) (right π) (col π) h x := by
    have re : event ρ B₃ = rejectChance (right π) (col π) x a active (fun _ => qr) := by
      unfold rejectChance
      rw [evdis (fun p q θ => ok q θ ∧ U θ≠univ ∧ x p∉U θ)]
      apply avg_congr; intro q
      apply avg_congr; intro θ
      apply event_congr; intro p
      by_cases hu' : U θ=univ
      · simp [active,hu']
      · simp only [active,hqr θ hu']
        by_cases ho : ok q θ <;> simp [ho]
    rw [re]
    apply reject_bound (L := L) _ _ (by rwa [mixture_left]) _ _ _ _ _ (by positivity)
    intro q θ hg
    have hm := margin θ (νH q) hg.1
    have he := event_compl (mix (νH q) ν) (fun z => z∈U θ)
    have bd : event (mix (νH q) ν) (fun z => z∉U θ) ≤ 3*(ζ+u) := by linarith
    unfold event at bd ⊢
    rw [mix_avg] at bd
    simp only [νH,historyLaw,push_avg,ν,posteriorState] at bd
    simp_rw [mixture_left, hqr θ hg.2]
    apply le_trans _ bd
    apply avg_mono; intro p
    apply avg_mono; intro r
    by_cases hh : x r∈U θ <;> simp [hh]
  have eqg : event ρ (fun z => ¬good z.2 z.1.1 z.1.2) =
      avg π (fun pq => event (a pq.2) (fun θ => ¬good θ pq.1 pq.2)) := dependent_avg .. 
  rw [m₀,eqg] at total
  dsimp only
  linarith only [localScore,total,m₁,m₂,m₃]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 4.12 Both integrated common-level comparisons with the literal loss

Lean verified

Let S > 2 2100 , and let the common levels have a finite positive measure of mass W c ≤ S / ϵ . Assume the finite coordinate and bit arrays depend measurably on the level. Let their integral of edge inconsistency be at most four. Let the finite edge law have strictly positive point marginals and let D ≥ 0 be the relative entropy of its two-point wedge law against the product of its point marginals. Let k = 2 18000 , L = k 8 , and take a positive integer K ≥ k 32 ( D + 1 ) . Then one point history of length n < K , with at most L 2 ( K − 1 ) values, satisfies both inequalities

( C Q + C T ) / 6 ≤ D Q c + D T c + 16 e 0 S , C P / 6 ≤ D P c + T F + 16 e 0 S .

Here D i c = ∫ C d i , C i = ∫ C V i , T F = ∫ C E p F ( ν h ( p ) ) . The T experiment draws the k histories independently at its center and resamples centers conditional on the tested point and the very same list. Each displayed quantity uses the original, unnormalized common-level measure.

Proof

Transport the finite measure along the map recording the complete arrays at a level. The pushforward gives every statistic of these arrays the same normalized integral. Select a history via the integrated vector estimate. With R = ( D / K ) 1 / 4 and M = ∫ C m ≤ 4 , the integrated predicted rejection is at most E = M + W c ( 4 / L + 4 18 R ) . Multiply the first inequality of Lemma 4.11 by the level mass and integrate. Its bracket contributes at most

M + E / ζ + W c ( 16 / ( k u 2 ) + 3 ( ζ + u ) + 4 / L + 4 6 R ) , ζ = 2 − 1946 , u = 2 − 4501 .

The second contributes at most M + E / ζ + W c ζ . The bound on K gives R ≤ 2 − 144000 . Both brackets are at most 2 − 144 S . For example 3 W c ζ ≤ 3 ⋅ 2 − 146 S = 3 e 0 S / 4 . Lean proves the remaining margins by comparing powers of two. When the common measure is zero all the common integrals vanish.

Inspect the Lean declarations

OAI.PlanarUnitDistances.CommonTemplate.exact_common_scores

∀ {P : Type u_1} {Q : Type u_2} {A : Type u_3} {B : Type u_4} {I : Type u_5} {L : Type u_6} {Ω : Type u_7}
  [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : Fintype A] [inst_3 : Fintype B] [inst_4 : Fintype I]
  [Nonempty I] [inst_6 : Fintype L] [Nonempty L] [inst_8 : MeasurableSpace A] [MeasurableSingletonClass A]
  [inst_10 : MeasurableSpace B] [MeasurableSingletonClass B] [inst_12 : MeasurableSpace Ω]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q)),
  (∀ (p : P), 0 < (OAI.PlanarUnitDistances.FiniteStarCoupling.left π).val p) →
    ∀ (σ : MeasureTheory.Measure Ω) [MeasureTheory.IsFiniteMeasure σ],
      0 < σ.real Set.univ →
        ∀ (t : Ω → OAI.PlanarUnitDistances.CommonTemplate.CommonLevel P Q A B),
          (∀ (p : P), Measurable fun j => (t j).x p) →
            (∀ (q : Q), Measurable fun j => (t j).y q) →
              (∀ (p : P) (q : Q), Measurable fun j => (t j).bit p q) →
                ∀ (K : ℕ),
                  0 < K →
                    0 ≤ OAI.PlanarUnitDistances.CommonTemplate.commonInformation π →
                      2 ^ 576000 * (OAI.PlanarUnitDistances.CommonTemplate.commonInformation π + 1) ≤ ↑K →
                        ↑(Fintype.card I) = 2 ^ 18000 →
                          (↑(Fintype.card L))⁻¹ = PlanarUnitDistances.ComparisonConstants.dy 144000 →
                            ∀ {S : ℝ},
                              2 ^ 2100 < S →
                                σ.real Set.univ ≤ S / PlanarUnitDistances.ComparisonConstants.dy 1800 →
                                  ∫ (j : Ω),
                                        OAI.PlanarUnitDistances.CommonTemplate.inconsistency π (t j).bit
                                          (t j).x (t j).y ∂σ ≤
                                      4 →
                                    ∃ n < K,
                                      ∃ h,
                                        (Finset.image h Finset.univ).card ≤ Fintype.card L ^ (2 * (K - 1)) ∧
                                          (∫ (j : Ω),
                                                    OAI.PlanarUnitDistances.CommonTemplate.cvT π h (t j) ∂σ +
                                                  ∫ (j : Ω),
                                                    OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π
                                                      (t j).bit ∂σ) /
                                                6 ≤
                                              ∫ (j : Ω),
                                                    OAI.PlanarUnitDistances.CommonTemplate.cdT π h (t j) ∂σ +
                                                  ∫ (j : Ω),
                                                    OAI.PlanarUnitDistances.FiniteStarCoupling.DQ π (t j).bit
                                                      (t j).x ∂σ +
                                                16 * (PlanarUnitDistances.ComparisonConstants.dy 144 * S) ∧
                                            (∫ (j : Ω),
                                                  OAI.PlanarUnitDistances.FiniteStarCoupling.VP π
                                                    (t j).bit ∂σ) /
                                                6 ≤
                                              ∫ (j : Ω),
                                                    OAI.PlanarUnitDistances.FiniteStarCoupling.DP π (t j).bit
                                                      (t j).y ∂σ +
                                                  ∫ (j : Ω),
                                                    OAI.PlanarUnitDistances.CommonTemplate.posteriorMoment π h
                                                      (t j) ∂σ +
                                                16 * (PlanarUnitDistances.ComparisonConstants.dy 144 * S)
Lean source · PlanarUnitDistances/ExactCommonScores.lean, lines 28–89
/-- The literal common-level conclusions with the paper's 16e₀S losses, using
the actual conditional experiment T from this very same observation history. -/
theorem exact_common_scores (π : Law (P×Q)) (hp : ∀p,0<(left π).val p)
    (σ : Measure Ω) [IsFiniteMeasure σ] (hσ : 0<σ.real Set.univ)
    (t : Ω → CommonLevel P Q A B) (h₁ : ∀p,Measurable (fun j => (t j).x p))
    (h₂ : ∀q,Measurable (fun j => (t j).y q)) (h₃ : ∀p q,Measurable (fun j => (t j).bit p q))
    (K : ℕ) (hK : 0<K) (hD : 0≤commonInformation π)
    (hk : (2:ℝ)^576000*(commonInformation π+1) ≤ (K:ℝ))
    (Icard : (Fintype.card I:ℝ)=(2:ℝ)^18000) (Lcard : ((Fintype.card L:ℝ))⁻¹=dy 144000)
    {S : ℝ} (hS : 2^2100<S) (hW : σ.real Set.univ ≤ S/dy 1800)
    (hM : (∫ j, inconsistency π (t j).bit (t j).x (t j).y ∂σ) ≤ 4) :
    ∃ n<K, ∃ h : P → FiniteInformation.History (L×L) n,
      (univ.image h).card ≤ (Fintype.card L)^(2*(K-1)) ∧
      ((∫j, cvT (I := I) π h (t j) ∂σ)+(∫j, VQ π (t j).bit ∂σ))/6 ≤
        (∫j, cdT (I := I) π h (t j) ∂σ)+(∫j, DQ π (t j).bit (t j).x ∂σ)+16*(dy 144*S) ∧
      (∫j, VP π (t j).bit ∂σ)/6 ≤ (∫j, DP π (t j).bit (t j).y ∂σ)+
        (∫j, posteriorMoment π h (t j) ∂σ)+16*(dy 144*S) := by
  let W := σ.real Set.univ
  let m := levelMean σ (fun j => inconsistency π (t j).bit (t j).x (t j).y)
  let R := (commonInformation π/(K:ℝ))^(1/4:ℝ)
  let E := W*(m+4*dy 144000+4*Real.sqrt 3*Real.sqrt 6*R)
  have hm : W*m ≤ 4 := by
    dsimp only [W,m,levelMean]
    rwa [mul_div_cancel₀ _ hσ.ne']
  have hr := fourth_root_bound hD hK hk
  have B := budgets hS hσ.le hW hm hr (M:=W*m) (E:=E) (by change W*(m+4*dy 144000+4*Real.sqrt 3*Real.sqrt 6*R) ≤ W*m+W*(4*dy 144000+4*Real.sqrt 3*Real.sqrt 6*R); exact le_of_eq (by ring))
  obtain ⟨n,hn,h,sz,_,hA,hB⟩ := continuum_scores (I := I) (L := L) π hp σ hσ t h₁ h₂ h₃ K hK (pos 1946) (pos 4501)
  have hL : 4/(Fintype.card L:ℝ)=4*dy 144000 := by rw [div_eq_mul_inv,Lcard]
  rw [Icard,hL] at hA
  rw [hL] at hB
  let a := m+4*dy 144000+4*Real.sqrt 3*Real.sqrt 6*R
  let extras := 16/((2:ℝ)^18000*(dy 4501)^2)+3*(dy 1946+dy 4501)+4*dy 144000+4*Real.sqrt 6*R
  have Ba : W*(m+a/dy 1946+extras) ≤ dy 144*S := by
    apply le_trans _ B.1
    change W*(m+a/dy 1946+extras) ≤ W*m+E/dy 1946+W*extras
    rw [mul_add,mul_add,← mul_div_assoc]
  have Bb : W*(m+a/dy 1946+dy 1946) ≤ dy 144*S := by
    apply le_trans _ B.2
    dsimp only [a,E]
    apply le_of_eq
    ring
  have unweight (f : Ω → ℝ) : W*levelMean σ f = ∫j,f j ∂σ := by
    dsimp only [W,levelMean]
    exact mul_div_cancel₀ _ hσ.ne'
  refine ⟨n,hn,h,sz,?_,?_⟩
  · have hg : (levelMean σ (fun j => cvT (I := I) π h (t j))+levelMean σ (fun j => VQ π (t j).bit))/6 ≤
        levelMean σ (fun j => cdT (I := I) π h (t j))+levelMean σ (fun j => DQ π (t j).bit (t j).x) +
        16*(m+a/dy 1946+extras) := by
      apply hA.trans_eq
      change _+_+16*(m+a/dy 1946+_+_+_+_) = _+_+16*(m+a/dy 1946+extras)
      dsimp only [extras,R]
      ac_rfl
    have hu := mul_le_mul_of_nonneg_left hg hσ.le
    change W*_ ≤ W*_ at hu
    rw [←mul_div_assoc,mul_add,unweight,unweight,mul_add,mul_add,unweight,unweight,
      mul_left_comm W 16] at hu
    exact hu.trans (add_le_add_right (mul_le_mul_of_nonneg_left Ba (by norm_num : (0:ℝ)≤16)) _)
  · change _ ≤ _ + _ + 16*(m+a/dy 1946+dy 1946) at hB
    have hu := mul_le_mul_of_nonneg_left hB hσ.le
    change W*_ ≤ W*_ at hu
    rw [←mul_div_assoc,unweight,mul_add,mul_add,unweight,unweight,mul_left_comm W 16] at hu
    exact hu.trans (add_le_add_right (mul_le_mul_of_nonneg_left Bb (by norm_num : (0:ℝ)≤16)) _)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.CommonTemplate.continuum_scores

∀ {P : Type u_1} {Q : Type u_2} {A : Type u_3} {B : Type u_4} {I : Type u_6} {L : Type u_7} [inst : Fintype P]
  [inst_1 : Fintype Q] [inst_2 : Fintype A] [inst_3 : Fintype B] [inst_4 : Fintype I] [Nonempty I]
  [inst_6 : Fintype L] [Nonempty L] {Ω : Type u_9} [inst_8 : MeasurableSpace Ω] [inst_9 : MeasurableSpace A]
  [MeasurableSingletonClass A] [inst_11 : MeasurableSpace B] [MeasurableSingletonClass B]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q)),
  (∀ (p : P), 0 < (OAI.PlanarUnitDistances.FiniteStarCoupling.left π).val p) →
    ∀ (σ : MeasureTheory.Measure Ω) [MeasureTheory.IsFiniteMeasure σ],
      0 < σ.real Set.univ →
        ∀ (t : Ω → OAI.PlanarUnitDistances.CommonTemplate.CommonLevel P Q A B),
          (∀ (p : P), Measurable fun j => (t j).x p) →
            (∀ (q : Q), Measurable fun j => (t j).y q) →
              (∀ (p : P) (q : Q), Measurable fun j => (t j).bit p q) →
                ∀ (K : ℕ),
                  0 < K →
                    ∀ {ζ u : ℝ},
                      0 < ζ →
                        0 < u →
                          have R :=
                            (OAI.PlanarUnitDistances.CommonTemplate.commonInformation π / ↑K) ^ (1 / 4);
                          have m :=
                            OAI.PlanarUnitDistances.CommonTemplate.levelMean σ fun j =>
                              OAI.PlanarUnitDistances.CommonTemplate.inconsistency π (t j).bit (t j).x
                                (t j).y;
                          have a := m + 4 / ↑(Fintype.card L) + 4 * √3 * √6 * R;
                          ∃ n < K,
                            ∃ h,
                              (Finset.image h Finset.univ).card ≤ Fintype.card L ^ (2 * (K - 1)) ∧
                                (OAI.PlanarUnitDistances.CommonTemplate.levelMean σ fun j =>
                                      OAI.PlanarUnitDistances.CommonTemplate.predictionError π h (t j).x
                                        (t j).y) ≤
                                    a ∧
                                  ((OAI.PlanarUnitDistances.CommonTemplate.levelMean σ fun j =>
                                            OAI.PlanarUnitDistances.CommonTemplate.cvT π h (t j)) +
                                          OAI.PlanarUnitDistances.CommonTemplate.levelMean σ fun j =>
                                            OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π (t j).bit) /
                                        6 ≤
                                      ((OAI.PlanarUnitDistances.CommonTemplate.levelMean σ fun j =>
                                            OAI.PlanarUnitDistances.CommonTemplate.cdT π h (t j)) +
                                          OAI.PlanarUnitDistances.CommonTemplate.levelMean σ fun j =>
                                            OAI.PlanarUnitDistances.FiniteStarCoupling.DQ π (t j).bit
                                              (t j).x) +
                                        16 *
                                          (m + a / ζ + 16 / (↑(Fintype.card I) * u ^ 2) + 3 * (ζ + u) +
                                              4 / ↑(Fintype.card L) +
                                            4 * √6 * R) ∧
                                    (OAI.PlanarUnitDistances.CommonTemplate.levelMean σ fun j =>
                                          OAI.PlanarUnitDistances.FiniteStarCoupling.VP π (t j).bit) /
                                        6 ≤
                                      ((OAI.PlanarUnitDistances.CommonTemplate.levelMean σ fun j =>
                                            OAI.PlanarUnitDistances.FiniteStarCoupling.DP π (t j).bit
                                              (t j).y) +
                                          OAI.PlanarUnitDistances.CommonTemplate.levelMean σ fun j =>
                                            OAI.PlanarUnitDistances.CommonTemplate.posteriorMoment π h
                                              (t j)) +
                                        16 * (m + a / ζ + ζ)
Lean source · PlanarUnitDistances/IntegratedScores.lean, lines 167–193
/-- Both common-level comparisons for the same history, on a genuine measured
continuum of levels. The predicates defining its label and bit arrays are
assumed measurable, and all subsequent finite tests are measurable automatically. -/
theorem continuum_scores {Ω : Type*} [MeasurableSpace Ω]
    [MeasurableSpace A] [MeasurableSingletonClass A] [MeasurableSpace B] [MeasurableSingletonClass B]
    (π : Law (P×Q)) (hp : ∀p,0<(left π).val p)
    (σ : Measure Ω) [IsFiniteMeasure σ] (hσ : 0<σ.real Set.univ)
    (t : Ω → CommonLevel P Q A B) (h₁ : ∀p,Measurable (fun j => (t j).x p))
    (h₂ : ∀q,Measurable (fun j => (t j).y q)) (h₃ : ∀p q,Measurable (fun j => (t j).bit p q))
    (K : ℕ) (hK : 0<K) {ζ u : ℝ} (hζ : 0<ζ) (hu : 0<u) :
    let R := (commonInformation π/(K:ℝ))^(1/4:ℝ)
    let m := levelMean σ (fun j => inconsistency π (t j).bit (t j).x (t j).y)
    let a := m+4/(Fintype.card L:ℝ)+4*Real.sqrt 3*Real.sqrt 6*R
    ∃ n<K, ∃ h : P → FiniteInformation.History (L×L) n,
      (univ.image h).card ≤ (Fintype.card L)^(2*(K-1)) ∧
      levelMean σ (fun j => predictionError π h (t j).x (t j).y) ≤ a ∧
      (levelMean σ (fun j => cvT (I := I) π h (t j))+levelMean σ (fun j => VQ π (t j).bit))/6 ≤
        levelMean σ (fun j => cdT (I := I) π h (t j))+levelMean σ (fun j => DQ π (t j).bit (t j).x) +
        16*(m+a/ζ+16/((Fintype.card I:ℝ)*u^2)+3*(ζ+u)+4/(Fintype.card L:ℝ)+4*Real.sqrt 6*R) ∧
      levelMean σ (fun j => VP π (t j).bit)/6 ≤ levelMean σ (fun j => DP π (t j).bit (t j).y) +
        levelMean σ (fun j => posteriorMoment π h (t j))+16*(m+a/ζ+ζ) := by
  let ht := measurable_snapshot t h₁ h₂ h₃
  obtain ⟨n,hn,h,sz,pe,A₁,A₂⟩ := integrated_scores (I := I) (L := L) π hp (compress σ hσ t ht) id K hK hζ hu
  refine ⟨n,hn,h,sz,?_,?_,?_⟩
  · simpa only [id_eq,compress_avg,levelMean] using pe
  · simpa only [id_eq,compress_avg,levelMean] using A₁
  · simpa only [id_eq,compress_avg,levelMean] using A₂

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ComparisonConstants.budgets

∀ {S W M E R : ℝ},
  2 ^ 2100 < S →
    0 ≤ W →
      W ≤ S / PlanarUnitDistances.ComparisonConstants.dy 1800 →
        M ≤ 4 →
          R ≤ PlanarUnitDistances.ComparisonConstants.dy 144000 →
            E ≤ M + W * (4 * PlanarUnitDistances.ComparisonConstants.dy 144000 + 4 * √3 * √6 * R) →
              M + E / PlanarUnitDistances.ComparisonConstants.dy 1946 +
                    W *
                      (16 / (2 ^ 18000 * PlanarUnitDistances.ComparisonConstants.dy 4501 ^ 2) +
                            3 *
                              (PlanarUnitDistances.ComparisonConstants.dy 1946 +
                                PlanarUnitDistances.ComparisonConstants.dy 4501) +
                          4 * PlanarUnitDistances.ComparisonConstants.dy 144000 +
                        4 * √6 * R) ≤
                  PlanarUnitDistances.ComparisonConstants.dy 144 * S ∧
                M + E / PlanarUnitDistances.ComparisonConstants.dy 1946 +
                    W * PlanarUnitDistances.ComparisonConstants.dy 1946 ≤
                  PlanarUnitDistances.ComparisonConstants.dy 144 * S
Lean source · PlanarUnitDistances/ComparisonConstants.lean, lines 22–82
/-- Literal comparison budget. Here W is the common width, M the integrated
edge inconsistency, E the integrated predicted rejection and R the
prediction fourth root. All are in unnormalized width units except R. -/
theorem budgets {S W M E R : ℝ} (hS : 2^2100 < S) (hW : 0≤W)
    (hW' : W ≤ S/dy 1800) (hM : M≤4)
    (hR : R≤dy 144000)
    (hE : E≤M+W*(4*dy 144000+4*sqrt 3*sqrt 6*R)) :
    M+E/dy 1946+W*(16/((2:ℝ)^18000*(dy 4501)^2)+3*(dy 1946+dy 4501)+4*dy 144000+4*sqrt 6*R)
      ≤ dy 144*S ∧ M+E/dy 1946+W*dy 1946 ≤ dy 144*S := by
  have hs : 0<S := (pow_pos (by norm_num : (0:ℝ)<2) 2100).trans hS
  have k0 : (4:ℝ) ≤ S*(4*dy 2100) := by
    have hh := mul_le_mul_of_nonneg_right hS.le (mul_nonneg (by norm_num : (0:ℝ)≤4) (pos 2100).le)
    have ee : (2:ℝ)^2100*(4*dy 2100) = 4 := by
      calc
        _ = 4*((2:ℝ)^2100 * ((2:ℝ)^2100)⁻¹) := by unfold dy; ac_rfl
        _ = 4 := by rw [mul_inv_cancel₀ (pow_ne_zero _ (two_ne_zero : (2:ℝ)≠0)),mul_one]
    rwa [ee] at hh
  have k1 : (4:ℝ)*sqrt 3*sqrt 6 ≤18 := by
    rw [mul_assoc,←sqrt_mul (by norm_num)]
    have h₁ := sq_sqrt (by norm_num : 0≤(3:ℝ)*6)
    nlinarith [sqrt_nonneg ((3:ℝ)*6)]
  have k2 : (4:ℝ)*sqrt 6 ≤10 := by nlinarith [sq_sqrt (by norm_num : (0:ℝ)≤6),sqrt_nonneg (6:ℝ)]
  have err0 : 4*dy 144000+4*sqrt 3*sqrt 6*R ≤ 22*dy 144000 := by
    calc
      _ ≤ 4*dy 144000+4*sqrt 3*sqrt 6*dy 144000 := by gcongr
      _ ≤ _ := by linarith [mul_le_mul_of_nonneg_right k1 (pos 144000).le]
  have err1 : 4*dy 144000+4*sqrt 6*R ≤14*dy 144000 := by
    calc
      _ ≤ 4*dy 144000+4*sqrt 6*dy 144000 := by gcongr
      _ ≤ _ := by linarith [mul_le_mul_of_nonneg_right k2 (pos 144000).le]
  have hw (n : ℕ) (hn : 1800 ≤ n) : W*dy n ≤ S*dy (n-1800) := calc
    _ ≤ (S/dy 1800)*dy n := mul_le_mul_of_nonneg_right hW' (pos _).le
    _ = _ := by rw [←div n 1800 hn]; ring
  have Ebd : E ≤ S*(4*dy 2100+22*dy 142200) := by
    have A := mul_le_mul_of_nonneg_left err0 hW
    linarith only [hE,A,hM,k0,hw 144000 (by decide)]
  have Eζ : E/dy 1946 ≤ S*(4*dy 154+22*dy 140254) := calc
    _ ≤ S*(4*dy 2100+22*dy 142200)/dy 1946 := div_le_div_of_nonneg_right Ebd (pos _).le
    _ = _ := by rw [←div 2100 1946 (by decide),←div 142200 1946 (by decide)]; ring
  have ed : 16/((2:ℝ)^18000*(dy 4501)^2) = 16*dy 8998 := by
    rw [pow, show (4501:ℕ)*2=9002 from rfl]
    rw [show (2:ℝ)^18000=(dy 18000)⁻¹ from (inv_inv _).symm]
    rw [← div 18000 9002 (by decide)]
    field_simp [ne_of_gt (pos _)]
  have rareScale : dy 146 = dy 144 / 4 := by
    have e := mul 144 2
    change dy 144*dy 2 = dy 146 at e
    rw [←e]; norm_num only [show dy 2=(1/4:ℝ) from by norm_num [dy]]; ring
  have margin : dy 154 = dy 144 / 1024 := by
    have e := mul 144 10
    change dy 144*dy 10=dy 154 at e
    rw [←e]; norm_num only [show dy 10=(1/1024:ℝ) from by norm_num [dy]]; ring
  have tight (n : ℕ) (hn : 154≤n) : S*dy n ≤ S*(dy 144/1024) := by
    rw [←margin]; exact mul_le_mul_of_nonneg_left (antitone hn) hs.le
  have last := mul_le_mul_of_nonneg_left err1 hW
  rw [ed]
  constructor <;>
    linarith only [hM,k0,Eζ,hw 1946 (by decide),hw 4501 (by decide),hw 8998 (by decide),
      hw 144000 (by decide),tight 2100 (by decide),tight 154 (by decide),tight 140254 (by decide),
      tight 7198 (by decide),tight 2701 (by decide),tight 142200 (by decide),last,
      show S*dy 146=S*(dy 144/4) from congrArg (S*·) rareScale]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.13 All-place posterior agreement

Lean verified

Let a ≠ b and c ≠ d be the two pairs of coordinate values in one number field. Sum over all infinite places and a finite set of finite places containing the multiplicative support of ( a − b ) ( c − d ) . Use the normalized place weights and any intervals [ l v , r v ] with l v ≤ − log ⁡ | a − b | v and r v ≥ log ⁡ | c − d | v . Test the first and second coordinates at scales e − s and e s , using shifted square grids at infinite places and the corresponding closed-ball relation at finite places. For each place choose the two grid shifts arbitrarily and keep them fixed over levels. Then the integral of the number of coordinate matches less one over all these intervals is at most log ⁡ 2 .

Proof

Write c v = log ⁡ 2 at an infinite place and c v = 0 otherwise. A match in the first coordinate implies s ≤ − log ⁡ | a − b | v + c v . A match in the second implies s ≥ log ⁡ | c − d | v − c v . Intersect each condition with [ l v , r v ] , bound each integral by the length of the corresponding one-sided interval, and subtract r v − l v . The resulting upper bound is − log ⁡ | ( a − b ) ( c − d ) | v + 2 c v . Summing the logarithm over the actual number-field places gives zero by the product formula. The total normalized infinite-place weight is one.

Inspect the Lean declarations

OAI.PlanarUnitDistances.PosteriorPlaces.all_places

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] {a b c d : K},
  a ≠ b →
    c ≠ d →
      ∀ (F : Finset (NumberField.FinitePlace K)),
        (∀ v ∉ F, v ((a - b) * (c - d)) = 1) →
          ∀ (U V : NumberField.InfinitePlace K → ℝ × ℝ) (l r : NumberField.InfinitePlace K → ℝ)
            (l' r' : NumberField.FinitePlace K → ℝ),
            (∀ (v : NumberField.InfinitePlace K), l v ≤ r v) →
              (∀ (v : NumberField.InfinitePlace K), l v ≤ -Real.log (v (a - b))) →
                (∀ (v : NumberField.InfinitePlace K), Real.log (v (c - d)) ≤ r v) →
                  (∀ v ∈ F, l' v ≤ r' v) →
                    (∀ v ∈ F, l' v ≤ -Real.log (v (a - b))) →
                      (∀ v ∈ F, Real.log (v (c - d)) ≤ r' v) →
                        ((∑ v,
                                ↑v.mult *
                                  ∫ (s : ℝ) in Set.Icc (l v) (r v),
                                    OAI.PlanarUnitDistances.PosteriorPlaces.score
                                      (fun t =>
                                        OAI.PlanarUnitDistances.PosteriorPlaces.archMatch v (U v) a b (-t))
                                      (OAI.PlanarUnitDistances.PosteriorPlaces.archMatch v (V v) c d) s) +
                              ∑ v ∈ F,
                                ∫ (s : ℝ) in Set.Icc (l' v) (r' v),
                                  OAI.PlanarUnitDistances.PosteriorPlaces.score
                                    (fun t => OAI.PlanarUnitDistances.PosteriorPlaces.finiteMatch v a b (-t))
                                    (OAI.PlanarUnitDistances.PosteriorPlaces.finiteMatch v c d) s) /
                            ↑(Module.finrank ℚ K) ≤
                          Real.log 2
Lean source · PlanarUnitDistances/PosteriorPlaces.lean, lines 116–158
/-- All infinite places and any finite prime set carrying the product-formula
support of the pair give an all-level excess agreement of at most log 2.
The shifts and both local interval endpoints may vary with the place. -/
theorem all_places {a b c d : K} (hab : a≠b) (hcd : c≠d)
    (F : Finset (FinitePlace K)) (hsupp : ∀ v : FinitePlace K, v ∉ F → v ((a-b)*(c-d))=1)
    (U V : InfinitePlace K → ℝ×ℝ) (l r : InfinitePlace K → ℝ) (l' r' : FinitePlace K → ℝ)
    (ord : ∀v,l v≤r v) (lo : ∀v,l v≤-log (v (a-b))) (hi : ∀v,log (v (c-d))≤r v)
    (ord' : ∀v∈F,l' v≤r' v) (lo' : ∀v∈F,l' v≤-log (v (a-b))) (hi' : ∀v∈F,log (v (c-d))≤r' v) :
    ((∑ v : InfinitePlace K, (v.mult:ℝ)*(∫s in Icc (l v) (r v),
      score (fun t => archMatch v (U v) a b (-t)) (archMatch v (V v) c d) s))+
      ∑ v∈F, ∫s in Icc (l' v) (r' v),
      score (fun t => finiteMatch v a b (-t)) (finiteMatch v c d) s)/(Module.finrank ℚ K:ℝ) ≤ log 2 := by
  let D := (a-b)*(c-d)
  have hn : D≠0 := mul_ne_zero (sub_ne_zero.mpr hab) (sub_ne_zero.mpr hcd)
  have ph := congrArg log (prod_abs_eq_one hn)
  have pI (v : InfinitePlace K) : 0 < v D := v.1.pos hn
  have pF (v : FinitePlace K) : 0 < v D := v.1.pos hn
  rw [finprod_eq_prod_of_mulSupport_subset _ (fun i h => by
    by_contra hnot; exact h (hsupp i hnot))] at ph
  have pprodI := Finset.prod_pos (s := (univ : Finset (InfinitePlace K))) (fun v _ => pow_pos (pI v) v.mult)
  have pprodF := Finset.prod_pos (s := F) (fun v _ => pF v)
  rw [log_mul pprodI.ne' pprodF.ne',log_prod (fun v _ => (pow_pos (pI v) v.mult).ne'),
    log_prod (fun v _ => (pF v).ne'),log_one] at ph
  simp only [log_pow] at ph
  have lg (v : AbsoluteValue K ℝ) : log (v D) = log (v (a-b))+log (v (c-d)) := by
    rw [show D=(a-b)*(c-d) from rfl,v.map_mul,log_mul (v.pos (sub_ne_zero.mpr hab)).ne' (v.pos (sub_ne_zero.mpr hcd)).ne']
  have upperI := sum_le_sum (s := (univ : Finset (InfinitePlace K))) fun v _ =>
    mul_le_mul_of_nonneg_left (infinite_local v (U v) (V v) hab hcd (ord v) (lo v) (hi v)) (Nat.cast_nonneg v.mult)
  have upperF := sum_le_sum (s := F) fun v hv => finite_local v hab hcd (ord' v hv) (lo' v hv) (hi' v hv)
  have eqI (v : InfinitePlace K) : -log (v (a-b))-log (v (c-d))+2*log (sqrt 2) =
      -log (v D)+log 2 := by
    have idv : log (v D) = log (v (a-b)) + log (v (c-d)) := lg v.1
    rw [idv, log_sqrt (by norm_num)]; ring
  have eqF (v : FinitePlace K) : -log (v (a-b))-log (v (c-d)) = -log (v D) := by
    have idv : log (v D) = log (v (a-b)) + log (v (c-d)) := lg v.1
    rw [idv]; ring
  simp_rw [eqI,mul_add,mul_neg,Finset.sum_add_distrib,Finset.sum_neg_distrib,←Finset.sum_mul] at upperI
  simp_rw [eqF,Finset.sum_neg_distrib] at upperF
  have hd : (0:ℝ)<Module.finrank ℚ K := Nat.cast_pos.mpr Module.finrank_pos
  have sm : (∑ v : InfinitePlace K, (v.mult:ℝ))=(Module.finrank ℚ K:ℝ) := by exact_mod_cast InfinitePlace.sum_mult_eq
  rw [sm] at upperI
  apply (div_le_iff₀ hd).mpr
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PosteriorPlaces.local_bound

∀ (P Q : ℝ → Prop) {l u t₁ t₂ c : ℝ},
  MeasurableSet {s | P s} →
    MeasurableSet {s | Q s} →
      (∀ (s : ℝ), P s → s ≤ t₁ + c) →
        (∀ (s : ℝ), Q s → t₂ - c ≤ s) →
          l ≤ u →
            l ≤ t₁ →
              t₂ ≤ u →
                0 ≤ c →
                  ∫ (s : ℝ) in Set.Icc l u, OAI.PlanarUnitDistances.PosteriorPlaces.score P Q s ≤
                    t₁ - t₂ + 2 * c
Lean source · PlanarUnitDistances/PosteriorPlaces.lean, lines 21–72
/-- One level interval. Matching the two coordinates forces opposite one-sided
inequalities; summing their lengths and subtracting the interval length
handles all relative orderings of the two thresholds. -/
theorem local_bound (P Q : ℝ → Prop) {l u t₁ t₂ c : ℝ}
    (hP : MeasurableSet {s | P s}) (hQ : MeasurableSet {s | Q s})
    (hp : ∀ s, P s → s ≤ t₁+c) (hq : ∀ s, Q s → t₂-c ≤ s)
    (hlu : l ≤ u) (hl : l ≤ t₁) (hu : t₂ ≤ u) (hc : 0 ≤ c) :
    (∫s in Icc l u, score P Q s) ≤ t₁-t₂+2*c := by
  let J := Icc l u
  let a := (Icc l (t₁+c)).indicator (fun _ : ℝ => (1:ℝ))
  let b := (Icc (t₂-c) u).indicator (fun _ : ℝ => (1:ℝ))
  let j := J.indicator (fun _ : ℝ => (1:ℝ))
  have ha : Integrable a := interval_indicator_L1 ..
  have hb : Integrable b := interval_indicator_L1 ..
  have hj : Integrable j := interval_indicator_L1 ..
  have hs : IntegrableOn (score P Q) J := by
    have hm : Measurable (score P Q) :=
      ((Measurable.ite hP measurable_const measurable_const).add
       (Measurable.ite hQ measurable_const measurable_const)).sub measurable_const
    haveI : IsFiniteMeasure (volume.restrict J) := inferInstanceAs (IsFiniteMeasure (volume.restrict (Icc l u)))
    apply Integrable.of_bound hm.aestronglyMeasurable 1
    filter_upwards [] with s
    unfold score
    split_ifs <;> norm_num
  have bound : ∫ s, J.indicator (score P Q) s ≤ ∫ s, a s+b s-j s := by
    apply integral_mono (hs.integrable_indicator measurableSet_Icc) ((ha.add hb).sub hj)
    intro s
    change J.indicator (score P Q) s ≤ a s+b s-j s
    by_cases h : s∈J
    · rw [indicator_of_mem h]
      have h₁ : (if P s then (1:ℝ) else 0) ≤ a s := by
        by_cases p : P s
        · simp [p,a,show s∈Icc l (t₁+c) from ⟨h.1,hp s p⟩]
        · simp [p,a,Set.indicator_apply]; positivity
      have h₂ : (if Q s then (1:ℝ) else 0) ≤ b s := by
        by_cases q : Q s
        · simp [q,b,show s∈Icc (t₂-c) u from ⟨hq s q,h.2⟩]
        · simp [q,b,Set.indicator_apply]; positivity
      simp only [score,j,indicator_of_mem h]
      linarith
    · rw [indicator_of_notMem h]
      simp only [j,indicator_of_notMem h,sub_zero]
      simp only [a,b,Set.indicator_apply]
      split_ifs <;> norm_num
  have subint := integral_sub (ha.add hb) hj
  simp only [Pi.add_apply] at subint
  rw [integral_indicator measurableSet_Icc,subint,integral_add ha hb] at bound
  dsimp only [a,b,j,J] at bound
  rw [interval_indicator_int,interval_indicator_int,interval_indicator_int,
    max_eq_left (by linarith : 0≤t₁+c-l),max_eq_left (by linarith : 0≤u-(t₂-c)),
    max_eq_left (sub_nonneg.mpr hlu)] at bound
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PosteriorPlaces.infinite_local

∀ {K : Type u_1} [inst : Field K] [NumberField K] (v : NumberField.InfinitePlace K) (u₁ u₂ : ℝ × ℝ)
  {a b c d : K},
  a ≠ b →
    c ≠ d →
      ∀ {l r : ℝ},
        l ≤ r →
          l ≤ -Real.log (v (a - b)) →
            Real.log (v (c - d)) ≤ r →
              ∫ (s : ℝ) in Set.Icc l r,
                  OAI.PlanarUnitDistances.PosteriorPlaces.score
                    (fun t => OAI.PlanarUnitDistances.PosteriorPlaces.archMatch v u₁ a b (-t))
                    (OAI.PlanarUnitDistances.PosteriorPlaces.archMatch v u₂ c d) s ≤
                -Real.log (v (a - b)) - Real.log (v (c - d)) + 2 * Real.log √2
Lean source · PlanarUnitDistances/PosteriorPlaces.lean, lines 91–100
theorem infinite_local (v : InfinitePlace K) (u₁ u₂ : ℝ×ℝ) {a b c d : K}
    (hab : a≠b) (hcd : c≠d) {l r : ℝ} (hlr : l≤r)
    (hl : l ≤ -log (v (a-b))) (hr : log (v (c-d)) ≤ r) :
    (∫s in Icc l r, score (fun t => archMatch v u₁ a b (-t)) (archMatch v u₂ c d) s) ≤
      -log (v (a-b))-log (v (c-d))+2*log (sqrt 2) := by
  refine local_bound _ _ (arch_meas v u₁ a b (fun s => -s) measurable_neg)
    (arch_meas v u₂ c d id measurable_id) ?_ ?_ hlr hl hr ?_
  · intro s h; linarith [arch_log_bound v u₁ hab h]
  · intro s h; linarith [arch_log_bound v u₂ hcd h]
  · rw [log_sqrt (by norm_num)]; positivity

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PosteriorPlaces.finite_local

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] (v : NumberField.FinitePlace K) {a b c d : K},
  a ≠ b →
    c ≠ d →
      ∀ {l r : ℝ},
        l ≤ r →
          l ≤ -Real.log (v (a - b)) →
            Real.log (v (c - d)) ≤ r →
              ∫ (s : ℝ) in Set.Icc l r,
                  OAI.PlanarUnitDistances.PosteriorPlaces.score
                    (fun t => OAI.PlanarUnitDistances.PosteriorPlaces.finiteMatch v a b (-t))
                    (OAI.PlanarUnitDistances.PosteriorPlaces.finiteMatch v c d) s ≤
                -Real.log (v (a - b)) - Real.log (v (c - d))
Lean source · PlanarUnitDistances/PosteriorPlaces.lean, lines 102–114
theorem finite_local (v : FinitePlace K) {a b c d : K}
    (hab : a≠b) (hcd : c≠d) {l r : ℝ} (hlr : l≤r)
    (hl : l ≤ -log (v (a-b))) (hr : log (v (c-d)) ≤ r) :
    (∫s in Icc l r, score (fun t => finiteMatch v a b (-t)) (finiteMatch v c d) s) ≤
      -log (v (a-b))-log (v (c-d)) := by
  have hn := local_bound (fun t => finiteMatch v a b (-t)) (finiteMatch v c d)
    (c := 0) (t₁ := -log (v (a-b))) (t₂ := log (v (c-d)))
    (measurableSet_le measurable_const (measurable_exp.comp measurable_neg))
    (measurableSet_le measurable_const measurable_exp)
    (fun s h => by have H := log_le_log (v.1.pos (sub_ne_zero.mpr hab)) h; rw [log_exp] at H; change log (v (a-b)) ≤ -s at H; linarith)
    (fun s h => by have H := log_le_log (v.1.pos (sub_ne_zero.mpr hcd)) h; rw [log_exp] at H; change log (v (c-d)) ≤ s at H; linarith)
    hlr hl hr le_rfl
  simpa using hn

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.14 Measurable finite labels for both vertex classes

Lean verified

On a finite vertex set V , encode each square-grid or nonarchimedean ball label by the subset of V in that cell. This gives the same finite alphabet P ( V ) for every place, level and coordinate. For fixed vertices, equality of the encoded labels is exactly a match of their physical cells. As functions of the real level both encoded coordinate labels are measurable. On the encoded labels the full-place integral for a pair of vertices distinct in both coordinates is at most log ⁡ 2 under the hypotheses of Lemma 4.13.

Proof

Equality of equivalence classes agrees with the underlying equivalence relation. For any fixed vertex v , membership in a given encoded class is an equality of two grid indices or a closed inequality of the form | a − b | v ≤ e ± s . These are measurable. Every subset-valued map on a finite alphabet is measurable once each membership predicate is measurable. For the comparison replace the two indicator functions by those of their physical relations and apply the all-place estimate.

Inspect the Lean declarations

OAI.PlanarUnitDistances.PhysicalLabels.all_labels

∀ {V : Type u_1} [inst : Fintype V] {K : Type u_3} [inst_1 : Field K] [inst_2 : NumberField K] (z w : V → K)
  (x y : V),
  z x ≠ z y →
    w x ≠ w y →
      ∀ (F : Finset (NumberField.FinitePlace K)),
        (∀ v ∉ F, v ((z x - z y) * (w x - w y)) = 1) →
          ∀ (U V' : NumberField.InfinitePlace K → ℝ × ℝ) (l r : NumberField.InfinitePlace K → ℝ)
            (l' r' : NumberField.FinitePlace K → ℝ),
            (∀ (v : NumberField.InfinitePlace K), l v ≤ r v) →
              (∀ (v : NumberField.InfinitePlace K), l v ≤ -Real.log (v (z x - z y))) →
                (∀ (v : NumberField.InfinitePlace K), Real.log (v (w x - w y)) ≤ r v) →
                  (∀ v ∈ F, l' v ≤ r' v) →
                    (∀ v ∈ F, l' v ≤ -Real.log (v (z x - z y))) →
                      (∀ v ∈ F, Real.log (v (w x - w y)) ≤ r' v) →
                        ((∑ v,
                                ↑v.mult *
                                  ∫ (s : ℝ) in Set.Icc (l v) (r v),
                                    OAI.PlanarUnitDistances.PredictionCut.pairScore
                                      (OAI.PlanarUnitDistances.PhysicalLabels.archPair v (U v) (V' v) z w s x)
                                      (OAI.PlanarUnitDistances.PhysicalLabels.archPair v (U v) (V' v) z w s
                                        y)) +
                              ∑ v ∈ F,
                                ∫ (s : ℝ) in Set.Icc (l' v) (r' v),
                                  OAI.PlanarUnitDistances.PredictionCut.pairScore
                                    (OAI.PlanarUnitDistances.PhysicalLabels.finitePair v z w s x)
                                    (OAI.PlanarUnitDistances.PhysicalLabels.finitePair v z w s y)) /
                            ↑(Module.finrank ℚ K) ≤
                          Real.log 2
Lean source · PlanarUnitDistances/PhysicalLabels.lean, lines 94–106
/-- The actual finitely encoded labels satisfy the off-diagonal bound needed
by the posterior cutoff theorem for these physical level intervals. -/
theorem all_labels (z w : V → K) (x y : V) (hz : z x ≠ z y) (hw : w x ≠ w y)
    (F : Finset (FinitePlace K))
    (hsupp : ∀ v : FinitePlace K, v ∉ F → v ((z x-z y)*(w x-w y))=1)
    (U V' : InfinitePlace K → ℝ×ℝ) (l r : InfinitePlace K → ℝ) (l' r' : FinitePlace K → ℝ)
    (ord : ∀v,l v≤r v) (lo : ∀v,l v≤-log (v (z x-z y))) (hi : ∀v,log (v (w x-w y))≤r v)
    (ord' : ∀v∈F,l' v≤r' v) (lo' : ∀v∈F,l' v≤-log (v (z x-z y))) (hi' : ∀v∈F,log (v (w x-w y))≤r' v) :
    ((∑ v : InfinitePlace K, (v.mult:ℝ)*(∫s in Icc (l v) (r v),
      PredictionCut.pairScore (archPair v (U v) (V' v) z w s x) (archPair v (U v) (V' v) z w s y)))+
      ∑ v∈F, ∫s in Icc (l' v) (r' v),
      PredictionCut.pairScore (finitePair v z w s x) (finitePair v z w s y))/(Module.finrank ℚ K:ℝ) ≤ log 2 := by
  simpa only [arch_score,finite_score] using all_places hz hw F hsupp U V' l r l' r' ord lo hi ord' lo' hi'

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLabels.archLabel_eq

∀ {V : Type u_1} [inst : Fintype V] {K : Type u_3} [inst_1 : Field K] (v : NumberField.InfinitePlace K)
  (u : ℝ × ℝ) (z : V → K) (s : ℝ) (x y : V),
  OAI.PlanarUnitDistances.PhysicalLabels.archLabel v u z s x =
      OAI.PlanarUnitDistances.PhysicalLabels.archLabel v u z s y ↔
    OAI.PlanarUnitDistances.PosteriorPlaces.archMatch v u (z x) (z y) s
Lean source · PlanarUnitDistances/PhysicalLabels.lean, lines 42–45
theorem archLabel_eq (v : InfinitePlace K) (u : ℝ×ℝ) (z : V → K) (s : ℝ) (x y : V) :
    archLabel v u z s x = archLabel v u z s y ↔ archMatch v u (z x) (z y) s := by
  apply label_eq_iff
  exact ⟨fun _ => rfl, fun hh => Eq.symm hh, fun h₁ h₂ => Eq.trans h₁ h₂⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLabels.finiteLabel_eq

∀ {V : Type u_1} [inst : Fintype V] {K : Type u_3} [inst_1 : Field K] [inst_2 : NumberField K]
  (v : NumberField.FinitePlace K) (z : V → K) (s : ℝ) (x y : V),
  OAI.PlanarUnitDistances.PhysicalLabels.finiteLabel v z s x =
      OAI.PlanarUnitDistances.PhysicalLabels.finiteLabel v z s y ↔
    OAI.PlanarUnitDistances.PosteriorPlaces.finiteMatch v (z x) (z y) s
Lean source · PlanarUnitDistances/PhysicalLabels.lean, lines 53–56
theorem finiteLabel_eq (v : FinitePlace K) (z : V → K) (s : ℝ) (x y : V) :
    finiteLabel v z s x = finiteLabel v z s y ↔ finiteMatch v (z x) (z y) s := by
  exact label_eq_iff _ _ ⟨fun x => (localSetoid v.1 (nonarch v) s).refl (z x),
    fun h => (localSetoid v.1 (nonarch v) s).symm h,fun h₁ h₂ => (localSetoid v.1 (nonarch v) s).trans h₁ h₂⟩ _ _

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLabels.measurable_archPair

∀ {V : Type u_1} [inst : Fintype V] {K : Type u_3} [inst_1 : Field K] (v : NumberField.InfinitePlace K)
  (u₁ u₂ : ℝ × ℝ) (z w : V → K) (x : V),
  Measurable fun s => OAI.PlanarUnitDistances.PhysicalLabels.archPair v u₁ u₂ z w s x
Lean source · PlanarUnitDistances/PhysicalLabels.lean, lines 75–77
theorem measurable_archPair (v : InfinitePlace K) (u₁ u₂ : ℝ×ℝ) (z w : V → K) (x : V) :
    Measurable (fun s => archPair v u₁ u₂ z w s x) :=
  ((measurable_archLabel v u₁ z x).comp measurable_neg).prodMk (measurable_archLabel v u₂ w x)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLabels.measurable_finitePair

∀ {V : Type u_1} [inst : Fintype V] {K : Type u_3} [inst_1 : Field K] [inst_2 : NumberField K]
  (v : NumberField.FinitePlace K) (z w : V → K) (x : V),
  Measurable fun s => OAI.PlanarUnitDistances.PhysicalLabels.finitePair v z w s x
Lean source · PlanarUnitDistances/PhysicalLabels.lean, lines 79–81
theorem measurable_finitePair (v : FinitePlace K) (z w : V → K) (x : V) :
    Measurable (fun s => finitePair v z w s x) :=
  ((measurable_finiteLabel v z x).comp measurable_neg).prodMk (measurable_finiteLabel v w x)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.15 The full measure on level records

Lean verified

At each place and level form a record t consisting of the two class labels for every point and center, together with all bits b p q , as in Lemma 4.14. At infinite places choose arbitrary shifts, fixed across levels. For a finite set F of finite places and arbitrary closed level intervals, let ν be the sum of the pushforwards of length on these intervals to the finite set of records, with coefficients n v / [ K : Q ] at infinite places and 1 / [ K : Q ] at the finite places in F . For every real function g on records, ∫ g d ν is exactly the weighted sum of the original integrals of g ( t ( v , s ) ) . With the interval and support hypotheses of Lemma 4.13, this gives the off-diagonal upper bound log ⁡ 2 on the integral of the posterior pair statistic for any pair of points distinct in both coordinates.

Proof

The finite record is measurable since each of its labels and bits is measurable. The change-of-variables formula for a pushforward measure identifies each local integral. Linearity gives the formula with all its place weights, and the local equality of physical and encoded matches permits the all-place inequality to be applied to the same record law.

Inspect the Lean declarations

OAI.PlanarUnitDistances.PhysicalLevels.posterior_pair_bound

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q] {K : Type u_3} [inst_2 : Field K]
  [inst_3 : NumberField K] (F : Finset (NumberField.FinitePlace K)) (z w : P ⊕ Q → K)
  (U V : NumberField.InfinitePlace K → ℝ × ℝ) (l r : NumberField.InfinitePlace K → ℝ)
  (l' r' : NumberField.FinitePlace K → ℝ) {p p' : P},
  z (Sum.inl p) ≠ z (Sum.inl p') →
    w (Sum.inl p) ≠ w (Sum.inl p') →
      (∀ v ∉ F, v ((z (Sum.inl p) - z (Sum.inl p')) * (w (Sum.inl p) - w (Sum.inl p'))) = 1) →
        (∀ (v : NumberField.InfinitePlace K), l v ≤ r v) →
          (∀ (v : NumberField.InfinitePlace K), l v ≤ -Real.log (v (z (Sum.inl p) - z (Sum.inl p')))) →
            (∀ (v : NumberField.InfinitePlace K), Real.log (v (w (Sum.inl p) - w (Sum.inl p'))) ≤ r v) →
              (∀ v ∈ F, l' v ≤ r' v) →
                (∀ v ∈ F, l' v ≤ -Real.log (v (z (Sum.inl p) - z (Sum.inl p')))) →
                  (∀ v ∈ F, Real.log (v (w (Sum.inl p) - w (Sum.inl p'))) ≤ r' v) →
                    ∫ (j : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                        OAI.PlanarUnitDistances.PredictionCut.pairScore (j.x p)
                          (j.x p') ∂OAI.PlanarUnitDistances.PhysicalLevels.measure F z w U V l r l' r' ≤
                      Real.log 2
Lean source · PlanarUnitDistances/PhysicalLevels.lean, lines 75–87
/-- The global off-diagonal estimate on exactly the record law used for the
common-score comparisons and all exceptional-width integrals. -/
theorem posterior_pair_bound (F : Finset (FinitePlace K)) (z w : P⊕Q → K)
    (U V : InfinitePlace K → ℝ×ℝ) (l r : InfinitePlace K → ℝ) (l' r' : FinitePlace K → ℝ) {p p' : P}
    (h₁ : z (.inl p)≠z (.inl p')) (h₂ : w (.inl p)≠w (.inl p'))
    (hsupp : ∀ v : FinitePlace K, v ∉ F → v ((z (.inl p)-z (.inl p'))*(w (.inl p)-w (.inl p')))=1)
    (ord : ∀v,l v≤r v) (lo : ∀v,l v≤-Real.log (v (z (.inl p)-z (.inl p'))))
    (hi : ∀v,Real.log (v (w (.inl p)-w (.inl p')))≤r v)
    (ord' : ∀v∈F,l' v≤r' v) (lo' : ∀v∈F,l' v≤-Real.log (v (z (.inl p)-z (.inl p'))))
    (hi' : ∀v∈F,Real.log (v (w (.inl p)-w (.inl p')))≤r' v) :
    (∫j, PredictionCut.pairScore (j.x p) (j.x p') ∂measure F z w U V l r l' r') ≤ Real.log 2 := by
  rw [integral_measure]
  exact all_labels z w (.inl p) (.inl p') h₁ h₂ F hsupp U V l r l' r' ord lo hi ord' lo' hi'

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLevels.measurable_arch

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q] {K : Type u_3} [inst_2 : Field K]
  (v : NumberField.InfinitePlace K) (U V : ℝ × ℝ) (z w : P ⊕ Q → K),
  Measurable (OAI.PlanarUnitDistances.PhysicalLevels.arch v U V z w)
Lean source · PlanarUnitDistances/PhysicalLevels.lean, lines 27–30
lemma measurable_arch (v : InfinitePlace K) (U V : ℝ×ℝ) (z w : P⊕Q → K) :
    Measurable (arch v U V z w) :=
  measurable_snapshot _ (fun p => measurable_archPair v U V z w (.inl p))
    (fun q => measurable_archPair v U V z w (.inr q)) (fun _ _ => measurable_bit _)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLevels.measurable_finite

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q] {K : Type u_3} [inst_2 : Field K]
  [inst_3 : NumberField K] (v : NumberField.FinitePlace K) (z w : P ⊕ Q → K),
  Measurable (OAI.PlanarUnitDistances.PhysicalLevels.finite v z w)
Lean source · PlanarUnitDistances/PhysicalLevels.lean, lines 32–34
lemma measurable_finite (v : FinitePlace K) (z w : P⊕Q → K) : Measurable (finite v z w) :=
  measurable_snapshot _ (fun p => measurable_finitePair v z w (.inl p))
    (fun q => measurable_finitePair v z w (.inr q)) (fun _ _ => measurable_bit _)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLevels.integral_measure

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q] {K : Type u_3} [inst_2 : Field K]
  [inst_3 : NumberField K] (F : Finset (NumberField.FinitePlace K)) (z w : P ⊕ Q → K)
  (U V : NumberField.InfinitePlace K → ℝ × ℝ) (l r : NumberField.InfinitePlace K → ℝ)
  (l' r' : NumberField.FinitePlace K → ℝ) (f : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → ℝ),
  ∫ (j : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
      f j ∂OAI.PlanarUnitDistances.PhysicalLevels.measure F z w U V l r l' r' =
    ((∑ v,
          ↑v.mult *
            ∫ (s : ℝ) in Set.Icc (l v) (r v),
              f (OAI.PlanarUnitDistances.PhysicalLevels.arch v (U v) (V v) z w s)) +
        ∑ v ∈ F,
          ∫ (s : ℝ) in Set.Icc (l' v) (r' v), f (OAI.PlanarUnitDistances.PhysicalLevels.finite v z w s)) /
      ↑(Module.finrank ℚ K)
Lean source · PlanarUnitDistances/PhysicalLevels.lean, lines 60–73
/-- The finite record law preserves the original continuum integral of every
statistic of the recorded labels and bits, including later history-dependent tests. -/
theorem integral_measure (F : Finset (FinitePlace K)) (z w : P⊕Q → K) (U V : InfinitePlace K → ℝ×ℝ)
    (l r : InfinitePlace K → ℝ) (l' r' : FinitePlace K → ℝ) (f : Record P Q → ℝ) :
    (∫j, f j ∂measure F z w U V l r l' r') =
    ((∑ v : InfinitePlace K, (v.mult:ℝ)*(∫s in Icc (l v) (r v), f (arch v (U v) (V v) z w s)))+
      ∑v∈F,∫s in Icc (l' v) (r' v), f (finite v z w s))/(Module.finrank ℚ K:ℝ) := by
  unfold measure
  rw [integral_smul_nnreal_measure,integral_add_measure Integrable.of_finite Integrable.of_finite,
    integral_finsetSum_measure (fun _ _ => Integrable.of_finite),integral_finsetSum_measure (fun _ _ => Integrable.of_finite)]
  simp only [integral_smul_nnreal_measure,NNReal.smul_def,smul_eq_mul,NNReal.coe_natCast,degreeWeight]
  simp_rw [record_integral _ (measurable_arch ..),record_integral _ (measurable_finite ..)]
  change (Module.finrank ℚ K:ℝ)⁻¹ * _ = _
  ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.16 The record measure on the uniform incidence law

Lean verified

Let S q ⊂ P be finite neighborhood sets, let e = ∑ q | S q | > 0 , and give every incidence ( p , q ) mass 1 / e . Let z , w be coordinates over one number field, each injective on the point side, satisfying ( z p − z q ) ( w p − w q ) = 1 on the incidences. Take the symmetric intervals given by the large-profile construction, retaining precisely the finite places whose profile radius is nonzero. Fix fractional shifts at the infinite places and let ν denote the resulting record measure. Its minority integral is exactly the large-profile scale S , independently of the shifts. Every distinct pair of points has integrated agreement statistic at most log ⁡ 2 . If all centers have positive degree, the common information parameter for the edge law equals the two-edge information parameter of this graph.

Proof

The marginals are the degree fractions at the two endpoints. The conditional law at a center is uniform on its row, so the same neighbor-pair distribution defines both information parameters. The finite support of the profile radius contains every prime at which a nonzero point-coordinate difference has nonzero logarithm. All omitted intervals have length zero. On the support of the incidence law the bit threshold is the geometric edge threshold. Integrating every entry of the finite record and summing with normalized weights gives the assertion.

Inspect the Lean declarations

PlanarUnitDistances.UniformPhysical.full_off_diagonal

∀ {P Q : Type} [inst : Fintype P] [inst_1 : Fintype Q] {K : Type u_1} [inst_2 : Field K]
  [inst_3 : NumberField K] (S : Q → Finset P) (z w : P ⊕ Q → K),
  Function.Injective (z ∘ Sum.inl) →
    Function.Injective (w ∘ Sum.inl) →
      ∀ (U V : NumberField.InfinitePlace K → ℝ × ℝ) {p q : P},
        p ≠ q →
          ∫ (j : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
              OAI.PlanarUnitDistances.PredictionCut.pairScore (j.x p)
                (j.x q) ∂PlanarUnitDistances.UniformPhysical.fullMeasure S z w U V ≤
            Real.log 2
Lean source · PlanarUnitDistances/UniformPhysical.lean, lines 45–64
theorem full_off_diagonal (S : Q → Finset P) (z w : P⊕Q → K)
    (hz : Function.Injective (z ∘ Sum.inl)) (hw : Function.Injective (w ∘ Sum.inl))
    (U V : InfinitePlace K → ℝ×ℝ) {p q : P} (hn : p≠q) :
    (∫ j, PredictionCut.pairScore (j.x p) (j.x q) ∂fullMeasure S z w U V) ≤ Real.log 2 := by
  have h₁ : z (.inl p)≠z (.inl q) := fun he => hn (hz he)
  have h₂ : w (.inl p)≠w (.inl q) := fun he => hn (hw he)
  have bounds (v : AbsoluteValue K ℝ) := (radius_bounds S z w v).2 p q
  have hr (v : AbsoluteValue K ℝ) : -profileRadius S z w v≤profileRadius S z w v :=
    neg_le_self (le_trans (abs_nonneg _) (bounds v).1)
  apply posterior_pair_bound _ _ _ _ _ _ _ _ _ h₁ h₂ _ (fun v => hr v.1)
    (fun v => neg_le_neg ((le_abs_self _).trans (bounds v.1).1)) (fun v => (le_abs_self _).trans (bounds v.1).2)
    (fun v _ => hr v.1) (fun v _ => neg_le_neg ((le_abs_self _).trans (bounds v.1).1))
    (fun v _ => (le_abs_self _).trans (bounds v.1).2)
  intro v hv
  have bd := bounds v.1
  rw [radius_zero S z w hv] at bd
  have one (u : K) (h : u≠0) (hh : |Real.log (v.1 u)|≤0) : v u=1 := by
    have lg : Real.log (v.1 u)=0 := abs_nonpos_iff.mp hh
    exact (Real.exp_log (v.1.pos h)).symm.trans (by rw [lg,Real.exp_zero])
  rw [map_mul,one _ (sub_ne_zero.mpr h₁) bd.1,one _ (sub_ne_zero.mpr h₂) bd.2,mul_one]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.UniformPhysical.edge_left

∀ {P Q : Type} [inst : Fintype P] [inst_1 : Fintype Q] (S : Q → Finset P) (e : ℝ) (he : 0 < e)
  (ht : ∑ q, ↑(S q).card = e) (p : P),
  (OAI.PlanarUnitDistances.FiniteStarCoupling.left
          (PlanarUnitDistances.UniformPhysical.edgeLaw S e he ht)).val
      p =
    ↑(PlanarUnitDistances.BoundedHeight.pointCenters S p).card / e
Lean source · PlanarUnitDistances/UniformIncidenceLaw.lean, lines 19–21
theorem edge_left (S : Q → Finset P) (e : ℝ) (he : 0<e) (ht : ∑q,((S q).card:ℝ)=e) (p : P) :
    (FiniteStarCoupling.left (edgeLaw S e he ht)).val p=((pointCenters S p).card:ℝ)/e := by
  rw [left_val]; exact weight_left S e p

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.UniformPhysical.edge_right

∀ {P Q : Type} [inst : Fintype P] [inst_1 : Fintype Q] (S : Q → Finset P) (e : ℝ) (he : 0 < e)
  (ht : ∑ q, ↑(S q).card = e) (q : Q),
  (OAI.PlanarUnitDistances.FiniteStarCoupling.right
          (PlanarUnitDistances.UniformPhysical.edgeLaw S e he ht)).val
      q =
    PlanarUnitDistances.BoundedHeight.centerLaw S e q
Lean source · PlanarUnitDistances/UniformIncidenceLaw.lean, lines 22–24
theorem edge_right (S : Q → Finset P) (e : ℝ) (he : 0<e) (ht : ∑q,((S q).card:ℝ)=e) (q : Q) :
    (right (edgeLaw S e he ht)).val q=centerLaw S e q := by
  rw [right_val]; exact weight_right S e q

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.UniformPhysical.edge_information

∀ {P Q : Type} [inst : Fintype P] [inst_1 : Fintype Q] (S : Q → Finset P) (e : ℝ) (he : 0 < e)
  (ht : ∑ q, ↑(S q).card = e),
  (∀ (q : Q), (S q).Nonempty) →
    OAI.PlanarUnitDistances.CommonTemplate.commonInformation
        (PlanarUnitDistances.UniformPhysical.edgeLaw S e he ht) =
      PlanarUnitDistances.BoundedHeight.twoEdgeInformation S e
Lean source · PlanarUnitDistances/UniformPhysical.lean, lines 13–29
theorem edge_information (S : Q → Finset P) (e : ℝ) (he : 0<e) (ht : ∑q,((S q).card:ℝ)=e)
    (hne : ∀q,(S q).Nonempty) : commonInformation (edgeLaw S e he ht)=twoEdgeInformation S e := by
  let ν := edgeLaw S e he ht
  have rk : (right ν).val = centerLaw S e := funext (edge_right S e he ht)
  have rkpos (q : Q) : 0<(right ν).val q := by
    rw [rk]; exact div_pos (Nat.cast_pos.mpr (card_pos.mpr (hne q))) he
  have cols : (fun q => (col ν q).val)=neighborLaw S := by
    funext q p
    rw [col_val ν (rkpos q) p,rk]
    change weight S e p q / centerLaw S e q = neighborLaw S q p
    by_cases h : p∈S q <;> simp [weight,centerLaw,neighborLaw,hne,h,div_eq_mul_inv]
    field_simp [he.ne',Nat.cast_ne_zero.mpr (card_ne_zero.mpr (hne q))]
  have hm : FiniteInformation.marginal (right ν).val (fun q => (col ν q).val) = (FiniteStarCoupling.left ν).val :=
    congrArg Law.val (mixture_left ν)
  unfold commonInformation twoEdgeInformation
  change FiniteInformation.KL (FiniteInformation.wedge (right ν).val _) _ = _
  rw [←hm,rk,cols]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.UniformPhysical.full_scale

∀ {P Q : Type} [inst : Fintype P] [inst_1 : Fintype Q] {K : Type u_1} [inst_2 : Field K]
  [inst_3 : NumberField K] (S : Q → Finset P) (e : ℝ) (he : 0 < e) (ht : ∑ q, ↑(S q).card = e)
  (z w : P ⊕ Q → K) (U V : NumberField.InfinitePlace K → ℝ × ℝ),
  ∫ (j : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
      OAI.PlanarUnitDistances.PhysicalLevels.minority (PlanarUnitDistances.UniformPhysical.edgeLaw S e he ht)
        j ∂PlanarUnitDistances.UniformPhysical.fullMeasure S z w U V =
    PlanarUnitDistances.UniformNormalization.profileScale S e z
      (fun v => -PlanarUnitDistances.profileRadius S z w v) (PlanarUnitDistances.profileRadius S z w)
Lean source · PlanarUnitDistances/UniformPhysical.lean, lines 78–101
/-- The S in the score estimates equals the minority-profile scale that is
already produced by the bounded-height obstruction for this same edge set. -/
theorem full_scale (S : Q → Finset P) (e : ℝ) (he : 0<e) (ht : ∑q,((S q).card:ℝ)=e)
    (z w : P⊕Q → K) (U V : InfinitePlace K → ℝ×ℝ) :
    (∫j, PhysicalLevels.minority (edgeLaw S e he ht) j ∂fullMeasure S z w U V) =
      profileScale S e z (fun v => -profileRadius S z w v) (profileRadius S z w) := by
  unfold fullMeasure
  rw [integral_measure]
  have ha (v : InfinitePlace K) (s : ℝ) :
      PhysicalLevels.minority (edgeLaw S e he ht) (arch v (U v) (V v) z w s) =
        ThresholdProfiles.minority (fun pq => weight S e pq.1 pq.2) (threshold v.1 (direction S z)) s :=
    minority_make S e he ht z v.1 s _
  have hb (v : FinitePlace K) (s : ℝ) :
      PhysicalLevels.minority (edgeLaw S e he ht) (PhysicalLevels.finite v z w s) =
        ThresholdProfiles.minority (fun pq => weight S e pq.1 pq.2) (threshold v.1 (direction S z)) s :=
    minority_make S e he ht z v.1 s _
  simp_rw [ha,hb]
  unfold profileScale placeSum minorityIntegral
  congr 2
  symm
  apply finsum_eq_sum_of_support_subset
  intro v hv
  by_contra hn
  simp [radius_zero S z w hn] at hv

Kernel axioms used: propext, Classical.choice, Quot.sound.

4.4 Scores on rare levels

Lemma 4.17 Averaging rare scores with the actual edge marginals

Lean verified

Fix a level, a proposed minority bit, a dominant label in the opposite shared coordinate, and any finite edge law. Write h x , h y for the base and neighbor exception probabilities, j for their joint exception probability on one edge, and m for its inconsistency probability. In each of the point, center, and conditional-list experiments, the expected rare positive term minus the bit disagreement is at least 2 ( h x − h y ) − 4 j − 6 m . For a list, its distribution can be any finite kernel depending on the center. Both centers are drawn conditionally on the same point and the same list.

Proof

When both neighbors are nonexceptional and both edges are consistent, their bits agree. If the base is exceptional as well, the shared dominant label contributes two to the rare positive term. Thus the two lower-bound errors on each draw have coefficients two for joint exception, one for neighbor exception and three for inconsistency. After averaging, each tested edge has the given edge law, including when sampling the second center from its conditional law given the point and the list.

Inspect the Lean declarations

OAI.PlanarUnitDistances.RareScore.list_lower

∀ {P : Type u_1} {Q : Type u_2} {A : Type u_3} {B : Type u_4} {Θ : Type u_5} [inst : Fintype P]
  [inst_1 : Fintype Q] [inst_2 : Fintype Θ] (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (a : Q → OAI.PlanarUnitDistances.FiniteLaw.Law Θ) (r : Bool) (l : A × B) (x : P → A × B) (y : Q → A × B)
  (bit : P → Q → Bool),
  2 *
          (OAI.PlanarUnitDistances.RareScore.pointException π r l x -
            OAI.PlanarUnitDistances.RareScore.centerException π r l y) -
        4 * OAI.PlanarUnitDistances.RareScore.jointException π r l x y -
      6 * OAI.PlanarUnitDistances.RareScore.edgeError π bit x y ≤
    OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.TemplateCoupling.templates π a) fun θ =>
      OAI.PlanarUnitDistances.RareScore.pointScore (OAI.PlanarUnitDistances.TemplateCoupling.slice π a θ) r l
        x y bit
Lean source · PlanarUnitDistances/RareCoupling.lean, lines 58–71
/-- Although the second center in the T experiment depends on the sampled list,
each tested edge still has exactly the original marginal. -/
theorem list_lower (π : Law (P×Q)) (a : Q → Law Θ) (r : Bool) (l : A×B)
    (x : P → A×B) (y : Q → A×B) (bit : P → Q → Bool) :
    2*(pointException π r l x-centerException π r l y)-4*jointException π r l x y-
      6*edgeError π bit x y ≤ avg (templates π a) (fun θ => pointScore (slice π a θ) r l x y bit) := by
  have h := avg_mono (templates π a) (fun θ => point_lower (slice π a θ) r l x y bit)
  have invariant (g : P×Q → Prop) : avg (templates π a) (fun θ => event (slice π a θ) g)=event π g := by
    rw [slice_event]
    unfold event
    apply avg_congr
    intro pq
    by_cases hg : g pq <;> simp [hg,avg_const]
  simpa only [avg_sub,avg_smul,pointException,centerException,jointException,edgeError,invariant] using h

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.RareScore.point_lower

∀ {P : Type u_1} {Q : Type u_2} {A : Type u_3} {B : Type u_4} [inst : Fintype P] [inst_1 : Fintype Q]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q)) (r : Bool) (l : A × B) (x : P → A × B) (y : Q → A × B)
  (bit : P → Q → Bool),
  2 *
          (OAI.PlanarUnitDistances.RareScore.pointException π r l x -
            OAI.PlanarUnitDistances.RareScore.centerException π r l y) -
        4 * OAI.PlanarUnitDistances.RareScore.jointException π r l x y -
      6 * OAI.PlanarUnitDistances.RareScore.edgeError π bit x y ≤
    OAI.PlanarUnitDistances.RareScore.pointScore π r l x y bit
Lean source · PlanarUnitDistances/RareCoupling.lean, lines 26–37
theorem point_lower (π : Law (P×Q)) (r : Bool) (l : A×B) (x : P → A×B) (y : Q → A×B)
    (bit : P → Q → Bool) :
    2*(pointException π r l x-centerException π r l y)-4*jointException π r l x y-
      6*edgeError π bit x y ≤ pointScore π r l x y bit := by
  have h := avg_mono (left π) (fun p => star_lower (row π p) r l (x p) y (bit p))
  simp only [avg_sub,avg_smul,row_event] at h
  have hP : avg (left π) (fun p => ind (exceptional r l (x p)))=pointException π r l x := by
    rw [left,push_avg]; rfl
  rw [hP] at h
  change 2*_ - 4*jointException π r l x y-2*centerException π r l y-6*edgeError π bit x y ≤ _ at h
  unfold pointScore
  linarith only [h]

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.RareScore.center_lower

∀ {P : Type u_1} {Q : Type u_2} {A : Type u_3} {B : Type u_4} [inst : Fintype P] [inst_1 : Fintype Q]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q)) (r : Bool) (l : A × B) (x : P → A × B) (y : Q → A × B)
  (bit : P → Q → Bool),
  2 *
          (OAI.PlanarUnitDistances.RareScore.centerException π r l y -
            OAI.PlanarUnitDistances.RareScore.pointException π r l x) -
        4 * OAI.PlanarUnitDistances.RareScore.jointException π r l x y -
      6 * OAI.PlanarUnitDistances.RareScore.edgeError π bit x y ≤
    OAI.PlanarUnitDistances.RareScore.centerScore π r l x y bit
Lean source · PlanarUnitDistances/RareCoupling.lean, lines 39–56
theorem center_lower (π : Law (P×Q)) (r : Bool) (l : A×B) (x : P → A×B) (y : Q → A×B)
    (bit : P → Q → Bool) :
    2*(centerException π r l y-pointException π r l x)-4*jointException π r l x y-
      6*edgeError π bit x y ≤ centerScore π r l x y bit := by
  have h := avg_mono (right π) (fun q => star_lower (col π q) r l (y q) x (fun p => bit p q))
  simp only [avg_sub,avg_smul,col_event] at h
  have hQ : avg (right π) (fun q => ind (exceptional r l (y q)))=centerException π r l y := by
    rw [right,push_avg]; rfl
  have hj : event π (fun pq => exceptional r l (y pq.2) ∧ exceptional r l (x pq.1)) =
      jointException π r l x y := event_congr _ (fun _ => and_comm)
  have he : event π (fun pq => ¬Consistent (bit pq.1 pq.2) (y pq.2) (x pq.1)) = edgeError π bit x y := by
    apply event_congr
    intro pq
    cases hh : bit pq.1 pq.2 <;> simp only [Consistent,Bool.false_eq_true,ite_false,ite_true] <;> aesop
  rw [hj,he,hQ] at h
  change 2*_ - 4*jointException π r l x y-2*pointException π r l x-6*edgeError π bit x y ≤ _ at h
  unfold centerScore
  linarith only [h]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.18 Removing rare levels from the posterior comparison

Lean verified

Use one draw of a history and then two independent posterior points for all levels. If the full-level integral of the number of coordinate agreements minus one is bounded by C ≥ 0 for every distinct pair, then the corresponding posterior average on the common levels is bounded by

C + 2 X + W b + W c | H | θ ,

where θ bounds the largest point atom and H is the finite history alphabet. On the record law of Lemma 4.16, using ∫ m ≤ 4 , S > 2 2100 and | H | θ ≤ 2 − 144000 , this is at most 2 X + 2 − 144 S . The assignment of the proposed dominant label is arbitrary in this inequality, with X computed for exactly that assignment.

Proof

Both posterior points have the original marginal and their collision probability is at most | H | θ . On a good rare level two nonexceptional points share the dominant coordinate, which makes their agreement count minus one nonnegative. Removing the rare levels thus costs at most the two exceptional widths and the bad-level width, except on a repeated pair, where the common-level contribution is W c . Lemma 4.15 supplies the all-place estimate on a single finite record measure.

Inspect the Lean declarations

OAI.PlanarUnitDistances.PhysicalLevels.posterior_comparison

∀ {P : Type u_1} {Q : Type u_2} {H : Type u_3} [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : Fintype H]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  [MeasureTheory.IsFiniteMeasure ν] (h : P → H) (r : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Bool)
  (label : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Finset (P ⊕ Q) × Finset (P ⊕ Q)),
  (∀ (p q : P),
      p ≠ q →
        ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
            OAI.PlanarUnitDistances.PredictionCut.pairScore (t.x p) (t.x q) ∂ν ≤
          Real.log 2) →
    ∀ {θ : ℝ},
      0 ≤ θ →
        (∀ (p : P), (OAI.PlanarUnitDistances.FiniteStarCoupling.left π).val p ≤ θ) →
          ↑(Fintype.card H) * θ ≤ PlanarUnitDistances.ComparisonConstants.dy 144000 →
            ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                  OAI.PlanarUnitDistances.CommonTemplate.inconsistency π t.bit t.x t.y ∂ν ≤
                4 →
              2 ^ 2100 <
                  ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                    OAI.PlanarUnitDistances.PhysicalLevels.minority π t ∂ν →
                ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                    if OAI.PlanarUnitDistances.PhysicalLevels.common π t then
                      OAI.PlanarUnitDistances.CommonTemplate.posteriorMoment π h t
                    else 0 ∂ν ≤
                  2 * OAI.PlanarUnitDistances.PhysicalLevels.pointWidth π ν r label +
                    PlanarUnitDistances.ComparisonConstants.dy 144 *
                      ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                        OAI.PlanarUnitDistances.PhysicalLevels.minority π t ∂ν
Lean source · PlanarUnitDistances/PosteriorWidth.lean, lines 79–108
/-- The posterior comparison, using the same record law for all levels and the
same-history pair. Width bounds are deduced from the definition of the good and
common levels and the integrated edge inconsistency bound. -/
theorem posterior_comparison (π : Law (P×Q)) (ν : Measure (Record P Q)) [IsFiniteMeasure ν]
    (h : P → H) (r : Record P Q → Bool) (label : Record P Q → Finset (P⊕Q)×Finset (P⊕Q))
    (hp : ∀p q : P,p≠q → (∫t,PredictionCut.pairScore (t.x p) (t.x q) ∂ν) ≤ Real.log 2)
    {θ : ℝ} (hθ : 0≤θ) (hmarg : ∀p,(left π).val p≤θ)
    (hsize : (Fintype.card H:ℝ)*θ ≤ dy 144000)
    (hm : (∫t,inconsistency π t.bit t.x t.y ∂ν) ≤ 4)
    (hS : 2^2100 < ∫t,minority π t ∂ν) :
    (∫t, (if common π t then posteriorMoment π h t else 0) ∂ν) ≤
      2*pointWidth π ν r label + dy 144*(∫t,minority π t ∂ν) := by
  have core := PredictionCut.integrated (left π) h ν (common π) (good π) r label
    (fun t => t.x) (Real.log 2) (Real.log_nonneg (by norm_num))
    Integrable.of_finite Integrable.of_finite (fun _ => Integrable.of_finite)
    (fun _ _ => Integrable.of_finite) (fun _ _ => Integrable.of_finite) hp hθ hmarg
  have eqv (t : Record P Q) :
      avg (PredictionCoupling.coupling (left π) h) (fun pp =>
        if common π t then PredictionCut.pairScore (t.x pp.1) (t.x pp.2) else 0) =
      if common π t then posteriorMoment π h t else 0 := by
    by_cases hc : common π t
    · simp only [if_pos hc]
      exact PredictionCoupling.tau_eq (left π) h t.x
    · simp [hc,avg_const]
  simp_rw [eqv] at core
  have ee := cutoff_constants hS (integral_nonneg (fun t => RareScore.ind_nonneg (common π t)))
    (common_width π ν) (bad_width π ν hm) hsize
  change _ ≤ Real.log 2+2*pointWidth π ν r label+_+_ at core
  unfold width at ee
  linarith only [core,ee]

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PredictionCoupling.tau_eq

∀ {P : Type u_1} {H : Type u_2} {A : Type u_3} {B : Type u_4} [inst : Fintype P] [inst_1 : Fintype H]
  [inst_2 : Fintype A] [inst_3 : Fintype B] (μ : OAI.PlanarUnitDistances.FiniteLaw.Law P) (h : P → H)
  (x : P → A × B),
  (OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.PredictionCoupling.coupling μ h) fun pp =>
      ((if (x pp.1).1 = (x pp.2).1 then 1 else 0) + if (x pp.1).2 = (x pp.2).2 then 1 else 0) - 1) =
    OAI.PlanarUnitDistances.FiniteLaw.avg μ fun p =>
      OAI.PlanarUnitDistances.FiniteMarginalScore.tau
        (OAI.PlanarUnitDistances.FiniteLaw.push (OAI.PlanarUnitDistances.FiniteLaw.cond μ h (h p)) x)
Lean source · PlanarUnitDistances/PosteriorCut.lean, lines 102–108
theorem tau_eq (μ : Law P) (h : P → H) (x : P → A×B) :
    avg (coupling μ h) (fun pp => (if (x pp.1).1=(x pp.2).1 then 1 else 0)+
      (if (x pp.1).2=(x pp.2).2 then 1 else 0)-1)=
      avg μ (fun p => tau (push (cond μ h (h p)) x)) := by
  rw [coupling,mix_avg]
  simp_rw [tau_pair]
  exact push_avg μ h _

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PredictionCut.integrated

∀ {P : Type u_1} {H : Type u_2} {A : Type u_3} {B : Type u_4} {Ω : Type u_5} [inst : Fintype P]
  [inst_1 : Fintype H] [inst_2 : MeasurableSpace Ω] (μ : OAI.PlanarUnitDistances.FiniteLaw.Law P) (h : P → H)
  (ν : MeasureTheory.Measure Ω) (common good : Ω → Prop) (r : Ω → Bool) (l : Ω → A × B) (x : Ω → P → A × B)
  (C : ℝ),
  0 ≤ C →
    MeasureTheory.Integrable (fun a => OAI.PlanarUnitDistances.RareScore.ind (common a)) ν →
      MeasureTheory.Integrable (fun a => OAI.PlanarUnitDistances.RareScore.ind (¬common a ∧ ¬good a)) ν →
        (∀ (p : P),
            MeasureTheory.Integrable
              (fun a =>
                OAI.PlanarUnitDistances.RareScore.ind
                  (¬common a ∧ good a ∧ OAI.PlanarUnitDistances.RareScore.exceptional (r a) (l a) (x a p)))
              ν) →
          (∀ (p q : P),
              MeasureTheory.Integrable
                (fun a => OAI.PlanarUnitDistances.PredictionCut.pairScore (x a p) (x a q)) ν) →
            (∀ (p q : P),
                MeasureTheory.Integrable
                  (fun a =>
                    if common a then OAI.PlanarUnitDistances.PredictionCut.pairScore (x a p) (x a q) else 0)
                  ν) →
              (∀ (p q : P),
                  p ≠ q → ∫ (a : Ω), OAI.PlanarUnitDistances.PredictionCut.pairScore (x a p) (x a q) ∂ν ≤ C) →
                ∀ {d : ℝ},
                  0 ≤ d →
                    (∀ (p : P), μ.val p ≤ d) →
                      ∫ (a : Ω),
                          OAI.PlanarUnitDistances.FiniteLaw.avg
                            (OAI.PlanarUnitDistances.PredictionCoupling.coupling μ h) fun pp =>
                            if common a then
                              OAI.PlanarUnitDistances.PredictionCut.pairScore (x a pp.1) (x a pp.2)
                            else 0 ∂ν ≤
                        (C +
                              2 *
                                OAI.PlanarUnitDistances.FiniteLaw.avg μ fun p =>
                                  ∫ (a : Ω),
                                    OAI.PlanarUnitDistances.RareScore.ind
                                      (¬common a ∧
                                        good a ∧
                                          OAI.PlanarUnitDistances.RareScore.exceptional (r a) (l a)
                                            (x a p)) ∂ν) +
                            ∫ (a : Ω), OAI.PlanarUnitDistances.RareScore.ind (¬common a ∧ ¬good a) ∂ν +
                          (∫ (a : Ω), OAI.PlanarUnitDistances.RareScore.ind (common a) ∂ν) *
                            (↑(Fintype.card H) * d)
Lean source · PlanarUnitDistances/PosteriorCut.lean, lines 174–217
theorem integrated (μ : Law P) (h : P → H) (ν : Measure Ω)
    (common good : Ω → Prop) (r : Ω → Bool) (l : Ω → A×B) (x : Ω → P → A×B)
    (C : ℝ) (hC : 0 ≤ C)
    (_hcommon : Integrable (fun a => ind (common a)) ν)
    (hbad : Integrable (fun a => ind (¬common a ∧ ¬good a)) ν)
    (hex : ∀p,Integrable (fun a => ind (¬common a ∧ good a ∧ exceptional (r a) (l a) (x a p))) ν)
    (hfull : ∀p q,Integrable (fun a => pairScore (x a p) (x a q)) ν)
    (hcut : ∀p q,Integrable (fun a => if common a then pairScore (x a p) (x a q) else 0) ν)
    (hbound : ∀p q,p≠q → (∫a,pairScore (x a p) (x a q) ∂ν) ≤ C)
    {d : ℝ} (hd : 0 ≤ d) (hm : ∀p,μ.val p ≤ d) :
    (∫a,avg (coupling μ h) (fun pp => if common a then pairScore (x a pp.1) (x a pp.2) else 0) ∂ν) ≤
      C+2*avg μ (fun p => ∫a,ind (¬common a ∧ good a ∧ exceptional (r a) (l a) (x a p)) ∂ν)+
      (∫a,ind (¬common a ∧ ¬good a) ∂ν)+
      (∫a,ind (common a) ∂ν)*((Fintype.card H:ℝ)*d) := by
  let e := fun p => ∫a,ind (¬common a ∧ good a ∧ exceptional (r a) (l a) (x a p)) ∂ν
  let wb := ∫a,ind (¬common a ∧ ¬good a) ∂ν
  let wc := ∫a,ind (common a) ∂ν
  have he0 (p : P) : 0 ≤ e p := integral_nonneg (fun a => ind_nonneg _)
  have hw0 : 0 ≤ wb := integral_nonneg (fun a => ind_nonneg _)
  have hc0 : 0 ≤ wc := integral_nonneg (fun a => ind_nonneg _)
  rw [integral_avg (coupling μ h) _ (fun pp => hcut pp.1 pp.2)]
  have hb (p q : P) : (∫a,if common a then pairScore (x a p) (x a q) else 0 ∂ν) ≤
      C+e p+e q+wb+(if p=q then wc else 0) := by
    by_cases hpq : p=q
    · subst q
      have hh : (∫a,if common a then pairScore (x a p) (x a p) else 0 ∂ν)=wc := by
        apply integral_congr_ae
        exact Filter.Eventually.of_forall (fun a => by simp [pairScore,ind])
      rw [hh, if_pos rfl]
      linarith [he0 p]
    · rw [if_neg hpq,add_zero]
      have hh := integral_mono (hcut p q) (((hfull p q).add (hex p)).add (hex q) |>.add hbad)
        (fun a => cut_bound (common a) (good a) (r a) (l a) (x a p) (x a q))
      have hi₁ := integral_add (hfull p q) (hex p)
      have hi₂ := integral_add ((hfull p q).add (hex p)) (hex q)
      have hi₃ := integral_add (((hfull p q).add (hex p)).add (hex q)) hbad
      simp only [Pi.add_apply] at hh hi₁ hi₂ hi₃
      rw [hi₃,hi₂,hi₁] at hh
      exact hh.trans (by dsimp only [e,wb]; linarith [hbound p q hpq])
  have hh := avg_mono (coupling μ h) (fun pp => hb pp.1 pp.2)
  simp only [avg_add,avg_const,PredictionCoupling.first,PredictionCoupling.second,avg_indicator_mul] at hh
  have hdg := mul_le_mul_of_nonneg_left (PredictionCoupling.diagonal μ h hd hm) hc0
  change _ ≤ C+2*avg μ e+wb+wc*((Fintype.card H:ℝ)*d)
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLevels.common_width

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  [MeasureTheory.IsFiniteMeasure ν],
  OAI.PlanarUnitDistances.PhysicalLevels.width ν (OAI.PlanarUnitDistances.PhysicalLevels.common π) ≤
    (∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
        OAI.PlanarUnitDistances.PhysicalLevels.minority π t ∂ν) /
      PlanarUnitDistances.ComparisonConstants.dy 1800
Lean source · PlanarUnitDistances/PosteriorWidth.lean, lines 29–32
lemma common_width (π : Law (P×Q)) (ν : Measure (Record P Q)) [IsFiniteMeasure ν] :
    width ν (common π) ≤ (∫t,minority π t ∂ν)/dy 1800 :=
  width_tail ν _ (fun _ => le_min (event_nonneg ..) (sub_nonneg.mpr (event_le_one ..)))
    _ (pos _) (fun _ h => h)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLevels.bad_width

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  [MeasureTheory.IsFiniteMeasure ν],
  ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
        OAI.PlanarUnitDistances.CommonTemplate.inconsistency π t.bit t.x t.y ∂ν ≤
      4 →
    (OAI.PlanarUnitDistances.PhysicalLevels.width ν fun t =>
        ¬OAI.PlanarUnitDistances.PhysicalLevels.common π t ∧
          ¬OAI.PlanarUnitDistances.PhysicalLevels.good π t) ≤
      4 / PlanarUnitDistances.ComparisonConstants.dy 1800
Lean source · PlanarUnitDistances/PosteriorWidth.lean, lines 33–37
lemma bad_width (π : Law (P×Q)) (ν : Measure (Record P Q)) [IsFiniteMeasure ν]
    (hm : (∫t,inconsistency π t.bit t.x t.y ∂ν) ≤ 4) :
    width ν (fun t => ¬common π t ∧ ¬good π t) ≤ 4/dy 1800 :=
  (width_tail ν _ (fun _ => event_nonneg ..) _ (pos _)
    (fun _ h => (lt_of_not_ge h.2).le)).trans (div_le_div_of_nonneg_right hm (pos _).le)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 4.19 Simultaneous common comparisons on the geometric walk

Lean verified

Under the hypotheses on the coordinates and uniform incidence law in Lemma 4.16, suppose every vertex has positive degree, the profile scale is S > 2 2100 , and the largest point atom is at most θ . Put D = I ( p 1 ; p 2 ) for two independent neighbors of a common random center. Take an integer K > 0 with K ≥ 2 576000 ( D + 1 ) and ( 2 144000 ) 2 ( K − 1 ) θ ≤ 2 − 144000 . Fix shifts satisfying ∫ m ≤ 4 . There exists an observation prefix of length n < K (two independent hash values per observation, each from an alphabet of size 2 144000 ) for which

( C Q + C T ) / 6 ≤ D Q C + D T C + 16 e 0 S , C P / 6 ≤ D P C + 2 X + 17 e 0 S .

Here D i C uses only the common levels, T draws its list of 2 18000 histories at its center, and e 0 = 2 − 144 . The same prefix works for every assignment used to define the exceptional width X . All statements, including the existence of a prefix, hold when the common-level measure vanishes.

Proof

Identify the common-score law with the restriction of the geometric record law to its common levels. The integral of its inconsistency is bounded by the full integral. If this restriction is zero, both common comparisons hold with the empty prefix. Otherwise Theorem 4.12 selects one prefix for both comparisons. Its history alphabet has at most ( 2 144000 ) 2 ( K − 1 ) elements. Apply Lemma 4.18 to this fixed prefix and add its e 0 S error to the second 16 e 0 S error. The choice of prefix precedes the use of the assignment defining X .

Inspect the Lean declarations

OAI.PlanarUnitDistances.PhysicalLevels.common_posterior_scores

∀ {P : Type u_1} {Q : Type u_2} {I : Type u_3} {L : Type u_4} [inst : Fintype P] [inst_1 : Fintype Q]
  [inst_2 : Fintype I] [Nonempty I] [inst_4 : Fintype L] [Nonempty L]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  [MeasureTheory.IsFiniteMeasure ν],
  (∀ (p : P), 0 < (OAI.PlanarUnitDistances.FiniteStarCoupling.left π).val p) →
    ∀ {θ : ℝ},
      0 ≤ θ →
        (∀ (p : P), (OAI.PlanarUnitDistances.FiniteStarCoupling.left π).val p ≤ θ) →
          (∀ (p q : P),
              p ≠ q →
                ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                    OAI.PlanarUnitDistances.PredictionCut.pairScore (t.x p) (t.x q) ∂ν ≤
                  Real.log 2) →
            ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                  OAI.PlanarUnitDistances.CommonTemplate.inconsistency π t.bit t.x t.y ∂ν ≤
                4 →
              2 ^ 2100 < OAI.PlanarUnitDistances.PhysicalLevels.scale π ν →
                ∀ (K : ℕ),
                  0 < K →
                    0 ≤ OAI.PlanarUnitDistances.CommonTemplate.commonInformation π →
                      2 ^ 576000 * (OAI.PlanarUnitDistances.CommonTemplate.commonInformation π + 1) ≤ ↑K →
                        ↑(Fintype.card I) = 2 ^ 18000 →
                          (↑(Fintype.card L))⁻¹ = PlanarUnitDistances.ComparisonConstants.dy 144000 →
                            ↑(Fintype.card L) ^ (2 * (K - 1)) * θ ≤
                                PlanarUnitDistances.ComparisonConstants.dy 144000 →
                              ∃ n < K,
                                ∃ h,
                                  (∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                            OAI.PlanarUnitDistances.CommonTemplate.cvT π h
                                              t ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
                                          ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                            OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π
                                              t.bit ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν) /
                                        6 ≤
                                      ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                            OAI.PlanarUnitDistances.CommonTemplate.cdT π h
                                              t ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
                                          ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                            OAI.PlanarUnitDistances.FiniteStarCoupling.DQ π t.bit
                                              t.x ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
                                        16 *
                                          (PlanarUnitDistances.ComparisonConstants.dy 144 *
                                            OAI.PlanarUnitDistances.PhysicalLevels.scale π ν) ∧
                                    ∀ (r : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Bool)
                                      (label :
                                        OAI.PlanarUnitDistances.PhysicalLevels.Record P Q →
                                          Finset (P ⊕ Q) × Finset (P ⊕ Q)),
                                      (∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                            OAI.PlanarUnitDistances.FiniteStarCoupling.VP π
                                              t.bit ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν) /
                                          6 ≤
                                        ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                              OAI.PlanarUnitDistances.FiniteStarCoupling.DP π t.bit
                                                t.y ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
                                            2 *
                                              OAI.PlanarUnitDistances.PhysicalLevels.pointWidth π ν r label +
                                          17 *
                                            (PlanarUnitDistances.ComparisonConstants.dy 144 *
                                              OAI.PlanarUnitDistances.PhysicalLevels.scale π ν)
Lean source · PlanarUnitDistances/RecordComparison.lean, lines 24–75
/-- Simultaneous common score inequalities with the posterior term removed.
The same history and the same restricted record law occur throughout. A null
common region is allowed. The dominant rare label may be chosen arbitrarily
in this inequality, but the width X uses exactly that choice. -/
theorem common_posterior_scores (π : Law (P×Q)) (ν : Measure (Record P Q)) [IsFiniteMeasure ν]
    (hp : ∀p,0<(left π).val p) {θ : ℝ} (hθ : 0≤θ) (hpθ : ∀p,(left π).val p≤θ)
    (hpair : ∀p q : P,p≠q → (∫t,PredictionCut.pairScore (t.x p) (t.x q) ∂ν) ≤ Real.log 2)
    (hm : (∫t,inconsistency π t.bit t.x t.y ∂ν) ≤ 4) (hs : 2^2100<scale π ν)
    (K : ℕ) (hK : 0<K) (hD : 0≤commonInformation π)
    (hk : (2:ℝ)^576000*(commonInformation π+1) ≤ (K:ℝ))
    (Icard : (Fintype.card I:ℝ)=(2:ℝ)^18000) (Lcard : ((Fintype.card L:ℝ))⁻¹=dy 144000)
    (hsize : (Fintype.card L:ℝ)^(2*(K-1))*θ ≤ dy 144000) :
    ∃ n<K, ∃ h : P → FiniteInformation.History (L×L) n,
      ((∫t,cvT (I:=I) π h t ∂commonLaw π ν)+(∫t,VQ π t.bit ∂commonLaw π ν))/6 ≤
        (∫t,cdT (I:=I) π h t ∂commonLaw π ν)+(∫t,DQ π t.bit t.x ∂commonLaw π ν)+16*(dy 144*scale π ν) ∧
      ∀ (r : Record P Q → Bool) (label : Record P Q → Finset (P⊕Q)×Finset (P⊕Q)),
      (∫t,VP π t.bit ∂commonLaw π ν)/6 ≤ (∫t,DP π t.bit t.y ∂commonLaw π ν)+
        2*pointWidth π ν r label+17*(dy 144*scale π ν) := by
  have hpos : 0≤dy 144*scale π ν := mul_nonneg (pos _).le ((pow_pos (by norm_num : (0:ℝ)<2) 2100).trans hs).le
  by_cases hnull : commonLaw π ν=0
  · refine ⟨0,hK,fun _ => PUnit.unit,?_⟩
    simp only [hnull,integral_zero_measure,add_zero,zero_div,zero_add]
    constructor
    · exact mul_nonneg (by norm_num) hpos
    · intro r label
      have hx : 0≤pointWidth π ν r label := avg_nonneg _ (fun _ => integral_nonneg (fun _ => RareScore.ind_nonneg _))
      exact add_nonneg (mul_nonneg (by norm_num) hx) (mul_nonneg (by norm_num) hpos)
  letI : NeZero (commonLaw π ν) := ⟨hnull⟩
  have hm' : (∫t,inconsistency π t.bit t.x t.y ∂commonLaw π ν)≤4 :=
    (integral_mono_measure Measure.restrict_le_self (Filter.Eventually.of_forall (fun _ => event_nonneg ..))
      Integrable.of_finite).trans hm
  obtain ⟨n,hn,h,_,hA,hB⟩ := exact_common_scores (I:=I) (L:=L) π hp (commonLaw π ν)
    measureReal_univ_pos id (fun _ => measurable_of_finite _) (fun _ => measurable_of_finite _)
    (fun _ _ => measurable_of_finite _) K hK hD hk Icard Lcard hs
    ((common_mass π ν).trans_le (common_width π ν)) hm'
  have nle : n≤K-1 := by omega
  have card : (Fintype.card (FiniteInformation.History (L×L) n):ℝ) ≤ (Fintype.card L:ℝ)^(2*(K-1)) := by
    rw [FiniteInformation.history_card,Fintype.card_prod]
    push_cast
    rw [←sq,←pow_mul]
    apply pow_le_pow_right₀
    · exact_mod_cast Fintype.card_pos (α:=L)
    · omega
  refine ⟨n,hn,h,hA,?_⟩
  intro r label
  have ht := posterior_comparison π ν h r label hpair hθ hpθ
    ((mul_le_mul_of_nonneg_right card hθ).trans hsize) hm hs
  have ht' : (∫t,posteriorMoment π h t ∂commonLaw π ν)≤2*pointWidth π ν r label+dy 144*scale π ν := by
    unfold commonLaw
    rw [←integral_indicator (Set.toFinite _).measurableSet]
    exact ht
  exact remove_posterior hB ht'

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.20 A single history on the prescribed original configuration

Lean verified

For all sufficiently large t , fix any large piece P , Q , M from the incidence restriction. Use its original profile intervals and fix both coordinate grids at each infinite place. If the integral of edge inconsistency for these grids is at most four, there exists a history prefix of length n < N giving both inequalities in Theorem 4.19 on these very grids. The point inequality holds simultaneously for all assignments of the exceptional label.

Proof

The point and center degree bounds give nonempty neighborhoods. The point-marginal bound controls the largest atom, and the information bound on the fixed piece permits the stated history depth. The off-diagonal integral bound holds for every pair of grid shifts. These facts apply the common posterior comparison directly to the fixed measure. No second selection of the incidence graph or of its shifts enters the proof.

Inspect the Lean declarations

PlanarUnitDistances.UniformPhysical.common_scores_on_large_piece

∀ᶠ (t : ℝ) in Filter.atTop,
  ∀ (P Q : Finset OAI.PlanarUnitDistances.Plane) (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q),
    PlanarUnitDistances.ProofAssembly.LargePiece t P Q M →
      ∀ (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q)
        (U V : NumberField.InfinitePlace ↥M.field → ℝ × ℝ),
        let rows := PlanarUnitDistances.unitRows P Q;
        have π :=
          PlanarUnitDistances.UniformPhysical.edgeLaw rows
            (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) he ⋯;
        have R := PlanarUnitDistances.profileRadius rows M.z M.w;
        have S :=
          PlanarUnitDistances.UniformNormalization.profileScale rows
            (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) M.z (fun v => -R v) R;
        have N :=
          PlanarUnitDistances.ComparisonConstants.historyDepth (PlanarUnitDistances.unitWalkInformation P Q);
        have ν := PlanarUnitDistances.UniformPhysical.fullMeasure rows M.z M.w U V;
        ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
              OAI.PlanarUnitDistances.CommonTemplate.inconsistency π t.bit t.x t.y ∂ν ≤
            4 →
          ∃ n < N,
            ∃ h,
              (∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
                        OAI.PlanarUnitDistances.CommonTemplate.cvT π h
                          t ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
                      ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
                        OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π
                          t.bit ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν) /
                    6 ≤
                  ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
                        OAI.PlanarUnitDistances.CommonTemplate.cdT π h
                          t ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
                      ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
                        OAI.PlanarUnitDistances.FiniteStarCoupling.DQ π t.bit
                          t.x ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
                    16 * (PlanarUnitDistances.ComparisonConstants.dy 144 * S) ∧
                ∀ (r : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q → Bool)
                  (l :
                    OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q →
                      Finset (↥P ⊕ ↥Q) × Finset (↥P ⊕ ↥Q)),
                  (∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
                        OAI.PlanarUnitDistances.FiniteStarCoupling.VP π
                          t.bit ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν) /
                      6 ≤
                    ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
                          OAI.PlanarUnitDistances.FiniteStarCoupling.DP π t.bit
                            t.y ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
                        2 * OAI.PlanarUnitDistances.PhysicalLevels.pointWidth π ν r l +
                      17 * (PlanarUnitDistances.ComparisonConstants.dy 144 * S)
Lean source · PlanarUnitDistances/DenseScores.lean, lines 15–63
/-- On each original large piece, fixing the geometry and the two archimedean
shifts before choosing the history gives the simultaneous comparison estimates. -/
theorem common_scores_on_large_piece :
    ∀ᶠ t : ℝ in atTop, ∀ (P Q : Finset Plane) (M : CommonFieldModel.Model P Q),
    ProofAssembly.LargePiece t P Q M → ∀ (he : 0 < incidences P Q)
      (U V : InfinitePlace M.field → ℝ × ℝ),
    let rows := unitRows P Q
    let π := edgeLaw rows (incidences P Q) he (unitRows_total P Q)
    let R := profileRadius rows M.z M.w
    let S := profileScale rows (incidences P Q) M.z (fun v => -R v) R
    let N := historyDepth (unitWalkInformation P Q)
    let ν := fullMeasure rows M.z M.w U V
    (∫t,inconsistency π t.bit t.x t.y ∂ν)≤4 →
      ∃ n<N, ∃ h : P → FiniteInformation.History (Hashes×Hashes) n,
        ((∫t,cvT (I:=Positions) π h t ∂commonLaw π ν)+(∫t,VQ π t.bit ∂commonLaw π ν))/6 ≤
          (∫t,cdT (I:=Positions) π h t ∂commonLaw π ν)+(∫t,DQ π t.bit t.x ∂commonLaw π ν)+16*(dy 144*S) ∧
        ∀ (r : Record P Q → Bool) (l : Record P Q → Finset (P⊕Q)×Finset (P⊕Q)),
        (∫t,VP π t.bit ∂commonLaw π ν)/6 ≤ (∫t,DP π t.bit t.y ∂commonLaw π ν)+
          2*pointWidth π ν r l+17*(dy 144*S) := by
  have small := (tendsto_rpow_neg_atTop (by norm_num : (0:ℝ)<1/2)).eventually
    (eventually_le_nhds (pos 144000))
  filter_upwards [eventually_ge_atTop (1:ℝ),small] with t ht hsmall
  intro P Q M piece he U V
  obtain ⟨_,_,_,_,_,degreeP,hθ,degreeQ,_,info,scaleBig⟩ := piece
  have ht' : 0<t := zero_lt_one.trans_le ht
  let rows := unitRows P Q
  have deg (q : Plane) (hq : q∈Q) : 0<degree P q :=
    (mul_pos (by norm_num) (Real.rpow_pos_of_pos ht' _)).trans_le (degreeQ q hq).1
  have nonempty (q : Q) : (rows q).Nonempty := card_pos.mp (Nat.cast_pos.mp
    ((unitRows_center_degree P Q q).symm ▸ deg q q.prop))
  have nonempty' (p : P) : (pointCenters rows p).Nonempty := by
    have dpos : 0<degree Q p := (mul_pos (by norm_num) (Real.rpow_pos_of_pos ht' _)).trans_le (degreeP p p.prop).1
    exact card_pos.mp (Nat.cast_pos.mp ((unitRows_point_degree P Q p).symm ▸ dpos))
  have ident := unitRows_information P Q deg
  let D := unitWalkInformation P Q
  have hD : 0≤D := (twoEdgeInformation_nonneg rows nonempty he (unitRows_total P Q)).trans_eq ident.symm
  have atom (p : P) : ((pointCenters rows p).card:ℝ)/incidences P Q ≤ t^(-1:ℝ) := by
    rw [unitRows_point_degree]; exact (degreeP p p.prop).2.2.2.trans hθ
  have iD : D+1≤30600*exactGap*Real.log t := by convert info using 1 <;> ring
  have col := (history_atom ht hD iD (le_rfl : t^(-1:ℝ)≤_)).trans hsmall
  have ip : (Fintype.card Positions:ℝ)=(2:ℝ)^18000 := by simp only [Positions,Fintype.card_fin,Nat.cast_pow,Nat.cast_ofNat]
  have hp : (Fintype.card Hashes:ℝ)=(2:ℝ)^144000 := by simp only [Hashes,Fintype.card_fin,Nat.cast_pow,Nat.cast_ofNat]
  have hp' : (Fintype.card Hashes:ℝ)⁻¹=dy 144000 := congrArg Inv.inv hp
  apply graph_common_scores_at (I:=Positions) (L:=Hashes) rows (incidences P Q) he (unitRows_total P Q)
      nonempty nonempty' M.z M.w M.point_injective M.wpoint_injective
      (Real.rpow_nonneg ht'.le _) atom
      (historyDepth D) (historyDepth_pos D hD) (hD.trans_eq ident) _ ip hp' _ scaleBig U V
  · rw [←ident]; exact historyDepth_large D
  · rw [hp]; exact col

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.UniformPhysical.graph_common_scores_at

∀ {P Q I L : Type} [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : Fintype I] [Nonempty I]
  [inst_4 : Fintype L] [Nonempty L] {K : Type u_1} [inst_6 : Field K] [inst_7 : NumberField K]
  (rows : Q → Finset P) (e : ℝ) (he : 0 < e) (ht : ∑ q, ↑(rows q).card = e),
  (∀ (q : Q), (rows q).Nonempty) →
    (∀ (p : P), (PlanarUnitDistances.BoundedHeight.pointCenters rows p).Nonempty) →
      ∀ (z w : P ⊕ Q → K),
        Function.Injective (z ∘ Sum.inl) →
          Function.Injective (w ∘ Sum.inl) →
            ∀ {θ : ℝ},
              0 ≤ θ →
                (∀ (p : P), ↑(PlanarUnitDistances.BoundedHeight.pointCenters rows p).card / e ≤ θ) →
                  ∀ (N : ℕ),
                    0 < N →
                      0 ≤ PlanarUnitDistances.BoundedHeight.twoEdgeInformation rows e →
                        2 ^ 576000 * (PlanarUnitDistances.BoundedHeight.twoEdgeInformation rows e + 1) ≤ ↑N →
                          ↑(Fintype.card I) = 2 ^ 18000 →
                            (↑(Fintype.card L))⁻¹ = PlanarUnitDistances.ComparisonConstants.dy 144000 →
                              ↑(Fintype.card L) ^ (2 * (N - 1)) * θ ≤
                                  PlanarUnitDistances.ComparisonConstants.dy 144000 →
                                2 ^ 2100 <
                                    PlanarUnitDistances.UniformNormalization.profileScale rows e z
                                      (fun v => -PlanarUnitDistances.profileRadius rows z w v)
                                      (PlanarUnitDistances.profileRadius rows z w) →
                                  ∀ (U V : NumberField.InfinitePlace K → ℝ × ℝ),
                                    have π := PlanarUnitDistances.UniformPhysical.edgeLaw rows e he ht;
                                    have S :=
                                      PlanarUnitDistances.UniformNormalization.profileScale rows e z
                                        (fun v => -PlanarUnitDistances.profileRadius rows z w v)
                                        (PlanarUnitDistances.profileRadius rows z w);
                                    have ν := PlanarUnitDistances.UniformPhysical.fullMeasure rows z w U V;
                                    ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                          OAI.PlanarUnitDistances.CommonTemplate.inconsistency π t.bit t.x
                                            t.y ∂ν ≤
                                        4 →
                                      ∃ n < N,
                                        ∃ h,
                                          (∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                                    OAI.PlanarUnitDistances.CommonTemplate.cvT π h
                                                      t ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π
                                                      ν +
                                                  ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                                    OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π
                                                      t.bit ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw
                                                      π ν) /
                                                6 ≤
                                              ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                                    OAI.PlanarUnitDistances.CommonTemplate.cdT π h
                                                      t ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π
                                                      ν +
                                                  ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                                    OAI.PlanarUnitDistances.FiniteStarCoupling.DQ π t.bit
                                                      t.x ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π
                                                      ν +
                                                16 * (PlanarUnitDistances.ComparisonConstants.dy 144 * S) ∧
                                            ∀ (r : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Bool)
                                              (l :
                                                OAI.PlanarUnitDistances.PhysicalLevels.Record P Q →
                                                  Finset (P ⊕ Q) × Finset (P ⊕ Q)),
                                              (∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                                    OAI.PlanarUnitDistances.FiniteStarCoupling.VP π
                                                      t.bit ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw
                                                      π ν) /
                                                  6 ≤
                                                ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                                                      OAI.PlanarUnitDistances.FiniteStarCoupling.DP π t.bit
                                                        t.y ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw
                                                        π ν +
                                                    2 *
                                                      OAI.PlanarUnitDistances.PhysicalLevels.pointWidth π ν r
                                                        l +
                                                  17 * (PlanarUnitDistances.ComparisonConstants.dy 144 * S)
Lean source · PlanarUnitDistances/GeometricCommonScores.lean, lines 14–49
/-- For any prescribed pair of shifts whose total inconsistency is at most four,
the same finite history gives both common-level score estimates. -/
theorem graph_common_scores_at (rows : Q → Finset P) (e : ℝ) (he : 0<e) (ht : ∑q,((rows q).card:ℝ)=e)
    (hrows : ∀q,(rows q).Nonempty) (hcols : ∀p,(pointCenters rows p).Nonempty)
    (z w : P⊕Q → K) (hz : Function.Injective (z ∘ Sum.inl)) (hw : Function.Injective (w ∘ Sum.inl))
    {θ : ℝ} (hθ : 0≤θ) (hatom : ∀p,((pointCenters rows p).card:ℝ)/e≤θ)
    (N : ℕ) (hN : 0<N) (hD : 0≤twoEdgeInformation rows e)
    (hN' : (2:ℝ)^576000*(twoEdgeInformation rows e+1) ≤ (N:ℝ))
    (Icard : (Fintype.card I:ℝ)=(2:ℝ)^18000) (Lcard : ((Fintype.card L:ℝ))⁻¹=dy 144000)
    (hsize : (Fintype.card L:ℝ)^(2*(N-1))*θ≤dy 144000)
    (hS : 2^2100<profileScale rows e z (fun v => -profileRadius rows z w v) (profileRadius rows z w))
    (U V : InfinitePlace K → ℝ × ℝ) :
    let π := edgeLaw rows e he ht
    let S := profileScale rows e z (fun v => -profileRadius rows z w v) (profileRadius rows z w)
    let ν := fullMeasure rows z w U V
    (∫t,inconsistency π t.bit t.x t.y ∂ν)≤4 →
      ∃ n<N, ∃ h : P → FiniteInformation.History (L×L) n,
      ((∫t,cvT (I:=I) π h t ∂commonLaw π ν)+(∫t,VQ π t.bit ∂commonLaw π ν))/6 ≤
        (∫t,cdT (I:=I) π h t ∂commonLaw π ν)+(∫t,DQ π t.bit t.x ∂commonLaw π ν)+16*(dy 144*S) ∧
      ∀ (r : Record P Q → Bool) (l : Record P Q → Finset (P⊕Q)×Finset (P⊕Q)),
      (∫t,VP π t.bit ∂commonLaw π ν)/6 ≤ (∫t,DP π t.bit t.y ∂commonLaw π ν)+
        2*pointWidth π ν r l+17*(dy 144*S) := by
  let π := edgeLaw rows e he ht
  let R := profileRadius rows z w
  dsimp only
  intro hem
  let ν := fullMeasure rows z w U V
  have hi : commonInformation π=twoEdgeInformation rows e := edge_information rows e he ht hrows
  have hs : scale π ν=profileScale rows e z (fun v => -R v) R := full_scale rows e he ht z w _ _
  have cp (p : P) : 0<(FiniteStarCoupling.left π).val p := by
    rw [edge_left]; exact div_pos (Nat.cast_pos.mpr (card_pos.mpr (hcols p))) he
  have ca (p : P) : (FiniteStarCoupling.left π).val p≤θ := (edge_left rows e he ht p).trans_le (hatom p)
  have pair (p q : P) (hn : p≠q) := full_off_diagonal rows z w hz hw U V hn
  have joint := common_posterior_scores (I:=I) (L:=L) π ν cp hθ ca pair hem
    (hs.symm ▸ hS) N hN (hi.symm ▸ hD) (hi.symm ▸ hN') Icard Lcard hsize
  rwa [hs] at joint

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.21 Integrating the three original neighbor experiments

Lean verified

Fix the original edge law π , a finite measure on its arithmetic records and one choice of rare-level labels. In each of the three experiments, the total score equals the expectation of the integrated two-neighbor score. In the center experiment the outer expectation draws q and both neighbors have law π ( p ∣ q ) . In the point experiment it draws p and both neighbors have law π ( q ∣ p ) . In the list experiment it draws θ , then p under the law conditioned on θ , and the two neighbors are independent draws from π ( q ∣ p , θ ) .

Proof

At a common level the matching coefficient uses the probability of bit one given the chosen base, including θ in the third experiment. At a good rare level the chosen label and the base determine the exceptional contribution. At every remaining level the only summand is minus the indicator of different bits. The original edge law decides which of these three cases applies. The expectations are finite sums and hence commute with integration. Equal-neighbor pairs occur with their full probability. Removing zero-mass neighbors preserves both the conditional bit frequency and the integral on distinct pairs.

Inspect the Lean declarations

OAI.PlanarUnitDistances.PhysicalLevels.list_integrated_slots

∀ {P : Type u_1} {Q : Type u_2} {T : Type u_4} [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : Fintype T]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q)) (a : Q → OAI.PlanarUnitDistances.FiniteLaw.Law T)
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  [MeasureTheory.IsFiniteMeasure ν]
  (l : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Finset (P ⊕ Q) × Finset (P ⊕ Q)),
  (∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
        OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.TemplateCoupling.templates π a)
          fun u =>
          OAI.PlanarUnitDistances.FiniteStarCoupling.DP (OAI.PlanarUnitDistances.TemplateCoupling.slice π a u)
            t.bit t.y ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
      OAI.PlanarUnitDistances.PhysicalLevels.rareIntegral π ν
        (fun t =>
          OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.TemplateCoupling.templates π a)
            fun u =>
            OAI.PlanarUnitDistances.RareScore.pointScore
              (OAI.PlanarUnitDistances.TemplateCoupling.slice π a u)
              (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π t) (l t) t.x t.y t.bit)
        fun t =>
        OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.TemplateCoupling.templates π a)
          fun u =>
          OAI.PlanarUnitDistances.FiniteStarCoupling.VP (OAI.PlanarUnitDistances.TemplateCoupling.slice π a u)
            t.bit) =
    OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.TemplateCoupling.templates π a) fun u =>
      have ρ := OAI.PlanarUnitDistances.TemplateCoupling.slice π a u;
      OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.FiniteStarCoupling.left ρ) fun p =>
        OAI.PlanarUnitDistances.FiniteLaw.avg
          (OAI.PlanarUnitDistances.FiniteLaw.pair (OAI.PlanarUnitDistances.FiniteStarCoupling.row ρ p)
            (OAI.PlanarUnitDistances.FiniteStarCoupling.row ρ p))
          fun qr =>
          ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
            OAI.PlanarUnitDistances.PhysicalLevels.baseSlot π
              (OAI.PlanarUnitDistances.FiniteStarCoupling.row ρ p) (fun q => (p, q)) (Sum.inl p) Sum.inr l
              qr.1 qr.2 t ∂ν
Lean source · PlanarUnitDistances/AveragedBaseSlots.lean, lines 73–87
theorem list_integrated_slots (π : Law (P×Q)) (a : Q → Law T)
    (ν : Measure (Record P Q)) [IsFiniteMeasure ν] (l : Record P Q → Finset (P⊕Q)×Finset (P⊕Q)) :
    (∫t, avg (templates π a) (fun u => DP (slice π a u) t.bit t.y) ∂commonLaw π ν) +
      rareIntegral π ν (fun t => avg (templates π a) (fun u =>
        pointScore (slice π a u) (rareBit π t) (l t) t.x t.y t.bit))
        (fun t => avg (templates π a) (fun u => VP (slice π a u) t.bit)) =
    avg (templates π a) (fun u => let ρ := slice π a u
      avg (left ρ) (fun p => avg (pair (row ρ p) (row ρ p)) (fun qr =>
        ∫t, baseSlot π (row ρ p) (fun q => (p,q)) (.inl p) Sum.inr l qr.1 qr.2 t ∂ν))) := by
  rw [← integral_levelScore]
  simp_rw [← avg_levelScore]
  rw [FiniteLawIntegral.integral_avg _ _ (fun _ => Integrable.of_finite)]
  apply avg_congr; intro u
  rw [integral_levelScore]
  exact point_integrated_slots π (slice π a u) ν l

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLevels.integral_levelScore

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  [MeasureTheory.IsFiniteMeasure ν] (c g v : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → ℝ),
  ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
      OAI.PlanarUnitDistances.PhysicalLevels.levelScore π t (c t) (g t) (v t) ∂ν =
    ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
        c t ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
      OAI.PlanarUnitDistances.PhysicalLevels.rareIntegral π ν g v
Lean source · PlanarUnitDistances/RecordScorePartition.lean, lines 21–38
theorem integral_levelScore (π : Law (P×Q)) (ν : Measure (Record P Q)) [IsFiniteMeasure ν]
    (c g v : Record P Q → ℝ) :
    (∫ t, levelScore π t (c t) (g t) (v t) ∂ν) =
      (∫ t, c t ∂commonLaw π ν) + rareIntegral π ν g v := by
  let A := {t : Record P Q | common π t}
  let B := goodRare π
  let C := badRare π
  have split (t : Record P Q) : levelScore π t (c t) (g t) (v t) =
      A.indicator c t + (B.indicator g t - C.indicator v t) := by
    by_cases hc : common π t <;> by_cases hg : good π t <;>
      simp [levelScore,A,B,C,goodRare,badRare,Set.indicator,hc,hg]
  simp_rw [split]
  rw [integral_add Integrable.of_finite Integrable.of_finite,
    integral_sub Integrable.of_finite Integrable.of_finite,
    integral_indicator (Set.toFinite A).measurableSet,
    integral_indicator (Set.toFinite B).measurableSet,
    integral_indicator (Set.toFinite C).measurableSet]
  rfl

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLevels.center_integrated_slots

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  [MeasureTheory.IsFiniteMeasure ν]
  (l : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Finset (P ⊕ Q) × Finset (P ⊕ Q)),
  (∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
        OAI.PlanarUnitDistances.FiniteStarCoupling.DQ π t.bit
          t.x ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
      OAI.PlanarUnitDistances.PhysicalLevels.rareIntegral π ν
        (fun t =>
          OAI.PlanarUnitDistances.RareScore.centerScore π (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π t)
            (l t) t.x t.y t.bit)
        fun t => OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π t.bit) =
    OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.FiniteStarCoupling.right π) fun q =>
      OAI.PlanarUnitDistances.FiniteLaw.avg
        (OAI.PlanarUnitDistances.FiniteLaw.pair (OAI.PlanarUnitDistances.FiniteStarCoupling.col π q)
          (OAI.PlanarUnitDistances.FiniteStarCoupling.col π q))
        fun pr =>
        ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
          OAI.PlanarUnitDistances.PhysicalLevels.baseSlot π
            (OAI.PlanarUnitDistances.FiniteStarCoupling.col π q) (fun p => (p, q)) (Sum.inr q) Sum.inl l pr.1
            pr.2 t ∂ν
Lean source · PlanarUnitDistances/AveragedBaseSlots.lean, lines 49–59
theorem center_integrated_slots (π : Law (P×Q)) (ν : Measure (Record P Q)) [IsFiniteMeasure ν]
    (l : Record P Q → Finset (P⊕Q)×Finset (P⊕Q)) :
    (∫t, DQ π t.bit t.x ∂commonLaw π ν) +
      rareIntegral π ν (fun t => centerScore π (rareBit π t) (l t) t.x t.y t.bit) (fun t => VQ π t.bit) =
    avg (right π) (fun q => avg (pair (col π q) (col π q)) (fun pr =>
      ∫t, baseSlot π (col π q) (fun p => (p,q)) (.inr q) Sum.inl l pr.1 pr.2 t ∂ν)) := by
  rw [← integral_levelScore]
  simp_rw [← center_baseSlots π π l]
  rw [FiniteLawIntegral.integral_avg _ _ (fun _ => Integrable.of_finite)]
  apply avg_congr; intro q
  exact FiniteLawIntegral.integral_avg _ _ (fun _ => Integrable.of_finite)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLevels.point_integrated_slots

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q]
  (π ρ : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  [MeasureTheory.IsFiniteMeasure ν]
  (l : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Finset (P ⊕ Q) × Finset (P ⊕ Q)),
  (∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
        OAI.PlanarUnitDistances.FiniteStarCoupling.DP ρ t.bit
          t.y ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
      OAI.PlanarUnitDistances.PhysicalLevels.rareIntegral π ν
        (fun t =>
          OAI.PlanarUnitDistances.RareScore.pointScore ρ (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π t)
            (l t) t.x t.y t.bit)
        fun t => OAI.PlanarUnitDistances.FiniteStarCoupling.VP ρ t.bit) =
    OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.FiniteStarCoupling.left ρ) fun p =>
      OAI.PlanarUnitDistances.FiniteLaw.avg
        (OAI.PlanarUnitDistances.FiniteLaw.pair (OAI.PlanarUnitDistances.FiniteStarCoupling.row ρ p)
          (OAI.PlanarUnitDistances.FiniteStarCoupling.row ρ p))
        fun qr =>
        ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
          OAI.PlanarUnitDistances.PhysicalLevels.baseSlot π
            (OAI.PlanarUnitDistances.FiniteStarCoupling.row ρ p) (fun q => (p, q)) (Sum.inl p) Sum.inr l qr.1
            qr.2 t ∂ν
Lean source · PlanarUnitDistances/AveragedBaseSlots.lean, lines 61–71
theorem point_integrated_slots (π ρ : Law (P×Q)) (ν : Measure (Record P Q)) [IsFiniteMeasure ν]
    (l : Record P Q → Finset (P⊕Q)×Finset (P⊕Q)) :
    (∫t, DP ρ t.bit t.y ∂commonLaw π ν) +
      rareIntegral π ν (fun t => pointScore ρ (rareBit π t) (l t) t.x t.y t.bit) (fun t => VP ρ t.bit) =
    avg (left ρ) (fun p => avg (pair (row ρ p) (row ρ p)) (fun qr =>
      ∫t, baseSlot π (row ρ p) (fun q => (p,q)) (.inl p) Sum.inr l qr.1 qr.2 t ∂ν)) := by
  rw [← integral_levelScore]
  simp_rw [← point_baseSlots π ρ l]
  rw [FiniteLawIntegral.integral_avg _ _ (fun _ => Integrable.of_finite)]
  apply avg_congr; intro p
  exact FiniteLawIntegral.integral_avg _ _ (fun _ => Integrable.of_finite)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLevels.off_base_onPositive

∀ {P : Type u_1} {Q : Type u_2} {I : Type u_3} [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : Fintype I]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  (μ : OAI.PlanarUnitDistances.FiniteLaw.Law I) (edge : I → P × Q) (base : P ⊕ Q) (neighbor : I → P ⊕ Q)
  (label : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Finset (P ⊕ Q) × Finset (P ⊕ Q)),
  (PlanarUnitDistances.Flanks.offAvg (OAI.PlanarUnitDistances.FiniteLaw.onPositive μ).val fun ij =>
      ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
        OAI.PlanarUnitDistances.PhysicalLevels.baseSlot π (OAI.PlanarUnitDistances.FiniteLaw.onPositive μ)
          (fun i => edge ↑i) base (fun i => neighbor ↑i) label ij.1 ij.2 t ∂ν) =
    PlanarUnitDistances.Flanks.offAvg μ.val fun ij =>
      ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
        OAI.PlanarUnitDistances.PhysicalLevels.baseSlot π μ edge base neighbor label ij.1 ij.2 t ∂ν
Lean source · PlanarUnitDistances/SupportedBaseSlots.lean, lines 29–43
/-- The product law loses no off-diagonal contribution when its zero atoms
are removed. Both slots retain their original indices and bias. -/
theorem off_base_onPositive (π : Law (P×Q)) (ν : Measure (Record P Q))
    (μ : Law I) (edge : I → P×Q) (base : P⊕Q) (neighbor : I → P⊕Q)
    (label : Record P Q → Finset (P⊕Q)×Finset (P⊕Q)) :
    offAvg (onPositive μ).val (fun ij => ∫t,baseSlot π (onPositive μ)
        (fun i => edge i.val) base (fun i => neighbor i.val) label ij.1 ij.2 t ∂ν) =
      offAvg μ.val (fun ij => ∫t,baseSlot π μ edge base neighbor label ij.1 ij.2 t ∂ν) := by
  rw [off_avg_eq,off_avg_eq,← onPositive_pair_avg μ μ]
  apply avg_congr
  rintro ⟨i,j⟩
  by_cases e : i=j
  · simp [e]
  · have ev : i.val≠j.val := fun h => e (Subtype.ext h)
    simp only [e,ev,ite_false,base_onPositive]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.22 The integrated rare lower bounds

Lean verified

On a finite record measure ν with ∫ m ≤ 4 , for any dominant-label assignment, let J e be the integral over good rare levels of the one-edge probability of joint exception. Put X = ∫ G h P , Y = ∫ G h Q , and W b = ν ( B ) . The signed contribution of all rare levels is at least 2 ( Y − X ) − ( 4 J e + 24 + W b ) for the center experiment and at least 2 ( X − Y ) − ( 4 J e + 24 + W b ) for both point experiments. The conditional-list inequality holds for every finite center-to-list kernel, including the one from Theorem 4.19.

Proof

Apply Lemma 4.17 to each good rare record, then integrate against its restricted measure. Inconsistency is nonnegative and contributes at most 6 ∫ m ≤ 24 . On each bad record the positive term vanishes and the disagreement probability is at most one.

Inspect the Lean declarations

OAI.PlanarUnitDistances.PhysicalLevels.rare_integrals

∀ {P : Type u_1} {Q : Type u_2} {Θ : Type u_3} [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : Fintype Θ]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  [MeasureTheory.IsFiniteMeasure ν] (a : Q → OAI.PlanarUnitDistances.FiniteLaw.Law Θ)
  (r : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Bool)
  (l : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Finset (P ⊕ Q) × Finset (P ⊕ Q)),
  ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
        OAI.PlanarUnitDistances.CommonTemplate.inconsistency π t.bit t.x t.y ∂ν ≤
      4 →
    have x := fun t => OAI.PlanarUnitDistances.RareScore.pointException π (r t) (l t) t.x;
    have y := fun t => OAI.PlanarUnitDistances.RareScore.centerException π (r t) (l t) t.y;
    have j := fun t => OAI.PlanarUnitDistances.RareScore.jointException π (r t) (l t) t.x t.y;
    have X :=
      ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q) in
        OAI.PlanarUnitDistances.PhysicalLevels.goodRare π, x t ∂ν;
    have Y :=
      ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q) in
        OAI.PlanarUnitDistances.PhysicalLevels.goodRare π, y t ∂ν;
    have E :=
      4 *
            ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q) in
              OAI.PlanarUnitDistances.PhysicalLevels.goodRare π, j t ∂ν +
          24 +
        ν.real (OAI.PlanarUnitDistances.PhysicalLevels.badRare π);
    (2 * (Y - X) - E ≤
        OAI.PlanarUnitDistances.PhysicalLevels.rareIntegral π ν
          (fun t => OAI.PlanarUnitDistances.RareScore.centerScore π (r t) (l t) t.x t.y t.bit) fun t =>
          OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π t.bit) ∧
      (2 * (X - Y) - E ≤
          OAI.PlanarUnitDistances.PhysicalLevels.rareIntegral π ν
            (fun t => OAI.PlanarUnitDistances.RareScore.pointScore π (r t) (l t) t.x t.y t.bit) fun t =>
            OAI.PlanarUnitDistances.FiniteStarCoupling.VP π t.bit) ∧
        2 * (X - Y) - E ≤
          OAI.PlanarUnitDistances.PhysicalLevels.rareIntegral π ν
            (fun t =>
              OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.TemplateCoupling.templates π a)
                fun θ =>
                OAI.PlanarUnitDistances.RareScore.pointScore
                  (OAI.PlanarUnitDistances.TemplateCoupling.slice π a θ) (r t) (l t) t.x t.y t.bit)
            fun t =>
            OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.TemplateCoupling.templates π a)
              fun θ =>
              OAI.PlanarUnitDistances.FiniteStarCoupling.VP
                (OAI.PlanarUnitDistances.TemplateCoupling.slice π a θ) t.bit
Lean source · PlanarUnitDistances/RareIntegral.lean, lines 31–61
/-- The good- and bad-rare contributions of Q, P and T on a single measure.
The third contribution uses the very same list kernel at every occurrence.
Joint-exception mass J is still explicit here. -/
theorem rare_integrals (π : Law (P×Q)) (ν : Measure (Record P Q)) [IsFiniteMeasure ν]
    (a : Q → Law Θ) (r : Record P Q → Bool) (l : Record P Q → Finset (P⊕Q)×Finset (P⊕Q))
    (hm : (∫t,inconsistency π t.bit t.x t.y ∂ν)≤4) :
    let x := fun t : Record P Q => pointException π (r t) (l t) t.x
    let y := fun t : Record P Q => centerException π (r t) (l t) t.y
    let j := fun t : Record P Q => jointException π (r t) (l t) t.x t.y
    let X := ∫ t in goodRare π,x t ∂ν
    let Y := ∫ t in goodRare π,y t ∂ν
    let E := 4*(∫ t in goodRare π,j t ∂ν)+24+ν.real (badRare π)
    2*(Y-X)-E ≤ rareIntegral π ν (fun t => centerScore π (r t) (l t) t.x t.y t.bit) (fun t => VQ π t.bit) ∧
    2*(X-Y)-E ≤ rareIntegral π ν (fun t => pointScore π (r t) (l t) t.x t.y t.bit) (fun t => VP π t.bit) ∧
    2*(X-Y)-E ≤ rareIntegral π ν
      (fun t => avg (templates π a) (fun θ => pointScore (slice π a θ) (r t) (l t) t.x t.y t.bit))
      (fun t => avg (templates π a) (fun θ => VP (slice π a θ) t.bit)) := by
  let m := fun t : Record P Q => inconsistency π t.bit t.x t.y
  have hnn (t : Record P Q) : 0 ≤ m t := event_nonneg ..
  have Q := rare_int_lower π ν _ _ _ m _ _ (fun t => center_lower π (r t) (l t) t.x t.y t.bit)
    (fun t => (vq_le π t.bit).trans (by norm_num)) hnn hm
  have P := rare_int_lower π ν _ _ _ m _ _ (fun t => point_lower π (r t) (l t) t.x t.y t.bit)
    (fun t => (vp_le π t.bit).trans (by norm_num)) hnn hm
  have T := rare_int_lower π ν _ _ _ m _ _ (fun t => list_lower π a (r t) (l t) t.x t.y t.bit)
    (fun t => avg_le_const (templates π a) (fun θ => (vp_le (slice π a θ) t.bit).trans (by norm_num))) hnn hm
  dsimp only
  constructor
  · linarith only [Q]
  constructor
  · linarith only [P]
  · linarith only [T]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 4.23 A single dominant label for the edge and the two-edge walk

Lean verified

Consider the finite Euclidean incidence piece. Let ν be a finite measure on the good rare levels. A measurable finite-range record provides both coordinate labels at each vertex, the bit at each edge, and its majority bit. The consistency rule asks for a match in just the first coordinate on a bit-one edge and in just the second coordinate on a bit-zero edge. Let f ( s ) be the edge mass disagreeing with the majority bit and m ( s ) the edge mass violating that consistency rule. Assume the regularity bounds of the incidence piece at t > 0 , S ≥ 4 , ξ = t − 150 g ≤ 2 − 154 , f , m ≤ ϵ , ∫ f d ν ≤ S , and ∫ m d ν ≤ 4 .

There is a measurable finite-range choice a s of a single dominant label for the coordinate specified by the majority bit. Let F s , B s be the exceptional point and center classes. Writing e 0 = 2 − 144 , one has

\begin{align*} \mu (F_s)+\kappa (B_s)& \le 2\bigl(f(s)+m(s)\bigr),\\ J_e=\int \Pr _E(p\in F_s,\ q\in B_s)\, d\nu (s)& \le 5e_0S,\\ J_w=\int \Pr (p\in F_s,\ r\in F_s)\, d\nu (s)& \le e_0S . \end{align*}

The probability in the third line uses the same center and includes p = r .

Proof

Mismatch in the selected coordinate requires a minority or inconsistent edge. Its edge probability is at most f + m . Apply Lemma 4.2 to the actual vertex labels and the uniform edge law using counting rectangles and the two lower degree marginals. The chosen label depends only on the record, so composing with the record map preserves measurability. In particular, μ ( F s ) ≤ 4 ϵ and ∫ μ ( F s ) d ν ≤ 4 S . On each level, Lemma 4.3 gives the two-neighbor probability at most 256 μ ( F s ) max ( ( 4 ϵ ) 4 / 27 , ξ ) . Since 4 ϵ = 2 − 1798 , integration gives J w ≤ e 0 S .

For J e , write u , v for the unweighted fractions of vertices in F s , B s . The lower marginals with 27 / 50 > 1 / 2 imply u v ≤ ( u + v ) / 2 ≤ μ ( F s ) + κ ( B s ) ≤ 4 ϵ . Rectangular expansion bounds the joint edge mass by u v ( ( u v ) 2 / 25 + ξ ) . The factor ( 4 ϵ ) 2 / 25 = 2 4 / 25 e 0 is at most 9 e 0 / 8 , since 16 ≤ ( 9 / 8 ) 25 . Integrating u v now gives the bound 4 ( 9 / 8 + 2 − 10 ) e 0 S ≤ 5 e 0 S .

Inspect the Lean declarations

PlanarUnitDistances.Competition.IncidencePiece.rare_edge_and_walk

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] {L : Type u_1} [Fintype L] [Nonempty L] {Ω : Type u_2}
  [inst_4 : MeasurableSpace Ω] (ν : MeasureTheory.Measure Ω) [MeasureTheory.IsFiniteMeasure ν]
  (M : PlanarUnitDistances.Competition.IncidencePiece K) {t S : ℝ},
  PlanarUnitDistances.Competition.Regular M t →
    0 < t →
      0 ≤ S →
        t ^ (-150 * PlanarUnitDistances.Competition.savingG) ≤ 2 ^ (-154) →
          ∀
            (R :
              MeasureTheory.SimpleFunc Ω
                ((PlanarUnitDistances.Competition.Plane → L) × (PlanarUnitDistances.Competition.Plane → L))),
            (∀ (s : Ω), M.labelMismatch (R s) ≤ 2 * PlanarUnitDistances.Competition.eps) →
              ∫ (s : Ω), M.labelMismatch (R s) ∂ν ≤ 2 * S →
                ∃ a,
                  (∀ (s : Ω),
                      ((M.pointMass fun p => (R s).1 p ≠ a s) + M.centerMass fun q => (R s).2 q ≠ a s) ≤
                        2 * M.labelMismatch (R s)) ∧
                    ∫ (s : Ω), M.edgeProb fun e => (R s).1 e.1 ≠ a s ∧ (R s).2 e.2 ≠ a s ∂ν ≤
                        5 * 2 ^ (-144) * S ∧
                      ∫ (s : Ω), ∑ v, if (R s).1 ↑v.1 ≠ a s ∧ (R s).1 ↑v.2.2 ≠ a s then M.mass v else 0 ∂ν ≤
                        2 ^ (-144) * S
Lean source · PlanarUnitDistances/RareLabels.lean, lines 230–268
/-- The two coincidence estimates (cb:je-jw) hold for one measurable
dominant label on the regular incidence piece and one level measure.
Both the edge law and the two-edge path law are the actual laws of M. -/
theorem rare_edge_and_walk {Ω : Type*} [MeasurableSpace Ω] (ν : Measure Ω) [IsFiniteMeasure ν]
    (M : IncidencePiece K) {t S : ℝ} (reg : Regular M t) (ht : 0<t) (hS : 0≤S)
    (hx : t^(-150*savingG)≤(2:ℝ)^(-154:ℝ))
    (R : SimpleFunc Ω ((Plane → L)×(Plane → L)))
    (hs : ∀s,M.labelMismatch (R s)≤2*eps) (hw : (∫s,M.labelMismatch (R s) ∂ν)≤2*S) :
    ∃a : SimpleFunc Ω L, (∀s,
      M.pointMass (fun p => (R s).1 p≠a s)+M.centerMass (fun q => (R s).2 q≠a s)
        ≤ 2*M.labelMismatch (R s)) ∧
      (∫s,M.edgeProb (fun e => (R s).1 e.1≠a s ∧ (R s).2 e.2≠a s) ∂ν)
        ≤ 5*(2:ℝ)^(-144:ℝ)*S ∧
      (∫s,∑v : Triple M, if (R s).1 v.1.val≠a s ∧ (R s).1 v.2.2.val≠a s then M.mass v else 0 ∂ν)
        ≤ (2:ℝ)^(-144:ℝ)*S := by
  obtain ⟨a,ha,hwalk⟩ := dominant_rare_walk ν M reg ht hS hx R hs hw
  refine ⟨a,ha,?_,hwalk⟩
  let c := (9/8)*(2:ℝ)^(-144:ℝ)+t^(-150*savingG)
  let J (r : ((Plane → L)×(Plane → L))×L) :=
    M.edgeProb (fun e => r.1.1 e.1≠r.2 ∧ r.1.2 e.2≠r.2)
  have intJ : Integrable (fun s => J (R s,a s)) ν :=
    ((R.pair a).map J).integrable_of_isFiniteMeasure
  have intM : Integrable (fun s => M.labelMismatch (R s)) ν :=
    (R.map (labelMismatch M)).integrable_of_isFiniteMeasure
  have point (s : Ω) : J (R s,a s) ≤ (2*c)*M.labelMismatch (R s) := by
    apply (joint_exception M reg ht (fun p => (R s).1 p≠a s) (fun q => (R s).2 q≠a s)
      (2*M.labelMismatch (R s)) (ha s)
      ((mul_le_mul_of_nonneg_left (hs s) (by norm_num : (0:ℝ)≤2)).trans_eq (by ring))).trans_eq
    dsimp only [c]; ring
  have hi := integral_mono intJ (intM.const_mul (2*c)) point
  rw [integral_const_mul] at hi
  have hc : 0≤2*c := by dsimp only [c]; positivity
  have num : ((9/8)*(2:ℝ)^(-144:ℝ)+2^(-154:ℝ))*4≤5*2^(-144:ℝ) := by norm_num
  have coeff : c*4≤5*(2:ℝ)^(-144:ℝ) :=
    (mul_le_mul_of_nonneg_right (add_le_add le_rfl hx) (by norm_num : (0:ℝ)≤4)).trans num
  calc
    _ ≤ (2*c)*(2*S) := hi.trans (mul_le_mul_of_nonneg_left hw hc)
    _ = (c*4)*S := by ring
    _ ≤ _ := mul_le_mul_of_nonneg_right coeff hS

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.rare_walk

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  {t δ : ℝ},
  PlanarUnitDistances.Competition.Regular M t →
    0 < t →
      t ^ (-150 * PlanarUnitDistances.Competition.savingG) ≤ 1 →
        ∀ F ⊆ M.P,
          ∑ p ∈ F, M.mu p ≤ δ →
            δ ≤ 1 →
              (∑ v, if ↑v.1 ∈ F ∧ ↑v.2.2 ∈ F then M.mass v else 0) ≤
                (256 * ∑ p ∈ F, M.mu p) *
                  max (δ ^ (4 / 27)) (t ^ (-150 * PlanarUnitDistances.Competition.savingG))
Lean source · PlanarUnitDistances/RareWalk.lean, lines 90–129
/-- Manuscript Lemma cb:rare on the original weighted common-center walk.
The point set F, both marginals, every rectangle and both sampled endpoints
are measured on the same regular piece; repeated endpoints are included. -/
theorem rare_walk (M : IncidencePiece K) {t δ : ℝ} (reg : Regular M t) (ht : 0<t)
    (hξ : t^(-150*savingG)≤1) (F : Finset Plane) (hF : F⊆M.P)
    (hδ : (∑p∈F,M.mu p)≤δ) (hδ1 : δ≤1) :
    (∑v : Triple M, if v.1.val∈F ∧ v.2.2.val∈F then M.mass v else 0) ≤
      256*(∑p∈F,M.mu p)*max (δ^(4/27:ℝ)) (t^(-150*savingG)) := by
  let f (q : M.Q) := fiber M F q.val/M.degreeQ q.val
  let κ (q : M.Q) := M.kappa q.val
  have he : (0:ℝ)<M.E.card := (Real.rpow_pos_of_pos ht _).trans_le reg.size
  have hd (q : M.Q) : (0:ℝ)<M.degreeQ q.val :=
    (mul_pos (show 0<gamma by norm_num [gamma]) (Real.rpow_pos_of_pos ht _)).trans_le
      (reg.center_degree q q.prop).1
  have hf (q : M.Q) : f q∈Icc (0:ℝ) 1 := by
    refine ⟨div_nonneg (Nat.cast_nonneg _) (hd q).le,(div_le_one (hd q)).2 ?_⟩
    unfold fiber degreeQ
    exact_mod_cast Finset.card_le_card (filter_subset_filter (fun p => (p,q.val)∈M.E) hF)
  have weighted (q : M.Q) : κ q*f q=fiber M F q.val/M.E.card := by
    dsimp only [κ,f,kappa]
    field_simp [he.ne',(hd q).ne']
  have mean : (∑q,κ q*f q)=∑p∈F,M.mu p := by
    simp_rw [weighted]
    rw [sum_coe_sort M.Q (fun q => fiber M F q/M.E.card),←sum_div,cut_fiber,cut_all]
  rw [triple_fiber M F hF he.ne' (fun q => (hd q).ne')]
  apply rare_two_neighbors κ f _ δ (t^(-150*savingG)) (fun q => div_nonneg (hd q).le he.le) hf
    mean hδ hδ1 (Real.rpow_nonneg ht.le _) hξ
  intro G
  let B := G.map (Function.Embedding.subtype (·∈M.Q))
  have hB : B⊆M.Q := by intro q hq; obtain ⟨r,_,rfl⟩ := mem_map.mp hq; exact r.prop
  have cut : (∑q∈G,κ q*f q)=((M.E∩(F×ˢB)).card:ℝ)/M.E.card := by
    simp_rw [weighted]
    rw [←sum_div,←cut_fiber]
    simp only [B,sum_map,Function.Embedding.subtype_apply]
  have ksum : (∑q∈G,κ q)=∑q∈B,M.kappa q := by simp [B,κ]
  rw [cut,ksum]
  apply marginal_cut (by positivity) (by positivity) (Real.rpow_nonneg ht.le _)
    (marginal_sum F _ M.mu (fun p hp => (reg.point_marginal p (hF hp)).1))
    (marginal_sum B _ M.kappa (fun q hq => reg.center_marginal q (hB hq)))
  exact reg.rectangle F B hF hB

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.dominant_label

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] {L : Type u_1} [Fintype L] [Nonempty L]
  (M : PlanarUnitDistances.Competition.IncidencePiece K) {t : ℝ},
  PlanarUnitDistances.Competition.Regular M t →
    0 < t →
      t ^ (-150 * PlanarUnitDistances.Competition.savingG) ≤ 1 / 2 ^ 100 →
        ∀ (x y : PlanarUnitDistances.Competition.Plane → L),
          (M.edgeProb fun e => x e.1 ≠ y e.2) ≤ 1 / 2 ^ 52 →
            ∃ a,
              ((M.pointMass fun p => x p ≠ a) + M.centerMass fun q => y q ≠ a) ≤
                2 * M.edgeProb fun e => x e.1 ≠ y e.2
Lean source · PlanarUnitDistances/RareLabels.lean, lines 81–128
/-- The dominant class is selected from the actual labels on both sides of
the same incidence piece, using just its regularity hypotheses. -/
theorem dominant_label (M : IncidencePiece K) {t : ℝ} (reg : Regular M t) (ht : 0<t)
    (hx : t^(-150*savingG)≤1/(2:ℝ)^100) (x y : Plane → L)
    (hs : M.edgeProb (fun e => x e.1≠y e.2)≤1/(2:ℝ)^52) :
    ∃a, M.pointMass (fun p => x p≠a)+M.centerMass (fun q => y q≠a)
      ≤2*M.edgeProb (fun e => x e.1≠y e.2) := by
  have he : (0:ℝ)<M.E.card := (Real.rpow_pos_of_pos ht _).trans_le reg.size
  obtain ⟨e,hem⟩ := card_pos.mp (Nat.cast_pos.mp he)
  have hmem := mem_product.mp (M.membership hem)
  have hP : M.P.Nonempty := ⟨_,hmem.1⟩
  have hQ : M.Q.Nonempty := ⟨_,hmem.2⟩
  have rect (A B : Plane → Prop) : M.edgeProb (fun e => A e.1 ∧ B e.2) ≤
      sqrt (frac M.P A*frac M.Q B)*((sqrt (frac M.P A*frac M.Q B))^(2/25:ℝ)+t^(-150*savingG)) := by
    rw [edge_cut]
    let z := frac M.P A*frac M.Q B
    have hz : 0≤z := by dsimp [z,frac]; positivity
    have hp : (sqrt z)^(2/25:ℝ)=z^(1/25:ℝ) := by rw [sqrt_eq_rpow,←rpow_mul hz]; norm_num
    change _≤sqrt z*((sqrt z)^(2/25:ℝ)+_)
    rw [hp]
    exact reg.rectangle _ _ (filter_subset ..) (filter_subset ..)
  let u := fun a => frac M.P (fun p => x p=a)
  let v := fun a => frac M.Q (fun q => y q=a)
  have ccP (a : L) := compl_frac M.P hP (fun p => x p=a)
  have ccQ (a : L) := compl_frac M.Q hQ (fun q => y q=a)
  have lowP (A : Plane → Prop) := (low_sum M.P M.mu A (fun p hp => (reg.point_marginal p hp).1)).trans_eq (edge_left M A).symm
  have lowQ (B : Plane → Prop) := (low_sum M.Q M.kappa B reg.center_marginal).trans_eq (edge_right M B).symm
  let w := fun _ : M.E => 1/(M.E.card:ℝ)
  have diag := matching_for_edge_law w (fun e : M.E => x e.val.1) (fun e : M.E => y e.val.2)
    u v (t^(-150*savingG)) (fun _ => div_nonneg zero_le_one he.le)
    (by simp [w,nsmul_eq_mul,div_eq_mul_inv,he.ne'])
    (fun a => by dsimp [u,frac]; positivity) (fun a => by dsimp [v,frac]; positivity)
    (total_frac M.P hP x) (total_frac M.Q hQ y) (Real.rpow_nonneg ht.le _) hx
    (fun a => (label_mass M _).trans_le (rect (fun p => x p=a) (fun q => y q=a)))
    (fun a => (label_mass M (fun e => x e.1≠a ∧ y e.2≠a)).trans_le
      (by simpa only [ccP,ccQ] using rect (fun p => x p≠a) (fun q => y q≠a)))
    (fun a => (by simpa only [ccP] using lowP (fun p => x p≠a) :
      gamma*(1-u a)≤M.edgeProb (fun e => x e.1≠a)).trans_eq
        (label_mass M (fun e => x e.1≠a)).symm)
    (fun a => (by simpa only [ccQ] using lowQ (fun q => y q≠a) :
      gamma*(1-v a)≤M.edgeProb (fun e => y e.2≠a)).trans_eq
        (label_mass M (fun e => y e.2≠a)).symm)
  obtain ⟨a,ha⟩ := diag.1 ((label_mass M _).trans_le hs)
  refine ⟨a,?_⟩
  have lp := (label_mass M (fun e => x e.1≠a)).trans (edge_left M (fun p => x p≠a))
  have lq := (label_mass M (fun e => y e.2≠a)).trans (edge_right M (fun q => y q≠a))
  exact (congrArg₂ (·+·) lp.symm lq.symm).trans_le
    (ha.trans_eq (congrArg (2*·) (label_mass M (fun e => x e.1≠y e.2))))

Kernel axioms used: propext, Classical.choice, Quot.sound.

4.5 Arithmetic records on the original graph

Lemma 4.24 Identifying the two-edge atom under the full-edge condition

Lean verified

Suppose the incidence piece contains every unit edge between P and Q . Then its edge count equals incidences ( P , Q ) in the research model, and its point and center marginals equal the research degrees divided by this count. Its atom at ( p , q , r ) is ( incidences ( P , Q ) deg P ⁡ ( q ) ) − 1 when ‖ p − q ‖ = ‖ r − q ‖ = 1 , and zero otherwise. This includes p = r .

Proof

The point and center degrees count precisely the unit-distance neighbors after imposing the full-edge condition. Summing the center degrees identifies the edge count. Substitution in the two-edge weight gives the stated formula for each triple. The research convention writes the same triple as ( ( p , r ) , q ) .

Inspect the Lean declarations

PlanarUnitDistances.Competition.IncidencePiece.Research.point_marginal

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K),
  PlanarUnitDistances.Competition.IncidencePiece.Research.Full M →
    ∀ (p : ↥M.P),
      M.mu ↑p =
        OAI.PlanarUnitDistances.CircleIncidence.degree M.Q ↑p /
          OAI.PlanarUnitDistances.CircleIncidence.incidences M.P M.Q
Lean source · PlanarUnitDistances/IncidenceIdentification.lean, lines 39–41
theorem point_marginal (M : IncidencePiece K) (h : Full M) (p : M.P) :
    M.mu p=degree M.Q p/OAI.PlanarUnitDistances.CircleIncidence.incidences M.P M.Q := by
  rw [mu,point_degree M h p p.prop,edge_count M h]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.Research.Full

{K : Type} →
  [inst : Field K] → [inst_1 : NumberField K] → PlanarUnitDistances.Competition.IncidencePiece K → Prop
Lean source · PlanarUnitDistances/IncidenceIdentification.lean, lines 12–15
/-- The extra condition used in identifying the explicitly stored edge
set with the research graph is inclusion of every available unit edge. -/
def Full (M : IncidencePiece K) : Prop :=
  ∀p∈M.P,∀q∈M.Q,dist p q=1 → (p,q)∈M.E

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.Research.edge_count

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K),
  PlanarUnitDistances.Competition.IncidencePiece.Research.Full M →
    ↑M.E.card = OAI.PlanarUnitDistances.CircleIncidence.incidences M.P M.Q
Lean source · PlanarUnitDistances/IncidenceIdentification.lean, lines 34–37
theorem edge_count (M : IncidencePiece K) (h : Full M) :
    (M.E.card:ℝ)=OAI.PlanarUnitDistances.CircleIncidence.incidences M.P M.Q := by
  rw [←sum_degrees M,Nat.cast_sum]
  exact sum_congr rfl (fun q hq => center_degree M h q hq)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.Research.center_marginal

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K),
  PlanarUnitDistances.Competition.IncidencePiece.Research.Full M →
    ∀ (q : ↥M.Q),
      M.kappa ↑q =
        OAI.PlanarUnitDistances.CircleIncidence.degree M.P ↑q /
          OAI.PlanarUnitDistances.CircleIncidence.incidences M.P M.Q
Lean source · PlanarUnitDistances/IncidenceIdentification.lean, lines 43–45
theorem center_marginal (M : IncidencePiece K) (h : Full M) (q : M.Q) :
    M.kappa q=degree M.P q/OAI.PlanarUnitDistances.CircleIncidence.incidences M.P M.Q := by
  rw [kappa,center_degree M h q q.prop,edge_count M h]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.Research.atom

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K),
  PlanarUnitDistances.Competition.IncidencePiece.Research.Full M →
    ∀ (p r : ↥M.P) (q : ↥M.Q),
      M.mass (p, q, r) =
        if dist ↑p ↑q = 1 ∧ dist ↑r ↑q = 1 then
          (OAI.PlanarUnitDistances.CircleIncidence.incidences M.P M.Q *
              OAI.PlanarUnitDistances.CircleIncidence.degree M.P ↑q)⁻¹
        else 0
Lean source · PlanarUnitDistances/IncidenceIdentification.lean, lines 47–54
/-- Compare each atom, including both the diagonal and nonincident triples,
in the two index conventions, before performing any expectation. -/
theorem atom (M : IncidencePiece K) (h : Full M) (p r : M.P) (q : M.Q) :
    M.mass (p,q,r) = if dist p.val q.val=1 ∧ dist r.val q.val=1 then
      (OAI.PlanarUnitDistances.CircleIncidence.incidences M.P M.Q*degree M.P q)⁻¹ else 0 := by
  unfold mass
  have eqv (a : M.P) : (a.val,q.val)∈M.E ↔ dist a.val q.val=1 := ⟨M.unit _,h _ a.prop _ q.prop⟩
  simp only [eqv,edge_count M h,center_degree M h q q.prop,one_div]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.25 A joint grid shift with integrated error 2 2

Lean verified

At an infinite place take any finite set of reciprocal-length edge jumps with nonnegative weights of sum one. Fix a bounded interval of levels. There is one u ∈ ( 0 , 1 ) for all edges, both coordinates and both grids such that the integral on this interval of the weighted inconsistency indicator is at most 2 2 .

Proof

For a uniform u ∈ ( 0 , 1 ] , the chance that the translated floors of two real numbers differ is at most their distance. Indeed the difference of their floors always has the same sign and its expectation equals the difference of the numbers by periodicity of the fractional part. The union bound for the two axes of a square gives at most 2 times the displacement divided by the grid side. For an edge of threshold n , if 2 e − | s − n | < 1 , its long jump exceeds the diameter of a square and its inconsistency entails a mismatch in the short coordinate. At all other levels 1 itself is bounded by 2 e − | s − n | . The same exponential thus bounds the expected error at every level. Its integral on the line is 2 2 . Fubini and the finite weighted average give the bound in expectation over the single common shift. The interval endpoints have zero shift measure, so a shift in the open interval realizes it.

Inspect the Lean declarations

PlanarUnitDistances.Competition.GridRounding.one_shift

∀ {E : Type u_1} [inst : Fintype E] (p : E → ℝ),
  (∀ (e : E), 0 ≤ p e) →
    ∑ e, p e = 1 →
      ∀ (n : E → ℝ) (z z' w w' : E → ℂ),
        (∀ (e : E), ‖z e - z' e‖ = Real.exp (-n e)) →
          (∀ (e : E), ‖w e - w' e‖ = Real.exp (n e)) →
            ∀ (l h : ℝ),
              ∃ u ∈ Set.Ioo 0 1,
                ∑ e,
                    p e *
                      ∫ (s : ℝ) in Set.Icc l h,
                        PlanarUnitDistances.Competition.GridRounding.failure (n e) (z e) (z' e) (w e) (w' e) s
                          u ≤
                  2 * √2
Lean source · PlanarUnitDistances/ShiftBudget.lean, lines 41–67
/-- One shift, chosen before sampling any edge, handles every edge of the
finite weighted graph throughout the prescribed interval of levels. -/
theorem one_shift {E : Type*} [Fintype E] (p : E → ℝ) (hp : ∀e,0≤p e) (total : ∑e,p e=1)
    (n : E → ℝ) (z z' w w' : E → ℂ) (hz : ∀e,‖z e-z' e‖=exp (-(n e)))
    (hw : ∀e,‖w e-w' e‖=exp (n e)) (l h : ℝ) :
    ∃u∈Ioo (0:ℝ) 1,(∑e,p e*(∫s in Icc l h,failure (n e) (z e) (z' e) (w e) (w' e) s u))≤2*sqrt 2 := by
  let J (e : E) (u : ℝ) := ∫s in Icc l h,failure (n e) (z e) (z' e) (w e) (w' e) s u
  have jI (e : E) : Integrable (J e) shift := (joint_integrable ..).integral_prod_right
  let F (u : ℝ) := ∑e,p e*J e u
  have fI : Integrable F shift := integrable_finsetSum _ (fun e _ => (jI e).const_mul _)
  have mean : (∫u,F u ∂shift)≤2*sqrt 2 := by
    unfold F
    rw [integral_finsetSum _ (fun e _ => (jI e).const_mul _)]
    simp_rw [integral_const_mul]
    apply (sum_le_sum (fun e _ => mul_le_mul_of_nonneg_left (single_edge_average (hz e) (hw e) l h) (hp e))).trans_eq
    rw [←Finset.sum_mul,total,one_mul]
  have inside : ∀ᵐu ∂shift,u∈Ioo (0:ℝ) 1 := by
    have h1 : ∀ᵐu ∂shift,u∈Ioc (0:ℝ) 1 := ae_restrict_mem measurableSet_Ioc
    have h2 : ∀ᵐu ∂shift,u≠1 := ae_restrict_of_ae (volume.ae_ne (1:ℝ))
    filter_upwards [h1,h2] with u hu ne
    exact ⟨hu.1,lt_of_le_of_ne hu.2 ne⟩
  have pos := measure_le_integral_pos fI
  by_contra! no
  have ae : ∀ᵐu ∂shift,¬F u≤∫v,F v ∂shift :=
    inside.mono fun u hu => not_le_of_gt (mean.trans_lt (no u hu))
  have zero := ae_iff.mp ae
  exact (ne_of_gt pos) (by simpa only [not_not] using zero)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.GridRounding.separation

∀ (a b : ℝ),
  ∫ (u : ℝ),
      PlanarUnitDistances.Competition.GridRounding.splitAt a b
        u ∂PlanarUnitDistances.Competition.GridRounding.shift ≤
    |a - b|
Lean source · PlanarUnitDistances/GridRounding.lean, lines 55–70
/-- The probability that two real numbers receive different integer labels
after translating the unit grid is at most their distance. The proof
integrates the difference of floors using periodicity of fractional part. -/
theorem separation (a b : ℝ) : (∫u,splitAt a b u ∂shift) ≤ |a-b| := by
  wlog h : a≤b generalizing a b
  · have eq : splitAt a b=splitAt b a := by funext u; simp only [splitAt,eq_comm]
    rw [eq,abs_sub_comm]
    exact this b a (le_of_not_ge h)
  have mono := integral_mono (integrable_split a b)
    ((integrable_const (b-a)).sub ((frac_int b).sub (frac_int a))) (sep_le h)
  change (∫u,splitAt a b u ∂shift) ≤ ∫u, (b-a)-(Int.fract (b+u)-Int.fract (a+u)) ∂shift at mono
  have isub := integral_sub (integrable_const (μ:=shift) (b-a)) ((frac_int b).sub (frac_int a))
  dsimp only [Pi.sub_apply] at isub
  rw [isub,
    integral_sub (frac_int b) (frac_int a),frac_mean a,frac_mean b,sub_self,sub_zero,integral_const] at mono
  simpa [abs_sub_comm a b,abs_of_nonneg (sub_nonneg.mpr h)] using mono

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.GridRounding.square_separation

∀ {r : ℝ},
  0 < r →
    ∀ (z w : ℂ),
      ∫ (u : ℝ),
          PlanarUnitDistances.Competition.GridRounding.mismatch r z w
            u ∂PlanarUnitDistances.Competition.GridRounding.shift ≤
        √2 * ‖z - w‖ / r
Lean source · PlanarUnitDistances/GridRounding.lean, lines 85–104
/-- The L1 displacement of the two axes is at most √2 times the complex
distance. Independence between the coordinates of the shift is unnecessary. -/
theorem square_separation {r : ℝ} (hr : 0<r) (z w : ℂ) :
    (∫u,mismatch r z w u ∂shift) ≤ sqrt 2*‖z-w‖/r := by
  have mono := integral_mono (integrable_mismatch r z w)
    ((integrable_split (z.re/r) (w.re/r)).add (integrable_split (z.im/r) (w.im/r))) (by
      intro u
      by_cases h₁ : ⌊z.re/r+u⌋=⌊w.re/r+u⌋ <;> by_cases h₂ : ⌊z.im/r+u⌋=⌊w.im/r+u⌋ <;>
        simp [mismatch,square,splitAt,h₁,h₂])
  change _ ≤ ∫u,splitAt (z.re/r) (w.re/r) u+splitAt (z.im/r) (w.im/r) u ∂shift at mono
  rw [integral_add (integrable_split ..) (integrable_split ..)] at mono
  apply (mono.trans (add_le_add (separation ..) (separation ..))).trans
  rw [←sub_div,←sub_div,abs_div,abs_div,abs_of_pos hr,←add_div]
  apply div_le_div_of_nonneg_right _ hr.le
  have hs := sq_sqrt (by norm_num : (0:ℝ)≤2)
  have hz : ‖z-w‖^2=|z.re-w.re|^2+|z.im-w.im|^2 := by
    rw [Complex.sq_norm,Complex.normSq_apply,sq_abs,sq_abs,Complex.sub_re,Complex.sub_im]; ring
  apply (sq_le_sq₀ (add_nonneg (abs_nonneg _) (abs_nonneg _)) (mul_nonneg (sqrt_nonneg _) (norm_nonneg _))).mp
  rw [mul_pow,hs,hz]
  nlinarith only [sq_nonneg (|z.re-w.re|-|z.im-w.im|)]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.GridRounding.expected_failure

∀ {n : ℝ} {z z' w w' : ℂ},
  ‖z - z'‖ = Real.exp (-n) →
    ‖w - w'‖ = Real.exp n →
      ∀ (s : ℝ),
        ∫ (u : ℝ),
            PlanarUnitDistances.Competition.GridRounding.failure n z z' w w' s
              u ∂PlanarUnitDistances.Competition.GridRounding.shift ≤
          √2 * Real.exp (-|s - n|)
Lean source · PlanarUnitDistances/ArchShift.lean, lines 53–92
/-- For small |s−n| the exponential majorant alone dominates one. Outside
that interval the long jump cannot fit in any cell, and the event of an
inconsistent edge is just the separation of the short jump. -/
theorem expected_failure {n : ℝ} {z z' w w' : ℂ} (hz : ‖z-z'‖=exp (-n)) (hw : ‖w-w'‖=exp n) (s : ℝ) :
    (∫u,failure n z z' w w' s u ∂shift) ≤ sqrt 2*exp (-|s-n|) := by
  by_cases near : 1≤sqrt 2*exp (-|s-n|)
  · apply le_trans _ near
    have i : Integrable (failure n z z' w w' s) shift := by
      apply Integrable.of_bound (((failure_measurable ..).comp (measurable_const.prodMk measurable_id)).aestronglyMeasurable) 1
      filter_upwards [] with u
      change ‖failure n z z' w w' s u‖≤1
      rw [Real.norm_eq_abs,abs_of_nonneg (failure_bounds ..).1]
      exact (failure_bounds ..).2
    simpa using integral_mono i (integrable_const (μ:=shift) (1:ℝ)) (fun u => (failure_bounds n z z' w w' s u).2)
  have far := lt_of_not_ge near
  by_cases h : s<n
  · rw [abs_of_neg (sub_neg.mpr h),neg_neg,exp_sub] at far ⊢
    have long : sqrt 2*exp s<‖w-w'‖ := by
      rw [hw]; rw [←mul_div_assoc,div_lt_one (exp_pos n)] at far; exact far
    have eq : failure n z z' w w' s=mismatch (exp (-s)) z z' := by
      funext u
      have sep : square (exp s) w u≠square (exp s) w' u := fun eq => (not_le_of_gt long) (square_diameter (exp_pos _) eq)
      simp [failure,mismatch,h,sep]
    rw [eq]
    apply (square_separation (exp_pos _) z z').trans_eq
    rw [hz,exp_neg,exp_neg,div_eq_mul_inv,inv_inv]; ring
  · have hle : n≤s := le_of_not_gt h
    rw [abs_of_nonneg (sub_nonneg.mpr hle),neg_sub,exp_sub] at far ⊢
    have long : sqrt 2*exp (-s)<‖z-z'‖ := by
      rw [hz,exp_neg,exp_neg]
      rw [←mul_div_assoc,div_lt_one (exp_pos s)] at far
      rw [←div_eq_mul_inv,←one_div,div_lt_div_iff₀ (exp_pos s) (exp_pos n)]
      simpa using far
    have eq : failure n z z' w w' s=mismatch (exp s) w w' := by
      funext u
      have sep : square (exp (-s)) z u≠square (exp (-s)) z' u := fun eq => (not_le_of_gt long) (square_diameter (exp_pos _) eq)
      simp [failure,mismatch,h,sep]
    rw [eq]
    apply (square_separation (exp_pos _) w w').trans_eq
    rw [hw]; ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 4.26 The two rare coincidences for the original arithmetic records

Lean verified

In the incidence-piece model, assume regularity at t > 0 , ξ = t − 150 g ≤ 2 − 154 and S ≥ 4 . At every place choose any interval containing all thresholds on its original edges, and retain any finite set of finite places containing all nonzero edge thresholds. A single choice of shifts and dominant labels gives both conclusions J e ≤ 5 e 0 S , J w ≤ e 0 S of Theorem 4.23 on the actual good rare levels { f < ϵ ,   m ≤ ϵ } . The same data give the original minority integral S and inconsistency integral at most 2 2 .

Proof

Apply the rare-label inequalities to a unit point mass on a single good record, with scalar budget equal to half its mismatch mass. Select a label as a function of this complete record. For that one label the edge and walk coincidence probabilities are at most ( 5 e 0 / 2 ) ( f + m ) and ( e 0 / 2 ) ( f + m ) , respectively. Compose with the finite-range arithmetic record map at each place. Use zero off the good rare set, integrate and sum with the original weights. The total available budget is S + 2 2 ≤ 2 S .

Inspect the Lean declarations

PlanarUnitDistances.Competition.IncidencePiece.physical_rare

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  {t : ℝ},
  PlanarUnitDistances.Competition.Regular M t →
    0 < t →
      t ^ (-150 * PlanarUnitDistances.Competition.savingG) ≤ 2 ^ (-154) →
        4 ≤ M.scale →
          ∀ (F : Finset (NumberField.FinitePlace K)),
            (∀ v ∉ F, ∀ e ∈ M.E, M.threshold (⇑v) e = 0) →
              ∀ (l h : AbsoluteValue K ℝ → ℝ),
                (∀ (v : AbsoluteValue K ℝ), ∀ e ∈ M.E, l v ≤ M.threshold (⇑v) e) →
                  (∀ (v : AbsoluteValue K ℝ), ∀ e ∈ M.E, M.threshold (⇑v) e ≤ h v) →
                    ∃ u d,
                      (∀ (v : NumberField.InfinitePlace K), u v ∈ Set.Ioo 0 1) ∧
                        (∀ (r : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label),
                            M.goodRare r →
                              ((M.pointMass fun p => r.selected p ≠ d r) +
                                  M.centerMass fun q => r.selected q ≠ d r) ≤
                                2 * (M.minorityMass r + M.inconsistentMass r)) ∧
                          M.placeIntegral F l h u M.minorityMass = M.scale ∧
                            M.placeIntegral F l h u M.inconsistentMass ≤ 2 * √2 ∧
                              M.placeIntegral F l h u (M.masked fun r => M.edgeException r (d r)) ≤
                                  5 * 2 ^ (-144) * M.scale ∧
                                M.placeIntegral F l h u (M.masked fun r => M.walkException r (d r)) ≤
                                  2 ^ (-144) * M.scale
Lean source · PlanarUnitDistances/AllPlaceRare.lean, lines 43–97
/-- For any intervals containing all edge thresholds and any finite set
of finite places containing those with a nonzero edge threshold, one
set of actual archimedean shifts and one dominant-label rule have both
asserted coincidence bounds at the original scale. -/
theorem physical_rare (M : IncidencePiece K) {t : ℝ} (reg : Regular M t) (ht : 0<t)
    (hx : t^(-150*savingG)≤(2:ℝ)^(-154:ℝ)) (hS : 4≤M.scale)
    (F : Finset (FinitePlace K)) (active : ∀v∉F,∀e∈M.E,M.threshold v e=0)
    (l h : AbsoluteValue K ℝ → ℝ)
    (lo : ∀(v : AbsoluteValue K ℝ) e,e∈M.E → l v≤M.threshold v e)
    (hi : ∀(v : AbsoluteValue K ℝ) e,e∈M.E → M.threshold v e≤h v) :
    ∃ (u : InfinitePlace K → ℝ) (d : CoordinateLevel M.Label → M.Label),
      (∀v,u v∈Ioo (0:ℝ) 1) ∧ (∀r,M.goodRare r →
      M.pointMass (fun p => r.selected p≠d r)+M.centerMass (fun q => r.selected q≠d r)
       ≤2*(M.minorityMass r+M.inconsistentMass r)) ∧
      M.placeIntegral F l h u M.minorityMass=M.scale ∧
      M.placeIntegral F l h u M.inconsistentMass≤2*sqrt 2 ∧
      M.placeIntegral F l h u (M.masked fun r => M.edgeException r (d r))≤5*(2:ℝ)^(-144:ℝ)*M.scale ∧
      M.placeIntegral F l h u (M.masked fun r => M.walkException r (d r))≤(2:ℝ)^(-144:ℝ)*M.scale := by
  have he : 0<(M.E.card:ℝ) := (rpow_pos_of_pos ht _).trans_le reg.size
  choose u hu small using fun v : InfinitePlace K => arch_shift M he v (l v.val) (h v.val)
  have e0 := recordwise_rare (L:=M.Label) M reg ht hx
  obtain ⟨d,hd⟩ := e0
  have finite_zero (v : FinitePlace K) : (∫s in Icc (l v.val) (h v.val),M.inconsistentMass (finiteRecord M v s))=0 :=
    integral_eq_zero_of_ae (ae_restrict_of_ae (finite_inconsistent_ae M v))
  have bad : M.placeIntegral F l h u M.inconsistentMass≤2*sqrt 2 := by
    unfold placeIntegral
    simp_rw [finite_zero]
    simp only [sum_const_zero,add_zero]
    apply (div_le_iff₀ (Nat.cast_pos.mpr (Module.finrank_pos (R:=ℚ) (M:=K)))).mpr
    exact (sum_le_sum (fun v _ => mul_le_mul_of_nonneg_left (small v) (Nat.cast_nonneg v.mult))).trans_eq
      (by rw [←sum_mul,←Nat.cast_sum,InfinitePlace.sum_mult_eq,mul_comm])
  have av (v : InfinitePlace K) : (∫s in Icc (l v.val) (h v.val),M.minorityMass (archRecord M v (u v,u v) (u v,u v) s))=M.localWidth v := by
    simp_rw [arch_minority M he]
    exact window_width M he v _ _ (lo v.val) (hi v.val)
  have fv (v : FinitePlace K) : (∫s in Icc (l v.val) (h v.val),M.minorityMass (finiteRecord M v s))=M.localWidth v := by
    simp_rw [finite_minority M he]
    exact window_width M he v _ _ (lo v.val) (hi v.val)
  have correct : M.placeIntegral F l h u M.minorityMass=M.scale := by
    unfold placeIntegral scale
    simp_rw [av,fv]
    congr 2
    symm
    apply finsum_eq_sum_of_support_subset
    intro v hv
    by_contra hn
    exact hv (width_zero M he v (active v hn))
  have bd : M.placeIntegral F l h u M.minorityMass+M.placeIntegral F l h u M.inconsistentMass≤2*M.scale := by
    rw [correct]; nlinarith only [bad,hS,sq_sqrt (by norm_num : (0:ℝ)≤2),sq_nonneg (sqrt 2-2)]
  refine ⟨u,d,hu,fun r hr => (hd r hr).1,correct,bad,?_,?_⟩
  · have b := aggregate M F l h u (5*(2:ℝ)^(-144:ℝ)/2) (by positivity)
      (fun r => M.edgeException r (d r)) (fun r hr => (hd r hr).2.1)
    exact b.trans ((mul_le_mul_of_nonneg_left bd (by positivity)).trans_eq (by ring))
  · have b := aggregate M F l h u ((2:ℝ)^(-144:ℝ)/2) (by positivity)
      (fun r => M.walkException r (d r)) (fun r hr => (hd r hr).2.2)
    exact b.trans ((mul_le_mul_of_nonneg_left bd (by positivity)).trans_eq (by ring))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.recordwise_rare

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] {L : Type u_1} [Fintype L] [Nonempty L]
  (M : PlanarUnitDistances.Competition.IncidencePiece K) {t : ℝ},
  PlanarUnitDistances.Competition.Regular M t →
    0 < t →
      t ^ (-150 * PlanarUnitDistances.Competition.savingG) ≤ 2 ^ (-154) →
        ∃ d,
          ∀ (r : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel L),
            M.goodRare r →
              ((M.pointMass fun p => r.selected p ≠ d r) + M.centerMass fun q => r.selected q ≠ d r) ≤
                  2 * (M.minorityMass r + M.inconsistentMass r) ∧
                M.edgeException r (d r) ≤ 5 * 2 ^ (-144) / 2 * (M.minorityMass r + M.inconsistentMass r) ∧
                  M.walkException r (d r) ≤ 2 ^ (-144) / 2 * (M.minorityMass r + M.inconsistentMass r)
Lean source · PlanarUnitDistances/RecordBudget.lean, lines 18–51
/-- The selected label depends only on the complete record. The same
choice therefore works for every measure on levels and at every place. -/
theorem recordwise_rare (M : IncidencePiece K) {t : ℝ} (reg : Regular M t) (ht : 0<t)
    (hx : t^(-150*savingG)≤(2:ℝ)^(-154:ℝ)) :
    ∃ d : CoordinateLevel L → L, ∀r,M.goodRare r →
      M.pointMass (fun p => r.selected p≠d r)+M.centerMass (fun q => r.selected q≠d r)
          ≤2*(M.minorityMass r+M.inconsistentMass r) ∧
      M.edgeException r (d r) ≤ (5*(2:ℝ)^(-144:ℝ)/2)*(M.minorityMass r+M.inconsistentMass r) ∧
      M.walkException r (d r) ≤ ((2:ℝ)^(-144:ℝ)/2)*(M.minorityMass r+M.inconsistentMass r) := by
  let C (r : CoordinateLevel L) (a : L) := M.goodRare r →
    M.pointMass (fun p => r.selected p≠a)+M.centerMass (fun q => r.selected q≠a)
      ≤2*(M.minorityMass r+M.inconsistentMass r) ∧
    M.edgeException r a≤(5*(2:ℝ)^(-144:ℝ)/2)*(M.minorityMass r+M.inconsistentMass r) ∧
    M.walkException r a≤((2:ℝ)^(-144:ℝ)/2)*(M.minorityMass r+M.inconsistentMass r)
  change ∃d : CoordinateLevel L → L,∀r,C r (d r)
  apply Classical.axiomOfChoice (r:=C)
  intro r
  by_cases good : M.goodRare r
  · let ν := Measure.dirac ()
    let R : SimpleFunc Unit ((Plane → L)×(Plane → L)) := SimpleFunc.const Unit (r.selected,r.selected)
    let h := M.minorityMass r+M.inconsistentMass r
    have prob (A : Plane×Plane → Prop) : 0≤M.edgeProb A := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _)
    have h0 : 0≤h := add_nonneg (prob _) (prob _)
    have hs (s : Unit) : M.labelMismatch (R s)≤2*eps :=
      (majority_mismatch M r).trans ((add_le_add good.1.le good.2).trans_eq (two_mul eps).symm)
    have hw : (∫s,M.labelMismatch (R s) ∂ν)≤2*(h/2) := by
      rw [integral_dirac,show 2*(h/2)=h by ring]
      exact majority_mismatch M r
    obtain ⟨a,ha,he,hw'⟩ := rare_edge_and_walk ν M reg ht (div_nonneg h0 (by norm_num : (0:ℝ)≤2)) hx R hs hw
    rw [integral_dirac] at he hw'
    refine ⟨a (),fun _ => ⟨(ha ()).trans (mul_le_mul_of_nonneg_left (majority_mismatch M r) (by norm_num)),?_,?_⟩⟩
    · exact he.trans_eq (by unfold h; ring)
    · exact hw'.trans_eq (by unfold h; ring)
  · exact ⟨Classical.choice ‹Nonempty L›,fun g => (good g).elim⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.27 The local signed and unsigned errors

Lean verified

Use one coordinate record for the two edges p q , r q and one proposed dominant label. Write I x for exception from this label, σ = 1 − 2 b for the sign of the majority bit and m e for the inconsistency indicator. With U = 2 ( I p I q + I r I q + m p q + m r q ) one has

| Y p q − Y r q − σ ( I p − I r ) | ≤ U , I p + I r − 2 I p I r − U ≤ | Y p q − Y r q | .

On any interval containing the thresholds n , n ′ , the integral of the signed bit difference is n − n ′ , and that of its absolute value is | n − n ′ | . On a supported triple the logarithm of the actual ratio ( Z p − Z q ) / ( Z r − Z q ) is n r q − n p q at every place.

Proof

For a consistent edge the selected labels agree exactly when the edge bit is the majority bit. When at most one endpoint is exceptional this determines the bit. The remaining cases give | Y p q − b − σ ( I p + I q ) | ≤ 2 ( I p I q + m p q ) . Subtract the two edges through the same center to cancel σ I q . Finally | I p − I r | = I p + I r − 2 I p I r and the triangle inequality give the unsigned lower bound. The two threshold indicators are nested, so after ordering the thresholds their unsigned difference is the indicator of a half-open interval of length | n − n ′ | , including the zero-length case. The logarithm of a quotient of two nonzero edge directions subtracts the two logarithms.

Inspect the Lean declarations

PlanarUnitDistances.Competition.IncidencePiece.threshold_ratio

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (x : PlanarUnitDistances.Competition.Triple M),
  0 < M.mass x →
    ∀ (v : AbsoluteValue K ℝ),
      Real.log (v (PlanarUnitDistances.Competition.tripleRatio M x)) =
        M.threshold ⇑v (↑x.2.2, ↑x.2.1) - M.threshold ⇑v (↑x.1, ↑x.2.1)
Lean source · PlanarUnitDistances/ArithmeticBits.lean, lines 22–28
theorem threshold_ratio (M : IncidencePiece K) (x : Triple M) (hx : 0<M.mass x) (v : AbsoluteValue K ℝ) :
    Real.log (v (tripleRatio M x))=M.threshold v (x.2.2.val,x.2.1.val)-M.threshold v (x.1.val,x.2.1.val) := by
  obtain ⟨p,q⟩ := supported_edges M x hx
  have h₁ := (v.pos (left_ne_zero_of_mul_eq_one (unit_model M p))).ne'
  have h₂ := (v.pos (left_ne_zero_of_mul_eq_one (unit_model M q))).ne'
  unfold tripleRatio threshold
  rw [map_div₀,Real.log_div h₁ h₂]; ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.edge_error

∀ {L : Type u_1} (r : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel L) (a : L)
  (e : PlanarUnitDistances.Competition.Plane × PlanarUnitDistances.Competition.Plane),
  |PlanarUnitDistances.Competition.IncidencePiece.bitValue (r.bit e) -
          PlanarUnitDistances.Competition.IncidencePiece.bitValue r.majority -
        r.bitSign * (r.exceptionAt a e.1 + r.exceptionAt a e.2)| ≤
    2 * (r.exceptionAt a e.1 * r.exceptionAt a e.2 + r.errorAt e)
Lean source · PlanarUnitDistances/SignedRecord.lean, lines 19–32
/-- The rare-level comparison for one original edge. The only charged
exceptions are a simultaneous exceptional point and center, or an
inconsistent edge. The center term will cancel when subtracting edges. -/
theorem edge_error (r : CoordinateLevel L) (a : L) (e : Plane×Plane) :
    |bitValue (r.bit e)-bitValue r.majority-r.bitSign*(r.exceptionAt a e.1+r.exceptionAt a e.2)|
      ≤ 2*(r.exceptionAt a e.1*r.exceptionAt a e.2+r.errorAt e) := by
  by_cases c : r.consistent e
  · have h := equal_labels r e c
    cases hb : r.bit e <;> cases hm : r.majority <;>
      by_cases p : r.selected e.1=a <;> by_cases q : r.selected e.2=a <;>
      simp_all [bitValue,bitSign,exceptionAt,errorAt] <;> norm_num
  · cases hb : r.bit e <;> cases hm : r.majority <;>
      by_cases p : r.selected e.1=a <;> by_cases q : r.selected e.2=a <;>
      norm_num [bitValue,bitSign,exceptionAt,errorAt,hb,hm,p,q,c]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.subtract_edges

∀ {L : Type u_1} (r : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel L) (a : L)
  (p q x : PlanarUnitDistances.Competition.Plane),
  |PlanarUnitDistances.Competition.IncidencePiece.bitValue (r.bit (p, q)) -
          PlanarUnitDistances.Competition.IncidencePiece.bitValue (r.bit (x, q)) -
        r.bitSign * (r.exceptionAt a p - r.exceptionAt a x)| ≤
    r.twoEdgeError a p q x
Lean source · PlanarUnitDistances/SignedRecord.lean, lines 37–45
/-- Both incidences use exactly the same center, record, sign and label. -/
theorem subtract_edges (r : CoordinateLevel L) (a : L) (p q x : Plane) :
    |(bitValue (r.bit (p,q))-bitValue (r.bit (x,q)))-r.bitSign*(r.exceptionAt a p-r.exceptionAt a x)|
       ≤ r.twoEdgeError a p q x := by
  have hp := abs_le.mp (edge_error r a (p,q))
  have hx := abs_le.mp (edge_error r a (x,q))
  dsimp only at hp hx
  unfold twoEdgeError
  exact abs_le.mpr ⟨by linarith only [hp.1,hx.2],by linarith only [hp.2,hx.1]⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.subtract_edges_unsigned

∀ {L : Type u_1} (r : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel L) (a : L)
  (p q x : PlanarUnitDistances.Competition.Plane),
  r.exceptionAt a p + r.exceptionAt a x - 2 * r.exceptionAt a p * r.exceptionAt a x - r.twoEdgeError a p q x ≤
    |PlanarUnitDistances.Competition.IncidencePiece.bitValue (r.bit (p, q)) -
        PlanarUnitDistances.Competition.IncidencePiece.bitValue (r.bit (x, q))|
Lean source · PlanarUnitDistances/SignedRecord.lean, lines 47–64
/-- The lower estimate for the unsigned disagreement on a single level
charges an additional two units precisely when both points are exceptional. -/
theorem subtract_edges_unsigned (r : CoordinateLevel L) (a : L) (p q x : Plane) :
    r.exceptionAt a p+r.exceptionAt a x-2*r.exceptionAt a p*r.exceptionAt a x-r.twoEdgeError a p q x
    ≤ |bitValue (r.bit (p,q))-bitValue (r.bit (x,q))| := by
  have j := subtract_edges r a p q x
  let d := bitValue (r.bit (p,q))-bitValue (r.bit (x,q))
  let b := r.bitSign*(r.exceptionAt a p-r.exceptionAt a x)
  have rev : |b|≤|d|+|d-b| := by
    calc
      _ = |d+(b-d)| := by ring_nf
      _ ≤ _ := (abs_add_le ..).trans_eq (by rw [abs_sub_comm b d])
  have net : r.exceptionAt a p+r.exceptionAt a x-2*r.exceptionAt a p*r.exceptionAt a x=|b| := by
    cases hm : r.majority <;> by_cases hp : r.selected p=a <;> by_cases hx : r.selected x=a <;>
      norm_num [b,bitSign,bitValue,exceptionAt,hm,hp,hx]
  change |d-b|≤_ at j
  change _≤|d|
  linarith only [j,rev,net]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.threshold_difference

∀ {l h a b : ℝ},
  l ≤ a →
    l ≤ b →
      a ≤ h →
        b ≤ h →
          ∫ (s : ℝ) in Set.Icc l h,
                PlanarUnitDistances.Competition.IncidencePiece.thresholdBit a s -
                  PlanarUnitDistances.Competition.IncidencePiece.thresholdBit b s =
              a - b ∧
            ∫ (s : ℝ) in Set.Icc l h,
                |PlanarUnitDistances.Competition.IncidencePiece.thresholdBit a s -
                    PlanarUnitDistances.Competition.IncidencePiece.thresholdBit b s| =
              |a - b|
Lean source · PlanarUnitDistances/ThresholdInterval.lean, lines 30–43
/-- The absolute difference of the two nested threshold bits has the
absolute difference of the thresholds as its integral, including ties. -/
theorem threshold_difference {l h a b : ℝ} (la : l≤a) (lb : l≤b) (ah : a≤h) (bh : b≤h) :
    (∫s in Icc l h,thresholdBit a s-thresholdBit b s)=a-b ∧
    (∫s in Icc l h,|thresholdBit a s-thresholdBit b s|)=|a-b| := by
  rcases le_total b a with ba|ab
  · rw [abs_of_nonneg (sub_nonneg.mpr ba)]
    exact ordered_threshold lb ba ah
  · obtain ⟨sign,unsign⟩ := ordered_threshold la ab bh
    constructor
    · rw [show (fun s => thresholdBit a s-thresholdBit b s)=fun s => -(thresholdBit b s-thresholdBit a s)
        from funext fun s => (neg_sub ..).symm,integral_neg,sign,neg_sub]
    · simp_rw [abs_sub_comm (thresholdBit a _) (thresholdBit b _)]
      rw [abs_sub_comm a b,abs_of_nonneg (sub_nonneg.mpr ab)]; exact unsign

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.28 Expected rare correction on the original two-edge walk

Lean verified

At every record with one chosen label, U of Lemma 4.27 satisfies

E w a l k [ U + 2 I p I r ] = 4 Pr E ( I p I q = 1 ) + 4 m + 2 Pr w a l k ( I p I r = 1 ) .
Proof

Above a fixed first incidence, summation over the second neighbor cancels its center degree in the denominator. Thus either leg of the triple has the original uniform incidence marginal. Apply this to the two joint point-center exceptions and the two inconsistency indicators, and keep the two-point exception under the walk law.

Inspect the Lean declarations

PlanarUnitDistances.Competition.IncidencePiece.average_rare_error

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] {L : Type u_1}
  (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (r : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel L) (a : L),
  M.walkLinear (PlanarUnitDistances.Competition.IncidencePiece.rareTripleError r a) =
    4 * M.edgeException r a + 4 * M.inconsistentMass r + 2 * M.walkException r a
Lean source · PlanarUnitDistances/WalkError.lean, lines 28–58
/-- Average the local two-edge errors on the actual triple experiment.
The coefficients account for the two incident edges and the repeated
endpoint term. Both halves have the same original uniform edge law. -/
theorem average_rare_error (M : IncidencePiece K) (r : CoordinateLevel L) (a : L) :
    M.walkLinear (rareTripleError r a) =
      4*M.edgeException r a+4*M.inconsistentMass r+2*M.walkException r a := by
  let J (e : Plane×Plane) := r.selected e.1≠a ∧ r.selected e.2≠a
  let I (e : Plane×Plane) := ¬r.consistent e
  let Jp := mark (fun v : Triple M => J (v.1.val,v.2.1.val))
  let Jr := mark (fun v : Triple M => J (v.2.2.val,v.2.1.val))
  let Ip := mark (fun v : Triple M => I (v.1.val,v.2.1.val))
  let Ir := mark (fun v : Triple M => I (v.2.2.val,v.2.1.val))
  let X := mark (fun v : Triple M => r.selected v.1.val≠a ∧ r.selected v.2.2.val≠a)
  have rep : (rareTripleError r a : Triple M → ℝ)=(2:ℝ) • (Jp+Jr+Ip+Ir)+(2:ℝ) • X := by
    funext v
    by_cases hp : r.selected v.1.val=a <;> by_cases hq : r.selected v.2.1.val=a <;>
      by_cases hr : r.selected v.2.2.val=a <;> by_cases ep : r.consistent (v.1.val,v.2.1.val) <;>
      by_cases er : r.consistent (v.2.2.val,v.2.1.val) <;>
      norm_num [rareTripleError,CoordinateLevel.twoEdgeError,CoordinateLevel.exceptionAt,
        CoordinateLevel.errorAt,Jp,Jr,Ip,Ir,X,mark,J,I,hp,hq,hr,ep,er]
  have j1 : M.walkLinear Jp=M.edgeException r a := (walk_indicator M _).trans (edge_marginals M J).1
  have j2 : M.walkLinear Jr=M.edgeException r a := (walk_indicator M _).trans (edge_marginals M J).2
  have i1 : M.walkLinear Ip=M.inconsistentMass r := (walk_indicator M _).trans (edge_marginals M I).1
  have i2 : M.walkLinear Ir=M.inconsistentMass r := (walk_indicator M _).trans (edge_marginals M I).2
  have xx : M.walkLinear X=M.walkException r a := by
    rw [show M.walkLinear X=_ from walk_indicator M (fun v => r.selected v.1.val≠a ∧ r.selected v.2.2.val≠a)]
    unfold walkException
    apply sum_congr rfl; intro v _
    by_cases ex : r.selected v.1.val≠a ∧ r.selected v.2.2.val≠a <;> simp [ex]
  rw [rep,map_add,map_smul,map_smul,map_add,map_add,map_add,j1,j2,i1,i2,xx]
  simp only [smul_eq_mul]; ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.edge_marginals

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (A : PlanarUnitDistances.Competition.Plane × PlanarUnitDistances.Competition.Plane → Prop),
  (∑ v, if A (↑v.1, ↑v.2.1) then M.mass v else 0) = M.edgeProb A ∧
    (∑ v, if A (↑v.2.2, ↑v.2.1) then M.mass v else 0) = M.edgeProb A
Lean source · PlanarUnitDistances/TripleMarginal.lean, lines 9–51
/-- Integration against either incident edge of the actual two-edge
walk recovers the original *uniform* edge law. -/
theorem edge_marginals (M : IncidencePiece K) (A : Plane×Plane → Prop) :
    (∑v : Triple M,if A (v.1.val,v.2.1.val) then M.mass v else 0)=M.edgeProb A ∧
    (∑v : Triple M,if A (v.2.2.val,v.2.1.val) then M.mass v else 0)=M.edgeProb A := by
  let hit (p : M.P) (q : M.Q) : ℝ := if (p.val,q.val)∈M.E then 1 else 0
  have deg (q : M.Q) : ∑p,hit p q=(M.degreeQ q.val:ℝ) := by
    change (∑p : M.P, if (p.val,q.val)∈M.E then (1:ℝ) else 0)=_
    rw [sum_coe_sort M.P (fun p => if (p,q.val)∈M.E then (1:ℝ) else 0)]
    simp only [degreeQ,natCast_card_filter]
  let W (p : M.P) (q : M.Q) : ℝ := if (p.val,q.val)∈M.E ∧ A (p.val,q.val) then 1 else 0
  have one (p r : M.P) (q : M.Q) : (if A (p.val,q.val) then M.mass (p,q,r) else 0)=
      W p q*hit r q/((M.E.card:ℝ)*M.degreeQ q.val) := by
    by_cases h1 : (p.val,q.val)∈M.E <;> by_cases h2 : (r.val,q.val)∈M.E <;>
      by_cases ha : A (p.val,q.val) <;> simp [mass,W,hit,h1,h2,ha]
  have fiber (p : M.P) (q : M.Q) : (∑r : M.P,if A (p.val,q.val) then M.mass (p,q,r) else 0)=W p q/M.E.card := by
    simp_rw [one,←sum_div,←mul_sum,deg]
    by_cases h : (p.val,q.val)∈M.E ∧ A (p.val,q.val)
    · have hd : M.degreeQ q.val≠0 := card_ne_zero.mpr ⟨p.val,mem_filter.mpr ⟨p.prop,h.1⟩⟩
      have wone : W p q=1 := ite_eq_left h
      rw [wone,one_mul,div_mul_eq_div_div,div_right_comm,div_self (show (M.degreeQ q.val:ℝ)≠0 from Nat.cast_ne_zero.mpr hd)]
    · simp [W,h]
  have ff : (M.P×ˢM.Q).filter (fun e => e∈M.E ∧ A e)=M.E.filter A := by
    ext e; simp only [mem_filter]
    exact ⟨And.right,fun he => ⟨M.membership he.1,he⟩⟩
  have first : (∑v : Triple M,if A (v.1.val,v.2.1.val) then M.mass v else 0)=M.edgeProb A := by
    simp only [Fintype.sum_prod_type,fiber,←sum_div]
    unfold edgeProb
    apply congrArg (·/(M.E.card:ℝ))
    let f (e : Plane×Plane) : ℝ := if e∈M.E ∧ A e then 1 else 0
    have inner (p : M.P) : ∑q : M.Q,W p q=∑q∈M.Q,f (p.val,q) := by
      rw [←sum_coe_sort M.Q (fun q => f (p.val,q))]
    simp_rw [inner]
    rw [sum_coe_sort M.P (fun p => ∑q∈M.Q,f (p,q)),←sum_product (f:=f)]
    unfold f
    rw [←natCast_card_filter,ff]
  refine ⟨first,?_⟩
  let rev : Triple M ≃ Triple M := ⟨fun x => (x.2.2,x.2.1,x.1),fun x => (x.2.2,x.2.1,x.1),fun _ => rfl,fun _ => rfl⟩
  have eq := Fintype.sum_equiv rev
    (fun v : Triple M => if A (v.2.2.val,v.2.1.val) then M.mass v else 0)
    (fun v : Triple M => if A (v.1.val,v.2.1.val) then M.mass v else 0)
    (fun v => by simp only [rev]; by_cases hh : A (v.2.2.val,v.2.1.val) <;> simp [hh,mass,and_comm])
  exact eq.trans first

Kernel axioms used: propext, Classical.choice, Quot.sound.

4.6 Integrating the endpoint errors

Lemma 4.29 Both endpoint inequalities on one place interval

Lean verified

Suppose a measurable finite-range coordinate record on an interval contains the threshold bits for two edges of the tested triple and both thresholds n , n ′ belong to the interval. Write W v for the sum of the two good-rare point widths and A v for the difference of the two signed point widths on the interval. Integrate U + 2 I p I r on the good rare region, the absolute bit disagreement on the common region, and 1 on the bad region to obtain Z v . Then

| n − n ′ − A v | ≤ Z v , W v − Z v ≤ | n − n ′ | ≤ W v + Z v .
Proof

On good rare levels use the pointwise inequalities and | I p − I r | ≤ I p + I r . On a common level charge the bit disagreement; on a bad level it is bounded by one. Integrate on the interval. Nested thresholds identify the signed and unsigned integrals with n − n ′ and | n − n ′ | .

Inspect the Lean declarations

PlanarUnitDistances.Competition.IncidencePiece.local_endpoint

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label)
  (v : PlanarUnitDistances.Competition.Triple M)
  (R : MeasureTheory.SimpleFunc ℝ (PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label))
  (l h n n' : ℝ),
  l ≤ n →
    l ≤ n' →
      n ≤ h →
        n' ≤ h →
          (∀ (s : ℝ),
              M.bitDifference v (R s) =
                PlanarUnitDistances.Competition.IncidencePiece.thresholdBit n s -
                  PlanarUnitDistances.Competition.IncidencePiece.thresholdBit n' s) →
            have T := PlanarUnitDistances.Competition.IncidencePiece.recordIntegral R l h;
            have w := T (M.endpointWidth d ↑v.1) + T (M.endpointWidth d ↑v.2.2);
            have a := T (M.endpointSigned d ↑v.1) - T (M.endpointSigned d ↑v.2.2);
            have z := T (M.recordError d v);
            |n - n' - a| ≤ z ∧ w - z ≤ |n - n'| ∧ |n - n'| ≤ w + z
Lean source · PlanarUnitDistances/LocalEndpoint.lean, lines 72–104
/-- Signed and two-sided unsigned comparisons on a whole interval for
an actual record map with the two prescribed original threshold bits. -/
theorem local_endpoint (M : IncidencePiece K) (d : CoordinateLevel M.Label→M.Label)
    (v : Triple M) (R : SimpleFunc ℝ (CoordinateLevel M.Label)) (l h n n' : ℝ)
    (ln : l≤n) (ln' : l≤n') (nh : n≤h) (nh' : n'≤h)
    (bits : ∀s,M.bitDifference v (R s)=thresholdBit n s-thresholdBit n' s) :
    let T := recordIntegral R l h
    let w := T (M.endpointWidth d v.1.val)+T (M.endpointWidth d v.2.2.val)
    let a := T (M.endpointSigned d v.1.val)-T (M.endpointSigned d v.2.2.val)
    let z := T (M.recordError d v)
    |(n-n')-a|≤z ∧ w-z≤|n-n'| ∧ |n-n'|≤w+z := by
  let T := recordIntegral R l h
  let A := M.endpointSigned d v.1.val-M.endpointSigned d v.2.2.val
  let W := M.endpointWidth d v.1.val+M.endpointWidth d v.2.2.val
  let B := M.bitDifference v
  let N (r : CoordinateLevel M.Label) := |B r|
  let E := M.recordError d v
  have mono {f g : CoordinateLevel M.Label→ℝ} (hfg : ∀r,f r≤g r) : T f≤T g :=
    integral_mono (R.map f).integrable_of_isFiniteMeasure (R.map g).integrable_of_isFiniteMeasure (fun s => hfg _)
  have point (r : CoordinateLevel M.Label) := recordError_comparison M d v r
  have sl : T (-E)≤T (B-A) := mono (fun r => (abs_le.mp (point r).1).1)
  have sr : T (B-A)≤T E := mono (fun r => (abs_le.mp (point r).1).2)
  have ul : T (W-E)≤T N := mono (fun r => (point r).2.1)
  have ur : T N≤T (W+E) := mono (fun r => (point r).2.2)
  have th := threshold_difference ln ln' nh nh'
  have tb : T B=n-n' := by
    change (∫s in Icc l h,M.bitDifference v (R s))=n-n'
    simp_rw [bits]; exact th.1
  have tn : T N=|n-n'| := by
    change (∫s in Icc l h,|M.bitDifference v (R s)|)=|n-n'|
    simp_rw [bits]; exact th.2
  simp only [map_neg,map_sub,tn,tb,map_add,A,W] at sl sr ul ur
  exact ⟨abs_le.mpr ⟨sl,sr⟩,ul,ur⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.endpointWidth

{K : Type} →
  [inst : Field K] →
    [inst_1 : NumberField K] →
      (M : PlanarUnitDistances.Competition.IncidencePiece K) →
        (PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label) →
          PlanarUnitDistances.Competition.Plane →
            PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → ℝ
Lean source · PlanarUnitDistances/LocalEndpoint.lean, lines 11–12
def endpointWidth (M : IncidencePiece K) (d : CoordinateLevel M.Label→M.Label) (p : Plane) :=
  M.masked fun r => r.exceptionAt (d r) p

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.endpointSigned

{K : Type} →
  [inst : Field K] →
    [inst_1 : NumberField K] →
      (M : PlanarUnitDistances.Competition.IncidencePiece K) →
        (PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label) →
          PlanarUnitDistances.Competition.Plane →
            PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → ℝ
Lean source · PlanarUnitDistances/LocalEndpoint.lean, lines 14–15
def endpointSigned (M : IncidencePiece K) (d : CoordinateLevel M.Label→M.Label) (p : Plane) :=
  M.masked fun r => r.bitSign*r.exceptionAt (d r) p

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.recordError

{K : Type} →
  [inst : Field K] →
    [inst_1 : NumberField K] →
      (M : PlanarUnitDistances.Competition.IncidencePiece K) →
        (PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label) →
          PlanarUnitDistances.Competition.Triple M →
            PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → ℝ
Lean source · PlanarUnitDistances/ErrorRecord.lean, lines 19–24
/-- This is the manuscript's Z integrand at one record for the two
actual incidences. Its three summands are the good rare error (including
the double-exception correction), common disagreement and bad width. -/
def recordError (M : IncidencePiece K) (d : CoordinateLevel M.Label → M.Label)
    (v : Triple M) (r : CoordinateLevel M.Label) :=
  M.masked (fun j => rareTripleError j (d j) v) r+M.commonBitError r v+M.badWidth r

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.recordError_comparison

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label)
  (v : PlanarUnitDistances.Competition.Triple M)
  (r : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label),
  have p := ↑v.1;
  have x := ↑v.2.2;
  have w := M.endpointWidth d p r + M.endpointWidth d x r;
  have b := M.bitDifference v r;
  have err := M.recordError d v r;
  |b - (M.endpointSigned d p r - M.endpointSigned d x r)| ≤ err ∧ w - err ≤ |b| ∧ |b| ≤ w + err
Lean source · PlanarUnitDistances/LocalEndpoint.lean, lines 20–70
theorem recordError_comparison (M : IncidencePiece K) (d : CoordinateLevel M.Label → M.Label)
    (v : Triple M) (r : CoordinateLevel M.Label) :
    let p := v.1.val
    let x := v.2.2.val
    let w := M.endpointWidth d p r+M.endpointWidth d x r
    let b := M.bitDifference v r
    let err := M.recordError d v r
    |b-(M.endpointSigned d p r-M.endpointSigned d x r)|≤err ∧
    w-err≤|b| ∧ |b|≤w+err := by
  dsimp only
  let p := v.1.val
  let q := v.2.1.val
  let x := v.2.2.val
  let a := d r
  let u := r.twoEdgeError a p q x
  let ip := r.exceptionAt a p
  let ix := r.exceptionAt a x
  let b := M.bitDifference v r
  have ip0 : 0 ≤ ip := by dsimp [ip,CoordinateLevel.exceptionAt]; split <;> norm_num
  have ix0 : 0 ≤ ix := by dsimp [ix,CoordinateLevel.exceptionAt]; split <;> norm_num
  have corr : 0≤2*ip*ix := mul_nonneg (mul_nonneg (by norm_num) ip0) ix0
  have sg : |r.bitSign|=1 := by cases hm : r.majority <;> norm_num [CoordinateLevel.bitSign,bitValue,hm]
  have sc : |r.bitSign*(ip-ix)| ≤ ip+ix := by
    rw [abs_mul,sg,one_mul]; exact abs_le.mpr ⟨by linarith,by linarith⟩
  have sign := subtract_edges r a p q x
  change |b-r.bitSign*(ip-ix)|≤u at sign
  have unsign := subtract_edges_unsigned r a p q x
  change ip+ix-2*ip*ix-u≤|b| at unsign
  have large : |b| ≤ ip+ix+u := by
    calc
      _ = |(b-r.bitSign*(ip-ix))+r.bitSign*(ip-ix)| := by rw [sub_add_cancel]
      _ ≤ _ := (abs_add_le ..).trans ((add_le_add sign sc).trans_eq (add_comm ..))
  have sm : |b|≤1 := by
    dsimp [b,bitDifference,bitValue]; split <;> split <;> norm_num
  by_cases hg : M.goodRare r
  · have hc := not_le_of_gt hg.1
    have hm := not_lt_of_ge hg.2
    simp only [recordError,endpointWidth,endpointSigned,masked,hg,ite_true,commonBitError,hc,ite_false,
      badWidth,hm,and_false,rareTripleError,add_zero]
    change |b-(r.bitSign*ip-r.bitSign*ix)|≤u+2*ip*ix ∧
      ip+ix-(u+2*ip*ix)≤|b| ∧ |b| ≤ ip+ix+(u+2*ip*ix)
    rw [←mul_sub]
    exact ⟨sign.trans (le_add_of_nonneg_right corr),by linarith only [unsign],by linarith only [large,corr]⟩
  · by_cases hc : eps≤M.minorityMass r
    · have hf := not_lt_of_ge hc
      simp [recordError,endpointWidth,endpointSigned,masked,hg,commonBitError,hc,badWidth,hf,bitDifference]
    · have f := lt_of_not_ge hc
      have m : eps<M.inconsistentMass r := lt_of_not_ge (fun hm => hg ⟨f,hm⟩)
      simp only [recordError,endpointWidth,endpointSigned,masked,hg,ite_false,commonBitError,hc,
        badWidth,f,m,and_self,ite_true,zero_add,sub_zero,add_zero]
      exact ⟨sm,by linarith only [abs_nonneg b],sm⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.30 Common disagreement on the original walk

Lean verified

Take the original uniform incidence law, with positive total incidence and positive degree at each center. At a fixed level let b ( p , q ) be its edge bit and f q the conditional probability of bit one at center q . On the common levels the expected disagreement for two neighbors of the same center is

∑ q κ ( q ) 2 f q ( 1 − f q ) .

The common-level contribution is zero at every other level.

Proof

The mass at ( p , q , r ) is κ ( q ) Pr ( p ∣ q ) Pr ( r ∣ q ) , including when r = p . Summing the events with opposite bits gives the two products f q ( 1 − f q ) and ( 1 − f q ) f q . Shifting the coordinate partitions changes neither bit on any incident edge. The uniform minority mass therefore selects the same common levels.

Inspect the Lean declarations

PlanarUnitDistances.ResearchPhysical.common_disagreement_eq

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
  (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q),
  (∀ (q : ↥Q), 0 < OAI.PlanarUnitDistances.CircleIncidence.degree P ↑q) →
    ∀
      (b :
        PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel
          (PlanarUnitDistances.ResearchPhysical.toPiece M).Label),
      (PlanarUnitDistances.ResearchPhysical.toPiece M).commonDisagreement b =
        if
            PlanarUnitDistances.Competition.eps ≤
              (PlanarUnitDistances.ResearchPhysical.toPiece M).minorityMass b then
          OAI.PlanarUnitDistances.FiniteStarCoupling.VQ
            (PlanarUnitDistances.ResearchPhysical.incidenceLaw P Q he) fun p q => b.bit (↑p, ↑q)
        else 0
Lean source · PlanarUnitDistances/ResearchCommonDisagreement.lean, lines 47–77
/-- At a common level the physical disagreement is exactly the conditional
variation used in the posterior estimates on the original edge law. -/
theorem common_disagreement_eq (M : Model P Q) (he : 0 < incidences P Q)
    (hq : ∀ q : Q, 0 < degree P q)
    (b : Competition.IncidencePiece.CoordinateLevel (toPiece M).Label) :
    (toPiece M).commonDisagreement b =
      if Competition.eps ≤ (toPiece M).minorityMass b then
        VQ (incidenceLaw P Q he) (fun p q => b.bit (p.val,q.val)) else 0 := by
  let π := incidenceLaw P Q he
  unfold Competition.IncidencePiece.commonDisagreement Competition.IncidencePiece.walkLinear
  simp only [LinearMap.coe_mk,AddHom.coe_mk]
  by_cases hc : Competition.eps ≤ (toPiece M).minorityMass b
  · simp only [hc,ite_true,Competition.IncidencePiece.commonBitError]
    unfold VQ avg
    simp_rw [←mismatch]
    simp only [event,avg,pair,Fintype.sum_prod_type,mul_sum]
    rw [Finset.sum_comm]
    apply Finset.sum_congr rfl
    intro q _
    apply Finset.sum_congr rfl
    intro p _
    apply Finset.sum_congr rfl
    intro r _
    rw [atom_at_center M he q (hq q) p r]
    have bit_abs (a c : Bool) :
        |Competition.IncidencePiece.bitValue a-Competition.IncidencePiece.bitValue c| =
          if a≠c then (1 : ℝ) else 0 := by
      cases a <;> cases c <;> norm_num [Competition.IncidencePiece.bitValue]
    simp only [bit_abs,mul_assoc]
    split_ifs <;> first | rfl | contradiction
  · simp [Competition.IncidencePiece.commonBitError,hc]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.atom_at_center

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
  (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) (q : ↥Q),
  0 < OAI.PlanarUnitDistances.CircleIncidence.degree P ↑q →
    ∀ (p r : ↥P),
      have π := PlanarUnitDistances.ResearchPhysical.incidenceLaw P Q he;
      (PlanarUnitDistances.ResearchPhysical.toPiece M).mass (p, q, r) =
        (OAI.PlanarUnitDistances.FiniteStarCoupling.right π).val q *
          ((OAI.PlanarUnitDistances.FiniteStarCoupling.col π q).val p *
            (OAI.PlanarUnitDistances.FiniteStarCoupling.col π q).val r)
Lean source · PlanarUnitDistances/ResearchCommonDisagreement.lean, lines 27–45
/-- The probability of each physical triple factors into the actual center
marginal and its two posterior neighbor probabilities, including repeated points. -/
theorem atom_at_center (M : Model P Q) (he : 0 < incidences P Q)
    (q : Q) (hq : 0 < degree P q) (p r : P) :
    let π := incidenceLaw P Q he
    (toPiece M).mass (p,q,r) = (right π).val q * ((col π q).val p * (col π q).val r) := by
  let π := incidenceLaw P Q he
  have right_eq : (right π).val q = degree P q / incidences P Q := by
    rw [edge_right]; simp only [centerLaw,unitRows_center_degree]
  have pos := right_eq.symm ▸ div_pos hq he
  change _ = (right π).val q * ((col π q).val p * (col π q).val r)
  rw [col_val π pos p,col_val π pos r,right_eq]
  apply (Competition.IncidencePiece.Research.atom (toPiece M) (full M) p r q).trans
  change (if dist p.val q.val=1 ∧ dist r.val q.val=1 then
    (incidences P Q * degree P q)⁻¹ else 0) = _ * ((weight (unitRows P Q) (incidences P Q) p q / _) *
                                                    (weight (unitRows P Q) (incidences P Q) r q / _))
  have mem (x : P) : x ∈ unitRows P Q q ↔ dist x.val q.val=1 := by simp [unitRows,unitNeighbors]
  by_cases hp : dist p.val q.val=1 <;> by_cases hr : dist r.val q.val=1 <;>
    simp [weight,mem,hp,hr,div_eq_mul_inv] <;> field_simp [he.ne',hq.ne']

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.31 The two integrals defining common disagreement

Lean verified

Fix the original sets P , Q , field coordinates, and uniform law π on their unit incidences. Assume that there is at least one incidence and that every center has positive degree. Choose any finite set of finite places and real integration intervals at these places and at all infinite places. Form the measure ν by sending each weighted level to its record of bits and coordinate labels. Then the contribution C Q of common levels to disagreement in the original walk satisfies

C Q = ∫ C V Q ( π , b t ) d ν ( t ) .

The equality allows the two integrals to use different archimedean grid shifts. In particular it holds for the original symmetric intervals and the finite places selected by the profile radius.

Proof

At each place v and level s , the bit on an incident pair is the indicator of s < − log ⁡ | z p − z q | v in both descriptions. Pairs outside the incidence set have zero mass. Consequently the edge frequencies agree, the two descriptions select precisely the same common levels, and the conditional frequency agrees at each center. Lemma 4.30 now identifies the integrands. Integrating that identity with the field-degree weights gives the formula, including at a threshold where the strict inequality is false. The comparison on this same measure is used in Theorem 4.51.

Inspect the Lean declarations

PlanarUnitDistances.ResearchPhysical.common_integral_eq

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
  (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q),
  (∀ (q : ↥Q), 0 < OAI.PlanarUnitDistances.CircleIncidence.degree P ↑q) →
    ∀ (u : NumberField.InfinitePlace ↥M.field → ℝ) (U V : NumberField.InfinitePlace ↥M.field → ℝ × ℝ),
      have rows := PlanarUnitDistances.unitRows P Q;
      have r := PlanarUnitDistances.profileRadius rows M.z M.w;
      have π := PlanarUnitDistances.ResearchPhysical.incidenceLaw P Q he;
      (PlanarUnitDistances.ResearchPhysical.toPiece M).placeIntegral
          (PlanarUnitDistances.UniformPhysical.primes rows M.z M.w) (fun v => -r v) r u
          (PlanarUnitDistances.ResearchPhysical.toPiece M).commonDisagreement =
        ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
          OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π
            t.bit ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π
            (PlanarUnitDistances.UniformPhysical.fullMeasure rows M.z M.w U V)
Lean source · PlanarUnitDistances/ResearchCommonMeasure.lean, lines 115–125
/-- In particular the original common-center walk uses the posterior comparison
on its own support and its own symmetric profile intervals. -/
theorem common_integral_eq (M : Model P Q) (he : 0 < incidences P Q)
    (hq : ∀ q : Q, 0 < degree P q) (u : InfinitePlace M.field → ℝ)
    (U V : InfinitePlace M.field → ℝ × ℝ) :
    let rows := unitRows P Q
    let r := profileRadius rows M.z M.w
    let π := incidenceLaw P Q he
    (toPiece M).placeIntegral (primes rows M.z M.w) (fun v => -r v) r u (toPiece M).commonDisagreement =
      ∫ t, VQ π t.bit ∂commonLaw π (fullMeasure rows M.z M.w U V) :=
  common_integral_on_windows_eq M he hq _ _ _ u U V

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.common_integral_on_windows_eq

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
  (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q),
  (∀ (q : ↥Q), 0 < OAI.PlanarUnitDistances.CircleIncidence.degree P ↑q) →
    ∀ (F : Finset (NumberField.FinitePlace ↥M.field)) (l h : AbsoluteValue ↥M.field ℝ → ℝ)
      (u : NumberField.InfinitePlace ↥M.field → ℝ) (U V : NumberField.InfinitePlace ↥M.field → ℝ × ℝ),
      have π := PlanarUnitDistances.ResearchPhysical.incidenceLaw P Q he;
      (PlanarUnitDistances.ResearchPhysical.toPiece M).placeIntegral F l h u
          (PlanarUnitDistances.ResearchPhysical.toPiece M).commonDisagreement =
        ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
          OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π
            t.bit ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π
            (OAI.PlanarUnitDistances.PhysicalLevels.measure F M.z M.w U V (fun v => l ↑v) (fun v => h ↑v)
              (fun v => l ↑v) fun v => h ↑v)
Lean source · PlanarUnitDistances/ResearchCommonMeasure.lean, lines 84–113
/-- The posterior integral and the physical error budget integrate exactly the same
common disagreement. The two archimedean shifts in the posterior are arbitrary. -/
theorem common_integral_on_windows_eq (M : Model P Q) (he : 0 < incidences P Q)
    (hq : ∀ q : Q, 0 < degree P q) (F : Finset (FinitePlace M.field))
    (l h : AbsoluteValue M.field ℝ → ℝ) (u : InfinitePlace M.field → ℝ)
    (U V : InfinitePlace M.field → ℝ × ℝ) :
    let π := incidenceLaw P Q he
    (toPiece M).placeIntegral F l h u (toPiece M).commonDisagreement =
      ∫ t, VQ π t.bit ∂commonLaw π (PhysicalLevels.measure F M.z M.w U V
        (fun v => l v.1) (fun v => h v.1) (fun v => l v.1) (fun v => h v.1)) := by
  let π := incidenceLaw P Q he
  let mask (t : Record P Q) := if PhysicalLevels.common π t then VQ π t.bit else 0
  have ep : 0 < ((toPiece M).E.card : ℝ) := by rwa [Research.edge_count _ (full M)]
  have a (v : InfinitePlace M.field) (s : ℝ) :
      (toPiece M).commonDisagreement ((toPiece M).archRecord v (u v,u v) (u v,u v) s) =
      mask (arch v (U v) (V v) M.z M.w s) :=
    common_level M he hq v.1 s _ _ (arch_minority _ ep v _ _ s)
      (arch_bit _ v _ _ s) (fun _ _ => rfl)
  have f (v : FinitePlace M.field) (s : ℝ) :
      (toPiece M).commonDisagreement ((toPiece M).finiteRecord v s) =
      mask (PhysicalLevels.finite v M.z M.w s) :=
    common_level M he hq v.1 s _ _ (finite_minority _ ep v s)
      (fin_bit M v s) (fun _ _ => rfl)
  dsimp only
  rw [commonLaw,←integral_indicator (Set.toFinite _).measurableSet]
  change _ = ∫ t, mask t ∂PhysicalLevels.measure F M.z M.w U V
    (fun v => l v.1) (fun v => h v.1) (fun v => l v.1) (fun v => h v.1)
  unfold placeIntegral
  rw [integral_measure]
  simp_rw [a,f]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 4.32 The integrated error on the geometric triple

Lean verified

On a nonempty incidence piece integrate the local error of Lemma 4.29 with normalized place weights and call the resulting function of the original triple Z . For every choice of shifts and dominant labels write M 0 = ∫ m , let J e , J w be the joint exceptions over the good rare levels and let C Q be the integrated common-level bit disagreement through the sampled center. Then

E Z ≤ 4 J e + ( 4 + 1 / ϵ ) M 0 + 2 J w + C Q .

Under the hypotheses of Theorem 4.26 with S ≥ 2 2100 , there are shifts and a label rule retaining all of that theorem’s conclusions for which

C Q ≤ 2048 e 0 S ⟹ E Z ≤ 2071 e 0 S < 2 12 e 0 S .
Proof

Interchange the finite triple average with the normalized place integrals. On good rare levels apply the exact identity for the two edge marginals. The bad-level indicator is bounded by m / ϵ , and the common-level contribution equals C Q . For the shifts supplied by Theorem 4.26, M 0 ≤ 2 2 and the lower bound on S gives ( 4 + 1 / ϵ ) M 0 ≤ e 0 S . The constant is 4 ⋅ 5 + 1 + 2 + 2048 = 2071 .

Inspect the Lean declarations

PlanarUnitDistances.Competition.IncidencePiece.physical_error_mean

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  {t : ℝ},
  PlanarUnitDistances.Competition.Regular M t →
    0 < t →
      t ^ (-150 * PlanarUnitDistances.Competition.savingG) ≤ 2 ^ (-154) →
        2 ^ 2100 ≤ M.scale →
          ∀ (F : Finset (NumberField.FinitePlace K)),
            (∀ v ∉ F, ∀ e ∈ M.E, M.threshold (⇑v) e = 0) →
              ∀ (l h : AbsoluteValue K ℝ → ℝ),
                (∀ (v : AbsoluteValue K ℝ), ∀ e ∈ M.E, l v ≤ M.threshold (⇑v) e) →
                  (∀ (v : AbsoluteValue K ℝ), ∀ e ∈ M.E, M.threshold (⇑v) e ≤ h v) →
                    ∃ u d,
                      (∀ (v : NumberField.InfinitePlace K), u v ∈ Set.Ioo 0 1) ∧
                        (∀ (r : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label),
                            M.goodRare r →
                              ((M.pointMass fun p => r.selected p ≠ d r) +
                                  M.centerMass fun q => r.selected q ≠ d r) ≤
                                2 * (M.minorityMass r + M.inconsistentMass r)) ∧
                          M.placeIntegral F l h u M.minorityMass = M.scale ∧
                            M.placeIntegral F l h u M.inconsistentMass ≤ 2 * √2 ∧
                              M.placeIntegral F l h u (M.masked fun r => M.edgeException r (d r)) ≤
                                  5 * 2 ^ (-144) * M.scale ∧
                                M.placeIntegral F l h u (M.masked fun r => M.walkException r (d r)) ≤
                                    2 ^ (-144) * M.scale ∧
                                  (M.placeIntegral F l h u M.commonDisagreement ≤
                                      2048 * 2 ^ (-144) * M.scale →
                                    (M.walkLinear fun v => M.placeIntegral F l h u (M.recordError d v)) ≤
                                        2071 * 2 ^ (-144) * M.scale ∧
                                      (M.walkLinear fun v => M.placeIntegral F l h u (M.recordError d v)) <
                                        2 ^ 12 * 2 ^ (-144) * M.scale)
Lean source · PlanarUnitDistances/PhysicalError.lean, lines 69–125
/-- The chosen common shifts and dominant labels, with the only remaining
mean-error input being the common-level bit disagreement on these very
shifts. The error Z of each triple is defined by place integration, with
no independent copy of the edge or walk. -/
theorem physical_error_mean (M : IncidencePiece K) {t : ℝ} (reg : Regular M t) (ht : 0<t)
    (hx : t^(-150*savingG)≤(2:ℝ)^(-154:ℝ)) (hS : (2:ℝ)^2100≤M.scale)
    (F : Finset (FinitePlace K)) (active : ∀v∉F,∀e∈M.E,M.threshold v e=0)
    (l h : AbsoluteValue K ℝ → ℝ)
    (lo : ∀(v : AbsoluteValue K ℝ) e,e∈M.E → l v≤M.threshold v e)
    (hi : ∀(v : AbsoluteValue K ℝ) e,e∈M.E → M.threshold v e≤h v) :
    ∃ (u : InfinitePlace K → ℝ) (d : CoordinateLevel M.Label → M.Label),
      (∀v,u v∈Set.Ioo (0:ℝ) 1) ∧ (∀r,M.goodRare r →
        M.pointMass (fun p => r.selected p≠d r)+M.centerMass (fun q => r.selected q≠d r)
        ≤2*(M.minorityMass r+M.inconsistentMass r)) ∧
      M.placeIntegral F l h u M.minorityMass=M.scale ∧
      M.placeIntegral F l h u M.inconsistentMass≤2*sqrt 2 ∧
      M.placeIntegral F l h u (M.masked fun r => M.edgeException r (d r))≤5*(2:ℝ)^(-144:ℝ)*M.scale ∧
      M.placeIntegral F l h u (M.masked fun r => M.walkException r (d r))≤(2:ℝ)^(-144:ℝ)*M.scale ∧
      (M.placeIntegral F l h u M.commonDisagreement≤2048*(2:ℝ)^(-144:ℝ)*M.scale →
        M.walkLinear (fun v => M.placeIntegral F l h u (M.recordError d v))≤
        2071*(2:ℝ)^(-144:ℝ)*M.scale ∧
        M.walkLinear (fun v => M.placeIntegral F l h u (M.recordError d v))<
        2^12*(2:ℝ)^(-144:ℝ)*M.scale) := by
  have four (n : ℕ) (hn : 2≤n) : (4:ℝ)≤2^n := by
    rw [show (4:ℝ)=(2:ℝ)^2 by norm_num]
    exact pow_le_pow_right₀ (by norm_num) hn
  have s4 : 4≤M.scale := (four 2100 (by decide)).trans hS
  obtain ⟨u,d,hu,hd,correct,err,je,jw⟩ := physical_rare M reg ht hx s4 F active l h lo hi
  refine ⟨u,d,hu,hd,correct,err,je,jw,?_⟩
  intro common
  have he : 0<(M.E.card:ℝ) := (rpow_pos_of_pos ht _).trans_le reg.size
  have budget := physical_error_budget M (card_pos.mp (Nat.cast_pos.mp he)) F l h u d
  have ep : 0<eps := by unfold eps; positivity
  have ern : M.placeIntegral F l h u M.inconsistentMass≤4 := by
    nlinarith only [err,sq_sqrt (by norm_num : (0:ℝ)≤2),sq_nonneg (sqrt 2-2)]
  have eb : (4+1/eps)*M.placeIntegral F l h u M.inconsistentMass≤(2:ℝ)^(-144:ℝ)*M.scale := by
    apply (mul_le_mul_of_nonneg_left ern (by positivity)).trans
    apply le_trans _ (mul_le_mul_of_nonneg_left hS (by positivity))
    have invε : 1/eps=(2:ℝ)^1800 := by norm_num [eps]
    have pw : (2:ℝ)^(-144:ℝ)*(2:ℝ)^2100=(2:ℝ)^1956 := by
      rw [←rpow_natCast _ 2100,←rpow_natCast _ 1956,←rpow_add (by norm_num)]
      congr 1; norm_num
    rw [invε,pw]
    calc
      _ ≤ ((2:ℝ)^1800+2^1800)*4 := mul_le_mul_of_nonneg_right (add_le_add (four 1800 (by decide)) le_rfl) (by norm_num)
      _ = (2:ℝ)^1803 := by
        rw [show 1803=1800+3 by decide,pow_add]
        generalize (2:ℝ)^1800=z
        ring
      _ ≤ (2:ℝ)^1956 := pow_le_pow_right₀ (by norm_num) (by decide : (1803:ℕ)≤1956)
  have nn : 0<(2:ℝ)^(-144:ℝ)*M.scale := mul_pos (rpow_pos_of_pos (by norm_num) _) (lt_of_lt_of_le (by norm_num) s4)
  have total := budget.trans (add_le_add (add_le_add (add_le_add (mul_le_mul_of_nonneg_left je (by norm_num : (0:ℝ)≤4))
    eb) (mul_le_mul_of_nonneg_left jw (by norm_num : (0:ℝ)≤2))) common)
  have bound : M.walkLinear (fun v => M.placeIntegral F l h u (M.recordError d v))≤2071*(2:ℝ)^(-144:ℝ)*M.scale :=
    total.trans_eq (by ring)
  refine ⟨bound,bound.trans_lt ?_⟩
  simpa only [mul_assoc] using mul_lt_mul_of_pos_right (by norm_num : (2071:ℝ)<2^12) nn

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.physical_error_budget

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K),
  M.E.Nonempty →
    ∀ (F : Finset (NumberField.FinitePlace K)) (l h : AbsoluteValue K ℝ → ℝ)
      (u : NumberField.InfinitePlace K → ℝ)
      (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label),
      (M.walkLinear fun v => M.placeIntegral F l h u (M.recordError d v)) ≤
        4 * M.placeIntegral F l h u (M.masked fun j => M.edgeException j (d j)) +
              (4 + 1 / PlanarUnitDistances.Competition.eps) * M.placeIntegral F l h u M.inconsistentMass +
            2 * M.placeIntegral F l h u (M.masked fun j => M.walkException j (d j)) +
          M.placeIntegral F l h u M.commonDisagreement
Lean source · PlanarUnitDistances/PhysicalError.lean, lines 49–67
/-- The expectation of the explicit error on physical triples, for
arbitrary physical shifts and labels, with every term on the same law. -/
theorem physical_error_budget (M : IncidencePiece K) (hn : M.E.Nonempty) (F : Finset (FinitePlace K))
    (l h : AbsoluteValue K ℝ → ℝ) (u : InfinitePlace K → ℝ) (d : CoordinateLevel M.Label → M.Label) :
    M.walkLinear (fun v => M.placeIntegral F l h u (M.recordError d v))≤
      4*M.placeIntegral F l h u (M.masked fun j => M.edgeException j (d j))+
      (4+1/eps)*M.placeIntegral F l h u M.inconsistentMass+
      2*M.placeIntegral F l h u (M.masked fun j => M.walkException j (d j))+
      M.placeIntegral F l h u M.commonDisagreement := by
  rw [interchange]
  apply (placeIntegral_mono M F l h u (record_mean_le M hn d)).trans_eq
  let T := M.placeLinear F l h u
  let J := M.masked (fun j => M.edgeException j (d j))
  let W := M.masked (fun j => M.walkException j (d j))
  have hT (f : CoordinateLevel M.Label→ℝ) : M.placeIntegral F l h u f=T f := (placeLinear_apply M F l h u f).symm
  simp_rw [hT]
  change T ((4:ℝ) • J+(4+1/eps) • M.inconsistentMass+(2:ℝ) • W+M.commonDisagreement)=
    4*T J+(4+1/eps)*T M.inconsistentMass+2*T W+T M.commonDisagreement
  simp only [map_add,map_smul,smul_eq_mul]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 4.33 Signed and unsigned endpoint inequalities at all places

Lean verified

Take any windows containing the edge thresholds, any finite set of finite places containing every active edge prime, any shifts, and any rule assigning a label to each coordinate record. Use precisely those data to build the point widths H p ≥ 0 , signed endpoint vectors a p and triple error Z ≥ 0 . The finite-prime part of each a p is supported on the chosen finite set. For every triple ( p , q , r ) with both edges present put λ = ( z p − z q ) / ( z r − z q ) . Then

‖ ( log ⁡ | λ | v ) v − ( a r − a p ) ‖ 1 ≤ Z , | 2 h ( λ ) − ( H p + H r ) | ≤ Z .

The places carry their normalized arithmetic weights. The inequalities also hold when p = r .

Proof

At each place, the two edge bits are exactly the nested threshold indicators. Their signed integrals in the order p q , r q differ by n p q − n r q = − log ⁡ | λ | v ; reversing the endpoint-vector difference gives the displayed sign. Apply the three inequalities of Lemma 4.29 and sum with positive weights. The logarithm of the ratio vanishes at all omitted finite primes because both thresholds vanish there. The normalized absolute-log sum equals 2 h ( λ ) by the height identity for the nonzero ratio.

Inspect the Lean declarations

PlanarUnitDistances.Competition.IncidencePiece.physical_endpoints

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (F : Finset (NumberField.FinitePlace K)),
  (∀ v ∉ F, ∀ e ∈ M.E, M.threshold (⇑v) e = 0) →
    ∀ (l h : AbsoluteValue K ℝ → ℝ),
      (∀ (v : AbsoluteValue K ℝ), ∀ e ∈ M.E, l v ≤ M.threshold (⇑v) e) →
        (∀ (v : AbsoluteValue K ℝ), ∀ e ∈ M.E, M.threshold (⇑v) e ≤ h v) →
          ∀ (u : NumberField.InfinitePlace K → ℝ)
            (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label)
            (x : PlanarUnitDistances.Competition.Triple M),
            0 < M.mass x →
              have S := M.arithmeticScores F l h u d;
              PlanarUnitDistances.Competition.signedError S x ≤ S.error x ∧
                |2 * PlanarUnitDistances.weilHeight (PlanarUnitDistances.Competition.tripleRatio M x) -
                      S.width x| ≤
                  S.error x
Lean source · PlanarUnitDistances/PhysicalScores.lean, lines 81–143
/-- Both endpoint comparisons of the manuscript on every supported
triple, including repeated points, with a single explicit family of
arithmetic endpoint scores and one integrated error. -/
theorem physical_endpoints (M : IncidencePiece K) (F : Finset (FinitePlace K))
    (active : ∀v∉F,∀e∈M.E,M.threshold v e=0) (l h : AbsoluteValue K ℝ → ℝ)
    (lo : ∀(v : AbsoluteValue K ℝ) e,e∈M.E → l v≤M.threshold v e)
    (hi : ∀(v : AbsoluteValue K ℝ) e,e∈M.E → M.threshold v e≤h v)
    (u : InfinitePlace K → ℝ) (d : CoordinateLevel M.Label → M.Label) (x : Triple M) (hx : 0<M.mass x) :
    let S := M.arithmeticScores F l h u d
    signedError S x≤S.error x ∧ |2*weilHeight (tripleRatio M x)-S.width x|≤S.error x := by
  let S := M.arithmeticScores F l h u d
  let E := M.valueAt l h u (M.recordError d x)
  let W := M.valueAt l h u (M.endpointWidth d x.1.val)+M.valueAt l h u (M.endpointWidth d x.2.2.val)
  let A := M.valueAt l h u (M.endpointSigned d x.2.2.val)-M.valueAt l h u (M.endpointSigned d x.1.val)
  let B (v : Place K) := Real.log (valuation v (tripleRatio M x))
  let N (v : Place K) := |B v|
  let D (v : Place K) := |B v-A v|
  obtain ⟨hp,hr⟩ := supported_edges M x hx
  have point (v : Place K) : D v≤E v ∧ W v-E v≤N v ∧ N v≤W v+E v := by
    let v' := valuation v
    have z := local_endpoint M d x (M.recordsAt u v) (l v') (h v') _ _ (lo v' _ hp) (lo v' _ hr)
      (hi v' _ hp) (hi v' _ hr) (bits_at M u x hx v)
    dsimp only at z
    have rev := threshold_ratio M x hx v'
    change B v=_ at rev
    have sn := abs_le.mp z.1
    change |B v-(_-_)|≤_ ∧ _≤|B v| ∧ |B v|≤_
    rw [rev,abs_sub_comm (M.threshold v' (x.2.2.val,x.2.1.val)) (M.threshold v' (x.1.val,x.2.1.val))]
    refine ⟨abs_le.mpr ⟨?_,?_⟩,z.2.1,z.2.2⟩ <;> dsimp only [valueAt,E] <;> linarith only [sn.1,sn.2]
  have zero (v : FinitePlace K) (hv : v∉F) : B (.inr v)=0 := by
    have eq (e : Plane×Plane) : M.threshold v.val e=M.threshold v e := by simp only [threshold,FinitePlace.coe_apply]
    exact (threshold_ratio M x hx v.val).trans (by
      rw [eq (x.2.2.val,x.2.1.val),eq (x.1.val,x.2.1.val),active v hv _ hr,active v hv _ hp,sub_self])
  have width : S.width x=placeSum F W :=
    (sum_add F (M.valueAt l h u (M.endpointWidth d x.1.val)) (M.valueAt l h u (M.endpointWidth d x.2.2.val))).symm
  have error : S.error x=placeSum F E := rfl
  have norm : 2*weilHeight (tripleRatio M x)=placeSum F N := by
    rw [twice_weilHeight_eq_absLog (ratio_ne M x hx)]
    unfold placeSum
    congr 2
    apply finsum_eq_sum_of_support_subset
    intro v hv; by_contra hn
    exact hv ((congrArg abs (zero v hn)).trans abs_zero)
  have finiteScore (p : M.P) (v : FinitePlace K) : S.finite p v=
      if v∈F then M.valueAt l h u (M.endpointSigned d p.val) (.inr v) else 0 := rfl
  have signed : signedError S x=placeSum F D := by
    unfold signedError placeSum
    congr 2
    have eq : (∑ᶠv : FinitePlace K, |Real.log (v (tripleRatio M x))-(S.finite x.2.2 v-S.finite x.1 v)|)=
      ∑v∈F,|Real.log (v (tripleRatio M x))-(S.finite x.2.2 v-S.finite x.1 v)| := by
      apply finsum_eq_sum_of_support_subset
      intro v hv; by_contra hn
      have hn' : v∉F := hn
      change |B (.inr v)-(S.finite x.2.2 v-S.finite x.1 v)|≠0 at hv
      simp [finiteScore,hn',zero v hn'] at hv
    rw [eq]; apply sum_congr rfl; intro v hv; simp [D,A,B,valuation,finiteScore,hv,FinitePlace.coe_apply]
  change signedError S x≤S.error x ∧ |2*weilHeight (tripleRatio M x)-S.width x|≤S.error x
  rw [signed,width,error,norm]
  have low := sum_mono F (f:=W-E) (g:=N) (fun v => (point (.inl v)).2.1) (fun v _ => (point (.inr v)).2.1)
  have high := sum_mono F (f:=N) (g:=W+E) (fun v => (point (.inl v)).2.2) (fun v _ => (point (.inr v)).2.2)
  rw [sum_sub] at low; rw [sum_add] at high
  exact ⟨sum_mono F (fun v => (point (.inl v)).1) (fun v _ => (point (.inr v)).1),
    abs_le.mpr ⟨by linarith only [low],by linarith only [high]⟩⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.arithmeticScores

{K : Type} →
  [inst : Field K] →
    [inst_1 : NumberField K] →
      (M : PlanarUnitDistances.Competition.IncidencePiece K) →
        Finset (NumberField.FinitePlace K) →
          (AbsoluteValue K ℝ → ℝ) →
            (AbsoluteValue K ℝ → ℝ) →
              (NumberField.InfinitePlace K → ℝ) →
                (PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label) →
                  PlanarUnitDistances.Competition.Scores M
Lean source · PlanarUnitDistances/PhysicalScores.lean, lines 38–46
/-- The scores are fixed functions of the endpoints, and the actual
triple error is integrated from the same level records. -/
def arithmeticScores (M : IncidencePiece K) (F : Finset (FinitePlace K)) (l h : AbsoluteValue K ℝ→ℝ)
    (u : InfinitePlace K→ℝ) (d : CoordinateLevel M.Label→M.Label) : Scores M where
  H p := M.placeIntegral F l h u (M.endpointWidth d p.val)
  arch p v := M.valueAt l h u (M.endpointSigned d p.val) (.inl v)
  finite p := Finsupp.onFinset F (fun v => if v∈F then M.valueAt l h u (M.endpointSigned d p.val) (.inr v) else 0)
    (by intro v hv; by_contra hn; exact hv (ite_eq_right hn))
  error x := M.placeIntegral F l h u (M.recordError d x)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.arithmeticScores_nonneg

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (F : Finset (NumberField.FinitePlace K)) (l h : AbsoluteValue K ℝ → ℝ) (u : NumberField.InfinitePlace K → ℝ)
  (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label),
  have S := M.arithmeticScores F l h u d;
  (∀ (p : ↥M.P), 0 ≤ S.H p) ∧ ∀ (x : PlanarUnitDistances.Competition.Triple M), 0 ≤ S.error x
Lean source · PlanarUnitDistances/PhysicalScores.lean, lines 48–61
theorem arithmeticScores_nonneg (M : IncidencePiece K) (F : Finset (FinitePlace K))
    (l h : AbsoluteValue K ℝ→ℝ) (u : InfinitePlace K→ℝ) (d : CoordinateLevel M.Label→M.Label) :
    let S := M.arithmeticScores F l h u d
    (∀p,0≤S.H p) ∧ (∀x,0≤S.error x) := by
  have nn (f : CoordinateLevel M.Label→ℝ) (hf : ∀r,0≤f r) : 0≤M.placeIntegral F l h u f := by
    have zero : M.placeIntegral F l h u (0 : CoordinateLevel M.Label→ℝ)=0 :=
      (placeLinear_apply M F l h u 0).symm.trans (map_zero _)
    rw [←zero]; exact placeIntegral_mono M F l h u hf
  constructor
  · intro p; apply nn
    intro r
    by_cases j : M.goodRare r <;> by_cases eq : r.selected p.val=d r <;>
      simp [endpointWidth,masked,CoordinateLevel.exceptionAt,j,eq]
  · intro x; exact nn _ fun r => (abs_nonneg _).trans (recordError_comparison M d x r).1

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 4.34 Three explicit inequalities suffice for the original score record

Lean verified

For a regular incidence piece at t > 0 with t − 150 g ≤ 2 − 154 and S ≥ 2 2100 , take a finite set and windows as in Theorem 4.33. There exist common shifts and one dominant-label rule retaining the simultaneous rare bounds of Theorem 4.26. For those very data put X = E E H p , W = H p + H r , and let C Q be the integrated common-level disagreement of the two-edge center walk. If

X > S / 203 , E [ W 1 W > 8 S / ϵ ] ≤ 2 14 e 0 S , C Q ≤ 2048 e 0 S ,

then the constructed scores obey both endpoint inequalities and all three moment bounds. In particular E W = 2 X and E Z < 2 12 e 0 S .

Proof

Each endpoint of the walk has the point marginal of the uniform edge, which gives the mean identity. Use the two endpoint inequalities and charge the expected error by Theorem 4.32. The three displayed inequalities are hypotheses of this implication.

Inspect the Lean declarations

PlanarUnitDistances.Competition.IncidencePiece.physical_scores_of_width_and_common

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  {t : ℝ},
  PlanarUnitDistances.Competition.Regular M t →
    0 < t →
      t ^ (-150 * PlanarUnitDistances.Competition.savingG) ≤ 2 ^ (-154) →
        2 ^ 2100 ≤ M.scale →
          ∀ (F : Finset (NumberField.FinitePlace K)),
            (∀ v ∉ F, ∀ e ∈ M.E, M.threshold (⇑v) e = 0) →
              ∀ (l h : AbsoluteValue K ℝ → ℝ),
                (∀ (v : AbsoluteValue K ℝ), ∀ e ∈ M.E, l v ≤ M.threshold (⇑v) e) →
                  (∀ (v : AbsoluteValue K ℝ), ∀ e ∈ M.E, M.threshold (⇑v) e ≤ h v) →
                    ∃ u d,
                      (∀ (v : NumberField.InfinitePlace K), u v ∈ Set.Ioo 0 1) ∧
                        (∀ (r : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label),
                            M.goodRare r →
                              ((M.pointMass fun p => r.selected p ≠ d r) +
                                  M.centerMass fun q => r.selected q ≠ d r) ≤
                                2 * (M.minorityMass r + M.inconsistentMass r)) ∧
                          M.placeIntegral F l h u M.minorityMass = M.scale ∧
                            M.placeIntegral F l h u M.inconsistentMass ≤ 2 * √2 ∧
                              M.placeIntegral F l h u (M.masked fun r => M.edgeException r (d r)) ≤
                                  5 * 2 ^ (-144) * M.scale ∧
                                M.placeIntegral F l h u (M.masked fun r => M.walkException r (d r)) ≤
                                    2 ^ (-144) * M.scale ∧
                                  have S := M.arithmeticScores F l h u d;
                                  (M.scale / 203 <
                                      M.edgeMean fun e => M.placeIntegral F l h u (M.endpointWidth d e.1)) →
                                    (M.walkLinear fun x =>
                                          if
                                              8 * M.scale / PlanarUnitDistances.Competition.eps <
                                                S.width x then
                                            S.width x
                                          else 0) ≤
                                        2 ^ 14 / 2 ^ 144 * M.scale →
                                      M.placeIntegral F l h u M.commonDisagreement ≤
                                          2048 * 2 ^ (-144) * M.scale →
                                        PlanarUnitDistances.Competition.MomentBounds M S
Lean source · PlanarUnitDistances/ArithmeticMomentReduction.lean, lines 23–55
/-- The residual conditions on these explicit scores are the lower mean,
the upper width tail, and the common-level disagreement. All use this
same original graph, its arithmetic shifts, and its chosen dominant label. -/
theorem physical_scores_of_width_and_common (M : IncidencePiece K) {t : ℝ} (reg : Regular M t) (ht : 0<t)
    (hx : t^(-150*savingG)≤(2:ℝ)^(-154:ℝ)) (hS : (2:ℝ)^2100≤M.scale)
    (F : Finset (FinitePlace K)) (active : ∀v∉F,∀e∈M.E,M.threshold v e=0)
    (l h : AbsoluteValue K ℝ → ℝ)
    (lo : ∀(v : AbsoluteValue K ℝ) e,e∈M.E → l v≤M.threshold v e)
    (hi : ∀(v : AbsoluteValue K ℝ) e,e∈M.E → M.threshold v e≤h v) :
    ∃(u : InfinitePlace K→ℝ) (d : CoordinateLevel M.Label→M.Label),
      (∀v,u v∈Set.Ioo (0:ℝ) 1) ∧
      (∀r,M.goodRare r → M.pointMass (fun p => r.selected p≠d r)+M.centerMass (fun q => r.selected q≠d r)
        ≤2*(M.minorityMass r+M.inconsistentMass r)) ∧
      M.placeIntegral F l h u M.minorityMass=M.scale ∧
      M.placeIntegral F l h u M.inconsistentMass≤2*sqrt 2 ∧
      M.placeIntegral F l h u (M.masked fun r => M.edgeException r (d r))≤5*(2:ℝ)^(-144:ℝ)*M.scale ∧
      M.placeIntegral F l h u (M.masked fun r => M.walkException r (d r))≤(2:ℝ)^(-144:ℝ)*M.scale ∧
      let S := M.arithmeticScores F l h u d
      (M.scale/203 < M.edgeMean (fun e => M.placeIntegral F l h u (M.endpointWidth d e.1))) →
      M.walkLinear (fun x => if 8*M.scale/eps<S.width x then S.width x else 0)≤(2:ℝ)^14/2^144*M.scale →
      M.placeIntegral F l h u M.commonDisagreement≤2048*(2:ℝ)^(-144:ℝ)*M.scale →
      MomentBounds M S := by
  obtain ⟨u,d,hu,hd,correct,inc,je,jw,error⟩ := physical_error_mean M reg ht hx hS F active l h lo hi
  refine ⟨u,d,hu,hd,correct,inc,je,jw,?_⟩
  dsimp only
  intro mean tail common
  obtain ⟨hn,en⟩ := arithmeticScores_nonneg M F l h u d
  have comp := physical_endpoints M F active l h lo hi u d
  have large : 2*M.scale/203 < M.walkLinear (M.arithmeticScores F l h u d).width := by
    rw [arithmetic_width_mean]; linarith only [mean]
  refine ⟨fun x => add_nonneg (hn x.1) (hn x.2.2),en,large,tail,?_,
    fun x hp => (comp x hp).1,fun x hp => (comp x hp).2⟩
  exact (error common).2.le.trans_eq (by norm_num)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.arithmetic_width_mean

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (F : Finset (NumberField.FinitePlace K)) (l h : AbsoluteValue K ℝ → ℝ) (u : NumberField.InfinitePlace K → ℝ)
  (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label),
  M.walkLinear (M.arithmeticScores F l h u d).width =
    2 * M.edgeMean fun e => M.placeIntegral F l h u (M.endpointWidth d e.1)
Lean source · PlanarUnitDistances/ArithmeticMomentReduction.lean, lines 11–21
/-- The manuscript's equality E[H_p+H_r]=2X, on the very same
shifts, dominant-label rule, arithmetic place integral, and edge law. -/
theorem arithmetic_width_mean (M : IncidencePiece K) (F : Finset (FinitePlace K))
    (l h : AbsoluteValue K ℝ→ℝ) (u : InfinitePlace K→ℝ) (d : CoordinateLevel M.Label→M.Label) :
    M.walkLinear (M.arithmeticScores F l h u d).width =
    2*M.edgeMean (fun e => M.placeIntegral F l h u (M.endpointWidth d e.1)) := by
  let H (p : Plane) := M.placeIntegral F l h u (M.endpointWidth d p)
  obtain ⟨first,second⟩ := M.leg_means H
  change (∑v : Triple M, M.mass v*(H v.1.val+H v.2.2.val))=2*M.edgeMean (fun e => H e.1)
  simp_rw [mul_add]
  rw [sum_add_distrib,first,second,two_mul]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 4.35 Geometric tail for the actual arithmetic widths

Lean verified

Consider a regular graph with S > 2 2100 , t > 0 , t − 150 g ≤ 2 − 72 and every point degree at least two. On fixed windows, shifts and dominant labels, assume the dominant exception bound of Theorem 4.26, ∫ f = S and ∫ m ≤ 2 2 . If for every point and every two distinct incident centers

2 H p ≤ 3 ( H q + m p q + H r + m p r ) + 2 S / ϵ ,

then, for B 0 = 2 S / ϵ and W = H p + H r on the original two-edge center walk,

E [ W 1 W > 4 B 0 ] ≤ 2 14 e 0 S .
Proof

The point and center width means are at most 4 S and the mean edge inconsistency at most four. For u ≥ B 0 , Markov’s inequality bounds the point fraction f u = Pr ( H p > u ) by 2 ϵ and the center fraction g u = Pr ( H q ≥ u / 12 ) by 24 ϵ ≤ 1 / 2 . Thus f u g u ≤ ϵ . The rectangle inequality on the actual edge law permits the coefficient 4 ⋅ 2 − 72 multiplying f u g u . The fixed-pair bound permits at most one neighbor of a point with H p > u to have H q + m p q < u / 6 ; at least half its incident edges remain. Integrate over u and use the equality of the two point marginals to bound the displayed triple tail.

Inspect the Lean declarations

PlanarUnitDistances.Competition.IncidencePiece.arithmetic_width_tail

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  {t : ℝ},
  PlanarUnitDistances.Competition.Regular M t →
    0 < t →
      2 ^ 2100 < M.scale →
        t ^ (-150 * PlanarUnitDistances.Competition.savingG) ≤ 1 / 2 ^ 72 →
          (∀ p ∈ M.P, 2 ≤ M.degreeP p) →
            ∀ (F : Finset (NumberField.FinitePlace K)) (l h : AbsoluteValue K ℝ → ℝ)
              (u : NumberField.InfinitePlace K → ℝ)
              (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label),
              (∀ (r : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label),
                  M.goodRare r →
                    ((M.pointMass fun p => r.selected p ≠ d r) + M.centerMass fun q => r.selected q ≠ d r) ≤
                      2 * (M.minorityMass r + M.inconsistentMass r)) →
                M.placeIntegral F l h u M.minorityMass = M.scale →
                  M.placeIntegral F l h u M.inconsistentMass ≤ 2 * √2 →
                    (∀ p ∈ M.P,
                        ∀ (q r : PlanarUnitDistances.Competition.Plane),
                          (p, q) ∈ M.E →
                            (p, r) ∈ M.E →
                              q ≠ r →
                                2 * M.vertexWidth F l h u d p ≤
                                  3 *
                                      (M.vertexWidth F l h u d q + M.inconsistentLength F l h u (p, q) +
                                        (M.vertexWidth F l h u d r + M.inconsistentLength F l h u (p, r))) +
                                    2 * M.scale / PlanarUnitDistances.Competition.eps) →
                      have s := M.arithmeticScores F l h u d;
                      (∑ v,
                          M.mass v *
                            if 8 * M.scale / PlanarUnitDistances.Competition.eps < s.width v then s.width v
                            else 0) ≤
                        2 ^ 14 / 2 ^ 144 * M.scale
Lean source · PlanarUnitDistances/ArithmeticWidthTail.lean, lines 12–35
theorem arithmetic_width_tail (M : IncidencePiece K) {t : ℝ} (reg : Regular M t) (ht : 0<t)
    (hS : (2:ℝ)^2100<M.scale) (hξ : t^(-150*savingG)≤1/(2:ℝ)^72) (hdeg : ∀p∈M.P,2≤M.degreeP p)
    (F : Finset (FinitePlace K)) (l h : AbsoluteValue K ℝ→ℝ) (u : InfinitePlace K→ℝ)
    (d : CoordinateLevel M.Label→M.Label)
    (hv : ∀r,M.goodRare r → M.pointMass (fun p => r.selected p≠d r)+M.centerMass (fun q => r.selected q≠d r)
       ≤2*(M.minorityMass r+M.inconsistentMass r))
    (hmin : M.placeIntegral F l h u M.minorityMass=M.scale)
    (hbad : M.placeIntegral F l h u M.inconsistentMass≤2*sqrt 2)
    (hpair : ∀p∈M.P,∀q r : Plane,(p,q)∈M.E → (p,r)∈M.E → q≠r →
      2*M.vertexWidth F l h u d p ≤ 3*(M.vertexWidth F l h u d q+M.inconsistentLength F l h u (p,q)+
        (M.vertexWidth F l h u d r+M.inconsistentLength F l h u (p,r)))+2*M.scale/eps) :
    let s := M.arithmeticScores F l h u d
    (∑v : Triple M,M.mass v*(if 8*M.scale/eps<s.width v then s.width v else 0))≤(2:ℝ)^14/2^144*M.scale := by
  let X := M.vertexWidth F l h u d
  let m := M.inconsistentLength F l h u
  obtain ⟨X0,m0,hX,hY,hm⟩ := M.arithmetic_tail_means hS F l h u d hv hmin hbad
  apply (M.geometric_width_tail reg ht ((by positivity : 0<(2:ℝ)^2100).trans hS) _ hξ hdeg X X m
    (fun e _ => X0 e.1) (fun e _ => X0 e.2) (fun e _ => m0 e) hX hY hm hpair).2
  apply (le_div_iff₀ (by positivity)).mpr
  apply le_trans _ hS.le
  calc
    (192:ℝ)*2^144 ≤ 2^8*2^144 := mul_le_mul_of_nonneg_right (by norm_num) (by positivity)
    _ = (2:ℝ)^(8+144) := (pow_add ..).symm
    _ ≤ (2:ℝ)^2100 := pow_le_pow_right₀ (by norm_num) (by decide : (8+144:ℕ)≤2100)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.geometric_width_tail

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  {t S : ℝ},
  PlanarUnitDistances.Competition.Regular M t →
    0 < t →
      0 < S →
        192 ≤ S / 2 ^ 144 →
          t ^ (-150 * PlanarUnitDistances.Competition.savingG) ≤ 1 / 2 ^ 72 →
            (∀ p ∈ M.P, 2 ≤ M.degreeP p) →
              ∀ (X Y : PlanarUnitDistances.Competition.Plane → ℝ)
                (m : PlanarUnitDistances.Competition.Plane × PlanarUnitDistances.Competition.Plane → ℝ),
                (∀ e ∈ M.E, 0 ≤ X e.1) →
                  (∀ e ∈ M.E, 0 ≤ Y e.2) →
                    (∀ e ∈ M.E, 0 ≤ m e) →
                      (M.edgeMean fun e => X e.1) ≤ 4 * S →
                        (M.edgeMean fun e => Y e.2) ≤ 4 * S →
                          M.edgeMean m ≤ 4 →
                            (∀ p ∈ M.P,
                                ∀ (q r : PlanarUnitDistances.Competition.Plane),
                                  (p, q) ∈ M.E →
                                    (p, r) ∈ M.E →
                                      q ≠ r →
                                        2 * X p ≤
                                          3 * (Y q + m (p, q) + (Y r + m (p, r))) +
                                            2 * S / PlanarUnitDistances.Competition.eps) →
                              (M.edgeMean fun e =>
                                    max (X e.1 - 2 * S / PlanarUnitDistances.Competition.eps) 0) ≤
                                  2 ^ 12 / 2 ^ 144 * S ∧
                                (∑ v,
                                    M.mass v *
                                      if 8 * S / PlanarUnitDistances.Competition.eps < X ↑v.1 + X ↑v.2.2 then
                                        X ↑v.1 + X ↑v.2.2
                                      else 0) ≤
                                  2 ^ 14 / 2 ^ 144 * S
Lean source · PlanarUnitDistances/GeometricWidthTail.lean, lines 34–109
/-- The rare upper-tail bound on the literal edge and triple experiments.
The pointwise premise is required only on pairs of distinct actual
neighbors. The large integrated widths, local inconsistency and pointwise
inequality are the three arithmetic inputs to the geometric truncation. -/
theorem geometric_width_tail (M : IncidencePiece K) {t S : ℝ} (reg : Regular M t)
    (ht : 0<t) (hS : 0<S) (hlarge : 192≤S/(2:ℝ)^144)
    (hξ : t^(-150*savingG)≤1/(2:ℝ)^72)
    (hdeg : ∀p∈M.P, 2≤M.degreeP p)
    (X Y : Plane → ℝ) (m : Plane×Plane → ℝ)
    (hX0 : ∀e∈M.E,0≤X e.1) (hY0 : ∀e∈M.E,0≤Y e.2) (hm0 : ∀e∈M.E,0≤m e)
    (hX : M.edgeMean (fun e => X e.1)≤4*S)
    (hY : M.edgeMean (fun e => Y e.2)≤4*S) (hm : M.edgeMean m≤4)
    (hpair : ∀p∈M.P, ∀q r : Plane, (p,q)∈M.E → (p,r)∈M.E → q≠r →
      2*X p≤3*(Y q+m (p,q)+(Y r+m (p,r)))+2*S/eps) :
    M.edgeMean (fun e => max (X e.1-2*S/eps) 0) ≤ (2:ℝ)^12/2^144*S ∧
    (∑v : Triple M,M.mass v*(if 8*S/eps<X v.1.val+X v.2.2.val then X v.1.val+X v.2.2.val else 0))
      ≤ (2:ℝ)^14/2^144*S := by
  let B := 2*S/eps
  let α := 4/(2:ℝ)^72
  have ep : 0<eps := by unfold eps; positivity
  have esmall : eps≤1/48 := by
    unfold eps
    apply le_trans (Real.rpow_le_rpow_of_exponent_le (by norm_num : (1:ℝ)≤2)
      (by norm_num : -(1800:ℝ)≤ -6))
    norm_num
  have hB : 0<B := div_pos (by positivity) ep
  have cut (u : ℝ) (hu : B≤u) :
      M.edgeProb (fun e => u<X e.1 ∧ u/12≤Y e.2) ≤
        α*sqrt (M.edgeProb (fun e => u<X e.1)*M.edgeProb (fun e => u/12≤Y e.2)) := by
    have x := (M.edge_markov (fun e => X e.1) hX0 (hB.trans_le hu).le (fun e => u<X e.1)
      (fun _ _ h => h.le)).trans hX
    have y := (M.edge_markov (fun e => Y e.2) hY0 (div_nonneg (hB.trans_le hu).le (by norm_num))
      (fun e => u/12≤Y e.2) (fun _ _ h => h)).trans hY
    have fx : 0≤M.edgeProb (fun e => u<X e.1) := by unfold edgeProb; positivity
    have fy : 0≤M.edgeProb (fun e => u/12≤Y e.2) := by unfold edgeProb; positivity
    have Bmul := (mul_le_mul_of_nonneg_right hu fx).trans x
    have Cmul := (mul_le_mul_of_nonneg_right (div_le_div_of_nonneg_right hu (by norm_num : (0:ℝ)≤12)) fy).trans y
    have Bx : M.edgeProb (fun e => u<X e.1)≤2*eps := by
      let z := M.edgeProb (fun e => u<X e.1)
      change z≤2*eps
      apply (le_of_mul_le_mul_left ?_ hS)
      calc
        S*z = B*z*(eps/2) := by dsimp only [B]; field_simp <;> ring
        _ ≤ 4*S*(eps/2) := mul_le_mul_of_nonneg_right Bmul (by positivity)
        _ = S*(2*eps) := by ring
    have Cy : M.edgeProb (fun e => u/12≤Y e.2)≤1/2 := by
      let z := M.edgeProb (fun e => u/12≤Y e.2)
      have v : z≤24*eps := by
        apply (le_of_mul_le_mul_left ?_ hS)
        calc
          S*z = B/12*z*(6*eps) := by dsimp only [B]; field_simp <;> ring
          _ ≤ 4*S*(6*eps) := mul_le_mul_of_nonneg_right Cmul (by positivity)
          _ = S*(24*eps) := by ring
      change z≤1/2
      linarith only [v,esmall]
    exact cutoff_coefficient fx fy Bx Cy hξ
      (M.edgeProb_rectangle_marginals reg ht (fun p => u<X p) (fun q => u/12≤Y q))
  have event (u : ℝ) (hu : B≤u) := cut u hu
  have res := edge_width_tail (P := ↥M.P) (fun p : M.P => ↥(M.centerFiber p)) (fun _ => 1/(M.E.card:ℝ)) (fun p => X p.val)
    (fun _ q => Y q.val) (fun p q => m (p.val,q.val)) (α:=α) (S:=S) (B₀:=B) hS hB.le
    (fun _ => by positivity) (fun _ q => hY0 _ (mem_filter.mp q.prop).2)
    (fun _ q => hm0 _ (mem_filter.mp q.prop).2)
    (fun p => by rw [Fintype.card_coe]; exact hdeg p p.prop)
    (fun p q r qr => hpair p p.prop q r (mem_filter.mp q.prop).2 (mem_filter.mp r.prop).2 (Subtype.val_injective.ne qr))
    (fun u hu => by simpa only [←M.fiber_event] using event u hu)
    (by norm_num [α]) (by exact (M.fiber_mean (fun e => Y e.2)).trans_le hY)
    (by exact (M.fiber_mean m).trans_le hm) hlarge
  have point : M.edgeMean (fun e => max (X e.1-B) 0) ≤ (2:ℝ)^12/2^144*S :=
    (M.fiber_mean (fun e => max (X e.1-B) 0)).symm.trans_le res
  have lm := M.leg_means (fun p => max (X p-B) 0)
  have pairs := truncated_pair_width M.mass (fun v => X v.1.val) (fun v => X v.2.2.val)
    (B₀:=B) M.mass_nonnegative (lm.1.trans_le point) (lm.2.trans_le point)
  refine ⟨point,?_⟩
  dsimp [B] at pairs
  rw [show (4:ℝ)*(2*S/eps)=8*S/eps by ring] at pairs
  exact pairs.trans_eq (by ring)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.arithmetic_tail_means

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K),
  2 ^ 2100 < M.scale →
    ∀ (F : Finset (NumberField.FinitePlace K)) (l h : AbsoluteValue K ℝ → ℝ)
      (u : NumberField.InfinitePlace K → ℝ)
      (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label),
      (∀ (r : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label),
          M.goodRare r →
            ((M.pointMass fun p => r.selected p ≠ d r) + M.centerMass fun q => r.selected q ≠ d r) ≤
              2 * (M.minorityMass r + M.inconsistentMass r)) →
        M.placeIntegral F l h u M.minorityMass = M.scale →
          M.placeIntegral F l h u M.inconsistentMass ≤ 2 * √2 →
            have X := M.vertexWidth F l h u d;
            have m := M.inconsistentLength F l h u;
            (∀ (p : PlanarUnitDistances.Competition.Plane), 0 ≤ X p) ∧
              (∀ (e : PlanarUnitDistances.Competition.Plane × PlanarUnitDistances.Competition.Plane),
                  0 ≤ m e) ∧
                (M.edgeMean fun e => X e.1) ≤ 4 * M.scale ∧
                  (M.edgeMean fun e => X e.2) ≤ 4 * M.scale ∧ M.edgeMean m ≤ 4
Lean source · PlanarUnitDistances/ArithmeticTailMeans.lean, lines 30–109
/-- The endpoint and inconsistency averages required by geometric truncation,
on the same field labels and on the same edge law. -/
theorem arithmetic_tail_means (M : IncidencePiece K) (hS : (2:ℝ)^2100<M.scale)
    (F : Finset (FinitePlace K)) (l h : AbsoluteValue K ℝ→ℝ) (u : InfinitePlace K→ℝ)
    (d : CoordinateLevel M.Label→M.Label)
    (hv : ∀r,M.goodRare r → M.pointMass (fun p => r.selected p≠d r)+M.centerMass (fun q => r.selected q≠d r)
       ≤2*(M.minorityMass r+M.inconsistentMass r))
    (hmin : M.placeIntegral F l h u M.minorityMass=M.scale)
    (hbad : M.placeIntegral F l h u M.inconsistentMass≤2*sqrt 2) :
    let X := M.vertexWidth F l h u d
    let m := M.inconsistentLength F l h u
    (∀p,0≤X p) ∧ (∀e,0≤m e) ∧ M.edgeMean (fun e => X e.1)≤4*M.scale ∧
    M.edgeMean (fun e => X e.2)≤4*M.scale ∧ M.edgeMean m≤4 := by
  let X := M.vertexWidth F l h u d
  let m := M.inconsistentLength F l h u
  have zero : M.placeIntegral F l h u (0 : CoordinateLevel M.Label→ℝ)=0 :=
    (placeLinear_apply M F l h u 0).symm.trans (map_zero _)
  have X0 (p : Plane) : 0≤X p := by
    rw [←zero]; apply placeIntegral_mono M F l h u
    intro r
    change 0≤M.endpointWidth d p r
    by_cases h1 : M.goodRare r <;> by_cases h2 : r.selected p=d r <;>
      simp [endpointWidth,masked,CoordinateLevel.exceptionAt,h1,h2]
  have m0 (e : Plane×Plane) : 0≤m e := by
    rw [←zero]; apply placeIntegral_mono M F l h u
    intro r
    split_ifs <;> norm_num
  have grad (f : Plane×Plane → CoordinateLevel M.Label → ℝ)
      (hf : ∀r,M.edgeMean (fun e => f e r) ≤ 2*(M.minorityMass r+M.inconsistentMass r)) :
      M.edgeMean (fun e => M.placeIntegral F l h u (f e))≤4*M.scale := by
    rw [edgeMean_placeIntegral]
    have b := M.placeIntegral_mono F l h u hf
    have id : (fun r : CoordinateLevel M.Label => 2*(M.minorityMass r+M.inconsistentMass r)) =
        (2:ℝ) • (M.minorityMass+M.inconsistentMass) := rfl
    have lin : M.placeIntegral F l h u (fun r => 2*(M.minorityMass r+M.inconsistentMass r)) =
        2*(M.scale+M.placeIntegral F l h u M.inconsistentMass) := by
      rw [id,←placeLinear_apply M F l h u ((2:ℝ) • (M.minorityMass+M.inconsistentMass)),
        map_smul,map_add,smul_eq_mul,placeLinear_apply,placeLinear_apply,hmin]
    rw [lin] at b
    have small : 2*sqrt 2≤4 := by nlinarith [Real.sq_sqrt (by norm_num : (0:ℝ)≤2),sq_nonneg (sqrt 2-2)]
    have hs : 4≤M.scale := (show (4:ℝ)=2^2 by norm_num).trans_le
      ((pow_le_pow_right₀ (by norm_num : (1:ℝ)≤2) (by decide : (2:ℕ)≤2100)).trans hS.le)
    exact b.trans ((mul_le_mul_of_nonneg_left (add_le_add le_rfl (hbad.trans (small.trans hs)))
      (by norm_num : (0:ℝ)≤2)).trans_eq (show 2*(M.scale+M.scale)=4*M.scale by ring))
  have widthEvent (k : Plane×Plane → Plane) (r : CoordinateLevel M.Label) :
      M.edgeMean (fun e => M.endpointWidth d (k e) r) =
        if M.goodRare r then M.edgeProb (fun e => r.selected (k e)≠d r) else 0 := by
    by_cases h : M.goodRare r
    · rw [ite_eq_left h,←edgeMean_indicator]
      apply congrArg M.edgeMean; funext e
      by_cases z : r.selected (k e)=d r <;> simp [endpointWidth,masked,h,CoordinateLevel.exceptionAt,z]
    · simp [endpointWidth,masked,h,edgeMean]
  have both (r : CoordinateLevel M.Label) : 0≤2*(M.minorityMass r+M.inconsistentMass r) := by
    unfold minorityMass inconsistentMass edgeProb; positivity
  have hX : M.edgeMean (fun e => X e.1)≤4*M.scale := by
    apply grad (fun e => M.endpointWidth d e.1)
    intro r; rw [widthEvent Prod.fst r]; split_ifs with z
    · rw [edgeProb_point_event M (fun p => r.selected p≠d r)]
      have hz : 0≤M.centerMass (fun q => r.selected q≠d r) := by rw [←edgeProb_center_event]; unfold edgeProb; positivity
      exact (le_add_of_nonneg_right hz).trans (hv r z)
    · exact both r
  have hY : M.edgeMean (fun e => X e.2)≤4*M.scale := by
    apply grad (fun e => M.endpointWidth d e.2)
    intro r; rw [widthEvent Prod.snd r]; split_ifs with z
    · rw [edgeProb_center_event M (fun q => r.selected q≠d r)]
      have hz : 0≤M.pointMass (fun p => r.selected p≠d r) := by rw [←edgeProb_point_event]; unfold edgeProb; positivity
      exact (le_add_of_nonneg_left hz).trans (hv r z)
    · exact both r
  have hm : M.edgeMean m≤4 := by
    have integ := M.edgeMean_placeIntegral F l h u (fun e (r : CoordinateLevel M.Label) => if ¬r.consistent e then (1:ℝ) else 0)
    change M.edgeMean m = _ at integ
    calc
      M.edgeMean m = M.placeIntegral F l h u (fun r => M.edgeMean (fun e => if ¬r.consistent e then (1:ℝ) else 0)) := integ
      _ = M.placeIntegral F l h u M.inconsistentMass := by
        apply congrArg (M.placeIntegral F l h u); funext r
        apply Eq.trans _ (M.edgeMean_indicator (fun e => ¬r.consistent e))
        apply congrArg M.edgeMean; funext e
        by_cases z : r.consistent e <;> simp [z]
      _ ≤ 4 := hbad.trans (by nlinarith [Real.sq_sqrt (by norm_num : (0:ℝ)≤2),sq_nonneg (sqrt 2-2)])
  exact ⟨X0,m0,hX,hY,hm⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.36 The fixed-pair rare score gives the tail premise

Lean verified

In the setting of Theorem 4.35, fix a point p and two distinct incident centers q , r . Let R be the integral of the rare positive term for this pair minus its full bit disagreement. The rare positive term equals two when the record is good rare, p is exceptional, both edge bits are minority bits, and q , r share the selected-coordinate label. It vanishes otherwise. If R ≤ 2 log ⁡ 2 , then the fixed-pair width bound needed in Theorem 4.35 holds for p , q , r .

Proof

On each good rare level, 2 I p is bounded by three times the sum of the two center-exception and two edge-inconsistency indicators, plus the signed rare score. The cases with two consistent edges follow by checking whether the two centers have the dominant label. Elsewhere charge one for the discarded level. Integrating the pointwise inequality, the charge for discarded levels is at most ( S + ∫ m ) / ϵ . Combine ∫ m ≤ 2 2 , S > 2 2100 and R ≤ 2 log ⁡ 2 to absorb both charges into 2 S / ϵ . Theorem 4.41 proves this fixed-pair estimate on the physical records.

Inspect the Lean declarations

PlanarUnitDistances.Competition.IncidencePiece.width_pair_of_rare_score

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (F : Finset (NumberField.FinitePlace K)) (l h : AbsoluteValue K ℝ → ℝ) (u : NumberField.InfinitePlace K → ℝ)
  (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label),
  2 ^ 2100 < M.scale →
    M.placeIntegral F l h u M.minorityMass = M.scale →
      M.placeIntegral F l h u M.inconsistentMass ≤ 2 * √2 →
        ∀ (p q q' : PlanarUnitDistances.Competition.Plane),
          M.placeIntegral F l h u (M.rarePairScore d p q q') ≤ 2 * Real.log 2 →
            2 * M.vertexWidth F l h u d p ≤
              3 *
                  (M.vertexWidth F l h u d q + M.inconsistentLength F l h u (p, q) +
                    (M.vertexWidth F l h u d q' + M.inconsistentLength F l h u (p, q'))) +
                2 * M.scale / PlanarUnitDistances.Competition.eps
Lean source · PlanarUnitDistances/FixedPairWidth.lean, lines 10–65
/-- Converting the fixed-pair product-formula estimate in manuscript (budnew-rarealone)
to the distinct-neighbor width inequality used by the edge-truncation argument. -/
theorem width_pair_of_rare_score (M : IncidencePiece K) (F : Finset (FinitePlace K))
    (l h : AbsoluteValue K ℝ→ℝ) (u : InfinitePlace K→ℝ) (d : CoordinateLevel M.Label→M.Label)
    (hS : (2:ℝ)^2100 < M.scale) (hmin : M.placeIntegral F l h u M.minorityMass=M.scale)
    (hbad : M.placeIntegral F l h u M.inconsistentMass≤2*sqrt 2)
    (p q q' : Plane) (hscore : M.placeIntegral F l h u (M.rarePairScore d p q q')≤2*log 2) :
    2*M.vertexWidth F l h u d p ≤ 3*(M.vertexWidth F l h u d q+M.inconsistentLength F l h u (p,q)+
      (M.vertexWidth F l h u d q'+M.inconsistentLength F l h u (p,q')))+2*M.scale/eps := by
  let L := M.placeLinear F l h u
  have Lmono {v w : CoordinateLevel M.Label→ℝ} (z : ∀r,v r≤w r) : L v ≤ L w := by
    dsimp [L]
    rw [placeLinear_apply,placeLinear_apply]
    exact M.placeIntegral_mono F l h u z
  let outside (r : CoordinateLevel M.Label) : ℝ := if M.goodRare r then 0 else 1
  let err (e : Plane×Plane) (r : CoordinateLevel M.Label) := r.errorAt e
  have err_eq (e : Plane×Plane) : L (err e) = M.inconsistentLength F l h u e := by
    rw [show L (err e)=M.placeIntegral F l h u (err e) from M.placeLinear_apply F l h u _]
    apply congrArg (M.placeIntegral F l h u)
    funext r
    by_cases c : r.consistent e <;> simp [err,CoordinateLevel.errorAt,c]
  let W := M.endpointWidth d
  have wx (x : Plane) : L (W x)=M.vertexWidth F l h u d x := M.placeLinear_apply F l h u _
  have pt : L ((2:ℝ) • W p) ≤ L ((3:ℝ) • (W q+W q'+err (p,q)+err (p,q'))+
        M.rarePairScore d p q q'+outside) :=
    Lmono (M.rare_pair_lower_record d p q q')
  simp only [map_smul,map_add,smul_eq_mul,wx,err_eq] at pt
  have ep : 0<eps := by unfold eps; positivity
  have ep1 : eps≤1 := by unfold eps; apply Real.rpow_le_one_of_one_le_of_nonpos <;> norm_num
  have Lmin : L M.minorityMass=M.scale := (M.placeLinear_apply F l h u _).trans hmin
  have Lbad : L M.inconsistentMass≤4 := (M.placeLinear_apply F l h u _).trans_le (hbad.trans
    (by nlinarith [sq_sqrt (by norm_num : (0:ℝ)≤2),sq_nonneg (sqrt 2-2)]))
  have mass : L (eps • outside) ≤ L (M.minorityMass+M.inconsistentMass) := by
    apply Lmono
    intro r
    have f : 0≤M.minorityMass r := by unfold minorityMass edgeProb; positivity
    have m : 0≤M.inconsistentMass r := by unfold inconsistentMass edgeProb; positivity
    change eps*outside r ≤ M.minorityMass r+M.inconsistentMass r
    by_cases hr : M.goodRare r
    · simp [outside,hr,add_nonneg f m]
    · simp only [outside,ite_eq_right hr,mul_one]
      change ¬(M.minorityMass r<eps ∧ M.inconsistentMass r≤eps) at hr
      rcases not_and_or.mp hr with a | a
      · linarith [le_of_not_gt a]
      · linarith [lt_of_not_ge a]
  simp only [map_smul,smul_eq_mul,map_add,Lmin] at mass
  have sc : L (M.rarePairScore d p q q')≤2*log 2 := (M.placeLinear_apply F l h u _).trans_le hscore
  have S8 : 8≤M.scale := (show (8:ℝ)=2^3 by norm_num).trans_le
    ((pow_le_pow_right₀ (by norm_num : (1:ℝ)≤2) (by decide : (3:ℕ)≤2100)).trans hS.le)
  have log2 : log 2≤1 := by linarith [log_le_sub_one_of_pos (by norm_num : (0:ℝ)<2)]
  have budget : L (M.rarePairScore d p q q')+L outside≤2*M.scale/eps := by
    apply (le_div_iff₀ ep).mpr
    have loge := mul_le_mul_of_nonneg_right (sc.trans (mul_le_mul_of_nonneg_left log2 (by norm_num : (0:ℝ)≤2))) ep.le
    rw [add_mul]
    linarith only [mass,Lbad,loge,ep1,S8]
  linarith only [pt,budget]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.IncidencePiece.rare_pair_lower_record

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label)
  (p q q' : PlanarUnitDistances.Competition.Plane)
  (r : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label),
  2 * M.endpointWidth d p r ≤
    3 * (M.endpointWidth d q r + M.endpointWidth d q' r + r.errorAt (p, q) + r.errorAt (p, q')) +
        M.rarePairScore d p q q' r +
      if M.goodRare r then 0 else 1
Lean source · PlanarUnitDistances/FixedPairRecord.lean, lines 26–62
/-- The pointwise rare lower bound, prior to integration or the product
formula. It includes both inconsistency flags and all excluded levels. -/
theorem rare_pair_lower_record (M : IncidencePiece K) (d : CoordinateLevel M.Label → M.Label)
    (p q q' : Plane) (r : CoordinateLevel M.Label) :
    2*M.endpointWidth d p r ≤
     3*(M.endpointWidth d q r+M.endpointWidth d q' r+r.errorAt (p,q)+r.errorAt (p,q'))+
       M.rarePairScore d p q q' r+(if M.goodRare r then 0 else 1) := by
  have hbit : |bitValue (r.bit (p,q))-bitValue (r.bit (p,q'))| ≤ 1 := by
    cases h1 : r.bit (p,q) <;> cases h2 : r.bit (p,q') <;> norm_num [bitValue]
  have err (e : Plane×Plane) : 0 ≤ r.errorAt e := by unfold CoordinateLevel.errorAt; split <;> norm_num
  by_cases good : M.goodRare r
  · simp only [endpointWidth,masked,ite_eq_left good,add_zero,rarePairScore]
    have non (x : Plane) : 0≤r.exceptionAt (d r) x := by unfold CoordinateLevel.exceptionAt; split <;> norm_num
    have maxp : r.exceptionAt (d r) p≤1 := by unfold CoordinateLevel.exceptionAt; split <;> norm_num
    have plus : 0≤M.rarePairPositive d p q q' r := by unfold rarePairPositive; split <;> norm_num
    by_cases clean : r.selected q=d r ∧ r.selected q'=d r ∧ r.consistent (p,q) ∧ r.consistent (p,q')
    · obtain ⟨hq,hq',c,c'⟩ := clean
      have eq1 := edge_bit_iff r c
      have eq2 := edge_bit_iff r c'
      rw [hq] at eq1; rw [hq'] at eq2
      have same : r.bit (p,q)=r.bit (p,q') := by
        cases z : r.majority <;> cases b : r.bit (p,q) <;> cases b' : r.bit (p,q') <;> simp_all
      by_cases hp : r.selected p=d r
      · simp only [same,sub_self,abs_zero,sub_zero]
        simp [rarePairPositive,CoordinateLevel.exceptionAt,hp,hq,hq',CoordinateLevel.errorAt,c,c']
      · have b1 := (not_congr eq1).mpr hp
        have b2 := (not_congr eq2).mpr hp
        simp only [same,sub_self,abs_zero,sub_zero]
        norm_num [rarePairPositive,CoordinateLevel.exceptionAt,hp,hq,hq',CoordinateLevel.errorAt,c,c',good,b1,b2]
    · have unit : 1≤r.exceptionAt (d r) q +r.exceptionAt (d r) q'+r.errorAt (p,q)+r.errorAt (p,q') := by
        by_cases h1 : r.selected q=d r <;> by_cases h2 : r.selected q'=d r <;>
          by_cases h3 : r.consistent (p,q) <;> by_cases h4 : r.consistent (p,q') <;>
          simp_all [CoordinateLevel.exceptionAt,CoordinateLevel.errorAt] <;> norm_num
      linarith only [unit,hbit,maxp,plus]
  · simp only [endpointWidth,masked,ite_eq_right good,zero_add,mul_zero,rarePairScore]
    simp only [rarePairPositive,good,false_and,ite_false,zero_sub]
    linarith only [hbit,err (p,q),err (p,q')]

Kernel axioms used: propext, Classical.choice, Quot.sound.

4.7 Recovering the original walk moments

Lemma 4.37 The physical graph is the original graph

Lean verified

Given the original common-field model of P , Q , take its own number field and the full set of pairs ( p , q ) ∈ P × Q with ‖ p − q ‖ = 1 . This defines the incidence-piece representation used in the rare-level estimates. Its complex null coordinates agree on every point and center with the given model. For every triple ( p , q , r ) its ratio is exactly

z ( p ) − z ( q ) z ( r ) − z ( q ) .
Proof

Use the specified embedding of the original number field into C . Both null coordinates of each vertex belong to the field, as does i . Their sum divided by two and their difference divided by 2 i give the two real coordinates, so each is algebraic over Q . The edge predicate includes every eligible unit edge. Substitution of the equal point and center coordinates gives equality of the ratios in the number field before taking any local logarithms. The atom computation in Lemma 4.24 applies to this concrete model. For every local absolute value v and every real threshold s , the fraction computed by filtering its edges agrees with the uniformly weighted sum on the original graph. Thus the two minority fractions agree separately at each level, including a level equal to an edge threshold. The original symmetric window contains every edge threshold. Integrating gives equality of the local widths at every absolute value. Summing with the archimedean multiplicities and the finite-place weights and dividing by the field degree gives equality of the two global scales.

Inspect the Lean declarations

PlanarUnitDistances.ResearchPhysical.scale_eq

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q),
  0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q →
    (PlanarUnitDistances.ResearchPhysical.toPiece M).scale = PlanarUnitDistances.ProofAssembly.pieceScale M
Lean source · PlanarUnitDistances/ResearchScaleEquality.lean, lines 12–22
/-- The scale in the all-place moment calculation is exactly the large
height S in the original manuscript, including its finite-place weights. -/
theorem scale_eq (M : Model P Q) (he : 0 < incidences P Q) : (toPiece M).scale=pieceScale M := by
  unfold Competition.IncidencePiece.scale pieceScale profileScale placeSum
  apply congrArg (fun u : ℝ => u / Module.finrank ℚ M.field)
  apply congrArg₂ (· + ·)
  · apply Finset.sum_congr rfl
    intro v _
    exact congrArg (fun z : ℝ => (v.mult : ℝ)*z) (local_width_eq M he v.1)
  · apply congrArg finsum
    exact funext (fun v : FinitePlace M.field => local_width_eq M he v.1)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.toPiece

{P Q : Finset PlanarUnitDistances.Competition.Plane} →
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q) →
    PlanarUnitDistances.Competition.IncidencePiece ↥M.field
Lean source · PlanarUnitDistances/ResearchPhysicalModel.lean, lines 39–57
/-- The exact graph and the exact field from the original large-height
piece, including all unit edges on P by Q and the same two null coordinates. -/
def toPiece (M : Model P Q) : Competition.IncidencePiece M.field where
  P := P
  Q := Q
  E := (P×ˢQ).filter (fun e => dist e.1 e.2=1)
  membership := filter_subset _ _
  algebraic := fun _ hp => real_coordinates M hp
  unit := fun e h => (mem_filter.mp h).2
  embedding := M.field.val.toRingHom
  imaginaryUnit := ⟨Complex.I,M.i_mem⟩
  imaginaryUnit_spec := rfl
  Z := fun p => liftCoord M (zCoord p)
  W := fun p => liftCoord M (star (zCoord p))
  coordinates := by
    intro p hp
    obtain ⟨a,b⟩ := coord_mem M hp
    change (liftCoord M (zCoord p) : ℂ)=zCoord p ∧ (liftCoord M (star (zCoord p)) : ℂ)=star (zCoord p)
    simp only [liftCoord,dif_pos a,dif_pos b,and_self]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.full

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q),
  PlanarUnitDistances.Competition.IncidencePiece.Research.Full
    (PlanarUnitDistances.ResearchPhysical.toPiece M)
Lean source · PlanarUnitDistances/ResearchPhysicalModel.lean, lines 59–60
theorem full (M : Model P Q) : Competition.IncidencePiece.Research.Full (toPiece M) :=
  fun _ hp _ hq d => mem_filter.mpr ⟨mem_product.mpr ⟨hp,hq⟩,d⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.z_point

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q) (p : ↥P),
  (PlanarUnitDistances.ResearchPhysical.toPiece M).Z ↑p = M.z (Sum.inl p)
Lean source · PlanarUnitDistances/ResearchPhysicalModel.lean, lines 62–64
theorem z_point (M : Model P Q) (p : P) : (toPiece M).Z p=M.z (.inl p) := by
  apply Subtype.ext
  exact ((toPiece M).coordinates _ (mem_union_left _ p.prop)).1.trans (M.z_eq (.inl p)).symm

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.z_center

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q) (q : ↥Q),
  (PlanarUnitDistances.ResearchPhysical.toPiece M).Z ↑q = M.z (Sum.inr q)
Lean source · PlanarUnitDistances/ResearchPhysicalModel.lean, lines 66–68
theorem z_center (M : Model P Q) (q : Q) : (toPiece M).Z q=M.z (.inr q) := by
  apply Subtype.ext
  exact ((toPiece M).coordinates _ (mem_union_right _ q.prop)).1.trans (M.z_eq (.inr q)).symm

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.ratio

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q) (p r : ↥P) (q : ↥Q),
  PlanarUnitDistances.Competition.tripleRatio (PlanarUnitDistances.ResearchPhysical.toPiece M) (p, q, r) =
    (M.z (Sum.inl p) - M.z (Sum.inr q)) / (M.z (Sum.inl r) - M.z (Sum.inr q))
Lean source · PlanarUnitDistances/ResearchPhysicalModel.lean, lines 70–74
theorem ratio (M : Model P Q) (p r : P) (q : Q) :
    Competition.tripleRatio (toPiece M) (p,q,r)=
      (M.z (.inl p)-M.z (.inr q))/(M.z (.inl r)-M.z (.inr q)) := by
  unfold Competition.tripleRatio
  rw [z_point,z_center,z_point]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.edgeProb_eq_sum

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
  (A : PlanarUnitDistances.Competition.Plane × PlanarUnitDistances.Competition.Plane → Prop),
  (PlanarUnitDistances.ResearchPhysical.toPiece M).edgeProb A =
    ∑ x,
      if dist ↑x.1 ↑x.2 = 1 ∧ A (↑x.1, ↑x.2) then (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q)⁻¹
      else 0
Lean source · PlanarUnitDistances/ResearchThresholds.lean, lines 19–33
theorem edgeProb_eq_sum (M : Model P Q) (A : Competition.Plane×Competition.Plane → Prop) :
    (toPiece M).edgeProb A = ∑ x : P×Q,
      if dist x.1.val x.2.val=1 ∧ A (x.1.val,x.2.val) then (incidences P Q)⁻¹ else 0 := by
  let d := incidences P Q
  let h (x : Competition.Plane × Competition.Plane) := dist x.1 x.2=1 ∧ A x
  let f (x : Competition.Plane × Competition.Plane) : ℝ := if h x then d⁻¹ else 0
  change _ = ∑ x : P×Q, f (x.1.val,x.2.val)
  rw [sum_vertices]
  unfold Competition.IncidencePiece.edgeProb
  rw [Competition.IncidencePiece.Research.edge_count _ (full M)]
  change ((((P×ˢQ).filter (fun x => dist x.1 x.2=1)).filter A).card:ℝ)/d=_
  simp only [filter_filter]
  change (((P×ˢQ).filter h).card:ℝ)/d=∑ x∈P×ˢQ,if h x then d⁻¹ else 0
  rw [←sum_filter]
  simp [div_eq_mul_inv]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.frequency_at_level

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q) (v : AbsoluteValue ↥M.field ℝ) (s : ℝ),
  (PlanarUnitDistances.ResearchPhysical.toPiece M).frequencyMinority (fun x => v x) s =
    OAI.PlanarUnitDistances.ThresholdProfiles.minority
      (fun x => if dist ↑x.1 ↑x.2 = 1 then (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q)⁻¹ else 0)
      (fun x => if dist ↑x.1 ↑x.2 = 1 then -Real.log (v (M.z (Sum.inl x.1) - M.z (Sum.inr x.2))) else 0) s
Lean source · PlanarUnitDistances/ResearchThresholds.lean, lines 35–53
/-- The exact minority frequency at each place and each real level agrees
in the physical record and the original uniform bipartite graph. -/
theorem frequency_at_level (M : Model P Q) (v : AbsoluteValue M.field ℝ) (s : ℝ) :
    (toPiece M).frequencyMinority (fun x => v x) s =
      minority (fun x : P×Q => if dist x.1.val x.2.val=1 then (incidences P Q)⁻¹ else 0)
        (fun x : P×Q => if dist x.1.val x.2.val=1 then
          -Real.log (v (M.z (.inl x.1)-M.z (.inr x.2))) else 0) s := by
  unfold Competition.IncidencePiece.frequencyMinority minority
  suffices (toPiece M).edgeProb (fun e => s<(toPiece M).threshold (fun x => v x) e)=_ by
    rw [this]
  rw [edgeProb_eq_sum]
  unfold frequency
  apply sum_congr rfl
  intro x _
  rcases x with ⟨p,q⟩
  by_cases h : dist p.val q.val=1
  · by_cases b : s < -Real.log (v (M.z (.inl p)-M.z (.inr q))) <;>
      simp [h,Competition.IncidencePiece.threshold,z_point,z_center,bit,b]
  · simp [h]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.local_width_eq

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q),
  0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q →
    ∀ (v : AbsoluteValue ↥M.field ℝ),
      ((PlanarUnitDistances.ResearchPhysical.toPiece M).localWidth fun x => v x) =
        have r := PlanarUnitDistances.profileRadius (PlanarUnitDistances.unitRows P Q) M.z M.w;
        PlanarUnitDistances.EdgeHeightScale.minorityIntegral
          (fun x =>
            PlanarUnitDistances.UniformNormalization.weight (PlanarUnitDistances.unitRows P Q)
              (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) x.1 x.2)
          (PlanarUnitDistances.UniformNormalization.direction (PlanarUnitDistances.unitRows P Q) M.z)
          (fun w => -r w) r v
Lean source · PlanarUnitDistances/ResearchLocalWidth.lean, lines 15–47
/-- Equality at every local absolute value, with the research graph's
actual symmetric integration window. -/
theorem local_width_eq (M : Model P Q) (he : 0 < incidences P Q) (v : AbsoluteValue M.field ℝ) :
    (toPiece M).localWidth (fun x => v x)=
      let r := profileRadius (unitRows P Q) M.z M.w
      minorityIntegral (fun x : P×Q => weight (unitRows P Q) (incidences P Q) x.1 x.2) (direction (unitRows P Q) M.z)
        (fun w => -r w) r v := by
  let r := profileRadius (unitRows P Q) M.z M.w
  have pos : 0<((toPiece M).E.card:ℝ) := by rwa [Competition.IncidencePiece.Research.edge_count _ (full M)]
  have within e (h : e∈(toPiece M).E) : |(toPiece M).threshold (fun a => v a) e|≤r v := by
    obtain ⟨p,q⟩ := e
    obtain ⟨pq,d⟩ := Finset.mem_filter.mp h
    obtain ⟨hp,hq⟩ := Finset.mem_product.mp pq
    let a : P := ⟨p,hp⟩
    let b : Q := ⟨q,hq⟩
    have ab := (radius_bounds (unitRows P Q) M.z M.w v).1 (a,b)
    change |-Real.log (v ((toPiece M).Z a-(toPiece M).Z b))|≤r v
    rw [z_point,z_center]
    simpa only [threshold,direction,if_pos ((member a b).mpr d)] using ab
  rw [←Competition.IncidencePiece.window_width _ pos _ (-r v) (r v)
    (fun e h => (abs_le.mp (within e h)).1) (fun e h => (abs_le.mp (within e h)).2)]
  apply integral_congr_ae
  apply Filter.Eventually.of_forall
  intro s
  rw [frequency_at_level]
  have wt : weight (unitRows P Q) (incidences P Q)=fun x q =>
      if dist x.val q.val=1 then (incidences P Q)⁻¹ else 0 := by
    funext p q; simp only [weight,member]
  have th : threshold v (direction (unitRows P Q) M.z)=fun x : P×Q =>
      if dist x.1.val x.2.val=1 then -Real.log (v (M.z (.inl x.1)-M.z (.inr x.2))) else 0 := by
    funext x
    by_cases h : dist x.1.val x.2.val=1 <;> simp [threshold,direction,member,h]
  simp only [wt,th]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.38 The two coordinate partitions agree at every original level

Lean verified

Tag points and centers by the disjoint union P ⊔ Q , and forget the tag to obtain their physical plane positions. At every real threshold level s , each of the two physical coordinate classes of any pair of tagged vertices agrees exactly when their corresponding posterior-model classes agree. The assertion holds at every finite and infinite place, for arbitrary archimedean shifts, including at grid and ball boundaries.

Proof

The two z , w values agree in the original number field at each tagged vertex. For the z coordinate, both grid constructions take the real and imaginary parts of the image under the same embedding, divide by e − s , add the corresponding fractional shifts and take floors. For w both use e s . The finite-place constructions use identical closed ultrametric balls in the two respective coordinates. These identities also handle a point of P ∩ Q with different tags.

Inspect the Lean declarations

PlanarUnitDistances.ResearchPhysical.finite_coordinate_classes

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q) (v : NumberField.FinitePlace ↥M.field) (s : ℝ)
  (x y : ↥P ⊕ ↥Q),
  have a := ((PlanarUnitDistances.ResearchPhysical.toPiece M).finiteRecord v) s;
  have b := OAI.PlanarUnitDistances.PhysicalLabels.finitePair v M.z M.w s;
  ((a.label (PlanarUnitDistances.ResearchPhysical.planeVertex x)).1 =
        (a.label (PlanarUnitDistances.ResearchPhysical.planeVertex y)).1 ↔
      (b x).1 = (b y).1) ∧
    ((a.label (PlanarUnitDistances.ResearchPhysical.planeVertex x)).2 =
        (a.label (PlanarUnitDistances.ResearchPhysical.planeVertex y)).2 ↔
      (b x).2 = (b y).2)
Lean source · PlanarUnitDistances/ResearchCellIdentification.lean, lines 45–56
/-- At a finite place the same assertion is equality of ultrametric
ball membership for the original coordinates, with the boundary included. -/
theorem finite_coordinate_classes (M : Model P Q) (v : FinitePlace M.field)
    (s : ℝ) (x y : P⊕Q) :
    let a := (toPiece M).finiteRecord v s
    let b := finitePair v M.z M.w s
    ((a.label (planeVertex x)).1=(a.label (planeVertex y)).1 ↔ (b x).1=(b y).1) ∧
    ((a.label (planeVertex x)).2=(a.label (planeVertex y)).2 ↔ (b x).2=(b y).2) := by
  dsimp only
  obtain ⟨z,w⟩ := (toPiece M).finite_matches v s _ _ (planeVertex_mem x) (planeVertex_mem y)
  rw [z,w]
  simp only [finitePair,finiteLabel_eq,finiteMatch,vertex_z,vertex_w,and_self,iff_self]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.arch_coordinate_classes

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q) (v : NumberField.InfinitePlace ↥M.field)
  (U V : ℝ × ℝ) (s : ℝ) (x y : ↥P ⊕ ↥Q),
  have a := ((PlanarUnitDistances.ResearchPhysical.toPiece M).archRecord v U V) s;
  have b := OAI.PlanarUnitDistances.PhysicalLabels.archPair v U V M.z M.w s;
  ((a.label (PlanarUnitDistances.ResearchPhysical.planeVertex x)).1 =
        (a.label (PlanarUnitDistances.ResearchPhysical.planeVertex y)).1 ↔
      (b x).1 = (b y).1) ∧
    ((a.label (PlanarUnitDistances.ResearchPhysical.planeVertex x)).2 =
        (a.label (PlanarUnitDistances.ResearchPhysical.planeVertex y)).2 ↔
      (b x).2 = (b y).2)
Lean source · PlanarUnitDistances/ResearchCellIdentification.lean, lines 32–43
/-- Equality of each coordinate class in the two record encodings,
at an arbitrary shift and level of the original infinite place. -/
theorem arch_coordinate_classes (M : Model P Q) (v : InfinitePlace M.field)
    (U V : ℝ×ℝ) (s : ℝ) (x y : P⊕Q) :
    let a := (toPiece M).archRecord v U V s
    let b := archPair v U V M.z M.w s
    ((a.label (planeVertex x)).1=(a.label (planeVertex y)).1 ↔ (b x).1=(b y).1) ∧
    ((a.label (planeVertex x)).2=(a.label (planeVertex y)).2 ↔ (b x).2=(b y).2) := by
  dsimp only
  obtain ⟨z,w⟩ := (toPiece M).arch_matches v U V s _ _ (planeVertex_mem x) (planeVertex_mem y)
  rw [z,w]
  simp only [archPair,archLabel_eq,archMatch,GridShift.gridLabel,IncidencePiece.grid,vertex_z,vertex_w,and_self,iff_self]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.39 The posterior and physical records have the same rare and inconsistency masses

Lean verified

Fix a nonempty original incidence graph. At each place and level use the same two shifts and the same threshold in its arithmetic and posterior records. The two distributions of a single supported edge have identical threshold bits. The arithmetic majority bit is the complement of the posterior rare bit, including when the frequency is 1 / 2 . Both records have exactly the same minority probability f and exactly the same edge-inconsistency probability m at this level.

Proof

Both one-edge laws put the mass 1 / | E | on each original incidence. For an incident edge the grid or ultrametric construction evaluates the same test s < − log ⁡ | z p − z q | v . Thus the two frequencies of bit one are equal. The majority rule tests whether this frequency exceeds 1 / 2 , while the rare rule tests whether it is at most 1 / 2 . The two coordinate equivalence relations agree for the tagged point and center. For each bit value, consistency tests exactly one coordinate equality and one inequality under both encodings. Averaging the resulting equal indicators gives the asserted identity for m .

Inspect the Lean declarations

PlanarUnitDistances.ResearchPhysical.RecordAgreement.rare_masses

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  {M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q}
  {b :
    PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel
      (PlanarUnitDistances.ResearchPhysical.toPiece M).Label}
  {t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q},
  PlanarUnitDistances.ResearchPhysical.RecordAgreement M b t →
    ∀ (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q),
      (PlanarUnitDistances.ResearchPhysical.toPiece M).minorityMass b =
          OAI.PlanarUnitDistances.PhysicalLevels.minority
            (PlanarUnitDistances.ResearchPhysical.incidenceLaw P Q he) t ∧
        (PlanarUnitDistances.ResearchPhysical.toPiece M).inconsistentMass b =
          OAI.PlanarUnitDistances.CommonTemplate.inconsistency
            (PlanarUnitDistances.ResearchPhysical.incidenceLaw P Q he) t.bit t.x t.y
Lean source · PlanarUnitDistances/ResearchRecordAgreement.lean, lines 73–92
theorem RecordAgreement.rare_masses {M : Model P Q} {b : CoordinateLevel (toPiece M).Label} {t : Record P Q}
    (H : RecordAgreement M b t) (he : 0 < incidences P Q) :
    (toPiece M).minorityMass b=minority (incidenceLaw P Q he) t ∧
    (toPiece M).inconsistentMass b=inconsistency (incidenceLaw P Q he) t.bit t.x t.y := by
  let π := incidenceLaw P Q he
  constructor
  · rw [←minority_probability]
    apply physical_event M he
    intro p q h
    rw [H.bits p q h,H.rare_bit he]
    cases t.bit p q <;> cases rareBit (incidenceLaw P Q he) t <;> decide
  · apply physical_event M he
    intro p q h
    apply not_congr
    obtain ⟨z,w⟩ := H.classes (.inl p) (.inr q)
    change ((b.label p.val).1=(b.label q.val).1 ↔ (t.x p).1=(t.y q).1) at z
    change ((b.label p.val).2=(b.label q.val).2 ↔ (t.x p).2=(t.y q).2) at w
    unfold CoordinateLevel.consistent Consistent
    rw [H.bits p q h]
    cases t.bit p q <;> simp [z,w,and_comm]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.arch_agreement

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q) (v : NumberField.InfinitePlace ↥M.field)
  (U V : ℝ × ℝ) (s : ℝ),
  PlanarUnitDistances.ResearchPhysical.RecordAgreement M
    (((PlanarUnitDistances.ResearchPhysical.toPiece M).archRecord v U V) s)
    (OAI.PlanarUnitDistances.PhysicalLevels.arch v U V M.z M.w s)
Lean source · PlanarUnitDistances/ResearchRecordAgreement.lean, lines 23–33
theorem arch_agreement (M : Model P Q) (v : InfinitePlace M.field) (U V : ℝ×ℝ) (s : ℝ) :
    RecordAgreement M ((toPiece M).archRecord v U V s) (arch v U V M.z M.w s) := by
  refine ⟨?_,rfl,?_⟩
  · intro p q h
    rw [arch_bit _ _ _ _ _ _ (full M p p.prop q q.prop h)]
    change decide (s < -Real.log (v ((toPiece M).Z p-(toPiece M).Z q)))=_
    rw [z_point,z_center]; rfl
  · intro x y
    have eq (a : P⊕Q) : tagState (arch v U V M.z M.w s) a=PhysicalLabels.archPair v U V M.z M.w s a := by
      cases a <;> rfl
    rw [eq,eq]; exact arch_coordinate_classes M v U V s x y

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.finite_agreement

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q) (v : NumberField.FinitePlace ↥M.field) (s : ℝ),
  PlanarUnitDistances.ResearchPhysical.RecordAgreement M
    (((PlanarUnitDistances.ResearchPhysical.toPiece M).finiteRecord v) s)
    (OAI.PlanarUnitDistances.PhysicalLevels.finite v M.z M.w s)
Lean source · PlanarUnitDistances/ResearchRecordAgreement.lean, lines 35–45
theorem finite_agreement (M : Model P Q) (v : FinitePlace M.field) (s : ℝ) :
    RecordAgreement M ((toPiece M).finiteRecord v s) (PhysicalLevels.finite v M.z M.w s) := by
  refine ⟨?_,rfl,?_⟩
  · intro p q h
    rw [finite_edge_bit _ _ _ _ (full M p p.prop q q.prop h)]
    change decide (s < -Real.log (v ((toPiece M).Z p-(toPiece M).Z q)))=_
    rw [z_point,z_center]; rfl
  · intro x y
    have eq (a : P⊕Q) : tagState (PhysicalLevels.finite v M.z M.w s) a=PhysicalLabels.finitePair v M.z M.w s a := by
      cases a <;> rfl
    rw [eq,eq]; exact finite_coordinate_classes M v s x y

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.RecordAgreement.rare_bit

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  {M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q}
  {b :
    PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel
      (PlanarUnitDistances.ResearchPhysical.toPiece M).Label}
  {t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q},
  PlanarUnitDistances.ResearchPhysical.RecordAgreement M b t →
    ∀ (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q),
      b.majority =
        !OAI.PlanarUnitDistances.PhysicalLevels.rareBit
            (PlanarUnitDistances.ResearchPhysical.incidenceLaw P Q he) t
Lean source · PlanarUnitDistances/ResearchRecordAgreement.lean, lines 61–71
theorem RecordAgreement.rare_bit {M : Model P Q} {b : CoordinateLevel (toPiece M).Label} {t : Record P Q}
    (H : RecordAgreement M b t) (he : 0 < incidences P Q) : b.majority= !(rareBit (incidenceLaw P Q he) t) := by
  let π := incidenceLaw P Q he
  have eq := physical_event M he (fun e => b.bit e=true) (fun pq => t.bit pq.1 pq.2=true)
    (fun p q h => by rw [H.bits p q h])
  rw [H.majority,eq]
  unfold rareBit
  change decide (1/2<event π (fun pq => t.bit pq.1 pq.2=true)) = !decide (event π (fun pq => t.bit pq.1 pq.2=true)≤1/2)
  by_cases h : event π (fun pq => t.bit pq.1 pq.2=true)≤1/2
  · simp only [h,not_lt_of_ge h,decide_false,decide_true,Bool.not_true]
  · simp only [h,lt_of_not_ge h,decide_false,decide_true,Bool.not_false]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.40 Inconsistency integrated over the original profile

Lean verified

Fix the original incidence edge law, its finite prime support and its symmetric profile intervals. For every family u v of real shifts at infinite places, set both two-dimensional shifts to ( u v , u v ) . The integrated physical inconsistency is precisely the integral of the posterior edge-inconsistency probability with respect to these original records.

Proof

At each finite and infinite place the two integrands agree at every level. Both constructions integrate over the same interval and use the same local multiplicities and number-field normalization.

Inspect the Lean declarations

PlanarUnitDistances.ResearchPhysical.inconsistency_integral_eq

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
  (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q)
  (u : NumberField.InfinitePlace ↥M.field → ℝ),
  have r := PlanarUnitDistances.profileRadius (PlanarUnitDistances.unitRows P Q) M.z M.w;
  (PlanarUnitDistances.ResearchPhysical.toPiece M).placeIntegral
      (PlanarUnitDistances.UniformPhysical.primes (PlanarUnitDistances.unitRows P Q) M.z M.w) (fun v => -r v)
      r u (PlanarUnitDistances.ResearchPhysical.toPiece M).inconsistentMass =
    ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
      OAI.PlanarUnitDistances.CommonTemplate.inconsistency
        (PlanarUnitDistances.ResearchPhysical.incidenceLaw P Q he) t.bit t.x
        t.y ∂PlanarUnitDistances.UniformPhysical.fullMeasure (PlanarUnitDistances.unitRows P Q) M.z M.w
        (fun v => (u v, u v)) fun v => (u v, u v)
Lean source · PlanarUnitDistances/ResearchInconsistencyIntegral.lean, lines 26–31
theorem inconsistency_integral_eq (M : Model P Q) (he : 0 < incidences P Q) (u : InfinitePlace M.field → ℝ) :
    let r := profileRadius (unitRows P Q) M.z M.w
    (toPiece M).placeIntegral (primes (unitRows P Q) M.z M.w) (fun v => -r v) r u (toPiece M).inconsistentMass =
      ∫t,inconsistency (incidenceLaw P Q he) t.bit t.x t.y
        ∂fullMeasure (unitRows P Q) M.z M.w (fun v => (u v,u v)) (fun v => (u v,u v)) :=
  integral_of_record_agreement M u _ _ (fun _ _ a => (a.rare_masses he).2)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.integral_of_record_agreement

∀ {P Q : Finset PlanarUnitDistances.Competition.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q) (u : NumberField.InfinitePlace ↥M.field → ℝ)
  (f :
    PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel
        (PlanarUnitDistances.ResearchPhysical.toPiece M).Label →
      ℝ)
  (g : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q → ℝ),
  (∀
      (b :
        PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel
          (PlanarUnitDistances.ResearchPhysical.toPiece M).Label)
      (t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
      PlanarUnitDistances.ResearchPhysical.RecordAgreement M b t → f b = g t) →
    have r := PlanarUnitDistances.profileRadius (PlanarUnitDistances.unitRows P Q) M.z M.w;
    (PlanarUnitDistances.ResearchPhysical.toPiece M).placeIntegral
        (PlanarUnitDistances.UniformPhysical.primes (PlanarUnitDistances.unitRows P Q) M.z M.w)
        (fun v => -r v) r u f =
      ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
        g
          t ∂PlanarUnitDistances.UniformPhysical.fullMeasure (PlanarUnitDistances.unitRows P Q) M.z M.w
          (fun v => (u v, u v)) fun v => (u v, u v)
Lean source · PlanarUnitDistances/ResearchInconsistencyIntegral.lean, lines 12–24
/-- The two original constructions use the same normalized interval
integrals whenever their per-record integrands agree. -/
theorem integral_of_record_agreement (M : Model P Q) (u : InfinitePlace M.field → ℝ)
    (f : CoordinateLevel (toPiece M).Label → ℝ) (g : Record P Q → ℝ)
    (eq : ∀b t,RecordAgreement M b t → f b=g t) :
    let r := profileRadius (unitRows P Q) M.z M.w
    (toPiece M).placeIntegral (primes (unitRows P Q) M.z M.w) (fun v => -r v) r u f =
      ∫t, g t ∂fullMeasure (unitRows P Q) M.z M.w (fun v => (u v,u v)) (fun v => (u v,u v)) := by
  have a (v : InfinitePlace M.field) (s : ℝ) := eq _ _ (arch_agreement M v (u v,u v) (u v,u v) s)
  have k (v : FinitePlace M.field) (s : ℝ) := eq _ _ (finite_agreement M v s)
  dsimp only
  unfold fullMeasure placeIntegral
  rw [integral_measure]; simp_rw [a,k]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 4.41 The fixed-pair rare bound on the original arithmetic records

Lean verified

For any number-field incidence piece, fix two distinct incident centers q , r of a point p . Use any physical shifts and dominant-label function, any place windows containing the edge thresholds, and any finite prime set containing the support of those thresholds. For these exact records the integral R of Lemma 4.36 satisfies R ≤ 2 log ⁡ 2 .

Proof

At a place v , write d = z p − z q , d ′ = z p − z r . The unit equations give d − 1 = w p − w q and ( d ′ ) − 1 = w p − w r . Distinctness of the original centers gives d ≠ d ′ . Sort their thresholds as b ≤ b ′ , and use T v from Lemma 4.5. At an archimedean place, equal square cells of side e s give coordinate difference at most 2 e s ≤ 2 e s . At a finite place the ultrametric difference is at most e s . The same estimates with − s apply to the other coordinate.

Write f v ( s ) for the actual fraction of edges whose threshold is strictly above s . It decreases with s . A positive rare score with minority bit one requires s ∈ [ b − T v , b ] and f v ( s ) < ϵ . With minority bit zero it requires s ∈ [ b ′ , b ′ + T v ] and f v ( s ) > 1 − ϵ . Since the former interval precedes the latter and ϵ ≤ 1 / 2 , both orientations cannot occur at this place. Thus the integral of the positive term is at most 2 T v , including when a flank extends beyond the chosen window. The entire bit discrepancy integrates to b ′ − b because the window contains the two thresholds. At an omitted finite place both thresholds vanish, so the omitted charge 2 T v is nonnegative. Summing the included charges and applying the product formula of Lemma 4.5 proves the assertion.

Inspect the Lean declarations

PlanarUnitDistances.ResearchPhysical.fixed_pair_width

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (F : Finset (NumberField.FinitePlace K)),
  (∀ v ∉ F, ∀ e ∈ M.E, M.threshold (⇑v) e = 0) →
    ∀ (l h : AbsoluteValue K ℝ → ℝ),
      (∀ (v : AbsoluteValue K ℝ), ∀ e ∈ M.E, l v ≤ M.threshold (⇑v) e) →
        (∀ (v : AbsoluteValue K ℝ), ∀ e ∈ M.E, M.threshold (⇑v) e ≤ h v) →
          ∀ (u : NumberField.InfinitePlace K → ℝ)
            (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label),
            2 ^ 2100 < M.scale →
              M.placeIntegral F l h u M.minorityMass = M.scale →
                M.placeIntegral F l h u M.inconsistentMass ≤ 2 * √2 →
                  ∀ {p q r : PlanarUnitDistances.Competition.Plane},
                    (p, q) ∈ M.E →
                      (p, r) ∈ M.E →
                        q ≠ r →
                          2 * M.vertexWidth F l h u d p ≤
                            3 *
                                (M.vertexWidth F l h u d q + M.inconsistentLength F l h u (p, q) +
                                  (M.vertexWidth F l h u d r + M.inconsistentLength F l h u (p, r))) +
                              2 * M.scale / PlanarUnitDistances.Competition.eps
Lean source · PlanarUnitDistances/ResearchFixedPairBudget.lean, lines 60–72
/-- Actual widths satisfy the inequality required by the tail theorem
without assuming a pair bound. -/
theorem fixed_pair_width (M : IncidencePiece K) (F : Finset (FinitePlace K))
    (active : ∀v∉F,∀e∈M.E,M.threshold v e=0) (l h : AbsoluteValue K ℝ → ℝ)
    (lo : ∀(v : AbsoluteValue K ℝ) e,e∈M.E → l v≤M.threshold v e)
    (hi : ∀(v : AbsoluteValue K ℝ) e,e∈M.E → M.threshold v e≤h v)
    (u : InfinitePlace K→ℝ) (d : CoordinateLevel M.Label→M.Label)
    (hS : (2:ℝ)^2100 < M.scale) (hmin : M.placeIntegral F l h u M.minorityMass=M.scale)
    (hbad : M.placeIntegral F l h u M.inconsistentMass≤2*sqrt 2)
    {p q r : Competition.Plane} (he : (p,q)∈M.E) (he' : (p,r)∈M.E) (hne : q≠r) :
    2*M.vertexWidth F l h u d p ≤ 3*(M.vertexWidth F l h u d q+M.inconsistentLength F l h u (p,q)+
      (M.vertexWidth F l h u d r+M.inconsistentLength F l h u (p,r)))+2*M.scale/eps :=
  M.width_pair_of_rare_score F l h u d hS hmin hbad p q r (fixed_pair_rare_budget M F active l h lo hi u d he he' hne)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.coordinate_matches

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (u : NumberField.InfinitePlace K → ℝ) (v : PlanarUnitDistances.Competition.IncidencePiece.Place K) (s : ℝ)
  (q r : PlanarUnitDistances.Competition.Plane),
  q ∈ M.P ∪ M.Q →
    r ∈ M.P ∪ M.Q →
      have t := (M.recordsAt u v) s;
      ((t.label q).1 = (t.label r).1 →
          (PlanarUnitDistances.Competition.IncidencePiece.valuation v) (M.Z q - M.Z r) ≤
            Real.exp (-s + PlanarUnitDistances.ResearchPhysical.flankConstant v)) ∧
        ((t.label q).2 = (t.label r).2 →
          (PlanarUnitDistances.Competition.IncidencePiece.valuation v) (M.W q - M.W r) ≤
            Real.exp (s + PlanarUnitDistances.ResearchPhysical.flankConstant v))
Lean source · PlanarUnitDistances/ResearchFlankCoordinates.lean, lines 23–43
/-- Physical equality in either stored coordinate gives the metric bounds
used for the two flanks, for the original shift and at this exact level. -/
theorem coordinate_matches (M : IncidencePiece K) (u : InfinitePlace K→ℝ) (v : Place K) (s : ℝ)
    (q r : Competition.Plane) (hq : q∈M.P∪M.Q) (hr : r∈M.P∪M.Q) :
    let t := M.recordsAt u v s
    ((t.label q).1=(t.label r).1 → valuation v (M.Z q-M.Z r)≤exp (-s+flankConstant v)) ∧
    ((t.label q).2=(t.label r).2 → valuation v (M.W q-M.W r)≤exp (s+flankConstant v)) := by
  cases v with
  | inl v =>
    have spec := M.arch_matches v (u v,u v) (u v,u v) s q r hq hr
    exact ⟨fun h => grid_norm v M.Z _ _ q r (spec.1.mp h),
      fun h => grid_norm v M.W _ _ q r (spec.2.mp h)⟩
  | inr v =>
    have spec := M.finite_matches v s q r hq hr
    constructor
    · intro h
      change v (M.Z q-M.Z r)≤exp (-s+0)
      rw [add_zero]; exact spec.1.mp h
    · intro h
      change v (M.W q-M.W r)≤exp (s+0)
      rw [add_zero]; exact spec.2.mp h

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.rare_flanks

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (u : NumberField.InfinitePlace K → ℝ) (v : PlanarUnitDistances.Competition.IncidencePiece.Place K)
  (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label)
  {p q r : PlanarUnitDistances.Competition.Plane},
  (p, q) ∈ M.E →
    (p, r) ∈ M.E →
      q ≠ r →
        M.threshold ⇑(PlanarUnitDistances.Competition.IncidencePiece.valuation v) (p, q) ≤
            M.threshold ⇑(PlanarUnitDistances.Competition.IncidencePiece.valuation v) (p, r) →
          ∀ (s : ℝ),
            M.rarePairPositive d p q r ((M.recordsAt u v) s) ≠ 0 →
              have t := (M.recordsAt u v) s;
              have b := M.threshold ⇑(PlanarUnitDistances.Competition.IncidencePiece.valuation v) (p, q);
              have b' := M.threshold ⇑(PlanarUnitDistances.Competition.IncidencePiece.valuation v) (p, r);
              have T :=
                OAI.PlanarUnitDistances.BudgetPlaces.alpha
                    (PlanarUnitDistances.Competition.IncidencePiece.valuation v)
                    (PlanarUnitDistances.ResearchPhysical.jump M p q)
                    (PlanarUnitDistances.ResearchPhysical.jump M p r) +
                  PlanarUnitDistances.ResearchPhysical.flankConstant v;
              (t.majority = false →
                  s ∈ Set.Icc (b - T) b ∧
                    PlanarUnitDistances.ResearchPhysical.bitFrequency M v s <
                      PlanarUnitDistances.Competition.eps) ∧
                (t.majority = true →
                  s ∈ Set.Icc b' (b' + T) ∧
                    1 - PlanarUnitDistances.Competition.eps <
                      PlanarUnitDistances.ResearchPhysical.bitFrequency M v s)
Lean source · PlanarUnitDistances/ResearchRareFlanks.lean, lines 76–125
/-- Positive rare score forces exactly the lower or upper geometric flank,
according to the physical majority bit. -/
theorem rare_flanks (M : IncidencePiece K) (u : InfinitePlace K→ℝ) (v : Place K)
    (d : CoordinateLevel M.Label→M.Label) {p q r : Competition.Plane}
    (he : (p,q)∈M.E) (he' : (p,r)∈M.E) (hne : q≠r)
    (hord : M.threshold (valuation v) (p,q)≤M.threshold (valuation v) (p,r)) (s : ℝ)
    (hp : M.rarePairPositive d p q r (M.recordsAt u v s)≠0) :
    let t := M.recordsAt u v s
    let b := M.threshold (valuation v) (p,q)
    let b' := M.threshold (valuation v) (p,r)
    let T := alpha (valuation v) (jump M p q) (jump M p r)+flankConstant v
    (t.majority=false → s∈Icc (b-T) b ∧ bitFrequency M v s<eps) ∧
    (t.majority=true → s∈Icc b' (b'+T) ∧ 1-eps<bitFrequency M v s) := by
  let t := M.recordsAt u v s
  have facts : M.goodRare t ∧ t.selected p≠d t ∧ t.bit (p,q)≠t.majority ∧
      t.bit (p,r)≠t.majority ∧ t.selected q=t.selected r := by
    by_contra hn; exact hp (ite_eq_right hn)
  obtain ⟨good,_,bit1,bit2,mat⟩ := facts
  have pos : 0<(M.E.card:ℝ) := by exact_mod_cast card_pos.mpr ⟨_,he⟩
  have minor := minority_frequency M u v pos s
  have freq : M.minorityMass t<eps := good.1
  have geom := coordinate_matches M u v s q r (mem_union_right _ (mem_product.mp (M.membership he)).2)
    (mem_union_right _ (mem_product.mp (M.membership he')).2)
  have b1 : t.bit (p,q)=decide (s<M.threshold (valuation v) (p,q)) := record_threshold M u v s _ he
  have b2 : t.bit (p,r)=decide (s<M.threshold (valuation v) (p,r)) := record_threshold M u v s _ he'
  have dd := distinct_jumps M he he' hne
  constructor
  · intro hm
    change t.majority=false at hm
    have cell : (t.label q).2=(t.label r).2 := by simpa [CoordinateLevel.selected,hm] using mat
    have hm' := geom.2 cell
    have reciprocal : (valuation v) ((jump M p q)⁻¹-(jump M p r)⁻¹)≤exp (s+flankConstant v) := by
      rwa [jump_inverse M he,jump_inverse M he',
        show (M.W p-M.W q)-(M.W p-M.W r)=-(M.W q-M.W r) by ring,(valuation v).map_neg]
    have hs : s<M.threshold (valuation v) (p,q) := by simpa [hm,b1] using bit1
    refine ⟨reciprocal_match_lower_flank (valuation v) (jump_ne M he) (jump_ne M he') dd hord hs reciprocal,?_⟩
    change M.minorityMass t=(if t.majority then _ else _) at minor
    simpa only [minor,hm,Bool.false_eq_true,ite_false] using freq
  · intro hm
    change t.majority=true at hm
    have cell : (t.label q).1=(t.label r).1 := by simpa [CoordinateLevel.selected,hm] using mat
    have dir : (valuation v) (jump M p q-jump M p r)≤exp (-s+flankConstant v) := by
      rw [show jump M p q-jump M p r=-(M.Z q-M.Z r) by unfold jump; ring,(valuation v).map_neg]
      exact geom.1 cell
    have hs : M.threshold (valuation v) (p,r) ≤ s := by simpa [hm,b2] using bit2
    refine ⟨direct_match_upper_flank (valuation v) dd hord hs dir,?_⟩
    change M.minorityMass t=(if t.majority then _ else _) at minor
    rw [minor,hm] at freq
    simp only [ite_true] at freq
    linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.local_rare_charge

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (u : NumberField.InfinitePlace K → ℝ) (v : PlanarUnitDistances.Competition.IncidencePiece.Place K)
  (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label)
  {p q r : PlanarUnitDistances.Competition.Plane},
  (p, q) ∈ M.E →
    (p, r) ∈ M.E →
      q ≠ r →
        ∀ {l h : ℝ},
          M.threshold ⇑(PlanarUnitDistances.Competition.IncidencePiece.valuation v) (p, q) ∈ Set.Icc l h →
            M.threshold ⇑(PlanarUnitDistances.Competition.IncidencePiece.valuation v) (p, r) ∈ Set.Icc l h →
              (PlanarUnitDistances.Competition.IncidencePiece.recordIntegral (M.recordsAt u v) l h)
                  (M.rarePairScore d p q r) ≤
                OAI.PlanarUnitDistances.BudgetPlaces.flankCharge
                  (PlanarUnitDistances.Competition.IncidencePiece.valuation v)
                  (PlanarUnitDistances.ResearchPhysical.flankConstant v)
                  (PlanarUnitDistances.ResearchPhysical.jump M p q)
                  (PlanarUnitDistances.ResearchPhysical.jump M p r)
Lean source · PlanarUnitDistances/ResearchRareCharge.lean, lines 89–113
/-- The signed fixed-pair rare score exhausts at most the prescribed local
flank charge at any archimedean or finite place, including tied thresholds. -/
theorem local_rare_charge (M : IncidencePiece K) (u : InfinitePlace K→ℝ) (v : Place K)
    (d : CoordinateLevel M.Label→M.Label) {p q r : Competition.Plane}
    (he : (p,q)∈M.E) (he' : (p,r)∈M.E) (hne : q≠r) {l h : ℝ}
    (b : M.threshold (valuation v) (p,q)∈Icc l h) (b' : M.threshold (valuation v) (p,r)∈Icc l h) :
    recordIntegral (M.recordsAt u v) l h (M.rarePairScore d p q r)≤
      flankCharge (valuation v) (flankConstant v) (jump M p q) (jump M p r) := by
  rcases le_total (M.threshold (valuation v) (p,q)) (M.threshold (valuation v) (p,r)) with ord|ord
  · exact ordered_rare_charge M u v d he he' hne ord b b'
  · have h0 := ordered_rare_charge M u v d he' he hne.symm ord b' b
    have rare : M.rarePairScore d p q r=M.rarePairScore d p r q := by
      funext s
      have eq : M.rarePairPositive d p q r s=M.rarePairPositive d p r q s := by
        unfold IncidencePiece.rarePairPositive
        split_ifs with a b b
        · rfl
        · exact (b ⟨a.1,a.2.1,a.2.2.2.1,a.2.2.1,a.2.2.2.2.symm⟩).elim
        · exact (a ⟨b.1,b.2.1,b.2.2.2.1,b.2.2.1,b.2.2.2.2.symm⟩).elim
        · rfl
      simp only [rarePairScore,eq,abs_sub_comm (bitValue (s.bit (p,q))) (bitValue (s.bit (p,r)))]
    have dd : differenceProduct (jump M p q) (jump M p r)=differenceProduct (jump M p r) (jump M p q) := by
      unfold differenceProduct; ring
    rw [rare,flankCharge_eq _ _ (jump_ne M he) (jump_ne M he') (distinct_jumps M he he' hne),dd]
    exact h0.trans_eq (flankCharge_eq _ _ (jump_ne M he') (jump_ne M he) (distinct_jumps M he' he hne.symm))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.fixed_pair_rare_budget

∀ {K : Type} [inst : Field K] [inst_1 : NumberField K] (M : PlanarUnitDistances.Competition.IncidencePiece K)
  (F : Finset (NumberField.FinitePlace K)),
  (∀ v ∉ F, ∀ e ∈ M.E, M.threshold (⇑v) e = 0) →
    ∀ (l h : AbsoluteValue K ℝ → ℝ),
      (∀ (v : AbsoluteValue K ℝ), ∀ e ∈ M.E, l v ≤ M.threshold (⇑v) e) →
        (∀ (v : AbsoluteValue K ℝ), ∀ e ∈ M.E, M.threshold (⇑v) e ≤ h v) →
          ∀ (u : NumberField.InfinitePlace K → ℝ)
            (d : PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel M.Label → M.Label)
            {p q r : PlanarUnitDistances.Competition.Plane},
            (p, q) ∈ M.E →
              (p, r) ∈ M.E → q ≠ r → M.placeIntegral F l h u (M.rarePairScore d p q r) ≤ 2 * Real.log 2
Lean source · PlanarUnitDistances/ResearchFixedPairBudget.lean, lines 11–58
/-- The fixed-pair rare-only estimate in (budnew-rarealone) for the literal
finite incidence graph, any selected labels, and its actual normalized places.
The prime set need only cover nonzero edge thresholds. -/
theorem fixed_pair_rare_budget (M : IncidencePiece K) (F : Finset (FinitePlace K))
    (active : ∀v∉F,∀e∈M.E,M.threshold v e=0) (l h : AbsoluteValue K ℝ → ℝ)
    (lo : ∀(v : AbsoluteValue K ℝ) e,e∈M.E → l v≤M.threshold v e)
    (hi : ∀(v : AbsoluteValue K ℝ) e,e∈M.E → M.threshold v e≤h v)
    (u : InfinitePlace K→ℝ) (d : CoordinateLevel M.Label→M.Label) {p q r : Competition.Plane}
    (he : (p,q)∈M.E) (he' : (p,r)∈M.E) (hne : q≠r) :
    M.placeIntegral F l h u (M.rarePairScore d p q r)≤2*log 2 := by
  let a := jump M p q
  let b := jump M p r
  have ha : a≠0 := jump_ne M he
  have hb : b≠0 := jump_ne M he'
  have hab : a≠b := distinct_jumps M he he' hne
  let c (v : FinitePlace K) := flankCharge v.val 0 a b
  have fin : (Function.support c).Finite := by
    apply (FinitePlace.hasFiniteMulSupport (differenceProduct_ne_zero hab)).subset
    intro v hv eq
    apply hv
    change flankCharge v.val 0 a b=0
    rw [flankCharge_eq v.val 0 ha hb hab]
    change v (differenceProduct a b)=1 at eq
    change -log (v (differenceProduct a b))+2*0=0
    simp [eq]
  have nonneg (v : FinitePlace K) (hv : v∉F) : 0≤c v := by
    have q0 : OAI.PlanarUnitDistances.BudgetPlaces.threshold v.val a=0 := active v hv _ he
    have r0 : OAI.PlanarUnitDistances.BudgetPlaces.threshold v.val b=0 := active v hv _ he'
    have n := flank_length_nonneg M he he' hne (.inr v)
    change 0≤alpha v.val a b+0 at n
    simp only [c,flankCharge,q0,r0,max_self,min_self,sub_self,sub_zero]
    exact mul_nonneg (by norm_num) n
  have fs : ∑v∈F,c v ≤ ∑ᶠv : FinitePlace K,c v := by
    rw [finsum_eq_sum_of_support_subset c (s:=F∪fin.toFinset) (fun v hv => mem_union_right _ (fin.mem_toFinset.mpr hv))]
    exact sum_le_sum_of_subset_of_nonneg subset_union_left (fun v _ hv => nonneg v hv)
  have here (v : Place K) := local_rare_charge M u v d he he' hne
    (l:=l (valuation v)) (h:=h (valuation v))
    ⟨lo _ _ he,hi _ _ he⟩ ⟨lo _ _ he',hi _ _ he'⟩
  rw [←normalized_flank_charge ha hb hab]
  apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _)
  apply add_le_add
  · apply sum_le_sum
    intro v _
    exact mul_le_mul_of_nonneg_left (here (.inl v)) (Nat.cast_nonneg _)
  · apply le_trans _ fs
    apply sum_le_sum
    intro v _
    exact here (.inr v)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.42 The three actual posterior neighbor laws

Lean verified

Fix the original uniform incidence law π , its common-field model, the two shifts at each infinite place, and a prescribed label for each physical record. For each of the following posterior laws μ , the integral of the score over two distinct draws has upper bound

1 15 ∫ common Pr i , j ∼ μ ( b i ≠ b j ) d ν + 2 log ⁡ 2.

Here the two draws are independent, and the off-diagonal integral uses their original masses μ ( i ) μ ( j ) without renormalization. The laws are the row at a point of positive marginal mass, the column at a center of positive marginal mass, and the row after conditioning on a template and a point of positive joint mass. The third assertion allows arbitrary randomized templates chosen conditionally on the center.

Proof

Restrict a conditional law to its positive atoms. For all three laws each such atom is an actual incident neighbor. In the conditioned law this follows by expanding its joint template–point mass into the nonnegative edge and template weights. The z -coordinates of distinct neighbors are distinct, and the unit identity ( z i − z b ) ( w i − w b ) = 1 holds in either orientation. Apply the integrated single-base estimate to this restricted law. Restoring zero atoms leaves both the off-diagonal sum and its bit-disagreement probability unchanged.

Inspect the Lean declarations

PlanarUnitDistances.UniformPhysical.template_posterior_upper

∀ {P Q : Finset OAI.PlanarUnitDistances.CommonFieldModel.Plane} {T : Type} [inst : Fintype T]
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
  (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q)
  (a : ↥Q → OAI.PlanarUnitDistances.FiniteLaw.Law T) (j : T) (p : ↥P),
  0 <
      (OAI.PlanarUnitDistances.TemplateCoupling.templates (PlanarUnitDistances.UniformPhysical.unitEdgeLaw he)
              a).val
          j *
        (OAI.PlanarUnitDistances.FiniteStarCoupling.left
              (OAI.PlanarUnitDistances.TemplateCoupling.slice
                (PlanarUnitDistances.UniformPhysical.unitEdgeLaw he) a j)).val
          p →
    ∀ (label : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q → Finset (↥P ⊕ ↥Q) × Finset (↥P ⊕ ↥Q))
      (az aw : NumberField.InfinitePlace ↥M.field → ℝ × ℝ),
      PlanarUnitDistances.UniformPhysical.OriginalBaseUpper M he
        (OAI.PlanarUnitDistances.FiniteStarCoupling.row
          (OAI.PlanarUnitDistances.TemplateCoupling.slice (PlanarUnitDistances.UniformPhysical.unitEdgeLaw he)
            a j)
          p)
        (fun q => (p, q)) (Sum.inl p) Sum.inr label az aw
Lean source · PlanarUnitDistances/ActualPosteriorUpper.lean, lines 62–69
theorem template_posterior_upper {T : Type} [Fintype T]
    (M : Model P Q) (he : 0 < incidences P Q) (a : Q→Law T) (j : T) (p : P)
    (hp : 0<(templates (unitEdgeLaw he) a).val j*(left (slice (unitEdgeLaw he) a j)).val p)
    (label : Record P Q→Finset (P⊕Q)×Finset (P⊕Q)) (az aw : InfinitePlace M.field→ℝ×ℝ) :
    OriginalBaseUpper M he (row (slice (unitEdgeLaw he) a j) p) (fun q => (p,q)) (.inl p) Sum.inr label az aw := by
  have mem := positive_slice_incidence he a j p hp
  exact supported_base_upper M he _ _ _ _ label az aw mem (fun _ => Or.inr ⟨rfl,rfl⟩)
    (fun _ _ h => Subtype.ext (M.center_injective h)) (fun q => reverse_unit M (mem q))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.UniformPhysical.supported_base_upper

∀ {P Q : Finset OAI.PlanarUnitDistances.CommonFieldModel.Plane} {I : Type} [inst : Fintype I]
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
  (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q)
  (μ : OAI.PlanarUnitDistances.FiniteLaw.Law I) (edge : I → ↥P × ↥Q) (base : ↥P ⊕ ↥Q) (neighbor : I → ↥P ⊕ ↥Q)
  (label : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q → Finset (↥P ⊕ ↥Q) × Finset (↥P ⊕ ↥Q))
  (az aw : NumberField.InfinitePlace ↥M.field → ℝ × ℝ),
  (∀ (i : OAI.PlanarUnitDistances.FiniteLaw.PositiveAtom μ),
      (edge ↑i).1 ∈ PlanarUnitDistances.unitRows P Q (edge ↑i).2) →
    (∀ (i : OAI.PlanarUnitDistances.FiniteLaw.PositiveAtom μ),
        neighbor ↑i = Sum.inl (edge ↑i).1 ∧ base = Sum.inr (edge ↑i).2 ∨
          neighbor ↑i = Sum.inr (edge ↑i).2 ∧ base = Sum.inl (edge ↑i).1) →
      (Function.Injective fun i => M.z (neighbor ↑i)) →
        (∀ (i : OAI.PlanarUnitDistances.FiniteLaw.PositiveAtom μ),
            (M.z (neighbor ↑i) - M.z base) * (M.w (neighbor ↑i) - M.w base) = 1) →
          PlanarUnitDistances.UniformPhysical.OriginalBaseUpper M he μ edge base neighbor label az aw
Lean source · PlanarUnitDistances/ActualPosteriorUpper.lean, lines 23–44
/-- A supported physical neighbor law can assign zero mass to other
vertices. All geometric hypotheses are needed only on positive atoms. -/
theorem supported_base_upper (M : Model P Q) (he : 0 < incidences P Q) (μ : Law I)
    (edge : I→P×Q) (base : P⊕Q) (neighbor : I→P⊕Q) (label : Record P Q→Finset (P⊕Q)×Finset (P⊕Q))
    (az aw : InfinitePlace M.field→ℝ×ℝ)
    (mem : ∀i : PositiveAtom μ,(edge i.val).1 ∈ unitRows P Q (edge i.val).2)
    (ends : ∀i : PositiveAtom μ,(neighbor i.val=.inl (edge i.val).1 ∧ base=.inr (edge i.val).2) ∨
      (neighbor i.val=.inr (edge i.val).2 ∧ base=.inl (edge i.val).1))
    (inj : Function.Injective (fun i : PositiveAtom μ => M.z (neighbor i.val)))
    (unit : ∀i : PositiveAtom μ,(M.z (neighbor i.val)-M.z base)*(M.w (neighbor i.val)-M.w base)=1) :
    OriginalBaseUpper M he μ edge base neighbor label az aw := by
  let G := unitEdgeLaw he
  let ν := fullMeasure (unitRows P Q) M.z M.w az aw
  have b : offAvg (onPositive μ).val (fun ij => ∫t,baseSlot G (onPositive μ) (fun i => edge i.val)
        base (fun i => neighbor i.val) label ij.1 ij.2 t ∂ν) ≤
      (∫t,variation (onPositive μ) (fun i => t.bit (edge i.val).1 (edge i.val).2) ∂commonLaw G ν)/15+2*log 2 :=
    graph_base_upper (unitRows P Q) M.z M.w G (onPositive μ)
      (fun i => edge i.val) base (fun i => neighbor i.val) label az aw mem ends inj unit
  rw [off_base_onPositive G ν μ edge base neighbor label] at b
  have each (t : Record P Q) : variation (onPositive μ) (fun i => t.bit (edge i.val).1 (edge i.val).2)=
      variation μ (fun i => t.bit (edge i).1 (edge i).2) := onPositive_variation μ (fun i => t.bit (edge i).1 (edge i).2)
  simpa only [OriginalBaseUpper, each, G, ν] using b

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.UniformPhysical.point_posterior_upper

∀ {P Q : Finset OAI.PlanarUnitDistances.CommonFieldModel.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
  (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) (p : ↥P),
  0 <
      (OAI.PlanarUnitDistances.FiniteStarCoupling.left
            (PlanarUnitDistances.UniformPhysical.unitEdgeLaw he)).val
        p →
    ∀ (label : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q → Finset (↥P ⊕ ↥Q) × Finset (↥P ⊕ ↥Q))
      (az aw : NumberField.InfinitePlace ↥M.field → ℝ × ℝ),
      PlanarUnitDistances.UniformPhysical.OriginalBaseUpper M he
        (OAI.PlanarUnitDistances.FiniteStarCoupling.row (PlanarUnitDistances.UniformPhysical.unitEdgeLaw he)
          p)
        (fun q => (p, q)) (Sum.inl p) Sum.inr label az aw
Lean source · PlanarUnitDistances/ActualPosteriorUpper.lean, lines 54–60
theorem point_posterior_upper (M : Model P Q) (he : 0 < incidences P Q) (p : P)
    (hp : 0<(left (unitEdgeLaw he)).val p) (label : Record P Q→Finset (P⊕Q)×Finset (P⊕Q))
    (az aw : InfinitePlace M.field→ℝ×ℝ) :
    OriginalBaseUpper M he (row (unitEdgeLaw he) p) (fun q => (p,q)) (.inl p) Sum.inr label az aw := by
  have mem := positive_row_incidence he p hp
  exact supported_base_upper M he _ _ _ _ label az aw mem (fun _ => Or.inr ⟨rfl,rfl⟩)
    (fun _ _ h => Subtype.ext (M.center_injective h)) (fun q => reverse_unit M (mem q))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.UniformPhysical.center_posterior_upper

∀ {P Q : Finset OAI.PlanarUnitDistances.CommonFieldModel.Plane}
  (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
  (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) (q : ↥Q),
  0 <
      (OAI.PlanarUnitDistances.FiniteStarCoupling.right
            (PlanarUnitDistances.UniformPhysical.unitEdgeLaw he)).val
        q →
    ∀ (label : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q → Finset (↥P ⊕ ↥Q) × Finset (↥P ⊕ ↥Q))
      (az aw : NumberField.InfinitePlace ↥M.field → ℝ × ℝ),
      PlanarUnitDistances.UniformPhysical.OriginalBaseUpper M he
        (OAI.PlanarUnitDistances.FiniteStarCoupling.col (PlanarUnitDistances.UniformPhysical.unitEdgeLaw he)
          q)
        (fun p => (p, q)) (Sum.inr q) Sum.inl label az aw
Lean source · PlanarUnitDistances/ActualPosteriorUpper.lean, lines 46–52
theorem center_posterior_upper (M : Model P Q) (he : 0 < incidences P Q) (q : Q)
    (hq : 0<(right (unitEdgeLaw he)).val q) (label : Record P Q→Finset (P⊕Q)×Finset (P⊕Q))
    (az aw : InfinitePlace M.field→ℝ×ℝ) :
    OriginalBaseUpper M he (col (unitEdgeLaw he) q) (fun p => (p,q)) (.inr q) Sum.inl label az aw := by
  have mem := positive_col_incidence he q hq
  exact supported_base_upper M he _ _ _ _ label az aw mem (fun _ => Or.inl ⟨rfl,rfl⟩)
    (fun _ _ h => Subtype.ext (M.point_injective h)) (fun p => M.unit_identity p.val q (mem_filter.mp (mem p)).2)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 4.43 Two physical comparisons on the original large piece

Lean verified

For all sufficiently large t , every original large piece ( P , Q , M ) has one set of shifts and dominant labels on its original prime set and profile intervals satisfying the rare bounds of Theorem 4.26. For this choice the two bounds

S / 203 < X , C Q ≤ 2048 2 − 144 S

imply its full ComparisonMoments. Here X is the mean exceptional width of the point endpoint of a uniform edge, and C Q integrates the common-level bit disagreement of the two neighbors of the same random center. Both refer to the displayed choice of data.

Proof

The original radius contains every edge threshold and gives zero edge thresholds at omitted finite primes. Theorem 4.41 and Lemma 4.36 supply the fixed-pair premise for these windows. The two comparisons and this fixed-pair bound now give all three moment estimates on the same piece.

Inspect the Lean declarations

PlanarUnitDistances.ResearchPhysical.eventually_two_comparisons

∀ᶠ (t : ℝ) in Filter.atTop,
  ∀ (P Q : Finset PlanarUnitDistances.Competition.Plane)
    (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q),
    PlanarUnitDistances.ProofAssembly.LargePiece t P Q M →
      ∃ u d,
        let G := PlanarUnitDistances.ResearchPhysical.toPiece M;
        have S := PlanarUnitDistances.ProofAssembly.pieceScale M;
        have F := PlanarUnitDistances.UniformPhysical.primes (PlanarUnitDistances.unitRows P Q) M.z M.w;
        have h := PlanarUnitDistances.profileRadius (PlanarUnitDistances.unitRows P Q) M.z M.w;
        have l := fun v => -h v;
        have H := G.vertexWidth F l h u d;
        (∀ (v : NumberField.InfinitePlace ↥M.field), u v ∈ Set.Ioo 0 1) ∧
          (∀
              (r :
                PlanarUnitDistances.Competition.IncidencePiece.CoordinateLevel
                  (PlanarUnitDistances.ResearchPhysical.toPiece M).Label),
              G.goodRare r →
                ((G.pointMass fun p => r.selected p ≠ d r) + G.centerMass fun q => r.selected q ≠ d r) ≤
                  2 * (G.minorityMass r + G.inconsistentMass r)) ∧
            G.placeIntegral F l h u G.minorityMass = S ∧
              G.placeIntegral F l h u G.inconsistentMass ≤ 2 * √2 ∧
                G.placeIntegral F l h u (G.masked fun r => G.edgeException r (d r)) ≤ 5 * 2 ^ (-144) * S ∧
                  G.placeIntegral F l h u (G.masked fun r => G.walkException r (d r)) ≤ 2 ^ (-144) * S ∧
                    ((S / 203 < G.edgeMean fun e => H e.1) →
                      G.placeIntegral F l h u G.commonDisagreement ≤ 2048 * 2 ^ (-144) * S →
                        PlanarUnitDistances.ProofAssembly.ComparisonMoments M)
Lean source · PlanarUnitDistances/ResearchMomentConclusion.lean, lines 11–56
/-- The fixed-pair estimate on the original LargePiece, with the original
profile radius and the very same finite primes, shifts and labels.
Only its point-width lower mean and common-disagreement upper mean remain. -/
theorem eventually_two_comparisons :
    ∀ᶠt : ℝ in atTop, ∀(P Q : Finset Competition.Plane) (M : Model P Q), LargePiece t P Q M →
    ∃(u : InfinitePlace M.field→ℝ)
      (d : IncidencePiece.CoordinateLevel (toPiece M).Label→(toPiece M).Label),
      let G := toPiece M
      let S := pieceScale M
      let F := UniformPhysical.primes (unitRows P Q) M.z M.w
      let h := profileRadius (unitRows P Q) M.z M.w
      let l := fun v => -h v
      let H := G.vertexWidth F l h u d
      (∀v,u v∈Set.Ioo (0:ℝ) 1) ∧
      (∀r,G.goodRare r → G.pointMass (fun p => r.selected p≠d r)+G.centerMass (fun q => r.selected q≠d r)
        ≤2*(G.minorityMass r+G.inconsistentMass r)) ∧
      G.placeIntegral F l h u G.minorityMass=S ∧ G.placeIntegral F l h u G.inconsistentMass≤2*sqrt 2 ∧
      G.placeIntegral F l h u (G.masked fun r => G.edgeException r (d r))≤5*(2:ℝ)^(-144:ℝ)*S ∧
      G.placeIntegral F l h u (G.masked fun r => G.walkException r (d r))≤(2:ℝ)^(-144:ℝ)*S ∧
      (S/203<G.edgeMean (fun e => H e.1) →
       G.placeIntegral F l h u G.commonDisagreement≤2048*(2:ℝ)^(-144:ℝ)*S →
       ComparisonMoments M) := by
  filter_upwards [eventually_three_comparisons,eventually_gt_atTop (0:ℝ)] with t on ht
  intro P Q M hl
  obtain ⟨u,d,hu,hd,hmin,hbad,je,jw,finish⟩ := on P Q M hl
  refine ⟨u,d,hu,hd,hmin,hbad,je,jw,?_⟩
  intro mean common
  apply finish mean common
  intro p _ q r he he' hne
  let G := toPiece M
  let F := UniformPhysical.primes (unitRows P Q) M.z M.w
  let h := profileRadius (unitRows P Q) M.z M.w
  let l := fun v => -h v
  have positive : 0 < incidences P Q := (Real.rpow_pos_of_pos ht _).trans_le hl.2.2.2.2.1
  have scale : G.scale=pieceScale M := scale_eq M positive
  have big : (2:ℝ)^2100<G.scale := by rw [scale]; exact hl.2.2.2.2.2.2.2.2.2.2
  have active (v : FinitePlace M.field) (hv : v∉F) (e) (mem : e∈G.E) : G.threshold v e=0 := by
    have bound := profile_edges_within M v.val e mem
    rw [UniformPhysical.radius_zero _ _ _ hv] at bound
    simpa only [IncidencePiece.threshold,FinitePlace.coe_apply] using abs_nonpos_iff.mp bound
  have result := fixed_pair_width G F active l h
    (fun v e mem => (abs_le.mp (profile_edges_within M v e mem)).1)
    (fun v e mem => (abs_le.mp (profile_edges_within M v e mem)).2)
    u d big (hmin.trans scale.symm) hbad he he' hne
  rw [scale] at result
  exact result

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.44 Both endpoint means for a prescribed dominant rule

Lean verified

Let ν be a finite measure on the original record space and π its edge law. Suppose S = ∫ f d ν ≥ 4 and ∫ m d ν ≤ 4 . For every rule c with point and center exceptional probabilities summing to at most 2 ( f + m ) on the good rare set, both its point mean X and its center mean Y are at most 4 S .

Proof

The sum X + Y integrates these two exceptional probabilities over the good rare set. It is at most 2 ( S + 4 ) by nonnegativity. Each individual width is nonnegative and 4 ≤ S .

Inspect the Lean declarations

OAI.PlanarUnitDistances.PhysicalLevels.width_means_of_dominance

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  [MeasureTheory.IsFiniteMeasure ν]
  (l : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Finset (P ⊕ Q) × Finset (P ⊕ Q)),
  ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
        OAI.PlanarUnitDistances.CommonTemplate.inconsistency π t.bit t.x t.y ∂ν ≤
      4 →
    4 ≤ OAI.PlanarUnitDistances.PhysicalLevels.scale π ν →
      (∀ t ∈ OAI.PlanarUnitDistances.PhysicalLevels.goodRare π,
          OAI.PlanarUnitDistances.RareScore.pointException π
                (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π t) (l t) t.x +
              OAI.PlanarUnitDistances.RareScore.centerException π
                (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π t) (l t) t.y ≤
            2 *
              (OAI.PlanarUnitDistances.PhysicalLevels.minority π t +
                OAI.PlanarUnitDistances.CommonTemplate.inconsistency π t.bit t.x t.y)) →
        OAI.PlanarUnitDistances.PhysicalLevels.pointWidth π ν
              (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π) l ≤
            4 * OAI.PlanarUnitDistances.PhysicalLevels.scale π ν ∧
          OAI.PlanarUnitDistances.PhysicalLevels.centerWidth π ν
              (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π) l ≤
            4 * OAI.PlanarUnitDistances.PhysicalLevels.scale π ν
Lean source · PlanarUnitDistances/DominantWidthMeans.lean, lines 10–38
/-- Each endpoint exceptional width has small mean for every rule
obeying local dominance, on the same record measure and good rare set. -/
theorem width_means_of_dominance (π : Law (P×Q)) (ν : Measure (Record P Q)) [IsFiniteMeasure ν]
    (l : Record P Q → Finset (P⊕Q) × Finset (P⊕Q))
    (hm : (∫t,inconsistency π t.bit t.x t.y ∂ν) ≤ 4) (hs : 4 ≤ scale π ν)
    (dom : ∀t∈goodRare π,pointException π (rareBit π t) (l t) t.x+
      centerException π (rareBit π t) (l t) t.y ≤ 2*(minority π t+inconsistency π t.bit t.x t.y)) :
    pointWidth π ν (rareBit π) l ≤ 4*scale π ν ∧
      centerWidth π ν (rareBit π) l ≤ 4*scale π ν := by
  let A := goodRare π
  let X (t : Record P Q) := pointException π (rareBit π t) (l t) t.x
  let Y (t : Record P Q) := centerException π (rareBit π t) (l t) t.y
  let m (t : Record P Q) := inconsistency π t.bit t.x t.y
  have raw := setIntegral_mono_on (μ:=ν) (f:=fun t => X t+Y t) (g:=fun t => 2*(minority π t+m t))
    Integrable.of_finite Integrable.of_finite (Set.toFinite A).measurableSet dom
  rw [integral_const_mul,integral_add (f:=minority π) (g:=m) Integrable.of_finite Integrable.of_finite,
    integral_add (f:=X) (g:=Y) Integrable.of_finite Integrable.of_finite] at raw
  have small : (∫t in A,minority π t ∂ν) ≤ scale π ν :=
    integral_mono_measure Measure.restrict_le_self (Filter.Eventually.of_forall
      (fun _ => le_min (event_nonneg ..) (sub_nonneg.mpr (event_le_one ..)))) Integrable.of_finite
  have inc : (∫t in A,m t ∂ν) ≤ (∫t,m t ∂ν) :=
    integral_mono_measure Measure.restrict_le_self (Filter.Eventually.of_forall (fun _ => event_nonneg ..))
      Integrable.of_finite
  have nx : 0≤∫t in A,X t ∂ν := integral_nonneg (fun _ => event_nonneg ..)
  have ny : 0≤∫t in A,Y t ∂ν := integral_nonneg (fun _ => event_nonneg ..)
  change (∫t,m t ∂ν) ≤ 4 at hm
  rw [←pointWidth_integral,←centerWidth_integral]
  change (∫t in A,X t ∂ν) ≤ _ ∧ (∫t in A,Y t ∂ν) ≤ _
  constructor <;> linarith only [raw,small,inc,hm,hs,nx,ny]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 4.45 All three finite comparisons on one selected history

Lean verified

For the original large piece, choose one shift family, one finite history and one label rule on the same original piece. The three full-score upper bounds for those same objects yield the following inequalities simultaneously with the walk moments:

C Q + C T ≤ 2048 e 0 S , Y ≤ X + 2048 e 0 S , C P ≤ 20 Y + 1024 e 0 S .

In C T one first computes the conditional disagreement for each history list and then averages with the law of that list.

Proof

Add the center and conditional lower scores. Their terms involving 2 ( Y − X ) and 2 ( X − Y ) cancel. Subtract the two corresponding upper scores, leaving coefficient 1 / 6 − 1 / 15 = 1 / 10 on C Q + C T . The common center score is at least − C Q . Combine this with its rare lower and full upper bounds to compare Y with X . In the ordinary point estimate, the two terms involving 2 X cancel and give the stated bound for C P .

Inspect the Lean declarations

PlanarUnitDistances.ResearchPhysical.eventually_moments_and_comparisons

∀ᶠ (t : ℝ) in Filter.atTop,
  ∀ (P Q : Finset PlanarUnitDistances.Competition.Plane)
    (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q),
    PlanarUnitDistances.ProofAssembly.LargePiece t P Q M →
      ∃ (he : 0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q),
        ∃ u,
          (∀ (v : NumberField.InfinitePlace ↥M.field), u v ∈ Set.Ioo 0 1) ∧
            have π := PlanarUnitDistances.ResearchPhysical.incidenceLaw P Q he;
            have ν :=
              PlanarUnitDistances.UniformPhysical.fullMeasure (PlanarUnitDistances.unitRows P Q) M.z M.w
                (fun v => (u v, u v)) fun v => (u v, u v);
            ∫ (j : OAI.PlanarUnitDistances.PhysicalLevels.Record ↥P ↥Q),
                  OAI.PlanarUnitDistances.CommonTemplate.inconsistency π j.bit j.x j.y ∂ν ≤
                4 ∧
              ∃
                n <
                  PlanarUnitDistances.ComparisonConstants.historyDepth
                    (PlanarUnitDistances.unitWalkInformation P Q),
                ∃ h c,
                  (∀ j ∈ OAI.PlanarUnitDistances.PhysicalLevels.goodRare π,
                      OAI.PlanarUnitDistances.RareScore.pointException π
                            (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π j) (c j) j.x +
                          OAI.PlanarUnitDistances.RareScore.centerException π
                            (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π j) (c j) j.y ≤
                        2 *
                          (OAI.PlanarUnitDistances.PhysicalLevels.minority π j +
                            OAI.PlanarUnitDistances.CommonTemplate.inconsistency π j.bit j.x j.y)) ∧
                    (PlanarUnitDistances.ResearchPhysical.historyTotalScores π ν h c →
                      PlanarUnitDistances.ProofAssembly.ComparisonMoments M ∧
                        PlanarUnitDistances.ResearchPhysical.historyThreeBounds π ν h c)
Lean source · PlanarUnitDistances/ResearchScoreFrontier.lean, lines 47–104
/-- On the original unit-incidence model, choose the common shifts, then
one prediction history, then a dominant rule, all before requiring the
three full score inequalities. Those inequalities imply all the original
comparison moments on the very same incidence piece. -/
theorem eventually_moments_and_comparisons :
    ∀ᶠ t : ℝ in atTop, ∀ (P Q : Finset Competition.Plane) (M : Model P Q), LargePiece t P Q M →
      ∃ (he : 0 < incidences P Q) (u : InfinitePlace M.field → ℝ),
        (∀v,u v∈Set.Ioo (0:ℝ) 1) ∧
        let π := incidenceLaw P Q he
        let ν := fullMeasure (unitRows P Q) M.z M.w (fun v => (u v,u v)) (fun v => (u v,u v))
        (∫j,inconsistency π j.bit j.x j.y ∂ν) ≤ 4 ∧
        ∃ n < historyDepth (unitWalkInformation P Q), ∃ h : P → FiniteInformation.History (Hashes×Hashes) n,
        ∃ c : Record P Q → Finset (P⊕Q) × Finset (P⊕Q),
          (∀j∈PhysicalLevels.goodRare π,pointException π (rareBit π j) (c j) j.x+
            centerException π (rareBit π j) (c j) j.y ≤ 2*(minority π j+inconsistency π j.bit j.x j.y)) ∧
          (historyTotalScores (I:=Positions) π ν h c → ComparisonMoments M ∧
            historyThreeBounds (I:=Positions) π ν h c) := by
  have gp : 0 < Competition.savingG := by unfold Competition.savingG; positivity [exactGap_pos]
  have decay : Tendsto (fun t : ℝ => t^(-150*Competition.savingG)) atTop (nhds 0) := by
    simpa only [neg_mul] using tendsto_rpow_neg_atTop (show 0 < 150*Competition.savingG by positivity)
  filter_upwards [eventually_two_comparisons,common_scores_on_large_piece,eventually_gt_atTop (0:ℝ),
    decay.eventually (eventually_le_nhds (pos 146))] with t two histories ht hsmall
  intro P Q M piece
  have history := histories P Q M piece
  obtain ⟨u,d,hu,hd,_,hmis,_,_,finish⟩ := two P Q M piece
  obtain ⟨_,plo,_,_,edge,degP,_,degQ,rect,_,big⟩ := piece
  have he : 0 < incidences P Q := (Real.rpow_pos_of_pos ht _).trans_le edge
  let π := incidenceLaw P Q he
  let U := fun v => (u v,u v)
  let ν := fullMeasure (unitRows P Q) M.z M.w U U
  have hm : (∫j,inconsistency π j.bit j.x j.y ∂ν) ≤ 4 := by
    rw [←inconsistency_integral_eq M he u]
    exact hmis.trans (by nlinarith [Real.sq_sqrt (by norm_num : (0:ℝ)≤2)])
  have mp := (Real.rpow_pos_of_pos ht _).trans_le plo
  have qp := pos_of_mul_pos_right (he.trans_le (incidences_le P Q)) (Nat.cast_nonneg _)
  have hq (q : Q) : 0 < degree P q :=
    (mul_pos (by norm_num) (Real.rpow_pos_of_pos ht _)).trans_le (degQ q q.prop).1
  have cut : RectangleLaw π (t^(-150*Competition.savingG)) :=
    incidence_rectangles P Q mp qp he (fun p hp => (degP p hp).2.2.1)
      (fun q hq => (degQ q hq).2.2) rect
  have sc : PhysicalLevels.scale π ν=pieceScale M :=
    full_scale _ _ he (unitRows_total P Q) M.z M.w U U
  have large : 2^2100 < PhysicalLevels.scale π ν := sc ▸ big
  obtain ⟨n,hn,h,first,second⟩ := history he U U hm
  obtain ⟨c,dom,score⟩ := label_for_history (I:=Positions) π ν h cut (Real.rpow_nonneg ht.le _)
    hsmall hm large (by rw [sc]; exact first) (fun l => by rw [sc]; exact second (rareBit π) l)
  refine ⟨he,u,hu,hm,n,hn,h,c,dom,?_⟩
  intro full
  obtain ⟨width,common,triple⟩ := score full
  rw [sc] at width common
  refine ⟨?_,triple⟩
  apply finish
  · rw [exceptional_point_mean_eq M he u d c hd dom]
    exact width
  · rw [common_integral_eq M he hq u U U]
    have same : dy 144=(2:ℝ)^(-144:ℝ) := by norm_num [dy,Real.rpow_neg]
    rw [same] at common
    linarith only [common]

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLevels.ThreeComparisonBounds

{P : Type u_1} →
  {Q : Type u_2} →
    {T : Type u_3} →
      [inst : Fintype P] →
        [inst_1 : Fintype Q] →
          [inst_2 : Fintype T] →
            OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q) →
              MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q) →
                (Q → OAI.PlanarUnitDistances.FiniteLaw.Law T) →
                  (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Finset (P ⊕ Q) × Finset (P ⊕ Q)) → Prop
Lean source · PlanarUnitDistances/FullScoreComparison.lean, lines 29–36
/-- The three conclusions of the manuscript's finite comparisons,
including the disagreement conditional on the actual list. -/
structure ThreeComparisonBounds (π : Law (P×Q)) (ν : Measure (Record P Q))
    (a : Q → Law T) (l : Record P Q → Finset (P⊕Q)×Finset (P⊕Q)) : Prop where
  center_list : (∫t,VQ π t.bit ∂commonLaw π ν)+
    (∫t,avg (templates π a) (fun u => VP (slice π a u) t.bit) ∂commonLaw π ν) ≤ 2048*(dy 144*scale π ν)
  widths : centerWidth π ν (rareBit π) l ≤ pointWidth π ν (rareBit π) l+2048*(dy 144*scale π ν)
  point : (∫t,VP π t.bit ∂commonLaw π ν) ≤ 20*centerWidth π ν (rareBit π) l+1024*(dy 144*scale π ν)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLevels.exists_label_for_all_score_bounds

∀ {P : Type u_1} {Q : Type u_2} {T : Type u_3} [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : Fintype T]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  [MeasureTheory.IsFiniteMeasure ν] (a : Q → OAI.PlanarUnitDistances.FiniteLaw.Law T) {ξ : ℝ}
  (R : OAI.PlanarUnitDistances.PhysicalLevels.RectangleLaw π ξ),
  0 ≤ ξ →
    ξ ≤ PlanarUnitDistances.ComparisonConstants.dy 146 →
      ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
            OAI.PlanarUnitDistances.CommonTemplate.inconsistency π t.bit t.x t.y ∂ν ≤
          4 →
        2 ^ 2100 < OAI.PlanarUnitDistances.PhysicalLevels.scale π ν →
          (∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                    OAI.PlanarUnitDistances.FiniteLaw.avg
                      (OAI.PlanarUnitDistances.TemplateCoupling.templates π a) fun u =>
                      OAI.PlanarUnitDistances.FiniteStarCoupling.VP
                        (OAI.PlanarUnitDistances.TemplateCoupling.slice π a u)
                        t.bit ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
                  ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                    OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π
                      t.bit ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν) /
                6 ≤
              ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                    OAI.PlanarUnitDistances.FiniteLaw.avg
                      (OAI.PlanarUnitDistances.TemplateCoupling.templates π a) fun u =>
                      OAI.PlanarUnitDistances.FiniteStarCoupling.DP
                        (OAI.PlanarUnitDistances.TemplateCoupling.slice π a u) t.bit
                        t.y ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
                  ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                    OAI.PlanarUnitDistances.FiniteStarCoupling.DQ π t.bit
                      t.x ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
                16 *
                  (PlanarUnitDistances.ComparisonConstants.dy 144 *
                    OAI.PlanarUnitDistances.PhysicalLevels.scale π ν) →
            (∀ (l : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Finset (P ⊕ Q) × Finset (P ⊕ Q)),
                (∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                      OAI.PlanarUnitDistances.FiniteStarCoupling.VP π
                        t.bit ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν) /
                    6 ≤
                  ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                        OAI.PlanarUnitDistances.FiniteStarCoupling.DP π t.bit
                          t.y ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν +
                      2 *
                        OAI.PlanarUnitDistances.PhysicalLevels.pointWidth π ν
                          (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π) l +
                    17 *
                      (PlanarUnitDistances.ComparisonConstants.dy 144 *
                        OAI.PlanarUnitDistances.PhysicalLevels.scale π ν)) →
              ∃ l,
                (∀ t ∈ OAI.PlanarUnitDistances.PhysicalLevels.goodRare π,
                    OAI.PlanarUnitDistances.RareScore.pointException π
                          (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π t) (l t) t.x +
                        OAI.PlanarUnitDistances.RareScore.centerException π
                          (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π t) (l t) t.y ≤
                      2 *
                        (OAI.PlanarUnitDistances.PhysicalLevels.minority π t +
                          OAI.PlanarUnitDistances.CommonTemplate.inconsistency π t.bit t.x t.y)) ∧
                  (OAI.PlanarUnitDistances.PhysicalLevels.TotalScoreComparison π ν a l →
                    OAI.PlanarUnitDistances.PhysicalLevels.scale π ν / 203 <
                        OAI.PlanarUnitDistances.PhysicalLevels.pointWidth π ν
                          (OAI.PlanarUnitDistances.PhysicalLevels.rareBit π) l ∧
                      ∫ (t : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q),
                            OAI.PlanarUnitDistances.FiniteStarCoupling.VQ π
                              t.bit ∂OAI.PlanarUnitDistances.PhysicalLevels.commonLaw π ν ≤
                          2048 *
                            (PlanarUnitDistances.ComparisonConstants.dy 144 *
                              OAI.PlanarUnitDistances.PhysicalLevels.scale π ν) ∧
                        OAI.PlanarUnitDistances.PhysicalLevels.ThreeComparisonBounds π ν a l)
Lean source · PlanarUnitDistances/FullScoreComparison.lean, lines 38–87
/-- Two target inequalities on the actual common center-disagreement and
rare point widths. The common-score selection and estimates for the
full score must concern the same edge law, list and rare labels. -/
theorem exists_label_for_all_score_bounds (π : Law (P×Q)) (ν : Measure (Record P Q)) [IsFiniteMeasure ν]
    (a : Q → Law T) {ξ : ℝ} (R : RectangleLaw π ξ) (hξ : 0≤ξ) (hsξ : ξ≤dy 146)
    (hm : (∫t,inconsistency π t.bit t.x t.y ∂ν)≤4) (hs : 2^2100<scale π ν)
    (common₁ : ((∫t,avg (templates π a) (fun u => VP (slice π a u) t.bit) ∂commonLaw π ν)+
      (∫t,VQ π t.bit ∂commonLaw π ν))/6 ≤
      (∫t,avg (templates π a) (fun u => DP (slice π a u) t.bit t.y) ∂commonLaw π ν)+
        (∫t,DQ π t.bit t.x ∂commonLaw π ν)+16*(dy 144*scale π ν))
    (common₂ : ∀ l : Record P Q → Finset (P⊕Q)×Finset (P⊕Q),
      (∫t,VP π t.bit ∂commonLaw π ν)/6 ≤ (∫t,DP π t.bit t.y ∂commonLaw π ν)+
          2*pointWidth π ν (rareBit π) l+17*(dy 144*scale π ν)) :
    ∃ l : Record P Q → Finset (P⊕Q)×Finset (P⊕Q),
      (∀t∈goodRare π,pointException π (rareBit π t) (l t) t.x+
        centerException π (rareBit π t) (l t) t.y≤2*(minority π t+inconsistency π t.bit t.x t.y)) ∧
      (TotalScoreComparison π ν a l → scale π ν/203 < pointWidth π ν (rareBit π) l ∧
      (∫t,VQ π t.bit ∂commonLaw π ν) ≤ 2048*(dy 144*scale π ν) ∧ ThreeComparisonBounds π ν a l) := by
  obtain ⟨l,dom,budget⟩ := rare_error_budget π ν R hξ hsξ hm hs
  refine ⟨l,dom,?_⟩
  intro full
  obtain ⟨qu,pu,tu⟩ := full
  obtain ⟨ql,pl,tl⟩ := rare_integrals π ν a (rareBit π) l hm
  rw [pointWidth_integral,centerWidth_integral] at ql pl tl
  let e := dy 144*scale π ν
  let cq := ∫t,VQ π t.bit ∂commonLaw π ν
  let ct := ∫t,avg (templates π a) (fun u => VP (slice π a u) t.bit) ∂commonLaw π ν
  let cp := ∫t,VP π t.bit ∂commonLaw π ν
  let X := pointWidth π ν (rareBit π) l
  let Y := centerWidth π ν (rareBit π) l
  have en : 0≤e := mul_nonneg (pos _).le ((pow_pos (by norm_num : (0:ℝ)<2) 2100).trans hs).le
  have cn : 0≤ct := integral_nonneg (fun _ => avg_nonneg _ (fun _ => avg_nonneg _ (fun _ =>
    StarScore.variation_nonneg ..)))
  have dql : -cq ≤ ∫t,DQ π t.bit t.x ∂commonLaw π ν := by
    change -(∫t,VQ π t.bit ∂commonLaw π ν) ≤ _
    rw [←integral_neg]
    exact integral_mono Integrable.of_finite Integrable.of_finite (fun t => dq_lower π t.bit t.x)
  have qt : cq+ct≤2048*e := by
    dsimp only [e,cq,ct] at *
    linarith only [common₁,qu,tu,ql,tl,budget,en]
  have q : cq≤2048*e := by linarith only [qt,cn]
  have y : Y≤X+2048*e := by
    dsimp only [e,cq,X,Y] at *
    linarith only [qu,ql,budget,q,dql,en]
  have p : cp≤20*Y+1024*e := by
    have c := common₂ l
    dsimp only [e,cp,Y] at *
    linarith only [c,pu,pl,budget,en]
  have ξ100 : ξ≤1/(2:ℝ)^100 := by simpa only [dy,one_div] using hsξ.trans (antitone (by decide : 100≤146))
  exact ⟨point_width_gt_of_comparisons π ν R hξ ξ100 hm hs l q y p,q,qt,y,p⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.historyThreeBounds

{P : Type u_1} →
  {Q : Type u_2} →
    {I : Type u_3} →
      {H : Type u_4} →
        [inst : Fintype P] →
          [inst_1 : Fintype Q] →
            [Fintype I] →
              [Fintype H] →
                [Nonempty I] →
                  OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q) →
                    MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q) →
                      (P → H) →
                        (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q →
                            Finset (P ⊕ Q) × Finset (P ⊕ Q)) →
                          Prop
Lean source · PlanarUnitDistances/ResearchScoreFrontier.lean, lines 24–29
/-- The manuscript's three common-level comparisons with the same iid
history list and the same local dominant rule as the score hypothesis. -/
def historyThreeBounds {P Q I H : Type*} [Fintype P] [Fintype Q] [Fintype I] [Fintype H] [Nonempty I]
    (π : Law (P×Q)) (ν : Measure (Record P Q)) (h : P → H)
    (c : Record P Q → Finset (P⊕Q) × Finset (P⊕Q)) : Prop :=
  ThreeComparisonBounds π ν (listLaw (I:=I) π h) c

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.46 The point exceptional width

Lean verified

If S > 0 , S ≤ X + 201 Y + 30721 e 0 S , and Y ≤ X + 2048 e 0 S , then X > S / 203 .

Proof

Substitution gives S ≤ 202 X + 442369 e 0 S , and 442369 e 0 < 1 / 203 .

Inspect the Lean declarations

PlanarUnitDistances.exceptional_width_gt

∀ {S X Y : ℝ},
  0 < S → S ≤ X + 201 * Y + 30721 * (2 ^ 144)⁻¹ * S → Y ≤ X + 2048 * (2 ^ 144)⁻¹ * S → S / 203 < X
Lean source · PlanarUnitDistances/Constants.lean, lines 149–156
/-- After the two comparisons have been added, the error coefficient still
leaves more than S/203 in the point exceptional widths. -/
theorem exceptional_width_gt {S X Y : ℝ} (hS : 0 < S)
    (h₁ : S ≤ X + 201 * Y + 30721 * ((2 : ℝ) ^ 144)⁻¹ * S)
    (h₂ : Y ≤ X + 2048 * ((2 : ℝ) ^ 144)⁻¹ * S) : S / 203 < X := by
  have he : 442369 * ((2 : ℝ) ^ 144)⁻¹ < 1 / 203 := by norm_num
  have h := mul_lt_mul_of_pos_right he hS
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.47 Integrating the point tail

Lean verified

Let N p be a finite neighborhood of size at least two for each point. Give all edges above p the same mass b p ≥ 0 . Write P p , Q p q , m p q for the point width, center width and edge inconsistency. The last two are nonnegative. Let B 0 ≥ 0 , S > 0 and, for every distinct q , r ∈ N p , assume

2 P p ≤ 3 ( Q p q + m p q + Q p r + m p r ) + B 0 .

At every u ≥ B 0 let F = { P p > u } and G = { Q p q ≥ u / 12 } . Under the given edge weights assume Pr ( F ∩ G ) ≤ α Pr ( F ) Pr ( G ) , where α 2 ≤ 16 e 0 . Also assume ∑ p , q b p Q p q ≤ 4 S , ∑ p , q b p m p q ≤ 4 , and 192 ≤ e 0 S . Then

∑ p , q b p ( P p − B 0 ) + ≤ 2 12 e 0 S .
Proof

A point in F has at most one neighbor with Q p q + m p q < u / 6 . At least half the neighborhood therefore lies in G or has m p q ≥ u / 12 . For f = Pr ( F ) and g = Pr ( G ) use α f g ≤ f / 4 + α 2 g . Integrate the tail inequality from B 0 upwards. The interval lengths give the upper bound 48 α 2 ∑ p , q b p Q p q + 48 ∑ p , q b p m p q . The finite sums and Lebesgue integrals in this argument are checked.

Inspect the Lean declarations

PlanarUnitDistances.edge_width_tail

∀ {P : Type u_1} [inst : Fintype P] (N : P → Type u_2) [inst_1 : (p : P) → Fintype (N p)] (b hP : P → ℝ)
  (hQ m : (p : P) → N p → ℝ) {S B₀ α : ℝ},
  0 < S →
    0 ≤ B₀ →
      (∀ (p : P), 0 ≤ b p) →
        (∀ (p : P) (q : N p), 0 ≤ hQ p q) →
          (∀ (p : P) (q : N p), 0 ≤ m p q) →
            (∀ (p : P), 2 ≤ Fintype.card (N p)) →
              (∀ (p : P) (q r : N p), q ≠ r → 2 * hP p ≤ 3 * (hQ p q + m p q + (hQ p r + m p r)) + B₀) →
                (∀ u ≥ B₀,
                    (PlanarUnitDistances.eventMass (fun e => b e.fst) fun e =>
                        u < hP e.fst ∧ u / 12 ≤ hQ e.fst e.snd) ≤
                      α *
                        √((PlanarUnitDistances.eventMass (fun e => b e.fst) fun e => u < hP e.fst) *
                            PlanarUnitDistances.eventMass (fun e => b e.fst) fun e =>
                              u / 12 ≤ hQ e.fst e.snd)) →
                  α ^ 2 ≤ 16 / 2 ^ 144 →
                    ∑ e, b e.fst * hQ e.fst e.snd ≤ 4 * S →
                      ∑ e, b e.fst * m e.fst e.snd ≤ 4 →
                        192 ≤ S / 2 ^ 144 → ∑ e, b e.fst * max (hP e.fst - B₀) 0 ≤ 2 ^ 12 / 2 ^ 144 * S
Lean source · PlanarUnitDistances/Selection.lean, lines 295–320
/-- Tail estimate with the manuscript's exact error budget. The expansion
input is the marginal estimate on the level rectangles, with uniform
coefficient squared at most `16·2⁻¹⁴⁴`. -/
theorem edge_width_tail {P : Type*} [Fintype P] (N : P → Type*)
    [∀ p, Fintype (N p)] (b hP : P → ℝ) (hQ m : (p : P) → N p → ℝ)
    {S B₀ α : ℝ} (hS : 0 < S) (hB : 0 ≤ B₀) (hb : ∀ p, 0 ≤ b p)
    (hq : ∀ p q, 0 ≤ hQ p q) (hm : ∀ p q, 0 ≤ m p q)
    (hdeg : ∀ p, 2 ≤ Fintype.card (N p))
    (hpair : ∀ p q r, q ≠ r → 2 * hP p ≤ 3 * (hQ p q + m p q + (hQ p r + m p r)) + B₀)
    (hexpand : ∀ u ≥ B₀, eventMass (ι := Sigma N) (fun e => b e.1)
        (fun e => u < hP e.1 ∧ u / 12 ≤ hQ e.1 e.2) ≤
      α * Real.sqrt (eventMass (ι := Sigma N) (fun e => b e.1) (fun e => u < hP e.1) *
        eventMass (ι := Sigma N) (fun e => b e.1) (fun e => u / 12 ≤ hQ e.1 e.2)))
    (hα : α ^ 2 ≤ 16 / (2 : ℝ)^144)
    (hY : (∑ e : Sigma N, b e.1 * hQ e.1 e.2) ≤ 4 * S)
    (hM : (∑ e : Sigma N, b e.1 * m e.1 e.2) ≤ 4)
    (hlarge : 192 ≤ S / (2 : ℝ)^144) :
    (∑ e : Sigma N, b e.1 * max (hP e.1 - B₀) 0) ≤ (2 : ℝ)^12 / 2^144 * S := by
  have h := truncated_point_width (ι := Sigma N) (fun e => b e.1) (fun e => hP e.1)
    (fun e => hQ e.1 e.2) (fun e => m e.1 e.2) hB (fun e => hb e.1)
    (fun e => hq ..) (fun e => hm ..) (fun _ hu => edge_mass_above_threshold N b hP hQ m
      hu hb hdeg hpair) hexpand
  have a := mul_le_mul_of_nonneg_left hY (by positivity : 0 ≤ 48 * α^2)
  have d := mul_le_mul_of_nonneg_right hα hS.le
  norm_num1 at hα d hlarge ⊢
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.48 Tail of the sum

Lean verified

Under any finite coupling, if E ( P − B 0 ) + ≤ T and E ( R − B 0 ) + ≤ T , then E [ ( P + R ) 1 { P + R > 4 B 0 } ] ≤ 4 T .

Proof

On the indicated event, P + R ≤ 2 ( ( P − B 0 ) + + ( R − B 0 ) + ) . Multiply by each sample mass and sum. For the two-edge law the two marginals agree, so Lemma 4.47 supplies T = 2 12 e 0 S for each.

Inspect the Lean declarations

PlanarUnitDistances.truncated_pair_width

∀ {ι : Type u_1} [inst : Fintype ι] (mass P R : ι → ℝ) {B₀ T : ℝ},
  (∀ (i : ι), 0 ≤ mass i) →
    ∑ i, mass i * max (P i - B₀) 0 ≤ T →
      ∑ i, mass i * max (R i - B₀) 0 ≤ T → (∑ i, mass i * if 4 * B₀ < P i + R i then P i + R i else 0) ≤ 4 * T
Lean source · PlanarUnitDistances/Selection.lean, lines 226–245
/-- The second inequality of the tail lemma, for any coupling whose two
endpoint positive parts satisfy the same first-moment bound. -/
theorem truncated_pair_width {ι : Type*} [Fintype ι]
    (mass P R : ι → ℝ) {B₀ T : ℝ} (hmass : ∀ i, 0 ≤ mass i)
    (hp : (∑ i, mass i * max (P i - B₀) 0) ≤ T)
    (hr : (∑ i, mass i * max (R i - B₀) 0) ≤ T) :
    (∑ i, mass i * (if 4 * B₀ < P i + R i then P i + R i else 0)) ≤ 4 * T := by
  classical
  have pointwise (i : ι) :
      (if 4 * B₀ < P i + R i then P i + R i else 0) ≤
        2 * (max (P i - B₀) 0 + max (R i - B₀) 0) := by
    split_ifs with h
    · linarith [le_max_left (P i - B₀) 0, le_max_left (R i - B₀) 0]
    · positivity
  have bound := Finset.sum_le_sum (s := Finset.univ)
    (fun i _ => mul_le_mul_of_nonneg_left (pointwise i) (hmass i))
  have distribute (i : ι) : mass i * (2 * (max (P i - B₀) 0 + max (R i - B₀) 0)) =
      2 * (mass i * max (P i - B₀) 0 + mass i * max (R i - B₀) 0) := by ring
  simp only [distribute, ← Finset.mul_sum, Finset.sum_add_distrib] at bound
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

4.8 Selecting a common scale

Lemma 4.49 One scale for both conditions

Lean verified

Let a finite probability law support arbitrary nonnegative variables W , Z . Suppose S , ϵ > 0 , E W > 2 S / 203 ,

E [ W 1 { W > 8 S / ϵ } ] ≤ 2 14 e 0 S , E Z ≤ 2 12 e 0 S .

Put B = 2 111 . There is J ∈ [ S / 500 , 8 S / ϵ ] with

Pr ( J ≤ W ≤ 2 J ,   Z ≤ J / ( 648 B ) ) ≥ ϵ / 8000 .
Proof

Put U = 8 S / ϵ . For W ≤ U mark [ W / 2 , W ] ∩ [ S / 500 , U ] ∩ [ 648 B Z , ∞ ) . Otherwise mark the empty set. The expected marked length is at least

1 2 E W − 1 2 E [ W 1 { W > U } ] − S / 500 − 648 B E Z > S / 1000.

Integrate the sum of the weighted indicators in J . The expected length divided by U is a lower bound for the mass obtained at some single scale. Empty intervals and equality at cutoffs are included in the formal proof.

Inspect the Lean declarations

PlanarUnitDistances.exists_height_scale

∀ {ι : Type u_1} [inst : Fintype ι] (mass W Z : ι → ℝ) (S ε : ℝ),
  0 < S →
    0 < ε →
      (∀ (i : ι), 0 ≤ mass i) →
        ∑ i, mass i = 1 →
          (∀ (i : ι), 0 ≤ W i) →
            (∀ (i : ι), 0 ≤ Z i) →
              2 * S / 203 < ∑ i, mass i * W i →
                (∑ i, mass i * if 8 * S / ε < W i then W i else 0) ≤ 2 ^ 14 / 2 ^ 144 * S →
                  ∑ i, mass i * Z i ≤ 2 ^ 12 / 2 ^ 144 * S →
                    ∃ J ∈ Set.Icc (S / 500) (8 * S / ε),
                      ε / 8000 ≤ ∑ i, if J ≤ W i ∧ W i ≤ 2 * J ∧ Z i ≤ J / (648 * 2 ^ 111) then mass i else 0
Lean source · PlanarUnitDistances/Selection.lean, lines 50–130
/-- The scale-selection lemma. Its three moment
hypotheses are the lower bound for twice the exceptional point width and the
previous two tail/error estimates. All numerical tolerances are explicit. -/
theorem exists_height_scale {ι : Type*} [Fintype ι]
    (mass W Z : ι → ℝ) (S ε : ℝ)
    (hS : 0 < S) (hε : 0 < ε)
    (hm : ∀ i, 0 ≤ mass i) (htotal : ∑ i, mass i = 1)
    (hW : ∀ i, 0 ≤ W i) (hZ : ∀ i, 0 ≤ Z i)
    (hmean : 2 * S / 203 < ∑ i, mass i * W i)
    (htail : (∑ i, mass i * (if 8 * S / ε < W i then W i else 0)) ≤
      (2 : ℝ)^14 / 2^144 * S)
    (herr : (∑ i, mass i * Z i) ≤ (2 : ℝ)^12 / 2^144 * S) :
    ∃ J ∈ Icc (S / 500) (8 * S / ε),
      ε / 8000 ≤ ∑ i, if J ≤ W i ∧ W i ≤ 2 * J ∧ Z i ≤ J / (648 * 2^111)
                        then mass i else 0 := by
  classical
  let U := 8 * S / ε
  let L := S / 500
  let D : ℝ := 648 * 2^111
  have hD : 0 < D := by dsimp [D]; positivity
  let lo (i : ι) := max (max (W i / 2) L) (D * Z i)
  let hi (i : ι) := if U < W i then 0 else W i
  have hU : 0 ≤ U := by dsimp [U]; positivity
  have hL : 0 < L := by dsimp [L]; positivity
  have hlo (i : ι) : L ≤ lo i := (le_max_right _ _).trans (le_max_left _ _)
  have hhi (i : ι) : hi i ≤ U := by
    dsimp [hi]
    split_ifs with h
    · exact hU
    · exact le_of_not_gt h
  have lower (i : ι) :
      W i / 2 - (if U < W i then W i else 0) / 2 - L - D * Z i ≤
        max (hi i - lo i) 0 := by
    have wz := hW i
    have ez := mul_nonneg hD.le (hZ i)
    dsimp [hi, lo]
    split_ifs with h
    · linarith [le_max_right (0 - max (max (W i / 2) L) (D * Z i)) 0]
    · apply le_trans _ (le_max_left _ _)
      have hmax : max (max (W i / 2) L) (D * Z i) ≤ W i / 2 + L + D * Z i :=
        max_le (max_le (by linarith) (by linarith)) (by linarith)
      linarith
  have totalLower := Finset.sum_le_sum (s := Finset.univ)
    (fun i _ => mul_le_mul_of_nonneg_left (lower i) (hm i))
  have repr (i : ι) :
      mass i * (W i / 2 - (if U < W i then W i else 0) / 2 - L - D * Z i) =
        mass i * W i / 2 - mass i * (if U < W i then W i else 0) / 2 -
          mass i * L - D * (mass i * Z i) := by ring
  simp only [repr, Finset.sum_sub_distrib, ← Finset.sum_div,
    ← Finset.sum_mul, ← Finset.mul_sum, htotal, one_mul] at totalLower
  have multError := mul_le_mul_of_nonneg_left herr hD.le
  change (∑ i, mass i * (if U < W i then W i else 0)) ≤ _ at htail
  have budget : U * (ε / 8000) < ∑ i, mass i * max (hi i - lo i) 0 := by
    have prod : U * (ε / 8000) = S / 1000 := by
      dsimp [U]
      field_simp
      ring
    rw [prod]
    dsimp [D] at multError
    dsimp [L] at totalLower
    norm_num1 at multError htail
    linarith
  obtain ⟨J, hJ, hcovered⟩ := exists_common_point_of_interval_mass mass lo hi
    hL.le hU (by positivity) hlo hhi budget
  refine ⟨J, hJ, hcovered.trans (Finset.sum_le_sum fun i _ => ?_)⟩
  by_cases hiJ : J ∈ Icc (lo i) (hi i)
  · have hcap : ¬ U < W i := by
      intro h
      have hjzero : J ≤ 0 := by simpa [hi, h] using hiJ.2
      exact (hL.trans_le hJ.1).not_ge hjzero
    have hw₁ : J ≤ W i := by simpa [hi, hcap] using hiJ.2
    have hw₂ := (le_max_left (W i / 2) L).trans
      ((le_max_left (max (W i / 2) L) (D * Z i)).trans hiJ.1)
    have hz := (le_max_right (max (W i / 2) L) (D * Z i)).trans hiJ.1
    have good : J ≤ W i ∧ W i ≤ 2 * J ∧ Z i ≤ J / D :=
      ⟨hw₁, by linarith, (le_div_iff₀ hD).2 (by linarith)⟩
    change (if J ∈ Icc (lo i) (hi i) then mass i else 0) ≤
      if J ≤ W i ∧ W i ≤ 2 * J ∧ Z i ≤ J / D then mass i else 0
    simp [hiJ, good]
  · simp only [hiJ, if_false]
    split_ifs <;> simp [hm]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 4.50 Applying one scale to the actual triples

Lean verified

Take one large-height piece with its original scale S , number-field coordinates and unit neighborhoods. Draw a center q with probability d ( q ) / | E | , then two independent uniform neighbors p , r . Suppose one nonnegative width H ( p ) and one place vector V p , finitely supported at finite primes, are given for each point. Put W = H ( p ) + H ( r ) and suppose Z ≥ 0 satisfies the three moment bounds of Lemma 4.49 on this law. For every positive-mass triple assume

W − Z ≤ ‖ ℓ ( λ ) ‖ 1 , ‖ ℓ ( λ ) − ( V r − V p ) ‖ 1 ≤ Z , λ = z p − z q z r − z q .

Then the selected triples have mass at least ϵ / 8000 and satisfy, at a single scale J ≥ S / 500 ,

p ≠ r , h ( λ ) ≥ J / 3 , ‖ ℓ ( λ ) − ( V r − V p ) ‖ 1 ≤ J / ( 648 ⋅ 2 111 ) .

For all sufficiently large t this event yields the post-deletion event of Lemma 6.3.

Proof

Every incident triple has weight 1 / ( | E | d ( q ) ) . Summing first in its endpoints recovers total mass one. Reindexing an arbitrary event in pair-first order gives exactly its center fibers and the same mass. Apply Lemma 4.49 with this weight and the original S . The estimate S > 2 2100 makes J ≥ S / 500 ≥ 12 ⋅ 2 111 . On the selected event Z ≤ J / ( 648 ⋅ 2 111 ) ≤ J / 3 . The identity 2 h ( λ ) = ‖ ℓ ( λ ) ‖ 1 now gives 2 h ( λ ) ≥ W − Z ≥ 2 J / 3 . If the endpoints coincided, their ratio would be 1 and its height zero. Retaining just the selected positive-mass triples ensures both incidence conditions. Their signed error bound uses the original V p and the same center.

Inspect the Lean declarations

PlanarUnitDistances.ProofAssembly.before_circle_deletion_at_scale_of_moments

∀ {P Q : Finset OAI.PlanarUnitDistances.Plane} (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
  {t : ℝ},
  0 < t →
    PlanarUnitDistances.ProofAssembly.LargePiece t P Q M →
      PlanarUnitDistances.ProofAssembly.ComparisonMoments M →
        PlanarUnitDistances.ProofAssembly.BeforeCircleDeletionAtScale M
          (PlanarUnitDistances.ProofAssembly.pieceScale M / 500)
Lean source · PlanarUnitDistances/TripleSelection.lean, lines 112–163
/-- Selection of J on the original walk from its moment bounds. Every
surviving fiber uses J, V, Z and the very same center in both inequalities. -/
theorem before_circle_deletion_at_scale_of_moments {P Q : Finset Plane} (M : CommonFieldModel.Model P Q)
    {t : ℝ} (ht : 0<t) (piece : LargePiece t P Q M) (mom : ComparisonMoments M) :
    BeforeCircleDeletionAtScale M (pieceScale M/500) := by
  let S := pieceScale M
  let m := tripleWeight P Q
  obtain ⟨_,_,_,_,ed,_,_,_,_,_,large⟩ := piece
  have he := lt_of_lt_of_le (Real.rpow_pos_of_pos ht _) ed
  have hS : (2:ℝ)^2100 < S := large
  have hS0 : 0 < S := (by positivity : (0:ℝ) < 2^2100).trans hS
  have hε : 0 < comparisonEpsilon := by unfold comparisonEpsilon; positivity
  obtain ⟨H,V,Z,hH,hV,hZ,hmean,htail,herr,comp⟩ := mom
  let W := pairWidth (Q:=Q) H
  obtain ⟨J,hJ,hm⟩ := exists_height_scale m W Z S comparisonEpsilon hS0 hε
    (tripleWeight_nonneg P Q) (tripleWeight_total P Q he) (fun x => add_nonneg (hH _) (hH _))
    hZ hmean htail herr
  have hbig : (12:ℝ)*2^111 ≤ J := by
    have hh : (2:ℝ)^124 ≤ 2^2100 := pow_le_pow_right₀ (by norm_num) (by decide)
    have hn : (12:ℝ)*2^111*500 ≤ 2^124 := by norm_num
    exact (le_div_iff₀ (by norm_num : (0:ℝ)<500)).2 (hn.trans (hh.trans hS.le)) |>.trans hJ.1
  let E (x : UnitTriple P Q) := J≤W x ∧ W x≤2*J ∧ Z x≤J/(648*2^111)
  let C := tripleEventCenters P Q E
  refine ⟨J,V,C,hJ.1,hbig,hV,?_,?_⟩
  · apply hm.trans_eq
    dsimp only [C]
    rw [←tripleWeight_event P Q E he]
    apply sum_congr rfl; intro x _
    by_cases hx : E x <;> simp only [E] at hx <;> simp [E,m,hx]
  intro z q hq
  obtain ⟨positive,hwlo,_,hz⟩ := (mem_tripleEventCenters P Q E z q).mp hq
  have inci : z.1 ∈ unitRows P Q q ∧ z.2 ∈ unitRows P Q q := by
    by_contra h
    have hz0 : m (z,q)=0 := by simp [m,tripleWeight,h]
    linarith
  let l := centerRatio M z.1 z.2 q
  have spec := centerRatio_spec M inci.1 inci.2
  have eqheight : 2*weilHeight l = placeNorm (localLog l) := twice_weilHeight_eq_absLog spec.1
  have ⟨hunsigned,hsigned⟩ := comp (z,q) positive
  change W (z,q)-Z (z,q) ≤ placeNorm (localLog l) at hunsigned
  have hpos : 0 < J := lt_of_lt_of_le (by positivity : (0:ℝ)<12*2^111) hbig
  have hthird : J/(648*2^111) ≤ J/3 := by
    apply div_le_div_of_nonneg_left hpos.le (by norm_num) (by norm_num)
  have height : J/3 ≤ weilHeight l := by linarith
  have distinct : z.1 ≠ z.2 := by
    intro same
    have nz : M.z (.inl z.2)-M.z (.inr q) ≠ 0 :=
      left_ne_zero_of_mul_eq_one (M.unit_identity _ _ (mem_filter.mp inci.2).2)
    have hz1 : l=1 := by simp [l,centerRatio,same,nz]
    rw [hz1,weilHeight_one] at height
    linarith
  exact ⟨distinct,inci.1,inci.2,height,hsigned.trans hz⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ProofAssembly.tripleWeight

(P Q : Finset OAI.PlanarUnitDistances.Plane) → PlanarUnitDistances.ProofAssembly.UnitTriple P Q → ℝ
Lean source · PlanarUnitDistances/TripleSelection.lean, lines 11–15
/-- The original experiment has mass 1/(e deg(q)) on each triple consisting
of an ordered pair of neighbors of q; all other triples have mass zero. -/
def tripleWeight (P Q : Finset Plane) (x : UnitTriple P Q) : ℝ :=
  if x.1.1 ∈ unitRows P Q x.2 ∧ x.1.2 ∈ unitRows P Q x.2 then
    (incidences P Q * degree P x.2)⁻¹ else 0

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ProofAssembly.tripleWeight_total

∀ (P Q : Finset OAI.PlanarUnitDistances.Plane),
  0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q →
    ∑ x, PlanarUnitDistances.ProofAssembly.tripleWeight P Q x = 1
Lean source · PlanarUnitDistances/TripleSelection.lean, lines 59–75
theorem tripleWeight_total (P Q : Finset Plane) (he : 0 < incidences P Q) :
    ∑ x,tripleWeight P Q x = 1 := by
  rw [Fintype.sum_prod_type,sum_comm]
  have hq (q : Q) : (∑ z : P×P,tripleWeight P Q (z,q)) = degree P q / incidences P Q := by
    rw [Fintype.sum_prod_type]
    have hcut : (∑ p : P,∑ r : P,tripleWeight P Q ((p,r),q)) =
       ∑ _p ∈ unitRows P Q q, ∑ _r ∈ unitRows P Q q,(incidences P Q*degree P q)⁻¹ := by
      simp_rw [restrict_sum (unitRows P Q q)]
      apply sum_congr rfl
      intro p _
      by_cases hp : p∈unitRows P Q q <;> simp [tripleWeight,hp]
    rw [hcut]
    simp only [sum_const,nsmul_eq_mul,unitRows_center_degree]
    by_cases hd : degree P q=0
    · simp [hd]
    · field_simp
  simp only [hq,←sum_div,←unitRows_center_degree,unitRows_total,div_self he.ne']

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ProofAssembly.tripleWeight_event

∀ (P Q : Finset OAI.PlanarUnitDistances.Plane) (E : PlanarUnitDistances.ProofAssembly.UnitTriple P Q → Prop),
  0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q →
    (∑ x, if E x then PlanarUnitDistances.ProofAssembly.tripleWeight P Q x else 0) =
      PlanarUnitDistances.goodTripleMass (PlanarUnitDistances.unitRows P Q)
        (PlanarUnitDistances.ProofAssembly.tripleEventCenters P Q E)
        (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q)
Lean source · PlanarUnitDistances/TripleSelection.lean, lines 33–57
/-- Reindex any tested subset of the triples into exactly its pair-centered
fibers. No untested or nonincident triple acquires probability. -/
theorem tripleWeight_event (P Q : Finset Plane) (E : UnitTriple P Q → Prop) (he : 0 < incidences P Q) :
    (∑ x, if E x then tripleWeight P Q x else 0) =
      goodTripleMass (unitRows P Q)
        (tripleEventCenters P Q E) (incidences P Q) := by
  unfold tripleEventCenters
  rw [goodTripleMass_center_sum _ _ he,Fintype.sum_prod_type,sum_comm]
  apply sum_congr rfl
  intro q _
  rw [Fintype.sum_prod_type]
  simp_rw [restrict_sum (unitRows P Q q)]
  apply sum_congr rfl
  intro p _
  by_cases hp : p∈unitRows P Q q
  · rw [if_pos hp]
    apply sum_congr rfl
    intro r _
    by_cases hr : r∈unitRows P Q q
    · have hdeg : (0:ℝ)<degree P q := by
        rw [←unitRows_center_degree P Q q]; exact_mod_cast card_pos.mpr ⟨p,hp⟩
      have hv := mul_pos (inv_pos.mpr hdeg) (inv_pos.mpr he)
      simp [hp,hr,tripleWeight,unitRows_center_degree,hv]
    · simp [hp,hr,tripleWeight]
  · simp [hp,tripleWeight]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ProofAssembly.pieceScale

{P Q : Finset OAI.PlanarUnitDistances.Plane} → OAI.PlanarUnitDistances.CommonFieldModel.Model P Q → ℝ
Lean source · PlanarUnitDistances/TripleSelection.lean, lines 77–81
/-- S is the integrated minority mass for the original directions of this
very model and the same intervals as in LargePiece. -/
def pieceScale {P Q : Finset Plane} (M : CommonFieldModel.Model P Q) : ℝ :=
  let r := profileRadius (unitRows P Q) M.z M.w
  UniformNormalization.profileScale (unitRows P Q) (incidences P Q) M.z (fun v => -r v) r

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ProofAssembly.ComparisonMoments

{P Q : Finset OAI.PlanarUnitDistances.Plane} → OAI.PlanarUnitDistances.CommonFieldModel.Model P Q → Prop
Lean source · PlanarUnitDistances/TripleSelection.lean, lines 85–100
/-- The precise three integral estimates and the pointwise signed/unsigned
comparison needed before the one-scale theorem. H is a point-only width,
V is a point-only endpoint vector, and Z is the triple error. -/
def ComparisonMoments {P Q : Finset Plane} (M : CommonFieldModel.Model P Q) : Prop :=
  let S := pieceScale M
  let m := tripleWeight P Q
  ∃ (H : P → ℝ) (V : P → HeightPlace M.field → ℝ) (Z : UnitTriple P Q → ℝ),
    (∀ p,0 ≤ H p) ∧ (∀ p,FiniteAtPrimes (V p)) ∧ (∀ x,0 ≤ Z x) ∧
    2*S/203 < ∑ x,m x*pairWidth H x ∧
    (∑ x,m x*(if 8*S/comparisonEpsilon < pairWidth H x then pairWidth H x else 0)) ≤
      (2:ℝ)^14/2^144*S ∧
    (∑ x,m x*Z x) ≤ (2:ℝ)^12/2^144*S ∧
    ∀ x,0 < m x →
      let l := centerRatio M x.1.1 x.1.2 x.2
      pairWidth H x-Z x ≤ placeNorm (localLog l) ∧
      placeNorm (localLog l-(V x.1.2-V x.1.1)) ≤ Z x

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 4.51 Moment estimates for the original common-center walk

Lean verified

For every sufficiently large t , take any original large-height piece and its own common-field model. Draw a center with probability d ( q ) / | E | , then draw two independent uniform neighbors p , r . There exist point widths H p ≥ 0 , point vectors V p with finite support at the finite places, and nonnegative triple errors Z . Put W = H p + H r , ϵ = 2 − 1800 and e 0 = 2 − 144 . For the scale S of the piece,

E W > 2 S / 203 , E [ W 1 { W > 8 S / ϵ } ] ≤ 2 14 e 0 S , E Z ≤ 2 12 e 0 S .

On every positive-probability triple, its actual ratio l = ( z p − z q ) / ( z r − z q ) satisfies W − Z ≤ ‖ log ⁡ | l | ‖ 1 and ‖ log ⁡ | l | − ( V r − V p ) ‖ 1 ≤ Z . Both estimates use the same center and point vectors.

Proof

Condition first on the base of each of the three experiments. Apply the off-diagonal estimate to two distinct neighbors in the support of that conditional law. For two equal neighbors, retain their squared atom masses and average them against their own base widths. In the list experiment the averaging order is list, point given the list, then two centers given both. The integrated score identities combine the two contributions with coefficient 1 / 15 on the common disagreement and error at most e 0 S in each experiment. On the selected shifts, prefix and dominant labels, the comparison inequalities yield the lower mean width and the upper common disagreement. The fixed-pair width bound controls the truncated moment. Integration of the signed comparison controls the error moment. This constructs all three witnesses on the original walk.

Inspect the Lean declarations

PlanarUnitDistances.ResearchPhysical.original_walk_moments

∀ᶠ (t : ℝ) in Filter.atTop,
  ∀ (P Q : Finset PlanarUnitDistances.Competition.Plane)
    (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q),
    PlanarUnitDistances.ProofAssembly.LargePiece t P Q M →
      PlanarUnitDistances.ProofAssembly.ComparisonMoments M
Lean source · PlanarUnitDistances/ResearchWalkMoments.lean, lines 57–62
/-- The three moment bounds and both endpoint estimates on the original
common-center walk, uniformly on every sufficiently large piece. -/
theorem original_walk_moments :
    ∀ᶠ t : ℝ in atTop, ∀ (P Q : Finset Competition.Plane) (M : Model P Q),
      LargePiece t P Q M → ComparisonMoments M :=
  moments_of_total_score_upper original_total_score_upper

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchPhysical.original_total_score_upper

PlanarUnitDistances.ResearchPhysical.OriginalTotalScoreUpper
Lean source · PlanarUnitDistances/ResearchWalkMoments.lean, lines 48–55
/-- Every original large piece satisfies all three integrated upper score
bounds with the manuscript's coefficient 1/15 and loss 2⁻¹⁴⁴ S. -/
theorem original_total_score_upper : OriginalTotalScoreUpper := by
  filter_upwards [history_scores_of_cardinal] with t scores
  intro P Q M piece he u n h c inputs
  apply scores P Q M piece he u n c inputs (I:=Positions) h
  intro p hp
  exact cardinal_bound_change_instance (T:=FullList n) (inputs.list_per_degree p hp)

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.PhysicalLevels.total_of_base_bounds

∀ {P : Type u_1} {Q : Type u_2} {T : Type u_4} [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : Fintype T]
  (π : OAI.PlanarUnitDistances.FiniteLaw.Law (P × Q))
  (ν : MeasureTheory.Measure (OAI.PlanarUnitDistances.PhysicalLevels.Record P Q))
  [MeasureTheory.IsFiniteMeasure ν] (a : Q → OAI.PlanarUnitDistances.FiniteLaw.Law T)
  (l : OAI.PlanarUnitDistances.PhysicalLevels.Record P Q → Finset (P ⊕ Q) × Finset (P ⊕ Q)),
  (∀ (q : Q),
      0 < (OAI.PlanarUnitDistances.FiniteStarCoupling.right π).val q →
        OAI.PlanarUnitDistances.PhysicalLevels.OffDiagonalBound π ν
          (OAI.PlanarUnitDistances.FiniteStarCoupling.col π q) (fun p => (p, q)) (Sum.inr q) Sum.inl l) →
    (∀ (p : P),
        0 < (OAI.PlanarUnitDistances.FiniteStarCoupling.left π).val p →
          OAI.PlanarUnitDistances.PhysicalLevels.OffDiagonalBound π ν
            (OAI.PlanarUnitDistances.FiniteStarCoupling.row π p) (fun q => (p, q)) (Sum.inl p) Sum.inr l) →
      (∀ (u : T) (p : P),
          0 <
              (OAI.PlanarUnitDistances.TemplateCoupling.templates π a).val u *
                (OAI.PlanarUnitDistances.FiniteStarCoupling.left
                      (OAI.PlanarUnitDistances.TemplateCoupling.slice π a u)).val
                  p →
            OAI.PlanarUnitDistances.PhysicalLevels.OffDiagonalBound π ν
              (OAI.PlanarUnitDistances.FiniteStarCoupling.row
                (OAI.PlanarUnitDistances.TemplateCoupling.slice π a u) p)
              (fun q => (p, q)) (Sum.inl p) Sum.inr l) →
        (2 * Real.log 2 +
              OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.FiniteStarCoupling.right π)
                fun q =>
                2 *
                    (OAI.PlanarUnitDistances.PhysicalLevels.width ν
                        (OAI.PlanarUnitDistances.PhysicalLevels.common π) +
                      OAI.PlanarUnitDistances.PhysicalLevels.baseExceptionWidth π ν l (Sum.inr q)) *
                  ∑ p, (OAI.PlanarUnitDistances.FiniteStarCoupling.col π q).val p ^ 2) ≤
            PlanarUnitDistances.ComparisonConstants.dy 144 *
              OAI.PlanarUnitDistances.PhysicalLevels.scale π ν →
          (2 * Real.log 2 +
                OAI.PlanarUnitDistances.FiniteLaw.avg (OAI.PlanarUnitDistances.FiniteStarCoupling.left π)
                  fun p =>
                  2 *
                      (OAI.PlanarUnitDistances.PhysicalLevels.width ν
                          (OAI.PlanarUnitDistances.PhysicalLevels.common π) +
                        OAI.PlanarUnitDistances.PhysicalLevels.baseExceptionWidth π ν l (Sum.inl p)) *
                    ∑ q, (OAI.PlanarUnitDistances.FiniteStarCoupling.row π p).val q ^ 2) ≤
              PlanarUnitDistances.ComparisonConstants.dy 144 *
                OAI.PlanarUnitDistances.PhysicalLevels.scale π ν →
            2 * Real.log 2 +
                  ∑ p,
                    2 *
                        (OAI.PlanarUnitDistances.PhysicalLevels.width ν
                            (OAI.PlanarUnitDistances.PhysicalLevels.common π) +
                          OAI.PlanarUnitDistances.PhysicalLevels.baseExceptionWidth π ν l (Sum.inl p)) *
                      ∑ u,
                        (OAI.PlanarUnitDistances.TemplateCoupling.templates π a).val u *
                            (OAI.PlanarUnitDistances.FiniteStarCoupling.left
                                  (OAI.PlanarUnitDistances.TemplateCoupling.slice π a u)).val
                              p *
                          ∑ q,
                            (OAI.PlanarUnitDistances.FiniteStarCoupling.row
                                    (OAI.PlanarUnitDistances.TemplateCoupling.slice π a u) p).val
                                q ^
                              2 ≤
                PlanarUnitDistances.ComparisonConstants.dy 144 *
                  OAI.PlanarUnitDistances.PhysicalLevels.scale π ν →
              OAI.PlanarUnitDistances.PhysicalLevels.TotalScoreComparison π ν a l
Lean source · PlanarUnitDistances/TotalScoreAssembly.lean, lines 20–55
/-- Summing the three genuine conditional experiments, including zero-mass
bases and repeated neighbors, yields the inequalities of the manuscript. -/
theorem total_of_base_bounds (π : Law (P×Q)) (ν : Measure (Record P Q)) [IsFiniteMeasure ν]
    (a : Q → Law T) (l : Record P Q → Finset (P⊕Q)×Finset (P⊕Q))
    (qoff : ∀q,0 < (right π).val q → OffDiagonalBound π ν (col π q) (fun p => (p,q)) (.inr q) Sum.inl l)
    (poff : ∀p,0 < (left π).val p → OffDiagonalBound π ν (row π p) (fun q => (p,q)) (.inl p) Sum.inr l)
    (toff : ∀u p,0 < (templates π a).val u*(left (slice π a u)).val p →
      OffDiagonalBound π ν (row (slice π a u) p) (fun q => (p,q)) (.inl p) Sum.inr l)
    (qdiag : 2*Real.log 2+avg (right π) (fun q =>
      2*(width ν (common π)+baseExceptionWidth π ν l (.inr q))*(∑p,((col π q).val p)^2))≤dy 144*scale π ν)
    (pdiag : 2*Real.log 2+avg (left π) (fun p =>
      2*(width ν (common π)+baseExceptionWidth π ν l (.inl p))*(∑q,((row π p).val q)^2))≤dy 144*scale π ν)
    (tdiag : 2*Real.log 2+∑p,2*(width ν (common π)+baseExceptionWidth π ν l (.inl p))*
      (∑u,(templates π a).val u*(left (slice π a u)).val p*(∑q,((row (slice π a u) p).val q)^2))
      ≤dy 144*scale π ν) : TotalScoreComparison π ν a l := by
  constructor
  · rw [center_integrated_slots]
    exact average_base_scores π ν (right π) (col π) (fun q p => (p,q)) Sum.inr
      (fun _ => Sum.inl) l _ qoff qdiag
  · rw [point_integrated_slots]
    exact average_base_scores π ν (left π) (row π) (fun p q => (p,q)) Sum.inl
      (fun _ => Sum.inr) l _ poff pdiag
  · let β := dependent (templates π a) (fun u => left (slice π a u))
    let μ (b : T×P) := row (slice π a b.1) b.2
    let C (p : P) := 2*(width ν (common π)+baseExceptionWidth π ν l (.inl p))
    have diag : 2*Real.log 2+avg β (fun b => C b.2*(∑q,((μ b).val q)^2)) ≤ dy 144*scale π ν := by
      apply le_trans (le_of_eq (congrArg (2*Real.log 2+·) ?_)) tdiag
      unfold avg β dependent
      rw [Fintype.sum_prod_type,Finset.sum_comm]
      apply sum_congr rfl; intro p _
      rw [mul_sum]; apply sum_congr rfl; intro u _
      dsimp only [μ,C]; ring
    have h := average_base_scores π ν β μ (fun b q => (b.2,q)) (fun b => Sum.inl b.2)
      (fun _ => Sum.inr) l _ (fun b hb => toff b.1 b.2 hb) diag
    rw [list_integrated_slots]
    simpa only [β,μ,dependent_avg,VP] using h

Kernel axioms used: propext, Classical.choice, Quot.sound.

5 The grid obstruction

In this chapter

In this chapter L ( p , r ) = ( p x − r x ) 2 + ( p y − r y ) 2 is a polynomial, including over a complex extension field. Put B = 2 111 . The geometric input is a dense bipartite graph with the same real algebraic point set on its two sides. Each edge has one assigned ratio. Repeated vertices in an ordered grid inherit that same assignment. The chosen scale J gives a lower bound J / 3 for each ratio height and an upper bound J / ( 324 B ) for each alternating rectangle quotient height. The purpose of fixing the quotients is to obtain differential constraints on the positions. At an algebraic configuration x , a tangent means a solution of the original equations over Q ― [ ϵ ] / ( ϵ 2 ) reducing to x , with every a i j fixed. It need only satisfy the linearized equations. It can exist even when no curve of configurations through x has that velocity.

5.1 Fixed quotients and tangent vectors

Definition 5.1 The fixed-quotient fibre

Definition in Lean

Choose a base row 0 and base column 0 ; the manuscript numbers them both 1 . Write a i j = λ i j λ 00 / ( λ i 0 λ 0 j ) . Thus a i 0 = a 0 j = 1 . The equations are

L i j = 2 − λ i j − μ i j , λ i j μ i j = 1 , λ i j λ 00 = a i j λ i 0 λ 0 j .

Boundary instances of the last equation are redundant. The definition accepts arbitrary commutative coefficient rings.

Inspect the Lean declarations

PlanarUnitDistances.Fibre.GridEquations

{I : Type u_2} →
  {J : Type u_3} →
    {R : Type u_4} →
      [CommRing R] → I → J → (I → R × R) → (J → R × R) → (I → J → R) → (I → J → R) → (I → J → R) → Prop
Lean source · PlanarUnitDistances/Algebra.lean, lines 29–36
/-- The three defining equations on a grid. The constant-quotient equations can
be written on every index by setting the base row and column of the coefficients
equal to one. Their redundant boundary equations then hold identically. -/
structure GridEquations {R : Type*} [CommRing R] (i₀ : I) (j₀ : J)
    (p : I → R × R) (r : J → R × R) (u m a : I → J → R) : Prop where
  distance : ∀ i j, chordSq (p i) (r j) = 2 - u i j - m i j
  inverse : ∀ i j, u i j * m i j = 1
  rect : ∀ i j, u i j * u i₀ j₀ = a i j * (u i j₀ * u i₀ j)

Kernel axioms used: propext.

Lemma 5.2 Row and column torus coordinates

Lean verified

Fix the position coordinates and the units a i j over a commutative test ring, with a i 0 = a 0 j = 1 . Solutions of the fibre equations correspond to row and column units u i , v j , v 0 = 1 , satisfying L i j = 2 − a i j u i v j − ( a i j u i v j ) − 1 .

Proof

Send ( u i , v j ) to λ i j = a i j u i v j . Recover u i = λ i 0 , v j = λ 0 j / λ 00 . Multiplication by λ 00 checks the second composition. The inverse-coordinate equation makes λ i j a unit with specified inverse μ i j . This calculation also holds over the dual numbers K [ ϵ ] / ( ϵ 2 ) .

Inspect the Lean declarations

PlanarUnitDistances.Fibre.torusEquivRatio

{I : Type u_2} →
  {J : Type u_3} →
    {R : Type u_4} →
      [inst : CommRing R] →
        (i₀ : I) →
          (j₀ : J) →
            (p : I → R × R) →
              (r : J → R × R) →
                (a : I → J → Rˣ) →
                  (∀ (j : J), a i₀ j = 1) →
                    (∀ (i : I), a i j₀ = 1) →
                      PlanarUnitDistances.Fibre.TorusSolution i₀ j₀ p r a ≃
                        PlanarUnitDistances.Fibre.RatioSolution i₀ j₀ p r a
Lean source · PlanarUnitDistances/Algebra.lean, lines 170–205
/-- The torus-to-ratio parametrization and its inverse work over every
commutative test ring, hence also over rings carrying nilpotent elements.
The two maps leave all position coordinates fixed. -/
def torusEquivRatio (i₀ : I) (j₀ : J) (p : I → R × R) (r : J → R × R)
    (a : I → J → Rˣ) (base_row : ∀ j, a i₀ j = 1) (base_col : ∀ i, a i j₀ = 1) :
    TorusSolution i₀ j₀ p r a ≃ RatioSolution i₀ j₀ p r a where
  toFun t :=
    { ratio := fun i j => a i j * t.row i * t.col j
      distance := t.distance
      rect := by
        intro i j
        simp only [base_row, base_col, t.base_col, one_mul, mul_one]
        ac_rfl }
  invFun l :=
    { row := fun i => l.ratio i j₀
      col := fun j => l.ratio i₀ j / l.ratio i₀ j₀
      base_col := div_self' _
      distance := by
        intro i j
        have he : a i j * l.ratio i j₀ * (l.ratio i₀ j / l.ratio i₀ j₀) = l.ratio i j := by
          rw [← mul_div_assoc, div_eq_iff_eq_mul]
          simpa only [mul_assoc] using (l.rect i j).symm
        rw [he]
        exact l.distance i j }
  left_inv t := by
    apply TorusSolution.ext
    · funext i
      simp [base_col, t.base_col]
    · funext j
      simp [base_row, t.base_col, mul_comm]
  right_inv l := by
    apply RatioSolution.ext
    funext i j
    change a i j * l.ratio i j₀ * (l.ratio i₀ j / l.ratio i₀ j₀) = l.ratio i j
    rw [← mul_div_assoc, div_eq_iff_eq_mul]
    simpa only [mul_assoc] using (l.rect i j).symm

Kernel axioms used: propext, Quot.sound.

Lemma 5.3 The differential equations

Lean verified

A dual-number solution over a field K in which every ratio moves gives position velocities H i , U j and scalars A i , b j such that

2 ( p i − r j ) ⋅ ( H i − U j ) = ( μ i j − λ i j ) ( A i − b j ) , A i − b j ≠ 0 , ( μ i j − λ i j ) 2 = L i j ( L i j − 4 ) .

Conversely, at a base solution, the displayed linear equations lift the positions and both reciprocal coordinates to a dual-number solution.

Proof

Write c i j = λ ˙ i j / λ i j . The quotient equations give c i j + c 00 = c i 0 + c 0 j , so use A i = c i 0 and b j = c 00 − c 0 j . The inverse-coordinate equation gives μ ˙ i j = − μ i j c i j . Substitute in the distance equation. For the converse use the pair of increments ( λ i j ( A i − b j ) , − μ i j ( A i − b j ) ) . Expanding the three defining equations modulo ϵ 2 gives the desired lift.

Inspect the Lean declarations

PlanarUnitDistances.Fibre.moving_grid_differential

∀ {K : Type u_1} [inst : Field K] {I : Type u_2} {J : Type u_3} (i₀ : I) (j₀ : J)
  (p : I → DualNumber K × DualNumber K) (r : J → DualNumber K × DualNumber K) (u m : I → J → DualNumber K)
  (a : I → J → K),
  (PlanarUnitDistances.Fibre.GridEquations i₀ j₀ p r u m fun i j => TrivSqZeroExt.inl (a i j)) →
    (∀ (i : I) (j : J), TrivSqZeroExt.snd (u i j) ≠ 0) →
      ∃ A b,
        ∀ (i : I) (j : J),
          have L :=
            PlanarUnitDistances.Fibre.chordSq (PlanarUnitDistances.Fibre.position (p i))
              (PlanarUnitDistances.Fibre.position (r j));
          have R := TrivSqZeroExt.fst (m i j) - TrivSqZeroExt.fst (u i j);
          2 *
                PlanarUnitDistances.Fibre.dot
                  (PlanarUnitDistances.Fibre.position (p i) - PlanarUnitDistances.Fibre.position (r j))
                  (PlanarUnitDistances.Fibre.velocity (p i) - PlanarUnitDistances.Fibre.velocity (r j)) =
              R * (A i - b j) ∧
            R ^ 2 = L * (L - 4) ∧ A i - b j ≠ 0
Lean source · PlanarUnitDistances/Algebra.lean, lines 54–102
/-- Each rectangle has fixed coefficient in the ground field, so its first
derivative vanishes. Hence the logarithmic velocities split as row minus column.
The statement and proof do not require distinct positions or smoothness. -/
theorem moving_grid_differential (i₀ : I) (j₀ : J)
    (p : I → DualNumber K × DualNumber K) (r : J → DualNumber K × DualNumber K)
    (u m : I → J → DualNumber K) (a : I → J → K)
    (h : GridEquations i₀ j₀ p r u m (fun i j => inl (a i j)))
    (moving : ∀ i j, (u i j).snd ≠ 0) :
    ∃ (A : I → K) (b : J → K), ∀ i j,
      let L := chordSq (position (p i)) (position (r j))
      let R := (m i j).fst - (u i j).fst
      2 * dot (position (p i) - position (r j)) (velocity (p i) - velocity (r j)) =
        R * (A i - b j) ∧ R ^ 2 = L * (L - 4) ∧ A i - b j ≠ 0 := by
  have inv₀ (i : I) (j : J) : (u i j).fst * (m i j).fst = 1 := by
    simpa only [fst_mul, fst_one] using congrArg fst (h.inverse i j)
  have hu (i : I) (j : J) : (u i j).fst ≠ 0 := left_ne_zero_of_mul_eq_one (inv₀ i j)
  have ha (i : I) (j : J) : a i j ≠ 0 := by
    have hh := congrArg fst (h.rect i j)
    simp only [fst_mul, fst_inl] at hh
    intro hz
    rw [hz, zero_mul] at hh
    exact (mul_ne_zero (hu i j) (hu i₀ j₀)) hh
  refine ⟨fun i => logVelocity (u i j₀), fun j => logVelocity (u i₀ j₀) -
    logVelocity (u i₀ j), ?_⟩
  intro i j
  dsimp only
  have hv := congrArg logVelocity (h.rect i j)
  rw [logVelocity_mul _ _ (hu i j) (hu i₀ j₀),
    logVelocity_mul (inl (a i j)) (u i j₀ * u i₀ j) (ha i j)
      (by rw [fst_mul]; exact mul_ne_zero (hu i j₀) (hu i₀ j)),
    logVelocity_mul _ _ (hu i j₀) (hu i₀ j)] at hv
  simp only [logVelocity, snd_inl, fst_inl, zero_div, zero_add] at hv
  have split : logVelocity (u i j₀) - (logVelocity (u i₀ j₀) - logVelocity (u i₀ j)) =
      logVelocity (u i j) := by dsimp [logVelocity]; linear_combination -hv
  rw [split]
  have dist₀ := congrArg fst (h.distance i j)
  have dist₁ := congrArg snd (h.distance i j)
  have inv₁ := congrArg snd (h.inverse i j)
  have hf₂ : (2 : DualNumber K).fst = 2 := rfl
  have hs₂ : (2 : DualNumber K).snd = 0 := rfl
  simp only [chordSq_fst, fst_sub, hf₂] at dist₀
  simp only [chordSq_snd, snd_sub, hs₂, zero_sub] at dist₁
  simp only [DualNumber.snd_mul, snd_one] at inv₁
  refine ⟨?_, ?_, div_ne_zero (moving i j) (hu i j)⟩
  · rw [dist₁, logVelocity]
    field_simp [hu]
    linear_combination -inv₁
  · rw [dist₀]
    linear_combination -4 * inv₀ i j

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Fibre.lift_differential

∀ {K : Type u_1} [inst : Field K] {I : Type u_2} {J : Type u_3} (i₀ : I) (j₀ : J) (p H : I → K × K)
  (r U : J → K × K) (u m a : I → J → K) (A : I → K) (b : J → K),
  PlanarUnitDistances.Fibre.GridEquations i₀ j₀ p r u m a →
    (∀ (i : I) (j : J),
        2 * PlanarUnitDistances.Fibre.dot (p i - r j) (H i - U j) = (m i j - u i j) * (A i - b j)) →
      PlanarUnitDistances.Fibre.GridEquations i₀ j₀
        (fun i => PlanarUnitDistances.Fibre.liftPosition (p i) (H i))
        (fun j => PlanarUnitDistances.Fibre.liftPosition (r j) (U j))
        (fun i j => PlanarUnitDistances.Fibre.liftScalar (u i j) (u i j * (A i - b j)))
        (fun i j => PlanarUnitDistances.Fibre.liftScalar (m i j) (-m i j * (A i - b j))) fun i j =>
        TrivSqZeroExt.inl (a i j)
Lean source · PlanarUnitDistances/Algebra.lean, lines 111–146
/-- The displayed first-order equations suffice for a tangent of the original
fibre. In particular the row and column scalar representation loses no
information. The proof constructs the lifts of both the ratios and inverses. -/
theorem lift_differential (i₀ : I) (j₀ : J) (p H : I → K × K) (r U : J → K × K)
    (u m a : I → J → K) (A : I → K) (b : J → K)
    (h : GridEquations i₀ j₀ p r u m a)
    (diff : ∀ i j, 2 * dot (p i - r j) (H i - U j) = (m i j - u i j) * (A i - b j)) :
    GridEquations i₀ j₀ (fun i => liftPosition (p i) (H i)) (fun j => liftPosition (r j) (U j))
      (fun i j => liftScalar (u i j) (u i j * (A i - b j)))
      (fun i j => liftScalar (m i j) (-m i j * (A i - b j)))
      (fun i j => inl (a i j)) := by
  have hf₂ : (2 : DualNumber K).fst = 2 := rfl
  have hs₂ : (2 : DualNumber K).snd = 0 := rfl
  constructor
  · intro i j
    apply TrivSqZeroExt.ext
    · rw [chordSq_fst, fst_sub, fst_sub, hf₂]
      exact h.distance i j
    · rw [chordSq_snd, snd_sub, snd_sub, hs₂]
      change 2 * dot (p i - r j) (H i - U j) =
        0 - u i j * (A i - b j) - -m i j * (A i - b j)
      rw [diff]
      ring
  · intro i j
    apply TrivSqZeroExt.ext
    · exact h.inverse i j
    · simp only [DualNumber.snd_mul, snd_one]
      change u i j * (-m i j * (A i - b j)) + u i j * (A i - b j) * m i j = 0
      ring
  · intro i j
    apply TrivSqZeroExt.ext
    · exact h.rect i j
    · simp only [DualNumber.snd_mul, fst_mul, fst_inl, snd_inl, zero_mul,
        add_zero]
      simp only [liftScalar, fst_mk, snd_mk]
      linear_combination (A i + A i₀ - b j - b j₀) * h.rect i j

Kernel axioms used: propext, Quot.sound.

Lemma 5.4 Repeated columns of the ordered grid

Lean verified

Suppose all column positions are the same point r , with the same nonzero chord label c i on each edge from row i . If L ( p i , r ) = 2 − c i − c i − 1 , the grid has a simultaneous motion.

Proof

Keep the columns fixed and choose a row velocity H i with 2 ( p i − r ) ⋅ H i = c i − 1 − c i . When p i = r , the chord equation gives c i = 1 . Otherwise the linear form on H i is nonzero. Taking row scalar one and column scalar zero gives the required nonzero differences on every edge.

Inspect the Lean declarations

PlanarUnitDistances.CartesianGrid.repeated

∀ {k : Type u_1} {I : Type u_2} {J : Type u} [inst : Field k] [CharZero k] (p : I → k × k) (s : J → k × k)
  (c : I → J → k) (j₀ : J),
  (∀ (j : J), s j = s j₀) →
    (∀ (i : I) (j : J), c i j = c i j₀) →
      (∀ (i : I), c i j₀ ≠ 0) →
        (∀ (i : I), PlanarUnitDistances.Fibre.chordSq (p i) (s j₀) = 2 - c i j₀ - (c i j₀)⁻¹) →
          PlanarUnitDistances.CartesianGrid.Moving p s c
Lean source · PlanarUnitDistances/SmallSideAssembly.lean, lines 36–67
theorem repeated [CharZero k] (p : I → k × k) (s : J → k × k) (c : I → J → k)
    (j₀ : J) (hr : ∀ j, s j = s j₀) (hc : ∀ i j, c i j = c i j₀)
    (hne : ∀ i, c i j₀ ≠ 0)
    (hd : ∀ i, chordSq (p i) (s j₀) = 2-c i j₀-(c i j₀)⁻¹) : Moving p s c := by
  classical
  have hrow (i : I) : ∃ H : k × k, 2*dot (p i-s j₀) H = (c i j₀)⁻¹-c i j₀ := by
    let z := c i j₀
    by_cases hx : (p i).1-(s j₀).1=0
    · by_cases hy : (p i).2-(s j₀).2=0
      · have hh := hd i
        simp [chordSq,hx,hy] at hh
        have hm : z*z⁻¹=1 := mul_inv_cancel₀ (hne i)
        have hz : (z⁻¹-z)^2=0 := by
          change 0=2-z-z⁻¹ at hh
          linear_combination (2+z+z⁻¹)*hh-4*hm
        refine ⟨0,?_⟩
        change 2*dot (p i-s j₀) 0 = z⁻¹-z
        rw [eq_zero_of_pow_eq_zero hz]
        simp [dot]
      · refine ⟨(0,(z⁻¹-z)/(2*((p i).2-(s j₀).2))),?_⟩
        simp only [dot,Prod.fst_sub,Prod.snd_sub,mul_zero,zero_add]
        change 2*(_*((z⁻¹-z)/(2*_)))=z⁻¹-z
        field_simp <;> ring
    · refine ⟨((z⁻¹-z)/(2*((p i).1-(s j₀).1)),0),?_⟩
      simp only [dot,Prod.fst_sub,Prod.snd_sub,mul_zero,add_zero]
      change 2*(_*((z⁻¹-z)/(2*_)))=z⁻¹-z
      field_simp <;> ring
  choose H hH using hrow
  refine ⟨H,fun _ ↦ 0,fun _ ↦ 1,fun _ ↦ 0,?_⟩
  intro i j
  refine ⟨one_ne_zero,?_⟩
  simpa only [sub_zero,mul_one,hr j,hc i j] using hH i

Kernel axioms used: propext, Classical.choice, Quot.sound.

5.2 Height of a stationary coordinate

Lemma 5.5 Simultaneous motion or a stationary edge

Lean verified

On a vector space over an infinite field, finitely many linear forms either are all nonzero on one vector of a given tangent subspace, or one form vanishes on that entire subspace.

Proof

Apply the finite-union theorem for proper subspaces to the kernels of the restricted forms.

Inspect the Lean declarations

PlanarUnitDistances.simultaneous_motion_or_stationarity

∀ {K : Type u_1} {V : Type u_2} {E : Type u_3} [inst : Field K] [Infinite K] [inst_2 : AddCommGroup V]
  [inst_3 : _root_.Module K V] [Finite E] (T : Submodule K V) (dRatio : E → V →ₗ[K] K),
  (∃ v ∈ T, ∀ (e : E), (dRatio e) v ≠ 0) ∨ ∃ e, ∀ v ∈ T, (dRatio e) v = 0
Lean source · PlanarUnitDistances/Stationarity.lean, lines 18–37
/-- On a prescribed tangent subspace, either one vector moves every ratio, or
one ratio has zero differential on the entire tangent subspace. -/
theorem simultaneous_motion_or_stationarity [Finite E] (T : Submodule K V)
    (dRatio : E → V →ₗ[K] K) :
    (∃ v ∈ T, ∀ e, dRatio e v ≠ 0) ∨ (∃ e, ∀ v ∈ T, dRatio e v = 0) := by
  classical
  by_cases h : ∃ v ∈ T, ∀ e, dRatio e v ≠ 0
  · exact Or.inl h
  · right
    push Not at h
    let f (e : E) := (dRatio e).comp T.subtype
    have hc : (⋃ e, ((f e).ker : Set T)) = Set.univ := by
      apply Set.eq_univ_of_forall
      intro v
      obtain ⟨e, he⟩ := h v v.property
      exact Set.mem_iUnion.mpr ⟨e, he⟩
    obtain ⟨e, he⟩ := Subspace.exists_eq_top_of_iUnion_eq_univ hc
    refine ⟨e, fun v hv ↦ ?_⟩
    have hm : (⟨v, hv⟩ : T) ∈ (f e).ker := he.symm ▸ Submodule.mem_top
    exact hm

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.6 Selecting rows by extendible column velocities

Lean verified

Choose the base column 0 . Let U j ∈ k 2 be the column velocities and let b j ∈ k for j ≠ 0 , with b 0 = 0 . For each row i let E i be the subspace of shared data ( U , b ) for which there are H i ∈ k 2 , A i ∈ k satisfying, for all columns j ,

2 ( p i − r j ) ⋅ ( H i − U j ) = R i j ( A i − b j ) .

If two columns occupy distinct positions, at most 3 l − 4 of the subspaces E i have intersection equal to ⋂ i E i . After adjoining the target row, and a second row if necessary, stationarity of A i e − b j e persists on the selected subgrid of between two and 3 l − 3 rows.

Proof

The shared space has dimension 2 l + ( l − 1 ) = 3 l − 1 . Each E i contains the same three-dimensional space of rigid column velocities: a translation and rotation of the columns extend by the same motion of p i , with all logarithmic velocities zero. As long as the current intersection strictly contains the full intersection, intersect it with one E i that lowers its dimension. Its dimension stays at least three. For a velocity of the selected rows, the shared data therefore extend to every omitted row. The local extensions can be chosen independently, and one keeps the specified velocity on the target row. Applying stationarity on the full grid gives the result.

Inspect the Lean declarations

PlanarUnitDistances.GridLocalization.localize_logarithmic_tangent

∀ {k : Type u_1} {I : Type u_2} {J : Type u_3} [inst : Field k] [inst_1 : Fintype J] [Nontrivial I]
  (p : I → k × k) (s : Option J → k × k) (R : I → Option J → k) (iₑ : I) (jₑ j j' : Option J),
  s j ≠ s j' →
    (∀ (b : PlanarUnitDistances.GridLocalization.Shared k J) (u : I → Fin 3 → k),
        (∀ (i : I) (q : Option J), PlanarUnitDistances.GridLocalization.rowEquation p s R i (u i) b q) →
          u iₑ 2 - PlanarUnitDistances.GridLocalization.colLog b jₑ = 0) →
      ∃ S,
        iₑ ∈ S ∧
          2 ≤ S.card ∧
            S.card ≤ 3 * Fintype.card (Option J) - 3 ∧
              ∀ (b : PlanarUnitDistances.GridLocalization.Shared k J) (u : I → Fin 3 → k),
                (∀ i ∈ S,
                    ∀ (q : Option J), PlanarUnitDistances.GridLocalization.rowEquation p s R i (u i) b q) →
                  u iₑ 2 - PlanarUnitDistances.GridLocalization.colLog b jₑ = 0
Lean source · PlanarUnitDistances/GridLocalization.lean, lines 111–162
/-- A target stationary on the full normalized tangent remains stationary on a
subgrid retaining all columns, its own row, and at most `3l−3` rows in total. -/
theorem localize_logarithmic_tangent [Fintype J] [Nontrivial I] (p : I → k × k)
    (s : Option J → k × k) (R : I → Option J → k) (iₑ : I) (jₑ j j' : Option J)
    (hj : s j ≠ s j')
    (stationary : ∀ (b : Shared k J) (u : I → Fin 3 → k),
      (∀ i q, rowEquation p s R i (u i) b q) → u iₑ 2 - colLog b jₑ = 0) :
    ∃ S : Finset I, iₑ ∈ S ∧ 2 ≤ S.card ∧ S.card ≤ 3 * Fintype.card (Option J) - 3 ∧
      ∀ (b : Shared k J) (u : I → Fin 3 → k),
        (∀ i ∈ S, ∀ q, rowEquation p s R i (u i) b q) → u iₑ 2 - colLog b jₑ = 0 := by
  classical
  let M := LinearMap.range (sharedRigid s)
  obtain ⟨T, hcard, hT⟩ := select_intersection (extendible p s R) M ⊤
    (rigid_extendible p s R) le_top
  have hm : Module.finrank k M = 3 := by
    rw [show M = LinearMap.range (sharedRigid s) from rfl,
      LinearMap.finrank_range_of_inj (sharedRigid_injective s j j' hj), Module.finrank_pi]
    simp
  have hdim : Module.finrank k (Shared k J) = 3 * Fintype.card (Option J) - 1 := by
    simp [Shared, Module.finrank_prod]
    omega
  rw [hm, finrank_top, hdim] at hcard
  let V := insert iₑ T
  have heV : iₑ ∈ V := Finset.mem_insert_self ..
  have hV : V.card ≤ 3 * Fintype.card (Option J) - 3 := by
    have := Finset.card_insert_le iₑ T
    change (insert iₑ T).card ≤ _
    omega
  have hl : 2 ≤ Fintype.card (Option J) :=
    Fintype.one_lt_card_iff_nontrivial.mpr ⟨⟨j, j', fun he ↦ hj (congrArg s he)⟩⟩
  obtain ⟨S, hVS, hS₂, hSmax⟩ : ∃ S : Finset I, V ⊆ S ∧ 2 ≤ S.card ∧
      S.card ≤ 3 * Fintype.card (Option J) - 3 := by
    by_cases hv : 2 ≤ V.card
    · exact ⟨V, Finset.Subset.rfl, hv, hV⟩
    · obtain ⟨i', hi'⟩ := exists_ne iₑ
      refine ⟨insert i' V, Finset.subset_insert .., ?_, ?_⟩
      · apply Finset.one_lt_card.mpr
        exact ⟨i', Finset.mem_insert_self .., iₑ, Finset.mem_insert_of_mem heV, hi'⟩
      · have := Finset.card_insert_le i' V
        omega
  refine ⟨S, hVS heV, hS₂, hSmax, ?_⟩
  intro b u hu
  have hfull := hT b Submodule.mem_top (fun i hi ↦
    show b ∈ extendible p s R i from ⟨u i, hu i (hVS (Finset.mem_insert_of_mem hi))⟩)
  choose v hv using (show ∀ i, ∃ w, ∀ q, rowEquation p s R i w b q from hfull)
  let v' (i : I) := if i = iₑ then u i else v i
  have hh (i : I) (q : Option J) : rowEquation p s R i (v' i) b q := by
    by_cases he : i = iₑ
    · subst i
      simpa [v'] using hu iₑ (hVS heV) q
    · simpa [v', he] using hv i q
  simpa [v'] using stationary b v' hh

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.GridLocalization.select_intersection

∀ {k : Type u_1} {V : Type u_2} {I : Type u_3} [inst : Field k] [inst_1 : AddCommGroup V]
  [inst_2 : _root_.Module k V] [FiniteDimensional k V] (F : I → Submodule k V) (M U : Submodule k V),
  (∀ (i : I), M ≤ F i) →
    M ≤ U →
      ∃ S,
        S.card + Module.finrank k ↥M ≤ Module.finrank k ↥U ∧ ∀ v ∈ U, (∀ i ∈ S, v ∈ F i) → ∀ (i : I), v ∈ F i
Lean source · PlanarUnitDistances/GridLocalization.lean, lines 15–36
/-- If every subspace contains `M`, at most `dim U − dim M` of them cut a
starting subspace `U ≥ M` down to its intersection with all the subspaces. -/
theorem select_intersection (F : I → Submodule k V) (M U : Submodule k V)
    (hm : ∀ i, M ≤ F i) (hU : M ≤ U) :
    ∃ S : Finset I, S.card + Module.finrank k M ≤ Module.finrank k U ∧
      ∀ v ∈ U, (∀ i ∈ S, v ∈ F i) → ∀ i, v ∈ F i := by
  classical
  by_cases hall : ∀ i, U ≤ F i
  · exact ⟨∅, by simpa using Submodule.finrank_mono hU, fun v hv _ i ↦ hall i hv⟩
  · push Not at hall
    obtain ⟨i, hi⟩ := hall
    have hlt : U ⊓ F i < U := lt_of_le_of_ne inf_le_left (fun he ↦ hi (inf_eq_left.mp he))
    have hd := Submodule.finrank_lt_finrank_of_lt hlt
    obtain ⟨S, hcard, hS⟩ := select_intersection F M (U ⊓ F i) hm (le_inf hU (hm i))
    refine ⟨insert i S, ?_, ?_⟩
    · have hb := Finset.card_insert_le i S
      omega
    · intro v hv hw
      exact hS v ⟨hv, hw i (Finset.mem_insert_self ..)⟩
        (fun j hj ↦ hw j (Finset.mem_insert_of_mem hj))
termination_by Module.finrank k U
decreasing_by exact hd

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.7 Localization on the concrete torus fibre

Lean verified

Suppose there are k , l ≥ 2 rows and columns respectively, two of the l column positions are distinct, and a ratio differential vanishes on the full fibre tangent. It already vanishes on the tangent of a subgrid through that edge using all columns and at most 3 l − 3 left rows. One may retain at least two rows.

Proof

Write A i = d u i / u i , b j = − d v j / v j , and R i j = λ i j − 1 − λ i j . Differentiating the two inverse equations determines the velocities of the inverse coordinates. Substitution into every distance differential gives precisely the row equations of Lemma 5.6, and d λ i j = λ i j ( A i − b j ) . Conversely those equations give a vector in the kernel of the actual torus Jacobian. Apply the preceding row selection. For any retained base row i 0 replace v j by a i 0 j v j and a i j by β i j = a i j / a i 0 j . This leaves all represented ratios unchanged. Since the base-column coefficients are one,

β i j = λ i j λ i 0 0 λ i 0 λ i 0 j .

Every velocity satisfying the normalized subgrid Jacobian thus gives one of the selected logarithmic velocities, on which the target derivative vanishes. The conclusion concerns the kernel of the normalized subgrid’s own polynomial Jacobian.

Inspect the Lean declarations

PlanarUnitDistances.TorusCritical.sparse_subgrid

∀ {I : Type u_1} {J : Type u_2} {k : Type u_3} [inst : Field k] [inst_1 : Fintype I] [inst_2 : Fintype J]
  (p : I → k × k) (s : Option J → k × k) (a : I → Option J → kˣ) (i₀ : I)
  (sol : PlanarUnitDistances.Fibre.TorusSolution i₀ none p s a) [Nontrivial I] (ha : ∀ (i : I), a i none = 1)
  (iₑ : I) (jₑ j j' : Option J),
  s j ≠ s j' →
    (∀ (v : PlanarUnitDistances.TorusCritical.Coord I J → k),
        (∀ (e : PlanarUnitDistances.TorusCritical.Equation I J),
            (PlanarUnitDistances.CriticalLocus.jacobianRow
                  (PlanarUnitDistances.TorusCritical.coordinates p s a i₀ sol)
                  (PlanarUnitDistances.TorusCritical.equation a e))
                v =
              0) →
          (PlanarUnitDistances.CriticalLocus.jacobianRow
                (PlanarUnitDistances.TorusCritical.coordinates p s a i₀ sol)
                (PlanarUnitDistances.TorusCritical.ratio a iₑ jₑ))
              v =
            0) →
      ∃ S,
        ∃ (hi : iₑ ∈ S),
          2 ≤ S.card ∧
            S.card ≤ 3 * Fintype.card (Option J) - 3 ∧
              ∀ (b₀ : ↥S),
                let β := PlanarUnitDistances.TorusCritical.restrictedCoefficient a S b₀;
                have y :=
                  PlanarUnitDistances.TorusCritical.coordinates (fun i => p ↑i) s β b₀
                    (PlanarUnitDistances.TorusCritical.restrictedSolution p s a i₀ sol S b₀ ha);
                ∀ (v : PlanarUnitDistances.TorusCritical.Coord (↥S) J → k),
                  (∀ (e : PlanarUnitDistances.TorusCritical.Equation (↥S) J),
                      (PlanarUnitDistances.CriticalLocus.jacobianRow y
                            (PlanarUnitDistances.TorusCritical.equation β e))
                          v =
                        0) →
                    (PlanarUnitDistances.CriticalLocus.jacobianRow y
                          (PlanarUnitDistances.TorusCritical.ratio β ⟨iₑ, hi⟩ jₑ))
                        v =
                      0
Lean source · PlanarUnitDistances/SparseTorus.lean, lines 92–127
/-- Manuscript sparse localization on the actual full and normalized subgrid
Jacobian kernels. The selected grid retains the target and all columns. -/
theorem sparse_subgrid [Nontrivial I] (ha : ∀ i, a i none = 1)
    (iₑ : I) (jₑ j j' : Option J) (hj : s j ≠ s j')
    (hs : ∀ v : Coord I J → k,
      (∀ e, jacobianRow (coordinates p s a i₀ sol) (equation a e) v = 0) →
      jacobianRow (coordinates p s a i₀ sol) (ratio a iₑ jₑ) v = 0) :
    ∃ (S : Finset I) (hi : iₑ ∈ S), 2 ≤ S.card ∧ S.card ≤ 3 * Fintype.card (Option J) - 3 ∧
      ∀ b₀ : S, let β := restrictedCoefficient a S b₀
        let y := coordinates (fun i : S ↦ p i) s β b₀ (restrictedSolution p s a i₀ sol S b₀ ha)
        ∀ v : Coord S J → k, (∀ e, jacobianRow y (equation β e) v = 0) →
          jacobianRow y (ratio β ⟨iₑ,hi⟩ jₑ) v = 0 := by
  classical
  obtain ⟨S, hi, hsmall, hlarge, hlog⟩ := localize_stationary_ratio p s a i₀ sol iₑ jₑ j j' hj hs
  refine ⟨S, hi, hsmall, hlarge, ?_⟩
  intro b₀
  let β := restrictedCoefficient a S b₀
  let q := fun i : S ↦ p i
  let small := restrictedSolution p s a i₀ sol S b₀ ha
  change ∀ v : Coord S J → k, (∀ e, jacobianRow (coordinates q s β b₀ small) (equation β e) v = 0) →
    jacobianRow (coordinates q s β b₀ small) (ratio β ⟨iₑ,hi⟩ jₑ) v = 0
  intro v hv
  let u := readLocal q s β b₀ small v
  let b := readShared q s β b₀ small v
  let u' (i : I) := if hi : i ∈ S then u ⟨i,hi⟩ else 0
  have hsmallRoot (i : S) (j : Option J) : chordRoot q s β b₀ small i j = chordRoot p s a i₀ sol i j := by
    simp only [chordRoot, q, β, small, restricted_chordRatio]
  have hrows (i : I) (hi' : i ∈ S) (j : Option J) :
      rowEquation p s (chordRoot p s a i₀ sol) i (u' i) b j := by
    have he := kernel_implies_rowEquation q s β b₀ small v hv ⟨i,hi'⟩ j
    simpa only [rowEquation, hsmallRoot, q, u', dif_pos hi', u, b] using he
  have hzero := hlog b u' hrows
  have h' : u ⟨iₑ,hi⟩ 2 - colLog b jₑ = 0 := by simpa [u', hi] using hzero
  change jacobianRow (coordinates q s β b₀ small) (ratio β ⟨iₑ,hi⟩ jₑ) v = 0
  rw [← reconstruct_velocity q s β b₀ small v hv, ratio_velocity]
  exact mul_eq_zero_of_right _ h'

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.TorusCritical.reconstruct_velocity

∀ {I : Type u_1} {J : Type u_2} {k : Type u_3} [inst : Field k] [inst_1 : Fintype I] [inst_2 : Fintype J]
  (p : I → k × k) (s : Option J → k × k) (a : I → Option J → kˣ) (i₀ : I)
  (sol : PlanarUnitDistances.Fibre.TorusSolution i₀ none p s a)
  (v : PlanarUnitDistances.TorusCritical.Coord I J → k),
  (∀ (e : PlanarUnitDistances.TorusCritical.Equation I J),
      (PlanarUnitDistances.CriticalLocus.jacobianRow
            (PlanarUnitDistances.TorusCritical.coordinates p s a i₀ sol)
            (PlanarUnitDistances.TorusCritical.equation a e))
          v =
        0) →
    PlanarUnitDistances.TorusCritical.gridVelocity p s a i₀ sol
        (PlanarUnitDistances.TorusCritical.readLocal p s a i₀ sol v)
        (PlanarUnitDistances.TorusCritical.readShared p s a i₀ sol v) =
      v
Lean source · PlanarUnitDistances/SparseTorus.lean, lines 21–40
/-- An arbitrary Jacobian velocity reconstructs exactly from its logarithmic
unit velocities. The two inverse-coordinate derivatives are forced by the
inverse equations. -/
theorem reconstruct_velocity (v : Coord I J → k)
    (hv : ∀ e, jacobianRow (coordinates p s a i₀ sol) (equation a e) v = 0) :
    gridVelocity p s a i₀ sol (readLocal p s a i₀ sol v) (readShared p s a i₀ sol v) = v := by
  have hone : jacobianRow (coordinates p s a i₀ sol) (1 : Poly I J k) v = 0 := derivative_constant _ _ 1
  funext c
  rcases c with ⟨i,h⟩ | (⟨j,h⟩ | ⟨j,h⟩)
  · have hi := hv (.inl i)
    simp [equation, derivative_sub, derivative_mul, derivative_variable, hone, coordinates] at hi
    fin_cases h <;> simp [gridVelocity, readLocal, ← mul_assoc]
    field_simp at hi ⊢
    linear_combination -hi
  · rfl
  · have hj := hv (.inr (.inl j))
    simp [equation, derivative_sub, derivative_mul, derivative_variable, hone, colUnit, coordinates] at hj
    fin_cases h <;> simp [gridVelocity, readShared, ← mul_assoc]
    field_simp at hj ⊢
    linear_combination -hj

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.8 Height of an eliminant root

Lean verified

If 0 ≠ f ∈ K [ T ] and f ( c ) = 0 in a common number field K , then

h ( c ) ≤ h proj ( coeff f ) + log ⁡ 2.

Here the projective tuple contains all coefficients through the leading term.

Proof

At a place v put a = | c | v , b = | lc f | v and A = max i | f i | v . For a > 1 the root equation gives b a d ≤ A ∑ i < d a i at infinity. Multiplication by a − 1 gives b ( a − 1 ) < A , hence b a ≤ 2 A . At a finite place b a d ≤ A a d − 1 , hence b a ≤ A . The same two bounds follow from b ≤ A when a ≤ 1 . Apply the product formula to the projective pair ( lc ( f ) c , lc ( f ) ) .

Inspect the Lean declarations

PlanarUnitDistances.EliminantHeight.weilHeight_root_le

∀ {K : Type u_1} [inst : Field K] [inst_1 : NumberField K] (p : Polynomial K),
  p ≠ 0 →
    ∀ {z : K},
      p.IsRoot z →
        PlanarUnitDistances.weilHeight z ≤
          PlanarUnitDistances.EliminantHeight.coefficientHeight p + Real.log 2
Lean source · PlanarUnitDistances/EliminantHeight.lean, lines 97–151
/-- For a root in the coefficient number field (or a common splitting field),
its absolute logarithmic Weil height is bounded by the normalized projective
coefficient height of its defining polynomial plus log 2, in every degree. -/
theorem weilHeight_root_le (p : K[X]) (hp : p ≠ 0) {z : K} (hz : p.IsRoot z) :
    weilHeight z ≤ coefficientHeight p + log 2 := by
  classical
  let x := p.leadingCoeff • (![z, 1] : Fin 2 → K)
  let y := coefficients p
  have hlc := leadingCoeff_ne_zero.mpr hp
  have hx : x ≠ 0 := by
    intro h
    have h' := congrFun h 1
    simp [x, hlc] at h'
  have hy : y ≠ 0 := by
    intro h
    exact hlc (congrFun h (Fin.last p.natDegree))
  have harch (v : AbsoluteValue K ℝ) (i : Fin 2) : v (x i) ≤ 2 * ⨆ j, v (y j) := by
    fin_cases i
    · exact arch_root_bound v p hp hz
    · change v (p.leadingCoeff * 1) ≤ _
      rw [mul_one]
      have hA : v p.leadingCoeff ≤ ⨆ j, v (y j) := coeff_le v p le_rfl
      linarith [v.nonneg p.leadingCoeff]
  have hnon (v : AbsoluteValue K ℝ) (hna : IsNonarchimedean v) (i : Fin 2) :
      v (x i) ≤ ⨆ j, v (y j) := by
    fin_cases i
    · exact nonarch_root_bound v hna p hp hz
    · change v (p.leadingCoeff * 1) ≤ _
      rw [mul_one]
      exact coeff_le v p le_rfl
  have hmul : Height.mulHeight x ≤ (2 : ℝ)^totalWeight K * Height.mulHeight y := by
    rw [Height.mulHeight_eq hx, Height.mulHeight_eq hy]
    have ha : (archAbsVal.map (fun v : AbsoluteValue K ℝ ↦ ⨆ i, v (x i))).prod ≤
        (2 : ℝ)^totalWeight K * (archAbsVal.map (fun v : AbsoluteValue K ℝ ↦ ⨆ j, v (y j))).prod := by
      calc
        _ ≤ (archAbsVal.map (fun v : AbsoluteValue K ℝ ↦ 2 * ⨆ j, v (y j))).prod :=
          Multiset.prod_map_le_prod_map₀ _ _
            (fun v _ ↦ Real.iSup_nonneg_of_nonnegHomClass v _) (fun v _ ↦ ciSup_le (harch v))
        _ = _ := by simp [Multiset.prod_map_mul, totalWeight]
    have hn : (∏ᶠ v : nonarchAbsVal, ⨆ i, v.val (x i)) ≤ ∏ᶠ v : nonarchAbsVal, ⨆ j, v.val (y j) :=
      finprod_le_finprod₀ (by fun_prop) (fun v ↦ Real.iSup_nonneg_of_nonnegHomClass v.val _)
        (by fun_prop) (fun v ↦ ciSup_le (hnon v.val (isNonarchimedean v.val v.prop)))
    rw [← mul_assoc]
    exact mul_le_mul ha hn (finprod_nonneg fun v ↦ Real.iSup_nonneg_of_nonnegHomClass v.val _)
      (mul_nonneg (by positivity) (Multiset.prod_map_nonneg fun v _ ↦ Real.iSup_nonneg_of_nonnegHomClass v _))
  have hlog := log_le_log (mulHeight_pos _) hmul
  rw [log_mul (by positivity : (2:ℝ)^totalWeight K ≠ 0) (mulHeight_ne_zero y),
    log_pow, NumberField.totalWeight_eq_finrank] at hlog
  change Height.logHeight x ≤ _ + Height.logHeight y at hlog
  rw [show Height.logHeight x = Height.logHeight₁ z from
    (logHeight_smul_eq_logHeight _ hlc).trans (logHeight₁_eq_logHeight z).symm] at hlog
  unfold weilHeight coefficientHeight
  have hD : 0 < (Module.finrank ℚ K : ℝ) := by exact_mod_cast Module.finrank_pos
  rw [div_add' _ _ _ hD.ne', div_le_div_iff_of_pos_right hD]
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.EliminantHeight.arch_root_bound

∀ {K : Type u_1} [inst : Field K] (v : AbsoluteValue K ℝ) (p : Polynomial K),
  p ≠ 0 →
    ∀ {z : K},
      p.IsRoot z → v (p.leadingCoeff * z) ≤ 2 * ⨆ j, v (PlanarUnitDistances.EliminantHeight.coefficients p j)
Lean source · PlanarUnitDistances/EliminantHeight.lean, lines 26–56
/-- Archimedean Cauchy estimate in homogeneous coefficient coordinates. -/
theorem arch_root_bound (v : AbsoluteValue K ℝ) (p : K[X]) (hp : p ≠ 0) {z : K}
    (hz : p.IsRoot z) : v (p.leadingCoeff * z) ≤ 2 * ⨆ j, v (coefficients p j) := by
  let A := ⨆ j, v (coefficients p j)
  let a := v z
  let b := v p.leadingCoeff
  have hb : 0 < b := (v.pos (leadingCoeff_ne_zero.mpr hp))
  have hbA : b ≤ A := coeff_le v p le_rfl
  rw [map_mul]
  change b*a ≤ 2*A
  by_contra! h
  have ha : 1 < a := by
    by_contra! ha
    have hb' := mul_le_mul_of_nonneg_left ha hb.le
    linarith
  have hid := congrArg v (root_identity p hz)
  simp only [map_mul, map_pow, map_neg_eq_map] at hid
  have hineq : b*a^p.natDegree ≤ A*(∑ i ∈ Finset.range p.natDegree, a^i) := by
    rw [Finset.mul_sum]
    calc
      _ = _ := hid
      _ ≤ _ := v.sum_le _ _
      _ ≤ _ := Finset.sum_le_sum fun i hi ↦ by
        rw [map_mul, map_pow]
        exact mul_le_mul_of_nonneg_right (coeff_le v p (Finset.mem_range.mp hi).le)
          (pow_nonneg (v.nonneg z) _)
  have hmult := mul_le_mul_of_nonneg_right hineq (sub_nonneg.mpr ha.le)
  rw [mul_assoc A, geom_sum_mul] at hmult
  have hstrong : A < b*a-b := by linarith
  have hbad := mul_lt_mul_of_pos_right hstrong (pow_pos (zero_lt_one.trans ha) p.natDegree)
  nlinarith only [hbad, hmult, hb, hbA]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.EliminantHeight.nonarch_root_bound

∀ {K : Type u_1} [inst : Field K] (v : AbsoluteValue K ℝ),
  IsNonarchimedean ⇑v →
    ∀ (p : Polynomial K),
      p ≠ 0 →
        ∀ {z : K},
          p.IsRoot z → v (p.leadingCoeff * z) ≤ ⨆ j, v (PlanarUnitDistances.EliminantHeight.coefficients p j)
Lean source · PlanarUnitDistances/EliminantHeight.lean, lines 58–91
/-- At nonarchimedean places the leading term is bounded with factor one. -/
theorem nonarch_root_bound (v : AbsoluteValue K ℝ) (hna : IsNonarchimedean v)
    (p : K[X]) (hp : p ≠ 0) {z : K} (hz : p.IsRoot z) :
    v (p.leadingCoeff * z) ≤ ⨆ j, v (coefficients p j) := by
  let A := ⨆ j, v (coefficients p j)
  have hbA : v p.leadingCoeff ≤ A := coeff_le v p le_rfl
  rw [map_mul]
  by_cases ha : v z ≤ 1
  · exact (mul_le_of_le_one_right (v.nonneg _) ha).trans hbA
  have hgt := lt_of_not_ge ha
  have hn : p.natDegree ≠ 0 := by
    intro h
    have hc := eq_C_of_natDegree_eq_zero h
    have hroot := hz
    rw [IsRoot.def, hc, eval_C] at hroot
    have h₀ : p.coeff 0 = 0 := hroot
    exact hp (by simpa [h₀] using hc)
  obtain ⟨d,hd⟩ := Nat.exists_eq_succ_of_ne_zero hn
  have hne : (Finset.range p.natDegree).Nonempty := ⟨0, Finset.mem_range.mpr (Nat.pos_of_ne_zero hn)⟩
  obtain ⟨i,hi,hle⟩ := hna.finset_image_add_of_nonempty (fun i ↦ p.coeff i * z^i) hne
  have hid := congrArg v (root_identity p hz)
  simp only [map_mul, map_pow, map_neg_eq_map] at hid
  rw [← hid, map_mul, map_pow] at hle
  have hpow : v z ^ i ≤ v z ^ d :=
    pow_le_pow_right₀ hgt.le (by have := Finset.mem_range.mp hi; omega)
  have hbound := hle.trans (mul_le_mul (coeff_le v p (Finset.mem_range.mp hi).le) hpow
    (pow_nonneg (v.nonneg _) _) ((v.nonneg _).trans hbA))
  change v p.leadingCoeff * v z ^ p.natDegree ≤ A * v z ^ d at hbound
  conv at hbound => lhs; rw [hd, pow_succ]
  change v p.leadingCoeff * v z ≤ A
  exact le_of_mul_le_mul_right
    (show (v p.leadingCoeff * v z) * v z ^ d ≤ A * v z ^ d by
      simpa only [mul_assoc, mul_comm (v z) (v z ^ d)] using hbound)
    (pow_pos (zero_lt_one.trans hgt) d)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.9 Three rigid velocities in the concrete Jacobian kernel

Lean verified

If two column positions are distinct, the Jacobian of the m -by- l torus quadrics has rank r satisfying r + 3 ≤ 4 ( m + l ) − 2 .

Proof

For ( a , b , ω ) ∈ k 3 give each position ( x , y ) velocity ( a − ω y , b + ω x ) and give all torus coordinates zero velocity. Every distance square has derivative 2 ( δ x ) ( − ω δ y ) + 2 ( δ y ) ( ω δ x ) = 0 , where δ x , δ y are the position differences across the edge. The inverse equations involve only the torus coordinates. Two distinct column positions force ω = 0 if this velocity vanishes, and then a = b = 0 . The Jacobian rows belong to the annihilator of this three-dimensional space.

Inspect the Lean declarations

PlanarUnitDistances.TorusCritical.torus_jacobian_rank_bound

∀ {I : Type u_1} {J : Type u_2} {k : Type u_3} [inst : Field k] (p : I → k × k) (s : Option J → k × k)
  [inst_1 : Fintype I] [inst_2 : Fintype J] (a : I → Option J → kˣ) (i₀ : I)
  (sol : PlanarUnitDistances.Fibre.TorusSolution i₀ none p s a) (j j' : Option J),
  s j ≠ s j' →
    Module.finrank k
          ↥(Submodule.span k
              (Set.range fun e =>
                PlanarUnitDistances.CriticalLocus.jacobianRow
                  (PlanarUnitDistances.TorusCritical.coordinates p s a i₀ sol)
                  (PlanarUnitDistances.TorusCritical.equation a e))) +
        3 ≤
      4 * (Fintype.card I + Fintype.card (Option J)) - 2
Lean source · PlanarUnitDistances/TorusRank.lean, lines 104–128
/-- The two distinct anchor positions make three independent velocities lie in
the Jacobian kernel, even if the grid point is singular. -/
theorem torus_jacobian_rank_bound (j j' : Option J) (h : s j ≠ s j') :
    Module.finrank k (Submodule.span k (Set.range
      (fun e ↦ jacobianRow (coordinates p s a i₀ sol) (equation a e)))) + 3 ≤
        4 * (Fintype.card I + Fintype.card (Option J)) - 2 := by
  let M := LinearMap.range (rigidMap p s)
  have hm : Module.finrank k M = 3 := by
    rw [show M = LinearMap.range (rigidMap p s) from rfl,
      LinearMap.finrank_range_of_inj (rigidMap_injective p s j j' h), Module.finrank_pi]
    simp
  have hle : Submodule.span k (Set.range
      (fun e ↦ jacobianRow (coordinates p s a i₀ sol) (equation a e))) ≤ M.dualAnnihilator := by
    apply Submodule.span_le.mpr
    rintro _ ⟨e,rfl⟩
    apply (Submodule.mem_dualAnnihilator _).mpr
    rintro _ ⟨w,rfl⟩
    exact equation_annihilates_rigid p s a i₀ sol e w
  calc
    _ ≤ Module.finrank k M.dualAnnihilator + 3 := Nat.add_le_add_right (Submodule.finrank_mono hle) _
    _ = Fintype.card (Coord I J) := by
      have hd := Subspace.finrank_add_finrank_dualAnnihilator_eq M
      rw [hm, Module.finrank_pi] at hd
      exact (add_comm _ _).trans hd
    _ = _ := by simp [Coord]; omega

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.TorusCritical.rigidMap_injective

∀ {I : Type u_1} {J : Type u_2} {k : Type u_3} [inst : Field k] (p : I → k × k) (s : Option J → k × k)
  (j j' : Option J), s j ≠ s j' → Function.Injective ⇑(PlanarUnitDistances.TorusCritical.rigidMap p s)
Lean source · PlanarUnitDistances/TorusRank.lean, lines 61–82
theorem rigidMap_injective (j j' : Option J) (h : s j ≠ s j') :
    Function.Injective (rigidMap p s) := by
  apply LinearMap.ker_eq_bot.mp
  apply LinearMap.ker_eq_bot'.mpr
  intro w hw
  have h₁ (j : Option J) : w 0 - w 2 * (s j).2 = 0 :=
    congrFun hw (.inr (.inl (j,0)))
  have h₂ (j : Option J) : w 1 + w 2 * (s j).1 = 0 :=
    congrFun hw (.inr (.inl (j,1)))
  have hw₂ : w 2 = 0 := by
    by_contra hne
    apply h
    apply Prod.ext
    · apply mul_left_cancel₀ hne
      linear_combination h₂ j - h₂ j'
    · apply mul_left_cancel₀ hne
      linear_combination h₁ j' - h₁ j
  have hw₀ := h₁ j
  have hw₁ := h₂ j
  simp only [hw₂, zero_mul, sub_zero, add_zero] at hw₀ hw₁
  funext i
  fin_cases i <;> assumption

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.TorusCritical.equation_annihilates_rigid

∀ {I : Type u_1} {J : Type u_2} {k : Type u_3} [inst : Field k] (p : I → k × k) (s : Option J → k × k)
  [inst_1 : Fintype I] [inst_2 : Fintype J] (a : I → Option J → kˣ) (i₀ : I)
  (sol : PlanarUnitDistances.Fibre.TorusSolution i₀ none p s a)
  (e : PlanarUnitDistances.TorusCritical.Equation I J) (w : Fin 3 → k),
  (PlanarUnitDistances.CriticalLocus.jacobianRow (PlanarUnitDistances.TorusCritical.coordinates p s a i₀ sol)
        (PlanarUnitDistances.TorusCritical.equation a e))
      ((PlanarUnitDistances.TorusCritical.rigidMap p s) w) =
    0
Lean source · PlanarUnitDistances/TorusRank.lean, lines 87–102
theorem equation_annihilates_rigid (e : Equation I J) (w : Fin 3 → k) :
    jacobianRow (coordinates p s a i₀ sol) (equation a e) (rigidMap p s w) = 0 := by
  change jacobianRow _ _ (rigidVelocity p s w) = 0
  have hu (j : Option J) (h : Fin 2) :
      jacobianRow (coordinates p s a i₀ sol) (colUnit (k := k) j h) (rigidVelocity p s w) = 0 := by
    cases j with
    | none => exact derivative_constant _ _ 1
    | some j => exact derivative_variable _ _ _
  have hone : jacobianRow (coordinates p s a i₀ sol) (1 : Poly I J k) (rigidVelocity p s w) = 0 :=
    derivative_constant _ _ 1
  rcases e with i | (j | ⟨i,j⟩)
  · simp [equation, derivative_sub, derivative_mul, derivative_variable, hone, rigidVelocity]
  · simp [equation, derivative_sub, derivative_mul, hu, hone]
  · simp [equation, ratio, inverseRatio, positionDifference, pow_two, derivative_add,
      derivative_sub, derivative_mul, derivative_variable, derivative_constant, hu, rigidVelocity, coordinates]
    ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.10 A constant critical coordinate on a component through the grid

Lean verified

Let x be a solution of the torus equations over an algebraically closed field k of characteristic zero. Write f = a i j u i v j for the chosen ratio, and let F α range over every torus equation. If d f ( x ) vanishes on the common kernel of all d F α ( x ) , set r = rank ( d F α ( x ) ) α . There are r independent rows indexed by α ν and scalars t ν such that the following equations define a locus containing ( x , t , f ( x ) ) .

\begin{align*} F_\alpha (X)& =0 \quad \text{for every }\alpha ,\\ \partial _h f(X)& =\sum _{\nu =1}^r T_\nu \, \partial _h F_{\alpha _\nu }(X) \quad \text{for every }h,\\ c& =f(X). \end{align*}

All equations have degree at most two. Some irreducible component through this point has c = f ( x ) identically. Equivalently, the ideal generated by the displayed equations has a minimal prime P contained in the point’s evaluation kernel with c − f ( x ) ∈ P .

Proof

The annihilator of the common Jacobian kernel is the span of its rows. Select a basis from those rows and expand d f ( x ) in it; its coefficients give t ν . The ideal therefore lies in the evaluation kernel at ( x , t , f ( x ) ) , which is prime and contains a minimal prime P over the ideal. Pass to the fraction field of the polynomial ring modulo P . For every k -derivation D , the polynomial chain rule gives

D f = ∑ h ( ∂ h f ) D X h = ∑ ν = 1 r T ν D F α ν = 0.

A transcendental element z of the fraction field extends to a transcendence basis. The partial derivative with respect to z extends over the separable algebraic extension and sends z to one. Thus c = f is algebraic over k and belongs to k . The coordinate ring embeds in its fraction field, so the same equality holds modulo P . Evaluating at the given point identifies the scalar with f ( x ) , including at a singular point. The Lean specialization uses the actual torus quadrics, with v 0 = t 0 = 1 ; multiplication by a fresh multiplier increases the degree of a partial derivative by at most one.

Inspect the Lean declarations

PlanarUnitDistances.TorusCritical.stationary_ratio_component

∀ {I : Type u_1} {J : Type u_2} {k : Type u_3} [inst : Field k] (p : I → k × k) (s : Option J → k × k)
  (a : I → Option J → kˣ) (i₀ : I) (sol : PlanarUnitDistances.Fibre.TorusSolution i₀ none p s a) [CharZero k]
  [IsAlgClosed k] [inst_3 : Fintype I] [inst_4 : Fintype J] (i : I) (j : Option J),
  (∀ (v : PlanarUnitDistances.TorusCritical.Coord I J → k),
      (∀ (e : PlanarUnitDistances.TorusCritical.Equation I J),
          (PlanarUnitDistances.CriticalLocus.jacobianRow
                (PlanarUnitDistances.TorusCritical.coordinates p s a i₀ sol)
                (PlanarUnitDistances.TorusCritical.equation a e))
              v =
            0) →
        (PlanarUnitDistances.CriticalLocus.jacobianRow
              (PlanarUnitDistances.TorusCritical.coordinates p s a i₀ sol)
              (PlanarUnitDistances.TorusCritical.ratio a i j))
            v =
          0) →
    ∃ r pick t,
      r =
          Module.finrank k
            ↥(Submodule.span k
                (Set.range fun e =>
                  PlanarUnitDistances.CriticalLocus.jacobianRow
                    (PlanarUnitDistances.TorusCritical.coordinates p s a i₀ sol)
                    (PlanarUnitDistances.TorusCritical.equation a e))) ∧
        (LinearIndependent k fun u =>
            PlanarUnitDistances.CriticalLocus.jacobianRow
              (PlanarUnitDistances.TorusCritical.coordinates p s a i₀ sol)
              (PlanarUnitDistances.TorusCritical.equation a (pick u))) ∧
          ∃
            P ∈
              (PlanarUnitDistances.CriticalLocus.incidenceIdeal
                  (PlanarUnitDistances.TorusCritical.ratio a i j)
                  (PlanarUnitDistances.TorusCritical.equation a) pick).minimalPrimes,
            P ≤
                RingHom.ker
                  (MvPolynomial.aeval
                    (PlanarUnitDistances.CriticalLocus.liftedPoint
                      (PlanarUnitDistances.TorusCritical.coordinates p s a i₀ sol) t
                      ↑(a i j * sol.row i * sol.col j))) ∧
              PlanarUnitDistances.CriticalLocus.outputVariable -
                    MvPolynomial.C ↑(a i j * sol.row i * sol.col j) ∈
                  P ∧
                ∀
                  (eqn :
                    PlanarUnitDistances.TorusCritical.Equation I J ⊕
                      PlanarUnitDistances.TorusCritical.Coord I J ⊕ Unit),
                  (PlanarUnitDistances.CriticalLocus.incidenceEquation
                        (PlanarUnitDistances.TorusCritical.ratio a i j)
                        (PlanarUnitDistances.TorusCritical.equation a) pick eqn).totalDegree ≤
                    2
Lean source · PlanarUnitDistances/TorusCritical.lean, lines 107–130
/-- The stationary chord ratio belongs to a constant-output irreducible component
through the specified grid. The ideal uses every explicit torus equation, even
when its corresponding row did not receive a multiplier. -/
theorem stationary_ratio_component [CharZero k] [IsAlgClosed k] [Fintype I] [Fintype J]
    (i : I) (j : Option J)
    (hs : ∀ v : Coord I J → k,
      (∀ e, jacobianRow (coordinates p s a i₀ sol) (equation a e) v = 0) →
      jacobianRow (coordinates p s a i₀ sol) (ratio a i j) v = 0) :
    ∃ (r : ℕ) (pick : Fin r → Equation I J) (t : Fin r → k),
      r = Module.finrank k (Submodule.span k (Set.range
        (fun e ↦ jacobianRow (coordinates p s a i₀ sol) (equation a e)))) ∧
      LinearIndependent k (fun u ↦ jacobianRow (coordinates p s a i₀ sol) (equation a (pick u))) ∧
      ∃ P ∈ (incidenceIdeal (ratio a i j) (equation a) pick).minimalPrimes,
        P ≤ RingHom.ker (aeval (liftedPoint (coordinates p s a i₀ sol) t
          (↑(a i j * sol.row i * sol.col j) : k))) ∧
        outputVariable - C (↑(a i j * sol.row i * sol.col j) : k) ∈ P ∧
        ∀ eqn, (incidenceEquation (ratio a i j) (equation a) pick eqn).totalDegree ≤ 2 := by
  obtain ⟨r, pick, t, hr, hi, P, hP, hlift, c, hc, hval⟩ :=
    stationary_coordinate_component (coordinates p s a i₀ sol) (ratio a i j) (equation a)
      (evaluate_equation p s a i₀ sol) hs
  rw [evaluate_ratio] at hlift hval
  change _ = c at hval
  refine ⟨r, pick, t, hr, hi, P, hP, hlift, hval ▸ hc, ?_⟩
  exact incidenceEquation_quadratic _ _ _ (ratio_degree a i j) (equation_degree a)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CriticalLocus.stationary_coordinate_component

∀ {k : Type u_1} {L : Type u_2} {X : Type u_3} {A : Type u_4} [inst : Field k] [inst_1 : Field L]
  [inst_2 : Algebra k L] [inst_3 : Fintype X] [CharZero k] [IsAlgClosed k] [Finite A] (x : X → L)
  (f : MvPolynomial X k) (g : A → MvPolynomial X k),
  (∀ (a : A), (MvPolynomial.aeval x) (g a) = 0) →
    (∀ (v : X → L),
        (∀ (a : A), (PlanarUnitDistances.CriticalLocus.jacobianRow x (g a)) v = 0) →
          (PlanarUnitDistances.CriticalLocus.jacobianRow x f) v = 0) →
      ∃ r pick t,
        r =
            Module.finrank L
              ↥(Submodule.span L (Set.range fun a => PlanarUnitDistances.CriticalLocus.jacobianRow x (g a))) ∧
          (LinearIndependent L fun j => PlanarUnitDistances.CriticalLocus.jacobianRow x (g (pick j))) ∧
            ∃ P ∈ (PlanarUnitDistances.CriticalLocus.incidenceIdeal f g pick).minimalPrimes,
              P ≤
                  RingHom.ker
                    (MvPolynomial.aeval
                      (PlanarUnitDistances.CriticalLocus.liftedPoint x t ((MvPolynomial.aeval x) f))) ∧
                ∃ c,
                  PlanarUnitDistances.CriticalLocus.outputVariable - MvPolynomial.C c ∈ P ∧
                    (MvPolynomial.aeval x) f = (algebraMap k L) c
Lean source · PlanarUnitDistances/CriticalLocus.lean, lines 288–320
/-- Without any multipliers given in advance, stationarity on the full
Jacobian kernel selects independent rows, lifts to the incidence locus with
exactly the rank many multipliers, and finds a component through the point
whose regular output function is a scalar. -/
theorem stationary_coordinate_component [CharZero k] [IsAlgClosed k] [Finite A]
    (x : X → L) (f : MvPolynomial X k) (g : A → MvPolynomial X k)
    (hz : ∀ a, aeval x (g a) = 0)
    (hstat : ∀ v : X → L, (∀ a, jacobianRow x (g a) v = 0) → jacobianRow x f v = 0) :
    ∃ (r : ℕ) (pick : Fin r → A) (t : Fin r → L),
      r = Module.finrank L (Submodule.span L (Set.range (fun a ↦ jacobianRow x (g a)))) ∧
      LinearIndependent L (fun j ↦ jacobianRow x (g (pick j))) ∧
      ∃ P ∈ (incidenceIdeal f g pick).minimalPrimes,
        P ≤ RingHom.ker (aeval (liftedPoint x t (aeval x f))) ∧
          ∃ c : k, outputVariable - C c ∈ P ∧ aeval x f = algebraMap k L c := by
  classical
  let row (a : A) := jacobianRow x (g a)
  have hf : jacobianRow x f ∈ Submodule.span L (Set.range row) :=
    mem_span_of_iInf_ker_le_ker (show (⨅ a, (row a).ker) ≤ (jacobianRow x f).ker from
      fun v hv ↦ hstat v (fun a ↦ (Submodule.mem_iInf _).mp hv a))
  obtain ⟨b, hb, hspan, hlin⟩ := Submodule.exists_fun_fin_finrank_span_eq L (Set.range row)
  choose pick hpick using hb
  have hrow : (fun j ↦ row (pick j)) = b := funext hpick
  rw [← hspan] at hf
  obtain ⟨t, ht⟩ := (Submodule.mem_span_range_iff_exists_fun L).mp hf
  refine ⟨_, pick, t, rfl, ?_, ?_⟩
  · change LinearIndependent L (fun j ↦ row (pick j))
    rwa [hrow]
  apply component_through_stationary_point x t f g pick hz
  intro i
  rw [← hrow] at ht
  have h := LinearMap.congr_fun ht (Pi.single i 1)
  simpa only [row, LinearMap.sum_apply, LinearMap.smul_apply, smul_eq_mul,
    jacobianRow_single] using h.symm

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CriticalLocus.output_constant_mod_prime

∀ {k : Type u_1} {X : Type u_2} {A : Type u_3} {R : Type u_4} [inst : Field k] [inst_1 : Fintype R]
  [CharZero k] [IsAlgClosed k] [Fintype X] (f : MvPolynomial X k) (g : A → MvPolynomial X k) (pick : R → A)
  (P : Ideal (MvPolynomial (PlanarUnitDistances.CriticalLocus.Variables X R) k)) [P.IsPrime],
  PlanarUnitDistances.CriticalLocus.incidenceIdeal f g pick ≤ P →
    ∃ c, PlanarUnitDistances.CriticalLocus.outputVariable - MvPolynomial.C c ∈ P
Lean source · PlanarUnitDistances/CriticalLocus.lean, lines 223–252
/-- On every prime closed subset of the multiplier locus the output equals a base
scalar modulo the prime ideal, independently of regularity or Jacobian rank. -/
theorem output_constant_mod_prime [CharZero k] [IsAlgClosed k] [Fintype X]
    (f : MvPolynomial X k) (g : A → MvPolynomial X k) (pick : R → A)
    (P : Ideal (MvPolynomial (Variables X R) k)) [P.IsPrime]
    (hP : incidenceIdeal f g pick ≤ P) :
    ∃ c : k, outputVariable - C c ∈ P := by
  let q := Ideal.Quotient.mkₐ k P
  let x (i : X) := q (MvPolynomial.X (Sum.inl i))
  let t (r : R) := q (MvPolynomial.X (Sum.inr (Sum.inl r)))
  have hrename (p : MvPolynomial X k) : q (rename Sum.inl p) = aeval x p := by
    have he : q.comp (rename (Sum.inl : X → Variables X R)) = aeval x := by
      ext i
      simp [x]
    exact AlgHom.congr_fun he p
  have heq (j) : q (incidenceEquation f g pick j) = 0 :=
    Ideal.Quotient.eq_zero_iff_mem.mpr (hP (Ideal.subset_span ⟨j, rfl⟩))
  have hz (r : R) : aeval x (g (pick r)) = 0 := by
    rw [← hrename]
    exact heq (.inl (pick r))
  have hj (i : X) : aeval x (pderiv i f) = ∑ r, t r * aeval x (pderiv i (g (pick r))) := by
    simpa only [incidenceEquation, map_sub, sub_eq_zero, map_sum, map_mul, hrename, t] using
      heq (.inr (.inl i))
  obtain ⟨c, hc⟩ := critical_value_in_coordinate_ring x t f (fun r ↦ g (pick r)) hz hj
  refine ⟨c, Ideal.Quotient.eq_zero_iff_mem.mp ?_⟩
  change q (outputVariable - C c) = 0
  have hout : q outputVariable = aeval x f := by
    simpa only [incidenceEquation, map_sub, sub_eq_zero, hrename] using heq (.inr (.inr ()))
  rw [map_sub, sub_eq_zero, hout, hc]
  exact (q.commutes c).symm

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CriticalLocus.incidenceEquation_quadratic

∀ {k : Type u_1} {X : Type u_2} {A : Type u_3} {R : Type u_4} [inst : Field k] [inst_1 : Fintype R]
  (f : MvPolynomial X k) (g : A → MvPolynomial X k) (pick : R → A),
  f.totalDegree ≤ 2 →
    (∀ (a : A), (g a).totalDegree ≤ 2) →
      ∀ (j : A ⊕ X ⊕ Unit), (PlanarUnitDistances.CriticalLocus.incidenceEquation f g pick j).totalDegree ≤ 2
Lean source · PlanarUnitDistances/CriticalLocus.lean, lines 192–210
/-- All the incidence equations are quadrics when the input polynomials are
quadrics. This accounts for the new multiplier in a gradient equation. -/
theorem incidenceEquation_quadratic (f : MvPolynomial X k) (g : A → MvPolynomial X k)
    (pick : R → A) (hf : f.totalDegree ≤ 2) (hg : ∀ a, (g a).totalDegree ≤ 2)
    (j : A ⊕ (X ⊕ Unit)) : (incidenceEquation f g pick j).totalDegree ≤ 2 := by
  rcases j with a | (i | ⟨⟩)
  · exact (totalDegree_rename_le _ _).trans (hg a)
  · apply (totalDegree_sub _ _).trans
    apply max_le
    · exact (totalDegree_rename_le _ _).trans ((totalDegree_pderiv_le i hf).trans (by decide))
    · apply totalDegree_finsetSum_le
      intro r _
      apply (totalDegree_mul _ _).trans
      rw [totalDegree_X]
      have ht := (totalDegree_rename_le (Sum.inl : X → Variables X R) _).trans
        (totalDegree_pderiv_le (d := 1) i (hg (pick r)))
      omega
  · apply (totalDegree_sub _ _).trans
    exact max_le (by simp [outputVariable]) ((totalDegree_rename_le _ _).trans hf)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 5.11 A small quadratic component for the original stationary ratio

Lean verified

Let 2 ≤ l ≤ 4 , let two of the column positions be distinct, and suppose a target ratio is stationary on the original torus grid. Some retained set of 2 ≤ m ≤ 3 l − 3 rows, containing the target, has ( m − 1 ) ( l − 1 ) ≤ 24 . For every choice of base row in this set, its normalized multiplier equations admit a minimal prime through the lifted subgrid with c − λ e in that prime. Here λ e is the original target ratio, the number of selected rows of the Jacobian is at most 47, the number of variables is at most 98, and every polynomial has degree at most two.

Proof

Apply sparse localization, choose any new base row, and apply the critical-coordinate construction to its normalized quadrics. The explicit rigid motions bound the number of independent gradients on this subgrid. The count of retained rows gives the bounds on the parameters and on the dimension of the ambient affine space.

Inspect the Lean declarations

PlanarUnitDistances.TorusCritical.sparse_stationary_component

∀ {I : Type u_1} {J : Type u_2} {k : Type u_3} [inst : Field k] [CharZero k] [IsAlgClosed k]
  [inst_3 : Fintype I] [inst_4 : Fintype J] [Nontrivial I] (p : I → k × k) (s : Option J → k × k)
  (a : I → Option J → kˣ) (i₀ : I) (sol : PlanarUnitDistances.Fibre.TorusSolution i₀ none p s a)
  (ha : ∀ (i : I), a i none = 1),
  Fintype.card (Option J) ≤ 4 →
    ∀ (iₑ : I) (jₑ j j' : Option J),
      s j ≠ s j' →
        (∀ (v : PlanarUnitDistances.TorusCritical.Coord I J → k),
            (∀ (e : PlanarUnitDistances.TorusCritical.Equation I J),
                (PlanarUnitDistances.CriticalLocus.jacobianRow
                      (PlanarUnitDistances.TorusCritical.coordinates p s a i₀ sol)
                      (PlanarUnitDistances.TorusCritical.equation a e))
                    v =
                  0) →
              (PlanarUnitDistances.CriticalLocus.jacobianRow
                    (PlanarUnitDistances.TorusCritical.coordinates p s a i₀ sol)
                    (PlanarUnitDistances.TorusCritical.ratio a iₑ jₑ))
                  v =
                0) →
          ∃ S,
            ∃ (hi : iₑ ∈ S),
              2 ≤ S.card ∧
                S.card ≤ 3 * Fintype.card (Option J) - 3 ∧
                  (S.card - 1) * (Fintype.card (Option J) - 1) ≤ 24 ∧
                    ∀ (b₀ : ↥S),
                      let β := PlanarUnitDistances.TorusCritical.restrictedCoefficient a S b₀;
                      have x :=
                        PlanarUnitDistances.TorusCritical.coordinates (fun i => p ↑i) s β b₀
                          (PlanarUnitDistances.TorusCritical.restrictedSolution p s a i₀ sol S b₀ ha);
                      ∃ r pick t,
                        r ≤ 47 ∧
                          Fintype.card
                                (PlanarUnitDistances.CriticalLocus.Variables
                                  (PlanarUnitDistances.TorusCritical.Coord (↥S) J) (Fin r)) ≤
                              98 ∧
                            ∃
                              P ∈
                                (PlanarUnitDistances.CriticalLocus.incidenceIdeal
                                    (PlanarUnitDistances.TorusCritical.ratio β ⟨iₑ, hi⟩ jₑ)
                                    (PlanarUnitDistances.TorusCritical.equation β) pick).minimalPrimes,
                              P ≤
                                  RingHom.ker
                                    (MvPolynomial.aeval
                                      (PlanarUnitDistances.CriticalLocus.liftedPoint x t
                                        (PlanarUnitDistances.TorusCritical.chordRatio p s a i₀ sol iₑ jₑ))) ∧
                                PlanarUnitDistances.CriticalLocus.outputVariable -
                                      MvPolynomial.C
                                        (PlanarUnitDistances.TorusCritical.chordRatio p s a i₀ sol iₑ jₑ) ∈
                                    P ∧
                                  ∀
                                    (e :
                                      PlanarUnitDistances.TorusCritical.Equation (↥S) J ⊕
                                        PlanarUnitDistances.TorusCritical.Coord (↥S) J ⊕ Unit),
                                    (PlanarUnitDistances.CriticalLocus.incidenceEquation
                                          (PlanarUnitDistances.TorusCritical.ratio β ⟨iₑ, hi⟩ jₑ)
                                          (PlanarUnitDistances.TorusCritical.equation β) pick e).totalDegree ≤
                                      2
Lean source · PlanarUnitDistances/StationaryComponent.lean, lines 15–57
/-- The component of the selected grid is defined in at most 98 variables by
quadrics. Its value is the chord ratio of the *original* target edge. -/
theorem sparse_stationary_component [Nontrivial I] (p : I → k × k) (s : Option J → k × k)
    (a : I → Option J → kˣ) (i₀ : I) (sol : Fibre.TorusSolution i₀ none p s a)
    (ha : ∀ i, a i none = 1) (hl : Fintype.card (Option J) ≤ 4)
    (iₑ : I) (jₑ j j' : Option J) (hj : s j ≠ s j')
    (hs : ∀ v : Coord I J → k, (∀ e, jacobianRow (coordinates p s a i₀ sol) (equation a e) v = 0) →
      jacobianRow (coordinates p s a i₀ sol) (ratio a iₑ jₑ) v = 0) :
    ∃ (S : Finset I) (hi : iₑ ∈ S), 2 ≤ S.card ∧ S.card ≤ 3 * Fintype.card (Option J) - 3 ∧
      (S.card - 1) * (Fintype.card (Option J) - 1) ≤ 24 ∧
      ∀ b₀ : S, let β := restrictedCoefficient a S b₀
        let x := coordinates (fun i : S ↦ p i) s β b₀ (restrictedSolution p s a i₀ sol S b₀ ha)
        ∃ (r : ℕ) (pick : Fin r → Equation S J) (t : Fin r → k),
          r ≤ 47 ∧ Fintype.card (Variables (Coord S J) (Fin r)) ≤ 98 ∧
          ∃ P ∈ (incidenceIdeal (ratio β ⟨iₑ,hi⟩ jₑ) (equation β) pick).minimalPrimes,
            P ≤ RingHom.ker (aeval (liftedPoint x t (chordRatio p s a i₀ sol iₑ jₑ))) ∧
            outputVariable - C (chordRatio p s a i₀ sol iₑ jₑ) ∈ P ∧
            ∀ e, (incidenceEquation (ratio β ⟨iₑ,hi⟩ jₑ) (equation β) pick e).totalDegree ≤ 2 := by
  classical
  obtain ⟨S, hi, h₂, hmax, hsub⟩ := sparse_subgrid p s a i₀ sol ha iₑ jₑ j j' hj hs
  have hl₂ : 2 ≤ Fintype.card (Option J) :=
    Fintype.one_lt_card_iff_nontrivial.mpr ⟨⟨j,j',fun h ↦ hj (congrArg s h)⟩⟩
  have hm := small_grid_sizes (m := S.card) (r := 0) hl₂ hl hmax (Nat.zero_le _)
  refine ⟨S, hi, h₂, hmax, hm.2.1, ?_⟩
  intro b₀
  let β := restrictedCoefficient a S b₀
  let p' := fun i : S ↦ p i
  let sol' := restrictedSolution p s a i₀ sol S b₀ ha
  let ie' : S := ⟨iₑ,hi⟩
  dsimp only
  obtain ⟨r,pick,t,hr,_hlin,P,hmin,hlift,hval,hdeg⟩ :=
    stationary_ratio_component p' s β b₀ sol' ie' jₑ (hsub b₀)
  have hrank := torus_jacobian_rank_bound p' s β b₀ sol' j j' hj
  rw [← hr, Fintype.card_coe] at hrank
  have hbud := small_grid_sizes (m := S.card) (r := r) hl₂ hl hmax (by omega)
  have hcoord : Fintype.card (Variables (Coord S J) (Fin r)) =
      (4*(S.card+Fintype.card (Option J))-2)+r+1 := by
    simp [Variables, Coord]
    omega
  have hc : (↑(β ie' jₑ * sol'.row ie' * sol'.col jₑ) : k) = chordRatio p s a i₀ sol iₑ jₑ :=
    restricted_chordRatio p s a i₀ sol S b₀ ha ie' jₑ
  rw [hc] at hlift hval
  exact ⟨r,pick,t,by omega, hcoord.trans_le hbud.2.2,P,hmin,hlift,hval,hdeg⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

5.3 Independent square roots and four anchors

Lemma 5.12 Changing one square root in the actual linear system

Lean verified

Let K have characteristic zero. Take four independent square classes D j in K , and choose roots R j 2 = D j in any extension. Suppose a j , b j , c j , t j lie in K , a 1 ≠ 0 , and

a j x + b j y − R j A = c j − R j t j ( 1 ≤ j ≤ 4 ) .

Then at least one equality A = t j holds. If the first three position rows have rank two, one gets A = t 4 .

Proof

Build the field by successively adjoining roots. A square in a quadratic extension lying in the base is either a square in the base or the radicand times such a square: expand ( x + y d ) 2 and compare its linear coefficient. Independence therefore gives a genuine quadratic step each time. Each root has its own sign-changing automorphism fixing the others. In rank two, the determinant from the first three equations has a nonzero position minor as a coefficient of a radical. The independent radicals make this determinant nonzero. Solve the three equations in their field and apply the fourth sign change. In rank one, project the velocity onto the span of the first position row and solve two equations before changing the third sign.

Inspect the Lean declarations

OAI.PlanarUnitDistances.Radicals.radical_system_impossible

∀ {K L : Type u} [inst : Field K] [CharZero K] [inst_2 : Field L] (f : K →+* L) (d a b c t : Fin 4 → K),
  OAI.PlanarUnitDistances.Radicals.SquareIndependent [d 0, d 1, d 2, d 3] →
    ∀ (r : Fin 4 → L),
      (∀ (i : Fin 4), r i ^ 2 = f (d i)) →
        a 0 ≠ 0 →
          ∀ (x y A : L),
            (∀ (i : Fin 4), f (a i) * x + f (b i) * y - r i * A = f (c i) - r i * f (t i)) →
              (∀ (i : Fin 4), A ≠ f (t i)) → False
Lean source · PlanarUnitDistances/QuadraticRadicals.lean, lines 480–512
theorem radical_system_impossible (f : K →+* L)
    (d a b c t : Fin 4 → K)
    (hind : SquareIndependent [d 0,d 1,d 2,d 3])
    (r : Fin 4 → L) (hr : ∀ i, r i ^ 2 = f (d i))
    (ha : a 0 ≠ 0) (x y A : L)
    (heq : ∀ i, f (a i)*x+f (b i)*y-r i*A = f (c i)-r i*f (t i))
    (hne : ∀ i, A ≠ f (t i)) : False := by
  classical
  by_cases h : a 0*b 1-b 0*a 1 ≠ 0 ∨ a 0*b 2-b 0*a 2 ≠ 0 ∨ a 1*b 2-b 1*a 2 ≠ 0
  · exact hne 3 (planar_radical_forces_scalar f d a b c t hind r hr h x y A heq)
  · push Not at h
    let ι : Fin 3 → Fin 4 := fun i => i.castSucc
    have hsub : SquareIndependent [d (ι 0),d (ι 1),d (ι 2)] := by
      intro s hs hs0 u
      apply hind s (hs.trans ?_) hs0 u
      exact List.sublist_append_left [d 0,d 1,d 2] [d 3]
    have hprop (i : Fin 3) : a (ι i)*b 0=a 0*b (ι i) := by
      fin_cases i
      · rfl
      · dsimp [ι]; linear_combination -h.1
      · dsimp [ι]; linear_combination -h.2.1
    have hfa : f (a 0) ≠ 0 := by simpa only [map_zero] using f.injective.ne ha
    have hcoef (i : Fin 3) : f (a (ι i))*(f (b 0)/f (a 0))=f (b (ι i)) := by
      rw [← mul_div_assoc, div_eq_iff hfa]
      have hh := congrArg f (hprop i)
      simpa only [map_mul, mul_comm (f (a 0))] using hh
    have heq' (i : Fin 3) : f (a (ι i))*(x+(f (b 0)/f (a 0))*y)-r (ι i)*A =
        f (c (ι i))-r (ι i)*f (t (ι i)) := by
      rw [mul_add, ← mul_assoc, hcoef]
      exact heq (ι i)
    have hh := line_radical_forces_scalar f (d ∘ ι) (a ∘ ι) (c ∘ ι) (t ∘ ι)
      hsub (r ∘ ι) (fun i => hr (ι i)) ha (x+(f (b 0)/f (a 0))*y) A heq'
    exact hne 2 hh

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.Radicals.SquareIndependent

{K : Type u} → [CommMonoid K] → List K → Prop
Lean source · PlanarUnitDistances/QuadraticRadicals.lean, lines 12–13
def SquareIndependent {K : Type u} [CommMonoid K] (ds : List K) : Prop :=
  ∀ s : List K, s.Sublist ds → s ≠ [] → ∀ c : K, s.prod ≠ c ^ 2

Kernel axioms used: none.

OAI.PlanarUnitDistances.Radicals.planar_radical_forces_scalar

∀ {K L : Type u} [inst : Field K] [CharZero K] [inst_2 : Field L] (f : K →+* L) (d a b c t : Fin 4 → K),
  OAI.PlanarUnitDistances.Radicals.SquareIndependent [d 0, d 1, d 2, d 3] →
    ∀ (r : Fin 4 → L),
      (∀ (i : Fin 4), r i ^ 2 = f (d i)) →
        a 0 * b 1 - b 0 * a 1 ≠ 0 ∨ a 0 * b 2 - b 0 * a 2 ≠ 0 ∨ a 1 * b 2 - b 1 * a 2 ≠ 0 →
          ∀ (x y A : L),
            (∀ (i : Fin 4), f (a i) * x + f (b i) * y - r i * A = f (c i) - r i * f (t i)) → A = f (t 3)
Lean source · PlanarUnitDistances/QuadraticRadicals.lean, lines 354–419
theorem planar_radical_forces_scalar (f : K →+* L)
    (d a b c t : Fin 4 → K)
    (hind : SquareIndependent [d 0, d 1, d 2, d 3])
    (r : Fin 4 → L) (hr : ∀ i, r i ^ 2 = f (d i))
    (hrank : a 0 * b 1 - b 0 * a 1 ≠ 0 ∨
      a 0 * b 2 - b 0 * a 2 ≠ 0 ∨ a 1 * b 2 - b 1 * a 2 ≠ 0)
    (x y A : L)
    (heq : ∀ i, f (a i) * x + f (b i) * y - r i * A =
      f (c i) - r i * f (t i)) : A = f (t 3) := by
  obtain ⟨m⟩ := exists_radicalModel _ hind
  obtain ⟨φ, hφbase, hφroot⟩ := m.evaluate L f r (by
    intro i; fin_cases i <;> simpa using hr _)
  let M : Matrix (Fin 3) (Fin 3) m.Carrier :=
    !![m.incl (a 0), m.incl (b 0), -m.roots 0;
       m.incl (a 1), m.incl (b 1), -m.roots 1;
       m.incl (a 2), m.incl (b 2), -m.roots 2]
  let rhs : Fin 3 → m.Carrier :=
    ![m.incl (c 0) - m.roots 0 * m.incl (t 0),
      m.incl (c 1) - m.roots 1 * m.incl (t 1),
      m.incl (c 2) - m.roots 2 * m.incl (t 2)]
  have hdet : M.det ≠ 0 := by
    intro hz
    let coeff : Fin 4 → K :=
      ![a 2 * b 1 - a 1 * b 2, a 0 * b 2 - a 2 * b 0,
        a 1 * b 0 - a 0 * b 1, 0]
    have hrel : ∑ i, m.incl (coeff i) * m.roots i = 0 := by
      have hexp := (Matrix.det_fin_three M).symm.trans hz
      simp [M] at hexp
      simp [Fin.sum_univ_succ, coeff]
      linear_combination hexp
    have hc := m.linear_relation hind coeff hrel
    have h0 := hc 0
    have h1 := hc 1
    have h2 := hc 2
    simp [coeff] at h0 h1 h2
    rcases hrank with hh | hh | hh
    · apply hh; linear_combination -h2
    · apply hh; linear_combination h1
    · apply hh; linear_combination -h0
  have h30 : (3 : Fin 4) ≠ 0 := by decide
  have h31 : (3 : Fin 4) ≠ 1 := by decide
  have h32 : (3 : Fin 4) ≠ 2 := by decide
  have hMf : ∀ i j, m.flips 3 (M i j) = M i j := by
    intro i j
    fin_cases i <;> fin_cases j <;>
      simp [M, m.flips_base, m.flips_roots, h30, h31, h32]
  have hbf : ∀ i, m.flips 3 (rhs i) = rhs i := by
    intro i; fin_cases i <;> simp [rhs, m.flips_base, m.flips_roots, h30, h31, h32]
  have hsol : (M.map φ).mulVec ![x, y, A] = fun i => φ (rhs i) := by
    ext i
    fin_cases i <;>
      simp [M, rhs, Matrix.mulVec, dotProduct, Fin.sum_univ_succ,
        hφbase, hφroot] <;>
      first | linear_combination heq 0 | linear_combination heq 1 | linear_combination heq 2
  obtain ⟨v, hv, hfix⟩ := solution_lift_fixed φ M rhs hdet (m.flips 3) hMf hbf
    ![x, y, A] hsol
  have hlast : m.incl (a 3) * v 0 + m.incl (b 3) * v 1 - m.roots 3 * v 2 =
      m.incl (c 3) - m.roots 3 * m.incl (t 3) := by
    apply φ.injective
    simpa [hφbase, hφroot, hv] using heq 3
  have hv2 : v 2 = m.incl (t 3) := unused_sign_equation (m.flips 3)
    (m.root_ne_zero hind 3)
    (by simp [hfix, m.flips_base]) (hfix 2) (m.flips_base 3 (c 3))
    (m.flips_base 3 (t 3)) (by simp [m.flips_roots]) hlast
  have hh := congrArg φ hv2
  simpa [hv, hφbase] using hh

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.Radicals.line_radical_forces_scalar

∀ {K L : Type u} [inst : Field K] [CharZero K] [inst_2 : Field L] (f : K →+* L) (d a c t : Fin 3 → K),
  OAI.PlanarUnitDistances.Radicals.SquareIndependent [d 0, d 1, d 2] →
    ∀ (r : Fin 3 → L),
      (∀ (i : Fin 3), r i ^ 2 = f (d i)) →
        a 0 ≠ 0 → ∀ (h A : L), (∀ (i : Fin 3), f (a i) * h - r i * A = f (c i) - r i * f (t i)) → A = f (t 2)
Lean source · PlanarUnitDistances/QuadraticRadicals.lean, lines 421–470
theorem line_radical_forces_scalar (f : K →+* L)
    (d a c t : Fin 3 → K)
    (hind : SquareIndependent [d 0, d 1, d 2])
    (r : Fin 3 → L) (hr : ∀ i, r i ^ 2 = f (d i))
    (ha : a 0 ≠ 0) (h A : L)
    (heq : ∀ i, f (a i) * h - r i * A = f (c i) - r i * f (t i)) :
    A = f (t 2) := by
  obtain ⟨m⟩ := exists_radicalModel _ hind
  obtain ⟨φ, hφbase, hφroot⟩ := m.evaluate L f r (by
    intro i; fin_cases i <;> simpa using hr _)
  let M : Matrix (Fin 2) (Fin 2) m.Carrier :=
    !![m.incl (a 0), -m.roots 0; m.incl (a 1), -m.roots 1]
  let rhs : Fin 2 → m.Carrier :=
    ![m.incl (c 0) - m.roots 0 * m.incl (t 0),
      m.incl (c 1) - m.roots 1 * m.incl (t 1)]
  have hdet : M.det ≠ 0 := by
    intro hz
    let coeff : Fin 3 → K := ![a 1, -a 0, 0]
    have hrel : ∑ i, m.incl (coeff i) * m.roots i = 0 := by
      have hexp := (Matrix.det_fin_two M).symm.trans hz
      simp [M] at hexp
      simp [Fin.sum_univ_succ, coeff]
      linear_combination hexp
    have hc := m.linear_relation hind coeff hrel 1
    apply ha
    simpa [coeff] using hc
  have h20 : (2 : Fin 3) ≠ 0 := by decide
  have h21 : (2 : Fin 3) ≠ 1 := by decide
  have hMf : ∀ i j, m.flips 2 (M i j) = M i j := by
    intro i j; fin_cases i <;> fin_cases j <;>
      simp [M, m.flips_base, m.flips_roots, h20, h21]
  have hbf : ∀ i, m.flips 2 (rhs i) = rhs i := by
    intro i; fin_cases i <;> simp [rhs, m.flips_base, m.flips_roots, h20, h21]
  have hsol : (M.map φ).mulVec ![h, A] = fun i => φ (rhs i) := by
    ext i
    fin_cases i <;>
      simp [M, rhs, Matrix.mulVec, dotProduct, Fin.sum_univ_succ, hφbase, hφroot] <;>
      first | linear_combination heq 0 | linear_combination heq 1
  obtain ⟨v, hv, hfix⟩ := solution_lift_fixed φ M rhs hdet (m.flips 2) hMf hbf
    ![h, A] hsol
  have hlast : m.incl (a 2) * v 0 - m.roots 2 * v 1 =
      m.incl (c 2) - m.roots 2 * m.incl (t 2) := by
    apply φ.injective
    simpa [hφbase, hφroot, hv] using heq 2
  have hv1 : v 1 = m.incl (t 2) := unused_sign_equation (m.flips 2)
    (m.root_ne_zero hind 2)
    (by simp [hfix, m.flips_base]) (hfix 1) (m.flips_base 2 (c 2))
    (m.flips_base 2 (t 2)) (by simp [m.flips_roots]) hlast
  have hh := congrArg φ hv1
  simpa [hv, hφbase] using hh

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.13 Private valuations for the plane and at a smooth curve point

Lean verified

For distinct centers ( a j , b j ) in the plane the functions L j ( L j − 4 ) , with L j = ( z − a j ) ( w − b j ) , have independent square classes in the iterated rational function field. On a curve defined by f ( z , w ) , let f ( a , b ) = 0 , ∂ w f ( a , b ) ≠ 0 , with nonzero leading coefficient in w at a . If b ≠ c , the branch through ( a , b ) gives an order one for the radicand of ( a , c ) . It gives order zero for the radicand of ( d , e ) whenever ( a − d ) ( b − e ) differs from 0 and 4 .

Proof

In the plane regard z as transcendental and take the simple root w = b j + 4 / ( z − a j ) . Its pole and constant term distinguish its center from all the others. On the curve, write z = a + t and lift b to a formal power series w ( t ) using the nonvanishing derivative. In the resulting Laurent-series valuation the first factor of the selected L has order one and w ( t ) − c is a unit. At the other centers both factors of L ( L − 4 ) have nonzero constant terms. Testing a squarefree product at the selected valuation rules out its being a square.

Inspect the Lean declarations

OAI.PlanarUnitDistances.CurveValuations.exists_curve_private_valuation

∀ {K : Type u} [inst : Field K] [CharZero K] (f : Polynomial (Polynomial K)) (a b c : K),
  Polynomial.eval a f.leadingCoeff ≠ 0 →
    Polynomial.eval₂ (Polynomial.evalRingHom a) b f = 0 →
      Polynomial.eval₂ (Polynomial.evalRingHom a) b (Polynomial.derivative f) ≠ 0 →
        b ≠ c →
          ∃ v,
            v (OAI.PlanarUnitDistances.CurveValuations.curveD f a c) = WithZero.exp (-1) ∧
              ∀ (d e : K),
                (a - d) * (b - e) ≠ 0 →
                  (a - d) * (b - e) ≠ 4 → v (OAI.PlanarUnitDistances.CurveValuations.curveD f d e) = 1
Lean source · PlanarUnitDistances/GenericBranches.lean, lines 430–475
theorem exists_curve_private_valuation [CharZero K]
    (f : K[X][X]) (a b c : K)
    (hlead : f.leadingCoeff.eval a ≠ 0)
    (hroot : f.eval₂ (evalRingHom a) b = 0)
    (hderiv : f.derivative.eval₂ (evalRingHom a) b ≠ 0)
    (hbc : b ≠ c) :
    ∃ v : Valuation (CurveField f) ℤᵐ⁰,
      v (curveD f a c) = WithZero.exp (-1 : ℤ) ∧
      ∀ d e : K, (a-d)*(b-e) ≠ 0 → (a-d)*(b-e) ≠ 4 →
        v (curveD f d e) = 1 := by
  obtain ⟨w, φ, hw, hwφ, hφ⟩ := exists_curve_branch_map f a b hlead hroot hderiv
  let v : Valuation (CurveField f) ℤᵐ⁰ :=
    (Valued.v : Valuation K⸨X⸩ ℤᵐ⁰).comap φ
  have hL (d e : K) : φ (curveL f d e) = HahnSeries.ofPowerSeries ℤ K
      ((PowerSeries.X + PowerSeries.C (a-d)) * (w - PowerSeries.C e)) :=
    curve_branch_map_L hφ hwφ d e
  have hval {p : PowerSeries K} (hp : PowerSeries.constantCoeff p ≠ 0) :
      (Valued.v : Valuation K⸨X⸩ ℤᵐ⁰) (HahnSeries.ofPowerSeries ℤ K p) = 1 :=
    laurent_valuation_powerSeries_unit hp
  refine ⟨v, ?_, ?_⟩
  · have hLc : v (curveL f a c) = WithZero.exp (-1 : ℤ) := by
      change Valued.v (φ (curveL f a c)) = _
      rw [hL]
      simp only [sub_self, map_zero, add_zero, map_mul]
      rw [laurent_valuation_powerSeries_X, hval, mul_one]
      simpa [hw] using sub_ne_zero.mpr hbc
    have hL4 : v (curveL f a c - 4) = 1 := by
      change Valued.v (φ (curveL f a c - 4)) = _
      rw [map_sub, hL, map_ofNat]
      rw [← map_ofNat (HahnSeries.ofPowerSeries ℤ K) 4, ← map_sub]
      apply hval
      norm_num [hw, map_ofNat]
    rw [curveD, map_mul, hLc, hL4, mul_one]
  · intro d e hne hfour
    have hLc : v (curveL f d e) = 1 := by
      change Valued.v (φ (curveL f d e)) = _
      rw [hL]
      apply hval
      simpa [hw] using hne
    have hL4 : v (curveL f d e - 4) = 1 := by
      change Valued.v (φ (curveL f d e - 4)) = _
      rw [map_sub, hL, map_ofNat]
      rw [← map_ofNat (HahnSeries.ofPowerSeries ℤ K) 4, ← map_sub]
      apply hval
      simpa [hw, map_ofNat] using sub_ne_zero.mpr hfour
    rw [curveD, map_mul, hLc, hL4, one_mul]

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.Radicals.squareIndependent_of_private_valuations

∀ {K : Type u} [inst : Field K] {ι : Type v} (is : List ι),
  is.Nodup →
    ∀ (d : ι → K),
      (∀ i ∈ is, ∃ v, v (d i) = WithZero.exp (-1) ∧ ∀ j ∈ is, j ≠ i → v (d j) = 1) →
        OAI.PlanarUnitDistances.Radicals.SquareIndependent (List.map d is)
Lean source · PlanarUnitDistances/PrivateValuations.lean, lines 20–42
theorem squareIndependent_of_private_valuations
    {K : Type u} [Field K] {ι : Type v} (is : List ι) (hi : is.Nodup)
    (d : ι → K)
    (hv : ∀ i ∈ is, ∃ v : Valuation K ℤᵐ⁰,
      v (d i) = WithZero.exp (-1 : ℤ) ∧ ∀ j ∈ is, j ≠ i → v (d j) = 1) :
    SquareIndependent (is.map d) := by
  intro s hs hsn c hc
  obtain ⟨js, hj, rfl⟩ := List.sublist_map_iff.mp hs
  cases js with
  | nil => exact hsn rfl
  | cons i js =>
    have hnd := List.nodup_cons.mp (hi.sublist hj)
    have him : i ∈ is := hj.subset (by simp)
    obtain ⟨v, hvi, hvj⟩ := hv i him
    have hone : (js.map (fun j => v (d j))).prod = 1 := by
      apply List.prod_eq_one
      intro a ha
      obtain ⟨j, hjm, rfl⟩ := List.mem_map.mp ha
      exact hvj j (hj.subset (by simp [hjm])) (by
        intro he; exact hnd.1 (he ▸ hjm))
    apply exp_neg_one_ne_square (v c)
    have hh := congrArg v hc
    simpa [map_list_prod, List.map_map, Function.comp_def, hvi, hone] using hh

Kernel axioms used: propext, Classical.choice, Quot.sound.

OAI.PlanarUnitDistances.Radicals.plane_radicands_squareIndependent

∀ {K : Type u} [inst : Field K] [CharZero K] (centers : List (K × K)),
  centers.Nodup →
    OAI.PlanarUnitDistances.Radicals.SquareIndependent
      (List.map
        (fun ab =>
          (algebraMap (Polynomial (RatFunc K)) (RatFunc (RatFunc K)))
            (OAI.PlanarUnitDistances.Radicals.planeRadicandPoly ab.1 ab.2))
        centers)
Lean source · PlanarUnitDistances/PrivateValuations.lean, lines 188–197
theorem plane_radicands_squareIndependent (centers : List (K × K))
    (h : centers.Nodup) :
    SquareIndependent (centers.map (fun ab =>
      algebraMap (RatFunc K)[X] (RatFunc (RatFunc K))
        (planeRadicandPoly ab.1 ab.2))) := by
  apply squareIndependent_of_private_simple_roots centers h
  intro ab hab
  exact ⟨planePrivateRoot ab.1 ab.2, (planePrivateRoot_simple ab.1 ab.2).1,
    (planePrivateRoot_simple ab.1 ab.2).2,
    fun cd _ hcd => planePrivateRoot_other ab cd hcd⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.14 Choosing the private branch for generic anchors

Lean verified

Work over a characteristic-zero field B and an algebraically closed extension K . Suppose the anchor abscissas a j are algebraically independent over B , and their ordinates c j satisfy a common plane curve equation g . Assume its base change to K is irreducible and it depends on the first coordinate. Fix an irreducible equation f over B of positive degree in the second coordinate. If f ( a i , c i ) ≠ 0 or this degree is at least two, there is a simple ordinate b ≠ c i of f ( a i , w ) with ( a i − a j ) ( b − c j ) ∉ { 0 , 4 } at every other anchor.

Proof

At the generic abscissa a i , the leading coefficient and the discriminant remain nonzero. On a distinct sheet choose b ≠ c i . This ordinate is algebraic over B ( a i ) , whereas a j remains transcendental over its relative algebraic closure. Substituting the two prohibited expressions for c j would force an identity on the anchor curve. A nonzero polynomial evaluation excludes each.

Inspect the Lean declarations

OAI.PlanarUnitDistances.GenericSheets.exists_private_sheet_curve

∀ {B : Type u_1} {K : Type u_2} [inst : Field B] [inst_1 : Field K] [inst_2 : Algebra B K] [CharZero B]
  [CharZero K] [IsAlgClosed K] {ι : Type u_3} (f g : Polynomial (Polynomial B)),
  Irreducible f →
    f.natDegree ≠ 0 →
      Irreducible ((OAI.PlanarUnitDistances.BivariateMaps.bimap (algebraMap B K)) g) →
        (Polynomial.Bivariate.swap g).natDegree ≠ 0 →
          ∀ (a c : ι → K),
            AlgebraicIndependent B a →
              (∀ (i : ι), Polynomial.eval₂ (Polynomial.aeval (a i)).toRingHom (c i) g = 0) →
                ∀ (i : ι),
                  Polynomial.eval₂ (Polynomial.aeval (a i)).toRingHom (c i) f ≠ 0 ∨ 2 ≤ f.natDegree →
                    ∃ b,
                      Polynomial.eval₂ (Polynomial.aeval (a i)).toRingHom b f = 0 ∧
                        Polynomial.eval₂ (Polynomial.aeval (a i)).toRingHom b (Polynomial.derivative f) ≠ 0 ∧
                          b ≠ c i ∧
                            ∀ (j : ι), j ≠ i → (a i - a j) * (b - c j) ≠ 0 ∧ (a i - a j) * (b - c j) ≠ 4
Lean source · PlanarUnitDistances/GenericBranches.lean, lines 199–250
theorem exists_private_sheet_curve [CharZero B] [CharZero K] [IsAlgClosed K]
    {ι : Type*} (f g : B[X][X]) (hf : Irreducible f) (hfdeg : f.natDegree ≠ 0)
    (hgK : Irreducible (bimap (algebraMap B K) g))
    (hgswap : (Bivariate.swap g).natDegree ≠ 0)
    (a c : ι → K) (ha : AlgebraicIndependent B a)
    (hc : ∀ i, g.eval₂ (aeval (a i)).toRingHom (c i)=0)
    (i : ι) (halt : f.eval₂ (aeval (a i)).toRingHom (c i) ≠ 0 ∨ 2 ≤ f.natDegree) :
    ∃ b : K, f.eval₂ (aeval (a i)).toRingHom b=0 ∧
      f.derivative.eval₂ (aeval (a i)).toRingHom b≠0 ∧ b≠c i ∧
      ∀ j, j≠i → (a i-a j)*(b-c j)≠0 ∧ (a i-a j)*(b-c j)≠4 := by
  obtain ⟨b,hb,hbd,hbc⟩ := GenericCurve.exists_distinct_smooth_sheet f hf hfdeg
    (a i) (c i) (ha.transcendental i) halt
  refine ⟨b,hb,hbd,hbc,?_⟩
  let F := IntermediateField.adjoin B ({a i} : Set K)
  let E := algebraicClosure F K
  let : IsScalarTower B E K := IsScalarTower.of_algebraMap_eq fun _ => rfl
  let ai : F := ⟨a i, IntermediateField.subset_adjoin B _ (Set.mem_singleton _)⟩
  let a' : E := algebraMap F E ai
  have ha' : algebraMap E K a'=a i := by simp [a',ai]
  have hbalg : IsAlgebraic F b := fiber_algebraic f hf.ne_zero (a i) b (ha.transcendental i) hb
  let b' : E := ⟨b, mem_algebraicClosure_iff.mpr hbalg⟩
  let g' := bimap (algebraMap B E) g
  have hge : bimap (algebraMap E K) g'=bimap (algebraMap B K) g := by
    simp only [g',bimap_comp,← IsScalarTower.algebraMap_eq B E K]
  have hg' : Irreducible g' := irreducible_of_bimap (algebraMap E K) (hge.symm ▸ hgK)
  have hgs' : (Bivariate.swap g').IsPrimitive := by
    apply ((MulEquiv.irreducible_iff Bivariate.swap).mpr hg').isPrimitive
    simpa only [g',bimap_swap,bimap_natDegree] using hgswap
  have hlead : g'.leadingCoeff.eval a' ≠ 0 := by
    intro hz
    have hz' := congrArg (algebraMap E K) hz
    have hg0 : g ≠ 0 := (irreducible_of_bimap (algebraMap B K) hgK).ne_zero
    apply GenericCurve.fiber_leadingCoeff_ne_zero g hg0 (a i) (ha.transcendental i)
    have hh : algebraMap E K (g'.leadingCoeff.eval a')=aeval (a i) g.leadingCoeff := by
      dsimp only [g', BivariateMaps.bimap,coe_mapRingHom]
      rw [leadingCoeff_map_of_injective (f := Polynomial.mapRingHom (algebraMap B E))
        (Polynomial.map_injective _ (algebraMap B E).injective)]
      change algebraMap E K ((g.leadingCoeff.map (algebraMap B E)).eval a')=_
      rw [← eval₂_hom, eval₂_map, ← IsScalarTower.algebraMap_eq B E K,ha',← aeval_def]
    simpa only [hh,map_zero] using hz'
  intro j hji
  have haj : Transcendental E (a j) := other_transcendental ha hji
  have hcj : g'.eval₂ (aeval (a j)).toRingHom (c j)=0 := by
    simpa only [g',eval_bimap] using hc j
  have hcz : c j≠(b' : K) :=
    GenericNoncoincidence.generic_ordinate_ne_constant g' hgs' b' (a j) (c j) haj
      (by simpa only [GenericNoncoincidence.aevalAeval_eq_eval₂] using hcj)
  have hdz : a i ≠ a j := fun hh => hji (ha.injective hh).symm
  refine ⟨mul_ne_zero (sub_ne_zero.mpr hdz) (sub_ne_zero.mpr hcz.symm),?_⟩
  have hn := GenericNoncoincidence.distance_ne_nonzero g' a' b' (4 : E) hlead
    (by norm_num) (a j) (c j) haj hcj
  simpa only [map_ofNat,ha',show algebraMap E K b'=b from rfl] using hn

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.15 Irreducibility after enlarging the constants

Lean verified

Let B be algebraically closed, K / B any field extension, and f ∈ B [ X i ∣ i ∈ I ] irreducible. Its image in K [ X i ∣ i ∈ I ] remains irreducible.

Proof

Given a factorization over K , adjoin to B all coefficients of the two factors and the inverses of their nonzero coefficients. The resulting nonzero finitely generated algebra R has a maximal ideal with residue field equal to B , by Zariski’s lemma and algebraic closedness. Reduction at this ideal preserves the full monomial support of each factor, since each of its nonzero coefficients is a unit in R . It also fixes f . One reduced factor must be constant and nonzero, so the same factor was already constant and nonzero over K .

Inspect the Lean declarations

PlanarUnitDistances.GeometricIrreducibility.irreducible_map

∀ {k : Type u_1} {L : Type u_2} {σ : Type u_3} [inst : Field k] [IsAlgClosed k] [inst_2 : Field L]
  [inst_3 : Algebra k L] (f : MvPolynomial σ k),
  Irreducible f → Irreducible ((MvPolynomial.map (algebraMap k L)) f)
Lean source · PlanarUnitDistances/GeometricIrreducibility.lean, lines 31–82
/-- Absolute irreducibility of a multivariate polynomial over an
algebraically closed ground field. The extending field may have any
transcendence degree, and the variable set need not be finite. -/
theorem irreducible_map {k L σ : Type*} [Field k] [IsAlgClosed k] [Field L] [Algebra k L]
    (f : MvPolynomial σ k) (irr : Irreducible f) : Irreducible (map (algebraMap k L) f) := by
  classical
  refine ⟨fun h ↦ irr.not_isUnit (unit_of_support
    (support_map_of_injective f (algebraMap k L).injective) h),?_⟩
  intro p q fac
  let s := p.coeffs ∪ q.coeffs
  let t := s ∪ s.image (fun c : L ↦ c⁻¹)
  let R := Algebra.adjoin k (t : Set L)
  let j := R.val.toRingHom
  letI : Algebra.FiniteType k R := Algebra.FiniteType.adjoin_of_finite t.finite_toSet
  obtain ⟨ψ⟩ := specialization k R
  have ins {c : L} (hc : c ∈ s) : c ∈ R := Algebra.subset_adjoin (Finset.mem_union_left _ hc)
  have invs {c : L} (hc : c ∈ s) : c⁻¹ ∈ R :=
    Algebra.subset_adjoin (Finset.mem_union_right _ (Finset.mem_image_of_mem _ hc))
  have lift (g : MvPolynomial σ L) (subset : g.coeffs ⊆ s) :
      ∃ g' : MvPolynomial σ R, map j g'=g ∧ (map ψ.toRingHom g').support=g.support := by
    have range : g ∈ Set.range (map (σ := σ) j) := mem_range_map_iff_coeffs_subset.mpr
      (fun c hc ↦ ⟨⟨c,ins (subset hc)⟩,rfl⟩)
    obtain ⟨g',hg'⟩ := range
    refine ⟨g',hg',?_⟩
    ext d
    rw [mem_support_iff,mem_support_iff,coeff_map]
    have dc : ((g'.coeff d : R):L)=g.coeff d := by
      change j (g'.coeff d)=g.coeff d
      have e := congrArg (fun z : MvPolynomial σ L ↦ z.coeff d) hg'
      simpa only [coeff_map] using e
    constructor
    · intro h hzero
      have ze : g'.coeff d=0 := Subtype.ext (dc.trans hzero)
      exact h (by simp [ze])
    · intro h
      have invmem := invs (subset (coeff_mem_coeffs d h))
      have un : IsUnit (g'.coeff d) := isUnit_iff_exists_inv.mpr
        ⟨⟨(g.coeff d)⁻¹,invmem⟩,Subtype.ext (by change ((g'.coeff d:R):L)*(g.coeff d)⁻¹=1; rw [dc,mul_inv_cancel₀ h])⟩
      exact (un.map ψ.toRingHom).ne_zero
  obtain ⟨p',hp,hps⟩ := lift p Finset.subset_union_left
  obtain ⟨q',hq,hqs⟩ := lift q Finset.subset_union_right
  have eqR : map (algebraMap k R) f=p'*q' := by
    apply map_injective j Subtype.val_injective
    rw [map_map,map_mul,hp,hq]
    exact fac
  have eqk : f=map ψ.toRingHom p'*map ψ.toRingHom q' := by
    have e := congrArg (map (σ := σ) ψ.toRingHom) eqR
    have r : ψ.toRingHom.comp (algebraMap k R)=RingHom.id k := by
      ext c
      exact ψ.commutes c
    simpa only [map_map,r,map_id,map_mul] using e
  exact (irr.isUnit_or_isUnit eqk).imp (unit_of_support hps) (unit_of_support hqs)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.16 Private orders on the embedded smooth curve

Lean verified

Assume the curve and anchor hypotheses of Lemma 5.14 at each of four indices, with the equation f also irreducible over K . Let z , w in a further field L satisfy f ( z , w ) = 0 and let z be transcendental over K . There is an intermediate field M ⊂ L over K containing z , w and four units D j in M with private integer orders. Their images in L are precisely T j ( T j − 4 ) , where T j = ( z − a j ) ( w − c j ) .

Proof

Map the fraction field in the abscissa to L by evaluation at z . The ordinate satisfies the irreducible curve equation, giving a field embedding of the curve function field into L sending the two coordinate functions to z , w . Let M be its image. At the chosen smooth branch over a i , the multiplicative valuation is exp ⁡ ( − 1 ) on D i and one on each D j with j ≠ i . Compose the valuation with the inverse of the field isomorphism onto M and take its negative logarithm on units. This gives an integer order equal to one on D i and zero on the other three.

Inspect the Lean declarations

PlanarUnitDistances.SmoothCurveOrders.smooth_curve_orders

∀ {B : Type u_1} {K : Type u_2} {L : Type u_3} [inst : Field B] [CharZero B] [inst_2 : Field K] [CharZero K]
  [IsAlgClosed K] [inst_5 : Field L] [inst_6 : Algebra B K] [inst_7 : Algebra K L]
  (f g : Polynomial (Polynomial B)),
  Irreducible ((OAI.PlanarUnitDistances.BivariateMaps.bimap (algebraMap B K)) f) →
    f.natDegree ≠ 0 →
      Irreducible ((OAI.PlanarUnitDistances.BivariateMaps.bimap (algebraMap B K)) g) →
        (Polynomial.Bivariate.swap g).natDegree ≠ 0 →
          ∀ (z w : L),
            Transcendental K z →
              Polynomial.eval₂ (Polynomial.aeval z).toRingHom w
                    ((OAI.PlanarUnitDistances.BivariateMaps.bimap (algebraMap B K)) f) =
                  0 →
                ∀ (a b : Fin 4 → K),
                  AlgebraicIndependent B a →
                    (∀ (i : Fin 4), Polynomial.eval₂ (Polynomial.aeval (a i)).toRingHom (b i) g = 0) →
                      (∀ (i : Fin 4),
                          Polynomial.eval₂ (Polynomial.aeval (a i)).toRingHom (b i) f ≠ 0 ∨ 2 ≤ f.natDegree) →
                        ∃ M,
                          z ∈ M ∧
                            w ∈ M ∧
                              ∃ D,
                                PlanarUnitDistances.FourRowObstruction.PrivateOrders D ∧
                                  ∀ (i : Fin 4),
                                    have t := (z - (algebraMap K L) (a i)) * (w - (algebraMap K L) (b i));
                                    ↑↑(D i) = t * (t - 4)
Lean source · PlanarUnitDistances/SmoothCurveOrders.lean, lines 73–97
/-- The sheets and their simple, private intersections follow from the
generic four anchor abscissas and the original two curve equations. The
last disjunction excludes exactly the common degree-one sheet. -/
theorem smooth_curve_orders {B K L : Type*} [Field B] [CharZero B] [Field K] [CharZero K]
    [IsAlgClosed K] [Field L] [Algebra B K] [Algebra K L]
    (f g : B[X][X]) (hf : Irreducible (bimap (algebraMap B K) f)) (hd : f.natDegree≠0)
    (hg : Irreducible (bimap (algebraMap B K) g)) (hgs : (Bivariate.swap g).natDegree≠0)
    (z w : L) (hz : Transcendental K z)
    (hzw : (bimap (algebraMap B K) f).eval₂ (aeval z).toRingHom w=0)
    (a b : Fin 4 → K) (ha : AlgebraicIndependent B a)
    (hb : ∀ i, g.eval₂ (aeval (a i)).toRingHom (b i)=0)
    (cases : ∀ i, f.eval₂ (aeval (a i)).toRingHom (b i)≠0 ∨ 2≤f.natDegree) :
    ∃ M : IntermediateField K L, z ∈ M ∧ w ∈ M ∧ ∃ D : Fin 4 → Mˣ,
      PrivateOrders D ∧ ∀ i, let t := (z-algebraMap K L (a i))*(w-algebraMap K L (b i))
                            (((D i : M) : L))=t*(t-4) := by
  apply embedded_orders_of_sheets _ hf (by simpa only [bimap_natDegree] using hd) z w hz hzw a b
  intro i
  have hbase := irreducible_of_bimap (algebraMap B K) hf
  obtain ⟨c,hr,dr,bc,rest⟩ := GenericSheets.exists_private_sheet_curve f g hbase hd hg hgs
    a b ha hb i (cases i)
  refine ⟨c,?_,?_,?_,bc,rest⟩
  · rw [GenericSheets.mapped_leading_eval]
    exact GenericCurve.fiber_leadingCoeff_ne_zero f hbase.ne_zero (a i) (ha.transcendental i)
  · simpa only [GenericSheets.mapped_eval] using hr
  · simpa only [GenericSheets.mapped_derivative_eval] using dr

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.SmoothCurveOrders.embedded_orders_of_sheets

∀ {K : Type u_1} {L : Type u_2} [inst : Field K] [CharZero K] [inst_2 : Field L] [inst_3 : Algebra K L]
  (f : Polynomial (Polynomial K)),
  Irreducible f →
    f.natDegree ≠ 0 →
      ∀ (z w : L),
        Transcendental K z →
          Polynomial.eval₂ (Polynomial.aeval z).toRingHom w f = 0 →
            ∀ (a b : Fin 4 → K),
              (∀ (i : Fin 4),
                  ∃ c,
                    Polynomial.eval (a i) f.leadingCoeff ≠ 0 ∧
                      Polynomial.eval₂ (Polynomial.evalRingHom (a i)) c f = 0 ∧
                        Polynomial.eval₂ (Polynomial.evalRingHom (a i)) c (Polynomial.derivative f) ≠ 0 ∧
                          c ≠ b i ∧
                            ∀ (j : Fin 4),
                              j ≠ i → (a i - a j) * (c - b j) ≠ 0 ∧ (a i - a j) * (c - b j) ≠ 4) →
                ∃ M,
                  z ∈ M ∧
                    w ∈ M ∧
                      ∃ D,
                        PlanarUnitDistances.FourRowObstruction.PrivateOrders D ∧
                          ∀ (i : Fin 4),
                            have t := (z - (algebraMap K L) (a i)) * (w - (algebraMap K L) (b i));
                            ↑↑(D i) = t * (t - 4)
Lean source · PlanarUnitDistances/SmoothCurveOrders.lean, lines 25–71
/-- Smooth private sheets on a given curve yield orders on the actual
embedded function field. Its abscissa and ordinate are the specified
elements `z,w` of `L`. -/
theorem embedded_orders_of_sheets {K L : Type*} [Field K] [CharZero K] [Field L] [Algebra K L]
    (f : K[X][X]) (hf : Irreducible f) (hd : f.natDegree≠0)
    (z w : L) (hz : Transcendental K z) (hzw : f.eval₂ (aeval z).toRingHom w=0)
    (a b : Fin 4 → K)
    (sheets : ∀ i, ∃ c : K, f.leadingCoeff.eval (a i)≠0 ∧
      f.eval₂ (evalRingHom (a i)) c=0 ∧ f.derivative.eval₂ (evalRingHom (a i)) c≠0 ∧
      c≠b i ∧ ∀ j, j≠i → (a i-a j)*(c-b j)≠0 ∧ (a i-a j)*(c-b j)≠4) :
    ∃ M : IntermediateField K L, z ∈ M ∧ w ∈ M ∧ ∃ D : Fin 4 → Mˣ,
      PrivateOrders D ∧ ∀ i, let t := (z-algebraMap K L (a i))*(w-algebraMap K L (b i))
                            (((D i : M) : L))=t*(t-4) := by
  letI : Fact (Irreducible (f.map (algebraMap K[X] (RatFunc K)))) :=
    ⟨GenericCurve.irreducible_fraction_curve f hf hd⟩
  obtain ⟨φ,_,hw,hpoly⟩ := GenericCurve.exists_curve_embedding f hf hd z w hz hzw
  have hx : φ (curveZ f)=z := by simpa only [curveZ,aeval_X] using hpoly X
  have hc (x : K) : φ (curveC f x)=algebraMap K L x := by
    simpa only [curveC,aeval_C] using hpoly (C x)
  have valuations (i : Fin 4) : ∃ v : Valuation (CurveField f) ℤᵐ⁰,
      v (curveD f (a i) (b i))=WithZero.exp (-1:ℤ) ∧
      ∀ j, j≠i → v (curveD f (a j) (b j))=1 := by
    obtain ⟨c,lead,root,ds,bc,away⟩ := sheets i
    obtain ⟨v,one,rest⟩ := exists_curve_private_valuation f (a i) c (b i) lead root ds bc
    exact ⟨v,one,fun j neq ↦ rest _ _ (away j neq).1 (away j neq).2⟩
  choose v hv hv' using valuations
  let e := φ.equivFieldRange
  let d i := curveD f (a i) (b i)
  have dn i : d i≠0 := by
    intro h
    have ve := hv i
    change v i (d i)=_ at ve
    rw [h,map_zero] at ve
    exact WithZero.exp_ne_zero ve.symm
  let D (i : Fin 4) : φ.fieldRangeˣ := Units.mk0 (e (d i)) (by simpa using dn i)
  refine ⟨φ.fieldRange, ⟨_,hx⟩, ⟨_,hw⟩, D, ?_, ?_⟩
  · intro i
    let v' := (v i).comap e.symm.toRingHom
    refine ⟨orderOfValuation v',?_,?_⟩
    · change -WithZero.log (v i (e.symm (e (d i))))=1
      simp [d,hv]
    · intro j hj
      change -WithZero.log (v i (e.symm (e (d j)) ))=0
      simp [d,hv' i j hj]
  · intro i
    change φ (curveD f (a i) (b i))=_
    simp only [curveD,curveL,map_mul,map_sub,map_ofNat,hx,hw,hc]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.17 Excluding the selected row in the lifted grid

Lean verified

Take an actual solution of the lifted grid equations on an admissible curve pair f , g with all twelve abscissas algebraically independent over C , and a normalized row as in Lemma 5.34. This is impossible if g ∤ f or deg w ⁡ f ≥ 2 . For any curve pair it suffices to construct the four private orders in an intermediate field containing both coordinates of that row over its normalized coefficient field.

Proof

The four anchor abscissas remain algebraically independent when regarded as elements of the normalized field K , and their ordinates still obey g = 0 . The two nonconstant projections in the curve-pair hypothesis give positive degree in each variable. Lemma 5.16 supplies the private orders in the indicated branch. Each normalized Cartesian velocity ( V x , V y ) has null components V x + i V y and V x − i V y . Expanding the product rule using i 2 = − 1 identifies the null-coordinate equation with twice the original Cartesian dot product. Its right side uses the same signed root m j − u j , and normalization retains every strict inequality A ≠ t j . The four equations now contradict the private orders. This last conversion is shared by the rational cases.

Inspect the Lean declarations

PlanarUnitDistances.Competition.GenericCurvePoint.NormalizedRow.excludes_smooth

∀ {E : Type} [inst : Field E] [inst_1 : Algebra ℂ E] [IsAlgClosed E]
  {y : PlanarUnitDistances.Competition.GridElimination.LiftCoord → E}
  (R : PlanarUnitDistances.Competition.GenericCurvePoint.NormalizedRow y)
  {f g : PlanarUnitDistances.Competition.Poly₂},
  PlanarUnitDistances.Competition.LiftedTangent.Data f g y →
    PlanarUnitDistances.Competition.CurvePair f g →
      (AlgebraicIndependent ℂ fun s => PlanarUnitDistances.Competition.LiftedTangent.nullPos y s 0) →
        ¬g ∣ f ∨ 2 ≤ MvPolynomial.degreeOf 1 f → False
Lean source · PlanarUnitDistances/NormalizedSmoothObstruction.lean, lines 66–83
/-- Direct exclusion of a normalized row for the given plane-curve pair,
unless the curves coincide up to a scalar and their vertical degree is one. -/
theorem excludes_smooth (R : NormalizedRow y) {f g : Poly₂} (data : Data f g y)
    (pair : CurvePair f g) (ind : AlgebraicIndependent ℂ (fun s : Slot ↦ nullPos y s 0))
    (cases : ¬g∣f ∨ 2≤f.degreeOf 1) : False := by
  letI : CharZero E := charZero_of_injective_algebraMap (algebraMap ℂ E).injective
  letI := R.closed
  obtain ⟨hf,_,fp⟩ := pair.1 f (Or.inl rfl)
  obtain ⟨hg,_,gp⟩ := pair.1 g (Or.inr rfl)
  obtain ⟨_,fd⟩ := BivariateCurveCoordinates.degrees_of_projections f hf fp
  obtain ⟨gz,gw⟩ := BivariateCurveCoordinates.degrees_of_projections g hg gp
  apply R.excludes_of_orders data
  apply orders_on_plane_curves f g hf hg fd gz gw cases _ _ R.transcendental ?_
    R.anchorZ R.anchorW (R.anchor_independence ind) (R.anchors_on_curve data)
  have eq : ![nullPos y (.inl R.i) 0,nullPos y (.inl R.i) 1]=nullPos y (.inl R.i) := by
    funext d; fin_cases d <;> rfl
  rw [eq]
  exact data.row_curve R.i

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.GenericCurvePoint.NormalizedRow.excludes_of_orders

∀ {E : Type} [inst : Field E] [inst_1 : Algebra ℂ E] [IsAlgClosed E]
  {y : PlanarUnitDistances.Competition.GridElimination.LiftCoord → E}
  (R : PlanarUnitDistances.Competition.GenericCurvePoint.NormalizedRow y)
  {f g : PlanarUnitDistances.Competition.Poly₂},
  PlanarUnitDistances.Competition.LiftedTangent.Data f g y →
    (∃ M,
        PlanarUnitDistances.Competition.LiftedTangent.nullPos y (Sum.inl R.i) 0 ∈ M ∧
          PlanarUnitDistances.Competition.LiftedTangent.nullPos y (Sum.inl R.i) 1 ∈ M ∧
            ∃ D,
              PlanarUnitDistances.FourRowObstruction.PrivateOrders D ∧
                ∀ (j : Fin 4),
                  have l :=
                    (PlanarUnitDistances.Competition.LiftedTangent.nullPos y (Sum.inl R.i) 0 -
                        (algebraMap (↥R.K) E) (R.anchorZ j)) *
                      (PlanarUnitDistances.Competition.LiftedTangent.nullPos y (Sum.inl R.i) 1 -
                        (algebraMap (↥R.K) E) (R.anchorW j));
                  ↑↑(D j) = l * (l - 4)) →
      False
Lean source · PlanarUnitDistances/NormalizedSmoothObstruction.lean, lines 35–64
/-- All curve cases can share this conversion: the orders are on a subfield
of the particular solution field and the roots and tangent come from the
original lifted equations and their normalized velocities. -/
theorem excludes_of_orders (R : NormalizedRow y) {f g : Poly₂} (data : Data f g y)
    (orders : ∃ M : IntermediateField R.K E,
      nullPos y (.inl R.i) 0 ∈ M ∧ nullPos y (.inl R.i) 1 ∈ M ∧ ∃ D : Fin 4 → Mˣ,
      PrivateOrders D ∧ ∀ j, let l := (nullPos y (.inl R.i) 0-algebraMap R.K E (R.anchorZ j))*
                                    (nullPos y (.inl R.i) 1-algebraMap R.K E (R.anchorW j))
                            (((D j : M) : E))=l*(l-4)) : False := by
  letI : CharZero E := charZero_of_injective_algebraMap (algebraMap ℂ E).injective
  let I := algebraMap ℂ E Complex.I
  let v (j : Fin 4) (d : Fin 2) : R.K := ⟨_,R.velocity j d⟩
  let uz (j : Fin 4) := v j 0+algebraMap ℂ R.K Complex.I*v j 1
  let uw (j : Fin 4) := v j 0-algebraMap ℂ R.K Complex.I*v j 1
  let scalar (j : Fin 4) : R.K := ⟨_,R.scalar j⟩
  have hI : I^2= -1 := by dsimp [I]; rw [← map_pow,Complex.I_sq,map_neg,map_one]
  apply excludes_null_tangent _ _ R.anchorZ R.anchorW orders (u y R.i) (μ y R.i)
    (data.inverse R.i) ?_ uz uw scalar (R.h R.i 0+I*R.h R.i 1) (R.h R.i 0-I*R.h R.i 1)
    (R.t R.i) (fun j ↦ (R.tangent R.i j).2) ?_
  · intro j
    exact (chordSq_eq_null y R.i j).symm.trans (data.chord R.i j)
  · intro j
    change (nullPos y (.inl R.i) 1-nullPos y (.inr j) 1)*
      ((R.h R.i 0+I*R.h R.i 1)-(R.v j 0+I*R.v j 1))+
      (nullPos y (.inl R.i) 0-nullPos y (.inr j) 0)*
      ((R.h R.i 0-I*R.h R.i 1)-(R.v j 0-I*R.v j 1))=_
    obtain ⟨pz,pw⟩ := recover y (.inl R.i)
    obtain ⟨az,aw⟩ := recover y (.inr j)
    rw [←pz,←pw,←az,←aw]
    exact (null_dot I hI _ _ _ _ _ _ _ _).trans (R.tangent R.i j).1

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.18 The zero determinant branch has degree at most twelve

Lean verified

Let v j = 2 ( ( X , Y ) − r j ) , b j = v j ⋅ U j , and R j 2 = D j , where D j has degree at most four. Suppose that the four square classes are independent in a characteristic-zero field containing k [ X , Y ] , and that the generic augmented determinant vanishes. If r 1 ≠ r 2 , a nonzero Q ∈ k [ X , Y ] of degree at most 12 vanishes at every specialized solution over every field extension with A ≠ a 4 .

Proof

Let c 1 , c 2 , c 3 be the signed minors of the first two columns of the first three rows, so ∑ j = 1 3 c j v j = 0 . Write F ( R ) for the augmented determinant. Flipping R 4 and subtracting gives

F ( R ) − F ( R 1 , R 2 , R 3 , − R 4 ) = 2 R 4 ∑ j = 1 3 c j ( b j + R j ( a 4 − a j ) ) .

Both determinants vanish generically. The remaining three independent sign changes imply c j ( a 4 − a j ) = 0 for each j and ∑ c j b j = 0 , as identities in the polynomial ring. At any specialized solution, the same sum equals ( a 4 − A ) ∑ c j R j . Thus the signed linear combination of the three radicals vanishes at every solution under consideration, including singular specializations.

Put u j = c j 2 D j and take

Q = ( u 3 − u 1 − u 2 ) 2 − 4 u 1 u 2 .

With x j = c j R j , this factors into the four forms x 3 ± x 1 ± x 2 . The factor with both plus signs vanishes at the specialized solution. Each generic factor is nonzero by radical independence, since c 3 = det ( v 1 , v 2 ) is a nonzero affine polynomial. The latter fact follows by evaluating at r 1 + ( 1 , 0 ) and r 1 + ( 0 , 1 ) . Each u j has degree at most six, hence deg ⁡ Q ≤ 12 . Multiplication over all eight signs would give the square of this four-factor polynomial.

Inspect the Lean declarations

PlanarUnitDistances.AnchorFallback.degree_twelve_branch

∀ {k : Type u_2} [inst : Field k] [CharZero k] {K : Type u_3} [inst_2 : Field K] [CharZero K]
  (r s : Fin 4 → k),
  (r 0, s 0) ≠ (r 1, s 1) →
    ∀ (b a D : Fin 4 → PlanarUnitDistances.AnchorFallback.PlanePoly k),
      (∀ (i : Fin 4), MvPolynomial.totalDegree (D i) ≤ 4) →
        ∀ (f : PlanarUnitDistances.AnchorFallback.PlanePoly k →+* K),
          Function.Injective ⇑f →
            ∀ (m : PlanarUnitDistances.AnchorFallback.Model (⇑f ∘ D)),
              OAI.PlanarUnitDistances.Radicals.SquareIndependent [f (D 0), f (D 1), f (D 2), f (D 3)] →
                (PlanarUnitDistances.AnchorFallback.aug
                        (fun j => m.incl (f (PlanarUnitDistances.AnchorFallback.pos 0 (r j))))
                        (fun j => m.incl (f (PlanarUnitDistances.AnchorFallback.pos 1 (s j))))
                        (⇑(m.incl.comp f) ∘ b) (⇑(m.incl.comp f) ∘ a) m.roots).det =
                    0 →
                  have x := fun j => PlanarUnitDistances.AnchorFallback.pos 0 (r j);
                  have y := fun j => PlanarUnitDistances.AnchorFallback.pos 1 (s j);
                  have F :=
                    PlanarUnitDistances.AnchorFallback.fallback (PlanarUnitDistances.AnchorFallback.cof x y)
                      D;
                  F ≠ 0 ∧
                    MvPolynomial.totalDegree F ≤ 12 ∧
                      ∀ (T : Type u_4) [inst_4 : Field T]
                        (g : PlanarUnitDistances.AnchorFallback.PlanePoly k →+* T) (u : Fin 4 → T)
                        (H₁ H₂ A : T),
                        (∀ (i : Fin 4), u i ^ 2 = g (D i)) →
                          (∀ (i : Fin 4), g (x i) * H₁ + g (y i) * H₂ - u i * A = g (b i) - u i * g (a i)) →
                            A ≠ g (a 3) → g F = 0
Lean source · PlanarUnitDistances/AnchorFallback.lean, lines 297–318
/-- Complete zero-determinant branch for four Cartesian anchors over a
generic field carrying the independent roots. Its nonzero degree-twelve
polynomial works uniformly in every specialization and every solution. -/
theorem degree_twelve_branch {K : Type*} [Field K] [CharZero K]
    (r s : Fin 4 → k) (distinct : (r 0,s 0)≠(r 1,s 1))
    (b a D : Fin 4 → PlanePoly k) (hD : ∀ i,(D i).totalDegree ≤ 4)
    (f : PlanePoly k →+* K) (hf : Function.Injective f) (m : Model (f ∘ D))
    (hind : SquareIndependent [f (D 0),f (D 1),f (D 2),f (D 3)])
    (gen : (aug (fun j => m.incl (f (pos 0 (r j)))) (fun j => m.incl (f (pos 1 (s j))))
      ((m.incl.comp f) ∘ b) ((m.incl.comp f) ∘ a) m.roots).det=0) :
    let x := fun j => pos 0 (r j)
    let y := fun j => pos 1 (s j)
    let F := fallback (cof x y) D
    F≠0 ∧ F.totalDegree ≤ 12 ∧
      ∀ (T : Type*) [Field T] (g : PlanePoly k →+* T) (u : Fin 4 → T) (H₁ H₂ A : T),
        (∀ i,u i^2=g (D i)) →
        (∀ i,g (x i)*H₁+g (y i)*H₂-u i*A=g (b i)-u i*g (a i)) →
        A≠g (a 3) → g F=0 := by
  dsimp only
  exact ⟨fallback_ne_zero f hf D m hind _ ⟨2,position_cofactor_nonzero r s distinct⟩,
    fallback_degree _ _ (position_cofactor_degrees r s) hD,
    fun _ _ g u h k A => specialized_fallback f hf D m hind _ _ b a gen g u h k A⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.AnchorFallback.det_flip

∀ {R : Type u_1} [inst : CommRing R] (x y b a s : Fin 4 → R),
  (PlanarUnitDistances.AnchorFallback.aug x y b a s).det -
      (PlanarUnitDistances.AnchorFallback.aug x y b a (PlanarUnitDistances.AnchorFallback.flip s)).det =
    2 * s 3 * PlanarUnitDistances.AnchorFallback.residual x y b a s
Lean source · PlanarUnitDistances/AnchorFallback.lean, lines 24–52
/-- Flipping only the fourth radical isolates the cofactor identity without
dividing by the first-three determinant. -/
theorem det_flip (x y b a s : Fin 4 → R) :
    (aug x y b a s).det - (aug x y b a (flip s)).det =
      2*s 3*residual x y b a s := by
  have a0 (s' : Fin 4 → R) (i) : aug x y b a s' i 0=x i := rfl
  have a1 (s' : Fin 4 → R) (i) : aug x y b a s' i 1=y i := rfl
  have a2 (s' : Fin 4 → R) (i) : aug x y b a s' i 2= -s' i := rfl
  have a3 (s' : Fin 4 → R) (i) : aug x y b a s' i 3=b i-s' i*a i := rfl
  rw [Matrix.det_succ_row _ 3, Matrix.det_succ_row (aug x y b a (flip s)) 3]
  simp only [Fin.sum_univ_four,Matrix.det_fin_three,Matrix.submatrix_apply,
    show (0:Fin 4).succAbove (0:Fin 3) = 1 from rfl,
    show (0:Fin 4).succAbove (1:Fin 3) = 2 from rfl,
    show (0:Fin 4).succAbove (2:Fin 3) = 3 from rfl,
    show (1:Fin 4).succAbove (0:Fin 3) = 0 from rfl,
    show (1:Fin 4).succAbove (1:Fin 3) = 2 from rfl,
    show (1:Fin 4).succAbove (2:Fin 3) = 3 from rfl,
    show (2:Fin 4).succAbove (0:Fin 3) = 0 from rfl,
    show (2:Fin 4).succAbove (1:Fin 3) = 1 from rfl,
    show (2:Fin 4).succAbove (2:Fin 3) = 3 from rfl,
    show (3:Fin 4).succAbove (0:Fin 3) = 0 from rfl,
    show (3:Fin 4).succAbove (1:Fin 3) = 1 from rfl,
    show (3:Fin 4).succAbove (2:Fin 3) = 2 from rfl]
  simp only [a0,a1,a2,a3]
  norm_num [flip,residual,cof,Fin.sum_univ_three,show (0:Fin 4)≠3 by decide,
    show (1:Fin 4)≠3 by decide,show (2:Fin 4)≠3 by decide,
    show (0:Fin 3).castSucc=0 from rfl,show (1:Fin 3).castSucc=1 from rfl,
    show (2:Fin 3).castSucc=2 from rfl,Matrix.cons_val_two,Matrix.cons_val_fin_one]
  ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.AnchorFallback.generic_coefficients

∀ {R : Type u_1} [inst : CommRing R] {K : Type u} [inst_1 : Field K] [CharZero K] {D : Fin 4 → K}
  (f : R →+* K),
  Function.Injective ⇑f →
    ∀ (m : PlanarUnitDistances.AnchorFallback.Model D),
      OAI.PlanarUnitDistances.Radicals.SquareIndependent [D 0, D 1, D 2, D 3] →
        ∀ (x y b a : Fin 4 → R),
          (PlanarUnitDistances.AnchorFallback.aug (⇑(m.incl.comp f) ∘ x) (⇑(m.incl.comp f) ∘ y)
                  (⇑(m.incl.comp f) ∘ b) (⇑(m.incl.comp f) ∘ a) m.roots).det =
              0 →
            ∑ i, PlanarUnitDistances.AnchorFallback.cof x y i * b i.castSucc = 0 ∧
              ∀ (i : Fin 3), PlanarUnitDistances.AnchorFallback.cof x y i * (a 3 - a i.castSucc) = 0
Lean source · PlanarUnitDistances/AnchorFallback.lean, lines 146–185
/-- If the generic augmented determinant vanishes, the regular polynomial
coefficients in its Cramer relation vanish individually. This statement
descends from the generic field before specializing any coordinate. -/
theorem generic_coefficients (f : R →+* K) (hf : Function.Injective f) (m : Model D)
    (hD : SquareIndependent [D 0,D 1,D 2,D 3]) (x y b a : Fin 4 → R)
    (gen : (aug ((m.incl.comp f) ∘ x) ((m.incl.comp f) ∘ y)
      ((m.incl.comp f) ∘ b) ((m.incl.comp f) ∘ a) m.roots).det = 0) :
    (∑ i : Fin 3,cof x y i*b i.castSucc)=0 ∧
      ∀ i : Fin 3,cof x y i*(a 3-a i.castSucc)=0 := by
  let v := m.incl.comp f
  let X := v ∘ x
  let Y := v ∘ y
  let B := v ∘ b
  let A := v ∘ a
  have hflip := congrArg (m.flips 3) gen
  have zflip : (aug X Y B A (flip m.roots)).det=0 := by
    let ψ := (m.flips 3).toRingHom
    have mat : ψ.mapMatrix (aug X Y B A m.roots) = aug X Y B A (flip m.roots) := by
      ext i j
      change m.flips 3 (aug X Y B A m.roots i j) = _
      fin_cases j <;> simp [X,Y,B,A,v,aug,flip,m.flips_base,m.flips_roots,eq_comm]
    rw [←mat,←ψ.map_det,show (aug X Y B A m.roots).det=0 from gen,map_zero]
  have eq := det_flip X Y B A m.roots
  rw [show (aug X Y B A m.roots).det=0 from gen,zflip,sub_self] at eq
  have resid := (mul_eq_zero.mp eq.symm).resolve_left (mul_ne_zero two_ne_zero (m.root_ne_zero hD 3))
  let C₀ := ∑ i : Fin 3,cof x y i*b i.castSucc
  let c (i : Fin 3) := cof x y i*(a 3-a i.castSucc)
  let coeff : Fin 4 → K := ![f (c 0),f (c 1),f (c 2),0]
  have id : m.incl (f C₀)+∑ i,m.incl (coeff i)*m.roots i = 0 := by
    apply Eq.trans _ resid
    simp only [residual,X,Y,B,A,C₀,v,mapped_cof,Function.comp_apply,RingHom.comp_apply,
      c,coeff,Fin.sum_univ_three,Fin.sum_univ_four,map_add,map_sub,map_mul]
    simp
    ring
  obtain ⟨base,coeffs⟩ := affine_independent m hD coeff (f C₀) id
  refine ⟨hf (base.trans (map_zero f).symm),?_⟩
  intro i
  apply hf
  fin_cases i <;> first | simpa [coeff,c] using coeffs 0 | simpa [coeff,c] using coeffs 1 |
    simpa [coeff,c] using coeffs 2

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.AnchorFallback.specialized_fallback

∀ {R : Type u_1} [inst : CommRing R] {K : Type u_2} [inst_1 : Field K] [CharZero K] (f : R →+* K),
  Function.Injective ⇑f →
    ∀ (D : Fin 4 → R) (m : PlanarUnitDistances.AnchorFallback.Model (⇑f ∘ D)),
      OAI.PlanarUnitDistances.Radicals.SquareIndependent [f (D 0), f (D 1), f (D 2), f (D 3)] →
        ∀ (x y b a : Fin 4 → R),
          (PlanarUnitDistances.AnchorFallback.aug (⇑(m.incl.comp f) ∘ x) (⇑(m.incl.comp f) ∘ y)
                  (⇑(m.incl.comp f) ∘ b) (⇑(m.incl.comp f) ∘ a) m.roots).det =
              0 →
            ∀ {T : Type u_3} [inst_3 : Field T] (g : R →+* T) (s : Fin 4 → T) (h k A : T),
              (∀ (i : Fin 4), s i ^ 2 = g (D i)) →
                (∀ (i : Fin 4), g (x i) * h + g (y i) * k - s i * A = g (b i) - s i * g (a i)) →
                  A ≠ g (a 3) →
                    g
                        (PlanarUnitDistances.AnchorFallback.fallback
                          (PlanarUnitDistances.AnchorFallback.cof x y) D) =
                      0
Lean source · PlanarUnitDistances/AnchorFallback.lean, lines 223–249
/-- Specialization of the Cramer branch. An arbitrary algebraic specialization
of the coefficient ring is allowed; it may kill every minor. -/
theorem specialized_fallback {K : Type*} [Field K] [CharZero K] (f : R →+* K)
    (hf : Function.Injective f) (D : Fin 4 → R) (m : Model (f ∘ D))
    (hind : SquareIndependent [f (D 0),f (D 1),f (D 2),f (D 3)]) (x y b a : Fin 4 → R)
    (gen : (aug ((m.incl.comp f) ∘ x) ((m.incl.comp f) ∘ y)
      ((m.incl.comp f) ∘ b) ((m.incl.comp f) ∘ a) m.roots).det=0)
    {T : Type*} [Field T] (g : R →+* T) (s : Fin 4 → T) (h k A : T)
    (hs : ∀ i,s i^2=g (D i))
    (eqs : ∀ i,g (x i)*h+g (y i)*k-s i*A = g (b i)-s i*g (a i))
    (hne : A≠g (a 3)) : g (fallback (cof x y) D)=0 := by
  obtain ⟨h0,hc⟩ := generic_coefficients f hf m hind x y b a gen
  have hb := congrArg g h0
  simp only [map_sum,map_mul,map_zero] at hb
  have rel : residual (g ∘ x) (g ∘ y) (g ∘ b) (g ∘ a) s=0 := by
    unfold residual
    simp only [mapped_cof,Function.comp_apply,mul_add,Finset.sum_add_distrib,hb,zero_add]
    apply Finset.sum_eq_zero
    intro i _
    have hh := congrArg g (hc i)
    simp only [map_mul,map_sub,map_zero] at hh
    linear_combination s i.castSucc * hh
  have hf' := residual_at_solution (g ∘ x) (g ∘ y) (g ∘ b) (g ∘ a) s h k A eqs
  rw [rel] at hf'
  have linear := (mul_eq_zero.mp hf'.symm).resolve_left (sub_ne_zero.mpr hne.symm)
  apply fallback_vanishes g _ _ s hs
  simpa only [mapped_cof] using linear

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.AnchorFallback.eliminate3_factors

∀ {R : Type u_1} [inst : CommRing R] (x y z : R),
  PlanarUnitDistances.AnchorFallback.eliminate3 (x ^ 2) (y ^ 2) (z ^ 2) =
    (z - x - y) * (z + x + y) * (z - x + y) * (z + x - y)
Lean source · PlanarUnitDistances/AnchorFallback.lean, lines 67–70
theorem eliminate3_factors (x y z : R) :
    eliminate3 (x^2) (y^2) (z^2) = (z-x-y)*(z+x+y)*(z-x+y)*(z+x-y) := by
  unfold eliminate3
  ring

Kernel axioms used: propext, Quot.sound.

Lemma 5.19 Cartesian four-anchor specialization

Lean verified

Let k have characteristic zero and contain i with i 2 = − 1 . For four distinct Cartesian anchors the map k [ X , Y ] → k ( z ) ( w ) defined by X = ( z + w ) / 2 , Y = ( z − w ) / ( 2 i ) is injective. The four radicands D j = L j ( L j − 4 ) , with L j = ( X − r j , 1 ) 2 + ( Y − r j , 2 ) 2 , generate independent square classes. If some choice of the four generic roots in a field extension annihilates the augmented determinant, a single nonzero polynomial of degree at most twelve vanishes at every specialized solution with A ≠ a 4 over every extension of k .

Proof

The inverse linear change of coordinates gives z = X + i Y , w = X − i Y , and the two independent rational function variables give injectivity. Each L j becomes ( z − z j ) ( w − w j ) . The private valuations give square-class independence. Every chosen generic root tuple is the image of the canonical tuple under a field embedding. The determinant commutes with this embedding, so its vanishing gives the hypothesis of Lemma 5.18.

Inspect the Lean declarations

PlanarUnitDistances.AnchorGenericPlane.exists_generic_roots

∀ {k : Type v} [inst : Field k] [CharZero k] {I : k},
  I ^ 2 = -1 →
    ∀ (r s : Fin 4 → k),
      (Function.Injective fun i => (r i, s i)) →
        Nonempty (PlanarUnitDistances.AnchorGenericPlane.GenericRoots I r s)
Lean source · PlanarUnitDistances/AnchorGenericPlane.lean, lines 165–167
theorem exists_generic_roots {I : k} (hI : I^2= -1) (r s : Fin 4 → k)
    (hd : Function.Injective (fun i => (r i,s i))) : Nonempty (GenericRoots I r s) :=
  exists_radicalModel _ (plane_model hI r s hd).2

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.AnchorGenericPlane.splitMap_injective

∀ {k : Type u_1} [inst : Field k], Function.Injective ⇑PlanarUnitDistances.AnchorGenericPlane.splitMap
Lean source · PlanarUnitDistances/AnchorGenericPlane.lean, lines 18–37
/-- No polynomial equation between the two generic null coordinates. -/
theorem splitMap_injective : Function.Injective (splitMap (k:=k)) := by
  let F := FractionRing (Pol k)
  let f : Pol k →ₐ[k] F := IsScalarTower.toAlgHom k (Pol k) F
  have inj : Function.Injective f := IsFractionRing.injective (Pol k) F
  have independent := (MvPolynomial.algebraicIndependent_X (Fin 2) k).map' inj
  obtain ⟨ψ,hw,hz,hc⟩ := OAI.PlanarUnitDistances.GenericPlane.exists_plane_embedding _ independent
  have id : ψ.comp splitMap = f.toRingHom := by
    apply MvPolynomial.ringHom_ext
    · intro b; change ψ (splitMap (C b))=f (C b)
      rw [splitMap,eval₂Hom_C]
      exact (hc b).trans (f.commutes b).symm
    · intro i
      simp only [RingHom.comp_apply,splitMap,eval₂Hom_X']
      fin_cases i
      · exact hz
      · exact hw
  intro p q h
  apply inj
  exact (DFunLike.congr_fun id p).symm.trans ((congrArg ψ h).trans (DFunLike.congr_fun id q))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.AnchorGenericPlane.toNull_injective

∀ {k : Type u_1} [inst : Field k] [CharZero k] {I : k},
  I ^ 2 = -1 → Function.Injective ⇑(PlanarUnitDistances.AnchorGenericPlane.toNull I)
Lean source · PlanarUnitDistances/AnchorGenericPlane.lean, lines 47–65
theorem toNull_injective {I : k} (hI : I^2= -1) : Function.Injective (toNull I) := by
  have hn : I≠0 := by rintro rfl; simp at hI
  have hinv (a : k) (ha : a≠0) : (C a:Pol k)*C a⁻¹=1 := by rw [←map_mul,mul_inv_cancel₀ ha,map_one]
  have comp : (toCartesian I).comp (toNull I)=RingHom.id _ := by
    apply MvPolynomial.ringHom_ext
    · intro b; simp [toCartesian,toNull]
    · intro i; fin_cases i
      · change toCartesian I (toNull I (X 0))=X 0
        simp [toCartesian,toNull]
        have h := hinv 2 two_ne_zero
        rw [map_ofNat] at h
        linear_combination (X 0)*h
      · change toCartesian I (toNull I (X 1))=X 1
        simp [toCartesian,toNull]
        have h := hinv (2*I) (mul_ne_zero two_ne_zero hn)
        simp only [mul_inv_rev,map_mul,map_ofNat] at h
        linear_combination (X 1)*h
  intro p q h
  exact (DFunLike.congr_fun comp p).symm.trans ((congrArg (toCartesian I) h).trans (DFunLike.congr_fun comp q))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.AnchorGenericPlane.distance_generic

∀ {k : Type u_1} [inst : Field k] [CharZero k] {I : k},
  I ^ 2 = -1 →
    ∀ (r s : k),
      (PlanarUnitDistances.AnchorGenericPlane.Dx I) (PlanarUnitDistances.AnchorGenericPlane.distanceSq r s) =
        (PlanarUnitDistances.AnchorGenericPlane.z - PlanarUnitDistances.AnchorGenericPlane.base (r + I * s)) *
          (PlanarUnitDistances.AnchorGenericPlane.w - PlanarUnitDistances.AnchorGenericPlane.base (r - I * s))
Lean source · PlanarUnitDistances/AnchorGenericPlane.lean, lines 72–90
/-- Pullback of the actual Cartesian distance to the split generic field, with
the same anchor parameters on both sides. -/
theorem distance_generic {I : k} (hi : I^2= -1) (r s : k) :
    Dx I (distanceSq r s) =
      (z-base (r+I*s)) * (w-base (r-I*s)) := by
  have hn : I≠0 := by rintro rfl; simp at hi
  have nn : base I≠0 := by simpa using (base.injective.ne hn)
  have zi : (C I : Pol k)^2 = -1 := by rw [←map_pow,hi,map_neg,map_one]
  have fac : distanceSq r s = ((X 0+C I*X 1)-C (r+I*s))*((X 0-C I*X 1)-C (r-I*s)) := by
    simp only [distanceSq,map_add,map_sub,map_mul]
    linear_combination (X 1-C s)^2*zi
  have phC (c : k) : Dx I (C c) = base c := by simp [Dx,splitMap,toNull]
  have x : Dx I (X 0) = (2:Frac2 k)⁻¹*(z+w) := by
    simp [Dx,splitMap,toNull,map_ofNat]
  have y : Dx I (X 1) = (2*base I)⁻¹*(z-w) := by
    simp [Dx,splitMap,toNull,map_ofNat]
  rw [fac,map_mul,map_sub,map_sub,map_add,map_sub,map_mul,x,y,phC,phC,phC]
  field_simp [nn]
  ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.AnchorGenericPlane.plane_model

∀ {k : Type u_1} [inst : Field k] [CharZero k] {I : k},
  I ^ 2 = -1 →
    ∀ (r s : Fin 4 → k),
      (Function.Injective fun i => (r i, s i)) →
        Function.Injective ⇑(PlanarUnitDistances.AnchorGenericPlane.Dx I) ∧
          OAI.PlanarUnitDistances.Radicals.SquareIndependent
            [(PlanarUnitDistances.AnchorGenericPlane.Dx I)
                (PlanarUnitDistances.AnchorGenericPlane.radicand (r 0) (s 0)),
              (PlanarUnitDistances.AnchorGenericPlane.Dx I)
                (PlanarUnitDistances.AnchorGenericPlane.radicand (r 1) (s 1)),
              (PlanarUnitDistances.AnchorGenericPlane.Dx I)
                (PlanarUnitDistances.AnchorGenericPlane.radicand (r 2) (s 2)),
              (PlanarUnitDistances.AnchorGenericPlane.Dx I)
                (PlanarUnitDistances.AnchorGenericPlane.radicand (r 3) (s 3))]
Lean source · PlanarUnitDistances/AnchorGenericPlane.lean, lines 91–123
/-- Generic field containing the correct independent four Cartesian radicands.
The underlying polynomial map is injective, so coefficient descent is valid. -/
theorem plane_model {I : k} (hI : I^2= -1) (r s : Fin 4 → k)
    (distinct : Function.Injective (fun i => (r i,s i))) :
    Function.Injective (Dx I) ∧
    SquareIndependent [Dx I (radicand (r 0) (s 0)),Dx I (radicand (r 1) (s 1)),
      Dx I (radicand (r 2) (s 2)),Dx I (radicand (r 3) (s 3))] := by
  refine ⟨splitMap_injective.comp (toNull_injective hI),?_⟩
  let a (j : Fin 4) := r j+I*s j
  let b (j : Fin 4) := r j-I*s j
  have hn : I≠0 := by rintro rfl; simp at hI
  have hab : Function.Injective (fun j => (a j,b j)) := by
    intro j l he
    have h1 := congrArg Prod.fst he; have h2 := congrArg Prod.snd he
    change r j+I*s j = r l+I*s l at h1
    change r j-I*s j = r l-I*s l at h2
    apply distinct
    apply Prod.ext
    · linear_combination (h1+h2)/2
    · apply mul_left_cancel₀ hn
      linear_combination (h1-h2)/2
  have hind := plane_radicands_squareIndependent (List.ofFn (fun j => (a j,b j))) (List.nodup_ofFn.mpr hab)
  have form : SquareIndependent (List.ofFn (fun j : Fin 4 =>
      (z-base (a j))*(w-base (b j))*((z-base (a j))*(w-base (b j))-4))) := by
    simpa only [List.map_ofFn,planeRadicandPoly,planeDistancePoly,map_mul,map_sub,map_ofNat,
      RatFunc.algebraMap_C,RatFunc.algebraMap_X,Function.comp_def,base,z,w,RingHom.comp_apply] using hind
  simp only [radicand,map_mul,map_sub,map_ofNat,distance_generic hI]
  let v (j : Fin 4) := (z-base (a j))*(w-base (b j))*((z-base (a j))*(w-base (b j))-4)
  have ls (F : Fin 4 → Frac2 k) : List.ofFn F = [F 0, F 1, F 2, F 3] := by
    simp [List.ofFn_succ]
  change SquareIndependent (List.ofFn v) at form
  rw [ls] at form
  simpa only [v,a,b,map_sub,map_mul] using form

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.AnchorGenericPlane.radicand_degree

∀ {k : Type v} [inst : Field k] (r s : k),
  MvPolynomial.totalDegree (PlanarUnitDistances.AnchorGenericPlane.radicand r s) ≤ 4
Lean source · PlanarUnitDistances/AnchorGenericPlane.lean, lines 136–151
theorem radicand_degree (r s : k) : (radicand r s).totalDegree ≤ 4 := by
  have linear (i : Fin 2) (a : k) : (X i-C a : Pol k).totalDegree ≤ 1 := by
    apply (totalDegree_sub _ _).trans
    rw [totalDegree_X,totalDegree_C]; decide
  have d : (distanceSq r s).totalDegree ≤ 2 := by
    unfold distanceSq
    apply (totalDegree_add _ _).trans
    apply max_le
    · exact (totalDegree_pow _ _).trans (by have := linear 0 r; omega)
    · exact (totalDegree_pow _ _).trans (by have := linear 1 s; omega)
  have four : (4:Pol k).totalDegree=0 := by
    rw [show (4:Pol k)=C (4:k) from (map_ofNat C 4).symm,totalDegree_C]
  unfold radicand
  apply (totalDegree_mul _ _).trans
  have t := totalDegree_sub (distanceSq r s) (4:Pol k)
  omega

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.AnchorGenericPlane.genericAug_zero_from_chosen_roots

∀ {k : Type v} [inst : Field k] {I : k} (r s U T a : Fin 4 → k)
  (m : PlanarUnitDistances.AnchorGenericPlane.GenericRoots I r s) {E : Type v} [inst_1 : Field E]
  (φ : PlanarUnitDistances.AnchorGenericPlane.Frac2 k →+* E) (u : Fin 4 → E),
  (∀ (j : Fin 4),
      u j ^ 2 =
        φ
          ((PlanarUnitDistances.AnchorGenericPlane.Dx I)
            (PlanarUnitDistances.AnchorGenericPlane.radicand (r j) (s j)))) →
    (PlanarUnitDistances.AnchorFallback.aug
            (⇑(φ.comp (PlanarUnitDistances.AnchorGenericPlane.Dx I)) ∘ fun j =>
              PlanarUnitDistances.AnchorFallback.pos 0 (r j))
            (⇑(φ.comp (PlanarUnitDistances.AnchorGenericPlane.Dx I)) ∘ fun j =>
              PlanarUnitDistances.AnchorFallback.pos 1 (s j))
            (⇑(φ.comp (PlanarUnitDistances.AnchorGenericPlane.Dx I)) ∘
              PlanarUnitDistances.AnchorGenericPlane.positionRhs r s U T)
            (fun j => φ ((PlanarUnitDistances.AnchorGenericPlane.Dx I) (MvPolynomial.C (a j)))) u).det =
        0 →
      (PlanarUnitDistances.AnchorGenericPlane.genericAug I r s U T a m).det = 0
Lean source · PlanarUnitDistances/AnchorGenericPlane.lean, lines 170–184
/-- Any choice of generic roots with zero determinant forces the corresponding
canonical model determinant to vanish, by its evaluation embedding. -/
theorem genericAug_zero_from_chosen_roots {I : k} (r s U T a : Fin 4 → k)
    (m : GenericRoots I r s) {E : Type v} [Field E] (φ : Frac2 k →+* E)
    (u : Fin 4 → E) (sq : ∀ j,u j^2=φ (Dx I (radicand (r j) (s j))))
    (zero : (aug ((φ.comp (Dx I)) ∘ (fun j => pos 0 (r j)))
      ((φ.comp (Dx I)) ∘ (fun j => pos 1 (s j))) ((φ.comp (Dx I)) ∘ positionRhs r s U T)
      (fun j => φ (Dx I (C (a j)))) u).det=0) : (genericAug I r s U T a m).det=0 := by
  obtain ⟨e,coeff,root⟩ := m.evaluate E φ u (by intro j; fin_cases j <;> exact sq _)
  apply e.injective
  rw [e.map_det,map_zero]
  apply Eq.trans _ zero
  apply congrArg Matrix.det
  ext i j
  fin_cases j <;> simp [genericAug,aug,coeff,root]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.AnchorGenericPlane.cartesian_fallback

∀ {k : Type v} [inst : Field k] [CharZero k] {I : k},
  I ^ 2 = -1 →
    ∀ (r s U T a : Fin 4 → k),
      (Function.Injective fun i => (r i, s i)) →
        ∀ (m : PlanarUnitDistances.AnchorGenericPlane.GenericRoots I r s),
          (PlanarUnitDistances.AnchorGenericPlane.genericAug I r s U T a m).det = 0 →
            ∃ F,
              F ≠ 0 ∧
                MvPolynomial.totalDegree F ≤ 12 ∧
                  ∀ (L : Type u_1) [inst_2 : Field L] (f : k →+* L) (p q h k' A : L) (u : Fin 4 → L),
                    (∀ (j : Fin 4),
                        have n := (p - f (r j)) ^ 2 + (q - f (s j)) ^ 2;
                        u j ^ 2 = n * (n - 4)) →
                      (∀ (j : Fin 4),
                          2 * ((p - f (r j)) * (h - f (U j)) + (q - f (s j)) * (k' - f (T j))) =
                            u j * (A - f (a j))) →
                        A ≠ f (a 3) → (MvPolynomial.eval₂Hom f ![p, q]) F = 0
Lean source · PlanarUnitDistances/AnchorGenericPlane.lean, lines 185–208
/-- The concrete exceptional branch of the four-anchor theorem. In Cartesian
coordinates the eliminant has total degree at most twelve and tests every
solution over every extension of k. -/
theorem cartesian_fallback {I : k} (hI : I^2= -1) (r s U T a : Fin 4 → k)
    (hd : Function.Injective (fun i => (r i,s i))) (m : GenericRoots I r s)
    (zero : (genericAug I r s U T a m).det=0) :
    ∃ F : Pol k,F≠0 ∧ F.totalDegree ≤ 12 ∧
      ∀ (L : Type*) [Field L] (f : k →+* L) (p q h k' A : L) (u : Fin 4 → L),
        (∀ j,let n := (p-f (r j))^2+(q-f (s j))^2; u j^2=n*(n-4)) →
        (∀ j,2*((p-f (r j))*(h-f (U j))+(q-f (s j))*(k'-f (T j)))=u j*(A-f (a j))) →
        A≠f (a 3) → eval₂Hom f ![p,q] F=0 := by
  have ⟨inj,indep⟩ := plane_model hI r s hd
  have proof := degree_twelve_branch r s (hd.ne (by decide : (0:Fin 4)≠1))
    (positionRhs r s U T) (fun j => C (a j)) (fun j => radicand (r j) (s j))
    (fun j => radicand_degree _ _) (Dx I) inj m indep zero
  refine ⟨_,proof.1,proof.2.1,?_⟩
  intro L _ f p q h k' A u hs eqs hn
  apply proof.2.2 L (eval₂Hom f ![p,q]) u h k' A
  · intro j
    simpa [radicand,distanceSq,map_ofNat] using hs j
  · intro j
    simp [pos,positionRhs]
    linear_combination eqs j
  · simpa using hn

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.20 Successive norms and arbitrary specializations

Lean verified

Let the square of each formal root be a plane polynomial of degree at most four. Adjoining n such roots gives a commutative algebra in which all of them are simultaneously defined. Every prescribed tuple of roots in an extension field gives a homomorphism from this algebra. The composite norm carries an element of weighted degree at most m to a polynomial of degree at most 2 n m . A zero in any specialization is a zero of the norm. Conversely, over an algebraically closed field, a zero of the norm lifts to a zero for at least one tuple of roots.

Proof

For a single root T 2 = d , write the element as a + b T . Give T weight two. The filtration at level m requires a at level m and b at level m − 2 . Allowing negative levels handles a zero coefficient at the lower end. The two summands of a 2 − d b 2 now have weight at most 2 m . Under a chosen evaluation this norm is the product of the two conjugate values, so a zero factor descends. Over an algebraically closed field choose a square root of the image of d ; if the product vanishes one of its two factors vanishes. Iteration proves both specialization assertions, even at repeated roots. In the same filtration subtracting the first row of the augmented matrix from the other three proves the degree-five bound before the first norm.

Inspect the Lean declarations

PlanarUnitDistances.RadicalNorm.formalRoots

{R : Type u} →
  [inst : CommRing R] →
    (b : PlanarUnitDistances.RadicalNorm.Bounds R) →
      {n : ℕ} →
        (d : Fin n → R) → (∀ (i : Fin n), b.fits 4 (d i)) → PlanarUnitDistances.RadicalNorm.RootModel b d
Lean source · PlanarUnitDistances/FormalRoots.lean, lines 70–72
def formalRoots (b : Bounds R) : ∀ {n} (d : Fin n → R), (∀ i, b.fits 4 (d i)) → RootModel b d
  | 0,d,_ => noRoots b d
  | _+1,d,h => addRoot d (h 0) (formalRoots b (fun i => d i.succ) (fun i => h i.succ))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.RadicalNorm.norm_fits

∀ {R : Type u} [inst : CommRing R] (b : PlanarUnitDistances.RadicalNorm.Bounds R) {d : R} (hd : b.fits 4 d)
  {n : ℤ} {z : QuadraticAlgebra R d 0},
  (PlanarUnitDistances.RadicalNorm.extend b d hd).fits n z → b.fits (2 * n) (QuadraticAlgebra.norm z)
Lean source · PlanarUnitDistances/QuadraticFiltration.lean, lines 75–81
/-- Each successive norm doubles the current weighted degree, including after
one or more previous square roots have already been adjoined. -/
theorem norm_fits (b : Bounds R) {d : R} (hd : b.fits 4 d) {n z}
    (h : (extend b d hd).fits n z) : b.fits (2*n) z.norm := by
  simp only [QuadraticAlgebra.norm_def,zero_mul,add_zero,sub_eq_add_neg]
  exact b.add (b.mono (by omega) (b.mul h.1 h.1))
    (b.neg (b.mono (by omega) (b.mul (b.mul hd h.2) h.2)))

Kernel axioms used: propext, Quot.sound.

PlanarUnitDistances.RadicalNorm.quadraticStep

{R : Type u} →
  [inst : CommRing R] →
    {S : Type u} →
      [inst_1 : CommRing S] →
        {b : PlanarUnitDistances.RadicalNorm.Bounds R} →
          {c : PlanarUnitDistances.RadicalNorm.Bounds S} →
            {m : ℕ} →
              PlanarUnitDistances.RadicalNorm.Descent b c m →
                (d : S) →
                  (hd : c.fits 4 d) →
                    PlanarUnitDistances.RadicalNorm.Descent b (PlanarUnitDistances.RadicalNorm.extend c d hd)
                      (m * 2)
Lean source · PlanarUnitDistances/QuadraticFiltration.lean, lines 120–143
def quadraticStep {S : Type u} [CommRing S] {b : Bounds R} {c : Bounds S} {m : ℕ}
    (tower : Descent b c m) (d : S) (hd : c.fits 4 d) : Descent b (extend c d hd) (m*2) where
  incl := (algebraMap S (QuadraticAlgebra S d 0)).comp tower.incl
  norm x := tower.norm x.norm
  bound := by
    intro n x hx
    simpa only [Nat.cast_mul,Nat.cast_ofNat,mul_assoc] using tower.bound (norm_fits c hd hx)
  vanishes := by
    intro L _ g x hx
    apply tower.vanishes (g.comp (algebraMap S (QuadraticAlgebra S d 0))) x.norm
    simp [QuadraticAlgebra.algebraMap_norm_eq_mul_star,hx]
  liftZero := by
    intro L _ _ f x hx
    obtain ⟨g,hg,hxg⟩ := tower.liftZero f x.norm hx
    obtain ⟨r,hr⟩ := IsAlgClosed.exists_pow_nat_eq (g d) (by decide : 0<2)
    rw [norm_specializes g r hr x,mul_eq_zero] at hxg
    rcases hxg with hp|hm
    · refine ⟨evalRoot g r hr,?_,hp⟩
      rw [← RingHom.comp_assoc,evalRoot_base,hg]
    · have hr' : (-r)^2=g d := by simpa using hr
      refine ⟨evalRoot g (-r) hr',?_,?_⟩
      · rw [← RingHom.comp_assoc,evalRoot_base,hg]
      · change g x.re+g x.im*(-r)=0
        simpa [sub_eq_add_neg] using hm

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.RadicalNorm.augmentedFits

∀ {R : Type u_1} [inst : CommRing R] (b : PlanarUnitDistances.RadicalNorm.Bounds R)
  (M : Matrix (Fin 4) (Fin 4) R) (p q : R) (a c : Fin 4 → R),
  b.fits 1 p →
    b.fits 1 q →
      (∀ (i : Fin 4), b.fits 0 (a i)) →
        (∀ (i : Fin 4), b.fits 0 (c i)) →
          (∀ (i : Fin 4), M i 0 = p + a i) →
            (∀ (i : Fin 4), M i 1 = q + c i) →
              (∀ (i : Fin 4), b.fits 2 (M i 2)) → (∀ (i : Fin 4), b.fits 2 (M i 3)) → b.fits 5 M.det
Lean source · PlanarUnitDistances/FilteredDeterminant.lean, lines 52–85
/-- Weighted degree five for the actual augmented determinant inside the
iterated square-root algebra. The two affine columns have a common leading term. -/
theorem augmentedFits (b : Bounds R) (M : Matrix (Fin 4) (Fin 4) R)
    (p q : R) (a c : Fin 4 → R) (hp : b.fits 1 p) (hq : b.fits 1 q)
    (ha : ∀ i, b.fits 0 (a i)) (hc : ∀ i, b.fits 0 (c i))
    (h0 : ∀ i, M i 0=p+a i) (h1 : ∀ i, M i 1=q+c i)
    (h2 : ∀ i, b.fits 2 (M i 2)) (h3 : ∀ i, b.fits 2 (M i 3)) : b.fits 5 M.det := by
  let D : Matrix (Fin 4) (Fin 4) R := fun i j => if i=0 then M i j else M i j-M 0 j
  let w (i : Fin 4) : Fin 4 → ℤ := ![if i=0 then 1 else 0,if i=0 then 1 else 0,2,2]
  have left (i j : Fin 4) (u : R) (v : Fin 4 → R) (H : ∀ k, M k j=u+v k)
      (hu : b.fits 1 u) (hv : ∀ l, b.fits 0 (v l)) :
      b.fits (if i=0 then 1 else 0) (D i j) := by
    by_cases hi : i=0
    · simp only [D,hi,if_true,H]
      exact b.add hu (b.mono (by decide : (0:ℤ)≤1) (hv _))
    · simp only [D,if_neg hi,H]
      rw [add_sub_add_left_eq_sub,sub_eq_add_neg]
      exact b.add (hv _) (b.neg (hv _))
  have right (i j : Fin 4) (h : ∀ l, b.fits 2 (M l j)) : b.fits 2 (D i j) := by
    by_cases hi : i=0
    · simpa [D,hi] using h 0
    · simpa [D,hi,sub_eq_add_neg] using b.add (h i) (b.neg (h 0))
  rw [← det_row_differences M]
  apply detFits b D w
  · intro i j
    fin_cases j
    · exact left i 0 p a h0 hp ha
    · exact left i 1 q c h1 hq hc
    · exact right i 2 h2
    · exact right i 3 h3
  · intro s
    have ne := s.injective.ne (by decide : (0:Fin 4)≠1)
    simp [w,Fin.sum_univ_four]
    split_ifs <;> omega

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.21 Four-anchor curve

Lean verified

Fix four distinct anchors r j , their position velocities U j and their scalars b j over a characteristic-zero field K containing a square root of − 1 . There is a single nonzero Q ∈ K [ X , Y ] , of degree at most D = 80 , such that Q ( p ) = 0 for every solution over every extension of K of

2 ( p − r j ) ⋅ ( H − U j ) = R j ( A − b j ) , R j 2 = L j ( L j − 4 ) , A ≠ b 4 .

Here Q depends on the fixed anchor data and is uniform in p , H , A , R j .

Proof

Write L j = ( z − z j ) ( w − w j ) , D j = L j ( L j − 4 ) . The divisor L j − 4 has order one on D j and zero on every other D m . Independent square classes give the independent sign changes of a degree-sixteen multiquadratic extension. The augmented four-equation determinant has weighted degree at most five when each radical has weight two. Its nonzero norm has degree at most 80. If the determinant vanishes identically, solve the first three equations generically. Their coefficient determinant d has a nonzero coefficient of a radical: det ( p − r 1 , p − r 2 ) is a nonzero affine linear polynomial since r 1 ≠ r 2 . Flipping the fourth sign forces A = b 4 generically. If d A is the Cramer numerator for A , the resulting identity d A = b 4 d holds in the polynomial algebra modulo the monic radical equations. Indeed its squarefree monomials are a free basis, and remain independent in the multiquadratic field. At an actual solution the adjugate identity gives d A = d A , even if d = 0 there. Consequently A ≠ b 4 forces d = 0 ; its norm has degree at most 24. This argument never evaluates a generic denominator at a possibly singular configuration. Lemma 5.18 verifies specialization in the Cramer branch and sharpens its bound to 12 . Lemma 5.20 supplies the polynomial norm with its degree bound and specialization in both directions. If the norm is the zero polynomial, lift its generic zero to four roots in an algebraic closure and use the degree-12 fallback. The resulting polynomial is chosen before the extension field or position is specified.

Inspect the Lean declarations

PlanarUnitDistances.four_anchor_curve

∀ {K : Type u} [inst : Field K] [CharZero K] (I : K),
  I ^ 2 = -1 →
    ∀ (r V : Fin 4 → Fin 2 → K) (a : Fin 4 → K),
      Function.Injective r →
        ∃ F,
          F ≠ 0 ∧
            F.totalDegree ≤ 80 ∧
              ∀ (L : Type u) [inst_2 : Field L] (ι : K →+* L) (p H : Fin 2 → L) (A : L) (R : Fin 4 → L),
                (∀ (j : Fin 4),
                    have x := p 0 - ι (r j 0);
                    have y := p 1 - ι (r j 1);
                    have d := x ^ 2 + y ^ 2;
                    R j ^ 2 = d * (d - 4) ∧
                      2 * (x * (H 0 - ι (V j 0)) + y * (H 1 - ι (V j 1))) = R j * (A - ι (a j))) →
                  A ≠ ι (a 3) → MvPolynomial.eval₂ ι p F = 0
Lean source · PlanarUnitDistances/FourAnchorCurve.lean, lines 19–81
/-- The four-anchor lemma of the manuscript. One bivariate polynomial works
over all extension fields, including all singular specializations. -/
theorem four_anchor_curve {K : Type u} [Field K] [CharZero K] (I : K) (hI : I^2= -1)
    (r V : Fin 4 → Fin 2 → K) (a : Fin 4 → K) (hd : Function.Injective r) :
    ∃ F : MvPolynomial (Fin 2) K, F≠0 ∧ F.totalDegree ≤ 80 ∧
      ∀ (L : Type u) [Field L] (ι : K →+* L) (p H : Fin 2 → L) (A : L) (R : Fin 4 → L),
        (∀ j, let x := p 0-ι (r j 0)
              let y := p 1-ι (r j 1)
              let d := x^2+y^2
              R j^2=d*(d-4) ∧
                2*(x*(H 0-ι (V j 0))+y*(H 1-ι (V j 1)))=R j*(A-ι (a j))) →
        A ≠ ι (a 3) → MvPolynomial.eval₂ ι p F=0 := by
  let r₀ (j : Fin 4) := r j 0
  let r₁ (j : Fin 4) := r j 1
  let u (j : Fin 4) := V j 0
  let v (j : Fin 4) := V j 1
  let b := positionRhs r₀ r₁ u v
  let D (i : Fin 4) := radicand (r₀ i) (r₁ i)
  have inj : Function.Injective (fun j => (r₀ j,r₁ j)) := by
    intro i j hij
    apply hd
    funext k
    fin_cases k
    · exact congrArg Prod.fst hij
    · exact congrArg Prod.snd hij
  have degP (k : Fin 2) : (2*X k : Pol K).totalDegree ≤ 1 := by
    rw [show (2:Pol K)=C (2:K) from (map_ofNat C 2).symm]
    simpa using totalDegree_mul (C (2:K)) (X k)
  have posEq (i : Fin 2) (z : K) : (2*X i : Pol K)+C (-(2*z))=pos i z := by
    simp [pos,map_ofNat]; ring
  have degPos (i : Fin 2) (z : K) : (pos i z).totalDegree ≤ 1 := by
    rw [← posEq]
    exact (totalDegree_add _ _).trans (max_le (degP i) (by rw [totalDegree_C]; decide))
  have hb (j) : (b j).totalDegree ≤ 2 := by
    apply (totalDegree_add _ _).trans
    have h₀ := totalDegree_mul (pos 0 (r₀ j)) (C (u j))
    have h₁ := totalDegree_mul (pos 1 (r₁ j)) (C (v j))
    simp only [totalDegree_C,add_zero] at h₀ h₁
    exact max_le ((h₀.trans (degPos ..)).trans (by decide)) ((h₁.trans (degPos ..)).trans (by decide))
  obtain ⟨F,dF,forward,back⟩ := RadicalNorm.four_root_eliminant
    (2*X 0) (2*X 1) (fun j => -(2*r₀ j)) (fun j => -(2*r₁ j))
    b (fun j => C (a j)) D (degP _) (degP _) hb (fun _ => by simp) (fun _ => radicand_degree _ _)
  simp only [posEq] at forward back
  by_cases hz : F=0
  · let K' := Frac2 K
    let φ := algebraMap K' (AlgebraicClosure K')
    obtain ⟨t,st,det⟩ := back (φ.comp (Dx I)) (by rw [hz,map_zero])
    obtain ⟨m⟩ := exists_generic_roots hI r₀ r₁ inj
    have z := genericAug_zero_from_chosen_roots r₀ r₁ u v a m φ t st det
    obtain ⟨Q,hQ,dQ,van⟩ := cartesian_fallback hI r₀ r₁ u v a inj m z
    refine ⟨Q,hQ,dQ.trans (by decide),?_⟩
    intro L _ ι p H A R he ne
    have peq : ![p 0,p 1]=p := by funext i; fin_cases i <;> rfl
    have hv := van L ι (p 0) (p 1) (H 0) (H 1) A R (fun j => (he j).1) (fun j => (he j).2) ne
    rwa [peq] at hv
  · refine ⟨F,hz,dF,?_⟩
    intro L _ ι p H A R he _
    apply forward (eval₂Hom ι p) R
    · intro j; simpa [D,radicand,distanceSq,r₀,r₁] using (he j).1
    · apply zero_aug_solution _ _ _ _ _ (H 0) (H 1) A
      intro j
      simp [pos,b,positionRhs,r₀,r₁,u,v]
      linear_combination (he j).2

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.22 Four anchors with many edges at their common neighbors

Lean verified

Let n ≥ 1 , and let a bipartite graph with at most n vertices on either side have e ≥ 16 n edges. Some ordered quadruple of distinct right anchors has a common-neighbor set on the left whose vertices have total degree at least e 5 / ( 512 n 8 ) .

Proof

Write d ( p ) for the left degree. For a right quadruple a , let M ( a ) be the sum of the degrees of its common neighbors. Interchange the two sums: a vertex p belongs to exactly ( d ( p ) ) 4 = d ( p ) ( d ( p ) − 1 ) ( d ( p ) − 2 ) ( d ( p ) − 3 ) such quadruples, interpreted as zero when d ( p ) < 4 . Thus ∑ a M ( a ) = ∑ p d ( p ) ( d ( p ) ) 4 . The vertices of degree at least eight carry at least e / 2 edges, and there ( d ( p ) ) 4 ≥ d ( p ) 4 / 16 . Jensen’s inequality for the fifth power gives ∑ a M ( a ) ≥ e 5 / ( 512 n 4 ) . Since there are at most n 4 quadruples, one has M ( a ) ≥ e 5 / ( 512 n 8 ) .

Inspect the Lean declarations

PlanarUnitDistances.CurveRestriction.four_anchors

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q] [Nonempty P] {n : ℕ},
  0 < n →
    Fintype.card P ≤ n →
      Fintype.card Q ≤ n →
        ∀ (N : P → Finset Q),
          16 * n ≤ ∑ p, (N p).card →
            ∃ a,
              ↑(∑ p, (N p).card) ^ 5 / (512 * ↑n ^ 8) ≤
                ∑ p ∈ PlanarUnitDistances.CurveRestriction.common N a, ↑(N p).card
Lean source · PlanarUnitDistances/CurveRestriction.lean, lines 111–144
/-- Under the size and density hypotheses an ordered, distinct right
quadruple has a common neighborhood carrying the stated original edges. -/
theorem four_anchors [Nonempty P] {n : ℕ} (hn : 0 < n)
    (hp : Fintype.card P ≤ n) (hq : Fintype.card Q ≤ n)
    (N : P → Finset Q) (dense : 16*n ≤ ∑ p, (N p).card) :
    ∃ a : Fin 4 ↪ Q, (((∑ p, (N p).card : ℕ):ℝ)^5) / (512 * (n:ℝ)^8) ≤
      (∑ p ∈ common N a, ((N p).card:ℝ)) := by
  classical
  let mass (a : Fin 4 ↪ Q) : ℝ := ∑ p ∈ common N a, ((N p).card:ℝ)
  let e : ℝ := (∑ p, (N p).card : ℕ)
  have he : 0 < e := by dsimp [e]; exact_mod_cast (show 0 < ∑ p, (N p).card by omega)
  have hn' : (0:ℝ) < n := by exact_mod_cast hn
  have hm : e^5 ≤ 512 * (n:ℝ)^4 * ∑ a, mass a := by
    have h := fifth_moment hp (fun p => (N p).card) dense
    have hc := common_degree_identity N
    dsimp [mass, e]
    norm_cast
    exact_mod_cast (show (∑ p, (N p).card)^5 ≤ 512*n^4*(∑ a, ∑ p ∈ common N a, (N p).card) by
      rw [hc]; exact_mod_cast h)
  have nh : (Finset.univ : Finset (Fin 4 ↪ Q)).Nonempty := by
    by_contra! h
    rw [h, sum_empty, mul_zero] at hm
    exact (pow_pos he 5).not_ge hm
  have cardA : Fintype.card (Fin 4 ↪ Q) ≤ n^4 := by
    rw [Fintype.card_embedding_eq, Fintype.card_fin]
    exact (Nat.descFactorial_le_pow _ _).trans (Nat.pow_le_pow_left hq _)
  have hsum : ∑ _ : Fin 4 ↪ Q, e^5/(512*(n:ℝ)^8) ≤ ∑ a, mass a := by
    simp only [sum_const, card_univ, nsmul_eq_mul]
    calc
      _ ≤ (n:ℝ)^4 * (e^5/(512*(n:ℝ)^8)) := by gcongr; exact_mod_cast cardA
      _ = e^5 / (512*(n:ℝ)^4) := by field_simp
      _ ≤ _ := (div_le_iff₀ (by positivity)).mpr (by linarith [hm])
  obtain ⟨a,_,ha⟩ := exists_le_of_sum_le nh hsum
  exact ⟨a,ha⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CurveRestriction.common_degree_identity

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q] (N : P → Finset Q),
  ∑ a, ∑ p ∈ PlanarUnitDistances.CurveRestriction.common N a, (N p).card =
    ∑ p, (N p).card * (N p).card.descFactorial 4
Lean source · PlanarUnitDistances/CurveRestriction.lean, lines 30–41
theorem common_degree_identity (N : P → Finset Q) :
    (∑ a : Fin 4 ↪ Q, ∑ p ∈ common N a, (N p).card) =
      ∑ p : P, (N p).card * (N p).card.descFactorial 4 := by
  classical
  unfold common
  simp_rw [sum_filter]
  rw [sum_comm]
  apply sum_congr rfl
  intro p _
  rw [← sum_filter (fun a : Fin 4 ↪ Q => ∀ i, a i ∈ N p) (fun _ => (N p).card)]
  simpa only [sum_const, nsmul_eq_mul, anchor_count, Nat.cast_id] using
    (Nat.mul_comm ((N p).card.descFactorial 4) (N p).card)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CurveRestriction.second_restriction

∀ {e e₁ e₂ n D : ℝ},
  0 ≤ e →
    0 < n →
      0 < D →
        e ^ 5 / (512 * D * n ^ 8) ≤ e₁ →
          e₁ ^ 5 / (512 * D * n ^ 8) ≤ e₂ → e ^ 25 / ((512 * D) ^ 6 * n ^ 48) ≤ e₂
Lean source · PlanarUnitDistances/CurveRestriction.lean, lines 147–156
/-- The exact constant after the second curve restriction, including the
sixth power of the factor count. -/
theorem second_restriction {e e₁ e₂ n D : ℝ} (he : 0 ≤ e) (hn : 0 < n) (hD : 0 < D)
    (h₁ : e^5 / (512*D*n^8) ≤ e₁) (h₂ : e₁^5 / (512*D*n^8) ≤ e₂) :
    e^25 / ((512*D)^6 * n^48) ≤ e₂ := by
  have h := pow_le_pow_left₀ (by positivity) h₁ 5
  apply le_trans _ h₂
  calc
    _ = (e^5/(512*D*n^8))^5 / (512*D*n^8) := by field_simp
    _ ≤ _ := div_le_div_of_nonneg_right h (by positivity)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.23 A single irreducible curve retains original edges

Lean verified

Suppose every quadruple of distinct right anchors has all its common neighbors on a nonzero polynomial of total degree at most D . Assume n , D ≥ 1 , both sides have size at most n , and e ≥ 16 n . There is an irreducible plane curve of total degree at most D whose left vertices carry at least e 5 / ( 512 D n 8 ) edges to the original right side.

Proof

Choose four anchors maximizing the sum of original vertex degrees in their common neighborhood, as in the preceding counting lemma. A unit polynomial cannot vanish on this nonempty set. For f = g h , each zero contributes its nonnegative weight to the zeros of g or of h . Induct on total degree, using deg ⁡ f = deg ⁡ g + deg ⁡ h . Keep the better of the two irreducible factors supplied by induction. Its total weight is at least the original zero weight divided by deg ⁡ f . This extends the factor induction in the September Lean proof to the original edge weights and to total degree.

Inspect the Lean declarations

PlanarUnitDistances.CurveRestriction.irreducible_curve_restriction

∀ {k : Type u_1} {P : Type u_2} {Q : Type u_3} [inst : Field k] [inst_1 : Fintype P] [inst_2 : Fintype Q]
  {n D : ℕ},
  0 < n →
    0 < D →
      Fintype.card P ≤ n →
        Fintype.card Q ≤ n →
          ∀ (x : P → Fin 2 → k) (N : P → Finset Q),
            16 * n ≤ ∑ p, (N p).card →
              (∀ (a : Fin 4 ↪ Q),
                  ∃ f,
                    f ≠ 0 ∧
                      MvPolynomial.totalDegree f ≤ D ∧
                        ∀ p ∈ PlanarUnitDistances.CurveRestriction.common N a,
                          (MvPolynomial.eval (x p)) f = 0) →
                ∃ g,
                  Irreducible g ∧
                    MvPolynomial.totalDegree g ≤ D ∧
                      ↑(∑ p, (N p).card) ^ 5 / (512 * ↑D * ↑n ^ 8) ≤
                        ∑ p with (MvPolynomial.eval (x p)) g = 0, ↑(N p).card
Lean source · PlanarUnitDistances/WeightedCurve.lean, lines 56–101
/-- From one actual low-degree equation on each quadruple's neighbors to
an irreducible curve retaining the asserted number of original edges. -/
theorem irreducible_curve_restriction [Fintype P] [Fintype Q] {n D : ℕ} (hn : 0<n) (hD : 0<D)
    (hp : Fintype.card P ≤ n) (hq : Fintype.card Q ≤ n) (x : P → Fin 2 → k)
    (N : P → Finset Q) (dense : 16*n ≤ ∑ p, (N p).card)
    (anchors : ∀ a : Fin 4 ↪ Q, ∃ f : Poly k, f ≠ 0 ∧ f.totalDegree ≤ D ∧
      ∀ p ∈ common N a, eval (x p) f=0) :
    ∃ g : Poly k, Irreducible g ∧ g.totalDegree ≤ D ∧
      ((∑ p, (N p).card : ℕ):ℝ)^5/(512*D*(n:ℝ)^8) ≤
        ∑ p ∈ univ.filter (fun p => eval (x p) g=0), ((N p).card:ℝ) := by
  haveI : Nonempty P := by
    by_contra! h
    letI : IsEmpty P := h
    simp at dense
    omega
  obtain ⟨a,hm⟩ := four_anchors hn hp hq N dense
  obtain ⟨f,hf,df,allz⟩ := anchors a
  let S := common N a
  let w (p : P) := (N p).card
  have epos : 0 < ∑ p, (N p).card := by omega
  have lhs : 0 < (((∑ p, (N p).card:ℕ):ℝ)^5)/(512*(n:ℝ)^8) := by positivity
  have sn : S.Nonempty := by
    by_contra! he
    change _ ≤ ∑ p ∈ S, ((N p).card:ℝ) at hm
    rw [he,Finset.sum_empty] at hm
    exact (not_lt_of_ge hm) lhs
  have nu : ¬IsUnit f := by
    obtain ⟨p,hs⟩ := sn
    intro hu
    exact (hu.map (eval (x p))).ne_zero (allz p hs)
  obtain ⟨g,ig,_,dg,wg⟩ := irreducible_weight_capture S x w f hf nu
  refine ⟨g,ig,dg.trans df,?_⟩
  have wz : zeroWeight S x w f=∑ p ∈ S,w p := by
    unfold zeroWeight
    exact Finset.sum_congr rfl fun p h => if_pos (allz p h)
  have wc : zeroWeight S x w g ≤ ∑ p ∈ univ.filter (fun p => eval (x p) g=0),w p := by
    rw [zeroWeight,Finset.sum_filter]
    exact Finset.sum_le_sum_of_subset (Finset.subset_univ _)
  rw [wz] at wg
  have hnat := wg.trans (Nat.mul_le_mul df wc)
  have hreal : (∑ p ∈ S, ((N p).card:ℝ)) ≤
      (D:ℝ)*∑ p ∈ univ.filter (fun p => eval (x p) g=0), ((N p).card:ℝ) := by exact_mod_cast hnat
  have hfinal := hm.trans hreal
  apply (div_le_iff₀ (by positivity)).mpr
  have hfin := (div_le_iff₀ (by positivity)).mp hfinal
  linarith only [hfin]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CurveRestriction.irreducible_weight_capture

∀ {k : Type u_1} {P : Type u_2} [inst : Field k] (S : Finset P) (x : P → Fin 2 → k) (w : P → ℕ)
  (f : PlanarUnitDistances.CurveRestriction.Poly k),
  f ≠ 0 →
    ¬IsUnit f →
      ∃ g,
        Irreducible g ∧
          g ∣ f ∧
            MvPolynomial.totalDegree g ≤ MvPolynomial.totalDegree f ∧
              PlanarUnitDistances.CurveRestriction.zeroWeight S x w f ≤
                MvPolynomial.totalDegree f * PlanarUnitDistances.CurveRestriction.zeroWeight S x w g
Lean source · PlanarUnitDistances/WeightedCurve.lean, lines 23–54
theorem irreducible_weight_capture (S : Finset P) (x : P → Fin 2 → k) (w : P → ℕ)
    (f : Poly k) (hf : f ≠ 0) (nu : ¬IsUnit f) :
    ∃ g : Poly k, Irreducible g ∧ g ∣ f ∧ g.totalDegree ≤ f.totalDegree ∧
      zeroWeight S x w f ≤ f.totalDegree*zeroWeight S x w g := by
  generalize hd : f.totalDegree=d
  induction d using Nat.strong_induction_on generalizing f with
  | h d ih =>
    by_cases ir : Irreducible f
    · exact ⟨f,ir,dvd_refl _,hd.le,Nat.le_mul_of_pos_left _ (hd ▸ degree_pos hf nu)⟩
    obtain ⟨g,h,ef,ng,nh⟩ : ∃ g h, f=g*h ∧ ¬IsUnit g ∧ ¬IsUnit h := by
      simpa [irreducible_iff,nu] using ir
    have hg := left_ne_zero_of_mul (ef ▸ hf)
    have hh := right_ne_zero_of_mul (ef ▸ hf)
    have sumD : g.totalDegree+h.totalDegree=d := by rw [←totalDegree_mul_of_isDomain hg hh,←ef,hd]
    have gp := degree_pos hg ng
    have hp := degree_pos hh nh
    obtain ⟨u,iu,du,su,wu⟩ := ih g.totalDegree (by omega) g hg ng rfl
    obtain ⟨v,iv,dv,sv,wv⟩ := ih h.totalDegree (by omega) h hh nh rfl
    have total : zeroWeight S x w f ≤ zeroWeight S x w g+zeroWeight S x w h := by
      unfold zeroWeight
      rw [← Finset.sum_add_distrib]
      apply Finset.sum_le_sum
      intro p _
      rw [ef,map_mul]
      by_cases h₁ : eval (x p) g=0 <;> by_cases h₂ : eval (x p) h=0 <;> simp [h₁,h₂]
    rcases le_total (zeroWeight S x w u) (zeroWeight S x w v) with hl|hl
    · refine ⟨v,iv,dv.trans (ef ▸ dvd_mul_left h g),by omega,?_⟩
      rw [←sumD,add_mul]
      exact total.trans (Nat.add_le_add (wu.trans (Nat.mul_le_mul_left _ hl)) wv)
    · refine ⟨u,iu,du.trans (ef ▸ dvd_mul_right g h),by omega,?_⟩
      rw [←sumD,add_mul]
      exact total.trans (Nat.add_le_add wu (wv.trans (Nat.mul_le_mul_left _ hl)))

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.24 Restriction to two curves

Lean verified

Let n , D ≥ 1 . Suppose each side of a bipartite graph has at most n vertices and the common neighbors of every four distinct right anchors lie in the zero set of a nonzero polynomial of degree at most D . One irreducible curve on the left retains at least e 5 / ( 512 D n 8 ) edges when e ≥ 16 n . If this last bound is at least 16 n and the reverse-side hypothesis holds too, restriction to two curves retains at least e 25 / ( K 1 n 48 ) edges, where K 1 = ( 512 D ) 6 .

Proof

The size restriction n ≥ 1 makes the displayed denominators nonzero. Factor each nonconstant containing polynomial over the algebraically closed coefficient field. At most D distinct irreducible factors cover its zeros. For empty common-neighbor sets, any line can be used. Choose the anchors by Lemma 5.22 and then choose one factor by Lemma 5.23. In the second restriction the new common-neighbor set is contained in the old one, so the reverse-side hypothesis survives. Apply the same estimate to the retained edge count e 1 and obtain e 1 5 / ( 512 D n 8 ) ≥ e 25 / ( ( 512 D ) 6 n 48 ) . Lean carries the original edge weights through both choices of an irreducible factor.

Inspect the Lean declarations

PlanarUnitDistances.CurveRestriction.restrict_to_two_curves

∀ {k : Type u_1} {P : Type u_2} {Q : Type u_3} [inst : Field k] [inst_1 : Fintype P] [inst_2 : Fintype Q]
  {n D : ℕ},
  0 < n →
    0 < D →
      Fintype.card P ≤ n →
        Fintype.card Q ≤ n →
          ∀ (x : P → Fin 2 → k) (y : Q → Fin 2 → k) (N : P → Finset Q),
            16 * n ≤ ∑ p, (N p).card →
              16 * ↑n ≤ ↑(∑ p, (N p).card) ^ 5 / (512 * ↑D * ↑n ^ 8) →
                (∀ (a : Fin 4 ↪ Q),
                    ∃ f,
                      f ≠ 0 ∧
                        MvPolynomial.totalDegree f ≤ D ∧
                          ∀ p ∈ PlanarUnitDistances.CurveRestriction.common N a,
                            (MvPolynomial.eval (x p)) f = 0) →
                  (∀ (a : Fin 4 ↪ P),
                      ∃ f,
                        f ≠ 0 ∧
                          MvPolynomial.totalDegree f ≤ D ∧
                            ∀
                              q ∈
                                PlanarUnitDistances.CurveRestriction.common
                                  (PlanarUnitDistances.CurveRestriction.reverseRow N Finset.univ) a,
                              (MvPolynomial.eval (y q)) f = 0) →
                    ∃ f g,
                      Irreducible f ∧
                        MvPolynomial.totalDegree f ≤ D ∧
                          Irreducible g ∧
                            MvPolynomial.totalDegree g ≤ D ∧
                              ↑(∑ p, (N p).card) ^ 25 / ((512 * ↑D) ^ 6 * ↑n ^ 48) ≤
                                ∑ q with (MvPolynomial.eval (y q)) g = 0,
                                  ↑(PlanarUnitDistances.CurveRestriction.reverseRow N
                                        {p | (MvPolynomial.eval (x p)) f = 0} q).card
Lean source · PlanarUnitDistances/TwoCurves.lean, lines 25–66
/-- The manuscript's two irreducible plane curves actually retain the claimed
edges: the second application is on the first restricted graph with the
original point labels. Empty neighborhoods and repeated point labels are allowed. -/
theorem restrict_to_two_curves {n D : ℕ} (hn : 0<n) (hD : 0<D)
    (hp : Fintype.card P ≤ n) (hq : Fintype.card Q ≤ n)
    (x : P → Fin 2 → k) (y : Q → Fin 2 → k) (N : P → Finset Q)
    (dense : 16*n ≤ ∑ p, (N p).card)
    (thick : (16:ℝ)*n ≤ ((∑ p, (N p).card:ℕ):ℝ)^5/(512*D*(n:ℝ)^8))
    (left : ∀ a : Fin 4 ↪ Q, ∃ f : Poly k, f ≠ 0 ∧ f.totalDegree ≤ D ∧
      ∀ p ∈ common N a, eval (x p) f=0)
    (right : ∀ a : Fin 4 ↪ P, ∃ f : Poly k, f ≠ 0 ∧ f.totalDegree ≤ D ∧
      ∀ q ∈ common (reverseRow N univ) a, eval (y q) f=0) :
    ∃ f g : Poly k, Irreducible f ∧ f.totalDegree ≤ D ∧ Irreducible g ∧ g.totalDegree ≤ D ∧
      ((∑ p, (N p).card:ℕ):ℝ)^25 / ((512*(D:ℝ))^6*(n:ℝ)^48) ≤
      ∑ q ∈ univ.filter (fun q => eval (y q) g=0),
        ((reverseRow N (univ.filter (fun p => eval (x p) f=0)) q).card:ℝ) := by
  obtain ⟨f,hf,df,h₁⟩ := irreducible_curve_restriction hn hD hp hq x N dense left
  let S := univ.filter fun p => eval (x p) f=0
  let M := reverseRow N S
  have hsum : (∑ q, ((M q).card:ℝ)) = ∑ p ∈ S, ((N p).card:ℝ) := by
    exact_mod_cast reverse_count N S
  have hsum' : ((∑ q, (M q).card:ℕ):ℝ) = ∑ p ∈ S, ((N p).card:ℝ) := by
    push_cast
    exact hsum
  have dense' : 16*n ≤ ∑ q, (M q).card := by
    exact_mod_cast (thick.trans h₁ |>.trans_eq hsum'.symm)
  have right' (a : Fin 4 ↪ P) : ∃ g : Poly k, g≠0 ∧ g.totalDegree ≤ D ∧
      ∀ q ∈ common M a, eval (y q) g=0 := by
    obtain ⟨g,hg,dg,hz⟩ := right a
    refine ⟨g,hg,dg,fun q h => hz q ?_⟩
    apply mem_filter.mpr
    refine ⟨mem_univ _, fun i => ?_⟩
    have hi : a i ∈ M q := (Finset.mem_filter.mp h).2 i
    change a i ∈ Finset.filter (fun p => q ∈ N p) (univ : Finset P)
    exact Finset.mem_filter.mpr ⟨mem_univ _, (Finset.mem_filter.mp hi).2⟩
  obtain ⟨g,hg,dg,h₂⟩ := irreducible_curve_restriction hn hD hq hp y M dense' right'
  refine ⟨f,g,hf,df,hg,dg,?_⟩
  have hleft : 0 ≤ ((∑ p, (N p).card:ℕ):ℝ) := Nat.cast_nonneg _
  have hnR : 0 < (n:ℝ) := Nat.cast_pos.mpr hn
  have hDR : 0 < (D:ℝ) := Nat.cast_pos.mpr hD
  exact second_restriction (e₁ := ((∑ q, (M q).card:ℕ):ℝ)) hleft hnR hDR
    (h₁.trans_eq hsum'.symm) h₂

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.25 Seven normalized anchor entries and eight abscissas

Lean verified

Work in a field extension K / F . Suppose eight rows and four anchors satisfy

2 ( p i − r j ) ⋅ ( H i − U j ) = R i j ( A i − a j ) , A i ≠ a j ,

with r 2 ≠ r 1 . Let x 1 , … , x 8 be algebraically independent over F . There are new velocities and scalars satisfying the same equations with the original positions and R i j , and a field L generated by at most seven elements over F , containing all new right-hand entries. Some x i is transcendental over the relative algebraic closure of L in K .

Proof

Subtract U 1 from each velocity and a 1 from each scalar. Write J ( x , y ) = ( − y , x ) . Subtracting ω J ( v − r 1 ) at position v leaves every equation unchanged, since v ⋅ J v = 0 . A nonzero component of J ( r 2 − r 1 ) determines ω so that one second-anchor component also vanishes. The remaining five vector components and three scalars give eight entries. If one is nonzero, rescale every velocity and scalar by its inverse. The selected entry is now one. If all vanish, take L = F . In either case seven entries suffice. The eight independent abscissas have algebraic matroid rank eight, whereas the closure of seven generators has rank at most seven. Hence one abscissa is transcendental over L , and remains so after an algebraic extension.

Inspect the Lean declarations

PlanarUnitDistances.GenericParameters.normalize_four_anchors

∀ {F : Type u_1} {K : Type u_2} [inst : Field F] [inst_1 : Field K] [inst_2 : Algebra F K]
  {p : Fin 8 → Fin 2 → K} {r : Fin 4 → Fin 2 → K} {R : Fin 8 → Fin 4 → K} {H : Fin 8 → Fin 2 → K}
  {U : Fin 4 → Fin 2 → K} {A : Fin 8 → K} {a : Fin 4 → K},
  PlanarUnitDistances.GenericParameters.Compatible p r R H U A a →
    r 1 ≠ r 0 →
      ∀ {x : Fin 8 → K},
        AlgebraicIndependent F x →
          ∃ y H' U' A' a',
            PlanarUnitDistances.GenericParameters.Compatible p r R H' U' A' a' ∧
              (∀ (j : Fin 4) (h : Fin 2), U' j h ∈ IntermediateField.adjoin F (Set.range y)) ∧
                (∀ (j : Fin 4), a' j ∈ IntermediateField.adjoin F (Set.range y)) ∧
                  ∃ i,
                    Transcendental (↥(algebraicClosure (↥(IntermediateField.adjoin F (Set.range y))) K)) (x i)
Lean source · PlanarUnitDistances/AnchorNormalization.lean, lines 67–102
/-- One nonzero common scaling gives another compatible tangent, brings
all right-hand data into a seven-generated field, and leaves an original
abscissa transcendental over its relative algebraic closure. -/
theorem normalize_four_anchors {F K : Type*} [Field F] [Field K] [Algebra F K]
    {p : Fin 8 → Fin 2 → K} {r : Fin 4 → Fin 2 → K} {R H U A a}
    (eqs : Compatible p r R H U A a) (hr : r 1 ≠ r 0) {x : Fin 8 → K}
    (hx : AlgebraicIndependent F x) :
    ∃ y : Fin 7 → K, ∃ H' U' A' a', Compatible p r R H' U' A' a' ∧
      (∀ j h, U' j h ∈ IntermediateField.adjoin F (range y)) ∧
      (∀ j, a' j ∈ IntermediateField.adjoin F (range y)) ∧
      ∃ i, Transcendental (algebraicClosure (IntermediateField.adjoin F (range y)) K) (x i) := by
  classical
  obtain ⟨V,T,B,b,k,he,h0,hb,h1⟩ := remove_rigid_motion eqs hr
  let other : Fin 2 := if k=0 then 1 else 0
  let entries : Fin 8 → K := ![T 1 other,T 2 0,T 2 1,T 3 0,T 3 1,b 1,b 2,b 3]
  obtain ⟨c,y,hc,hmem⟩ := seven_generators (F := F) entries
  refine ⟨y,(fun i h => c*V i h),(fun j h => c*T j h),(fun i => c*B i),
    (fun j => c*b j),?_,?_,?_,eight_against_seven x y hx⟩
  · intro i j
    obtain ⟨h,h'⟩ := he i j
    constructor
    · linear_combination c*h
    · exact fun h => h' (mul_left_cancel₀ hc h)
  · intro j h
    have g0 := hmem 0
    have g1 := hmem 1
    have g2 := hmem 2
    have g3 := hmem 3
    have g4 := hmem 4
    fin_cases k <;> fin_cases j <;> fin_cases h <;>
      simp_all [entries,other]
  · intro j
    have g5 := hmem 5
    have g6 := hmem 6
    have g7 := hmem 7
    fin_cases j <;> simp_all [entries]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.GenericParameters.remove_rigid_motion

∀ {I : Type u_1} {K : Type u_2} [inst : Field K] {p : I → Fin 2 → K} {r : Fin 4 → Fin 2 → K}
  {R : I → Fin 4 → K} {H : I → Fin 2 → K} {U : Fin 4 → Fin 2 → K} {A : I → K} {a : Fin 4 → K},
  PlanarUnitDistances.GenericParameters.Compatible p r R H U A a →
    r 1 ≠ r 0 →
      ∃ H' U' A' a' k,
        PlanarUnitDistances.GenericParameters.Compatible p r R H' U' A' a' ∧
          (∀ (h : Fin 2), U' 0 h = 0) ∧ a' 0 = 0 ∧ U' 1 k = 0
Lean source · PlanarUnitDistances/AnchorNormalization.lean, lines 14–48
/-- Translation, rotation and a scalar translation preserve the equations,
and set the first three anchor entries and one second-anchor velocity to zero. -/
theorem remove_rigid_motion {I K : Type*} [Field K] {p : I → Fin 2 → K}
    {r : Fin 4 → Fin 2 → K} {R H U A a} (eqs : Compatible p r R H U A a)
    (hr : r 1 ≠ r 0) :
    ∃ H' U' A' a', ∃ k : Fin 2, Compatible p r R H' U' A' a' ∧
      (∀ h, U' 0 h = 0) ∧ a' 0 = 0 ∧ U' 1 k = 0 := by
  classical
  let J (v : Fin 2 → K) (k : Fin 2) : K := ![-(v 1-r 0 1), v 0-r 0 0] k
  have nonzero : ∃ k, J (r 1) k ≠ 0 := by
    by_contra! h
    apply hr
    funext k
    have h0 := h 0
    have h1 := h 1
    simp [J] at h0 h1
    fin_cases k
    · exact sub_eq_zero.mp h1
    · exact (sub_eq_zero.mp h0).symm
  obtain ⟨k,hk⟩ := nonzero
  let w := (U 1 k-U 0 k)/J (r 1) k
  let V (x u : Fin 2 → K) (c : Fin 2) := u c - U 0 c - w*J x c
  refine ⟨fun i => V (p i) (H i), fun j => V (r j) (U j),
    fun i => A i-a 0, fun j => a j-a 0, k, ?_, ?_, sub_self _, ?_⟩
  · intro i j
    obtain ⟨he,hn⟩ := eqs i j
    constructor
    · dsimp [V,J]
      linear_combination he
    · simpa using hn
  · intro h
    fin_cases h <;> simp [V,J]
  · dsimp [V,w]
    field_simp [hk]
    ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.GenericParameters.seven_generators

∀ {F : Type u_1} {K : Type u_2} [inst : Field F] [inst_1 : Field K] [inst_2 : Algebra F K] (b : Fin 8 → K),
  ∃ c y, c ≠ 0 ∧ ∀ (j : Fin 8), c * b j ∈ IntermediateField.adjoin F (Set.range y)
Lean source · PlanarUnitDistances/AnchorNormalization.lean, lines 50–65
/-- After common rescaling, eight remaining anchor entries are generated by
seven of them. The scaling factor is also nonzero in the all-zero case. -/
theorem seven_generators {F K : Type*} [Field F] [Field K] [Algebra F K] (b : Fin 8 → K) :
    ∃ (c : K) (y : Fin 7 → K), c ≠ 0 ∧ ∀ j, c*b j ∈ IntermediateField.adjoin F (range y) := by
  classical
  by_cases nonzero : ∃ j, b j ≠ 0
  · obtain ⟨j,hj⟩ := nonzero
    let y (k : Fin 7) := (b j)⁻¹*b (j.succAbove k)
    refine ⟨(b j)⁻¹,y,inv_ne_zero hj,fun m => ?_⟩
    by_cases h : m = j
    · subst m
      simp [hj]
    · obtain ⟨k,rfl⟩ := Fin.exists_succAbove_eq h
      exact IntermediateField.subset_adjoin F _ ⟨k,rfl⟩
  · push Not at nonzero
    exact ⟨1,fun _ => 0,one_ne_zero,fun j => by simp [nonzero]⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.GenericParameters.eight_against_seven

∀ {F : Type u_1} {K : Type u_2} [inst : Field F] [inst_1 : Field K] [inst_2 : Algebra F K] (x : Fin 8 → K)
  (y : Fin 7 → K),
  AlgebraicIndependent F x →
    ∃ i, Transcendental (↥(algebraicClosure (↥(IntermediateField.adjoin F (Set.range y))) K)) (x i)
Lean source · PlanarUnitDistances/GenericParameters.lean, lines 32–36
/-- Manuscript's eight point abscissas after seven normalized anchor parameters. -/
theorem eight_against_seven {F K : Type*} [Field F] [Field K] [Algebra F K]
    (x : Fin 8 → K) (y : Fin 7 → K) (hx : AlgebraicIndependent F x) :
    ∃ i, Transcendental (algebraicClosure (IntermediateField.adjoin F (range y)) K) (x i) :=
  survives_adjoining (by decide) x y hx

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.26 Private orders on the coefficient field

Lean verified

Suppose for each radicand D j ∈ K × there is an integer order that takes value one on D j and zero on the other three. Then the four classes are independent in K × / K × 2 .

Proof

In a nonempty product choose one index and apply its order. The product has order one. A square has even order.

Inspect the Lean declarations

PlanarUnitDistances.FourRowObstruction.independent_of_private_orders

∀ {K : Type u_1} [inst : Field K] {D : Fin 4 → Kˣ},
  PlanarUnitDistances.FourRowObstruction.PrivateOrders D →
    PlanarUnitDistances.FourRowObstruction.IndependentClasses D
Lean source · PlanarUnitDistances/QuadraticKummerInput.lean, lines 24–40
/-- A selected private order is 1 on the product and even on a square. -/
theorem independent_of_private_orders {K : Type*} [Field K] {D : Fin 4 → Kˣ}
    (orders : PrivateOrders D) : IndependentClasses D := by
  intro T ht u e
  obtain ⟨i,hi⟩ := ht
  obtain ⟨w,wi,wj⟩ := orders i
  have value : w (∏ j∈T,D j)=w (D i) := by
    rw [map_prod]
    apply Finset.prod_eq_single i
    · intro k _ hki
      have h := wj k hki
      exact congrArg Multiplicative.ofAdd h
    · exact fun hn => (hn hi).elim
  have q := congrArg (fun z : Kˣ => (w z).toAdd) e
  change (w (∏ j∈T,D j)).toAdd=(w (u^2)).toAdd at q
  rw [value,wi,map_pow,Int.toAdd_pow] at q
  omega

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.FourRowObstruction.PrivateOrders

{K : Type u_1} → [inst : Field K] → (Fin 4 → Kˣ) → Prop
Lean source · PlanarUnitDistances/QuadraticKummerInput.lean, lines 15–19
/-- Integer orders restricted to the multiplicative group of the coefficient
field. Their values need only distinguish the four chosen radicands. -/
def PrivateOrders {K : Type*} [Field K] (D : Fin 4 → Kˣ) : Prop :=
  ∀ i, ∃ w : Kˣ →* Multiplicative ℤ, (w (D i)).toAdd=1 ∧
    ∀ j, j≠i → (w (D j)).toAdd=0

Kernel axioms used: propext, Quot.sound.

Lemma 5.27 The signs belong to the given chord labels

Lean verified

For the four original chord equations set u i m i = 1 , ℓ i = 2 − u i − m i , and D i = ℓ i ( ℓ i − 4 ) . The signed roots in the tangent equations are exactly m i − u i .

Proof

Expanding the chord identity gives ( m i − u i ) 2 = ℓ i ( ℓ i − 4 ) .

Inspect the Lean declarations

PlanarUnitDistances.FourRowObstruction.chord_root

∀ {E : Type u_2} [inst : Field E] {u m l : E}, u * m = 1 → l = 2 - u - m → (m - u) ^ 2 = l * (l - 4)
Lean source · PlanarUnitDistances/ChordObstruction.lean, lines 12–17
/-- A reciprocal pair satisfying the Euclidean chord equation gives a root
of the specified radicand with the sign supplied by the original labels. -/
theorem chord_root {u m l : E} (inv : u*m=1) (chord : l=2-u-m) :
    (m-u)^2=l*(l-4) := by
  rw [chord]
  linear_combination -4*inv

Kernel axioms used: propext, Quot.sound.

Lemma 5.28 Private orders on a generic line

Lean verified

Let k ⊂ K be of characteristic zero. On the line w = e z + e ′ take four anchor abscissas a i ∈ K algebraically independent over k , with e , c ∈ k and e c 2 = 4 . In K ( z ) the actual radicands D i = L i ( L i − 4 ) , L i = e ( z − a i ) 2 , have private integer orders. This remains valid when K contains additional anchor or velocity data.

Proof

For index i take the order at z = a i + c . The value of L i is four there, and the derivative of L i is 2 e c ≠ 0 . For j ≠ i , a zero of D j at this point would make a i − a j one of 0 , − c , − 2 c , contradicting independence over k . The Lean proof constructs the group homomorphism from the valuation at the prime ( z − a i − c ) in K [ z ] . It has value one on D i and zero on the other three. This supplies the orders for Lemma 5.27 without assuming a valuation on an enlarged field.

Inspect the Lean declarations

PlanarUnitDistances.RationalPrivateZeros.line_private_orders

∀ {K : Type u_1} [inst : Field K] {k : Type u_2} [inst_1 : Field k] [CharZero k] [CharZero K]
  [inst_4 : Algebra k K] (e c : k),
  e * c ^ 2 = 4 →
    ∀ (a : Fin 4 → K),
      AlgebraicIndependent k a →
        ∃ D,
          PlanarUnitDistances.FourRowObstruction.PrivateOrders D ∧
            ∀ (i : Fin 4),
              have l := PlanarUnitDistances.RationalPrivateZeros.lineChord ((algebraMap k K) e) (a i);
              ↑(D i) = (algebraMap (Polynomial K) (RatFunc K)) (l * (l - 4))
Lean source · PlanarUnitDistances/RationalPrivateZeros.lean, lines 76–130
/-- The same-line case of the private-valuation lemma, with the actual four
generic anchor abscissas. The intercept cancels from the squared distance.
The final constant field K may contain arbitrarily many other elements. -/
theorem line_private_orders {k : Type*} [Field k] [CharZero k] [CharZero K] [Algebra k K]
    (e c : k) (ec : e*c^2=4) (a : Fin 4 → K) (ind : AlgebraicIndependent k a) :
    ∃ D : Fin 4 → (RatFunc K)ˣ, FourRowObstruction.PrivateOrders D ∧ ∀ i,
      let l := lineChord (algebraMap k K e) (a i)
      (D i:RatFunc K)=algebraMap K[X] (RatFunc K) (l*(l-4)) := by
  let E := algebraMap k K e
  let C₀ := algebraMap k K c
  have hc : E*C₀^2=4 := by simpa only [E,C₀,map_mul,map_pow,map_ofNat] using congrArg (algebraMap k K) ec
  have e0 : E≠0 := by intro h; rw [h] at hc; norm_num at hc
  have c0 : C₀≠0 := by intro h; rw [h] at hc; norm_num at hc
  let l i := lineChord E (a i)
  let P i := l i*(l i-4)
  let s i := a i+C₀
  have val (i j) : (l j).eval (s i)=E*(a i+C₀-a j)^2 := by simp [l,s,lineChord]
  have here (i) : (l i).eval (s i)=4 := by simpa [val] using hc
  have root (i) : (P i).eval (s i)=0 := by simp [P,here]
  have deriv (i) : (l i).derivative.eval (s i)=2*E*C₀ := by
    simp [l,lineChord,s,derivative_pow]; ring
  have simple_root (i) : (P i).derivative.eval (s i)≠0 := by
    simp [P,derivative_mul,here,deriv,e0,c0]
  have other (i j) (ne : j≠i) : (P j).eval (s i)≠0 := by
    let z := a i+C₀-a j
    have avoid (d : k) : a i-a j≠algebraMap k K d := difference_not_constant a ind ne.symm d
    have z0 : z≠0 := by
      intro h
      apply avoid (-c)
      rw [map_neg]; change a i-a j= -C₀
      dsimp [z] at h; linear_combination h
    have nz : E*z^2≠4 := by
      intro h
      have f : (z-C₀)*(z+C₀)=0 := by
        apply mul_left_cancel₀ e0
        linear_combination h-hc
      rcases mul_eq_zero.mp f with p|p
      · apply avoid 0
        rw [map_zero]
        dsimp [z] at p; linear_combination p
      · apply avoid (-(c+c))
        rw [map_neg,map_add]
        change a i-a j= -(C₀+C₀)
        dsimp [z] at p; linear_combination p
    change (l j*(l j-4)).eval (s i)≠0
    simpa [val, ← show a i+C₀-a j=z from rfl] using
      mul_ne_zero (mul_ne_zero e0 (pow_ne_zero 2 z0)) (sub_ne_zero.mpr nz)
  have pne i : P i≠0 := by
    intro h
    have := simple_root i
    simp [h] at this
  let D i := Units.mk0 (algebraMap K[X] (RatFunc K) (P i))
    (by simpa only [map_zero] using (RatFunc.algebraMap_injective K).ne (pne i))
  refine ⟨D,private_orders_of_simple_zeros P (fun _ => 1) D (by simp [D]) s
    root simple_root other (by simp),fun i => rfl⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.RationalPrivateZeros.private_orders_of_simple_zeros

∀ {K : Type u_1} [inst : Field K] (P Q : Fin 4 → Polynomial K) (D : Fin 4 → (RatFunc K)ˣ),
  (∀ (i : Fin 4),
      ↑(D i) =
        (algebraMap (Polynomial K) (RatFunc K)) (P i) / (algebraMap (Polynomial K) (RatFunc K)) (Q i)) →
    ∀ (s : Fin 4 → K),
      (∀ (i : Fin 4), Polynomial.eval (s i) (P i) = 0) →
        (∀ (i : Fin 4), Polynomial.eval (s i) (Polynomial.derivative (P i)) ≠ 0) →
          (∀ (i j : Fin 4), j ≠ i → Polynomial.eval (s i) (P j) ≠ 0) →
            (∀ (i j : Fin 4), Polynomial.eval (s i) (Q j) ≠ 0) →
              PlanarUnitDistances.FourRowObstruction.PrivateOrders D
Lean source · PlanarUnitDistances/RationalPrivateZeros.lean, lines 42–63
/-- Actual arithmetic of private points on a rational parameter line.
All numerator and denominator evaluations occur over the final constant
field, including when it has already been enlarged by anchor parameters. -/
theorem private_orders_of_simple_zeros (P Q : Fin 4 → K[X])
    (D : Fin 4 → (RatFunc K)ˣ)
    (formula : ∀ i,(D i:RatFunc K)=algebraMap K[X] (RatFunc K) (P i) /
      algebraMap K[X] (RatFunc K) (Q i))
    (s : Fin 4 → K) (hroot : ∀ i,(P i).eval (s i)=0)
    (hsimple : ∀ i,(P i).derivative.eval (s i)≠0)
    (hother : ∀ i j,j≠i → (P j).eval (s i)≠0)
    (hden : ∀ i j,(Q j).eval (s i)≠0) : FourRowObstruction.PrivateOrders D := by
  intro i
  refine ⟨order (s i),?_,?_⟩
  · change -WithZero.log ((linearPrime _).valuation (RatFunc K) (D i:RatFunc K))=1
    rw [formula,map_div₀,valuation_of_algebraMap,valuation_of_algebraMap,
      simple _ _ (hroot i) (hsimple i),away _ _ (hden i i),div_one]
    simp
  · intro j hj
    change -WithZero.log ((linearPrime _).valuation (RatFunc K) (D j:RatFunc K))=0
    rw [formula,map_div₀,valuation_of_algebraMap,valuation_of_algebraMap,
      away _ _ (hother i j hj),away _ _ (hden i j)]
    simp

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.29 Private orders on a nonunit hyperbola

Lean verified

Let k ⊂ K be fields of characteristic zero, with k algebraically closed. Fix u , v , b ∈ k , b ≠ 0 , 1 . On the hyperbola ( z − u ) ( w − v ) = b , take four anchors with abscissas a i ∈ K algebraically independent over k . In K ( z ) the four squared chord lengths and their radicands are

L i = − b ( z − a i ) 2 ( z − u ) ( a i − u ) , D i = L i ( L i − 4 ) .

For each i there is an integer order on K ( z ) × that takes value one on D i and zero on every other D j .

Proof

Choose t ∈ k satisfying b t 2 + ( 4 − 2 b ) t + b = 0 . Its discriminant is 16 ( 1 − b ) ≠ 0 and t ≠ 0 . At s i = u + t ( a i − u ) all four denominators are nonzero and L i = 4 simply. To exclude a zero of D j there for j ≠ i , clear the denominator and regard the resulting numerator as a polynomial in the two independent anchors. Evaluating this polynomial at a i = u ,   a j = u + 1 gives b 2 ≠ 0 . This test is on the numerator alone, so the vanishing of a denominator at the test values causes no problem. Algebraic independence gives nonvanishing at the actual anchors. The order at the prime ( z − s i ) now has the asserted values. The case b = 1 has a repeated quadratic root and is excluded here.

Inspect the Lean declarations

PlanarUnitDistances.RationalPrivateZeros.hyperbola_private_orders

∀ {k : Type u_1} {K : Type u_2} [inst : Field k] [CharZero k] [inst_2 : Field K] [CharZero K]
  [inst_4 : Algebra k K] [IsAlgClosed k] (u b : k),
  b ≠ 0 →
    b ≠ 1 →
      ∀ (a : Fin 4 → K),
        AlgebraicIndependent k a →
          ∃ D,
            PlanarUnitDistances.FourRowObstruction.PrivateOrders D ∧
              ∀ (i : Fin 4),
                have l :=
                  (algebraMap (Polynomial K) (RatFunc K))
                      (PlanarUnitDistances.RationalPrivateZeros.hyperbolaNum ((algebraMap k K) b) (a i)) /
                    (algebraMap (Polynomial K) (RatFunc K))
                      (PlanarUnitDistances.RationalPrivateZeros.hyperbolaDen ((algebraMap k K) u) (a i));
                ↑(D i) = l * (l - 4)
Lean source · PlanarUnitDistances/HyperbolaPrivate.lean, lines 112–123
/-- The nonunit hyperbola case needs only b different from zero and one.
The private roots are chosen over the original algebraically closed field. -/
theorem hyperbola_private_orders [IsAlgClosed k] (u b : k) (hb : b≠0) (hb1 : b≠1)
    (a : Fin 4 → K) (ind : AlgebraicIndependent k a) :
    ∃ D : Fin 4 → (RatFunc K)ˣ, FourRowObstruction.PrivateOrders D ∧ ∀ i,
      let l := algebraMap K[X] (RatFunc K) (hyperbolaNum (algebraMap k K b) (a i)) /
        algebraMap K[X] (RatFunc K) (hyperbolaDen (algebraMap k K u) (a i))
      (D i:RatFunc K)=l*(l-4) := by
  obtain ⟨w,hw⟩ := IsAlgClosed.exists_pow_nat_eq (1-b) (by decide : 0<2)
  apply hyperbola_private_orders_at_root u b ((b-2+2*w)/b) hb hb1 _ a ind
  field_simp [hb]
  linear_combination 4*hw

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.RationalPrivateZeros.hyperbola_chord

∀ {K : Type u_2} [inst : Field K] (b u v z a : K),
  z ≠ u → a ≠ u → (z - a) * (v + b / (z - u) - (v + b / (a - u))) = -b * (z - a) ^ 2 / ((z - u) * (a - u))
Lean source · PlanarUnitDistances/HyperbolaPrivate.lean, lines 46–51
/-- For the shifted hyperbola (z-u)(w-v)=b, the squared distance to the
anchor with abscissa a is -b*(z-a)^2/((z-u)*(a-u)). -/
theorem hyperbola_chord (b u v z a : K) (hz : z≠u) (ha : a≠u) :
    (z-a)*((v+b/(z-u))-(v+b/(a-u)))= -b*(z-a)^2/((z-u)*(a-u)) := by
  field_simp [sub_ne_zero.mpr hz, sub_ne_zero.mpr ha]
  ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.RationalPrivateZeros.hyperbola_private_orders_at_root

∀ {k : Type u_1} {K : Type u_2} [inst : Field k] [CharZero k] [inst_2 : Field K] [CharZero K]
  [inst_4 : Algebra k K] (u b t : k),
  b ≠ 0 →
    b ≠ 1 →
      b * t ^ 2 + (4 - 2 * b) * t + b = 0 →
        ∀ (a : Fin 4 → K),
          AlgebraicIndependent k a →
            ∃ D,
              PlanarUnitDistances.FourRowObstruction.PrivateOrders D ∧
                ∀ (i : Fin 4),
                  have l :=
                    (algebraMap (Polynomial K) (RatFunc K))
                        (PlanarUnitDistances.RationalPrivateZeros.hyperbolaNum ((algebraMap k K) b) (a i)) /
                      (algebraMap (Polynomial K) (RatFunc K))
                        (PlanarUnitDistances.RationalPrivateZeros.hyperbolaDen ((algebraMap k K) u) (a i));
                  ↑(D i) = l * (l - 4)
Lean source · PlanarUnitDistances/HyperbolaPrivate.lean, lines 53–110
/-- Private orders for the four actual rational radicands, on the same
nonunit hyperbola. The simple root t must be chosen over the original
coefficient field; extending that field afterwards does not alter the
computed orders. -/
theorem hyperbola_private_orders_at_root (u b t : k) (hb : b≠0) (hb1 : b≠1)
    (root : b*t^2+(4-2*b)*t+b=0) (a : Fin 4 → K) (ind : AlgebraicIndependent k a) :
    ∃ D : Fin 4 → (RatFunc K)ˣ, FourRowObstruction.PrivateOrders D ∧ ∀ i,
      let l := algebraMap K[X] (RatFunc K) (hyperbolaNum (algebraMap k K b) (a i)) /
        algebraMap K[X] (RatFunc K) (hyperbolaDen (algebraMap k K u) (a i))
      (D i:RatFunc K)=l*(l-4) := by
  let U := algebraMap k K u
  let B := algebraMap k K b
  let T := algebraMap k K t
  have b0 : B≠0 := by simpa only [B,map_zero] using (algebraMap k K).injective.ne hb
  have b1 : B≠1 := by simpa only [B,map_one] using (algebraMap k K).injective.ne hb1
  have rt : B*T^2+(4-2*B)*T+B=0 := by
    simpa only [B,T,map_add,map_sub,map_ofNat,map_pow,map_zero,map_mul]
      using congrArg (algebraMap k K) root
  have t0 : T≠0 := by intro h; simp [h,b0] at rt
  have sep : -2*B*(T-1)-4≠0 := by
    intro h
    apply b1
    apply eq_of_sub_eq_zero
    linear_combination (B/4)*rt + ((2*B*T-2*B+4)/16)*h
  let N i := hyperbolaNum B (a i)
  let Q i := hyperbolaDen U (a i)
  let P i := N i*(N i-4*Q i)
  let s i := U+T*(a i-U)
  have a0 i : a i-U≠0 := sub_ne_zero.mpr (generic_ne_const u a ind i)
  have nzs i : s i-U≠0 := by simpa [s] using mul_ne_zero t0 (a0 i)
  have qval i j : (Q j).eval (s i)=(s i-U)*(a j-U) := by simp [Q,hyperbolaDen,den]
  have qne i j : (Q j).eval (s i)≠0 := qval i j ▸ mul_ne_zero (nzs i) (a0 j)
  have nval i j : (N j).eval (s i)= -B*(s i-a j)^2 := by simp [N,hyperbolaNum,num]
  have rn i : (N i).eval (s i)=4*(Q i).eval (s i) := by
    rw [nval,qval]
    dsimp [s]
    linear_combination -(a i-U)^2*rt
  have rootP i : (P i).eval (s i)=0 := by simp [P,rn]
  have der i : ((N i).derivative.eval (s i)-4*(Q i).derivative.eval (s i))=
        (-2*B*(T-1)-4)*(a i-U) := by
    simp [N,Q,hyperbolaDen,hyperbolaNum,den,num,derivative_mul,derivative_pow,s]; ring
  have simpleP i : (P i).derivative.eval (s i)≠0 := by
    have h := mul_ne_zero (show 4*(Q i).eval (s i)≠0 from mul_ne_zero (by norm_num) (qne i i))
      (mul_ne_zero sep (a0 i))
    simpa [P,derivative_mul,rn,der] using h
  have other i j (ne : j≠i) : (P j).eval (s i)≠0 := by
    simpa only [P,eval_mul,eval_sub,eval_ofNat,nval,qval,num,den,s,B,U,T] using off_diag u b t hb a ind ne
  have pne i : P i≠0 := by intro h; have := simpleP i; simp [h] at this
  have q0 i : Q i≠0 := by intro h; have := qne i i; simp [h] at this
  let F := algebraMap K[X] (RatFunc K)
  have fp i : F (P i)≠0 := by simpa only [F,map_zero] using (RatFunc.algebraMap_injective K).ne (pne i)
  have fq i : F (Q i)≠0 := by simpa only [F,map_zero] using (RatFunc.algebraMap_injective K).ne (q0 i)
  let D i := Units.mk0 (F (P i) / F (Q i^2)) (div_ne_zero (fp i) (by simp [fq]))
  refine ⟨D,private_orders_of_simple_zeros P (fun i => Q i^2) D (by intro i; rfl)
    s rootP simpleP other (fun i j => by simp [qne]),fun i => ?_⟩
  change F (N i*(N i-4*Q i))/F (Q i^2)=F (N i)/F (Q i)*(F (N i)/F (Q i)-4)
  rw [map_mul,map_sub,map_mul,map_ofNat,map_pow]
  field_simp [fq]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.30 A generic solution from concrete solutions

Lean verified

Suppose a collection of polynomial equations over k has the following property. For every nonzero polynomial p in a chosen list of coordinates, some solution over k has p ≠ 0 . Then all the equations have a simultaneous solution in a field extension of k in which the chosen coordinates are algebraically independent. On an admissible complex curve product, the twelve abscissas by themselves pass the nonvanishing test before the grid equations are imposed.

Proof

In the polynomial ring of the full system, let J be the ideal of its equations. The multiplicative set obtained by substituting the chosen coordinates into all nonzero polynomials is disjoint from J , by evaluation at the given solutions. Choose a prime containing J disjoint from that set. Taking the fraction field of the quotient gives one solution on which every nonzero polynomial in the chosen coordinates survives.

For a complex irreducible curve with two distinct abscissas, a finite set of abscissas would make the product of their linear factors vanish on the curve. By the Nullstellensatz this product belongs to the principal prime ideal of the curve. One factor must then vanish on the whole curve, a contradiction. A polynomial vanishing on the Cartesian product of twelve infinite sets is zero. Each choice of abscissas lifts independently to a point of the product.

Inspect the Lean declarations

PlanarUnitDistances.Competition.GenericCurvePoint.product_abscissas

∀ {f g : PlanarUnitDistances.Competition.Poly₂},
  PlanarUnitDistances.Competition.CurvePair f g →
    ∀ (p : MvPolynomial PlanarUnitDistances.Competition.Slot ℂ),
      p ≠ 0 →
        ∃ x ∈ PlanarUnitDistances.Competition.curveProduct f g, (MvPolynomial.eval fun s => x (s, 0)) p ≠ 0
Lean source · PlanarUnitDistances/InfiniteAbscissas.lean, lines 45–64
/-- No nonzero polynomial in the twelve abscissas vanishes on the whole
product. The finite-dimensional product only needs infinite coordinate
images. -/
theorem product_abscissas {f g : Poly₂} (pair : CurvePair f g)
    (p : MvPolynomial Slot ℂ) (hne : p≠0) :
    ∃ x ∈ curveProduct f g, eval (fun s => x (s,0)) p≠0 := by
  classical
  let h (s : Slot) := s.elim (fun _ => f) (fun _ => g)
  have inf (s : Slot) : (abscissas (h s)).Infinite := by
    have H := pair.1 (h s) (by cases s <;> simp [h])
    exact infinite_abscissas H.1 (H.2.2 0)
  have exists_z : ∃ z ∈ Set.pi Set.univ (fun s => abscissas (h s)), eval z p≠0 := by
    by_contra! fail
    apply hne
    exact MvPolynomial.funext_set (fun s => abscissas (h s)) inf
      (fun z hz => (fail z hz).trans (map_zero _).symm)
  obtain ⟨z,hz,hval⟩ := exists_z
  choose row on ab using fun s => hz s (Set.mem_univ s)
  refine ⟨fun (i : Coord) => row i.1 i.2,⟨fun i => on (.inl i),fun j => on (.inr j)⟩,?_⟩
  simpa only [ab] using hval

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.GenericSolution.over_independent_coordinates

∀ {k I V : Type} [inst : Field k] (coord : I → V) (eqs : Set (MvPolynomial V k)),
  (∀ (p : MvPolynomial I k),
      p ≠ 0 → ∃ y, (∀ f ∈ eqs, (MvPolynomial.eval y) f = 0) ∧ (MvPolynomial.eval (y ∘ coord)) p ≠ 0) →
    ∃ E x x_1 y, (∀ f ∈ eqs, (MvPolynomial.aeval y) f = 0) ∧ AlgebraicIndependent k (y ∘ coord)
Lean source · PlanarUnitDistances/GenericSolution.lean, lines 12–50
/-- If no nonzero polynomial in the indicated coordinates vanishes on every
concrete solution, then the same equations have an extension-field solution
with those coordinates jointly algebraically independent. -/
theorem over_independent_coordinates {k I V : Type} [Field k]
    (coord : I → V) (eqs : Set (MvPolynomial V k))
    (dense : ∀ p : MvPolynomial I k,p≠0 → ∃ y : V → k,
      (∀ f∈eqs,eval y f=0) ∧ eval (y ∘ coord) p≠0) :
    ∃ (E : Type) (_ : Field E) (_ : Algebra k E) (y : V → E),
      (∀ f∈eqs,aeval y f=0) ∧ AlgebraicIndependent k (y ∘ coord) := by
  classical
  let P := MvPolynomial V k
  let v := rename (R := k) coord
  let S : Submonoid P := (nonZeroDivisors (MvPolynomial I k)).map v.toRingHom.toMonoidHom
  let J := Ideal.span eqs
  have disj : Disjoint (J:Set P) S := by
    apply Set.disjoint_left.mpr
    rintro _ h ⟨p,hp,rfl⟩
    obtain ⟨y,hy,ne⟩ := dense p (nonZeroDivisors.ne_zero hp)
    have ker : J≤RingHom.ker (eval y) := Ideal.span_le.mpr hy
    exact ne (by simpa [v,eval_rename] using (show eval y (v p)=0 from ker h))
  obtain ⟨q,hq,hJ,away⟩ := J.exists_le_prime_disjoint S disj
  let _ : q.IsPrime := hq
  let R := P ⧸ q
  let E := FractionRing R
  let φ : P →ₐ[k] E := (IsScalarTower.toAlgHom k R E).comp (Ideal.Quotient.mkₐ k q)
  let y (i : V) := φ (X i)
  have hom : aeval y=φ := by ext i; simp [y]
  have ker (f : P) : φ f=0 ↔ f∈q := by
    change algebraMap R E (Ideal.Quotient.mk q f)=0 ↔ _
    rw [←map_zero (algebraMap R E),(IsFractionRing.injective R E).eq_iff,Ideal.Quotient.eq_zero_iff_mem]
  refine ⟨E,inferInstance,inferInstance,y,fun f hf => ?_,algebraicIndependent_iff.mpr ?_⟩
  · rw [hom]
    exact (ker _).mpr (hJ (Ideal.subset_span hf))
  · intro p hp
    by_contra ne
    apply Set.disjoint_left.mp away _ (show v p∈S from ⟨p,mem_nonZeroDivisors_of_ne_zero ne,rfl⟩)
    apply (ker _).mp
    rw [←hom]
    exact (aeval_rename coord y p).trans hp

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.GenericCurvePoint.infinite_abscissas

∀ {f : PlanarUnitDistances.Competition.Poly₂},
  Irreducible f →
    (∃ p r, (MvPolynomial.eval p) f = 0 ∧ (MvPolynomial.eval r) f = 0 ∧ p 0 ≠ r 0) →
      (PlanarUnitDistances.Competition.GenericCurvePoint.abscissas f).Infinite
Lean source · PlanarUnitDistances/InfiniteAbscissas.lean, lines 14–43
/-- An irreducible plane curve with two distinct abscissas has infinitely
many. This uses Mathlib's Nullstellensatz for the principal prime ideal. -/
theorem infinite_abscissas {f : Poly₂} (irr : Irreducible f)
    (nonconstant : ∃ p r : Fin 2 → ℂ,eval p f=0 ∧ eval r f=0 ∧ p 0≠r 0) :
    (abscissas f).Infinite := by
  classical
  intro finite
  let T := finite.toFinset
  let J := Ideal.span ({f}:Set Poly₂)
  let _ : J.IsPrime := (Ideal.span_singleton_prime irr.ne_zero).mpr irr.prime
  let P : Poly₂ := ∏ a∈T,(X 0-C a)
  have vanish : P∈vanishingIdeal ℂ (zeroLocus ℂ J) := by
    intro x hx
    have hf := hx f (Ideal.subset_span (Set.mem_singleton _))
    have ha : x 0∈T := finite.mem_toFinset.mpr ⟨x,hf,rfl⟩
    change eval x P=0
    simp only [P,map_prod,map_sub,eval_X,eval_C]
    exact Finset.prod_eq_zero ha (sub_self _)
  have div : f∣P := by
    apply Ideal.mem_span_singleton.mp
    change P∈J
    rw [MvPolynomial.IsPrime.vanishingIdeal_zeroLocus (K := ℂ) J] at vanish
    exact vanish
  obtain ⟨a,_,q,hq⟩ := (irr.prime.dvd_finsetProd_iff (fun a : ℂ => X 0-C a)).mp div
  have c (x : Fin 2 → ℂ) (h : eval x f=0) : x 0=a := by
    have z := congrArg (eval x) hq
    have v : x 0-a=0 := by simpa [h] using z
    exact sub_eq_zero.mp v
  obtain ⟨p,r,hp,hr,ne⟩ := nonconstant
  exact ne ((c p hp).trans (c r hr).symm)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.31 The field containing all four anchors

Lean verified

Suppose the eight point abscissas and four anchor abscissas are jointly algebraically independent over k . Let F be the relative algebraic closure of the field generated by the four anchor abscissas inside the ambient solution field. If the four anchors lie on one nonzero plane equation over k , then F contains all four anchor ordinates, and the eight point abscissas are jointly independent over F .

Proof

Separate the two families in the definition of algebraic independence. Passing from the ring generated by the anchor abscissas to its fraction field, and then to its relative algebraic closure, preserves the independence of the eight remaining coordinates. If an anchor ordinate were transcendental over the field of the four anchor abscissas, that ordinate and its own abscissa would be an independent pair over k . Evaluating the nonzero anchor equation on them contradicts independence. This supplies the base field required by the seven-parameter normalization, including each entire anchor point.

Inspect the Lean declarations

PlanarUnitDistances.GenericAnchorField.anchor_coordinates

∀ {k : Type u_1} {E : Type u_2} [inst : Field k] [inst_1 : Field E] [inst_2 : Algebra k E]
  (z : Fin 8 ⊕ Fin 4 → E) (w : Fin 4 → E),
  AlgebraicIndependent k z →
    ∀ (g : MvPolynomial (Fin 2) k),
      g ≠ 0 →
        (∀ (j : Fin 4), (MvPolynomial.aeval ![z (Sum.inr j), w j]) g = 0) →
          have a := fun j => z (Sum.inr j);
          let F := IntermediateField.adjoin k (Set.range a);
          (AlgebraicIndependent ↥(algebraicClosure (↥F) E) fun i => z (Sum.inl i)) ∧
            ∀ (j : Fin 4), w j ∈ algebraicClosure (↥F) E
Lean source · PlanarUnitDistances/GenericAnchorField.lean, lines 10–35
/-- Over the relative algebraic closure of the field of the four anchor
abscissas, all four anchor ordinates are already present and the eight
generic point abscissas remain jointly independent. -/
theorem anchor_coordinates (z : Fin 8 ⊕ Fin 4 → E) (w : Fin 4 → E)
    (ind : AlgebraicIndependent k z) (g : MvPolynomial (Fin 2) k) (ng : g≠0)
    (curve : ∀ j,aeval ![z (.inr j),w j] g=0) :
    let a := fun j => z (.inr j)
    let F := IntermediateField.adjoin k (range a)
    AlgebraicIndependent (_root_.algebraicClosure F E) (fun i => z (.inl i)) ∧
      ∀ j, w j ∈ _root_.algebraicClosure F E := by
  let a (j : Fin 4) := z (.inr j)
  let x (i : Fin 8) := z (.inl i)
  let F := IntermediateField.adjoin k (range a)
  have same : Sum.elim x a=z := by funext i; cases i <;> rfl
  have parts := AlgebraicIndependent.sumElim_iff.mp (same.symm ▸ ind)
  have left : AlgebraicIndependent F x := IntermediateField.algebraicIndependent_adjoin_iff.mpr parts.2
  refine ⟨left.algebraicClosure,fun j => mem_algebraicClosure_iff.mpr ?_⟩
  by_contra h
  have one : AlgebraicIndependent F (fun _ : Unit => w j) :=
    algebraicIndependent_unique_type_iff.mpr h
  have both := parts.1.sumElim (IntermediateField.algebraicIndependent_adjoin_iff.mp one)
  let e : Fin 2 → Unit ⊕ Fin 4 := ![.inr j,.inl ()]
  have inj : Function.Injective e := by intro i l; fin_cases i <;> fin_cases l <;> simp [e]
  have val : (Sum.elim (fun _ : Unit => w j) a) ∘ e = ![z (.inr j),w j] := by
    funext i; fin_cases i <;> rfl
  exact ng ((val ▸ both.comp e inj).eq_zero_of_aeval_eq_zero g (curve j))

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.32 A generic point on the full lifted grid

Lean verified

If the compatible complex positions are dense in the product C 1 8 × C 2 4 , there is an algebraically closed extension of C containing one common solution of all 128 edge equations and all twelve curve equations, with the twelve abscissas jointly algebraically independent. The solution includes the original inverse witnesses for the inequalities A i ≠ a j .

Proof

Take a nonzero polynomial p in the twelve abscissas. It is nonzero at some point of the curve product. If it vanished at the positions of every compatible lift, then the renamed polynomial in the position variables would vanish on the closure, a contradiction. Lemma 5.30 now applies to the full system in 156 coordinates. Embed its solution field in an algebraic closure. All equations remain true, and injectivity of the embedding preserves algebraic independence. This constructs the common solution directly without selecting an irreducible component that dominates the product.

Inspect the Lean declarations

PlanarUnitDistances.GridLocus.generic_of_no_separator

∀ (f g : PlanarUnitDistances.GridLocus.PlanePoly),
  PlanarUnitDistances.GridLocus.curvePair f g →
    (¬∃ Q, PlanarUnitDistances.GridLocus.separates f g Q) →
      ∃ E x x_1,
        ∃ (_ : IsAlgClosed E),
          ∃ y,
            (∀ (i : Fin 128),
                (MvPolynomial.aeval y) (PlanarUnitDistances.Competition.GridElimination.edgeList i) = 0) ∧
              (∀ (j : Fin 12),
                  (MvPolynomial.aeval y) (PlanarUnitDistances.Competition.GridElimination.curveList f g j) =
                    0) ∧
                AlgebraicIndependent ℂ fun s => y (Sum.inl (s, 0))
Lean source · PlanarUnitDistances/ResearchGenericGrid.lean, lines 7–19
/-- Failure of the exact manuscript separator gives an extension-field
solution of the concrete lifted equations with twelve independent
abscissas. The separator and the density use the same curve product. -/
theorem generic_of_no_separator (f g : PlanePoly) (pair : curvePair f g)
    (none : ¬∃ Q, separates f g Q) :
    ∃ (E : Type) (_ : Field E) (_ : Algebra ℂ E) (_ : IsAlgClosed E) (y : LiftCoord → E),
      (∀ i, aeval y (edgeList i)=0) ∧ (∀ j, aeval y (curveList f g j)=0) ∧
      AlgebraicIndependent ℂ (fun s : Competition.Slot => y (.inl (s,0))) := by
  apply Competition.GenericCurvePoint.closed_generic_grid_of_dense f g ((pair_equiv _ _).mp pair)
  intro p hp Q hQ
  by_contra bad
  exact none ⟨Q,(fun u hu h => hQ _ ⟨hu,(position_equiv u).mp h⟩),
    (fun s j => p (s,j)),hp,bad⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.GenericCurvePoint.generic_grid_of_dense

∀ (f g : PlanarUnitDistances.Competition.Poly₂),
  PlanarUnitDistances.Competition.CurvePair f g →
    PlanarUnitDistances.Competition.curveProduct f g ⊆
        PlanarUnitDistances.Competition.algebraicClosure
          {y |
            y ∈ PlanarUnitDistances.Competition.curveProduct f g ∧
              PlanarUnitDistances.Competition.PositionSystem y} →
      ∃ E x x_1 y,
        (∀ (i : Fin 128),
            (MvPolynomial.aeval y) (PlanarUnitDistances.Competition.GridElimination.edgeList i) = 0) ∧
          (∀ (j : Fin 12),
              (MvPolynomial.aeval y) (PlanarUnitDistances.Competition.GridElimination.curveList f g j) = 0) ∧
            AlgebraicIndependent ℂ fun s => y (Sum.inl (s, 0))
Lean source · PlanarUnitDistances/GenericGridPoint.lean, lines 10–41
/-- Density of concrete compatible positions on the given curve product
would supply a solution of all 140 lifted equations with twelve independent
abscissas. The inverse variables in the same system retain every required
inequality between tangent scalars. -/
theorem generic_grid_of_dense (f g : Poly₂) (pair : CurvePair f g)
    (dense : curveProduct f g ⊆ algebraicClosure {y | y∈curveProduct f g ∧ PositionSystem y}) :
    ∃ (E : Type) (_ : Field E) (_ : Algebra ℂ E) (y : LiftCoord → E),
      (∀ i, aeval y (edgeList i)=0) ∧ (∀ j, aeval y (curveList f g j)=0) ∧
      AlgebraicIndependent ℂ (fun s : Slot => y (.inl (s,0))) := by
  let W := List.ofFn edgeList ++ List.ofFn (curveList f g)
  let S : Set P := {F | F∈W}
  let coords (s : Slot) : LiftCoord := .inl (s,0)
  have witness (p : MvPolynomial Slot ℂ) (hne : p≠0) :
      ∃ y : LiftCoord → ℂ, (∀ F∈S,eval y F=0) ∧ eval (y ∘ coords) p≠0 := by
    obtain ⟨x,hx,hp⟩ := product_abscissas pair p hne
    by_contra! no
    let F : MvPolynomial Coord ℂ := rename (fun s : Slot => (s,0)) p
    have vanish (q : GridTuple) (hq : q∈curveProduct f g ∧ PositionSystem q) : eval q F=0 := by
      have h : q ∈ (fun (y : LiftCoord → ℂ) i => y (.inl i)) '' equations W := by
        rw [show W=List.ofFn edgeList ++ List.ofFn (curveList f g) from rfl,projected_grid_locus]
        exact hq
      obtain ⟨y,hy,rfl⟩ := h
      simpa only [F,eval_rename,Function.comp_def,coords] using no y hy
    have h := dense hx F vanish
    exact hp (by simpa only [F,eval_rename,Function.comp_def] using h)
  obtain ⟨E,field,alg,y,sol,ind⟩ := GenericSolution.over_independent_coordinates coords S witness
  let _ : Field E := field
  let _ : Algebra ℂ E := alg
  refine ⟨E,field,alg,y,fun i => sol _ ((List.mem_append).mpr (Or.inl ?_)),
    fun j => sol _ ((List.mem_append).mpr (Or.inr ?_)),ind⟩
  · exact List.mem_ofFn.mpr ⟨i,rfl⟩
  · exact List.mem_ofFn.mpr ⟨j,rfl⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.GenericCurvePoint.closed_generic_grid_of_dense

∀ (f g : PlanarUnitDistances.Competition.Poly₂),
  PlanarUnitDistances.Competition.CurvePair f g →
    PlanarUnitDistances.Competition.curveProduct f g ⊆
        PlanarUnitDistances.Competition.algebraicClosure
          {y |
            y ∈ PlanarUnitDistances.Competition.curveProduct f g ∧
              PlanarUnitDistances.Competition.PositionSystem y} →
      ∃ E x x_1,
        ∃ (_ : IsAlgClosed E),
          ∃ y,
            (∀ (i : Fin 128),
                (MvPolynomial.aeval y) (PlanarUnitDistances.Competition.GridElimination.edgeList i) = 0) ∧
              (∀ (j : Fin 12),
                  (MvPolynomial.aeval y) (PlanarUnitDistances.Competition.GridElimination.curveList f g j) =
                    0) ∧
                AlgebraicIndependent ℂ fun s => y (Sum.inl (s, 0))
Lean source · PlanarUnitDistances/GenericGridPoint.lean, lines 43–59
/-- The ambient solution may be chosen algebraically closed. This allows
later relative algebraic closures to contain all roots of the curve fibers. -/
theorem closed_generic_grid_of_dense (f g : Poly₂) (pair : CurvePair f g)
    (dense : curveProduct f g ⊆ algebraicClosure {y | y∈curveProduct f g ∧ PositionSystem y}) :
    ∃ (E : Type) (_ : Field E) (_ : Algebra ℂ E) (_ : IsAlgClosed E) (y : LiftCoord → E),
      (∀ i, aeval y (edgeList i)=0) ∧ (∀ j, aeval y (curveList f g j)=0) ∧
      AlgebraicIndependent ℂ (fun s : Slot => y (.inl (s,0))) := by
  obtain ⟨M,field,alg,v,edges,curves,ind⟩ := generic_grid_of_dense f g pair dense
  let _ : Field M := field
  let _ : Algebra ℂ M := alg
  let E := AlgebraicClosure M
  let φ := IsScalarTower.toAlgHom ℂ M E
  refine ⟨E,inferInstance,inferInstance,inferInstance,φ ∘ v,?_,?_,ind.map' φ.injective⟩
  · intro i
    exact (comp_aeval_apply v φ _).symm.trans (by rw [edges,map_zero])
  · intro j
    exact (comp_aeval_apply v φ _).symm.trans (by rw [curves,map_zero])

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.33 Recovering the tangent from the lifted equations

Lean verified

Over the solution field, each null position ( z , w ) gives Cartesian coordinates x = ( z + w ) / 2 ,   y = ( z − w ) / ( 2 i ) . The lifted equations give the tangent equations on those very positions with the signed roots μ i j − u i j , where u i j μ i j = 1 . Each row and anchor lies on its prescribed curve. Both z = x + i y and w = x − i y are recovered in that same field.

Proof

Read the four equations for each indexed edge and the single equation for each position. The first two edge equations give the inverse relation and the squared chord length. The third gives the dot product with the Cartesian velocities. The fourth supplies an inverse to the scalar difference, hence its nonvanishing. The calculation holds after extension from complex scalars.

Inspect the Lean declarations

PlanarUnitDistances.Competition.LiftedTangent.data_of_lift

∀ {E : Type u_1} [inst : Field E] [inst_1 : Algebra ℂ E] (f g : PlanarUnitDistances.Competition.Poly₂)
  (y : PlanarUnitDistances.Competition.GridElimination.LiftCoord → E),
  (∀ (k : Fin 128), (MvPolynomial.aeval y) (PlanarUnitDistances.Competition.GridElimination.edgeList k) = 0) →
    (∀ (k : Fin 12),
        (MvPolynomial.aeval y) (PlanarUnitDistances.Competition.GridElimination.curveList f g k) = 0) →
      PlanarUnitDistances.Competition.LiftedTangent.Data f g y
Lean source · PlanarUnitDistances/LiftedTangentData.lean, lines 81–101
theorem data_of_lift (f g : Poly₂) (y : LiftCoord → E)
    (hedge : ∀ k, aeval y (edgeList k)=0) (hcurve : ∀ k, aeval y (curveList f g k)=0) :
    Data f g y := by
  have two : algebraMap ℂ E 2 = 2 := map_ofNat _ _
  have iv (i : Fin 8) (j : Fin 4) : u y i j * μ y i j = 1 := by
    simpa [u,μ,edgeEquation,edgeVar,sub_eq_zero] using indexed_edges y hedge i j 0
  have chord (i : Fin 8) (j : Fin 4) : chordSq y i j = 2-u y i j-μ y i j := by
    rw [chordSq_eq_null]
    simpa [edgeEquation,dw,point,edgeVar,nullPos,u,μ,sub_eq_zero,two] using indexed_edges y hedge i j 1
  refine ⟨?_,iv,chord,?_,fun i ↦ indexed_curves f g y hcurve (.inl i),
    fun j ↦ indexed_curves f g y hcurve (.inr j)⟩
  · intro i j
    have deriv := indexed_edges y hedge i j 2
    have distinct := indexed_edges y hedge i j 3
    simp [edgeEquation,edgeVar,dw,dv,point,velocity,sub_eq_zero,two] at deriv distinct
    refine ⟨?_,sub_ne_zero.mp (right_ne_zero_of_mul_eq_one distinct)⟩
    simp [cart,nullPos,u,μ,U,H,A,a,two] 
    linear_combination deriv
  · intro i j
    rw [chord]
    linear_combination -4 * iv i j

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.LiftedTangent.recover

∀ {E : Type u_1} [inst : Field E] [inst_1 : Algebra ℂ E]
  (y : PlanarUnitDistances.Competition.GridElimination.LiftCoord → E)
  (s : PlanarUnitDistances.Competition.Slot),
  PlanarUnitDistances.Competition.LiftedTangent.cart y s 0 +
        (algebraMap ℂ E) Complex.I * PlanarUnitDistances.Competition.LiftedTangent.cart y s 1 =
      PlanarUnitDistances.Competition.LiftedTangent.nullPos y s 0 ∧
    PlanarUnitDistances.Competition.LiftedTangent.cart y s 0 -
        (algebraMap ℂ E) Complex.I * PlanarUnitDistances.Competition.LiftedTangent.cart y s 1 =
      PlanarUnitDistances.Competition.LiftedTangent.nullPos y s 1
Lean source · PlanarUnitDistances/LiftedTangentData.lean, lines 22–32
/-- Recover both original null coordinates from the Cartesian entries, with
the sign convention used by the defining equations. -/
theorem recover (y : LiftCoord → E) (s : Slot) :
    cart y s 0 + algebraMap ℂ E Complex.I * cart y s 1 = nullPos y s 0 ∧
    cart y s 0 - algebraMap ℂ E Complex.I * cart y s 1 = nullPos y s 1 := by
  have hi := (algebraMap ℂ E).injective.ne Complex.I_ne_zero
  simp only [map_zero] at hi
  have : CharZero E := charZero_of_injective_algebraMap (algebraMap ℂ E).injective
  simp only [cart,Matrix.cons_val_zero,Matrix.cons_val_one,Matrix.cons_val_fin_one,
    map_div₀,map_mul,map_one,map_ofNat]
  constructor <;> field_simp [hi] <;> ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.LiftedTangent.chordSq_eq_null

∀ {E : Type u_1} [inst : Field E] [inst_1 : Algebra ℂ E]
  (y : PlanarUnitDistances.Competition.GridElimination.LiftCoord → E) (i : Fin 8) (j : Fin 4),
  PlanarUnitDistances.Competition.LiftedTangent.chordSq y i j =
    (PlanarUnitDistances.Competition.LiftedTangent.nullPos y (Sum.inl i) 0 -
        PlanarUnitDistances.Competition.LiftedTangent.nullPos y (Sum.inr j) 0) *
      (PlanarUnitDistances.Competition.LiftedTangent.nullPos y (Sum.inl i) 1 -
        PlanarUnitDistances.Competition.LiftedTangent.nullPos y (Sum.inr j) 1)
Lean source · PlanarUnitDistances/LiftedTangentData.lean, lines 59–68
theorem chordSq_eq_null (y : LiftCoord → E) (i : Fin 8) (j : Fin 4) :
    chordSq y i j = (nullPos y (.inl i) 0-nullPos y (.inr j) 0) *
      (nullPos y (.inl i) 1-nullPos y (.inr j) 1) := by
  obtain ⟨p0,p1⟩ := recover y (.inl i)
  obtain ⟨r0,r1⟩ := recover y (.inr j)
  have hI : (algebraMap ℂ E Complex.I)^2 = -1 := by
    rw [← map_pow, Complex.I_sq, map_neg, map_one]
  rw [←p0,←p1,←r0,←r1]
  unfold chordSq
  linear_combination (cart y (.inl i) 1-cart y (.inr j) 1)^2*hI

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.34 The coefficient field for one normalized row

Lean verified

Suppose a compatible grid is defined in an algebraically closed field E . A subfield F contains the Cartesian coordinates of all four anchors, two specified anchors are distinct, and the eight row abscissas are independent over F . Then there is one algebraically closed intermediate field K , a normalized tangent with all anchor velocities and scalars in K , and an index i whose row abscissa is transcendental over K . The normalized tangent still satisfies every edge equation and every scalar inequality.

Proof

Adjoin the seven normalized parameters to F inside E and take the relative algebraic closure of this field in E . This supplies an algebraically closed field containing the required data. The eight-against-seven inequality gives the stated transcendence over that same field. Applied to Lemma 5.32, this produces a normalized row on its very solution. The Lean conclusion retains the original labels, both anchor coordinates, the normalized tangent equations, and the transcendence of its selected abscissa over K .

Inspect the Lean declarations

PlanarUnitDistances.Competition.GenericCurvePoint.normalized_of_lift

∀ {E : Type} [inst : Field E] [inst_1 : Algebra ℂ E] [IsAlgClosed E]
  {f g : PlanarUnitDistances.Competition.Poly₂},
  g ≠ 0 →
    ∀ {y : PlanarUnitDistances.Competition.GridElimination.LiftCoord → E},
      PlanarUnitDistances.Competition.LiftedTangent.Data f g y →
        (AlgebraicIndependent ℂ fun s => PlanarUnitDistances.Competition.LiftedTangent.nullPos y s 0) →
          Nonempty (PlanarUnitDistances.Competition.GenericCurvePoint.NormalizedRow y)
Lean source · PlanarUnitDistances/GenericNormalizedGrid.lean, lines 29–58
theorem normalized_of_lift {f g : Poly₂} (ng : g≠0) {y : LiftCoord → E}
    (data : Data f g y) (ind : AlgebraicIndependent ℂ (fun s : Slot => nullPos y s 0)) :
    Nonempty (NormalizedRow y) := by
  let z (s : Slot) := nullPos y s 0
  let B := IntermediateField.adjoin ℂ (range (fun j : Fin 4 => z (.inr j)))
  let C := _root_.algebraicClosure B E
  let F := C.restrictScalars ℂ
  have curve (j : Fin 4) : aeval ![z (.inr j),nullPos y (.inr j) 1] g=0 := by
    have e : ![z (.inr j),nullPos y (.inr j) 1]=nullPos y (.inr j) := by
      funext d; fin_cases d <;> rfl
    rw [e]; exact data.anchor_curve j
  obtain ⟨left,right⟩ := GenericAnchorField.anchor_coordinates z _ ind g ng curve
  have mem (j : Fin 4) (d : Fin 2) : nullPos y (.inr j) d∈F := by
    fin_cases d
    · exact C.algebraMap_mem (⟨_,IntermediateField.subset_adjoin _ _ ⟨j,rfl⟩⟩ : B)
    · exact right j
  have cp (j : Fin 4) (d : Fin 2) : cart y (.inr j) d∈F := by
    fin_cases d
    · exact F.mul_mem (F.algebraMap_mem _) (F.add_mem (mem j 0) (mem j 1))
    · exact F.mul_mem (F.algebraMap_mem _) (F.sub_mem (mem j 0) (mem j 1))
  have diff : cart y (.inr 1) ≠ cart y (.inr 0) := by
    intro eq
    have same : nullPos y (.inr 1) 0 = nullPos y (.inr 0) 0 := by
      rw [← (recover y (.inr 1)).1,← (recover y (.inr 0)).1,eq]
    exact (by decide : (Sum.inr 1 : Slot) ≠ .inr 0) (ind.injective same)
  have positions j d : cart y (.inr j) d∈range (algebraMap F E) := ⟨⟨_,cp j d⟩,rfl⟩
  obtain ⟨L,closed,i,h,v,t,b,he,hc,hv,hs,tr⟩ := GenericParameters.normalized_row_field
    positions data.compatible diff (show AlgebraicIndependent F (fun i => z (.inl i)) from left)
  have allanchors j d : nullPos y (.inr j) d∈L := L.algebraMap_mem (⟨_,mem j d⟩ : F)
  exact ⟨⟨L.restrictScalars ℂ,closed,i,tr,allanchors,hc,h,v,t,b,he,hv,hs⟩⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.GenericParameters.normalized_row_field

∀ {F : Type u_1} {E : Type u_2} [inst : Field F] [inst_1 : Field E] [inst_2 : Algebra F E] [IsAlgClosed E]
  {p : Fin 8 → Fin 2 → E} {r : Fin 4 → Fin 2 → E} {R : Fin 8 → Fin 4 → E} {H : Fin 8 → Fin 2 → E}
  {U : Fin 4 → Fin 2 → E} {A : Fin 8 → E} {a : Fin 4 → E},
  (∀ (j : Fin 4) (d : Fin 2), r j d ∈ Set.range ⇑(algebraMap F E)) →
    PlanarUnitDistances.GenericParameters.Compatible p r R H U A a →
      r 1 ≠ r 0 →
        ∀ {x : Fin 8 → E},
          AlgebraicIndependent F x →
            ∃ K,
              ∃ (_ : IsAlgClosed ↥K),
                ∃ i H' U' A' a',
                  PlanarUnitDistances.GenericParameters.Compatible p r R H' U' A' a' ∧
                    (∀ (j : Fin 4) (d : Fin 2), r j d ∈ K) ∧
                      (∀ (j : Fin 4) (d : Fin 2), U' j d ∈ K) ∧
                        (∀ (j : Fin 4), a' j ∈ K) ∧ Transcendental (↥K) (x i)
Lean source · PlanarUnitDistances/NormalizedRowField.lean, lines 7–29
/-- One normalized row over a single algebraically closed coefficient
field inside the actual solution. Every anchor position and every anchor
velocity and scalar belongs to it. The abscissa of the chosen point
remains transcendental over this very field. -/
theorem normalized_row_field {F E : Type*} [Field F] [Field E] [Algebra F E] [IsAlgClosed E]
    {p : Fin 8 → Fin 2 → E} {r : Fin 4 → Fin 2 → E} {R H U A a}
    (positions : ∀ j d,r j d ∈ range (algebraMap F E))
    (eqs : Compatible p r R H U A a) (distinct : r 1 ≠ r 0)
    {x : Fin 8 → E} (ind : AlgebraicIndependent F x) :
    ∃ (K : IntermediateField F E) (_ : IsAlgClosed K) (i : Fin 8)
        (H' : Fin 8 → Fin 2 → E) (U' : Fin 4 → Fin 2 → E) (A' : Fin 8 → E) (a' : Fin 4 → E),
      Compatible p r R H' U' A' a' ∧ (∀ j d,r j d ∈ K) ∧
        (∀ j d,U' j d∈K) ∧ (∀ j,a' j∈K) ∧ Transcendental K (x i) := by
  obtain ⟨t,H',U',A',a',he,hU,ha,i,hi⟩ := normalize_four_anchors eqs distinct ind
  let L := IntermediateField.adjoin F (range t)
  let C := _root_.algebraicClosure L E
  let K := C.restrictScalars F
  have incl {v : E} (h : v∈L) : v∈K := C.algebraMap_mem ⟨v,h⟩
  refine ⟨K,(IsAlgClosure.isAlgClosed L : IsAlgClosed C),i,H',U',A',a',he,?_,
    fun j d => incl (hU j d),fun j => incl (ha j),hi⟩
  intro j d
  obtain ⟨v,h⟩ := positions j d
  exact h ▸ K.algebraMap_mem v

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.GenericCurvePoint.NormalizedRow

{E : Type} →
  [inst : Field E] → [Algebra ℂ E] → (PlanarUnitDistances.Competition.GridElimination.LiftCoord → E) → Type
Lean source · PlanarUnitDistances/GenericNormalizedGrid.lean, lines 11–27
/-- The normalized coefficient field, row, and velocities on the same
generic point. The anchor positions are recorded in both coordinate systems. -/
structure NormalizedRow (y : LiftCoord → E) where
  K : IntermediateField ℂ E
  closed : IsAlgClosed K
  i : Fin 8
  transcendental : Transcendental K (nullPos y (.inl i) 0)
  anchor : ∀ j d,nullPos y (.inr j) d∈K
  cartesian : ∀ j d,cart y (.inr j) d∈K
  h : Fin 8 → Fin 2 → E
  v : Fin 4 → Fin 2 → E
  t : Fin 8 → E
  b : Fin 4 → E
  tangent : GenericParameters.Compatible (fun i => cart y (.inl i)) (fun j => cart y (.inr j))
    (fun i j => μ y i j-u y i j) h v t b
  velocity : ∀ j d,v j d ∈ K
  scalar : ∀ j,b j ∈ K

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.35 Private orders on the actual rational row field

Lean verified

For either rational parametrization above, if the surviving abscissa x is transcendental over the normalized coefficient field K , all four private orders exist on the actual intermediate field K ( x ) ⊂ E . Under its embedding into E the four units have values L j ( L j − 4 ) with L j computed from x and the original anchor abscissas.

Proof

Evaluation at x gives a K -isomorphism from K ( X ) to K ( x ) . Transport each order by composing it with the inverse isomorphism on units. Checking the images of the numerator and denominator gives the required four values in E . This computation takes place before adjoining the signed square roots.

Inspect the Lean declarations

PlanarUnitDistances.RationalPrivateZeros.hyperbola_at_transcendental

∀ {k : Type u_1} {K : Type u_2} {E : Type u_3} [inst : Field k] [CharZero k] [inst_2 : Field K] [CharZero K]
  [inst_4 : Algebra k K] [inst_5 : Field E] [inst_6 : Algebra K E] [IsAlgClosed k] (u b : k),
  b ≠ 0 →
    b ≠ 1 →
      ∀ (a : Fin 4 → K),
        AlgebraicIndependent k a →
          ∀ (x : E),
            Transcendental K x →
              ∃ D,
                PlanarUnitDistances.FourRowObstruction.PrivateOrders D ∧
                  ∀ (i : Fin 4),
                    have U := (algebraMap K E) ((algebraMap k K) u);
                    have B := (algebraMap K E) ((algebraMap k K) b);
                    have l :=
                      -B * (x - (algebraMap K E) (a i)) ^ 2 / ((x - U) * ((algebraMap K E) (a i) - U));
                    ↑↑(D i) = l * (l - 4)
Lean source · PlanarUnitDistances/RowPrivateField.lean, lines 41–58
theorem hyperbola_at_transcendental [IsAlgClosed k] (u b : k) (hb : b≠0) (hb1 : b≠1)
    (a : Fin 4 → K) (ind : AlgebraicIndependent k a) (x : E) (tr : Transcendental K x) :
    ∃ D : Fin 4 → (K⟮x⟯)ˣ, PrivateOrders D ∧ ∀ i,
      let U := algebraMap K E (algebraMap k K u)
      let B := algebraMap K E (algebraMap k K b)
      let l := -B*(x-algebraMap K E (a i))^2/((x-U)*(algebraMap K E (a i)-U))
      ((D i : K⟮x⟯) : E)=l*(l-4) := by
  obtain ⟨D,ord,eq⟩ := hyperbola_private_orders u b hb hb1 a ind
  let φ := RatFunc.algEquivOfTranscendental x tr
  refine ⟨fun i => Units.map φ.toRingEquiv.toMonoidHom (D i),transport_private φ.toRingEquiv ord,?_⟩
  intro i
  change ((φ (D i : RatFunc K) : K⟮x⟯) : E)=_
  rw [eq]
  have hc (v : K) : ((RatFunc.algEquivOfTranscendental x tr (RatFunc.C v) : K⟮x⟯) : E)=algebraMap K E v := congrArg (fun z : K⟮x⟯ => (z : E)) (φ.commutes v)
  have hn (B a : K) : hyperbolaNum B a = -C B*(X-C a)^2 := rfl
  have hd (U a : K) : hyperbolaDen U a = (X-C U)*C (a-U) := by simp [show hyperbolaDen U a = (X-C U)*(C a-C U) from rfl]
  simp [φ,hn,hd,hc,map_ofNat]
  exact Or.inl rfl

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.RationalPrivateZeros.transport_private

∀ {F : Type u_4} {L : Type u_5} [inst : Field F] [inst_1 : Field L] (e : F ≃+* L) {D : Fin 4 → Fˣ},
  PlanarUnitDistances.FourRowObstruction.PrivateOrders D →
    PlanarUnitDistances.FourRowObstruction.PrivateOrders fun i => (Units.map e.toMonoidHom) (D i)
Lean source · PlanarUnitDistances/RowPrivateField.lean, lines 11–22
/-- Transport orders only across an actual field isomorphism. No extension
of a valuation to an ambient field of unknown ramification is involved. -/
theorem transport_private {F L : Type*} [Field F] [Field L] (e : F ≃+* L)
    {D : Fin 4 → Fˣ} (orders : PrivateOrders D) :
    PrivateOrders (fun i => Units.map e.toMonoidHom (D i)) := by
  intro i
  obtain ⟨v,hi,hrest⟩ := orders i
  let ψ := Units.map e.symm.toMonoidHom
  have cancel (d : Fˣ) : ψ (Units.map e.toMonoidHom d)=d := by
    apply Units.ext; exact e.symm_apply_apply _
  exact ⟨v.comp ψ,by simpa only [MonoidHom.comp_apply,cancel] using hi,
    fun j ne => by simpa only [MonoidHom.comp_apply,cancel] using hrest j ne⟩

Kernel axioms used: propext, Quot.sound.

PlanarUnitDistances.RationalPrivateZeros.line_at_transcendental

∀ {k : Type u_1} {K : Type u_2} {E : Type u_3} [inst : Field k] [CharZero k] [inst_2 : Field K] [CharZero K]
  [inst_4 : Algebra k K] [inst_5 : Field E] [inst_6 : Algebra K E] (e c : k),
  e * c ^ 2 = 4 →
    ∀ (a : Fin 4 → K),
      AlgebraicIndependent k a →
        ∀ (x : E),
          Transcendental K x →
            ∃ D,
              PlanarUnitDistances.FourRowObstruction.PrivateOrders D ∧
                ∀ (i : Fin 4),
                  have l := (algebraMap K E) ((algebraMap k K) e) * (x - (algebraMap K E) (a i)) ^ 2;
                  ↑↑(D i) = l * (l - 4)
Lean source · PlanarUnitDistances/RowPrivateField.lean, lines 24–39
/-- The private orders are on the actual field K(x) of the surviving row.
The chord lengths are identified in the original extension field E. -/
theorem line_at_transcendental (e c : k) (ec : e*c^2=4)
    (a : Fin 4 → K) (ind : AlgebraicIndependent k a) (x : E) (tr : Transcendental K x) :
    ∃ D : Fin 4 → (K⟮x⟯)ˣ, PrivateOrders D ∧ ∀ i,
      let l := algebraMap K E (algebraMap k K e)*(x-algebraMap K E (a i))^2
      ((D i : K⟮x⟯) : E)=l*(l-4) := by
  obtain ⟨D,ord,eq⟩ := line_private_orders e c ec a ind
  let φ := RatFunc.algEquivOfTranscendental x tr
  refine ⟨fun i => Units.map φ.toRingEquiv.toMonoidHom (D i),transport_private φ.toRingEquiv ord,?_⟩
  intro i
  change ((φ (D i : RatFunc K) : K⟮x⟯) : E)=_
  rw [eq]
  have hc (v : K) : ((RatFunc.algEquivOfTranscendental x tr (RatFunc.C v) : K⟮x⟯) : E)=algebraMap K E v := congrArg (fun z : K⟮x⟯ => (z : E)) (φ.commutes v)
  simp [φ,lineChord,hc,map_ofNat]
  exact Or.inl rfl

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.36 The equations in the common degree-one case

Lean verified

Let f , g ∈ C [ z , w ] be an admissible curve pair. If g ∣ f and deg w ⁡ f = 1 , both polynomials divide one of the equations

w − e z − c , ( z − u ) ( w − v ) − β ,

with e ≠ 0 in the first case and β ∉ { 0 , 1 } in the second.

Proof

Reflection preserves the full zero set of f . The Nullstellensatz for the principal prime ideal ( f ) shows that f divides its reflected polynomial. The two are irreducible and hence associates, so their partial degrees agree after exchange of variables. Both partial degrees of f are one. The bilinear classification supplies the stated equations on complex points. In the hyperbola case reflection gives v = u ― . Since g and f are associates, β = 1 would make them the same excluded unit circle. Applying the Nullstellensatz again gives the polynomial divisibilities, which remain valid in the field of the generic grid solution.

Inspect the Lean declarations

PlanarUnitDistances.RationalCurveCase.classify

∀ {f g : PlanarUnitDistances.Competition.Poly₂},
  PlanarUnitDistances.Competition.CurvePair f g →
    g ∣ f →
      MvPolynomial.degreeOf 1 f = 1 →
        (∃ e c,
            e ≠ 0 ∧
              f ∣ PlanarUnitDistances.RationalCurveCase.lineEq e c ∧
                g ∣ PlanarUnitDistances.RationalCurveCase.lineEq e c) ∨
          ∃ u v b,
            b ≠ 0 ∧
              b ≠ 1 ∧
                f ∣ PlanarUnitDistances.RationalCurveCase.hyperEq u v b ∧
                  g ∣ PlanarUnitDistances.RationalCurveCase.hyperEq u v b
Lean source · PlanarUnitDistances/RationalCurveCase.lean, lines 40–73
/-- The classification holds as polynomial divisibility, so it applies to
the generic positions over every extension. It uses only the actual curve
pair hypotheses and excludes the unit circle only when both curves are it. -/
theorem classify {f g : Poly₂} (pair : CurvePair f g) (same : g∣f) (one : f.degreeOf 1=1) :
    (∃ e c : ℂ,e≠0 ∧ f∣lineEq e c ∧ g∣lineEq e c) ∨
    (∃ u v b : ℂ,b≠0 ∧ b≠1 ∧ f∣hyperEq u v b ∧ g∣hyperEq u v b) := by
  obtain ⟨hf,symf,_⟩ := pair.1 f (Or.inl rfl)
  have hg := (pair.1 g (Or.inr rfl)).1
  have eta (x : Fin 2 → ℂ) : ![x 0,x 1]=x := by funext d; fin_cases d <;> rfl
  rcases CurveNormalForm.classify_bidegree_one f hf ((degree_symmetry hf symf).trans one) one with
    ⟨e,c,ne,eq⟩|⟨u,v,b,ne,eq⟩
  · have dv : f∣lineEq e c := divides_of_zero_set hf (fun x hx => by
      have h := (eq (x 0) (x 1)).mp (by rwa [eta])
      simpa only [lineEq,map_sub,map_add,map_mul,eval_X,eval_C,sub_eq_zero] using h)
    exact Or.inl ⟨e,c,ne,dv,same.trans dv⟩
  · have sym (z w : ℂ) (h : (z-u)*(w-v)=b) : (conj w-u)*(conj z-v)=b :=
      (eq _ _).mp ((symf _ _).mp ((eq _ _).mpr h))
    have hv := (hyperbola_center u v b sym).1
    have no : b≠1 := by
      rintro rfl
      apply pair.2
      refine ⟨u,fun x => ?_⟩
      have h := eq (x 0) (x 1)
      rw [eta,hv] at h
      have associated := hg.associated_of_dvd hf same
      have zeros : eval x g=0 ↔ eval x f=0 := by
        constructor
        · rintro hx; obtain ⟨d,hd⟩ := same; simp [hd,hx]
        · rintro hx; obtain ⟨d,hd⟩ := associated.symm.dvd; simp [hd,hx]
      exact ⟨h,zeros.trans h⟩
    have dv : f∣hyperEq u v b := divides_of_zero_set hf (fun x hx => by
      have h := (eq (x 0) (x 1)).mp (by rwa [eta])
      simpa only [hyperEq,map_sub,map_mul,eval_X,eval_C,sub_eq_zero] using h)
    exact Or.inr ⟨u,v,b,ne,no,dv,same.trans dv⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.RationalCurveCase.degree_symmetry

∀ {f : PlanarUnitDistances.Competition.Poly₂},
  Irreducible f →
    (∀ (z w : ℂ),
        (MvPolynomial.eval ![z, w]) f = 0 ↔
          (MvPolynomial.eval ![(starRingEnd ℂ) w, (starRingEnd ℂ) z]) f = 0) →
      MvPolynomial.degreeOf 0 f = MvPolynomial.degreeOf 1 f
Lean source · PlanarUnitDistances/RationalCurveCase.lean, lines 18–35
theorem degree_symmetry {f : Poly₂} (irr : Irreducible f)
    (symm : ∀ z w : ℂ,eval ![z,w] f=0 ↔ eval ![conj w,conj z] f=0) :
    f.degreeOf 0=f.degreeOf 1 := by
  have eta (x : Fin 2 → ℂ) : ![x 0,x 1]=x := by funext d; fin_cases d <;> rfl
  have rr (x : Fin 2 → ℂ) : reflectPoint (reflectPoint x)=x := by
    funext i; fin_cases i <;> simp [reflectPoint]
  have re (x : Fin 2 → ℂ) : reflectPoint x=![conj (x 1),conj (x 0)] := by
    funext i; fin_cases i <;> rfl
  have dv : f∣reflect f := divides_of_zero_set irr (fun x h => by
    have v := (symm (x 0) (x 1)).mp (by rwa [eta])
    have ev := reflect_eval (reflectPoint x) f
    rwa [rr,re,v,map_zero] at ev)
  obtain ⟨u,hu⟩ := irr.associated_of_dvd ((MulEquiv.irreducible_iff reflect).mpr irr) dv
  obtain ⟨c,hc,ce⟩ := isUnit_iff_eq_C_of_isReduced.mp u.isUnit
  have fac : reflect f=C c*f := by rw [←hu,ce,mul_comm]
  have deg := reflect_degreeOf 0 f
  rw [fac,degreeOf_C_mul _ _ (mem_nonZeroDivisors_of_ne_zero hc.ne_zero)] at deg
  exact deg.symm

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.37 Private orders after classifying the common curve

Lean verified

Under the hypotheses of Lemma 5.36, let the four anchor abscissas a j ∈ K be algebraically independent over C . Let ( x , w ) lie on f in an extension of K , with x transcendental over K . Then w ∈ K ( x ) , and the four radicands of this row admit private orders on K ( x ) .

Proof

The polynomial divisibilities apply both at the row and at each anchor ( a j , b j ) on g . On the line they give L j = ( x − a j ) ( w − b j ) = e ( x − a j ) 2 . On the hyperbola they give w = v + β / ( x − u ) and

L j = − β ( x − a j ) 2 ( x − u ) ( a j − u ) .

The curve equation and β ≠ 0 make both denominators nonzero. These are the two functions treated in Lemma 5.35.

Inspect the Lean declarations

PlanarUnitDistances.RationalCurveCase.orders_on_rational_row

∀ {K E : Type} [inst : Field K] [CharZero K] [inst_2 : Algebra ℂ K] [inst_3 : Field E] [inst_4 : Algebra K E]
  [inst_5 : Algebra ℂ E] [IsScalarTower ℂ K E] {f g : PlanarUnitDistances.Competition.Poly₂},
  PlanarUnitDistances.Competition.CurvePair f g →
    g ∣ f →
      MvPolynomial.degreeOf 1 f = 1 →
        ∀ (x w : E),
          Transcendental K x →
            (MvPolynomial.aeval ![x, w]) f = 0 →
              ∀ (a b : Fin 4 → K),
                AlgebraicIndependent ℂ a →
                  (∀ (j : Fin 4), (MvPolynomial.aeval ![a j, b j]) g = 0) →
                    ∃ M,
                      x ∈ M ∧
                        w ∈ M ∧
                          ∃ D,
                            PlanarUnitDistances.FourRowObstruction.PrivateOrders D ∧
                              ∀ (j : Fin 4),
                                have l := (x - (algebraMap K E) (a j)) * (w - (algebraMap K E) (b j));
                                ↑↑(D j) = l * (l - 4)
Lean source · PlanarUnitDistances/RationalRowOrders.lean, lines 34–71
theorem orders_on_rational_row {f g : Poly₂} (pair : CurvePair f g)
    (same : g∣f) (one : f.degreeOf 1=1) (x w : E) (tr : Transcendental K x)
    (on : aeval ![x,w] f=0) (a b : Fin 4 → K) (ind : AlgebraicIndependent ℂ a)
    (anchors : ∀ j,aeval ![a j,b j] g=0) :
    ∃ M : IntermediateField K E,x∈M ∧ w∈M ∧ ∃ D : Fin 4 → Mˣ,
      PrivateOrders D ∧ ∀ j,let l := (x-algebraMap K E (a j))*(w-algebraMap K E (b j))
                            (((D j : M) : E))=l*(l-4) := by
  let M := K⟮x⟯
  have xmem : x∈M := IntermediateField.mem_adjoin_simple_self _ _
  have mapc (c : ℂ) : algebraMap ℂ E c=algebraMap K E (algebraMap ℂ K c) :=
    IsScalarTower.algebraMap_apply ℂ K E c
  have cmem (c : ℂ) : algebraMap ℂ E c ∈ M := mapc c ▸ M.algebraMap_mem _
  rcases classify pair same one with ⟨e,c,ne,hf,hg⟩|⟨u,v,β,nz,n1,hf,hg⟩
  · have hr := line_value (eval_of_dvd hf _ on)
    have ha (j) := line_value (eval_of_dvd hg _ (anchors j))
    obtain ⟨t,ht⟩ := IsAlgClosed.exists_pow_nat_eq (4/e) (by decide : 0<2)
    obtain ⟨D,orders,hD⟩ := line_at_transcendental e t (by rw [ht]; field_simp) a ind x tr
    refine ⟨M,xmem,hr ▸ M.add_mem (M.mul_mem (cmem e) xmem) (cmem c),D,orders,fun j => ?_⟩
    have len : (x-algebraMap K E (a j))*(w-algebraMap K E (b j)) =
        algebraMap K E (algebraMap ℂ K e)*(x-algebraMap K E (a j))^2 := by
      rw [hr,ha,map_add,map_mul,mapc,mapc]; ring
    dsimp only
    rw [len]; exact hD j
  · obtain ⟨nx,hr⟩ := hyper_value nz (eval_of_dvd hf _ on)
    have ha (j) := hyper_value nz (eval_of_dvd hg _ (anchors j))
    obtain ⟨D,orders,hD⟩ := hyperbola_at_transcendental u β nz n1 a ind x tr
    refine ⟨M,xmem,hr ▸ M.add_mem (cmem v) (M.div_mem (cmem β) (M.sub_mem xmem (cmem u))),
      D,orders,fun j => ?_⟩
    have na := (algebraMap K E).injective.ne (ha j).1
    have h := hyperbola_chord (algebraMap ℂ E β) (algebraMap ℂ E u) (algebraMap ℂ E v)
      x (algebraMap K E (a j)) nx (by rwa [mapc])
    have len : (x-algebraMap K E (a j))*(w-algebraMap K E (b j)) =
        -(algebraMap K E (algebraMap ℂ K β))*(x-algebraMap K E (a j))^2 /
          ((x-algebraMap K E (algebraMap ℂ K u))*(algebraMap K E (a j)-algebraMap K E (algebraMap ℂ K u))) := by
      rw [hr,(ha j).2,map_add,map_div₀,map_sub]
      simpa only [mapc] using h
    dsimp only
    rw [len]; exact hD j

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.38 Proper locus of compatible position tuples

Lean verified

Let the two irreducible complex plane curves have nonconstant coordinate projections and be invariant under ( z , w ) ↦ ( w ― , z ― ) . Suppose they are not both the same real unit circle. Then the position tuples of all compatible 8 -by- 4 grids lie in a proper closed algebraic subset of C 1 8 × C 2 4 .

Proof

Assume the compatible positions are dense. Lemma 5.32 provides a solution of the full lifted system whose twelve abscissas are algebraically independent. Lemma 5.34 gives a row with abscissa transcendental over a field K containing the four anchor positions and their normalized velocities and scalars. If g ∤ f or deg w ⁡ f ≥ 2 , the smooth-branch construction of Lemma 5.17 contradicts the equations on this row. Otherwise g ∣ f . Nonconstancy of the first projection excludes deg w ⁡ f = 0 , so deg w ⁡ f = 1 . Lemma 5.37 gives private orders on the same row field. The independent sign changes of Lemma 5.12, applied to the chord roots of Lemma 5.27, force equality of the row scalar and an anchor scalar, contrary to the nonzero difference required on their edge. This excludes density for every admissible pair.

Inspect the Lean declarations

PlanarUnitDistances.GridLocus.proper_grid_locus

PlanarUnitDistances.GridLocus.ProperGridLocus
Lean source · PlanarUnitDistances/GridProperness.lean, lines 38–46
/-- The manuscript's original affine separating-polynomial formulation. -/
theorem proper_grid_locus : ProperGridLocus := by
  intro f g pair
  by_contra h
  obtain ⟨E,field,alg,closed,y,edges,curves,ind⟩ := generic_of_no_separator f g pair h
  let _ : Field E := field
  let _ : Algebra ℂ E := alg
  let _ : IsAlgClosed E := closed
  exact Competition.GenericCurvePoint.no_generic_grid f g ((pair_equiv _ _).mp pair) y edges curves ind

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.GenericCurvePoint.no_generic_grid

∀ (f g : PlanarUnitDistances.Competition.Poly₂),
  PlanarUnitDistances.Competition.CurvePair f g →
    ∀ {E : Type} [inst : Field E] [inst_1 : Algebra ℂ E] [IsAlgClosed E]
      (y : PlanarUnitDistances.Competition.GridElimination.LiftCoord → E),
      (∀ (i : Fin 128),
          (MvPolynomial.aeval y) (PlanarUnitDistances.Competition.GridElimination.edgeList i) = 0) →
        (∀ (j : Fin 12),
            (MvPolynomial.aeval y) (PlanarUnitDistances.Competition.GridElimination.curveList f g j) = 0) →
          (AlgebraicIndependent ℂ fun s => PlanarUnitDistances.Competition.LiftedTangent.nullPos y s 0) →
            False
Lean source · PlanarUnitDistances/GridProperness.lean, lines 9–30
/-- On the full 8 by 4 grid no simultaneous solution over an algebraically
closed extension can have all twelve abscissas independent. Both curve
equations and the four original variables on every edge are retained. -/
theorem no_generic_grid (f g : Poly₂) (pair : CurvePair f g)
    {E : Type} [Field E] [Algebra ℂ E] [IsAlgClosed E] (y : LiftCoord → E)
    (edges : ∀ i,aeval y (edgeList i)=0) (curves : ∀ j,aeval y (curveList f g j)=0)
    (ind : AlgebraicIndependent ℂ (fun s : Slot => nullPos y s 0)) : False := by
  let _ : CharZero E := charZero_of_injective_algebraMap (algebraMap ℂ E).injective
  let data := data_of_lift f g y edges curves
  obtain ⟨R⟩ := normalized_of_lift (pair.1 g (Or.inr rfl)).1.ne_zero data ind
  by_cases smooth : ¬g∣f ∨ 2≤f.degreeOf 1
  · exact R.excludes_smooth data pair ind smooth
  push_neg at smooth
  obtain ⟨hf,_,proj⟩ := pair.1 f (Or.inl rfl)
  have nz := (BivariateCurveCoordinates.degrees_of_projections f hf proj).2
  have one : f.degreeOf 1=1 := by omega
  apply R.excludes_of_orders data
  refine RationalCurveCase.orders_on_rational_row pair smooth.1 one _ _ R.transcendental ?_
    R.anchorZ R.anchorW (R.anchor_independence ind) (R.anchors_on_curve data)
  have eta : ![nullPos y (.inl R.i) 0,nullPos y (.inl R.i) 1]=nullPos y (.inl R.i) := by
    funext j; fin_cases j <;> rfl
  rw [eta]; exact data.row_curve R.i

Kernel axioms used: propext, Classical.choice, Quot.sound.

5.4 Counting exceptional tuples

Lemma 5.39 A fixed constructible set of compatible positions

Lean verified

There is a finite collection T of pairs ( B , h ) , where B is a finite set of complex polynomials in the 24 position coordinates and h is one such polynomial. A tuple x ∈ C 24 admits all ratios, velocities and scalars of the original compatibility system if and only if some ( B , h ) ∈ T satisfies

b ( x ) = 0 ( b ∈ B ) , h ( x ) ≠ 0 .

The same collection works before either curve is chosen.

Proof

Take the zeros of the 128 edge quadrics in the 156 coordinates of the lifted system. The inverse variable on each edge enforces the required nonzero scalar difference. Chevalley’s theorem applies to the coordinate projection on prime spectra and describes its image as a finite union of sets V ( B ) ∖ V ( h ) .

For the identification on complex points, suppose a prime upstairs lies above the evaluation ideal of a prescribed tuple x . Choose a maximal ideal containing that prime. The weak Nullstellensatz writes this maximal ideal as evaluation at a complex tuple y . All 128 quadrics vanish at y . Each polynomial X i − x i belongs to the contraction of the prime, so the corresponding coordinate of y is exactly x i . Conversely, evaluation at any actual lift contracts to evaluation at its projection. Thus the description represents the tuples with lifts, including the polynomial inequation on each set.

Inspect the Lean declarations

PlanarUnitDistances.Competition.GridElimination.position_charts

∃ T,
  ∀ (x : PlanarUnitDistances.Competition.GridTuple),
    PlanarUnitDistances.Competition.PositionSystem x ↔
      ∃ c ∈ T, (∀ p ∈ c.1, (MvPolynomial.eval x) p = 0) ∧ (MvPolynomial.eval x) c.2 ≠ 0
Lean source · PlanarUnitDistances/ConstructiblePositions.lean, lines 95–122
/-- A single finite family of charts describes the original 8-by-4
tangent compatibility system on complex positions, independently of both
curves. The guard in each chart is required to be nonzero. -/
theorem position_charts :
    ∃ T : Finset (Finset (MvPolynomial Coord ℂ) × MvPolynomial Coord ℂ), ∀ x : GridTuple,
      PositionSystem x ↔ ∃ c ∈ T, (∀ p ∈ c.1, eval x p=0) ∧ eval x c.2≠0 := by
  have zero (s : Slot) : curveEquation 0 0 s=0 := by cases s <;> simp [curveEquation]
  have cut (i : Fin 12) : curveList 0 0 i=0 := zero _
  have eqs : PublishedElimination.equations (List.ofFn edgeList ++ List.ofFn (curveList 0 0)) =
      {y : LiftCoord → ℂ | ∀ i, eval y (edgeList i)=0} := by
    ext y
    change (∀ p ∈ List.ofFn edgeList ++ List.ofFn (curveList 0 0), eval y p=0) ↔ _
    constructor
    · intro h i
      exact h _ (List.mem_append_left _ (List.mem_ofFn.mpr ⟨i,rfl⟩))
    · intro h p hp
      rcases List.mem_append.mp hp with hp|hp
      · obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hp
        exact h i
      · obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hp
        rw [cut,map_zero]
  have eq := projected_grid_locus 0 0
  rw [eqs] at eq
  obtain ⟨S,hS⟩ := projected_equation_charts (Sum.inl : Coord → LiftCoord) edgeList
  refine ⟨S,fun x => ?_⟩
  rw [←hS]
  have h := Set.ext_iff.mp eq x
  simpa [curveProduct,Function.comp_def] using h.symm

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.GridElimination.lift_projected_closed_point

∀ {k : Type u_1} {I : Type u_2} {J : Type u_3} {N : Type u_4} [inst : Field k] [IsAlgClosed k] [Finite J]
  (c : I → J) (q : N → MvPolynomial J k) (x : I → k),
  (∃ y, (∀ (i : N), (MvPolynomial.eval y) (q i) = 0) ∧ y ∘ c = x) ↔
    MvPolynomial.pointToPoint x ∈
      PrimeSpectrum.comap (MvPolynomial.rename c).toRingHom '' PrimeSpectrum.zeroLocus (Set.range q)
Lean source · PlanarUnitDistances/ConstructiblePositions.lean, lines 27–51
/-- The projection of a closed affine set on actual field-valued points is
the pullback of its prime-spectrum image under the closed-point map.
The inclusion from right to left lifts the given point without replacing it
by a specialization of the target. -/
theorem lift_projected_closed_point (c : I → J) (q : N → MvPolynomial J k) (x : I → k) :
    (∃ y : J → k, (∀ i, eval y (q i)=0) ∧ y ∘ c = x) ↔
    pointToPoint (k:=k) x ∈ PrimeSpectrum.comap (rename c (R:=k)).toRingHom ''
      PrimeSpectrum.zeroLocus (Set.range q) := by
  constructor
  · rintro ⟨y,h,rfl⟩
    refine ⟨pointToPoint (k:=k) y,?_,project_point c y⟩
    rintro _ ⟨i,rfl⟩
    exact (point_mem _ _).mpr (h i)
  · rintro ⟨p,hp,hpx⟩
    obtain ⟨m,hm,hle⟩ := p.asIdeal.exists_le_maximal p.isPrime.ne_top
    obtain ⟨y,hmx⟩ := eq_vanishingIdeal_singleton_of_isMaximal k hm
    have vanish (a : MvPolynomial J k) (ha : a ∈ p.asIdeal) : eval y a=0 :=
      (mem_vanishingIdeal_singleton_iff y a).mp (hmx ▸ hle ha)
    refine ⟨y, fun i => vanish _ (hp (Set.mem_range_self i)),?_⟩
    funext i
    let a : MvPolynomial I k := X i-C (x i)
    have ax : a ∈ (pointToPoint (k:=k) x).asIdeal := (point_mem _ _).mpr (by simp [a])
    rw [← hpx] at ax
    have h := vanish _ (show rename c a ∈ p.asIdeal from ax)
    simpa [a,eval_rename,sub_eq_zero] using h

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.Competition.GridElimination.projected_equation_charts

∀ {k : Type u_1} {I : Type u_2} {J : Type u_3} {N : Type u_4} [inst : Field k] [IsAlgClosed k] [Finite I]
  [Finite J] [Finite N] (c : I → J) (q : N → MvPolynomial J k),
  ∃ T,
    ∀ (x : I → k),
      (∃ y, (∀ (i : N), (MvPolynomial.eval y) (q i) = 0) ∧ y ∘ c = x) ↔
        ∃ t ∈ T, (∀ p ∈ t.1, (MvPolynomial.eval x) p = 0) ∧ (MvPolynomial.eval x) t.2 ≠ 0
Lean source · PlanarUnitDistances/ConstructiblePositions.lean, lines 61–93
/-- A finite union of charts, each defined on the concrete affine space by
a finite family of equations and one polynomial inequation. -/
theorem projected_equation_charts (c : I → J) (q : N → MvPolynomial J k) :
    ∃ T : Finset (Finset (MvPolynomial I k) × MvPolynomial I k), ∀ x : I → k,
      (∃ y : J → k, (∀ i, eval y (q i)=0) ∧ y ∘ c = x) ↔
        ∃ t ∈ T, (∀ p ∈ t.1, eval x p=0) ∧ eval x t.2≠0 := by
  classical
  let source := PrimeSpectrum.zeroLocus (Set.range q)
  have hs : IsConstructible source := by
    rw [← isConstructible_compl]
    exact (PrimeSpectrum.isRetrocompact_zeroLocus_compl (Set.finite_range q)).isConstructible
      (PrimeSpectrum.isClosed_zeroLocus _).isOpen_compl
  obtain ⟨S,hS⟩ := PrimeSpectrum.exists_constructibleSetData_iff.mpr
    (PrimeSpectrum.isConstructible_comap_image (rename_fp (k:=k) c) hs)
  let chart (b : PrimeSpectrum.BasicConstructibleSetData (MvPolynomial I k)) :=
    (Finset.univ.image b.g,b.f)
  refine ⟨S.image chart,fun x => ?_⟩
  rw [lift_projected_closed_point]
  change pointToPoint (k:=k) x ∈ PrimeSpectrum.comap (rename c (R:=k)).toRingHom '' source ↔ _
  rw [←hS]
  have basic (b : PrimeSpectrum.BasicConstructibleSetData (MvPolynomial I k)) :
      pointToPoint (k:=k) x ∈ b.toSet ↔
        (∀ p ∈ (chart b).1, eval x p=0) ∧ eval x (chart b).2≠0 := by
    change (Set.range b.g ⊆ (pointToPoint (k:=k) x).asIdeal ∧
      ¬({b.f} : Set (MvPolynomial I k)) ⊆ (pointToPoint (k:=k) x).asIdeal) ↔ _
    simp [chart,Set.range_subset_iff,Set.singleton_subset_iff,point_mem]
  simpa only [PrimeSpectrum.ConstructibleSetData.toSet,Set.mem_iUnion,Finset.mem_image,
    exists_prop,basic] using
    (show (∃ b ∈ S, (∀ p ∈ (chart b).1, eval x p=0) ∧ eval x (chart b).2≠0) ↔
      ∃ t ∈ S.image chart, (∀ p ∈ t.1, eval x p=0) ∧ eval x t.2≠0 from by
        constructor
        · rintro ⟨b,hb,h⟩; exact ⟨chart b,Finset.mem_image_of_mem _ hb,h⟩
        · rintro ⟨_,ht,h⟩; obtain ⟨b,hb,rfl⟩ := Finset.mem_image.mp ht; exact ⟨b,hb,h⟩)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 5.40 A uniform exceptional degree for the asymptotic bound

Lean verified

There is an integer E ≥ 0 , independent of both curves, such that every pair satisfying Lemma 5.38 admits a polynomial of degree at most E vanishing on every compatible tuple and nonzero somewhere on W = C 1 8 × C 2 4 . This includes eligible curves of all degrees.

Proof

Choose an equation Q from Lemma 5.38 which vanishes on all compatible points of W and is nonzero somewhere on W . For each pair ( B , h ) in Lemma 5.39, select any b ∈ B nonzero somewhere on W , if one exists. If all members of B vanish on W , the set represented by this pair misses W . Indeed, a point there would make h nonzero somewhere on W . Lemma 5.44 would then supply a point where h Q ≠ 0 , which satisfies all equations in B and hence is compatible, contradicting the vanishing of Q . Choose the constant polynomial one in this case.

The product of the selected polynomials vanishes on every compatible tuple of W and is nonzero somewhere on W by simultaneous nonvanishing again. One may take

E = ∑ ( B , h ) ∈ T   ∑ b ∈ B deg ⁡ b .

This proves the uniform existence needed when the graph size tends to infinity.

Inspect the Lean declarations

PlanarUnitDistances.GridLocus.uniform_exceptional_degree

PlanarUnitDistances.GridLocus.UniformExceptionalDegree
Lean source · PlanarUnitDistances/UniformGridSeparator.lean, lines 35–39
/-- The original uniform-degree predicate, including its original
nonvanishing witness and every compatible tuple of the original product. -/
theorem uniform_exceptional_degree : UniformExceptionalDegree := by
  obtain ⟨E,h⟩ := uniform_separating_degree
  exact ⟨E,fun f g pair _ _ => h f g pair⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.UniformSeparation.uniform_separator

∀ {k : Type u_1} {σ : Type u_2} [inst : Field k] {S : Set (σ → k)}
  (T : Finset (PlanarUnitDistances.UniformSeparation.Chart σ k)),
  (∀ (x : σ → k), x ∈ S ↔ ∃ a ∈ T, PlanarUnitDistances.UniformSeparation.Holds a x) →
    ∃ E,
      ∀ (W : Set (σ → k)),
        (∀ (p q : MvPolynomial σ k),
            PlanarUnitDistances.UniformSeparation.NonzeroOn W p →
              PlanarUnitDistances.UniformSeparation.NonzeroOn W q →
                PlanarUnitDistances.UniformSeparation.NonzeroOn W (p * q)) →
          (∃ g,
              PlanarUnitDistances.UniformSeparation.NonzeroOn W g ∧
                ∀ x ∈ W, x ∈ S → (MvPolynomial.eval x) g = 0) →
            ∃ f,
              f.totalDegree ≤ E ∧
                (∀ x ∈ W, x ∈ S → (MvPolynomial.eval x) f = 0) ∧
                  PlanarUnitDistances.UniformSeparation.NonzeroOn W f
Lean source · PlanarUnitDistances/UniformChartSeparation.lean, lines 39–74
/-- A fixed constructible description gives a single degree bound for all
irreducible test sets. The degree of a supplied separator can vary arbitrarily
with the test set. Only its nonvanishing and vanishing properties enter. -/
theorem uniform_separator {S : Set (σ → k)} (T : Finset (Chart σ k))
    (charts : ∀x,x∈S ↔ ∃ a ∈ T,Holds a x) :
    ∃ E : ℕ, ∀ W : Set (σ → k),
      (∀ p q, NonzeroOn W p → NonzeroOn W q → NonzeroOn W (p*q)) →
      (∃ g : MvPolynomial σ k, NonzeroOn W g ∧ ∀ x ∈ W, x∈S → eval x g=0) →
      ∃ f : MvPolynomial σ k, f.totalDegree ≤ E ∧
        (∀ x ∈ W, x∈S → eval x f=0) ∧ NonzeroOn W f := by
  classical
  let cost (a : Chart σ k) := ∑h∈a.1,h.totalDegree
  refine ⟨∑a∈T,cost a,?_⟩
  rintro W product ⟨g,hg,zero⟩
  have each (a) (ha : a∈T) := separate_one W a g hg
    (fun x hx h => zero x hx ((charts x).mpr ⟨a,ha,h⟩)) product
  choose f degree vanishes nonzero using each
  let F (a : Chart σ k) := if h : a∈T then f a h else 1
  have pos (J : Finset (Chart σ k)) (sub : J ⊆ T) : NonzeroOn W (∏a∈J,F a) := by
    induction J using Finset.induction_on with
    | empty =>
      obtain ⟨x,hx,_⟩ := hg
      exact ⟨x,hx,by simp⟩
    | @insert a J ha ih =>
      rw [prod_insert ha]
      have mem := sub (mem_insert_self a J)
      exact product _ _ (by simpa only [F,dif_pos mem] using nonzero a mem)
        (ih (fun _ h => sub (mem_insert_of_mem h)))
  refine ⟨∏a∈T,F a,(totalDegree_finsetProd T F).trans ?_,?_,pos T (Subset.rfl)⟩
  · apply sum_le_sum; intro a ha
    simpa only [F,dif_pos ha] using degree a ha
  · intro x hx hs
    obtain ⟨a,ha,h⟩ := (charts x).mp hs
    rw [map_prod]
    apply prod_eq_zero ha
    simpa only [F,dif_pos ha] using vanishes a ha x hx h

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.GridLocus.uniform_separating_degree

∃ E,
  ∀ (f g : PlanarUnitDistances.GridLocus.PlanePoly),
    PlanarUnitDistances.GridLocus.curvePair f g →
      ∃ F, MvPolynomial.totalDegree F ≤ E ∧ PlanarUnitDistances.GridLocus.separates f g F
Lean source · PlanarUnitDistances/UniformGridSeparator.lean, lines 10–33
/-- The compatibility locus has a separating equation of uniformly bounded
degree on every eligible curve product. Its bound is chosen once from the
finite family of charts for the fixed 8-by-4 tangent system. -/
theorem uniform_separating_degree :
    ∃ E : ℕ, ∀ f g, curvePair f g → ∃ F : TuplePoly, F.totalDegree ≤ E ∧ separates f g F := by
  let S : Set Competition.GridTuple := {x | Competition.PositionSystem x}
  obtain ⟨T,description⟩ := Competition.GridElimination.position_charts
  obtain ⟨E,uniform⟩ := UniformSeparation.uniform_separator (S:=S) T description
  refine ⟨E,?_⟩
  intro f g pair
  let W := Competition.curveProduct f g
  have product (F G : TuplePoly) : UniformSeparation.NonzeroOn W F →
      UniformSeparation.NonzeroOn W G → UniformSeparation.NonzeroOn W (F*G) :=
    Competition.GenericCurvePoint.nonzero_product_on_curves ((pair_equiv f g).mp pair)
  obtain ⟨Q,hvan,u,hu,hQ⟩ := proper_grid_locus f g pair
  have initial : ∃ H : TuplePoly, UniformSeparation.NonzeroOn W H ∧
      ∀ x ∈ W, x∈S → eval x H=0 := by
    refine ⟨Q,⟨fun e => u e.1 e.2,hu,hQ⟩,?_⟩
    intro x hx hS
    exact hvan (fun s d => x (s,d)) hx ((position_equiv _).mpr hS)
  obtain ⟨F,deg,van,x,hx,nonzero⟩ := uniform W product initial
  refine ⟨F,deg,?_,fun s d => x (s,d),hx,nonzero⟩
  intro v hv h
  exact van (fun e => v e.1 e.2) hv ((position_equiv v).mp h)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.41 One-curve Bézout bound

Lean verified

Let F , G be polynomials in two variables over any field, with F irreducible and F ∤ G . Every finite set of distinct common zeros has size at most deg ⁡ ( F ) deg ⁡ ( G ) . A nonzero value of G at a point of the curve F = 0 implies the required nondivisibility.

Proof

Write d = deg ⁡ F , e = deg ⁡ G and let S consist of n distinct common zeros. The vector space V j of bivariate polynomials of degree at most j has dimension ( j + 1 ) ( j + 2 ) / 2 , by counting its monomials. Put m = n + d + e . Evaluation from V m to functions on S is surjective. For each x ∈ S , multiply one linear factor for each y ≠ x , choosing a coordinate in which x and y differ. Divide by its nonzero value at x to interpolate the indicator of x .

The image of ( A , B ) ↦ F A + G B from V n + e ⊕ V n + d lies in the evaluation kernel. If F A + G B = 0 , primality of F and F ∤ G give B = F C . Cancellation yields A = − G C . Degree additivity gives C ∈ V n , including C = 0 . Thus

n ≤ dim ⁡ V m − dim ⁡ V n + e − dim ⁡ V n + d + dim ⁡ V n = d e .

This counts each distinct point once over the given field.

Inspect the Lean declarations

PlanarUnitDistances.PlaneBezout.common_zeros

∀ {k : Type u_1} [inst : Field k] (F G : PlanarUnitDistances.PlaneBezout.Poly k),
  Irreducible F →
    ¬F ∣ G →
      ∀ (S : Finset (Fin 2 → k)),
        (∀ x ∈ S, (MvPolynomial.eval x) F = 0) →
          (∀ x ∈ S, (MvPolynomial.eval x) G = 0) →
            S.card ≤ MvPolynomial.totalDegree F * MvPolynomial.totalDegree G
Lean source · PlanarUnitDistances/PlaneBezout.lean, lines 101–158
/-- Every finite set of common zeros of an irreducible plane polynomial F and a
polynomial G not divisible by F contains at most deg(F) deg(G) distinct points. -/
theorem common_zeros (F G : Poly k) (hF : Irreducible F) (hFG : ¬ F ∣ G)
    (S : Finset (Fin 2 → k)) (hf : ∀ x ∈ S, MvPolynomial.eval x F = 0)
    (hg : ∀ x ∈ S, MvPolynomial.eval x G = 0) :
    S.card ≤ F.totalDegree * G.totalDegree := by
  classical
  let n := S.card
  let d := F.totalDegree
  let e := G.totalDegree
  let m := n+d+e
  let A := times F (n+e) m (by dsimp [m,d]; omega)
  let B := times G (n+d) m (by dsimp [m,e]; omega)
  let L := A.coprod B
  let Y := evaluate S m
  let T := ((times (-G) n (n+e) (by simp [e]; omega))).prod
    (times F n (n+d) (by dsimp [d]; omega))
  have syz : LinearMap.ker L ≤ LinearMap.range T := by
    rintro ⟨a,b⟩ hab
    have eqn : F*a.val+G*b.val=0 := congrArg Subtype.val (LinearMap.mem_ker.mp hab)
    have div : F ∣ G*b.val := ⟨-a.val,by rw [mul_neg]; linear_combination eqn⟩
    obtain ⟨c,hc⟩ := ((hF.prime.dvd_mul.mp div).resolve_left hFG)
    have ha : a.val = (-G)*c := by
      apply mul_left_cancel₀ hF.ne_zero
      rw [hc] at eqn
      linear_combination eqn
    have cdeg : c.totalDegree ≤ n := by
      by_cases hz : c=0
      · simp [hz]
      · have hb := (mem_restrictTotalDegree _ _ _).mp b.prop
        rw [hc,totalDegree_mul_of_isDomain hF.ne_zero hz] at hb
        dsimp [d] at hb
        omega
    refine ⟨⟨c,(mem_restrictTotalDegree _ _ _).mpr cdeg⟩,?_⟩
    apply Prod.ext
    · exact Subtype.ext ha.symm
    · exact Subtype.ext hc.symm
  have inc : LinearMap.range L ≤ LinearMap.ker Y := by
    rintro _ ⟨⟨a,b⟩,rfl⟩
    apply LinearMap.mem_ker.mpr
    funext x
    change MvPolynomial.eval x.val (F*a.val+G*b.val) = 0
    simp [hf _ x.prop,hg _ x.prop]
  have surj : LinearMap.range Y = ⊤ := LinearMap.range_eq_top.mpr
    (evaluation_surjective S (by dsimp [m,n]; omega))
  have h₁ := L.finrank_range_add_finrank_ker
  have h₂ := Y.finrank_range_add_finrank_ker
  have h₃ := (Submodule.finrank_mono syz).trans (LinearMap.finrank_range_le T)
  have h₄ := Submodule.finrank_mono inc
  rw [surj,finrank_top,Module.finrank_pi, Fintype.card_coe] at h₂
  rw [Module.finrank_prod] at h₁
  have v₀ := degree_space_dimension k n
  have v₁ := degree_space_dimension k (n+e)
  have v₂ := degree_space_dimension k (n+d)
  have v₃ := degree_space_dimension k m
  dsimp only [m] at v₃
  change S.card ≤ d*e
  nlinarith only [h₁,h₂,h₃,h₄,v₀,v₁,v₂,v₃]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.PlaneBezout.degree_space_dimension

∀ (k : Type u_1) [inst : Field k] (n : ℕ),
  2 * Module.finrank k ↥(PlanarUnitDistances.PlaneBezout.V k n) = (n + 1) * (n + 2)
Lean source · PlanarUnitDistances/PlaneBezout.lean, lines 35–45
theorem degree_space_dimension (n : ℕ) :
    2*finrank k (V k n) = (n+1)*(n+2) := by
  letI : Fintype (triangle n) := Fintype.ofEquiv _ (triangleEquiv n).symm
  let B : Module.Basis (triangle n) k (V k n) := basisRestrictSupport k _
  rw [Module.finrank_eq_card_basis B, Fintype.card_congr (triangleEquiv n), Fintype.card_sigma]
  simp only [Fintype.card_fin]
  rw [sum_add_distrib]
  have h := sum_range_id_mul_two (n+1)
  simp at h ⊢
  rw [Fin.sum_univ_eq_sum_range (fun i => i)]
  nlinarith only [h]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.42 Reflection symmetry from real points

Lean verified

Let f ∈ C [ z , w ] be irreducible of total degree at most D . Suppose more than D 2 distinct real plane points lie on f = 0 in the coordinates z = x + i y ,   w = x − i y . Write f σ ( z , w ) = f ( w ― , z ― ) ― . Then f σ = c f for some c ∈ C × . The entire complex curve is invariant under ( z , w ) ↦ ( w ― , z ― ) , and deg z ⁡ f = deg w ⁡ f . Both coordinate projections on the curve are nonconstant.

Proof

Reflection conjugates the coefficients and swaps the variable indices, so it preserves total degree and interchanges the two partial degrees. Each sampled real point is fixed under reflection. If f ∤ f σ , the plane intersection bound gives at most D 2 points. Thus f ∣ f σ , and both polynomials are irreducible because reflection is a ring automorphism. Their quotient is a nonzero constant. Finally the complex coordinate z determines the original real point, as does w = z ― . Any two distinct sample points witness nonconstancy of both projections.

Inspect the Lean declarations

PlanarUnitDistances.CurveReflection.rich_curve_symmetry

∀ (f : PlanarUnitDistances.CurveReflection.Poly),
  Irreducible f →
    ∀ {D : ℕ},
      MvPolynomial.totalDegree f ≤ D →
        ∀ (S : Finset OAI.PlanarUnitDistances.Plane),
          D ^ 2 < S.card →
            (∀ p ∈ S, (MvPolynomial.eval (PlanarUnitDistances.CurveReflection.realPoint p)) f = 0) →
              (∃ c, c ≠ 0 ∧ PlanarUnitDistances.CurveReflection.reflect f = MvPolynomial.C c * f) ∧
                (∀ (x : PlanarUnitDistances.CurveReflection.Point),
                    (MvPolynomial.eval (PlanarUnitDistances.CurveReflection.reflectPoint x)) f = 0 ↔
                      (MvPolynomial.eval x) f = 0) ∧
                  MvPolynomial.degreeOf 0 f = MvPolynomial.degreeOf 1 f
Lean source · PlanarUnitDistances/CurveReflection.lean, lines 72–95
/-- Invariance up to a nonzero constant factor, and invariance of the entire
complex zero set, with equality of the separate z and w degrees. -/
theorem rich_curve_symmetry (f : Poly) (hf : Irreducible f) {D : ℕ} (hd : f.totalDegree ≤ D)
    (S : Finset Plane) (hS : D^2 < S.card) (hz : ∀ p ∈ S, eval (realPoint p) f = 0) :
    (∃ c : ℂ, c ≠ 0 ∧ reflect f = C c * f) ∧
      (∀ x : Point, eval (reflectPoint x) f = 0 ↔ eval x f = 0) ∧ f.degreeOf 0 = f.degreeOf 1 := by
  obtain ⟨u,hu⟩ := (rich_curve_associated f hf hd S hS hz).2
  obtain ⟨c,hc,he⟩ := isUnit_iff_eq_C_of_isReduced.mp u.isUnit
  have hfactor : reflect f = C c * f := by rw [← hu, he, mul_comm]
  have hcn : c ≠ 0 := hc.ne_zero
  refine ⟨⟨c,hcn,hfactor⟩, ?_, ?_⟩
  · intro x
    have hh := reflect_eval x f
    rw [hfactor, map_mul, eval_C] at hh
    constructor
    · intro h
      rw [h,mul_zero] at hh
      exact star_eq_zero.mp hh.symm
    · intro h
      rw [h,map_zero] at hh
      exact (mul_eq_zero.mp hh).resolve_left hcn
  · have hdeg := reflect_degreeOf 0 f
    rw [hfactor, degreeOf_C_mul _ _ (mem_nonZeroDivisors_of_ne_zero hcn)] at hdeg
    simpa [flip] using hdeg.symm

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CurveReflection.rich_curve_associated

∀ (f : PlanarUnitDistances.CurveReflection.Poly),
  Irreducible f →
    ∀ {D : ℕ},
      MvPolynomial.totalDegree f ≤ D →
        ∀ (S : Finset OAI.PlanarUnitDistances.Plane),
          D ^ 2 < S.card →
            (∀ p ∈ S, (MvPolynomial.eval (PlanarUnitDistances.CurveReflection.realPoint p)) f = 0) →
              f ∣ PlanarUnitDistances.CurveReflection.reflect f ∧
                Associated f (PlanarUnitDistances.CurveReflection.reflect f)
Lean source · PlanarUnitDistances/CurveReflection.lean, lines 57–70
/-- The degree-D threshold forces divisibility in the polynomial ring itself,
and hence association because reflection preserves irreducibility. -/
theorem rich_curve_associated (f : Poly) (hf : Irreducible f) {D : ℕ} (hd : f.totalDegree ≤ D)
    (S : Finset Plane) (hS : D^2 < S.card) (hz : ∀ p ∈ S, eval (realPoint p) f = 0) :
    f ∣ reflect f ∧ Associated f (reflect f) := by
  have hdvd : f ∣ reflect f := by
    by_contra hn
    have h := PlaneBezout.common_zeros f (reflect f) hf hn (S.map realPoint)
      (by rintro x hx; obtain ⟨p,hp,rfl⟩ := Finset.mem_map.mp hx; exact hz p hp)
      (by rintro x hx; obtain ⟨p,hp,rfl⟩ := Finset.mem_map.mp hx
          rw [← realPoint_fixed p, reflect_eval, hz p hp, map_zero])
    rw [Finset.card_map, reflect_degree] at h
    exact (not_lt_of_ge ((h.trans (Nat.mul_le_mul hd hd)).trans_eq (pow_two D).symm)) hS
  exact ⟨hdvd, hf.associated_of_dvd ((MulEquiv.irreducible_iff reflect).mpr hf) hdvd⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CurveReflection.rich_curve_nonconstant_projections

∀ (f : PlanarUnitDistances.CurveReflection.Poly),
  Irreducible f →
    ∀ {D : ℕ},
      MvPolynomial.totalDegree f ≤ D →
        ∀ (S : Finset OAI.PlanarUnitDistances.Plane),
          D ^ 2 < S.card →
            (∀ p ∈ S, (MvPolynomial.eval (PlanarUnitDistances.CurveReflection.realPoint p)) f = 0) →
              ∃ p ∈ S,
                ∃ q ∈ S,
                  (MvPolynomial.eval (PlanarUnitDistances.CurveReflection.realPoint p)) f = 0 ∧
                    (MvPolynomial.eval (PlanarUnitDistances.CurveReflection.realPoint q)) f = 0 ∧
                      ∀ (j : Fin 2),
                        PlanarUnitDistances.CurveReflection.realPoint p j ≠
                          PlanarUnitDistances.CurveReflection.realPoint q j
Lean source · PlanarUnitDistances/CurveReflection.lean, lines 97–115
/-- Two distinct real-plane points always have different z coordinates and
different w coordinates. Hence both coordinate projections on the *whole*
curve are nonconstant, witnessed by the same two real points. -/
theorem rich_curve_nonconstant_projections (f : Poly) (hf : Irreducible f) {D : ℕ} (hd : f.totalDegree ≤ D)
    (S : Finset Plane) (hS : D^2 < S.card) (hz : ∀ p ∈ S, eval (realPoint p) f = 0) :
    ∃ p ∈ S, ∃ q ∈ S, eval (realPoint p) f = 0 ∧ eval (realPoint q) f = 0 ∧
      ∀ j : Fin 2, realPoint p j ≠ realPoint q j := by
  have hpos : 0 < f.totalDegree := by
    by_contra! h
    have he := totalDegree_eq_zero_iff_eq_C.mp (Nat.eq_zero_of_le_zero h)
    have hcoeff : f.coeff 0 ≠ 0 := fun hc ↦ hf.ne_zero (by simpa [hc] using he)
    exact hf.not_isUnit (isUnit_iff_eq_C_of_isReduced.mpr ⟨_, isUnit_iff_ne_zero.mpr hcoeff, he⟩)
  have hone : 1 ≤ D^2 := Nat.one_le_pow _ _ (hpos.trans_le hd)
  obtain ⟨p,hp,q,hq,hpq⟩ := Finset.one_lt_card.mp (hone.trans_lt hS)
  refine ⟨p,hp,q,hq,hz p hp,hz q hq,?_⟩
  intro j
  fin_cases j
  · exact zCoord_injective.ne hpq
  · exact Complex.conjAe.injective.ne (zCoord_injective.ne hpq)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.43 A reflected translated hyperbola with parameter one

Lean verified

Suppose the complex curve ( z − u ) ( w − v ) = b is invariant under ( z , w ) ↦ ( w ― , z ― ) . Then v = u ― and b is real. For b = 1 , its real points are exactly the Euclidean unit circle centered at the real point corresponding to u .

Proof

For real t ≠ 0 , reflect the point ( u + t , v + b / t ) and multiply its equation by t . The resulting quadratic in t has leading coefficient v ― − u and middle coefficient ( v ― − u ) ( u ― − v ) + b ― − b . Its values at 1 , 2 , 3 vanish, forcing v ― = u and b ― = b . For b = 1 and w = z ― , the equation becomes ( z − u ) ( z − u ) ― = 1 , the squared Euclidean distance equation for the specified center.

Inspect the Lean declarations

PlanarUnitDistances.CurveReflection.hyperbola_one_is_unit_circle

∀ (u v : ℂ),
  (∀ (z w : ℂ), (z - u) * (w - v) = 1 → ((starRingEnd ℂ) w - u) * ((starRingEnd ℂ) z - v) = 1) →
    ∃ center,
      PlanarUnitDistances.zCoord center = u ∧
        ∀ (p : OAI.PlanarUnitDistances.Plane),
          (PlanarUnitDistances.zCoord p - u) * ((starRingEnd ℂ) (PlanarUnitDistances.zCoord p) - v) = 1 ↔
            dist p center = 1
Lean source · PlanarUnitDistances/CurveReflection.lean, lines 141–157
/-- In the exceptional case β=1 the original real points describe the usual
Euclidean unit circle, including its radius and its center. -/
theorem hyperbola_one_is_unit_circle (u v : ℂ)
    (hsym : ∀ z w : ℂ, (z-u)*(w-v)=1 → (conj w-u)*(conj z-v)=1) :
    ∃ center : Plane, zCoord center = u ∧ ∀ p : Plane,
      (zCoord p-u)*(conj (zCoord p)-v)=1 ↔ dist p center = 1 := by
  have hv := (hyperbola_center u v 1 hsym).1
  let center := WithLp.toLp 2 ![u.re,u.im]
  have hc : zCoord center = u := by apply Complex.ext <;> rfl
  refine ⟨center,hc,fun p ↦ ?_⟩
  rw [hv, ← hc, ← map_sub, Complex.mul_conj, zCoord_sub_normSq]
  constructor
  · intro h
    have h' : dist p center ^ 2 = 1 := by exact_mod_cast h
    nlinarith [dist_nonneg (x := p) (y := center)]
  · intro h
    simp [h]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CurveReflection.hyperbola_center

∀ (u v b : ℂ),
  (∀ (z w : ℂ), (z - u) * (w - v) = b → ((starRingEnd ℂ) w - u) * ((starRingEnd ℂ) z - v) = b) →
    v = (starRingEnd ℂ) u ∧ (starRingEnd ℂ) b = b
Lean source · PlanarUnitDistances/CurveReflection.lean, lines 117–139
/-- A reflection-symmetric translated hyperbola has
conjugate centers and real parameter. The normalized mixed coefficient removes
the scalar ambiguity in the equation. -/
theorem hyperbola_center (u v b : ℂ)
    (hsym : ∀ z w : ℂ, (z-u)*(w-v)=b → (conj w-u)*(conj z-v)=b) :
    v = conj u ∧ conj b = b := by
  have he (t : ℂ) (ht : t ≠ 0) :=
    hsym (u+t) (v+b/t) (by field_simp; ring)
  have hx (t : ℝ) (ht : t ≠ 0) :
      (conj v-u) * (t : ℂ)^2 +
        ((conj v-u)*(conj u-v) + conj b - b) * t + conj b * (conj u-v) = 0 := by
    have h := he (t:ℂ) (by exact_mod_cast ht)
    simp only [map_add, map_div₀, Complex.conj_ofReal] at h
    field_simp [Complex.ofReal_ne_zero.mpr ht] at h
    linear_combination h
  have h₁ := hx 1 (by norm_num)
  have h₂ := hx 2 (by norm_num)
  have h₃ := hx 3 (by norm_num)
  norm_num only [Complex.ofReal_one, Complex.ofReal_ofNat] at h₁ h₂ h₃
  have hcenter : conj v - u = 0 := by linear_combination (h₃ - 2*h₂ + h₁)/2
  have hv : v = conj u := by
    simpa using congrArg conj (sub_eq_zero.mp hcenter)
  exact ⟨hv,by rw [hcenter, ← hv] at h₁; simpa [sub_eq_zero] using h₁⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.44 Simultaneous nonvanishing on the twelve-curve product

Lean verified

Let W = C f 8 × C g 4 be the product in the original twenty-four coordinates for an admissible pair of curves. If each of two polynomials is nonzero somewhere on W , there is one tuple in W where their product is nonzero. The individual witnesses may differ.

Proof

For two polynomials F , G , put D = max ( deg ⁡ f , deg ⁡ g ) . After indexing the twelve slots by { 1 , … , 12 } , take N = 12 D ( deg ⁡ F + deg ⁡ G ) + 1 points in each slot. Each curve has infinitely many abscissas. Lemma 5.45 bounds the number of grid points where F or G vanishes by 12 D ( deg ⁡ F + deg ⁡ G ) N 11 < N 12 . A tuple outside the union of these two zero sets works, with no restriction on where the two input witnesses lie.

Inspect the Lean declarations

PlanarUnitDistances.Competition.GenericCurvePoint.nonzero_product_on_curves

∀ {f g : PlanarUnitDistances.Competition.Poly₂},
  PlanarUnitDistances.Competition.CurvePair f g →
    ∀ {F G : MvPolynomial PlanarUnitDistances.Competition.Coord ℂ},
      (∃ x ∈ PlanarUnitDistances.Competition.curveProduct f g, (MvPolynomial.eval x) F ≠ 0) →
        (∃ x ∈ PlanarUnitDistances.Competition.curveProduct f g, (MvPolynomial.eval x) G ≠ 0) →
          ∃ x ∈ PlanarUnitDistances.Competition.curveProduct f g, (MvPolynomial.eval x) (F * G) ≠ 0
Lean source · PlanarUnitDistances/SimultaneousCurveNonvanishing.lean, lines 55–94
/-- Two nonvanishing witnesses on the original twelve-curve product give
one simultaneous witness. A polynomial of either factor may vanish on
the witness supplied for the other. -/
theorem nonzero_product_on_curves {f g : Poly₂} (pair : CurvePair f g) {F G : MvPolynomial Coord ℂ}
    (hF : ∃ x∈curveProduct f g,eval x F≠0) (hG : ∃ x∈curveProduct f g,eval x G≠0) :
    ∃ x∈curveProduct f g,eval x (F*G)≠0 := by
  let e : Slot ≃ Fin 12 := finSumFinEquiv
  let h (s : Slot) : Poly₂ := s.elim (fun _ => f) (fun _ => g)
  let B (i : Fin 12) := h (e.symm i)
  have either (s : Slot) : h s=f ∨ h s=g := by cases s <;> simp [h]
  have irr (i : Fin 12) := (pair.1 (B i) (either _)).1
  have degree (i : Fin 12) : (B i).totalDegree ≤ max f.totalDegree g.totalDegree := by
    rcases either (e.symm i) with eq|eq
    · exact (congrArg totalDegree eq).trans_le (le_max_left ..)
    · exact (congrArg totalDegree eq).trans_le (le_max_right ..)
  have sample (n i) := curve_sample (irr i) ((pair.1 (B i) (either _)).2.2 0) n
  let index (b : Coord) : Fin 12 × Fin 2 := (e b.1,b.2)
  let flat (w : ∀i,Curve (B i)) : GridTuple := fun b => (w (e b.1)).val b.2
  have on (x : GridTuple) (hx : x∈curveProduct f g) (s : Slot) : eval (fun d => x (s,d)) (h s)=0 := by
    cases s with
    | inl i => exact hx.1 i
    | inr j => exact hx.2 j
  let lift (x : GridTuple) (hx : x∈curveProduct f g) (i : Fin 12) : Curve (B i) :=
    ⟨fun d => x (e.symm i,d),on x hx _⟩
  have flat_lift (x : GridTuple) (hx : x∈curveProduct f g) : flat (lift x hx)=x := by
    funext b
    simp [flat,lift]
  have ev (w : ∀i,Curve (B i)) (H : MvPolynomial Coord ℂ) :
      eval (coords fun i => (w i).val) (rename index H)=eval (flat w) H := by
    rw [eval_rename]; rfl
  have witness (H : MvPolynomial Coord ℂ) (hw : ∃x∈curveProduct f g,eval x H≠0) :
      ∃w : ∀i,Curve (B i),eval (coords fun i => (w i).val) (rename index H)≠0 := by
    obtain ⟨x,hx,nz⟩ := hw
    exact ⟨lift x hx,by rwa [ev,flat_lift]⟩
  obtain ⟨w,nz⟩ := avoid_two_on_product B irr _ degree sample _ _ (witness F hF) (witness G hG)
  have eq (s : Slot) : eval (fun d => flat w (s,d)) (h s)=0 := by
    simpa only [flat,B,Equiv.symm_apply_apply] using (w (e s)).prop
  refine ⟨flat w,⟨fun i => eq (.inl i),fun j => eq (.inr j)⟩,?_⟩
  rw [←map_mul] at nz
  rwa [ev] at nz

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.45 Witness slicing on a product of curves

Lean verified

Take s irreducible affine plane curves, each of degree at most D . Sample at most n points on each curve. If a polynomial of total degree at most E is nonzero somewhere on the product, it has at most s D E n s − 1 zeros in the product of the samples.

Proof

Fix a witness w anywhere on the product. Slice the polynomial in its first plane coordinate, holding the remaining coordinates fixed. Substituting constants for the other positions preserves the degree bound, which follows by expanding in monomials. On each tail where the polynomial is nonzero at w 1 , Lemma 5.41 bounds the sampled zeros by D E . On each remaining tail there are at most n . With w 1 fixed, the remaining polynomial is still nonzero at the tail of w . Induction bounds the exceptional tails by ( s − 1 ) D E n s − 2 for s ≥ 2 . The resulting count is D E n s − 1 + n ( s − 1 ) D E n s − 2 ; the proof handles zero factors and empty samples directly.

Inspect the Lean declarations

PlanarUnitDistances.CurveProduct.zeros_on_product

∀ {k : Type u_1} [inst : Field k] {s : ℕ} (B : Fin s → MvPolynomial (Fin 2) k),
  (∀ (i : Fin s), Irreducible (B i)) →
    ∀ (F : MvPolynomial (Fin s × Fin 2) k) (D E n : ℕ),
      (∀ (i : Fin s), (B i).totalDegree ≤ D) →
        F.totalDegree ≤ E →
          ∀ (S : (i : Fin s) → Finset (PlanarUnitDistances.CurveProduct.Curve (B i))),
            (∀ (i : Fin s), (S i).card ≤ n) →
              ∀ (w : (i : Fin s) → PlanarUnitDistances.CurveProduct.Curve (B i)),
                (MvPolynomial.eval (PlanarUnitDistances.CurveProduct.coords fun i => ↑(w i))) F ≠ 0 →
                  {x ∈ Fintype.piFinset S |
                        (MvPolynomial.eval (PlanarUnitDistances.CurveProduct.coords fun i => ↑(x i))) F =
                          0}.card ≤
                    s * D * E * n ^ (s - 1)
Lean source · PlanarUnitDistances/CurveProduct.lean, lines 43–78
/-- Manuscript product-of-curves zero count, with actual irreducible plane equations
and an actual ambient polynomial. A witness on the product may lie outside the samples. -/
theorem zeros_on_product (B : Fin s → MvPolynomial (Fin 2) k)
    (hB : ∀ i, Irreducible (B i)) (F : MvPolynomial (Fin s × Fin 2) k)
    (D E n : ℕ) (hD : ∀ i, (B i).totalDegree ≤ D) (hE : F.totalDegree ≤ E)
    (S : ∀ i, Finset (Curve (B i))) (size : ∀ i, (S i).card ≤ n)
    (w : ∀ i, Curve (B i)) (hw : eval (coords fun i => (w i).val) F ≠ 0) :
    ((Fintype.piFinset S).filter fun x => eval (coords fun i => (x i).val) F = 0).card ≤
      s * D * E * n^(s-1) := by
  classical
  refine ProductZeros.curve_product_bound (fun i => Curve (B i)) S
    (fun x => eval (coords fun i => (x i).val) F) D E n size ?_ w hw
  intro x i hx
  let v : Fin s → Point k := fun j => (x j).val
  let G := eval₂Hom C (axis v i) F
  have eg (t : Curve (B i)) : eval t.val G =
      eval (coords fun j => ((Function.update x i t) j).val) F := by
    rw [show eval t.val G = eval (coords (Function.update v i t.val)) F from slice_eval ..]
    congr 2
    funext ⟨j,b⟩
    by_cases h : j=i
    · subst j; simp [coords]
    · simp [coords,v,h]
  have hnd : ¬ B i ∣ G := by
    rintro ⟨H,hH⟩
    have hz : eval (x i).val G = 0 := by rw [hH,map_mul,(x i).prop,zero_mul]
    rw [eg,Function.update_eq_self] at hz
    exact hx hz
  let A := (S i).filter fun t => eval (coords fun j => ((Function.update x i t) j).val) F = 0
  let emb : Curve (B i) ↪ Point k := ⟨Subtype.val,Subtype.val_injective⟩
  have count := PlaneBezout.common_zeros (B i) G (hB i) hnd (A.map emb)
    (by intro t ht; obtain ⟨y,_,rfl⟩ := mem_map.mp ht; exact y.prop)
    (by intro t ht; obtain ⟨y,hy,rfl⟩ := mem_map.mp ht; exact (eg y).trans (mem_filter.mp hy).2)
  have deg : G.totalDegree ≤ E := (degree_after_linear_substitution F (axis v i)
    (fun b => by unfold axis; split <;> simp)).trans hE
  exact (by simpa only [card_map] using count : A.card ≤ _).trans (Nat.mul_le_mul (hD i) deg)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CurveProduct.degree_after_linear_substitution

∀ {k : Type u_1} [inst : Field k] {ι : Type u_2} {τ : Type u_3} (F : MvPolynomial ι k)
  (L : ι → MvPolynomial τ k),
  (∀ (i : ι), (L i).totalDegree ≤ 1) →
    ((MvPolynomial.eval₂Hom MvPolynomial.C L) F).totalDegree ≤ F.totalDegree
Lean source · PlanarUnitDistances/CurveProduct.lean, lines 12–25
/-- Substitution of affine-linear expressions cannot increase total degree. -/
theorem degree_after_linear_substitution {ι τ : Type*} (F : MvPolynomial ι k)
    (L : ι → MvPolynomial τ k) (hL : ∀ i, (L i).totalDegree ≤ 1) :
    (eval₂Hom C L F).totalDegree ≤ F.totalDegree := by
  classical
  conv_lhs => rw [F.as_sum,map_sum]
  apply totalDegree_finsetSum_le
  intro a ha
  rw [coe_eval₂Hom,eval₂_monomial]
  refine (totalDegree_mul ..).trans ?_
  simp only [totalDegree_C,zero_add]
  refine (totalDegree_finsetProd ..).trans ((sum_le_sum ?_).trans (le_totalDegree ha))
  intro j _
  exact (totalDegree_pow _ _).trans (by simpa using Nat.mul_le_mul_left (a j) (hL j))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ProductZeros.card_zeros_le

∀ {s : ℕ} (C : Fin s → Type u_1) (S : (i : Fin s) → Finset (C i)) (Z : ((i : Fin s) → C i) → Prop)
  [inst : DecidablePred Z] (m n : ℕ),
  (∀ (i : Fin s), (S i).card ≤ n) →
    (∀ (x : (i : Fin s) → C i) (i : Fin s), ¬Z x → {t ∈ S i | Z (Function.update x i t)}.card ≤ m) →
      ∀ (w : (i : Fin s) → C i), ¬Z w → (Finset.filter Z (Fintype.piFinset S)).card ≤ s * m * n ^ (s - 1)
Lean source · PlanarUnitDistances/ProductZeros.lean, lines 14–83
/-- Count zero tuples in an arbitrary finite box. The predicate and the
nonzero witness live on the entire ambient product. The witness need not
belong to the sampled box. -/
theorem card_zeros_le {s : ℕ} (C : Fin s → Type*) (S : ∀ i, Finset (C i))
    (Z : (∀ i, C i) → Prop) [DecidablePred Z] (m n : ℕ)
    (size : ∀ i, (S i).card ≤ n)
    (slice : ∀ (x : ∀ i, C i) (i : Fin s), ¬ Z x →
      ((S i).filter fun t => Z (Function.update x i t)).card ≤ m)
    (w : ∀ i, C i) (hw : ¬ Z w) :
    ((piFinset S).filter Z).card ≤ s * m * n ^ (s - 1) := by
  classical
  induction s with
  | zero =>
    have h : (piFinset S).filter Z = ∅ := by
      apply filter_eq_empty_iff.mpr
      intro x _ hx
      exact hw (Subsingleton.elim x w ▸ hx)
    rw [h, Finset.card_empty]
    exact Nat.zero_le _
  | succ s ih =>
    let T := piFinset (Fin.tail S)
    let Z' (t : ∀ j : Fin s, C j.succ) := Z (Fin.cons (w 0) t)
    have htail : (T.filter Z').card ≤ s * m * n ^ (s - 1) := by
      refine ih _ (Fin.tail S) Z' (fun j => size j.succ) ?_ (Fin.tail w) ?_
      · intro x i hx
        simpa only [Z', Fin.cons_update, Fin.tail] using slice (Fin.cons (w 0) x) i.succ hx
      · simpa [Z'] using hw
    let roots := (piFinset S).filter Z
    have intoT : (roots : Set (∀ i, C i)).MapsTo Fin.tail T := by
      intro x hx
      exact (Fin.mem_piFinset_iff_zero_tail.mp (mem_filter.mp hx).1).2
    have bound (t : ∀ j : Fin s, C j.succ) :
        (roots.filter fun x => Fin.tail x = t).card ≤ m + (if Z' t then n else 0) := by
      have hcard : (roots.filter fun x => Fin.tail x = t).card ≤
          ((S 0).filter fun a => Z (Fin.cons a t)).card := by
        apply card_le_card_of_injOn (fun x => x 0)
        · intro x hx
          obtain ⟨hx₁, ht⟩ := mem_filter.mp hx
          obtain ⟨hx₂, hxZ⟩ := mem_filter.mp hx₁
          exact mem_filter.mpr ⟨(mem_piFinset.mp hx₂) 0, by simpa [← ht] using hxZ⟩
        · intro x hx y hy hxy
          change x 0 = y 0 at hxy
          have ht : Fin.tail x = Fin.tail y := (mem_filter.mp hx).2.trans (mem_filter.mp hy).2.symm
          calc
            x = Fin.cons (x 0) (Fin.tail x) := (Fin.cons_self_tail x).symm
            _ = Fin.cons (y 0) (Fin.tail y) := by rw [hxy, ht]
            _ = y := Fin.cons_self_tail y
      by_cases hz : Z' t
      · exact hcard.trans ((card_filter_le _ _).trans ((size 0).trans (by simp [hz])))
      · have h := slice (Fin.cons (w 0) t) 0 hz
        simpa only [Fin.update_cons_zero, if_neg hz, add_zero] using hcard.trans
          (by simpa only [Fin.update_cons_zero] using h)
    have cardT : T.card ≤ n ^ s := by
      calc
        T.card = ∏ i : Fin s, (S i.succ).card := Fintype.card_piFinset _
        _ ≤ ∏ _ : Fin s, n := Finset.prod_le_prod' (fun i _ => size i.succ)
        _ = n ^ s := by simp
    change roots.card ≤ _
    calc
      roots.card = ∑ t ∈ T, (roots.filter fun x => Fin.tail x = t).card :=
        card_eq_sum_card_fiberwise intoT
      _ ≤ ∑ t ∈ T, (m + if Z' t then n else 0) := sum_le_sum fun t _ => bound t
      _ = T.card * m + (T.filter Z').card * n := by
        rw [sum_add_distrib, ← sum_filter Z' (fun _ => n)]
        simp
      _ ≤ n ^ s * m + (s * m * n ^ (s - 1)) * n := by gcongr
      _ = (s + 1) * m * n ^ (s + 1 - 1) := by
        cases s with
        | zero => simp
        | succ s => simp only [Nat.add_sub_cancel, pow_succ]; ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.46 Counting complete ordered grids

Lean verified

In a nonempty-sided bipartite graph with side sizes m , m ′ and edge count e 2 , the number of complete ordered 8 -by- 4 grids, allowing repetitions, is at least e 2 32 / ( m 24 ( m ′ ) 28 ) .

Proof

If d ( p ) is the common-neighbor count for an ordered eight-tuple, sum d ( p ) 4 and use convexity. The first moment is ∑ r d ( r ) 8 , which a second use of convexity bounds by e 2 8 / ( m ′ ) 7 . Lean proves the count for arbitrary grid sizes.

Inspect the Lean declarations

PlanarUnitDistances.GridCount.complete_grid_count

∀ {α : Type u_1} {β : Type u_2} [inst : Fintype α] [inst_1 : Fintype β] [Nonempty α] [Nonempty β]
  (E : α → β → Prop) [inst_4 : DecidableRel E] (N j : ℕ),
  ↑(Fintype.card α) ^ N * ↑(Fintype.card β) ^ j *
      (↑{ab | E ab.1 ab.2}.card / (↑(Fintype.card α) * ↑(Fintype.card β))) ^ (N * j) ≤
    ↑(PlanarUnitDistances.GridCount.grids E N j).card
Lean source · PlanarUnitDistances/GridCount.lean, lines 72–86
theorem complete_grid_count {α β : Type*} [Fintype α] [Fintype β]
    [Nonempty α] [Nonempty β] (E : α → β → Prop) [DecidableRel E] (N j : ℕ) :
    (Fintype.card α : ℝ)^N * (Fintype.card β : ℝ)^j *
      (((univ.filter fun ab : α × β => E ab.1 ab.2).card : ℝ) /
        ((Fintype.card α : ℝ) * (Fintype.card β : ℝ)))^(N*j)
      ≤ (grids E N j).card := by
  classical
  have h := complete_grid_density (fun a b => if E a b then (1 : ℝ) else 0)
    (by intros; split_ifs <;> norm_num) N j
  simp only [Finset.prod_boole, mem_univ, forall_const] at h
  rw [expect_pair_indicator, expect_pair_indicator] at h
  simp only [Fintype.card_fun, Fintype.card_fin, Nat.cast_pow] at h
  have hd : 0 < (Fintype.card α : ℝ)^N * (Fintype.card β : ℝ)^j := by positivity
  have hh := (le_div_iff₀ hd).mp h
  simpa only [grids, mul_comm] using hh

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.47 The original graph on the two retained curves

Lean verified

Let G satisfy the organized graph hypotheses, let n ≥ 2 10000 , and suppose e = | G | ≥ n 2 − 1 / 2000 . Assume the common neighbors of every four distinct anchors on either side lie on a nonzero polynomial of degree at most 80 in null coordinates. There exist subsets A , B of the original point set, on irreducible curves f , g of degree at most 80 , for which the actual edge set E 2 = G ∩ ( A × B ) satisfies

| E 2 | ≥ n 2 − 25 / 2000 ( 512 ⋅ 80 ) 6 , 80 2 < n 9 / 10 ≤ | E 2 | / n ≤ min ( | A | , | B | ) .

Both complex curves are invariant under ( z , w ) ↦ ( w ― , z ― ) and both projections are nonconstant on each curve. The curves cannot be the same real unit circle.

Proof

For u ≥ 1 / 16 , the threshold gives n u ≥ 2 625 ≥ 2 100 . Apply this to u = 1 − 1 / 2000 and u = 5 ( 2 − 1 / 2000 ) − 9 to obtain 16 n ≤ e and 16 n ≤ e 5 / ( 512 ⋅ 80 n 8 ) . Lemma 5.24 now applies, and 25 ( 2 − 1 / 2000 ) − 48 = 2 − 25 / 2000 . The loss ( 512 ⋅ 80 ) 6 < 2 100 is absorbed by n 1 / 10 − 25 / 2000 . Counting these same original edges gives | E 2 | ≤ | A | | B | and both side sizes are at most n . Apply Lemma 5.42 on the two real samples. If both curves were the unit circle with complex center c , Lemma 5.43 would identify its real points with the Euclidean unit circle at ( ℜ c , ℑ c ) . At least | A | ≥ n 9 / 10 original points would lie on it, and any member of the nonempty set E 2 would violate the original edge exclusion.

Inspect the Lean declarations

PlanarUnitDistances.GraphRestriction.retain

∀ {n : ℕ} {K : Type} [inst : Field K] [inst_1 : NumberField K] (G : PlanarUnitDistances.AdmissibleGraph n K),
  2 ^ 10000 ≤ n →
    ↑n ^ (2 - 1 / 2000) ≤ ↑(Finset.card G.edges) →
      PlanarUnitDistances.GraphRestriction.CurvesForRows G →
        Nonempty (PlanarUnitDistances.GraphRestriction.Restricted G)
Lean source · PlanarUnitDistances/GraphRestriction.lean, lines 173–233
/-- Assuming only the common-neighbor curves, the exact counterexample density
retains the asserted number of original edges on two rich symmetric curves.
The same vertex samples exclude a common Euclidean unit circle. -/
theorem retain (G : AdmissibleGraph n K) (hn : 2^10000 ≤ n)
    (dense : (n:ℝ)^(2-1/2000:ℝ) ≤ G.edges.card) (localCurves : CurvesForRows G) :
    Nonempty (Restricted G) := by
  have hnR : (2:ℝ)^10000 ≤ n := by exact_mod_cast hn
  have hn₀ : 0 < n := lt_of_lt_of_le (by positivity) hn
  have hnPos : 0 < (n:ℝ) := by exact_mod_cast hn₀
  have hd := prerequisites hnR dense
  have hcard : Fintype.card G.points ≤ n := by simpa using G.point_bound
  have hed : 16*n ≤ ∑ p, (rows G p).card := by rw [rows_count]; exact_mod_cast hd.1
  have hthick : (16:ℝ)*n ≤ ((∑ p, (rows G p).card : ℕ):ℝ)^5/(512*(80:ℝ)*n^8) := by
    rw [rows_count]; exact hd.2
  obtain ⟨f,g,hf,df,hg,dg,hE⟩ := restrict_to_two_curves hn₀ (by decide : 0<80)
    hcard hcard (fun p => realPoint p.val) (fun q => realPoint q.val) (rows G)
    hed hthick localCurves.1 localCurves.2
  let S := univ.filter fun p : G.points => eval (realPoint p.val) f = 0
  let T := univ.filter fun q : G.points => eval (realPoint q.val) g = 0
  let A := toPoints G S
  let B := toPoints G T
  let E := edgesOn G A B
  have den : (n:ℝ)^(2-25/2000:ℝ)/restrictionCost ≤ (E.card:ℝ) := by
    have hc : (E.card:ℝ) = ∑ q ∈ T, ((reverseRow (rows G) S q).card:ℝ) := by
      exact_mod_cast edgesOn_count G S T
    rw [hc]
    apply (density_after_restriction hnPos dense).trans
    rw [rows_count] at hE
    exact hE
  have hA : A ⊆ G.points := toPoints_subset G S
  have hB : B ⊆ G.points := toPoints_subset G T
  have hsize := card_le_card (filter_subset (fun e : Plane × Plane => e ∈ G.edges) (A×ˢB))
  rw [card_product] at hsize
  have eab : E.card ≤ A.card * B.card := hsize
  have hleft : (E.card:ℝ) / n ≤ A.card := by
    apply (div_le_iff₀ hnPos).mpr
    exact_mod_cast eab.trans (Nat.mul_le_mul_left _ ((card_le_card hB).trans G.point_bound))
  have hright : (E.card:ℝ) / n ≤ B.card := by
    apply (div_le_iff₀ hnPos).mpr
    rw [mul_comm]
    exact_mod_cast eab.trans (Nat.mul_le_mul_right _ ((card_le_card hA).trans G.point_bound))
  obtain ⟨hdegree,hcircle⟩ := retained_threshold hnR den
  have manyA : 80^2 < A.card := by exact_mod_cast hdegree.trans_le (hcircle.trans hleft)
  have manyB : 80^2 < B.card := by exact_mod_cast hdegree.trans_le (hcircle.trans hright)
  have onA (p : Plane) (hp : p ∈ A) : eval (realPoint p) f = 0 := by
    obtain ⟨q,hq,rfl⟩ := mem_map.mp hp
    exact (mem_filter.mp hq).2
  have onB (p : Plane) (hp : p ∈ B) : eval (realPoint p) g = 0 := by
    obtain ⟨q,hq,rfl⟩ := mem_map.mp hp
    exact (mem_filter.mp hq).2
  refine ⟨⟨A,B,f,g,hA,hB,rich_side A f hf df onA manyA,rich_side B g hg dg onB manyB,
    den,hleft,hright,hcircle,?_⟩⟩
  rintro ⟨c,ac,bc⟩
  have hpos : 0 < (E.card:ℝ) := lt_of_lt_of_le (by
    exact div_pos (Real.rpow_pos_of_pos hnPos _) (by norm_num [restrictionCost,curveDegree])) den
  obtain ⟨e,he⟩ := card_pos.mp (show 0 < E.card by exact_mod_cast hpos)
  obtain ⟨hab,hG⟩ := mem_filter.mp he
  obtain ⟨ha,hb⟩ := mem_product.mp hab
  have hlt := G.circle e.1 e.2 hG c (ac _ ha) (bc _ hb)
  have hsub : A ⊆ G.points.filter (fun p => dist p c = 1) := fun p hp => mem_filter.mpr ⟨hA hp,ac p hp⟩
  exact (not_le_of_gt hlt) ((hcircle.trans hleft).trans (by exact_mod_cast card_le_card hsub))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.GraphRestriction.prerequisites

∀ {n e : ℝ}, 2 ^ 10000 ≤ n → n ^ (2 - 1 / 2000) ≤ e → 16 * n ≤ e ∧ 16 * n ≤ e ^ 5 / (512 * 80 * n ^ 8)
Lean source · PlanarUnitDistances/GraphRestriction.lean, lines 25–46
/-- Both density prerequisites of the two successive curve restrictions. -/
theorem prerequisites {n e : ℝ} (hn : (2:ℝ)^10000 ≤ n) (he : n^(2-1/2000:ℝ) ≤ e) :
    16*n ≤ e ∧ 16*n ≤ e^5 / (512*80*n^8) := by
  have hn₀ : 0 < n := lt_of_lt_of_le (by positivity) hn
  constructor
  · calc
      16*n ≤ n^(1-1/2000:ℝ)*n := by
        gcongr; exact (by norm_num : (16:ℝ) ≤ 2^100).trans (threshold hn (by norm_num))
      _ = n^(2-1/2000:ℝ) := by
        conv_lhs => enter [2]; rw [← Real.rpow_one n]
        rw [← Real.rpow_add hn₀]; norm_num
      _ ≤ e := he
  · apply (le_div_iff₀ (by positivity)).mpr
    calc
      16*n*(512*80*n^8) = (16*512*80)*n^9 := by ring
      _ ≤ n^((2-1/2000:ℝ)*5-9)*n^9 := by
        gcongr; exact (by norm_num : (16*512*80:ℝ) ≤ 2^100).trans (threshold hn (by norm_num))
      _ = (n^(2-1/2000:ℝ))^5 := by
        rw [← Real.rpow_natCast n 9, ← Real.rpow_add hn₀,
          show ((2-1/2000:ℝ)*5-9+((9:ℕ):ℝ))=(2-1/2000)*5 by norm_num,
          Real.rpow_mul hn₀.le, Real.rpow_ofNat]
      _ ≤ e^5 := pow_le_pow_left₀ (by positivity) he _

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.GraphRestriction.density_after_restriction

∀ {n e : ℝ},
  0 < n →
    n ^ (2 - 1 / 2000) ≤ e →
      n ^ (2 - 25 / 2000) / PlanarUnitDistances.CurveRestriction.restrictionCost ≤
        e ^ 25 / ((512 * 80) ^ 6 * n ^ 48)
Lean source · PlanarUnitDistances/GraphRestriction.lean, lines 48–59
/-- The lower bound left after both curve restrictions at the original graph exponent. -/
theorem density_after_restriction {n e : ℝ} (hn : 0<n) (he : n^(2-1/2000:ℝ) ≤ e) :
    n^(2-25/2000:ℝ)/restrictionCost ≤ e^25/((512*80)^6*n^48) := by
  have hk : 0 < restrictionCost := by norm_num [restrictionCost, curveDegree]
  apply (div_le_div_iff₀ hk (by positivity)).mpr
  calc
    n^(2-25/2000:ℝ)*((512*80)^6*n^48) = n^((2-1/2000:ℝ)*25)*restrictionCost := by
      rw [mul_comm ((512*80:ℝ)^6), ← mul_assoc, ← Real.rpow_natCast n 48,
        ← Real.rpow_add hn]
      norm_num [restrictionCost,curveDegree]
    _ = (n^(2-1/2000:ℝ))^25*restrictionCost := by rw [Real.rpow_mul hn.le, Real.rpow_ofNat]
    _ ≤ e^25*restrictionCost := mul_le_mul_of_nonneg_right (pow_le_pow_left₀ (by positivity) he _) hk.le

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.GraphRestriction.retained_threshold

∀ {n e₂ : ℝ},
  2 ^ 10000 ≤ n →
    n ^ (2 - 25 / 2000) / PlanarUnitDistances.CurveRestriction.restrictionCost ≤ e₂ →
      80 ^ 2 < n ^ (9 / 10) ∧ n ^ (9 / 10) ≤ e₂ / n
Lean source · PlanarUnitDistances/GraphRestriction.lean, lines 61–78
/-- Both point thresholds hold at the same retained density and the original n. -/
theorem retained_threshold {n e₂ : ℝ} (hn : (2:ℝ)^10000 ≤ n)
    (dense : n^(2-25/2000:ℝ)/restrictionCost ≤ e₂) :
    (80:ℝ)^2 < n^(9/10:ℝ) ∧ n^(9/10:ℝ) ≤ e₂/n := by
  have hn₀ : 0 < n := lt_of_lt_of_le (by positivity) hn
  have hk : 0 < restrictionCost := by norm_num [restrictionCost,curveDegree]
  refine ⟨(by norm_num : (80:ℝ)^2 < 2^100).trans_le (threshold hn (by norm_num)), ?_⟩
  apply (le_div_iff₀ hn₀).mpr
  apply le_trans _ dense
  apply (le_div_iff₀ hk).mpr
  have hcost : restrictionCost ≤ n^(1/10-25/2000:ℝ) :=
    (by norm_num [restrictionCost,curveDegree] : restrictionCost ≤ (2:ℝ)^100).trans
      (threshold hn (by norm_num))
  calc
    n^(9/10:ℝ)*n*restrictionCost ≤ n^(9/10:ℝ)*n*n^(1/10-25/2000:ℝ) := by gcongr
    _ = n^(2-25/2000:ℝ) := by
      conv_lhs => enter [1,2]; rw [← Real.rpow_one n]
      rw [← Real.rpow_add hn₀, ← Real.rpow_add hn₀]; norm_num

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.GraphRestriction.rows_count

∀ {n : ℕ} {K : Type} [inst : Field K] [inst_1 : NumberField K] (G : PlanarUnitDistances.AdmissibleGraph n K),
  ∑ p, (PlanarUnitDistances.GraphRestriction.rows G p).card = Finset.card G.edges
Lean source · PlanarUnitDistances/GraphRestriction.lean, lines 121–129
theorem rows_count (G : AdmissibleGraph n K) :
    ∑ p, (rows G p).card = G.edges.card := by
  have hc := edgesOn_count G univ univ
  simp only [all_points, all_edges] at hc
  rw [hc]
  let rel (p q : G.points) := (p.val,q.val) ∈ G.edges
  have eq := sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow
    (s := (univ : Finset G.points)) (t := univ) rel
  simpa [bipartiteAbove, bipartiteBelow, rel, rows, reverseRow] using eq

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.GraphRestriction.Restricted.curve_pair

∀ {n : ℕ} {K : Type} [inst : Field K] [inst_1 : NumberField K] {G : PlanarUnitDistances.AdmissibleGraph n K}
  (R : PlanarUnitDistances.GraphRestriction.Restricted G), PlanarUnitDistances.GridLocus.curvePair R.f R.g
Lean source · PlanarUnitDistances/GraphRestriction.lean, lines 236–256
/-- The precise pair-of-curves hypothesis for the exceptional grid theorem. -/
theorem Restricted.curve_pair {G : AdmissibleGraph n K} (R : Restricted G) :
    GridLocus.curvePair R.f R.g := by
  constructor
  · have side (f : CurveReflection.Poly) (A : Finset Plane) (d : RichSide A f) :
        Irreducible f ∧ (∀ p, eval p f = 0 ↔ eval (reflectPoint p) f = 0) ∧
          ∀ j : Fin 2, ∃ p q : CurveReflection.Point, eval p f=0 ∧ eval q f=0 ∧ p j ≠ q j := by
      refine ⟨d.irred,fun p => (d.symmetry p).symm,?_⟩
      obtain ⟨p,hp,q,hq,h⟩ := d.projections
      exact fun j => ⟨_,_,d.vanishes p hp,d.vanishes q hq,h j⟩
    intro f hf
    simp only [mem_insert,mem_singleton] at hf
    rcases hf with rfl|rfl
    · exact side _ _ R.left
    · exact side _ _ R.right
  · rintro ⟨c,eq⟩
    obtain ⟨v,_,hv⟩ := hyperbola_one_is_unit_circle c (conj c) (fun z w h => by
      simpa [mul_comm] using congrArg conj h)
    apply R.no_common_circle
    exact ⟨v,fun p hp => (hv p).mp ((eq (realPoint p)).1.mp (R.left.vanishes p hp)),
      fun q hq => (hv q).mp ((eq (realPoint q)).2.mp (R.right.vanishes q hq))⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 5.48 Common-neighbor curves and ordered grids in the original graph

Lean verified

Suppose every complete ordered grid in the original graph whose two sides have size at least two and at least one side has size at most four has a tangent moving every assigned ratio in the fixed-quotient fibre. Each set of four distinct anchors on either side then has all its common neighbors on one nonzero polynomial of degree at most 80 in null coordinates. Every ordered complete eight-by-four grid, allowing repeated vertices, also satisfies the position compatibility predicate with its original ratios.

Proof

The dual-number lifts fix the original coordinates and ratios. Taking first derivatives gives one shared assignment of position and scalar velocities to the entire grid, with radicand root λ − 1 − λ . Under transposition, exchange the position velocities and negate both families of scalar velocities, preserving the equation. With four anchors and at least two common neighbors, apply Lemma 5.21 once using these shared anchor velocities. An empty set admits the polynomial 1 , and for a singleton a line through that point suffices. The invertible linear change from Cartesian to null coordinates preserves nonvanishing and does not increase total degree. On an eight-by-four grid the chord identity and the same differential equations verify the full compatibility predicate, with repetitions retained.

Inspect the Lean declarations

PlanarUnitDistances.MovingGrid.curvesForRows

∀ {n : ℕ} {K : Type} [inst : Field K] [inst_1 : NumberField K] {G : PlanarUnitDistances.AdmissibleGraph n K},
  PlanarUnitDistances.MovingGrid.Motion G → PlanarUnitDistances.GraphRestriction.CurvesForRows G
Lean source · PlanarUnitDistances/MovingGridAnchors.lean, lines 73–103
/-- The moving-tangent hypothesis implies the two concrete anchor hypotheses
for the restriction of the original graph, in both orientations. -/
theorem curvesForRows {G : AdmissibleGraph n K} (motion : Motion G) : CurvesForRows G := by
  constructor
  · intro a
    let S := common (rows G) a
    let p (i : S) : Plane := i.val.val
    let r (j : Fin 4) : Plane := (a j).val
    have hi : Function.Injective r := Subtype.val_injective.comp a.injective
    have edges (i : S) (j : Fin 4) : (p i,r j) ∈ G.edges := by
      have h : ∀ j, (p i,r j) ∈ G.edges := by
        simpa [S,common,rows,p,r] using i.prop
      exact h j
    obtain ⟨f,hf,df,hz⟩ := common_neighbor_curve p r hi (fun hc => by
      obtain ⟨L⟩ := motion S (Fin 4) p r hc (by decide) (Or.inr (by decide)) edges
      exact ⟨_,L.equations⟩)
    exact ⟨f,hf,df,fun i h => hz ⟨i,h⟩⟩
  · intro a
    let T := common (reverseRow (rows G) Finset.univ) a
    let p (i : Fin 4) : Plane := (a i).val
    let r (j : T) : Plane := j.val.val
    have hi : Function.Injective p := Subtype.val_injective.comp a.injective
    have edges (i : Fin 4) (j : T) : (p i,r j) ∈ G.edges := by
      have h : ∀ i, (p i,r j) ∈ G.edges := by
        simpa [T,common,reverseRow,rows,p,r] using j.prop
      exact h i
    obtain ⟨f,hf,df,hz⟩ := common_neighbor_curve r p hi (fun hc => by
      obtain ⟨L⟩ := motion (Fin 4) T p r (by decide) hc (Or.inl (by decide)) edges
      obtain ⟨e⟩ := L.equations
      exact ⟨_,⟨e.transpose⟩⟩)
    exact ⟨f,hf,df,fun j h => hz ⟨j,h⟩⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.MovingGrid.Lift.equations

∀ {n : ℕ} {K : Type} [inst : Field K] [inst_1 : NumberField K] {I J : Type}
  {G : PlanarUnitDistances.AdmissibleGraph n K} {p : I → OAI.PlanarUnitDistances.Plane}
  {r : J → OAI.PlanarUnitDistances.Plane} (L : PlanarUnitDistances.MovingGrid.Lift G p r),
  Nonempty
    (PlanarUnitDistances.MovingGrid.Equations p r fun i j =>
      PlanarUnitDistances.MovingGrid.signedRoot G (p i) (r j))
Lean source · PlanarUnitDistances/MovingGrid.lean, lines 62–78
theorem Lift.equations {G : AdmissibleGraph n K} {p : I → Plane} {r : J → Plane}
    (L : Lift G p r) : Nonempty (Equations p r (fun i j => signedRoot G (p i) (r j))) := by
  obtain ⟨A,a,eq⟩ := moving_grid_differential L.rowBase L.colBase L.rowPos L.colPos L.u L.m
    L.coeff L.system L.moving
  have hInv (i j) : (L.m i j).fst = (ratio G (p i) (r j))⁻¹ := by
    have inv := congrArg TrivSqZeroExt.fst (L.system.inverse i j)
    simp only [TrivSqZeroExt.fst_mul,TrivSqZeroExt.fst_one,L.ratio_fst] at inv
    have hn := left_ne_zero_of_mul_eq_one inv
    apply mul_left_cancel₀ hn
    simpa [hn] using inv
  refine ⟨⟨(fun i => ![(velocity (L.rowPos i)).1,(velocity (L.rowPos i)).2]),
    (fun j => ![(velocity (L.colPos j)).1,(velocity (L.colPos j)).2]),A,a,?_,?_⟩⟩
  · intro i j
    have e := eq i j
    rw [L.row_fst,L.col_fst,hInv,L.ratio_fst] at e
    exact ⟨e.2.1,e.1⟩
  · exact fun i j => sub_ne_zero.mp (eq i j).2.2

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.MovingGrid.Equations.transpose

{I J : Type} →
  {p : I → OAI.PlanarUnitDistances.Plane} →
    {r : J → OAI.PlanarUnitDistances.Plane} →
      {R : I → J → ℂ} →
        PlanarUnitDistances.MovingGrid.Equations p r R →
          PlanarUnitDistances.MovingGrid.Equations r p fun j i => R i j
Lean source · PlanarUnitDistances/MovingGrid.lean, lines 80–94
/-- Transposing a grid uses the same assigned root. Both scalar velocities
change sign, so that the row-minus-column difference is preserved. -/
def Equations.transpose {p : I → Plane} {r : J → Plane} {R : I → J → ℂ}
    (e : Equations p r R) : Equations r p (fun j i => R i j) where
  H := e.U
  U := e.H
  A := fun j => -e.a j
  a := fun i => -e.A i
  equation j i := by
    obtain ⟨h₁,h₂⟩ := e.equation i j
    dsimp only at h₁ h₂ ⊢
    constructor
    · linear_combination h₁
    · linear_combination h₂
  velocity_ne j i := fun h => e.velocity_ne i j (neg_injective h).symm

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.MovingGrid.compatible

∀ {n : ℕ} {K : Type} [inst : Field K] [inst_1 : NumberField K] {G : PlanarUnitDistances.AdmissibleGraph n K},
  PlanarUnitDistances.MovingGrid.Motion G →
    ∀ (p : Fin 8 → OAI.PlanarUnitDistances.Plane) (r : Fin 4 → OAI.PlanarUnitDistances.Plane),
      (∀ (i : Fin 8) (j : Fin 4), (p i, r j) ∈ G.edges) →
        PlanarUnitDistances.GridLocus.compatibleTuple
          (PlanarUnitDistances.GridLocus.join (⇑PlanarUnitDistances.CurveReflection.realPoint ∘ p)
            (⇑PlanarUnitDistances.CurveReflection.realPoint ∘ r))
Lean source · PlanarUnitDistances/MovingGrid.lean, lines 105–122
/-- The exact tuple predicate used by the exceptional-locus grid count,
on every ordered complete grid, including repeated positions. -/
theorem compatible {G : AdmissibleGraph n K} (motion : Motion G) (p : Fin 8 → Plane)
    (r : Fin 4 → Plane) (edges : ∀ i j, (p i,r j) ∈ G.edges) :
    GridLocus.compatibleTuple (GridLocus.join (realPoint ∘ p) (realPoint ∘ r)) := by
  obtain ⟨L⟩ := motion (Fin 8) (Fin 4) p r (by decide) (by decide) (Or.inr (by decide)) edges
  obtain ⟨e⟩ := L.equations
  refine ⟨(fun i j => ratio G (p i) (r j)),e.H,e.U,e.A,e.a,?_⟩
  intro i j
  change ratio G (p i) (r j) ≠ 0 ∧
    (zCoord (p i)-zCoord (r j))*(conj (zCoord (p i))-conj (zCoord (r j))) =
      2-ratio G (p i) (r j)-(ratio G (p i) (r j))⁻¹ ∧ _ ∧ _
  refine ⟨?_, ?_,e.velocity_ne i j,?_⟩
  · simpa only [ratio,map_zero] using G.embedding.injective.ne (G.nonzero _ _ (edges i j))
  · rw [←map_sub,Complex.mul_conj,zCoord_sub_normSq]
    exact G.chord _ _ (edges i j)
  · simpa only [GridLocus.join,Sum.elim_inl,Sum.elim_inr,Function.comp_apply,recover_cart,signedRoot]
      using (e.equation i j).2

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.MovingGrid.common_neighbor_curve

∀ {I : Type} [inst : Fintype I] (p : I → OAI.PlanarUnitDistances.Plane)
  (r : Fin 4 → OAI.PlanarUnitDistances.Plane),
  Function.Injective r →
    (2 ≤ Fintype.card I → ∃ R, Nonempty (PlanarUnitDistances.MovingGrid.Equations p r R)) →
      ∃ F,
        F ≠ 0 ∧
          MvPolynomial.totalDegree F ≤ 80 ∧
            ∀ (i : I), (MvPolynomial.eval (PlanarUnitDistances.CurveReflection.realPoint (p i))) F = 0
Lean source · PlanarUnitDistances/MovingGridAnchors.lean, lines 51–69
/-- The four anchors and their velocities are shared across the entire finite
set of source points. One degree-80 polynomial contains every point in null
coordinates, also when the set of rows is empty or a singleton. -/
theorem common_neighbor_curve {I : Type} [Fintype I] (p : I → Plane) (r : Fin 4 → Plane)
    (hr : Function.Injective r) (moving : 2 ≤ Fintype.card I →
      ∃ R : I → Fin 4 → ℂ, Nonempty (Equations p r R)) :
    ∃ F : CurveReflection.Poly, F≠0 ∧ F.totalDegree ≤ 80 ∧ ∀ i, eval (realPoint (p i)) F=0 := by
  by_cases hc : 2 ≤ Fintype.card I
  · obtain ⟨R,⟨e⟩⟩ := moving hc
    have hi : Complex.I^2 = -1 := Complex.I_sq
    obtain ⟨F,hF,df,zeros⟩ := four_anchor_curve Complex.I hi (cartPoint ∘ r) e.U e.a
      (cart_inj.comp hr)
    refine ⟨toNull Complex.I F,?_,(null_degree F).trans df,?_⟩
    · simpa only [map_zero] using (toNull_injective hi).ne hF
    · intro i
      rw [null_eval]
      exact zeros ℂ (RingHom.id ℂ) (cartPoint (p i)) (e.H i) (e.A i) (R i)
        (fun j => e.equation i j) (e.velocity_ne i 3)
  · exact trivial_curve p (by omega)

Kernel axioms used: propext, Classical.choice, Quot.sound.

5.5 The stationary equations needed for Theorem A

Lemma 5.49 Discarding the unselected primal equations

Lean verified

Let k be an algebraically closed field of characteristic zero. Write F e ( X ) for the original equations on n coordinates and f ( X ) for the output polynomial. Choose r indices e 1 , … , e r . In the polynomial ring in X , the multipliers t 1 , … , t r , and the output variable z , retain

F e ν ( X ) = 0 , ∂ h f ( X ) − ∑ ν = 1 r t ν ∂ h F e ν ( X ) = 0 , z − f ( X ) = 0 .

Suppose a prime P contains the full system, including every F e , and z − c ∈ P for some c ∈ k . There is a minimal prime Q of the retained system such that Q ⊆ P and z − c ∈ Q . In particular the retained system has n + r + 1 displayed equations in n + r + 1 variables. This count allows a positive-dimensional common zero set.

Proof

The retained equations belong to P . Choose a minimal prime Q of their ideal contained in P . In the function field of Q , differentiate the r retained equations. The multiplier identities give d f = 0 and the output equation gives d z = 0 . Characteristic zero and algebraic closedness make z equal to a scalar d ∈ k on Q . Passing to the quotient by P gives both z = c and z = d . The field k embeds in this nonzero quotient, so d = c . This last step is needed because dropping equations can enlarge the component.

Inspect the Lean declarations

PlanarUnitDistances.CriticalLocus.constant_on_selected_component

∀ {k : Type u_1} {X : Type u_2} {E : Type u_3} {R : Type u_4} [inst : Field k] [inst_1 : Fintype R]
  [Fintype X] [CharZero k] [IsAlgClosed k] (f : MvPolynomial X k) (g : E → MvPolynomial X k) (pick : R → E)
  (P : Ideal (MvPolynomial (PlanarUnitDistances.CriticalLocus.Variables X R) k)) [P.IsPrime],
  PlanarUnitDistances.CriticalLocus.incidenceIdeal f g pick ≤ P →
    ∀ (c : k),
      PlanarUnitDistances.CriticalLocus.outputVariable - MvPolynomial.C c ∈ P →
        ∃ Q ∈ (PlanarUnitDistances.CriticalLocus.selectedIdeal f g pick).minimalPrimes,
          Q ≤ P ∧ PlanarUnitDistances.CriticalLocus.outputVariable - MvPolynomial.C c ∈ Q
Lean source · PlanarUnitDistances/SelectedCriticalLocus.lean, lines 25–45
/-- Each component of the full multiplier system lies on a component of the
selected system with the same constant output. This uses constancy on the
larger component, including when the full component has smaller dimension. -/
theorem constant_on_selected_component [Fintype X] [CharZero k] [IsAlgClosed k]
    (f : MvPolynomial X k) (g : E → MvPolynomial X k) (pick : R → E)
    (P : Ideal (MvPolynomial (Variables X R) k)) [P.IsPrime]
    (hP : incidenceIdeal f g pick ≤ P) (c : k) (hc : outputVariable - C c ∈ P) :
    ∃ Q ∈ (selectedIdeal f g pick).minimalPrimes,
      Q ≤ P ∧ outputVariable - C c ∈ Q := by
  obtain ⟨Q, hQ, hQP⟩ := Ideal.exists_minimalPrimes_le ((selectedIdeal_le f g pick).trans hP)
  have := hQ.isPrime
  obtain ⟨d, hd⟩ := output_constant_mod_prime f (g ∘ pick) id Q hQ.le
  let q := Ideal.Quotient.mkₐ k P
  have coordinate (b : k) (hb : outputVariable - C b ∈ P) :
      q outputVariable = algebraMap k _ b := by
    have hz : q (outputVariable - C b) = 0 := Ideal.Quotient.eq_zero_iff_mem.mpr hb
    rw [map_sub, sub_eq_zero] at hz
    exact hz.trans (q.commutes b)
  have hcd : c = d := (algebraMap k _).injective
    ((coordinate c hc).symm.trans (coordinate d (hQP hd)))
  exact ⟨Q, hQ, hQP, hcd ▸ hd⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CriticalLocus.selectedIdeal

{k : Type u_1} →
  {X : Type u_2} →
    {E : Type u_3} →
      {R : Type u_4} →
        [inst : Field k] →
          [Fintype R] →
            MvPolynomial X k →
              (E → MvPolynomial X k) →
                (R → E) → Ideal (MvPolynomial (PlanarUnitDistances.CriticalLocus.Variables X R) k)
Lean source · PlanarUnitDistances/SelectedCriticalLocus.lean, lines 10–13
/-- Keep the chosen primal equations, their multiplier equations, and the output equation. -/
def selectedIdeal (f : MvPolynomial X k) (g : E → MvPolynomial X k) (pick : R → E) :
    Ideal (MvPolynomial (Variables X R) k) :=
  incidenceIdeal f (g ∘ pick) id

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CriticalLocus.selectedIdeal_le

∀ {k : Type u_1} {X : Type u_2} {E : Type u_3} {R : Type u_4} [inst : Field k] [inst_1 : Fintype R]
  (f : MvPolynomial X k) (g : E → MvPolynomial X k) (pick : R → E),
  PlanarUnitDistances.CriticalLocus.selectedIdeal f g pick ≤
    PlanarUnitDistances.CriticalLocus.incidenceIdeal f g pick
Lean source · PlanarUnitDistances/SelectedCriticalLocus.lean, lines 16–23
theorem selectedIdeal_le (f : MvPolynomial X k) (g : E → MvPolynomial X k) (pick : R → E) :
    selectedIdeal f g pick ≤ incidenceIdeal f g pick := by
  apply Ideal.span_le.mpr
  rintro _ ⟨e | h, rfl⟩
  · exact Ideal.subset_span ⟨.inl (pick e), rfl⟩
  · cases h with
    | inl x => exact Ideal.subset_span ⟨.inr (.inl x), rfl⟩
    | inr u => exact Ideal.subset_span ⟨.inr (.inr u), rfl⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

6 The final count

In this chapter

Lemma 6.1 Counting all rich unit circles

Lean verified

Let P consist of N real planar points. For an integer m ≥ 2 , let C be the set of all points in the plane whose unit circle contains at least m points of P . Then C is finite, | C | m ( m − 1 ) ≤ 2 N ( N − 1 ) , and at most | C | ( | C | − 1 ) points of P lie on two or more of these circles. If N ≤ 2 t 1 + 2 a , t > 0 , t 9 / 10 ≥ 2 and m = ⌈ t 9 / 10 ⌉ , then | C | ≤ 16 t 1 / 5 + 4 a .

Proof

Count pairs consisting of a center and two ordered distinct points on its circle. Every ordered point pair has at most two such centers. The resulting inequality holds on every finite family of candidate centers, so an infinite family would contain a finite subset violating it. Exchange points and centers to bound the double-covered set. Finally m ( m − 1 ) ≥ ( t 9 / 10 ) 2 / 2 yields the displayed power bound.

Inspect the Lean declarations

PlanarUnitDistances.rich_circles_power_bound

∀ (P : Finset OAI.PlanarUnitDistances.Plane) {t a : ℝ},
  0 < t →
    2 ≤ t ^ (9 / 10) →
      ↑P.card ≤ 2 * t ^ (1 + 2 * a) →
        ↑(PlanarUnitDistances.richCenterSet P ⌈t ^ (9 / 10)⌉₊).ncard ≤ 16 * t ^ (1 / 5 + 4 * a)
Lean source · PlanarUnitDistances/RichCircles.lean, lines 71–102
/-- Converting the discrete count to the rectangular graph parameters in
the density theorem. The use of the ceiling covers noninteger thresholds. -/
theorem rich_circles_power_bound (P : Finset Plane) {t a : ℝ} (ht : 0 < t)
    (htwo : 2 ≤ t^(9/10 : ℝ)) (hP : (P.card : ℝ) ≤ 2*t^(1+2*a)) :
    ((richCenterSet P ⌈t^(9/10 : ℝ)⌉₊).ncard : ℝ) ≤ 16*t^(1/5+4*a) := by
  let m := ⌈t^(9/10 : ℝ)⌉₊
  have hm' : t^(9/10 : ℝ) ≤ (m:ℝ) := Nat.le_ceil _
  have hm : 2 ≤ m := by exact_mod_cast htwo.trans hm'
  have h := (rich_circles_finite_count P hm).2
  have hmn : ((m-1 : ℕ) : ℝ) = (m:ℝ)-1 := by rw [Nat.cast_sub (by omega), Nat.cast_one]
  have hR : ((richCenterSet P m).ncard : ℝ) * ((m:ℝ)*((m:ℝ)-1)) ≤ (P.card:ℝ)^2 * 2 := by
    have h' : (richCenterSet P m).ncard * (m*(m-1)) ≤ P.card^2*2 :=
      h.trans (Nat.mul_le_mul_right _ (by rw [offDiag_card,pow_two]; omega))
    simpa only [Nat.cast_mul, Nat.cast_pow, Nat.cast_ofNat, hmn] using
      (Nat.cast_le (α := ℝ)).mpr h'
  have hlow : (t^(9/10 : ℝ))^2/2 ≤ (m:ℝ)*((m:ℝ)-1) := by
    have hhalf : t^(9/10 : ℝ)/2 ≤ (m:ℝ)-1 := by linarith
    have hh := mul_le_mul hm' hhalf (by positivity) (Nat.cast_nonneg (α := ℝ) m)
    nlinarith only [hh]
  have hbound : ((richCenterSet P m).ncard : ℝ) * (t^(9/10 : ℝ))^2 ≤ 16*(t^(1+2*a))^2 := by
    have h₁ := mul_le_mul_of_nonneg_left hlow
      (Nat.cast_nonneg (α := ℝ) (richCenterSet P m).ncard)
    have h₂ := pow_le_pow_left₀ (Nat.cast_nonneg (α := ℝ) P.card) hP 2
    nlinarith only [h₁,hR,h₂]
  change ((richCenterSet P m).ncard : ℝ) ≤ 16*t^(1/5+4*a)
  apply (mul_le_mul_iff_left₀ (by positivity : 0 < (t^(9/10 : ℝ))^2)).mp
  calc
    _ ≤ _ := hbound
    _ = 16*t^(1/5+4*a)*(t^(9/10 : ℝ))^2 := by
      simp only [sq, ← Real.rpow_add ht, mul_assoc]
      congr 2
      ring

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.circlePoints

Finset OAI.PlanarUnitDistances.Plane → OAI.PlanarUnitDistances.Plane → Finset OAI.PlanarUnitDistances.Plane
Lean source · PlanarUnitDistances/RichCircles.lean, lines 13–15
/-- Points of the input on the circle with center c. -/
noncomputable def circlePoints (P : Finset Plane) (c : Plane) : Finset Plane := by
  classical exact P.filter (fun p ↦ dist p c = 1)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.richCenterSet

Finset OAI.PlanarUnitDistances.Plane → ℕ → Set OAI.PlanarUnitDistances.Plane
Lean source · PlanarUnitDistances/RichCircles.lean, lines 21–23
/-- All centers of circles containing at least m input points. -/
def richCenterSet (P : Finset Plane) (m : ℕ) : Set Plane :=
  {c | m ≤ (circlePoints P c).card}

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.rich_circles_finite_count

∀ (P : Finset OAI.PlanarUnitDistances.Plane) {m : ℕ},
  2 ≤ m →
    (PlanarUnitDistances.richCenterSet P m).Finite ∧
      (PlanarUnitDistances.richCenterSet P m).ncard * (m * (m - 1)) ≤ P.offDiag.card * 2
Lean source · PlanarUnitDistances/RichCircles.lean, lines 43–59
/-- Richness at least two makes the set of all geometric centers finite.
The result also gives its exact ordered-pair incidence bound. -/
theorem rich_circles_finite_count (P : Finset Plane) {m : ℕ} (hm : 2 ≤ m) :
    (richCenterSet P m).Finite ∧
      (richCenterSet P m).ncard * (m*(m-1)) ≤ P.offDiag.card * 2 := by
  classical
  have hf : (richCenterSet P m).Finite := by
    by_contra hinf
    obtain ⟨C, hC, hc⟩ := Set.Infinite.exists_subset_card_eq hinf (P.offDiag.card*2+1)
    have h := ordered_pair_count P C m (fun c hc ↦ hC hc)
    have hpos : 1 ≤ m*(m-1) := Nat.one_le_iff_ne_zero.mpr <| Nat.mul_ne_zero (by omega) (by omega)
    have hle := Nat.mul_le_mul_left C.card hpos
    rw [Nat.mul_one] at hle
    omega
  refine ⟨hf, ?_⟩
  have h := ordered_pair_count P hf.toFinset m (fun c hc ↦ hf.mem_toFinset.mp hc)
  rwa [← Set.ncard_eq_toFinset_card _ hf] at h

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.double_covered_points_count

∀ (P C : Finset OAI.PlanarUnitDistances.Plane),
  {p ∈ P | 2 ≤ (PlanarUnitDistances.circlePoints C p).card}.card ≤ C.offDiag.card
Lean source · PlanarUnitDistances/RichCircles.lean, lines 61–69
/-- Intersection multiplicity summed over the rich circles. The factor two
from two circle intersections cancels the two orderings of the center pair. -/
theorem double_covered_points_count (P C : Finset Plane) :
    (P.filter (fun p ↦ 2 ≤ (circlePoints C p).card)).card ≤ C.offDiag.card := by
  classical
  let bad := P.filter (fun p ↦ 2 ≤ (circlePoints C p).card)
  have h := ordered_pair_count C bad 2 (fun p hp ↦ (mem_filter.mp hp).2)
  change bad.card ≤ C.offDiag.card
  omega

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 6.2 Loss of two-edge probability on rich circles

Lean verified

Take a finite Euclidean unit-incidence graph with e > 0 edges and center degrees at least d > 0 . Let A , B bound the point and center marginal atom masses. For a finite collection of unit-circle centers C , write P 2 for the points lying on at least two of their circles. The probability that both endpoints of the two-edge walk lie on the same circle of C is at most

| P 2 | A + | C | B + 2 / d .
Proof

Discard first endpoints in P 2 and sampled centers in C , at costs at most | P 2 | A and | C | B . For every remaining first endpoint p and center q , either p belongs to no circle of C or there is just one, with center c ≠ q . The circles around q , c have at most two common points, so at most two second neighbors are forbidden. Average the resulting bound 2 / d over the incident first edges. Only the first endpoint is tested for double coverage, so this event contributes a single term | P 2 | A .

Inspect the Lean declarations

PlanarUnitDistances.rich_circle_deletion_cost

∀ (P Q C : Finset OAI.PlanarUnitDistances.Plane)
  (N : OAI.PlanarUnitDistances.Plane → Finset OAI.PlanarUnitDistances.Plane) {e d A B : ℝ},
  0 < e →
    0 < d →
      (∀ q ∈ Q, d ≤ ↑(N q).card) →
        ∑ q ∈ Q, ↑(N q).card = e →
          (∀ q ∈ Q, N q ⊆ P) →
            (∀ q ∈ Q, ∀ r ∈ N q, dist r q = 1) →
              (∀ p ∈ P, ↑{q ∈ Q | p ∈ N q}.card / e ≤ A) →
                (∀ q ∈ Q, ↑(N q).card / e ≤ B) →
                  ∑ q ∈ Q,
                      ∑ p ∈ N q, ∑ _r ∈ N q with ∃ c ∈ C, dist p c = 1 ∧ dist _r c = 1, (e * ↑(N q).card)⁻¹ ≤
                    ↑{p ∈ P | 2 ≤ (PlanarUnitDistances.circlePoints C p).card}.card * A + ↑C.card * B + 2 / d
Lean source · PlanarUnitDistances/RichCircles.lean, lines 130–209
/-- Probability lost from the actual uniform-incidence two-edge walk when an
ordered pair lies on a circle in C. The first endpoint alone is sufficient
for the first exceptional event. Edges and neighborhoods remain oriented
exactly as in the graph extraction. -/
theorem rich_circle_deletion_cost (P Q C : Finset Plane) (N : Plane → Finset Plane)
    {e d A B : ℝ} (he : 0 < e) (hd : 0 < d)
    (hmin : ∀ q ∈ Q, d ≤ ((N q).card : ℝ))
    (hsum : ∑ q ∈ Q, ((N q).card : ℝ) = e)
    (hsub : ∀ q ∈ Q, N q ⊆ P) (hunit : ∀ q ∈ Q, ∀ r ∈ N q, dist r q = 1)
    (hatom : ∀ p ∈ P, ((Q.filter fun q ↦ p ∈ N q).card : ℝ) / e ≤ A)
    (hcenter : ∀ q ∈ Q, ((N q).card : ℝ) / e ≤ B) :
    (∑ q ∈ Q, ∑ p ∈ N q, ∑ _r ∈ (N q).filter (fun r ↦
      ∃ c ∈ C, dist p c = 1 ∧ dist r c = 1),
        (e * ((N q).card : ℝ))⁻¹) ≤
      ((P.filter fun p ↦ 2 ≤ (circlePoints C p).card).card : ℝ)*A +
      (C.card:ℝ)*B + 2/d := by
  classical
  let bad := P.filter fun p ↦ 2 ≤ (circlePoints C p).card
  let n (q : Plane) : ℝ := (N q).card
  let forbidden (q p : Plane) := (N q).filter fun r ↦
    ∃ c ∈ C, dist p c = 1 ∧ dist r c = 1
  let m (q p : Plane) : ℝ := ∑ _r ∈ forbidden q p, (e*n q)⁻¹
  have hn (q : Plane) (hq : q ∈ Q) : 0 < n q := hd.trans_le (hmin q hq)
  have full (q p : Plane) (hq : q ∈ Q) : m q p ≤ e⁻¹ := by
    calc
      m q p = ((forbidden q p).card:ℝ)*(e*n q)⁻¹ := by simp [m]
      _ ≤ n q*(e*n q)⁻¹ := by
        gcongr
        exact (Nat.cast_le (α := ℝ)).mpr (Finset.card_filter_le (N q) _)
      _ = _ := by field_simp [ne_of_gt (hn q hq)]
  have localBound (q : Plane) (hq : q ∈ Q) (p : Plane) (hp : p ∈ N q) :
      m q p ≤ (if p ∈ bad then e⁻¹ else 0) + (if q ∈ C then e⁻¹ else 0) + 2/(e*d) := by
    have hn' := hn q hq
    have hinv : 0 ≤ e⁻¹ := (inv_pos.mpr he).le
    have hnon : 0 ≤ 2 / (e*d) := by positivity
    by_cases hb : p ∈ bad <;> by_cases hc : q ∈ C
    · simp [hb,hc]; linarith [full q p hq]
    · simp [hb,hc]; linarith [full q p hq]
    · simp [hb,hc]; linarith [full q p hq]
    · simp only [hb,hc,if_false,zero_add]
      have hp' : (circlePoints C p).card ≤ 1 := by
        by_contra! hh
        exact hb (mem_filter.mpr ⟨hsub q hq hp, by omega⟩)
      have hcut := forbidden_returns_le_two C (N q) hc hp' (hunit q hq)
      have hinv' := inv_anti₀ (mul_pos he hd) (mul_le_mul_of_nonneg_left (hmin q hq) he.le)
      calc
        _ = ((forbidden q p).card:ℝ)*(e*n q)⁻¹ := by simp [m]
        _ ≤ 2*(e*d)⁻¹ := mul_le_mul (by exact_mod_cast hcut) hinv' (by positivity) (by norm_num)
        _ = _ := by ring
  have hfirst : (∑ q ∈ Q, ∑ p ∈ N q, if p ∈ bad then e⁻¹ else 0) ≤ (bad.card:ℝ)*A := by
    calc
      _ = ∑ q ∈ Q, ∑ p ∈ bad, if p ∈ N q then e⁻¹ else 0 := by
        apply sum_congr rfl; intro q _
        rw [← sum_filter, ← sum_filter, filter_mem_eq_inter, filter_mem_eq_inter, inter_comm]
      _ = ∑ p ∈ bad, ((Q.filter fun q ↦ p ∈ N q).card:ℝ) / e := by
        rw [sum_comm]; apply sum_congr rfl; intro p _
        rw [← sum_filter]; simp [div_eq_mul_inv]
      _ ≤ _ := by
        simpa using sum_le_sum (s := bad) (fun p hp ↦ hatom p (mem_filter.mp hp).1)
  have hB : 0 ≤ B := by
    have hQ : Q.Nonempty := by
      by_contra! h; simp [h] at hsum; linarith
    obtain ⟨q,hq⟩ := hQ
    exact (div_nonneg (hn q hq).le he.le).trans (hcenter q hq)
  have hsecond : (∑ q ∈ Q, ∑ _p ∈ N q, if q ∈ C then e⁻¹ else 0) ≤ (C.card:ℝ)*B := by
    calc
      _ = ∑ q ∈ Q.filter (· ∈ C), ((N q).card : ℝ)/e := by
        rw [sum_filter]; apply sum_congr rfl; intro q _; by_cases hq : q ∈ C <;> simp [hq,div_eq_mul_inv]
      _ ≤ ((Q.filter (· ∈ C)).card:ℝ)*B := by
        simpa using sum_le_sum (s := Q.filter (· ∈ C)) (fun q hq ↦ hcenter q (mem_filter.mp hq).1)
      _ ≤ _ := by
        apply mul_le_mul_of_nonneg_right _ hB
        exact_mod_cast card_le_card (show Q.filter (· ∈ C) ⊆ C from fun q hq ↦ (mem_filter.mp hq).2)
  have hthird : (∑ q ∈ Q, ∑ _p ∈ N q, 2/(e*d)) = 2/d := by
    simp only [sum_const,nsmul_eq_mul,← sum_mul,hsum]
    field_simp
  change (∑ q ∈ Q, ∑ p ∈ N q, m q p) ≤ _
  have hh := sum_le_sum (s := Q) (fun q hq ↦ sum_le_sum (s := N q) (fun p hp ↦ localBound q hq p hp))
  simp only [sum_add_distrib, hthird] at hh
  linarith

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.forbidden_returns_le_two

∀ (C N : Finset OAI.PlanarUnitDistances.Plane) {p q : OAI.PlanarUnitDistances.Plane},
  q ∉ C →
    (PlanarUnitDistances.circlePoints C p).card ≤ 1 →
      (∀ r ∈ N, dist r q = 1) → {r ∈ N | ∃ c ∈ C, dist p c = 1 ∧ dist r c = 1}.card ≤ 2
Lean source · PlanarUnitDistances/RichCircles.lean, lines 104–128
/-- For a fixed first endpoint outside the double-covered set and a fixed
non-rich center, at most two of that center's neighbors can complete a
pair on a rich circle. This counts the geometric endpoints before any
choice of a witness center. -/
theorem forbidden_returns_le_two (C N : Finset Plane) {p q : Plane}
    (hq : q ∉ C) (hp : (circlePoints C p).card ≤ 1)
    (hN : ∀ r ∈ N, dist r q = 1) :
    (N.filter fun r ↦ ∃ c ∈ C, dist p c = 1 ∧ dist r c = 1).card ≤ 2 := by
  classical
  let F := N.filter fun r ↦ ∃ c ∈ C, dist p c = 1 ∧ dist r c = 1
  change F.card ≤ 2
  by_cases hf : F.Nonempty
  · obtain ⟨x,hx⟩ := hf
    obtain ⟨c,hc,hpc,_⟩ := (mem_filter.mp hx).2
    have hc₀ : c ∈ circlePoints C p := mem_circlePoints.mpr ⟨hc, by rwa [dist_comm]⟩
    apply planar_common_centers_le_two F id Function.injective_id.injOn
      (show c ≠ q by rintro rfl; exact hq hc)
    · intro r hr
      obtain ⟨c',hc',hpc',hrc'⟩ := (mem_filter.mp hr).2
      have hc'₀ : c' ∈ circlePoints C p := mem_circlePoints.mpr ⟨hc', by rwa [dist_comm]⟩
      have heq := card_le_one.mp hp c hc₀ c' hc'₀
      rw [heq,dist_comm]
      exact hrc'
    · intro r hr; exact (dist_comm q r).trans (hN r (mem_filter.mp hr).1)
  · simp [Finset.not_nonempty_iff_eq_empty.mp hf]

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 6.3 Uniform loss estimate for the extracted graph

Lean verified

Let g = 3 Δ and a = 10000 g . For each η > 0 there is an absolute threshold t 0 ( η ) such that the following estimate holds simultaneously for every large-height piece with t ≥ t 0 ( η ) and every event H of its center-first two-edge walk. Keep a triple in H when every real unit circle through both endpoints contains strictly fewer than | P | 9 / 10 points of P . The probability discarded is less than η . Thus an event of probability at least ϵ / 8000 retains probability at least ϵ / 16000 , where ϵ = 2 − 1800 . Its endpoint functions, height estimates, and individual witness triples are preserved.

Proof

On reindexing the pair fibers in center-first order, each incident triple ( p , q , r ) contributes 1 / ( | E | d ( q ) ) . This identifies the loss for any event with at most the unconditional loss from Lemma 6.2. The size lower bound gives | P | ≥ t 1 + 2 a − 173 g ≥ t for t ≥ 1 , so every circle forbidden by the | P | 9 / 10 condition has at least ⌈ t 9 / 10 ⌉ points. There are at most 16 t 1 / 5 + 4 a such circles. Using the degree bounds for the same point and center laws gives a total loss at most

256 t − 3 / 5 + 6 a + 100 g + 16 t − 9 / 5 + 3 a + 100 g + 2 27 / 50 t − a + 90 g .

All three exponents are strictly negative at the fixed g . Apply the result at η = ϵ / 16000 to the selected scale event. Removing a pair discards its whole center fiber; every center of a retained pair continues to witness the same individual estimates.

Inspect the Lean declarations

PlanarUnitDistances.rich_circle_survival

∀ {ε : ℝ},
  0 < ε →
    ∀ᶠ (t : ℝ) in Filter.atTop,
      ∀ (P Q : Finset OAI.PlanarUnitDistances.Plane) (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q),
        PlanarUnitDistances.ProofAssembly.LargePiece t P Q M →
          ∀ (H : ↥P × ↥P → Finset ↥Q),
            ε / 8000 ≤
                PlanarUnitDistances.goodTripleMass (PlanarUnitDistances.unitRows P Q) H
                  (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) →
              ε / 16000 ≤
                PlanarUnitDistances.goodTripleMass (PlanarUnitDistances.unitRows P Q)
                  (PlanarUnitDistances.removeRichPairs H)
                  (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q)
Lean source · PlanarUnitDistances/RichCircleSurvival.lean, lines 203–214
/-- Manuscript scale selection and rich-circle deletion use the same sampled
triples. Removing rich pairs retains the claimed absolute mass ε/16000 as
soon as the supplied scale event has mass at least ε/8000. -/
theorem rich_circle_survival {ε : ℝ} (hε : 0 < ε) :
    ∀ᶠ t : ℝ in atTop, ∀ (P Q : Finset Plane) (M : CommonFieldModel.Model P Q),
      ProofAssembly.LargePiece t P Q M → ∀ H : P×P → Finset Q,
        ε/8000 ≤ goodTripleMass (unitRows P Q) H (incidences P Q) →
        ε/16000 ≤ goodTripleMass (unitRows P Q) (removeRichPairs H) (incidences P Q) := by
  filter_upwards [rich_circle_loss_eventually (div_pos hε (by norm_num : (0:ℝ)<16000))]
    with t ht
  intro P Q M h H hmass
  linarith [ht P Q M h H]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.goodTripleMass_center_sum

∀ {I : Type u_1} {J : Type u_2} [inst : Fintype I] [inst_1 : Fintype J] [inst_2 : DecidableEq I]
  (S : J → Finset I) (H : I × I → Finset J) {e : ℝ},
  0 < e →
    PlanarUnitDistances.goodTripleMass S H e =
      ∑ q, ∑ p ∈ S q, ∑ r ∈ S q, if q ∈ H (p, r) then (e * ↑(S q).card)⁻¹ else 0
Lean source · PlanarUnitDistances/RichCircleSurvival.lean, lines 11–42
/-- Reindex the projected pair-fiber mass in center-first sampling order.
This holds for any event, including fibers containing nonincident endpoints. -/
theorem goodTripleMass_center_sum {I J : Type*} [Fintype I] [Fintype J] [DecidableEq I]
    (S : J → Finset I) (H : I×I → Finset J) {e : ℝ} (he : 0 < e) :
    goodTripleMass S H e =
      ∑ q, ∑ p ∈ S q, ∑ r ∈ S q,
        if q ∈ H (p,r) then (e*((S q).card:ℝ))⁻¹ else 0 := by
  let w (z : I×I) (q : J) :=
    ((S q).card:ℝ)/e*(if z.1 ∈ S q then ((S q).card:ℝ)⁻¹ else 0)*
      (if z.2 ∈ S q then ((S q).card:ℝ)⁻¹ else 0)
  have allPairs : goodTripleMass S H e = ∑ z, ∑ q ∈ H z,w z q := by
    apply sum_subset (subset_univ _)
    intro z _ h
    have hn : ¬(H z).Nonempty := fun hn => h (mem_filter.mpr ⟨mem_univ _,hn⟩)
    simp [Finset.not_nonempty_iff_eq_empty.mp hn]
  rw [allPairs]
  simp_rw [restrict_sum (H _), restrict_sum (S _)]
  rw [sum_comm]
  apply sum_congr rfl
  intro q _
  rw [Fintype.sum_prod_type]
  apply sum_congr rfl
  intro p _
  by_cases hp : p∈S q
  · rw [if_pos hp]
    apply sum_congr rfl
    intro r _
    by_cases hr : r∈S q <;> by_cases hz : q∈H (p,r) <;> simp [w,hp,hr,hz]
    have hd : (0:ℝ) < (S q).card := Nat.cast_pos.mpr (card_pos.mpr ⟨p,hp⟩)
    field_simp
  · rw [if_neg hp]
    simp [w,hp]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.circleSafe

(P : Finset OAI.PlanarUnitDistances.Plane) → ↥P × ↥P → Prop
Lean source · PlanarUnitDistances/RichCircleSurvival.lean, lines 44–48
/-- The final admissibility condition for an ordered endpoint pair, quantified
over every real center, independently of the sampled center set. -/
def circleSafe (P : Finset Plane) (z : P×P) : Prop :=
  ∀ c : Plane,dist (z.1:Plane) c=1 → dist (z.2:Plane) c=1 →
    ((circlePoints P c).card:ℝ) < (P.card:ℝ)^(9/10:ℝ)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.removeRichPairs

{P Q : Finset OAI.PlanarUnitDistances.Plane} → (↥P × ↥P → Finset ↥Q) → ↥P × ↥P → Finset ↥Q
Lean source · PlanarUnitDistances/RichCircleSurvival.lean, lines 50–52
/-- Drop all centers for a forbidden endpoint pair, preserving the other fibers exactly. -/
def removeRichPairs {P Q : Finset Plane} (H : P×P → Finset Q) (z : P×P) : Finset Q :=
  if circleSafe P z then H z else ∅

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.mem_removeRichPairs

∀ {P Q : Finset OAI.PlanarUnitDistances.Plane} (H : ↥P × ↥P → Finset ↥Q) (z : ↥P × ↥P) (q : ↥Q),
  q ∈ PlanarUnitDistances.removeRichPairs H z ↔ q ∈ H z ∧ PlanarUnitDistances.circleSafe P z
Lean source · PlanarUnitDistances/RichCircleSurvival.lean, lines 54–56
theorem mem_removeRichPairs {P Q : Finset Plane} (H : P×P → Finset Q) (z : P×P) (q : Q) :
    q∈removeRichPairs H z ↔ q∈H z ∧ circleSafe P z := by
  by_cases h : circleSafe P z <;> simp [removeRichPairs,h]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.rich_circle_loss_eventually

∀ {η : ℝ},
  0 < η →
    ∀ᶠ (t : ℝ) in Filter.atTop,
      ∀ (P Q : Finset OAI.PlanarUnitDistances.Plane) (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q),
        PlanarUnitDistances.ProofAssembly.LargePiece t P Q M →
          ∀ (H : ↥P × ↥P → Finset ↥Q),
            PlanarUnitDistances.goodTripleMass (PlanarUnitDistances.unitRows P Q) H
                (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) <
              PlanarUnitDistances.goodTripleMass (PlanarUnitDistances.unitRows P Q)
                  (PlanarUnitDistances.removeRichPairs H)
                  (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) +
                η
Lean source · PlanarUnitDistances/RichCircleSurvival.lean, lines 110–201
/-- Uniformly in the winning piece and the event carried by its triples, the
absolute mass discarded tends to zero. The test for retention uses |P|^(9/10),
so it directly supplies the circle requirement in AdmissibleGraph. -/
theorem rich_circle_loss_eventually {η : ℝ} (hη : 0 < η) :
    ∀ᶠ t : ℝ in atTop, ∀ (P Q : Finset Plane) (M : CommonFieldModel.Model P Q),
      ProofAssembly.LargePiece t P Q M → ∀ H : P×P → Finset Q,
        goodTripleMass (unitRows P Q) H (incidences P Q) <
          goodTripleMass (unitRows P Q) (removeRichPairs H) (incidences P Q) + η := by
  let g := 3*exactGap
  let a := 10000*g
  have hg : 0 < g := mul_pos (by norm_num) exactGap_pos
  have ha : a ≤ 1/100 := by
    have hb := exactGap_lt_largeHeightGap.trans_le
      (Real.rpow_le_rpow_of_exponent_le (by norm_num : (1:ℝ) ≤ 2)
      (by norm_num : (-(594036:ℝ)) ≤ -(32:ℝ)))
    rw [Real.rpow_neg (by norm_num),← Nat.cast_ofNat (R := ℝ) (n:=32),Real.rpow_natCast] at hb
    norm_num1 at hb
    dsimp [a,g]
    linarith
  have neg1 : -3/5+6*a+100*g < 0 := by dsimp [a] at *; linarith
  have neg2 : -9/5+3*a+100*g < 0 := by dsimp [a] at *; linarith
  have neg3 : -a+90*g < 0 := by dsimp [a]; linarith
  have small (k x : ℝ) (hx : x < 0) : Tendsto (fun t : ℝ => k*t^x) atTop (nhds 0) := by
    have h := (tendsto_rpow_neg_atTop (neg_pos.mpr hx)).const_mul k
    simpa only [neg_neg,mul_zero] using h
  have dec := ((small 256 _ neg1).add (small 16 _ neg2)).add (small (2/(27/50)) _ neg3)
  simp only [add_zero] at dec
  filter_upwards [dec.eventually (eventually_lt_nhds hη), eventually_ge_atTop (1:ℝ),
    (tendsto_rpow_atTop (by norm_num : 0 < (9/10:ℝ))).eventually_ge_atTop 2] with t decay ht htwo
  have ht0 := zero_lt_one.trans_le ht
  intro P Q M pie H
  obtain ⟨_,pLo,pHi,_,edge,dp,_,dq,_,_,_⟩ := pie
  let A := t^(-1-2*a+100*g)
  let B := t^(-2-a+100*g)
  let d := (27/50:ℝ)*t^(a-90*g)
  let e := incidences P Q
  let m := ⌈t^(9/10:ℝ)⌉₊
  have he : 0 < e := (Real.rpow_pos_of_pos ht0 _).trans_le edge
  have hd : 0 < d := by dsimp [d]; positivity
  have hm : 2 ≤ m := by exact_mod_cast htwo.trans (Nat.le_ceil _)
  let hf := (rich_circles_finite_count P hm).1
  let C := hf.toFinset
  have centers (c : Plane) : c∈C ↔ m ≤ (circlePoints P c).card := hf.mem_toFinset
  have cHi : (C.card:ℝ) ≤ 16*t^(1/5+4*a) := by
    rw [show C.card=(richCenterSet P m).ncard from (Set.ncard_eq_toFinset_card _ hf).symm]
    exact rich_circles_power_bound P ht0 htwo pHi
  have c2 : ((P.filter (fun p => 2 ≤ (circlePoints C p).card)).card:ℝ) ≤ (C.card:ℝ)^2 := by
    have h := double_covered_points_count P C
    rw [offDiag_card] at h
    exact_mod_cast (h.trans (by rw [pow_two]; exact Nat.sub_le _ _) : _ ≤ C.card^2)
  have safeCover (z : P×P) (hz : ¬circleSafe P z) :
      ∃ c∈C,dist (z.1:Plane) c=1 ∧ dist (z.2:Plane) c=1 := by
    unfold circleSafe at hz
    push Not at hz
    obtain ⟨c,hp,hr,hcard⟩ := hz
    refine ⟨c,(centers _).2 (Nat.ceil_le.mpr (le_trans ?_ hcard)),hp,hr⟩
    apply Real.rpow_le_rpow ht0.le _ (by norm_num)
    have hle : (1:ℝ) ≤ 1+2*a-173*g := by dsimp [a]; linarith
    exact le_trans (by simpa only [Real.rpow_one] using (Real.rpow_le_rpow_of_exponent_le ht hle)) pLo
  have atom (p : Plane) (hp : p∈P) :
      ((Q.filter fun q => p∈circlePoints P q).card:ℝ)/e ≤ A := by
    have hh : Q.filter (fun q => p∈circlePoints P q) = Q.filter (fun q => dist q p=1) := by
      ext q; simp [hp,dist_comm p]
    rw [hh]
    exact (dp p hp).2.2.2
  have catom (q : Plane) (hq : q∈Q) : ((circlePoints P q).card:ℝ)/e ≤ B := by
    have h := div_le_div₀ (Real.rpow_nonneg ht0.le _) (dq q hq).2.1 (Real.rpow_pos_of_pos ht0 _) edge
    rw [←Real.rpow_sub ht0] at h
    apply h.trans_eq
    change t^(a+10*g-(2+2*a-90*g)) = t^(-2-a+100*g)
    congr 1; ring
  have cost := rich_circle_deletion_cost P Q C (circlePoints P) he hd
    (fun q hq => (dq q hq).1) rfl (fun _ _ => filter_subset ..)
    (fun _ _ _ h => (mem_circlePoints.mp h).2) atom catom
  have term1 : ((P.filter (fun p => 2 ≤ (circlePoints C p).card)).card:ℝ)*A ≤
      256*t^(-3/5+6*a+100*g) := by
    have hh := (mul_le_mul_of_nonneg_right (c2.trans (pow_le_pow_left₀ (Nat.cast_nonneg _) cHi 2))
      (Real.rpow_nonneg ht0.le (-1-2*a+100*g)))
    apply hh.trans_eq
    rw [mul_pow,show (16:ℝ)^2=256 by norm_num,pow_two,mul_assoc,←Real.rpow_add ht0,←Real.rpow_add ht0]
    congr 2; ring
  have term2 : (C.card:ℝ)*B ≤ 16*t^(-9/5+3*a+100*g) := by
    apply (mul_le_mul_of_nonneg_right cHi (Real.rpow_nonneg ht0.le _)).trans_eq
    rw [mul_assoc,←Real.rpow_add ht0]
    congr 2; ring
  have term3 : 2/d = (2/(27/50:ℝ))*t^(-a+90*g) := by
    dsimp [d]
    rw [show -a+90*g = -(a-90*g) by ring,Real.rpow_neg ht0.le]
    ring
  have lost : lossSum P Q C < η :=
    ((cost.trans (add_le_add (add_le_add term1 term2) term3.le))).trans_lt decay
  exact (mass_le_retained_add_loss P Q C H he safeCover).trans_lt (add_lt_add_right lost _)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 6.4 Counting ordered pairs and fixing their centers

Lean verified

Consider a finite Euclidean unit-incidence graph with injective point and center labels, e > 0 edges, and minimum center degree at least d > 0 . For each ordered endpoint pair ( p , r ) specify a set S p r of surviving common centers, empty whenever p = r . Give triples the law obtained by choosing q with probability d ( q ) / e and then independently choosing two uniform neighbors of q . If the probability of q ∈ S p r is at least ϵ / 16000 , the graph G = { ( p , r ) : S p r ≠ ∅ } satisfies | G | ≥ ϵ e d / 32000 . There exists one function on G choosing a surviving center for every edge.

Proof

Every surviving triple has mass 1 / ( e d ( q ) ) ≤ 1 / ( e d ) . Lemma 2.3 gives | S p r | ≤ 2 for each retained pair. Sum first over its center fiber and then over the ordered pairs to bound the total surviving mass by 2 | G | / ( e d ) . Choose the center function on the subtype of pairs with nonempty fibers. Lemma 6.2 bounds the deletion loss before this choice.

Inspect the Lean declarations

PlanarUnitDistances.good_ordered_pairs_and_witnesses

∀ {P : Type u_1} {Q : Type u_2} [inst : Fintype P] [inst_1 : Fintype Q] [inst_2 : DecidableEq P]
  (point : P → OAI.PlanarUnitDistances.Plane) (center : Q → OAI.PlanarUnitDistances.Plane),
  Function.Injective point →
    Function.Injective center →
      ∀ (neighbors : Q → Finset P),
        (∀ (q : Q), ∀ i ∈ neighbors q, dist (point i) (center q) = 1) →
          ∀ (centers : P × P → Finset Q),
            (∀ (z : P × P), ∀ q ∈ centers z, z.1 ≠ z.2 ∧ z.1 ∈ neighbors q ∧ z.2 ∈ neighbors q) →
              ∀ {d ε : ℝ},
                0 < d →
                  (∀ (q : Q), d ≤ ↑(neighbors q).card) →
                    ∀ (e : ℝ),
                      0 < e →
                        ∑ q, ↑(neighbors q).card = e →
                          ε / 16000 ≤ PlanarUnitDistances.goodTripleMass neighbors centers e →
                            ε * e * d / 32000 ≤ ↑(PlanarUnitDistances.goodOrderedPairs centers).card ∧
                              ∃ witness,
                                ∀ (z : ↥(PlanarUnitDistances.goodOrderedPairs centers)),
                                  witness z ∈ centers ↑z
Lean source · PlanarUnitDistances/GoodPairs.lean, lines 29–83
/-- Euclidean extraction with the manuscript constant 32000. The event
may depend on the center. Its surviving fibers need only consist of
incident distinct endpoints. -/
theorem good_ordered_pairs_and_witnesses {P Q : Type*} [Fintype P] [Fintype Q]
    [DecidableEq P] (point : P → Plane) (center : Q → Plane)
    (hp : Function.Injective point) (hc : Function.Injective center)
    (neighbors : Q → Finset P)
    (hunit : ∀ q i, i ∈ neighbors q → dist (point i) (center q) = 1)
    (centers : P × P → Finset Q)
    (hgood : ∀ z q, q ∈ centers z →
      z.1 ≠ z.2 ∧ z.1 ∈ neighbors q ∧ z.2 ∈ neighbors q)
    {d ε : ℝ} (hd : 0 < d) (hmin : ∀ q, d ≤ ((neighbors q).card : ℝ))
    (e : ℝ) (he : 0 < e) (_hsum : ∑ q, ((neighbors q).card : ℝ) = e)
    (hmass : ε/16000 ≤ goodTripleMass neighbors centers e) :
    ε * e * d / 32000 ≤ ((goodOrderedPairs centers).card : ℝ) ∧
      ∃ witness : (z : ↥(goodOrderedPairs centers)) → Q,
        ∀ z, witness z ∈ centers z.val := by
  classical
  have hmem (z : P × P) (hz : z ∈ goodOrderedPairs centers) : (centers z).Nonempty :=
    (mem_filter.mp hz).2
  have hN (q : Q) : 0 < ((neighbors q).card : ℝ) := hd.trans_le (hmin q)
  have hpair (z : P × P) (hz : z ∈ goodOrderedPairs centers) : (centers z).card ≤ 2 := by
    obtain ⟨q,hq⟩ := hmem z hz
    have h := euclidean_unit_graph_codegree point center hp hc neighbors hunit _ _ (hgood z q hq).1
    apply le_trans (card_le_card ?_) h
    intro q' hq'
    exact mem_filter.mpr ⟨mem_univ _, (hgood z q' hq').2⟩
  have hbound : goodTripleMass neighbors centers e ≤
      ((goodOrderedPairs centers).card : ℝ) * (2 / (e*d)) := by
    unfold goodTripleMass
    calc
      _ ≤ ∑ _z ∈ goodOrderedPairs centers, 2 / (e*d) := by
        apply sum_le_sum
        intro z hz
        calc
          _ ≤ ∑ _q ∈ centers z, (e*d)⁻¹ := by
            apply sum_le_sum
            intro q hq
            have hm := (hgood z q hq).2
            rw [if_pos hm.1, if_pos hm.2]
            calc
              _ = (e * ((neighbors q).card : ℝ))⁻¹ := by field_simp
              _ ≤ _ := inv_anti₀ (mul_pos he hd) (mul_le_mul_of_nonneg_left (hmin q) he.le)
          _ ≤ _ := by
            simp only [sum_const, nsmul_eq_mul, div_eq_mul_inv]
            gcongr
            exact_mod_cast hpair z hz
      _ = _ := by simp
  constructor
  · have hh := (hmass.trans hbound)
    rw [mul_div_assoc'] at hh
    have hh' := (le_div_iff₀ (mul_pos he hd)).mp hh
    linarith
  · exact ⟨fun z ↦ (hmem z.val z.property).choose,
      fun z ↦ (hmem z.val z.property).choose_spec⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.goodOrderedPairs

{P : Type u_1} → {Q : Type u_2} → [Fintype P] → (P × P → Finset Q) → Finset (P × P)
Lean source · PlanarUnitDistances/GoodPairs.lean, lines 13–18
/-- The projected event is a set of ordered endpoint pairs; each supplied
fiber contains precisely the centers surviving the chosen test. -/
noncomputable def goodOrderedPairs {P Q : Type*} [Fintype P]
    (centers : P × P → Finset Q) : Finset (P × P) := by
  classical
  exact univ.filter fun z ↦ (centers z).Nonempty

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.goodTripleMass

{P : Type u_1} → {Q : Type u_2} → [Fintype P] → [DecidableEq P] → (Q → Finset P) → (P × P → Finset Q) → ℝ → ℝ
Lean source · PlanarUnitDistances/GoodPairs.lean, lines 20–27
/-- `e` is the number of incidences. Center probability is deg(q)/e;
the other two factors are the two independent neighbor probabilities. -/
noncomputable def goodTripleMass {P Q : Type*} [Fintype P] [DecidableEq P]
    (neighbors : Q → Finset P) (centers : P × P → Finset Q) (e : ℝ) : ℝ :=
  ∑ z ∈ goodOrderedPairs centers, ∑ q ∈ centers z,
    ((neighbors q).card : ℝ) / e *
      (if z.1 ∈ neighbors q then ((neighbors q).card : ℝ)⁻¹ else 0) *
      (if z.2 ∈ neighbors q then ((neighbors q).card : ℝ)⁻¹ else 0)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 6.5 Building the labeled graph from the surviving triples

Lean verified

Fix finite algebraic P , finite Q , common field coordinates, and a scale J ≥ 12 ⋅ 2 111 . Suppose the surviving triples have total probability at least ϵ / 16000 under the uniform-incidence walk, with center degrees at least d > 0 . Assume that on each such triple the distinct endpoints p , r share the center q , lie on no common unit circle containing | P | 9 / 10 points, and have ratio λ = ( z p − z q ) / ( z r − z q ) of height at least J / 3 . Suppose there is one place-vector V p for each point, finitely supported at finite places, with

‖ log ⁡ | λ | − ( V r − V p ) ‖ 1 ≤ J / ( 648 ⋅ 2 111 )

on every surviving triple. Then there is an admissible graph on P at scale J , with at least ϵ | E | d / 32000 ordered edges.

Proof

Project the triples to their ordered endpoint pairs. Select a single surviving center for each such pair and form its ratio in the specified number field. Under its given complex embedding this ratio has the signed chord identity from Lemma 1.3. On a rectangle the four errors concern the four selected centers but the potentials are indexed by endpoints alone. Their alternating sum cancels, giving the required quotient height at most J / ( 324 ⋅ 2 111 ) . The construction checks every field of the Lean definition of an admissible graph, including the unit-circle condition for every real center.

Inspect the Lean declarations

PlanarUnitDistances.graph_of_surviving_triples

∀ {P Q : Finset OAI.PlanarUnitDistances.Plane},
  PlanarUnitDistances.AlgebraicPoints P →
    ∀ (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q) (centers : ↥P × ↥P → Finset ↥Q)
      (V : ↥P → PlanarUnitDistances.HeightPlace ↥M.field → ℝ),
      (∀ (p : ↥P), PlanarUnitDistances.FiniteAtPrimes (V p)) →
        ∀ (J d ε : ℝ),
          12 * 2 ^ 111 ≤ J →
            0 < d →
              (∀ (q : ↥Q), d ≤ ↑(PlanarUnitDistances.unitRows P Q q).card) →
                0 < OAI.PlanarUnitDistances.CircleIncidence.incidences P Q →
                  ε / 16000 ≤
                      PlanarUnitDistances.goodTripleMass (PlanarUnitDistances.unitRows P Q) centers
                        (OAI.PlanarUnitDistances.CircleIncidence.incidences P Q) →
                    (∀ (z : ↥P × ↥P),
                        ∀ q ∈ centers z,
                          z.1 ≠ z.2 ∧
                            z.1 ∈ PlanarUnitDistances.unitRows P Q q ∧
                              z.2 ∈ PlanarUnitDistances.unitRows P Q q ∧
                                J / 3 ≤
                                    PlanarUnitDistances.weilHeight
                                      (PlanarUnitDistances.centerRatio M z.1 z.2 q) ∧
                                  PlanarUnitDistances.placeNorm
                                        (PlanarUnitDistances.localLog
                                            (PlanarUnitDistances.centerRatio M z.1 z.2 q) -
                                          (V z.2 - V z.1)) ≤
                                      J / (648 * 2 ^ 111) ∧
                                    ∀ (c : OAI.PlanarUnitDistances.Plane),
                                      dist (↑z.1) c = 1 →
                                        dist (↑z.2) c = 1 →
                                          ↑{x ∈ P | dist x c = 1}.card < ↑P.card ^ (9 / 10)) →
                      ∃ G,
                        G.points = P ∧
                          G.scale = J ∧
                            ε * OAI.PlanarUnitDistances.CircleIncidence.incidences P Q * d / 32000 ≤
                              ↑(Finset.card G.edges)
Lean source · PlanarUnitDistances/SurvivingGraph.lean, lines 30–123
/-- From the surviving triples with one endpoint potential per point to the
literal graph required by the manuscript. The same selected center defines the
ratio in both the individual and every rectangle height bound. -/
theorem graph_of_surviving_triples (hP : AlgebraicPoints P)
    (M : CommonFieldModel.Model P Q) (centers : P × P → Finset Q)
    (V : P → HeightPlace M.field → ℝ) (hV : ∀ p, FiniteAtPrimes (V p))
    (J d ε : ℝ) (hJ : 12*2^111 ≤ J) (hd : 0<d)
    (hdq : ∀ q, d ≤ ((unitRows P Q q).card : ℝ)) (he : 0 < incidences P Q)
    (mass : ε/16000 ≤ goodTripleMass (unitRows P Q) centers (incidences P Q))
    (survive : ∀ z q, q ∈ centers z →
      z.1 ≠ z.2 ∧ z.1 ∈ unitRows P Q q ∧ z.2 ∈ unitRows P Q q ∧
      J/3 ≤ weilHeight (centerRatio M z.1 z.2 q) ∧
      placeNorm (localLog (centerRatio M z.1 z.2 q) - (V z.2-V z.1)) ≤ J/(648*2^111) ∧
      ∀ c : Plane, dist (z.1:Plane) c = 1 → dist (z.2:Plane) c = 1 →
        (((P.filter fun x => dist x c = 1).card:ℕ):ℝ) < (P.card:ℝ)^(9/10:ℝ)) :
    ∃ G : AdmissibleGraph P.card M.field, G.points=P ∧ G.scale=J ∧
      ε*incidences P Q*d/32000 ≤ (G.edges.card:ℝ) := by
  classical
  let E := goodOrderedPairs centers
  obtain ⟨hc,w,hw⟩ := good_ordered_pairs_and_witnesses (@Subtype.val _ (· ∈ P))
    (@Subtype.val _ (· ∈ Q)) Subtype.val_injective Subtype.val_injective (unitRows P Q)
    (fun _ _ h => (Finset.mem_filter.mp h).2) centers
    (fun z q h => ⟨(survive z q h).1,(survive z q h).2.1,(survive z q h).2.2.1⟩)
    hd hdq _ he (unitRows_total P Q) mass
  let emb : (P × P) ↪ (Plane × Plane) := (Function.Embedding.subtype _).prodMap (Function.Embedding.subtype _)
  let Gedges := E.map emb
  have unpack {p r : Plane} (h : (p,r) ∈ Gedges) :
      ∃ (hp : p ∈ P) (hr : r ∈ P), (⟨p,hp⟩,⟨r,hr⟩)∈E := by
    obtain ⟨⟨i,j⟩,hm,eq⟩ := Finset.mem_map.mp h
    change ((i:Plane),(j:Plane)) = (p,r) at eq
    cases eq
    exact ⟨i.prop,j.prop,hm⟩
  let label (p r : Plane) : M.field :=
    if hp : p ∈ P then if hr : r ∈ P then
      if h : (⟨p,hp⟩,⟨r,hr⟩) ∈ E then centerRatio M ⟨p,hp⟩ ⟨r,hr⟩ (w ⟨_,h⟩)
      else 1 else 1 else 1
  have spec {p r : Plane} (h : (p,r) ∈ Gedges) :
      ∃ (i j : P), ↑i=p ∧ ↑j=r ∧ label p r ≠ 0 ∧
        ((dist p r^2:ℝ):ℂ)=2-(label p r:ℂ)-(label p r:ℂ)⁻¹ ∧
        J/3 ≤ weilHeight (label p r) ∧
        placeNorm (localLog (label p r) - (V j-V i)) ≤ J/(648*2^111) ∧
        ∀ c : Plane, dist p c = 1 → dist r c = 1 →
          (((P.filter fun x => dist x c = 1).card:ℕ):ℝ) < (P.card:ℝ)^(9/10:ℝ) := by
    obtain ⟨hp,hr,hE⟩ := unpack h
    let z : E := ⟨(⟨p,hp⟩,⟨r,hr⟩),hE⟩
    have good := survive z.val (w z) (hw z)
    have rat := centerRatio_spec M good.2.1 good.2.2.1
    refine ⟨z.val.1,z.val.2,rfl,rfl,?_⟩
    simpa only [label,dif_pos hp,dif_pos hr,dif_pos hE,z] using
      And.intro rat.1 (And.intro rat.2 good.2.2.2)
  refine ⟨{
    embedding := M.field.subtype
    points := P
    algebraic := hP
    point_bound := le_rfl
    edges := Gedges
    endpoints := ?_
    label := label
    scale := J
    scale_bound := hJ
    nonzero := ?_
    chord := ?_
    large_height := ?_
    rectangle := ?_
    circle := ?_ },rfl,rfl,?_⟩
  · rintro ⟨p,r⟩ h
    obtain ⟨hp,hr,_⟩ := unpack h
    exact ⟨hp,hr⟩
  · intro p r h
    obtain ⟨_,_,_,_,h',_⟩ := spec h
    exact h'
  · intro p r h
    obtain ⟨_,_,_,_,_,h',_⟩ := spec h
    exact h'
  · intro p r h
    obtain ⟨_,_,_,_,_,_,h',_⟩ := spec h
    exact h'
  · intro p p' r r' h11 h22 h12 h21
    obtain ⟨i,j,rfl,rfl,n11,_,_,b11,_⟩ := spec h11
    obtain ⟨k,l,rfl,rfl,n22,_,_,b22,_⟩ := spec h22
    obtain ⟨i',l',hi,hl,n12,_,_,b12,_⟩ := spec h12
    obtain ⟨k',j',hk,hj,n21,_,_,b21,_⟩ := spec h21
    obtain rfl := Subtype.val_injective hi
    obtain rfl := Subtype.val_injective hl
    obtain rfl := Subtype.val_injective hk
    obtain rfl := Subtype.val_injective hj
    have hh := quotient_height_of_endpoint_errors n11 n12 n21 n22 _ _ _ _
      (hV i') (hV k') (hV j') (hV l') _ b11 b12 b21 b22
    convert hh using 1
    ring
  · intro p r h
    obtain ⟨_,_,_,_,_,_,_,_,h'⟩ := spec h
    exact h'
  · simpa [Gedges,E] using hc

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.centerRatio_spec

∀ {P Q : Finset OAI.PlanarUnitDistances.Plane} (M : OAI.PlanarUnitDistances.CommonFieldModel.Model P Q)
  {p r : ↥P} {q : ↥Q},
  p ∈ PlanarUnitDistances.unitRows P Q q →
    r ∈ PlanarUnitDistances.unitRows P Q q →
      PlanarUnitDistances.centerRatio M p r q ≠ 0 ∧
        ↑(dist ↑p ↑r ^ 2) =
          2 - ↑(PlanarUnitDistances.centerRatio M p r q) - (↑(PlanarUnitDistances.centerRatio M p r q))⁻¹
Lean source · PlanarUnitDistances/SurvivingGraph.lean, lines 17–28
theorem centerRatio_spec (M : CommonFieldModel.Model P Q) {p r : P} {q : Q}
    (hp : p ∈ unitRows P Q q) (hr : r ∈ unitRows P Q q) :
    centerRatio M p r q ≠ 0 ∧
    ((dist (p:Plane) (r:Plane)^2:ℝ):ℂ)=2-(centerRatio M p r q:ℂ)-(centerRatio M p r q:ℂ)⁻¹ := by
  have hp' : dist (p:Plane) (q:Plane)=1 := (Finset.mem_filter.mp hp).2
  have hr' : dist (r:Plane) (q:Plane)=1 := (Finset.mem_filter.mp hr).2
  have nz (i : P) (hi : dist (i:Plane) (q:Plane)=1) : M.z (.inl i)-M.z (.inr q) ≠ 0 := by
    intro h
    simpa [h] using M.unit_identity i q hi
  refine ⟨div_ne_zero (nz p hp') (nz r hr'),?_⟩
  simpa [centerRatio,M.z_eq,CommonFieldModel.location] using
    (planar_chord_identities hp' hr').1

Kernel axioms used: propext, Classical.choice, Quot.sound.

6.1 A height bound for the stationary ratio

Let K be the number field of the graph labels, with its chosen embedding σ : K → C . Write a i j for the normalized rectangle quotients of Lemma 5.7. On a component of the multiplier equations, suppose the output coordinate Y o is constant with value σ ( c ) , where c ∈ K . We seek a nonzero polynomial p ∈ K [ T ] with p ( c ) = 0 . To estimate h ( c ) , we will express each coefficient of p as an integral polynomial in the a i j and their inverses, and bound the degree and the sum of the absolute values of its coefficients. The intermediate equations live over a rational function field. The estimates at the places of K enter after those extra variables have been removed.

Lemma 6.6 Keeping the output coordinate on the selected component

Lean verified

Let P be the prime of the given component of the full multiplier ideal. There is a minimal prime Q ⊆ P of the selected equations with Y o − σ ( c ) ∈ Q . Among the coordinates of Q choose a transcendence basis indexed by S , with o ∉ S . After passing to C ( S ) , number the complementary coordinates from 1 to q , and let j be the index of o . In C ( S ) [ Y 1 , … , Y q ] the specialized equations have a maximal ideal M minimal over their ideal. It contracts to Q , contains Y j − σ ( c ) , and each specialized equation has degree at most two in the Y i . Here q is the number of complementary coordinates, so q ≤ 98 in the grid application.

Proof

On a minimal prime of the selected equations contained in P , the multiplier equations make the output constant. Reducing both constants modulo P identifies its value with σ ( c ) . The coordinate o is algebraic over the ground field, so one can choose a coordinate transcendence basis among the other coordinates. Inverting the nonzero polynomials in S preserves this minimal prime. The remaining residue coordinates are algebraic over C ( S ) , giving a maximal ideal there. The residue field may be an extension of C ( S ) .

Inspect the Lean declarations

PlanarUnitDistances.CoordinateSlice.numbered_coordinate_slice

∀ {k : Type u_1} {V : Type u_2} [inst : Field k] [Finite V] {w : ℕ}
  (g : Fin w → PlanarUnitDistances.CoordinateSlice.Poly k V),
  ∀ P ∈ (Ideal.span (Set.range g)).minimalPrimes,
    ∀ (o : V) (c : k),
      MvPolynomial.X o - MvPolynomial.C c ∈ P →
        (∀ (t : Fin w), MvPolynomial.totalDegree (g t) ≤ 2) →
          ∃ S,
            ∃ (ho : o ∉ S),
              (IsTranscendenceBasis k fun i => PlanarUnitDistances.CoordinateSlice.residue P ↑i) ∧
                ∃ q e,
                  q = Nat.card ↑Sᶜ ∧
                    q ≤ Nat.card V ∧
                      have j := e ⟨o, ho⟩;
                      have G := fun t => (PlanarUnitDistances.CoordinateSlice.numbered k S e) (g t);
                      ∃ M,
                        M.IsMaximal ∧
                          M ∈ (Ideal.span (Set.range G)).minimalPrimes ∧
                            Ideal.comap (PlanarUnitDistances.CoordinateSlice.numbered k S e) M = P ∧
                              MvPolynomial.X j -
                                    MvPolynomial.C
                                      ((algebraMap (PlanarUnitDistances.CoordinateSlice.Poly k ↑S)
                                          (PlanarUnitDistances.CoordinateSlice.FrozenField k S))
                                        (MvPolynomial.C c)) ∈
                                  M ∧
                                ∀ (t : Fin w), (G t).totalDegree ≤ 2
Lean source · PlanarUnitDistances/NumberedCoordinateSlice.lean, lines 29–73
/-- Freeze exactly a coordinate transcendence basis for the selected
component and number the complementary coordinates. The given output
coordinate survives, and the new isolated maximal prime contracts back
to the specified original component. No algebraic-closure change is used. -/
theorem numbered_coordinate_slice [Finite V] {w : ℕ} (g : Fin w → Poly k V)
    (P : Ideal (Poly k V)) (component : P ∈ (Ideal.span (range g)).minimalPrimes)
    (o : V) (c : k) (value : X o-C c∈P) (degree : ∀t,(g t).totalDegree≤2) :
    ∃ (S : Set V) (ho : o ∉ S), IsTranscendenceBasis k (fun i : S => residue P i.1) ∧
      ∃ (q : ℕ) (e : (↑Sᶜ) ≃ Fin q), q=Nat.card (↑Sᶜ) ∧ q≤Nat.card V ∧
        let j := e (⟨o,ho⟩ : (↑Sᶜ))
        let G := fun t => numbered k S e (g t)
        ∃ M : Ideal (MvPolynomial (Fin q) (FrozenField k S)), M.IsMaximal ∧
          M ∈ (Ideal.span (range G)).minimalPrimes ∧ M.comap (numbered k S e)=P ∧
          X j-C (algebraMap (Poly k S) (FrozenField k S) (C c))∈M ∧ ∀t,(G t).totalDegree≤2 := by
  classical
  obtain ⟨S,ho,basis,Q,maxQ,minQ,under,root⟩ := polynomial_coordinate_slice component o c value
  let q := Nat.card (↑Sᶜ)
  let e := Finite.equivFin (↑Sᶜ)
  let E := (renameEquiv (FrozenField k S) e).toRingEquiv
  let f : SliceRing k S →+* MvPolynomial (Fin q) (FrozenField k S) := E.toRingHom
  let G := fun t => numbered k S e (g t)
  let I := Ideal.span (range g)
  have mapped : (I.map (specialize k S)).map f=Ideal.span (range G) := by
    change ((Ideal.span (range g)).map (specialize k S)).map f=_
    rw [Ideal.map_span,Ideal.map_span,←Set.range_comp,←Set.range_comp]
    rfl
  let _ : Q.IsMaximal := maxQ
  have maxM : (Q.map f).IsMaximal := Ideal.map_isMaximal_of_equiv E
  have ker : RingHom.ker f=⊥ := (RingHom.injective_iff_ker_eq_bot f).mp E.injective
  have minM : Q.map f ∈ (Ideal.span (range G)).minimalPrimes := by
    rw [←mapped,Ideal.minimalPrimes_map_of_surjective (f:=f) E.surjective,ker,sup_bot_eq]
    exact ⟨Q,minQ,rfl⟩
  have back : (Q.map f).comap f=Q := by
    rw [Ideal.comap_map_of_surjective f E.surjective]
    change Q ⊔ RingHom.ker f = Q
    rw [ker,sup_bot_eq]
  have contract : (Q.map f).comap (numbered k S e)=P := by
    change (Q.map f).comap (f.comp (specialize k S))=P
    rw [←Ideal.comap_comap,back,under]
  refine ⟨S,ho,basis,q,e,rfl,Nat.card_le_card_of_injective ((↑) : (↑Sᶜ) → V) Subtype.val_injective,
    Q.map f,maxM,minM,contract,?_,fun t => (numbered_totalDegree _ _ _).trans (degree t)⟩
  have h : X o-C c ∈ (Q.map f).comap (numbered k S e) := contract.symm ▸ value
  change numbered k S e (X o-C c) ∈ Q.map f at h
  rw [map_sub, numbered_C, numbered_X_compl S e (⟨o,ho⟩ : (↑Sᶜ))] at h
  exact h

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.CriticalLocus.constant_on_selected_component

∀ {k : Type u_1} {X : Type u_2} {E : Type u_3} {R : Type u_4} [inst : Field k] [inst_1 : Fintype R]
  [Fintype X] [CharZero k] [IsAlgClosed k] (f : MvPolynomial X k) (g : E → MvPolynomial X k) (pick : R → E)
  (P : Ideal (MvPolynomial (PlanarUnitDistances.CriticalLocus.Variables X R) k)) [P.IsPrime],
  PlanarUnitDistances.CriticalLocus.incidenceIdeal f g pick ≤ P →
    ∀ (c : k),
      PlanarUnitDistances.CriticalLocus.outputVariable - MvPolynomial.C c ∈ P →
        ∃ Q ∈ (PlanarUnitDistances.CriticalLocus.selectedIdeal f g pick).minimalPrimes,
          Q ≤ P ∧ PlanarUnitDistances.CriticalLocus.outputVariable - MvPolynomial.C c ∈ Q
Lean source · PlanarUnitDistances/SelectedCriticalLocus.lean, lines 25–45
/-- Each component of the full multiplier system lies on a component of the
selected system with the same constant output. This uses constancy on the
larger component, including when the full component has smaller dimension. -/
theorem constant_on_selected_component [Fintype X] [CharZero k] [IsAlgClosed k]
    (f : MvPolynomial X k) (g : E → MvPolynomial X k) (pick : R → E)
    (P : Ideal (MvPolynomial (Variables X R) k)) [P.IsPrime]
    (hP : incidenceIdeal f g pick ≤ P) (c : k) (hc : outputVariable - C c ∈ P) :
    ∃ Q ∈ (selectedIdeal f g pick).minimalPrimes,
      Q ≤ P ∧ outputVariable - C c ∈ Q := by
  obtain ⟨Q, hQ, hQP⟩ := Ideal.exists_minimalPrimes_le ((selectedIdeal_le f g pick).trans hP)
  have := hQ.isPrime
  obtain ⟨d, hd⟩ := output_constant_mod_prime f (g ∘ pick) id Q hQ.le
  let q := Ideal.Quotient.mkₐ k P
  have coordinate (b : k) (hb : outputVariable - C b ∈ P) :
      q outputVariable = algebraMap k _ b := by
    have hz : q (outputVariable - C b) = 0 := Ideal.Quotient.eq_zero_iff_mem.mpr hb
    rw [map_sub, sub_eq_zero] at hz
    exact hz.trans (q.commutes b)
  have hcd : c = d := (algebraMap k _).injective
    ((coordinate c hc).symm.trans (coordinate d (hQP hd)))
  exact ⟨Q, hQ, hQP, hcd ▸ hd⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 6.7 Choosing the square system

Lean verified

Write g 0 , … , g w − 1 for the equations after the slice. For successively all but finitely many natural numbers b 1 , … , b q , the same M is minimal over the q equations

G i ( Y ) = ∑ ν = 0 w − 1 b i ν g ν ( Y ) = 0 ( 1 ≤ i ≤ q ) .

Each excluded finite set may depend on the preceding choices.

Proof

At an intermediate prime strictly below M that is minimal over the cuts made so far, at least one original equation survives. Its coefficient in ∑ ν B ν g ν prevents this polynomial from vanishing identically modulo that prime. Only finitely many natural B are roots, since the field has characteristic zero. Avoid those roots for the finitely many relevant minimal primes. Each cut increases the lower bound on their heights by one. A maximal ideal in q polynomial variables over a field has height q . After q cuts a minimal prime below M must therefore equal M .

Inspect the Lean declarations

PlanarUnitDistances.CoordinateSlice.eventual_square_after_slice

∀ {k : Type u_1} {V : Type u_2} [inst : Field k] [CharZero k] (S : Set V) {q w : ℕ} (e : ↑Sᶜ ≃ Fin q)
  (g : Fin w → PlanarUnitDistances.CoordinateSlice.Poly k V)
  (M : Ideal (MvPolynomial (Fin q) (PlanarUnitDistances.CoordinateSlice.FrozenField k S))) [M.IsMaximal],
  M ∈
      (Ideal.span
          (Set.range fun t => (PlanarUnitDistances.CoordinateSlice.numbered k S e) (g t))).minimalPrimes →
    ∀ᶠ (a : Fin q → ℕ) in PlanarUnitDistances.StationaryDeformation.integerTuples q,
      M ∈
        (Ideal.span
            (Set.range fun i =>
              PlanarUnitDistances.StationaryDeformation.combination
                (fun t => (PlanarUnitDistances.CoordinateSlice.numbered k S e) (g t)) (a i))).minimalPrimes
Lean source · PlanarUnitDistances/NumberedCoordinateSlice.lean, lines 75–83
/-- Over characteristic zero the very ideal produced above admits q
explicit Vandermonde combinations for nested cofinally many choices. -/
theorem eventual_square_after_slice [CharZero k] (S : Set V) {q w : ℕ} (e : (↑Sᶜ) ≃ Fin q)
    (g : Fin w → Poly k V) (M : Ideal (MvPolynomial (Fin q) (FrozenField k S))) [M.IsMaximal]
    (isolated : M ∈ (Ideal.span (range (fun t => numbered k S e (g t)))).minimalPrimes) :
    ∀ᶠ a in StationaryDeformation.integerTuples q, M ∈ (Ideal.span (range
      (fun i => StationaryDeformation.combination (fun t => numbered k S e (g t)) (a i)))).minimalPrimes :=
  StationaryDeformation.generic_square_selection (k:=FrozenField k S) _ M isolated q
    (StationaryDeformation.maximal_height_fin q M)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.StationaryDeformation.generic_square_selection

∀ {R : Type u_1} {k : Type u_2} [inst : CommRing R] [IsNoetherianRing R] [inst_2 : Field k] [CharZero k]
  [Algebra k R] {w : ℕ} (g : Fin w → R),
  ∀ P ∈ (Ideal.span (Set.range g)).minimalPrimes,
    ∀ (n : ℕ),
      P.height = ↑n →
        ∀ᶠ (a : Fin n → ℕ) in PlanarUnitDistances.StationaryDeformation.integerTuples n,
          P ∈
            (Ideal.span
                (Set.range fun i =>
                  PlanarUnitDistances.StationaryDeformation.combination g (a i))).minimalPrimes
Lean source · PlanarUnitDistances/GenericSquareSelection.lean, lines 86–106
/-- As many combinations as the height of P isolate P locally. The nested
cofinite quantifiers allow extraction of polynomial coefficients in the mixing
parameters after the geometric argument. -/
theorem generic_square_selection (g : Fin w → R) (P : Ideal R)
    (hP : P ∈ (Ideal.span (Set.range g)).minimalPrimes) (n : ℕ) (height : P.height=n) :
    ∀ᶠ a in integerTuples n, P ∈ (Ideal.span (Set.range (fun i => combination g (a i)))).minimalPrimes := by
  classical
  let := hP.isPrime
  filter_upwards [generic_cuts_bound (k:=k) g P hP n 0 ⊥ (by simp)] with a ha
  let J := Ideal.span (Set.range (fun i => combination g (a i)))
  have subset : J ≤ P := Ideal.span_le.mpr (by rintro x ⟨i,rfl⟩; exact hP.le (combination_mem g _))
  obtain ⟨Q,hQ,le⟩ := Ideal.exists_minimalPrimes_le subset
  suffices Q = P by simpa [this] using hQ
  by_contra ne
  have strict := lt_of_le_of_ne le ne
  let := hQ.isPrime
  have jm : Q ∈ (cuts g n a ⊥).minimalPrimes := by simpa [cuts_eq,J] using hQ
  have bound : (n:ℕ∞) ≤ Q.height := by simpa using ha Q jm strict
  have step := (add_le_add bound (le_refl (1:ℕ∞))).trans (Ideal.height_add_one_le_of_lt_of_isPrime strict)
  rw [height] at step
  exact (by exact_mod_cast Nat.not_succ_le_self n : ¬ (n:ℕ∞)+1≤n) step

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 6.8 The integral coefficients of the chosen equations

Lean verified

Homogenize the G i to degree two using X 0 , and adjoin the linear form X j . Before any specialization, every coefficient of these q + 1 forms has an integral expression in the mixing variables B i , the frozen coordinates S , and the signed labels U = ( a i j , a i j − 1 ) , treated as independent indeterminates. For each expression A ,

deg ⁡ A ≤ 100 , ∑ m | coeff m A | ≤ 2 173 .

Evaluating this table at the actual labels and B i = b i gives the coefficients of the chosen equations and test form, in their specified order over C ( S ) .

Proof

Number the original selected equations once and use that numbering both for the powers of B i and for the rows entering elimination. There are at most 98 rows, so the largest mixing exponent is at most 97 . Freeze just the members of S . In each coefficient slot the other state exponents select precisely the corresponding coefficient of the affine polynomial, with the power of X 0 supplying its missing degree. For the linear test there is one coefficient equal to one. The map K [ S ] → C ( S ) , which applies σ to coefficients and keeps S as indeterminates, is injective. On mixing variables, frozen variables and labels separately, evaluation in this field agrees with specializing the integral table in two stages.

Inspect the Lean declarations

PlanarUnitDistances.IntegralGrid.honest_coefficients_budget

∀ {I : Type u_1} {J : Type u_2} [inst : Fintype I] [inst_1 : Fintype J] {r q w : ℕ} (i : I) (j : Option J)
  (pick : Fin r → PlanarUnitDistances.TorusCritical.Equation I J),
  r ≤ 47 →
    Fintype.card (PlanarUnitDistances.IntegralGrid.Slots I J r) ≤ 98 →
      ∀ (S : Set (PlanarUnitDistances.IntegralGrid.Slots I J r)) (free : ↑Sᶜ ≃ Fin q)
        (ord : PlanarUnitDistances.IntegralGrid.Input I J r ≃ Fin w) (out : Fin q)
        (b : PlanarUnitDistances.HomogeneousMacaulay.Coord q)
        (m :
          PlanarUnitDistances.HomogeneousMacaulay.Mon q
            (PlanarUnitDistances.HomogeneousMacaulay.formDegree b)),
        have C := PlanarUnitDistances.IntegralGrid.honestCoefficients i j pick S free ord out b m;
        MvPolynomial.totalDegree C ≤ 100 ∧ PlanarUnitDistances.EliminantHeight.coefficientSum C ≤ 2 ^ 173
Lean source · PlanarUnitDistances/HonestMacaulayTable.lean, lines 31–41
theorem honest_coefficients_budget (i : I) (j : Option J) (pick : Fin r → Equation I J)
    (hs : r≤47) (hq : Fintype.card (Slots I J r)≤98)
    (S : Set (Slots I J r)) (free : (↑Sᶜ) ≃ Fin q) (ord : Input I J r ≃ Fin w)
    (out : Fin q) (b : HomogeneousMacaulay.Coord q) (m : Mon q (formDegree b)) :
    let C := honestCoefficients i j pick S free ord out b m
    C.totalDegree ≤ 100 ∧ coefficientSum C ≤ 2^173 := by
  cases b with
  | none =>
    dsimp only [honestCoefficients]
    split <;> simp [coefficientSum]
  | some t => exact honest_actual_budget i j pick hs hq S free _ (index_budget ord hq) t m.val.some

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.IntegralGrid.honest_coefficients_evaluation

∀ {I : Type u_1} {J : Type u_2} [inst : Fintype I] [inst_1 : Fintype J] {r q w : ℕ} {k : Type u_3}
  [inst_2 : Field k] (a : I → Option J → kˣ) (i : I) (j : Option J)
  (pick : Fin r → PlanarUnitDistances.TorusCritical.Equation I J)
  (S : Set (PlanarUnitDistances.IntegralGrid.Slots I J r)) (free : ↑Sᶜ ≃ Fin q)
  (ord : PlanarUnitDistances.IntegralGrid.Input I J r ≃ Fin w) (out : Fin q) (mix : Fin q → ℕ)
  (b : PlanarUnitDistances.HomogeneousMacaulay.Coord q)
  (m : PlanarUnitDistances.HomogeneousMacaulay.Mon q (PlanarUnitDistances.HomogeneousMacaulay.formDegree b)),
  have g := fun t =>
    ∑ e,
      ↑(mix t) ^ ↑(ord e) *
        (PlanarUnitDistances.IntegralGrid.numbered S free)
          (PlanarUnitDistances.CriticalLocus.incidenceEquation (PlanarUnitDistances.TorusCritical.ratio a i j)
            (PlanarUnitDistances.TorusCritical.equation a ∘ pick) id e);
  (MvPolynomial.eval₂Hom (Int.castRingHom (PlanarUnitDistances.IntegralGrid.FrozenField k S))
        (PlanarUnitDistances.IntegralGrid.honestValue S
          (PlanarUnitDistances.TorusCritical.ratioParameterValues a) fun t => ↑(mix t)))
      (PlanarUnitDistances.IntegralGrid.honestCoefficients i j pick S free ord out b m) =
    PlanarUnitDistances.UniversalIncidence.inputCoefficients out
      (fun t => PlanarUnitDistances.UniversalIncidence.quadraticHomogenization (g t)) b m
Lean source · PlanarUnitDistances/HonestMacaulayTable.lean, lines 43–65
/-- Specialization into the actual coefficient field of the sliced stationary component.
The input has no deformation or test parameter. The test form is the desired
remaining output coordinate. -/
theorem honest_coefficients_evaluation {k : Type*} [Field k] (a : I → Option J → kˣ)
    (i : I) (j : Option J) (pick : Fin r → Equation I J)
    (S : Set (Slots I J r)) (free : (↑Sᶜ) ≃ Fin q) (ord : Input I J r ≃ Fin w)
    (out : Fin q) (mix : Fin q → ℕ) (b : HomogeneousMacaulay.Coord q) (m : Mon q (formDegree b)) :
    let g t := ∑ e, (mix t : MvPolynomial (Fin q) (FrozenField k S)) ^ (ord e).val *
      numbered S free (CriticalLocus.incidenceEquation (TorusCritical.ratio a i j)
        ((TorusCritical.equation a) ∘ pick) id e)
    eval₂Hom (Int.castRingHom (FrozenField k S))
        (honestValue S (ratioParameterValues a) (fun t => (mix t : FrozenField k S)))
        (honestCoefficients i j pick S free ord out b m) =
      UniversalIncidence.inputCoefficients out (fun t => UniversalIncidence.quadraticHomogenization (g t)) b m := by
  intro g
  cases b with
  | none =>
    refine Eq.trans ?_ (UniversalIncidence.input_test_slot out (fun t => UniversalIncidence.quadraticHomogenization (g t)) m).symm
    dsimp only [honestCoefficients]
    split <;> simp
  | some t =>
    exact (honest_actual_evaluation i j pick a S free (fun e => (ord e).val) t m.val.some mix).trans
      (UniversalIncidence.input_quadratic_slot out t g m).symm

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.IntegralGrid.mixedEvaluation_eq_honest

∀ {k : Type u_1} {L : Type u_2} {U : Type u_3} {V : Type u_4} [inst : Field k] [inst_1 : Field L] {q : ℕ}
  (φ : k →+* L) (S : Set V) (u : U → k) (a : Fin q → ℕ),
  (PlanarUnitDistances.StationaryDeformation.mixedEvaluation
          (PlanarUnitDistances.IntegralGrid.embedFrozen φ S) a).comp
      ((MvPolynomial.map (MvPolynomial.aeval u).toRingHom).comp
        (MvPolynomial.sumAlgEquiv ℤ (Fin q ⊕ ↑S) U).toRingEquiv.toRingHom) =
    MvPolynomial.eval₂Hom (Int.castRingHom (PlanarUnitDistances.IntegralGrid.FrozenField L S))
      (PlanarUnitDistances.IntegralGrid.honestValue S (⇑φ ∘ u) fun i => ↑(a i))
Lean source · PlanarUnitDistances/MixedHonestEvaluation.lean, lines 25–37
/-- On the integral table, specializing the source-field labels and then
specializing the integer row choices agrees with the direct evaluation in
the ambient rational function field; the frozen coordinates stay independent.
The second homomorphism on the left is the definition of `specializeLabels`. -/
theorem mixedEvaluation_eq_honest (φ : k →+* L) (S : Set V) (u : U → k) (a : Fin q → ℕ) :
    (mixedEvaluation (embedFrozen φ S) a).comp
      ((MvPolynomial.map (aeval (R:=ℤ) u).toRingHom).comp (sumAlgEquiv ℤ (Fin q ⊕ S) U).toRingHom) =
    eval₂Hom (Int.castRingHom (FrozenField L S))
      (honestValue S (φ ∘ u) (fun i => (a i : FrozenField L S))) := by
  apply MvPolynomial.ringHom_ext
  · intro z
    simp [honestValue,inputScalar]
  · rintro ((i|s)|t) <;> simp [honestValue,inputScalar]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.IntegralGrid.embedFrozen_injective

∀ {k : Type u_1} {L : Type u_2} {V : Type u_4} [inst : Field k] [inst_1 : Field L] (φ : k →+* L) (S : Set V),
  Function.Injective ⇑(PlanarUnitDistances.IntegralGrid.embedFrozen φ S)
Lean source · PlanarUnitDistances/MixedHonestEvaluation.lean, lines 14–15
theorem embedFrozen_injective (φ : k →+* L) (S : Set V) : Function.Injective (embedFrozen φ S) :=
  (IsFractionRing.injective (MvPolynomial S L) (FrozenField L S)).comp (map_injective φ φ.injective)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 6.9 Degree of the universal incidence relation

Lean verified

Take the coefficients of a linear form and q quadratic forms in X 0 , … , X q to be independent variables over Z . Parametrize their common zero on the chart X 0 = 1 by solving for the coefficient of X 0 d i in each form of degree d i . The kernel of the resulting map of coefficient rings is generated by a nonzero polynomial F . For 1 ≤ q ≤ 98 ,

deg ⁡ F ≤ 2 q + q 2 q − 1 < 2 104 .

Its specialization vanishes whenever the forms have a common zero ( 1 , x 1 , … , x q ) , including over a commutative coefficient ring.

Proof

Index the rows and columns of a Macaulay matrix by the monomials of degree q + 1 . For a distinguished form i , choose a dividing pure power X h d h for each row monomial, giving preference to h ≠ i . The row contains the coefficients of the corresponding monomial multiple of form h . At the pure-power system the matrix is the identity. Its determinant is a nonzero incidence relation. In a row that used form i , every exponent away from i is strictly below its corresponding d h . These exponents determine the row, giving at most ∏ h ≠ i d h such rows.

On the affine incidence parametrization, the coefficients remaining after separating the constant coefficient of the linear form inject into the parameter ring. Passing to their fraction field and using the primitive polynomial lemma gives a principal kernel over the original integral ring. Its generator divides the determinant just constructed for every choice of i . The degree budget follows by adding the bound 2 q for the linear block and 2 q − 1 for each quadratic block.

Inspect the Lean declarations

PlanarUnitDistances.UniversalIncidence.exists_incidence_relation

∀ (q : ℕ),
  ∃ F,
    F ≠ 0 ∧
      PlanarUnitDistances.UniversalIncidence.incidenceMap F = 0 ∧
        (∀ (G : PlanarUnitDistances.BlockMacaulay.Universal q),
            PlanarUnitDistances.UniversalIncidence.incidenceMap G = 0 ↔ F ∣ G) ∧
          MvPolynomial.totalDegree F ≤ 2 ^ q + q * 2 ^ (q - 1)
Lean source · PlanarUnitDistances/AffineUniversalRelation.lean, lines 147–178
/-- A single nonzero integral relation for the full affine incidence
family divides every distinguished-block minor. This detects incidence at
x₀=1 even when the common zero is singular or belongs to a component. -/
theorem exists_incidence_relation (q : ℕ) :
    ∃ F : BlockMacaulay.Universal q, F≠0 ∧ incidenceMap F=0 ∧
      (∀ G : BlockMacaulay.Universal q, incidenceMap G=0 ↔ F ∣ G) ∧
      F.totalDegree≤2^q+q*2^(q-1) := by
  let e := parameterPolynomial q
  let φ := (incidenceMap (q:=q)).comp e.symm.toRingHom
  have faithful : Function.Injective (φ.comp Polynomial.C) := by
    change Function.Injective ((incidenceMap (q:=q)).comp (e.symm.toRingHom.comp Polynomial.C))
    rw [coefficient_hom]
    exact remaining_coefficients_faithful
  let w := e (BlockMacaulay.minor (none : Coord q))
  have nw : w≠0 := by
    intro h
    exact BlockMacaulay.minor_ne_zero none (e.injective (by simpa [w] using h))
  have zw : φ w=0 := by simpa [φ,w] using minor_in_kernel (none : Coord q)
  obtain ⟨p,np,zp,univ⟩ := exists_common_relation φ faithful w nw zw
  let F := e.symm p
  have nf : F≠0 := by
    intro h
    exact np (by simpa [F] using congrArg e h)
  have all (G : BlockMacaulay.Universal q) : incidenceMap G=0 ↔ F ∣ G := by
    have agree : φ (e G)=incidenceMap G := by simp [φ]
    rw [←agree,univ]
    constructor
    · intro h
      simpa [F] using map_dvd e.symm h
    · intro h
      simpa [F] using map_dvd e h
  exact ⟨F,nf,zp,all,BlockMacaulay.totalDegree_of_common_divisor (fun ℓ => (all _).mp (minor_in_kernel ℓ))⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.UniversalIncidence.specializes_at_affine_point

∀ {q : ℕ} {R : Type u_1} [inst : CommRing R] (A : PlanarUnitDistances.HomogeneousMacaulay.Coefficients q R)
  (x : Fin q → R),
  (∀ (i : PlanarUnitDistances.HomogeneousMacaulay.Coord q),
      (MvPolynomial.eval fun j => Option.elim j 1 x) (PlanarUnitDistances.HomogeneousMacaulay.form A i) = 0) →
    ∀ (F : PlanarUnitDistances.BlockMacaulay.Universal q),
      PlanarUnitDistances.UniversalIncidence.incidenceMap F = 0 →
        (MvPolynomial.eval₂Hom (Int.castRingHom R) fun e => A e.fst e.snd) F = 0
Lean source · PlanarUnitDistances/AffineUniversalRelation.lean, lines 87–113
/-- Every relation in this kernel vanishes at the coefficients of every
actual homogeneous system with a common root whose first coordinate is one. -/
theorem specializes_at_affine_point {R : Type*} [CommRing R] (A : Coefficients q R) (x : Fin q → R)
    (root : ∀i,eval (fun j : Coord q => j.elim 1 x) (form A i)=0)
    (F : BlockMacaulay.Universal q) (relation : incidenceMap F=0) :
    eval₂Hom (Int.castRingHom R) (fun e : Parameter q => A e.1 e.2) F=0 := by
  let ψ : IncidenceRing q →+* R := eval₂Hom (Int.castRingHom R)
    (Sum.elim (fun e : FreeCoeff q => A e.1 e.2.val) x)
  have point (j : Coord q) : ψ (affinePoint j)=j.elim 1 x := by cases j <;> simp [affinePoint,ψ]
  have mon (s : Coord q →₀ ℕ) : ψ (ambientMonomial s)=monAt x s := by
    simp [ambientMonomial,monAt,Finsupp.prod,point]
  have recovered (i : Coord q) : ψ (reconstruct i)=A i (constantMon i) := by
    have hz := root i
    rw [affine_value] at hz
    simp only [reconstruct,map_neg,map_sum,map_mul,mon]
    simpa [ψ] using (neg_eq_of_add_eq_zero_right hz)
  have commutes : ψ.comp incidenceMap = eval₂Hom (Int.castRingHom R) (fun e : Parameter q => A e.1 e.2) := by
    apply MvPolynomial.ringHom_ext
    · intro a
      simp [incidenceMap,ψ]
    · rintro ⟨i,m⟩
      by_cases h : m=constantMon i
      · subst m
        simp [incidenceMap,affineCoefficients,recovered]
      · simp [incidenceMap,affineCoefficients,h,ψ]
  rw [←commutes]
  exact (congrArg ψ relation).trans (map_zero _)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.BlockMacaulay.block_degree_of_dvd

∀ {q : ℕ} (ℓ : PlanarUnitDistances.HomogeneousMacaulay.Coord q)
  {F : PlanarUnitDistances.BlockMacaulay.Universal q},
  F ∣ PlanarUnitDistances.BlockMacaulay.minor ℓ →
    ((PlanarUnitDistances.BlockMacaulay.blockScale ℓ) F).natDegree ≤
      Option.elim ℓ (2 ^ q) fun x => 2 ^ (q - 1)
Lean source · PlanarUnitDistances/BlockMacaulay.lean, lines 202–210
/-- Every common divisor inherits the saving in the same distinguished
block, even though a different minor is used for every block. -/
theorem block_degree_of_dvd {F : Universal q} (h : F ∣ minor ℓ) :
    (blockScale ℓ F).natDegree ≤ ℓ.elim (2^q) (fun _ => 2^(q-1)) := by
  have le := Polynomial.natDegree_le_of_dvd (map_dvd (blockScale ℓ) h) (blockScale_minor_ne_zero ℓ)
  rw [blockScale_minor,Polynomial.natDegree_mul (pow_ne_zero _ Polynomial.X_ne_zero)
    (Polynomial.C_ne_zero.mpr (minor_ne_zero ℓ))] at le
  simp only [Polynomial.natDegree_X_pow,Polynomial.natDegree_C,add_zero] at le
  exact le.trans ((assigned_bound ℓ).trans_eq (off_product ℓ))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.BlockMacaulay.totalDegree_of_common_divisor

∀ {q : ℕ} {F : PlanarUnitDistances.BlockMacaulay.Universal q},
  (∀ (ℓ : PlanarUnitDistances.HomogeneousMacaulay.Coord q), F ∣ PlanarUnitDistances.BlockMacaulay.minor ℓ) →
    MvPolynomial.totalDegree F ≤ 2 ^ q + q * 2 ^ (q - 1)
Lean source · PlanarUnitDistances/BlockMacaulay.lean, lines 245–261
/-- A common divisor is bounded in total coefficient degree, although
the original determinants have much larger total degree individually. -/
theorem totalDegree_of_common_divisor {F : Universal q} (dvd : ∀ℓ, F ∣ minor ℓ) :
    F.totalDegree ≤ 2^q+q*2^(q-1) := by
  apply Finset.sup_le
  intro d hd
  have eq : (∑ b : Coord q, blockExponent b d) = d.sum (fun _ k => k) := by
    unfold blockExponent Finsupp.sum
    rw [sum_comm]
    apply sum_congr rfl
    intro e _
    simp [ite_mul]
  rw [←eq]
  calc
    _ ≤ ∑ b : Coord q, b.elim (2^q) (fun _ => 2^(q-1)) :=
      sum_le_sum fun b _ => (support_exponent_le b F hd).trans (block_degree_of_dvd b (dvd b))
    _ = _ := by simp [Fintype.sum_option]

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.BlockMacaulay.degree_budget

∀ {q : ℕ} {F : PlanarUnitDistances.BlockMacaulay.Universal q},
  (∀ (ℓ : PlanarUnitDistances.HomogeneousMacaulay.Coord q), F ∣ PlanarUnitDistances.BlockMacaulay.minor ℓ) →
    q ≤ 98 → MvPolynomial.totalDegree F < 2 ^ 104
Lean source · PlanarUnitDistances/BlockMacaulay.lean, lines 263–267
theorem degree_budget {F : Universal q} (dvd : ∀ℓ, F ∣ minor ℓ) (hq : q≤98) : F.totalDegree < 2^104 := by
  apply (totalDegree_of_common_divisor dvd).trans_lt
  have h₂ : 2^q ≤ 2^98 := Nat.pow_le_pow_right (by decide) hq
  have h₃ : 2^(q-1) ≤ 2^97 := Nat.pow_le_pow_right (by decide) (by omega)
  exact (Nat.add_le_add h₂ (Nat.mul_le_mul hq h₃)).trans_lt (by decide)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 6.10 Size of the deformed relation

Lean verified

For q ≤ 98 , choose the generator in Lemma 6.9 with coefficient sum at most 2 2 400 . Replace the test form by X j − T X 0 and the i -th quadric by G i h o m + ε X i 2 . For the universal input table the deformed relation has degree < 2 104 in all its variables together and coefficient sum at most 2 2 401 . After substitution of the integral table of Lemma 6.8, each coefficient of ε e T t has degree at most 2 112 in the remaining variables and coefficient sum at most 2 2 402 .

Proof

Factor one of the nonzero integral determinants as F times a cofactor. At integer inputs where the cofactor is nonzero, its absolute value is at least one. The determinant bound therefore bounds the values of F there. Integer interpolation on a finite box away from the zero set of the cofactor gives the required coefficient bound. The universal deformation adds a single parameter to the relevant pure-power slots. For the substitution of the grid table, the estimates use the bounds 256 and 2 200 for the degree and coefficient sum of an entry. In particular 256 ⋅ 2 104 = 2 112 . Collecting one coefficient of ε e T t preserves the coefficient-sum bound.

Inspect the Lean declarations

PlanarUnitDistances.MacaulayFactorBounds.exists_bounded_incidence_relation

∀ q ≤ 98,
  ∃ F,
    F ≠ 0 ∧
      PlanarUnitDistances.UniversalIncidence.incidenceMap F = 0 ∧
        (∀ (G : PlanarUnitDistances.BlockMacaulay.Universal q),
            PlanarUnitDistances.UniversalIncidence.incidenceMap G = 0 ↔ F ∣ G) ∧
          MvPolynomial.totalDegree F < 2 ^ 104 ∧
            PlanarUnitDistances.EliminantHeight.coefficientSum F ≤ 2 ^ 2 ^ 400 ∧
              (MvPolynomial.eval₂ MvPolynomial.C PlanarUnitDistances.MacaulayFactorBounds.genericDeformedEntry
                      F).totalDegree <
                  2 ^ 104 ∧
                PlanarUnitDistances.EliminantHeight.coefficientSum
                    (MvPolynomial.eval₂ MvPolynomial.C
                      PlanarUnitDistances.MacaulayFactorBounds.genericDeformedEntry F) ≤
                  2 ^ 2 ^ 401
Lean source · PlanarUnitDistances/IntegralMacaulayDeformation.lean, lines 82–94
/-- A single integral generator of the actual affine incidence kernel has all four
    degree and coefficient bounds, before and after adjoining ε and T. -/
theorem exists_bounded_incidence_relation (q : ℕ) (hq : q ≤ 98) :
    ∃ F : Universal q, F ≠ 0 ∧ UniversalIncidence.incidenceMap F = 0 ∧
      (∀ G : Universal q, UniversalIncidence.incidenceMap G = 0 ↔ F ∣ G) ∧
      F.totalDegree < 2^104 ∧ coefficientSum F ≤ 2^(2^400) ∧
      (F.eval₂ C genericDeformedEntry).totalDegree < 2^104 ∧
      coefficientSum (F.eval₂ C genericDeformedEntry) ≤ 2^(2^401) := by
  obtain ⟨F, hn, hr, hker, _⟩ := UniversalIncidence.exists_incidence_relation q
  have hd (i : Coord q) : F ∣ minor i := (hker _).mp (UniversalIncidence.minor_in_kernel i)
  have hdeg := degree_budget hd hq
  exact ⟨F, hn, hr, hker, hdeg, factor_coefficient_sum hq none F (hd none),
    (generic_deformation_degree F).trans_lt hdeg, generic_deformation_size hq F hd⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.MacaulayFactorBounds.specialized_coefficient_budget

∀ {q : ℕ},
  q ≤ 98 →
    ∀ (F : PlanarUnitDistances.BlockMacaulay.Universal q),
      (∀ (i : PlanarUnitDistances.HomogeneousMacaulay.Coord q),
          F ∣ PlanarUnitDistances.BlockMacaulay.minor i) →
        ∀ {σ : Type u_1} (A : PlanarUnitDistances.HomogeneousMacaulay.Coefficients q (MvPolynomial σ ℤ)),
          (∀ (i : PlanarUnitDistances.HomogeneousMacaulay.Coord q)
              (m :
                PlanarUnitDistances.HomogeneousMacaulay.Mon q
                  (PlanarUnitDistances.HomogeneousMacaulay.formDegree i)),
              (A i m).totalDegree ≤ 256) →
            (∀ (i : PlanarUnitDistances.HomogeneousMacaulay.Coord q)
                (m :
                  PlanarUnitDistances.HomogeneousMacaulay.Mon q
                    (PlanarUnitDistances.HomogeneousMacaulay.formDegree i)),
                PlanarUnitDistances.EliminantHeight.coefficientSum (A i m) ≤ 2 ^ 200) →
              ∀ (j k : ℕ),
                have P :=
                  ((Polynomial.Bivariate.swap
                            ((PlanarUnitDistances.UniversalIncidence.deformationMap A) F)).coeff
                        k).coeff
                    j;
                P.totalDegree ≤ 2 ^ 112 ∧ PlanarUnitDistances.EliminantHeight.coefficientSum P ≤ 2 ^ 2 ^ 402
Lean source · PlanarUnitDistances/SpecializedCoefficientBudget.lean, lines 18–36
/-- For any integral table substituted into the q selected quadrics and the test form,
    bound an arbitrary ε- and T-coefficient of the actual swapped nested relation. -/
theorem specialized_coefficient_budget {q : ℕ} (hq : q ≤ 98) (F : Universal q)
    (divides : ∀ i, F ∣ minor i) {σ : Type*} (A : Coefficients q (MvPolynomial σ ℤ))
    (degreeA : ∀ i m, (A i m).totalDegree ≤ 256)
    (sizeA : ∀ i m, coefficientSum (A i m) ≤ 2^200) (j k : ℕ) :
    let P := ((Polynomial.Bivariate.swap (UniversalIncidence.deformationMap A F)).coeff k).coeff j
    P.totalDegree ≤ 2^112 ∧ coefficientSum P ≤ 2^(2^402) := by
  dsimp only
  obtain ⟨G,dG,sG,representation⟩ := specialized_swapped_coefficient hq F divides j k
  rw [representation A]
  have mapC : Int.castRingHom (MvPolynomial σ ℤ) = C := by ext; simp
  rw [mapC]
  let b := fun e : Parameter q => A e.1 e.2
  change (G.eval₂ C b).totalDegree ≤ _ ∧ coefficientSum (G.eval₂ C b) ≤ _
  obtain ⟨d,t⟩ := exponents _ dG
  refine ⟨(totalDegree_substitution_le G b 256 (fun i => degreeA _ _)).trans d, ?_⟩
  exact (coefficientSum_substitution_le G b (Nat.pow_pos (by decide)) (fun i => sizeA _ _)).trans
    (size_budget _ _ (2^401) 200 (2^402) sG t)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 6.11 The first surviving deformation coefficient

Lean verified

Fix the chosen square system over the slice field L = C ( S ) . The deformed relation H ( ε , T ) ∈ L [ ε , T ] is nonzero. Write H = ∑ e ε e H e ( T ) and let d be the least index with H d ≠ 0 . For every maximal ideal M minimal over the undeformed square system, H d ( Y j ) ∈ M . In particular, if Y j − σ ( c ) ∈ M , then H d ( σ ( c ) ) = 0 .

Proof

The pure-power term of the determinant ensures nonvanishing after deformation for every input table. Substituting T = Y j into H puts it in the ideal of the actual deformed equations. The incidence identity applies directly in the quotient by those equations. For the given M , there is a minimal prime of this deformed ideal below the inverse image of M under ε ↦ 0 which does not contain ε . Otherwise the height bound for an ideal generated by q elements conflicts with the height of the point in the polynomial ring with the extra variable. In the domain given by that prime, cancel the common factor ε d . Reduction to the special fibre now gives H d ( Y j ) ∈ M . This step permits H ( 0 , T ) to vanish identically.

Inspect the Lean declarations

PlanarUnitDistances.UniversalIncidence.concrete_deformation_membership

∀ {q : ℕ} {k : Type u_1} [inst : Field k] (F : PlanarUnitDistances.BlockMacaulay.Universal q),
  PlanarUnitDistances.UniversalIncidence.incidenceMap F = 0 →
    ∀ (j : Fin q) (Q : Fin q → MvPolynomial (PlanarUnitDistances.HomogeneousMacaulay.Coord q) k),
      (∀ (i : Fin q), (Q i).IsHomogeneous 2) →
        Polynomial.eval₂ (Polynomial.C.comp (PlanarUnitDistances.UniversalIncidence.outputTest j))
            Polynomial.X
            (Polynomial.Bivariate.swap
              ((PlanarUnitDistances.UniversalIncidence.deformationMap
                  (PlanarUnitDistances.UniversalIncidence.inputCoefficients j Q))
                F)) ∈
          Ideal.span (Set.range (PlanarUnitDistances.UniversalIncidence.deformedSquare Q))
Lean source · PlanarUnitDistances/ConcreteSquareElimination.lean, lines 115–126
/-- The swapped deformation polynomial is in the literal ideal of the q
affine equations, after putting T equal to the prescribed state coordinate. -/
theorem concrete_deformation_membership (F : BlockMacaulay.Universal q) (relation : incidenceMap F=0)
    (j : Fin q) (Q : Fin q → MvPolynomial (Coord q) k) (hom : ∀i,(Q i).IsHomogeneous 2) :
    (Polynomial.Bivariate.swap (deformationMap (inputCoefficients j Q) F)).eval₂
      (Polynomial.C.comp (outputTest j)) Polynomial.X ∈ Ideal.span (Set.range (deformedSquare Q)) := by
  let I := Ideal.span (Set.range (deformedSquare Q))
  let π : Polynomial (State q k) →+* (Polynomial (State q k) ⧸ I) := Ideal.Quotient.mk I
  have rootI (i : Fin q) : π (deformedSquare Q i)=0 :=
    (Ideal.Quotient.eq_zero_iff_mem (I:=I)).mpr (Ideal.subset_span (Set.mem_range_self i))
  have zero := evaluation_zero_on_family (q:=q) (k:=k) (D:=Polynomial (State q k) ⧸ I) π F relation j Q hom rootI
  exact (Ideal.Quotient.eq_zero_iff_mem (I:=I)).mp zero

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.StationaryDeformation.isolated_square_lifts

∀ {S : Type u_1} [inst : CommRing S] [IsNoetherianRing S] (n : ℕ) (g : Fin n → Polynomial S) (P : Ideal S)
  [P.IsMaximal],
  P ∈ (Ideal.map (Polynomial.evalRingHom 0) (Ideal.span (Set.range g))).minimalPrimes →
    ↑n ≤ P.height →
      ∃ Q ∈ (Ideal.span (Set.range g)).minimalPrimes,
        Q ≤ Ideal.comap (Polynomial.evalRingHom 0) P ∧ Polynomial.X ∉ Q
Lean source · PlanarUnitDistances/IsolatedStationaryDeformation.lean, lines 31–50
/-- For a square system, an isolated point of height at least n in the special
fiber lies on a horizontal component. No Jacobian condition is required. -/
theorem isolated_square_lifts {S : Type*} [CommRing S] [IsNoetherianRing S]
    (n : ℕ) (g : Fin n → Polynomial S) (P : Ideal S) [P.IsMaximal]
    (special : P ∈ ((Ideal.span (Set.range g)).map (evalRingHom 0)).minimalPrimes)
    (height : (n : ℕ∞) ≤ P.height) :
    ∃ Q ∈ (Ideal.span (Set.range g)).minimalPrimes,
      Q ≤ P.comap (evalRingHom 0) ∧ X ∉ Q := by
  let π : Polynomial S →+* S := evalRingHom 0
  have surj : Function.Surjective π := eval_surjective 0
  let M := P.comap π
  let : M.IsMaximal := Ideal.comap_isMaximal_of_surjective π surj
  let : M.LiesOver P := ⟨by ext a; simp [M, π, Ideal.under, Ideal.mem_comap]⟩
  apply exists_horizontal_prime π surj X (by simp [π, ker_evalRingHom]) _ P special
  intro Q hQ
  have hn : (Set.range g).encard ≤ n := by
    simpa using Set.encard_image_le g Set.univ
  have hlt : (n : ℕ∞) < n + 1 := by exact_mod_cast Nat.lt_succ_self n
  exact (Ideal.height_le_encard_of_mem_minimalPrimes_span hQ).trans hn |>.trans_lt
    (hlt.trans_le ((add_le_add height (le_refl (1 : ℕ∞))).trans_eq (Polynomial.height_eq_height_add_one P M).symm))

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.StationaryDeformation.common_first_coefficient

∀ {k A ι : Type} [inst : Field k] [inst_1 : CommRing A] [inst_2 : Fintype ι]
  (g : Fin (Fintype.card ι) → Polynomial (MvPolynomial ι k)) (φ : A →+* MvPolynomial ι k) (H : Polynomial A),
  H ≠ 0 →
    Polynomial.eval₂ (Polynomial.C.comp φ) Polynomial.X H ∈ Ideal.span (Set.range g) →
      ∃ d,
        H.coeff d ≠ 0 ∧
          (∀ e < d, H.coeff e = 0) ∧
            ∀ (P : Ideal (MvPolynomial ι k)) [P.IsMaximal],
              P ∈ (Ideal.map (Polynomial.evalRingHom 0) (Ideal.span (Set.range g))).minimalPrimes →
                φ (H.coeff d) ∈ P
Lean source · PlanarUnitDistances/SquareSpecialization.lean, lines 9–34
/-- One coefficient is chosen before the component. It vanishes at every
isolated closed point of the special fiber of this square polynomial family. -/
theorem common_first_coefficient {k A ι : Type} [Field k] [CommRing A] [Fintype ι]
    (g : Fin (Fintype.card ι) → Polynomial (MvPolynomial ι k))
    (φ : A →+* MvPolynomial ι k) (H : Polynomial A) (nonzero : H ≠ 0)
    (vanishes : H.eval₂ (C.comp φ) X ∈ Ideal.span (Set.range g)) :
    ∃ d, H.coeff d ≠ 0 ∧ (∀ e < d, H.coeff e = 0) ∧
      ∀ (P : Ideal (MvPolynomial ι k)) [P.IsMaximal],
        P ∈ ((Ideal.span (Set.range g)).map (evalRingHom 0)).minimalPrimes → φ (H.coeff d) ∈ P := by
  obtain ⟨d,hd,before,descend⟩ := UniversalIncidence.first_surviving_coefficient H nonzero
  refine ⟨d,hd,before,?_⟩
  intro P _ special
  obtain ⟨Q,hQ,below,away⟩ := isolated_square_lifts _ g P special (maximal_polynomial_height (k:=k) P).ge
  let := hQ.isPrime
  let f := Ideal.Quotient.mk Q
  let ρ : Polynomial (MvPolynomial ι k) →+* (MvPolynomial ι k ⧸ P) :=
    (Ideal.Quotient.mk P).comp (evalRingHom 0)
  have killed : Q ≤ RingHom.ker ρ := fun x hx => Ideal.Quotient.eq_zero_iff_mem.mpr (below hx)
  let reduce := Ideal.Quotient.lift Q ρ killed
  have zero : H.eval₂ (f.comp (C.comp φ)) (f X) = 0 :=
    (hom_eval₂ H (C.comp φ) f X).symm.trans (Ideal.Quotient.eq_zero_iff_mem.mpr (hQ.le vanishes))
  have res := descend (f.comp (C.comp φ)) reduce (f X)
    (fun h => away (Ideal.Quotient.eq_zero_iff_mem.mp h)) zero (by change (Ideal.Quotient.mk P) (Polynomial.eval 0 X) = 0; simp)
  apply Ideal.Quotient.eq_zero_iff_mem.mp
  change (Ideal.Quotient.mk P) (Polynomial.eval 0 (C (φ (H.coeff d)))) = 0 at res
  simpa using res

Kernel axioms used: propext, Classical.choice, Quot.sound.

Proposition 6.12 An equation over the original number field

Lean verified

There is a nonzero p ∈ K [ T ] , with p ( c ) = 0 , such that for each t its coefficient [ T t ] p is D t ( U ) evaluated at the actual signed labels. The integral polynomial D t satisfies

deg ⁡ D t ≤ 2 112 , ∑ m | coeff m D t | ≤ 2 2 402 .
Proof

Keep the mixing variables B and the frozen coordinates S independent after substituting the labels. A nonzero polynomial in K [ B , S ] remains nonzero in C ( S ) for successively all but finitely many integer choices of B . Apply this fact to a nonzero T -coefficient of the first surviving ε -coefficient. On the intersection with the choices of Lemma 6.7, that same index is the first surviving index. Lemma 6.11 forces its evaluation at c to vanish. If that evaluation were a nonzero polynomial in B , S , it too would survive a common choice. Take one nonzero monomial coefficient in B , S of this relation, retaining T as the variable. This gives p . Each of its coefficients is obtained by extracting coefficients from the bounded integral expression in Lemma 6.10.

Inspect the Lean declarations

PlanarUnitDistances.StationaryDeformation.bounded_generic_root

∀ {k L U S : Type} [inst : Field k] [CharZero k] [inst_2 : Field L] [Fintype U] [Fintype S] {q : ℕ},
  q ≤ 98 →
    ∀ (x : U → k) (ι : MvPolynomial S k →+* L),
      Function.Injective ⇑ι →
        ∀ (c : k) (j : Fin q) (M : Ideal (PlanarUnitDistances.UniversalIncidence.State q L)) [M.IsMaximal],
          MvPolynomial.X j - MvPolynomial.C (ι (MvPolynomial.C c)) ∈ M →
            ∀ (g : (Fin q → ℕ) → Fin q → PlanarUnitDistances.UniversalIncidence.State q L),
              (∀ (a : Fin q → ℕ) (i : Fin q), MvPolynomial.totalDegree (g a i) ≤ 2) →
                (∀ᶠ (a : Fin q → ℕ) in PlanarUnitDistances.StationaryDeformation.integerTuples q,
                    M ∈ (Ideal.span (Set.range (g a))).minimalPrimes) →
                  ∀
                    (A :
                      PlanarUnitDistances.HomogeneousMacaulay.Coefficients q
                        (MvPolynomial ((Fin q ⊕ S) ⊕ U) ℤ)),
                    (∀ (i : PlanarUnitDistances.HomogeneousMacaulay.Coord q)
                        (m :
                          PlanarUnitDistances.HomogeneousMacaulay.Mon q
                            (PlanarUnitDistances.HomogeneousMacaulay.formDegree i)),
                        (A i m).totalDegree ≤ 256) →
                      (∀ (i : PlanarUnitDistances.HomogeneousMacaulay.Coord q)
                          (m :
                            PlanarUnitDistances.HomogeneousMacaulay.Mon q
                              (PlanarUnitDistances.HomogeneousMacaulay.formDegree i)),
                          PlanarUnitDistances.EliminantHeight.coefficientSum (A i m) ≤ 2 ^ 200) →
                        (∀ (a : Fin q → ℕ) (i : PlanarUnitDistances.HomogeneousMacaulay.Coord q)
                            (m :
                              PlanarUnitDistances.HomogeneousMacaulay.Mon q
                                (PlanarUnitDistances.HomogeneousMacaulay.formDegree i)),
                            (PlanarUnitDistances.StationaryDeformation.mixedEvaluation ι a)
                                ((PlanarUnitDistances.StationaryDeformation.specializeLabels x) (A i m)) =
                              PlanarUnitDistances.UniversalIncidence.inputCoefficients j
                                (fun t =>
                                  PlanarUnitDistances.UniversalIncidence.quadraticHomogenization (g a t))
                                i m) →
                          ∃ p,
                            p ≠ 0 ∧
                              p.IsRoot c ∧
                                ∀ (t : ℕ),
                                  ∃ G,
                                    G.totalDegree ≤ 2 ^ 112 ∧
                                      PlanarUnitDistances.EliminantHeight.coefficientSum G ≤ 2 ^ 2 ^ 402 ∧
                                        p.coeff t = (MvPolynomial.aeval x) G
Lean source · PlanarUnitDistances/BoundedGenericRoot.lean, lines 33–80
/-- On the isolated component, all auxiliary choices disappear from the height
estimate. The input table is integral before specializing the labels, the
frozen coordinates or the integer row combinations. The field L holding the
component need not be a number field or be algebraic over k. -/
theorem bounded_generic_root {k L U S : Type} [Field k] [CharZero k] [Field L]
    [Fintype U] [Fintype S] {q : ℕ} (hq : q ≤ 98)
    (x : U → k) (ι : MvPolynomial S k →+* L) (injective : Function.Injective ι)
    (c : k) (j : Fin q) (M : Ideal (State q L)) [M.IsMaximal]
    (value : X j - C (ι (C c)) ∈ M)
    (g : (Fin q → ℕ) → Fin q → State q L)
    (deg : ∀ a i, (g a i).totalDegree ≤ 2)
    (isolated : ∀ᶠ a in integerTuples q, M ∈ (Ideal.span (Set.range (g a))).minimalPrimes)
    (A : Coefficients q (MvPolynomial ((Fin q ⊕ S) ⊕ U) ℤ))
    (degreeA : ∀ i m, (A i m).totalDegree ≤ 256)
    (sizeA : ∀ i m, coefficientSum (A i m) ≤ 2^200)
    (entries : ∀ a i m, mixedEvaluation ι a (specializeLabels x (A i m)) =
      inputCoefficients j (fun t => quadraticHomogenization (g a t)) i m) :
    ∃ p : Polynomial k, p ≠ 0 ∧ p.IsRoot c ∧
      ∀ t, ∃ G : MvPolynomial U ℤ, G.totalDegree ≤ 2^112 ∧
        coefficientSum G ≤ 2^(2^402) ∧ p.coeff t = aeval x G := by
  classical
  obtain ⟨F,_,rel,ker,_⟩ := exists_bounded_incidence_relation q hq
  have divides (i : Coord q) : F ∣ minor i := (ker _).mp (minor_in_kernel i)
  let B := fun i m => specializeLabels x (A i m)
  let H := Polynomial.Bivariate.swap (deformationMap B F)
  have generic : ∀ᶠ a in integerTuples q, ∃ e,
      ((H.coeff e).map (mixedEvaluation ι a)) ≠ 0 ∧
      (∀ t < e, (H.coeff t).map (mixedEvaluation ι a) = 0) ∧
      ((H.coeff e).map (mixedEvaluation ι a)).IsRoot (ι (C c)) := by
    filter_upwards [isolated] with a good
    have same : (fun i m => mixedEvaluation ι a (B i m)) =
        inputCoefficients j (fun t => quadraticHomogenization (g a t)) := funext fun i => funext (entries a i)
    obtain ⟨_,e,ne,first,roots⟩ := affine_coordinate_from_relation F rel
      ((ker _).mp original_determinant_in_kernel) L j (g a) (deg a)
    simp only [H,mapped_swapped_coeff,same]
    exact ⟨e,ne,first,(roots M good).2 _ value⟩
  obtain ⟨d,m,nz,root⟩ := descend_generic_first_root ι injective c H generic
  refine ⟨parameterCoefficient (H.coeff d) m,nz,root,?_⟩
  intro t
  let P := ((Polynomial.Bivariate.swap (deformationMap A F)).coeff d).coeff t
  let G := ((sumAlgEquiv ℤ (Fin q ⊕ S) U) P).coeff m
  obtain ⟨dp,sp⟩ := specialized_coefficient_budget hq F divides A degreeA sizeA t d
  refine ⟨G,(IntegralCoordinateSplit.sum_coeff_degree P m).trans dp,
    (IntegralCoordinateSplit.sum_coeff_bound P m).trans sp,?_⟩
  rw [parameterCoefficient_coeff]
  dsimp only [H,B]
  rw [←mapped_swapped_coeff (specializeLabels x) A F d,Polynomial.coeff_map]
  exact coefficient_specializeLabels x P m

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.StationaryDeformation.descend_generic_first_root

∀ {k S L : Type} [inst : Field k] [CharZero k] [inst_2 : CommRing L] {q : ℕ} (ι : MvPolynomial S k →+* L),
  Function.Injective ⇑ι →
    ∀ (c : k) (H : Polynomial (Polynomial (MvPolynomial (Fin q ⊕ S) k))),
      (∀ᶠ (a : Fin q → ℕ) in PlanarUnitDistances.StationaryDeformation.integerTuples q,
          ∃ e,
            Polynomial.map (PlanarUnitDistances.StationaryDeformation.mixedEvaluation ι a) (H.coeff e) ≠ 0 ∧
              (∀ j < e,
                  Polynomial.map (PlanarUnitDistances.StationaryDeformation.mixedEvaluation ι a) (H.coeff j) =
                    0) ∧
                (Polynomial.map (PlanarUnitDistances.StationaryDeformation.mixedEvaluation ι a)
                      (H.coeff e)).IsRoot
                  (ι (MvPolynomial.C c))) →
        ∃ d m,
          PlanarUnitDistances.UniversalIncidence.parameterCoefficient (H.coeff d) m ≠ 0 ∧
            (PlanarUnitDistances.UniversalIncidence.parameterCoefficient (H.coeff d) m).IsRoot c
Lean source · PlanarUnitDistances/GenericRootDescent.lean, lines 36–79
/-- For a fixed output c, the first surviving deformation coefficient at a
generic integer tuple vanishes at c. Select a single monomial in all auxiliary
variables to obtain a nonzero equation in k[T]. This selection costs no degree
or coefficient size: every coefficient is one specified old coefficient. -/
theorem descend_generic_first_root {k S L : Type} [Field k] [CharZero k] [CommRing L] {q : ℕ}
    (ι : MvPolynomial S k →+* L) (inj : Function.Injective ι) (c : k)
    (H : Polynomial (Polynomial (MvPolynomial (Fin q ⊕ S) k)))
    (root : ∀ᶠ a in integerTuples q, ∃ e,
      ((H.coeff e).map (mixedEvaluation ι a)) ≠ 0 ∧
      (∀ j < e, (H.coeff j).map (mixedEvaluation ι a) = 0) ∧
      ((H.coeff e).map (mixedEvaluation ι a)).IsRoot (ι (C c))) :
    ∃ d m, parameterCoefficient (H.coeff d) m ≠ 0 ∧
      (parameterCoefficient (H.coeff d) m).IsRoot c := by
  classical
  have nz : H ≠ 0 := by
    obtain ⟨a,e,survives,_⟩ := root.exists
    rintro rfl
    exact survives (by simp)
  obtain ⟨d,hd,before,_⟩ := first_surviving_coefficient H nz
  have someCoefficient : ∃ j, (H.coeff d).coeff j ≠ 0 := by
    by_contra! zero
    exact hd (Polynomial.ext (by simpa using zero))
  obtain ⟨j,hj⟩ := someCoefficient
  have vanish : (H.coeff d).eval (C c) = 0 := by
    by_contra wrong
    have absurdly : ∀ᶠ _ in integerTuples q, False := by
      filter_upwards [root, mixedEvaluation_separates ι inj _ hj,
        mixedEvaluation_separates ι inj _ wrong] with a chosen persists nonzero
      obtain ⟨e,he,earlier,atRoot⟩ := chosen
      have hd' : (H.coeff d).map (mixedEvaluation ι a) ≠ 0 := by
        intro z
        apply persists
        simpa only [Polynomial.coeff_map, Polynomial.coeff_zero] using
          congrArg (fun f : Polynomial L => f.coeff j) z
      have equal : e = d := le_antisymm
        (le_of_not_gt (fun lt => hd' (earlier d lt)))
        (le_of_not_gt (fun lt => he (by simp [before e lt])))
      subst e
      apply nonzero
      rw [← Polynomial.eval₂_hom, ← Polynomial.eval_map, mixedEvaluation_C]
      exact atRoot
    exact absurdly.exists.choose_spec
  obtain ⟨m,hm,roots⟩ := extract_base_field_polynomial (H.coeff d) hd (RingHom.id _) Function.injective_id
  exact ⟨d,m,hm,roots c (by simpa [Polynomial.IsRoot] using vanish)⟩

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 6.13 Height of a root with bounded coefficient forms

Lean verified

With the coefficient estimates of Proposition 6.12,

h ( c ) ≤ 2 2086 + 2 113 ∑ i , j h ( a i j ) .
Proof

At a finite place, bound the value of D t by its largest monomial contribution. At an infinite place, use the coefficient sum as well. These are simultaneous bounds for the coefficients of p at each place. The root estimate and the product formula remove the leading coefficient. The two signs of a unit contribute equal global heights, giving the factor 2 ⋅ 2 112 . The additive cost is at most 2 402 + log ⁡ 2 , which is below the displayed allowance.

Inspect the Lean declarations

PlanarUnitDistances.TorusCritical.ratio_height_from_bounded_coefficient_forms

∀ {I J K : Type} [inst : Fintype I] [inst_1 : Fintype J] [inst_2 : Field K] [inst_3 : NumberField K]
  (a : I → Option J → Kˣ) (c : K) (p : Polynomial K),
  p ≠ 0 →
    p.IsRoot c →
      (∀ (j : Fin (p.natDegree + 1)),
          ∃ G,
            G.totalDegree ≤ 2 ^ 112 ∧
              PlanarUnitDistances.EliminantHeight.coefficientSum G ≤ 2 ^ 2 ^ 402 ∧
                p.coeff ↑j =
                  (MvPolynomial.aeval (PlanarUnitDistances.TorusCritical.ratioParameterValues a)) G) →
        PlanarUnitDistances.weilHeight c ≤
          2 ^ 2086 + 2 ^ 113 * ∑ z, PlanarUnitDistances.weilHeight ↑(a z.1 z.2)
Lean source · PlanarUnitDistances/HeightFromCoefficientForms.lean, lines 102–111
theorem ratio_height_from_bounded_coefficient_forms {I J K : Type} [Fintype I] [Fintype J] [Field K] [NumberField K]
    (a : I → Option J → Kˣ) (c : K) (p : Polynomial K) (hp : p ≠ 0) (root : p.IsRoot c)
    (forms : ∀ j : Fin (p.natDegree+1), ∃ G : MvPolynomial (RatioParameters I J) ℤ,
      G.totalDegree ≤ 2^112 ∧ coefficientSum G ≤ 2^(2^402) ∧ p.coeff j.val = aeval (ratioParameterValues a) G) :
    weilHeight c ≤ (2:ℝ)^2086+(2:ℝ)^113*∑ z : I × Option J, weilHeight (a z.1 z.2 : K) := by
  have h := ratio_height_from_coefficient_forms a c p hp root (2^112) (2^402) forms
  simp only [Nat.cast_pow, Nat.cast_ofNat] at h
  have slope : (2:ℝ)*2^112 = 2^113 := by rw [pow_succ (2:ℝ) 112, mul_comm]
  rw [slope] at h
  exact h.trans (add_le_add power_height_additive (le_refl _))

Kernel axioms used: propext, Classical.choice, Quot.sound.

Theorem 6.14 The stationary height bound on the normalized grid

Lean verified

For every normalized grid and every value c ∈ K of its stationary output on a component of the full multiplier ideal, the bound of Lemma 6.13 holds, for r ≤ 47 and at most 98 state and multiplier variables in the selected multiplier system.

Proof

Choose the component of the selected equations retaining this c . Its numbered slice supplies the maximal ideal and test coordinate to Proposition 6.12. Evaluate the signed labels through σ , use the injective map on the frozen coordinates, and apply Lemma 6.13 to the resulting polynomial over K .

Inspect the Lean declarations

PlanarUnitDistances.IntegralGrid.stationary_height_unconditional

PlanarUnitDistances.ResearchMotion.LocalizedGridWithCap fun s => 2 ^ 2086 + 2 ^ 113 * s
Lean source · PlanarUnitDistances/ExactUnconditional.lean, lines 12–56
/-- The chosen component of the literal normalized stationary grid determines
a nonzero polynomial of controlled coefficient height over the original number
field, even if the component is defined only over the complex numbers. -/
theorem stationary_height_unconditional :
    ResearchMotion.LocalizedGridWithCap (fun s => (2:ℝ)^2086+(2:ℝ)^113*s) := by
  intro K _ _ _ I J _ _ r a i j _row _col _mi _ma _lj _hj hr pick c P hP hc hq
  classical
  let φ := algebraMap K ℂ
  let α := mapUnits φ a
  let ord := Fintype.equivFin (Input I J r)
  let eqs := orderedOriginal α i j pick ord
  let o := outputSlot I J r
  letI := hP.isPrime
  obtain ⟨Q,hQ,_QP,hcQ⟩ := constant_on_selected_component
    (TorusCritical.ratio α i j) (TorusCritical.equation α) pick P hP.le (φ c) hc
  have selected : Q ∈ (Ideal.span (Set.range eqs)).minimalPrimes := by
    simpa only [eqs,span_orderedOriginal] using hQ
  have valued : X o-C (φ c) ∈ Q := hcQ
  obtain ⟨S,ho,_basis,q,free,_qcard,qle,M,hM,hmin,_contract,constant,degree⟩ :=
    CoordinateSlice.numbered_coordinate_slice eqs Q selected o (φ c) valued
      (orderedOriginal_degree α i j pick ord)
  letI := hM
  letI : Fintype S := Fintype.ofFinite S
  let out := free (⟨o,ho⟩ : (↑Sᶜ))
  let G := fun t => CoordinateSlice.numbered ℂ S free (eqs t)
  let g (a : Fin q → ℕ) (t : Fin q) := combination G (a t)
  let A := honestCoefficients i j pick S free ord out
  have budget (b m) := honest_coefficients_budget i j pick hr hq S free ord out b m
  have qsmall : q≤98 := qle.trans (by simpa only [Nat.card_eq_fintype_card] using hq)
  have root_value : X out-C ((embedFrozen φ S) (C c)) ∈ M := by
    simpa only [embedFrozen_C] using constant
  have labels : φ ∘ ratioParameterValues a = ratioParameterValues α :=
    funext fun t => (extended_signed_labels φ a t).symm
  obtain ⟨p,hp,root,forms⟩ := bounded_generic_root qsmall (ratioParameterValues a)
    (embedFrozen φ S) (embedFrozen_injective φ S) c out M root_value g
    (fun mix t => combination_degree G degree (mix t))
    (CoordinateSlice.eventual_square_after_slice S free eqs M hmin) A
    (fun b m => (budget b m).1.trans (by decide))
    (fun b m => (budget b m).2.trans (Nat.pow_le_pow_right (by decide) (by decide : 173≤200)))
    (by
      intro mix b m
      have ev := DFunLike.congr_fun (mixedEvaluation_eq_honest φ S (ratioParameterValues a) mix) (A b m)
      rw [labels] at ev
      exact ev.trans (actual_numbered_homogeneous_table α i j pick S free ho ord mix b m))
  exact ratio_height_from_bounded_coefficient_forms a c p hp root (fun t => forms t.val)

Kernel axioms used: propext, Classical.choice, Quot.sound.

Lemma 6.15 The scale margin in the extracted graph

Lean verified

The cap h ( c ) ≤ 2 2086 + 2 113 ∑ i , j h ( a i j ) for all the normalized stationary outputs suffices for the exact exponent.

Proof

The original common-center walk produces the graph at a scale J ≥ 2 2100 / 500 . For a stationary edge, each of the at most 24 nontrivial normalized rectangle quotients has height at most J / ( 324 ⋅ 2 111 ) . The assumed cap gives

h ( c ) ≤ ( 125 4096 + 8 27 ) J < J 3 .

Indeed the scale floor bounds the additive term by 125 J / 4096 . The edge in the extracted graph has height at least J / 3 , so it cannot be stationary. The resulting motion and the uniformly bounded degree of the separator exclude a dense grid for all sufficiently large graph sizes. The edges retained by extraction force that size to grow with the original n . The elementary bound for the finitely many smaller n is absorbed into C . Specializing a real configuration to an algebraic one preserves its size and at least its original number of unordered unit pairs.

Inspect the Lean declarations

PlanarUnitDistances.ResearchPhysical.exact_from_affine_stationary_heights

∀ {A D : ℝ},
  A ≤ 2 ^ 2086 →
    D ≤ 2 ^ 113 →
      (PlanarUnitDistances.ResearchMotion.LocalizedGridWithCap fun s => A + D * s) →
        PlanarUnitDistances.TheoremA
Lean source · PlanarUnitDistances/ExactFromAffineStationary.lean, lines 41–68
/-- The bound only uses the full normalized multiplier ideals, at the
large scale retained by the original common-center extraction. -/
theorem exact_from_affine_stationary_heights {A D : ℝ}
    (hA : A ≤ (2:ℝ)^2086) (hD : D ≤ (2:ℝ)^113)
    (heights : ResearchMotion.LocalizedGridWithCap (fun s => A+D*s)) : TheoremA := by
  let cap : ℝ → ℝ := fun s => (2:ℝ)^2086 + (2:ℝ)^113*s
  have mono : Monotone cap := fun s t h => add_le_add (le_refl _) (mul_le_mul_of_nonneg_left h (by positivity))
  have heightMax : ResearchMotion.LocalizedGridWithCap cap := by
    intro K _ _ _ I J _ _ r a i j row col mi ma lj hj hr pick c P hP hc hq
    have hh := heights K I J r a i j row col mi ma lj hj hr pick c P hP hc hq
    exact hh.trans (add_le_add hA (mul_le_mul_of_nonneg_right hD (Finset.sum_nonneg fun _ _ => weilHeight_nonneg _)))
  apply theoremA_of_eventual_large_scale_graph
  apply eventual_graph_bound_of_scale_motion _ GridLocus.uniform_exceptional_degree
  intro n K _ _ G floor
  apply ResearchMotion.motion_with_cap cap mono heightMax G
  intro h low high
  have small : (2:ℝ)^2086 ≤ G.scale*(125/4096) := by
    have eq : (2:ℝ)^2086 = ((2:ℝ)^2100/500)*(125/4096) := by
      rw [show (2100:ℕ) = 2086+14 by decide, pow_add]
      ring
    exact eq.le.trans (mul_le_mul_of_nonneg_right floor (by norm_num))
  have slope : (2:ℝ)^113 * (24*(G.scale/(324*2^111))) = (8/27)*G.scale := by ring
  change h ≤ (2:ℝ)^2086 + (2:ℝ)^113*(24*(G.scale/(324*2^111))) at high
  rw [slope] at high
  have pos : 0 < G.scale := (by norm_num : (0:ℝ) < (2:ℝ)^2100/500).trans_le floor
  have contradict (a S y : ℝ) (hS : 0<S) (ha : a ≤ S*(125/4096))
      (hl : S/3 ≤ y) (hu : y ≤ a+(8/27)*S) : False := by linarith only [hS,ha,hl,hu]
  exact contradict _ _ _ pos small low high

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ProofAssembly.original_extraction_at_large_scale

PlanarUnitDistances.DenseGraphExtractionAtScale PlanarUnitDistances.exactGap (2 ^ 2100 / 500)
Lean source · PlanarUnitDistances/LargeScaleExtraction.lean, lines 68–98
/-- Unconditional dense extraction at the manuscript exponent. The same
graph satisfies the edge lower bound and the stronger scale lower bound. -/
theorem original_extraction_at_large_scale :
    DenseGraphExtractionAtScale exactGap ((2:ℝ)^2100/500) := by
  let g := 3*exactGap
  let a := 10000*g
  obtain ⟨k,hk,hle⟩ := large_piece_graph_with_scale
  refine ⟨k,hk,?_⟩
  have ht : Tendsto incidenceScale atTop atTop :=
    (tendsto_rpow_atTop (by norm_num : 0<(1/3:ℝ))).comp tendsto_natCast_atTop_atTop
  have hg : 0<g := mul_pos (by norm_num) exactGap_pos
  have expPos : 0<1+2*a-173*g := by dsimp [a]; linarith
  have hb := (tendsto_rpow_atTop expPos).eventually_ge_atTop ((2:ℝ)^10000)
  filter_upwards [ht.eventually dense_to_large_piece,ht.eventually hle,ht.eventually hb] with n hp he hs
  intro X hX _hAlg hcount
  let t := incidenceScale n
  have ht3 : (n:ℝ)=t^3 := by
    change (n:ℝ)=((n:ℝ)^(1/3:ℝ))^3
    rw [← Real.rpow_natCast,← Real.rpow_mul (Nat.cast_nonneg _)]
    norm_num
  have hpow : t^(4-g)=(n:ℝ)^(4/3-exactGap) := by
    dsimp [t,incidenceScale,g]
    rw [← Real.rpow_mul (Nat.cast_nonneg _)]
    congr 1
    ring
  obtain ⟨P,Q,M,piece⟩ := hp X (by rw [hX]; exact ht3) (hpow ▸ hcount)
  obtain ⟨G,_,scale,hG⟩ := he P Q M piece
  have big : (2:ℝ)^2100 < pieceScale M := piece.2.2.2.2.2.2.2.2.2.2
  refine ⟨P.card,M.field,inferInstance,inferInstance,G,?_,?_,piece.2.2.1,hG⟩
  · exact (div_le_div_of_nonneg_right big.le (by norm_num : (0:ℝ) ≤ 500)).trans scale
  exact_mod_cast hs.trans piece.2.1

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.ResearchMotion.motion_with_cap

∀ (cap : ℝ → ℝ),
  Monotone cap →
    PlanarUnitDistances.ResearchMotion.LocalizedGridWithCap cap →
      ∀ {n : ℕ} {K : Type} [inst : Field K] [inst_1 : NumberField K]
        (G : PlanarUnitDistances.AdmissibleGraph n K),
        (∀ (h : ℝ), G.scale / 3 ≤ h → h ≤ cap (24 * (G.scale / (324 * 2 ^ 111))) → False) →
          PlanarUnitDistances.MovingGrid.Motion G
Lean source · PlanarUnitDistances/ResearchMotion.lean, lines 85–109
/-- The original lift includes both the ratios and their inverses over
dual numbers. The chosen constant parameters are precisely their actual
cross ratios, and the first component is the original geometry. -/
theorem motion_with_cap (cap : ℝ → ℝ) (hcap : Monotone cap) (input : LocalizedGridWithCap cap) {n : ℕ} {K : Type}
    [Field K] [NumberField K] (G : AdmissibleGraph n K) (impossible : ∀ h : ℝ, G.scale/3 ≤ h → h ≤ cap (24*(G.scale/(324*2^111))) → False) : MovingGrid.Motion G := by
  intro I J _ _ p r hi hj small edges
  haveI : Nontrivial I := Fintype.one_lt_card_iff_nontrivial.mp (by omega)
  haveI : Nontrivial J := Fintype.one_lt_card_iff_nontrivial.mp (by omega)
  obtain ⟨H,U,A,b,hm⟩ := physical_velocities_with_cap cap hcap input G impossible p r small edges
  let u (i : I) (j : J) := G.embedding (G.label (p i) (r j))
  let i₀ : I := Classical.choice inferInstance
  let j₀ : J := Classical.choice inferInstance
  let coeff i j := (u i j*u i₀ j₀)/(u i j₀*u i₀ j)
  have hu i j : u i j ≠ 0 := by
    simpa only [u, map_zero] using G.embedding.injective.ne (G.nonzero _ _ (edges i j))
  have hgrid : GridEquations i₀ j₀ (cart ∘ p) (cart ∘ r) u (fun i j ↦ (u i j)⁻¹) coeff := by
    refine ⟨fun i j ↦ (chord_cart _ _).trans (G.chord _ _ (edges i j)),fun i j ↦ mul_inv_cancel₀ (hu i j),?_⟩
    intro i j
    exact (div_mul_cancel₀ _ (mul_ne_zero (hu i j₀) (hu i₀ j))).symm
  refine ⟨⟨i₀,j₀,fun i ↦ liftPosition (cart (p i)) (H i),fun j ↦ liftPosition (cart (r j)) (U j),
    fun i j ↦ liftScalar (u i j) (u i j*(A i-b j)),
    fun i j ↦ liftScalar (u i j)⁻¹ (-(u i j)⁻¹*(A i-b j)),coeff,
    lift_differential i₀ j₀ _ H _ U u _ coeff A b hgrid (fun i j ↦ (hm i j).2),
    fun _ ↦ rfl,fun _ ↦ rfl,fun _ _ ↦ rfl,?_⟩⟩
  exact fun i j ↦ mul_ne_zero (hu i j) (sub_ne_zero.mpr (hm i j).1)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.eventual_graph_bound_of_scale_motion

∀ {minScale : ℝ},
  (∀ (n : ℕ) (K : Type) [inst : Field K] [inst_1 : NumberField K]
      (G : PlanarUnitDistances.AdmissibleGraph n K),
      minScale ≤ G.scale → PlanarUnitDistances.MovingGrid.Motion G) →
    PlanarUnitDistances.GridLocus.UniformExceptionalDegree →
      PlanarUnitDistances.EventualAlgebraicGraphBoundAtScale minScale
Lean source · PlanarUnitDistances/ExactFromAffineStationary.lean, lines 15–37
theorem eventual_graph_bound_of_scale_motion {minScale : ℝ}
    (motionAt : ∀ (n : ℕ) (K : Type) [Field K] [NumberField K] (G : AdmissibleGraph n K),
      minScale ≤ G.scale → MovingGrid.Motion G)
    (uniform : GridLocus.UniformExceptionalDegree) : EventualAlgebraicGraphBoundAtScale minScale := by
  obtain ⟨E, eff⟩ := uniform
  have grows : Tendsto (fun n : ℕ => (n:ℝ)^(3/5:ℝ)) atTop atTop :=
    (tendsto_rpow_atTop (by norm_num : (0:ℝ) < 3/5)).comp tendsto_natCast_atTop_atTop
  filter_upwards [eventually_ge_atTop (2^10000 : ℕ), grows.eventually_gt_atTop
    (12*CurveRestriction.curveDegree*(E:ℝ)*CurveRestriction.restrictionCost^32)]
    with n hn growth
  intro K _ _ G hscale
  by_contra! dense
  have motion : MovingGrid.Motion G := by
    exact motionAt n K G hscale
  obtain ⟨R⟩ := GraphRestriction.retain G hn dense (MovingGrid.curvesForRows motion)
  have an := (card_le_card R.left_subset).trans G.point_bound
  have bn := (card_le_card R.right_subset).trans G.point_bound
  have hn0 : 0 < n := (pow_pos (by decide : 0 < 2) _).trans_le hn
  exact GridLocus.excludes_dense_real_graph_of_degree E eff R.f R.g R.curve_pair R.left.degree R.right.degree
    R.A R.B (card_pos.mp (lt_of_le_of_lt (Nat.zero_le _) R.left.many))
    (card_pos.mp (lt_of_le_of_lt (Nat.zero_le _) R.right.many))
    R.left.vanishes R.right.vanishes G.edges n (by exact_mod_cast hn0) growth an bn R.dense
    (MovingGrid.compatible motion)

Kernel axioms used: propext, Classical.choice, Quot.sound.

PlanarUnitDistances.theoremA_of_eventual_large_scale_graph

PlanarUnitDistances.EventualAlgebraicGraphBoundAtScale (2 ^ 2100 / 500) → PlanarUnitDistances.TheoremA
Lean source · PlanarUnitDistances/LargeScaleCounting.lean, lines 82–86
/-- It suffices to prove the asymptotic edge bound only on graphs at the selected large scale. -/
theorem theoremA_of_eventual_large_scale_graph
    (hgraph : EventualAlgebraicGraphBoundAtScale ((2:ℝ)^2100/500)) : TheoremA :=
  powerSaving_of_extraction_and_eventual_graph_at_scale exactGap_pos exactGap_lt_largeHeightGap.le
    ProofAssembly.original_extraction_at_large_scale hgraph

Kernel axioms used: propext, Classical.choice, Quot.sound.

Dependency graph

Select a vertex for its statement and proof. Arrows point from a prerequisite to a result that uses it.

Legend
Box
A definition used by the proof.
Green ellipse
A statement with a Lean-verified proof.
Arrow
The proof or type at the arrowhead depends on the declaration at the tail. An arrow can pass through intermediate declarations in the Lean proof.
inc:finite-optimizer finite-optimizer inc:maximize maximize inc:finite-optimizer->inc:maximize inc:piece piece inc:maximize->inc:piece h:force force inc:piece->h:force elim:scale scale h:force->elim:scale inc:small-history small-history h:exact-cutoff exact-cutoff inc:small-history->h:exact-cutoff h:exact-cutoff->h:force main:target Theorem A elim:scale->main:target prob:balanced-boundary balanced-boundary prob:actual-posterior-upper actual-posterior-upper prob:balanced-boundary->prob:actual-posterior-upper prob:unconditional-moments unconditional-moments prob:actual-posterior-upper->prob:unconditional-moments prob:unconditional-moments->elim:scale prob:tail tail prob:arithmetic-tail arithmetic-tail prob:tail->prob:arithmetic-tail prob:original-two-inputs original-two-inputs prob:arithmetic-tail->prob:original-two-inputs prob:original-full-triple original-full-triple prob:original-two-inputs->prob:original-full-triple prob:original-full-triple->prob:unconditional-moments main:goodpairs goodpairs main:surviving-graph surviving-graph main:goodpairs->main:surviving-graph main:surviving-graph->elim:scale prob:prescribed-common prescribed-common prob:prescribed-common->prob:original-full-triple prob:pairtail pairtail prob:pairtail->prob:arithmetic-tail h:one-center one-center h:one-center->h:exact-cutoff prob:fixed-rare-score fixed-rare-score prob:fixed-pair-charge fixed-pair-charge prob:fixed-rare-score->prob:fixed-pair-charge prob:fixed-pair-charge->prob:original-two-inputs alg:four-anchor four-anchor alg:motion-to-curves motion-to-curves alg:four-anchor->alg:motion-to-curves alg:motion-to-curves->elim:scale prob:dominant-rare-joint dominant-rare-joint prob:placewise-rare placewise-rare prob:dominant-rare-joint->prob:placewise-rare prob:integrated-error integrated-error prob:placewise-rare->prob:integrated-error prob:arithmetic-moments arithmetic-moments prob:integrated-error->prob:arithmetic-moments prob:arithmetic-moments->prob:original-two-inputs prob:geometric-common geometric-common prob:geometric-common->prob:prescribed-common h:cycle cycle h:cycle->main:surviving-graph prob:common-disagreement common-disagreement prob:posterior-walk posterior-walk prob:common-disagreement->prob:posterior-walk prob:posterior-walk->prob:original-full-triple alg:anchor-fallback anchor-fallback alg:anchor-fallback->alg:four-anchor prob:global-endpoint global-endpoint prob:global-endpoint->prob:arithmetic-moments inc:final-exponents final-exponents inc:final-exponents->elim:scale h:residual residual h:residual->h:one-center alg:seven-parameters seven-parameters alg:normalized-row-field normalized-row-field alg:seven-parameters->alg:normalized-row-field alg:generic generic alg:normalized-row-field->alg:generic alg:uniform-exceptional-degree uniform-exceptional-degree alg:generic->alg:uniform-exceptional-degree alg:uniform-exceptional-degree->elim:scale alg:constructible-positions constructible-positions alg:constructible-positions->alg:uniform-exceptional-degree alg:selected-component selected-component elim:stationary-height stationary-height alg:selected-component->elim:stationary-height elim:stationary-height->main:target elim:slice slice elim:slice->elim:stationary-height prob:scalar scalar h:circle-prediction circle-prediction prob:scalar->h:circle-prediction h:circle-prediction->h:exact-cutoff main:rich-count rich-count main:rich-survival rich-survival main:rich-count->main:rich-survival main:rich-survival->elim:scale alg:rich-reflection rich-reflection alg:retained-graph retained-graph alg:rich-reflection->alg:retained-graph alg:retained-graph->elim:scale inc:log-incidence log-incidence inc:log-incidence->inc:finite-optimizer inc:initial-rectangle initial-rectangle inc:log-incidence->inc:initial-rectangle inc:initial-rectangle->inc:maximize prob:uniform-records uniform-records prob:uniform-records->prob:prescribed-common alg:generic-lift generic-lift alg:generic-lift->alg:generic alg:rational-classification rational-classification alg:classified-row-orders classified-row-orders alg:rational-classification->alg:classified-row-orders alg:classified-row-orders->alg:generic alg:product-bound product-bound alg:simultaneous-nonvanishing simultaneous-nonvanishing alg:product-bound->alg:simultaneous-nonvanishing alg:simultaneous-nonvanishing->alg:uniform-exceptional-degree prob:local-scores local-scores prob:exact-common exact-common prob:local-scores->prob:exact-common prob:exact-common->prob:geometric-common prob:score-averages score-averages prob:score-averages->prob:unconditional-moments alg:rigid-rank rigid-rank alg:stationary-component stationary-component alg:rigid-rank->alg:stationary-component alg:stationary-component->elim:scale alg:radical-system radical-system alg:normalized-smooth normalized-smooth alg:radical-system->alg:normalized-smooth alg:normalized-smooth->alg:generic prob:all-place-agreement all-place-agreement prob:physical-labels physical-labels prob:all-place-agreement->prob:physical-labels prob:record-law record-law prob:physical-labels->prob:record-law prob:record-law->prob:uniform-records alg:tower-norm tower-norm alg:tower-norm->alg:four-anchor alg:generic-field generic-field alg:generic-field->alg:generic-lift prob:flank-charge flank-charge prob:flank-charge->prob:actual-posterior-upper prob:flank-charge->prob:fixed-pair-charge alg:critical-coordinate critical-coordinate alg:critical-coordinate->alg:stationary-component alg:grid-count grid-count alg:grid-count->elim:scale elim:budget budget elim:base-field base-field elim:budget->elim:base-field elim:base-field->elim:stationary-height prob:width width prob:width->prob:original-full-triple inc:constants constants inc:constants->inc:small-history inc:constants->prob:arithmetic-tail inc:constants->prob:dominant-rare-joint inc:gap gap inc:constants->inc:gap prob:triple-selection triple-selection inc:constants->prob:triple-selection inc:gap->h:force inc:gap->prob:original-two-inputs inc:gap->prob:prescribed-common inc:gap->main:rich-survival inc:ordinary-diagonals ordinary-diagonals inc:gap->inc:ordinary-diagonals inc:full-history-lists full-history-lists inc:gap->inc:full-history-lists prob:triple-selection->elim:scale inc:ordinary-diagonals->prob:unconditional-moments inc:full-history-lists->prob:unconditional-moments h:transfer transfer h:normalized normalized h:transfer->h:normalized h:normalized->h:force h:edge-scale edge-scale h:edge-scale->h:force prob:flank-intervals flank-intervals prob:single-slot single-slot prob:flank-intervals->prob:single-slot prob:single-slot->prob:actual-posterior-upper alg:generic-sheet generic-sheet alg:embedded-smooth-orders embedded-smooth-orders alg:generic-sheet->alg:embedded-smooth-orders alg:embedded-smooth-orders->alg:normalized-smooth alg:line-orders line-orders alg:line-orders->alg:classified-row-orders inc:cutting cutting inc:cutting->inc:log-incidence prob:rare-score rare-score prob:rare-integrals rare-integrals prob:rare-score->prob:rare-integrals prob:rare-integrals->prob:original-full-triple prob:posterior-cut posterior-cut prob:posterior-cut->prob:geometric-common alg:absolute-irreducibility absolute-irreducibility alg:absolute-irreducibility->alg:normalized-smooth alg:cartesian-radicals cartesian-radicals alg:cartesian-radicals->alg:four-anchor alg:lifted-data lifted-data alg:lifted-data->alg:generic inc:trim trim inc:trim->inc:maximize h:euclidean-law euclidean-law h:euclidean-law->h:force prob:one-level one-level prob:one-level->prob:exact-common alg:private-orders private-orders alg:private-orders->alg:normalized-smooth alg:chord-signs chord-signs alg:chord-signs->alg:normalized-smooth elim:root-height root-height elim:root-height->elim:stationary-height elim:special-fibre special-fibre elim:special-fibre->elim:base-field prob:laws laws prob:laws->prob:original-two-inputs prob:laws->prob:triple-selection main:count count main:count->elim:scale h:cell-residual cell-residual h:cell-residual->h:one-center inc:entropy entropy inc:entropy->inc:piece prob:local-endpoint local-endpoint prob:local-endpoint->prob:global-endpoint prob:original-cell-partitions original-cell-partitions prob:original-inconsistency original-inconsistency prob:original-cell-partitions->prob:original-inconsistency prob:original-inconsistency->prob:original-full-triple prob:empirical empirical prob:empirical->prob:one-level alg:localize localize alg:localize->alg:stationary-component alg:real-hyperbola real-hyperbola alg:real-hyperbola->elim:scale h:height height h:height->alg:motion-to-curves h:height->h:residual h:height->alg:retained-graph h:height->h:transfer h:height->h:edge-scale h:embedding embedding h:height->h:embedding alg:root-bound root-bound h:height->alg:root-bound h:lognorm lognorm h:height->h:lognorm h:embedding->h:cell-residual alg:root-bound->elim:root-height h:lognorm->h:cycle h:lognorm->prob:global-endpoint h:lognorm->prob:triple-selection alg:fibre fibre alg:differential differential alg:fibre->alg:differential alg:differential->alg:motion-to-curves inc:specialization specialization inc:specialization->inc:piece elim:table table elim:table->elim:stationary-height alg:torus torus alg:torus->elim:scale inc:common-field-model common-field-model inc:common-field-model->h:force h:three three h:three->h:exact-cutoff prob:subtract-edges subtract-edges prob:subtract-edges->prob:global-endpoint prob:scale scale prob:scale->prob:triple-selection alg:repeated repeated alg:repeated->elim:scale prob:prescribed-width-means prescribed-width-means prob:prescribed-width-means->prob:unconditional-moments prob:rare rare prob:rare->prob:dominant-rare-joint prob:canonical-model canonical-model prob:canonical-model->prob:original-two-inputs alg:jacobian jacobian alg:jacobian->elim:scale alg:bezout bezout alg:bezout->alg:rich-reflection alg:bezout->alg:product-bound geo:centers centers geo:centers->h:exact-cutoff geo:centers->main:rich-count inc:codegree codegree geo:centers->inc:codegree main:rich-loss rich-loss geo:centers->main:rich-loss inc:codegree->main:goodpairs inc:codegree->inc:entropy main:rich-loss->main:rich-survival h:cells cells h:cells->h:circle-prediction alg:curve-valuation curve-valuation alg:curve-valuation->alg:embedded-smooth-orders elim:universal universal elim:universal->elim:budget prob:rare-error-mean rare-error-mean prob:rare-error-mean->prob:integrated-error alg:weighted-factor weighted-factor alg:two-curves two-curves alg:weighted-factor->alg:two-curves alg:two-curves->alg:retained-graph h:prediction prediction h:prediction->prob:exact-common alg:log-localize log-localize alg:log-localize->alg:localize alg:class-count class-count alg:class-count->alg:weighted-factor prob:matching matching prob:matching->prob:dominant-rare-joint h:rectangle-control rectangle-control prob:matching->h:rectangle-control h:rectangle-control->h:euclidean-law prob:incidence-identification incidence-identification prob:incidence-identification->prob:original-two-inputs prob:diagonal-shift diagonal-shift prob:diagonal-shift->prob:placewise-rare alg:hyperbola-orders hyperbola-orders alg:rational-row-field rational-row-field alg:hyperbola-orders->alg:rational-row-field alg:rational-row-field->alg:classified-row-orders alg:anchor-field anchor-field alg:anchor-field->alg:normalized-row-field inc:winner winner inc:winner->inc:maximize geo:chord chord geo:chord->prob:original-two-inputs geo:chord->main:surviving-graph geo:chord->prob:triple-selection prob:original-record-agreement original-record-agreement prob:original-record-agreement->prob:original-inconsistency elim:square square elim:square->elim:stationary-height