G2 coordinate models and complete statement definitions
DefinitionAPFNativeG2Native subset prices, their declared real quadratic interpolants and Gram matrices, indicator and basis vectors, integer-lattice minima with attainment, and the full collapsing-price family. The module also defines the changed-support price on two bits, the real and complex NOT matrices, the stipulated complex root, and the classical four-state cycle. These are complete definitions; they do not identify interpolated geometry with physical transition cost.
import Mathlib.LinearAlgebra.QuadraticForm.Basic
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.LinearAlgebra.Matrix.PosDef
import Mathlib.LinearAlgebra.Matrix.Notation
import Mathlib.Data.Nat.Choose.Basic
noncomputable section
set_option autoImplicit false
open scoped BigOperators Matrix
namespace APFNativeG2
abbrev Vec (n : ℕ) := Fin n → ℝ
abbrev Mat (n : ℕ) := Matrix (Fin n) (Fin n) ℝ
def price (u p : ℝ) (k : ℕ) : ℝ := u * k + p * (k.choose 2 : ℝ)
def q {n : ℕ} (u p : ℝ) (x : Vec n) : ℝ :=
(u - p / 2) * (∑ i, (x i)^2) + (p / 2) * (∑ i, x i)^2
def gram (n : ℕ) (u p : ℝ) : Mat n := fun i j => if i = j then u else p / 2
def indicator {n : ℕ} (S : Finset (Fin n)) : Vec n := fun i => if i ∈ S then 1 else 0
def basis {n : ℕ} (i : Fin n) : Vec n := fun j => if j = i then 1 else 0
def zreal {n : ℕ} (z : Fin n → ℤ) : Vec n := fun i => (z i : ℝ)
def positive {n : ℕ} (f : Vec n → ℝ) : Prop := ∀ x, x ≠ 0 → 0 < f x
def latticeMinimum {n : ℕ} (f : Vec n → ℝ) (m : ℝ) : Prop :=
(∀ z : Fin n → ℤ, z ≠ 0 → m ≤ f (zreal z)) ∧
∃ z : Fin n → ℤ, z ≠ 0 ∧ f (zreal z) = m
def collapseP (k : ℕ) : ℝ := 2 - 1 / (k : ℝ)
abbrev BitPair := Bool × Bool
def changed (x y : BitPair) : Finset (Fin 2) :=
(Finset.univ.filter fun i => (if i = 0 then x.1 else x.2) ≠
(if i = 0 then y.1 else y.2))
def D (x y : BitPair) : ℝ := price 1 1 (changed x y).card
def corners : Fin 4 → BitPair := ![(false,false), (true,false), (true,true), (false,true)]
def notR : Mat 2 := !![0,1;1,0]
def notC : Matrix (Fin 2) (Fin 2) ℂ := !![0,1;1,0]
def rootC : Matrix (Fin 2) (Fin 2) ℂ :=
((1 + Complex.I) / 2) • (1 : Matrix (Fin 2) (Fin 2) ℂ) +
((1 - Complex.I) / 2) • notC
def cycle (x : BitPair) : BitPair := if x.2 then (!x.1, false) else (x.1, true)
end APFNativeG2
Read-back
What the Lean code literally says, in plain math · Exact runtime model identifier unavailable; independent reviewer RV-spine (01a082f2-417c-79c1-9069-c35844067fde).
Coordinate vectors, native cardinality price uk+pchoose(k,2), quadratic function (u-p/2)sum squares+(p/2)(sum coordinates)^2, matrix with diagonal u and off-diagonal p/2, indicator/basis/integer embeddings. Positive means strictly positive away from zero; latticeMinimum includes a universal lower bound and an attained nonzero integer witness. Defines collapse parameter2-1/k, Boolean support-difference price, four corners, real and complex NOT, a complex linear-combination square-root candidate, and a four-state cycle. All definitions complete, no asserted target properties. Independent code-first reading by RV-spine. Earlier written-source exposure and required personal paper/code consultation disclosed; this is not fully blind. Open theorem proofs remain sorry. Source-equivalence scope is governed by SOURCE_EQUIVALENCE_REVIEW.json, including G3-04 limits.