Documentation

CslibFrontier.Computability.Complexity.RealAlgebraic.CoordinateSelection

Indexed constraints for coordinate selection #

Row zero tests the source polynomial. The next rows test membership in the coordinate root grid. The strict inequalities are the coordinate fingerprint labels from the shared witness word. These constraints express the selection conditions without a counting-level increase for the individual row queries.

Their sum-of-squares feasibility polynomial uses one auxiliary variable per label. Its modular evaluator costs one additional counting level over the labels. A fixed-width witness can make the labels select any given point in the root grid. A second system adds counterexample variables and one equation at the same counting level. The counterexample renaming places the parameters before the witnesses and leaves room for the leading reciprocal variable of the parameter system.

Adapted from lean-canny's SelectionSystem, SelectionSystemCorrectness, SelectionCounterexampleSystem, SelectionCounterexampleCorrectness and CounterexampleVariableOrder at 970f28a5ecefc1327402ade16c068aa4b1b2c183.

noncomputable def Cslib.Complexity.RealAlgebraic.selectionEquation {n d : ℕ} (F : MvPolynomial (Fin n) ℤ) (hF : F.totalDegree ≤ d + 1) (hn : 0 < n) (j : ℕ) :

The source equation at row zero followed by the coordinate root equations. Positive addresses read the preceding coordinate address.

@[simp]
theorem Cslib.Complexity.RealAlgebraic.selectionEquation_zero {n d : ℕ} (F : MvPolynomial (Fin n) ℤ) (hF : F.totalDegree ≤ d + 1) (hn : 0 < n) :
selectionEquation F hF hn 0 = F

Row zero is the source polynomial.

noncomputable def Cslib.Complexity.RealAlgebraic.Controlled.selectionEquations {α : Type} {n : α → ℕ} {enc : α ↪ List Bool} {a : ℕ} {F : (w : α) → MvPolynomial (Fin (n w)) ℤ} (C : Controlled F enc a) (E : Turing.MultiTapeTM.Decoder enc) {d : α → ℕ} (hn : ∀ (w : α), 0 < n w) (hdpos : ∀ (w : α), 1 ≤ d w) (hF : ∀ (w : α), (F w).totalDegree ≤ d w + 1) (hd : Turing.MultiTapeTM.ComputableInPolyTime d enc Turing.MultiTapeTM.encNat) :
Controlled (fun (q : α × ℕ) => selectionEquation (F q.1) ⋯ ⋯ q.2) (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) (a + 18)

Evaluate the source or a coordinate equation selected by a binary row address at counting level a + 18. All rows share polynomial-time bounds independent of the row address.

theorem Cslib.Complexity.RealAlgebraic.Controlled.selectionEquations_bounds_eq {α : Type} {n : α → ℕ} {enc : α ↪ List Bool} {a : ℕ} {F : (w : α) → MvPolynomial (Fin (n w)) ℤ} (C : Controlled F enc a) (E : Turing.MultiTapeTM.Decoder enc) {d : α → ℕ} (hn : ∀ (w : α), 0 < n w) (hdpos : ∀ (w : α), 1 ≤ d w) (hF : ∀ (w : α), (F w).totalDegree ≤ d w + 1) (hd : Turing.MultiTapeTM.ComputableInPolyTime d enc Turing.MultiTapeTM.encNat) (w : α) (j : ℕ) :
have equations := C.selectionEquations E hn hdpos hF hd; equations.degreeBound (w, j) = equations.degreeBound (w, 0) ∧ equations.massExponent (w, j) = equations.massExponent (w, 0) ∧ equations.cutoff (w, j) = equations.cutoff (w, 0)

The selection equations share the degree bound, norm exponent and prime cutoff at row zero. These instance bounds apply to every binary row address.

The indexed rows express that the point is a source zero in the coordinate root grid and that every coordinate satisfies the fingerprint label from the shared word.

noncomputable def Cslib.Complexity.RealAlgebraic.selectionFeasibilityPolynomial {n d : ℕ} (F : MvPolynomial (Fin n) ℤ) (hF : F.totalDegree ≤ d + 1) (mass : ℕ) (hn : 0 < n) (word : List Bool) :

The feasibility polynomial for a source equation, its coordinate root grid and the fingerprint constraints supplied by a shared word. The last n coordinates are auxiliary.

noncomputable def Cslib.Complexity.RealAlgebraic.Controlled.selectionFeasibility {α : Type} {n : α → ℕ} {enc : α ↪ List Bool} {a : ℕ} {F : (w : α) → MvPolynomial (Fin (n w)) ℤ} (C : Controlled F enc a) (E : Turing.MultiTapeTM.Decoder enc) {d : α → ℕ} (hn : ∀ (w : α), 0 < n w) (hdpos : ∀ (w : α), 1 ≤ d w) (hF : ∀ (w : α), (F w).totalDegree ≤ d w + 1) (hd : Turing.MultiTapeTM.ComputableInPolyTime d enc Turing.MultiTapeTM.encNat) (word : α → List Bool) (hword : Turing.MultiTapeTM.ComputableInPolyTime word enc Turing.MultiTapeTM.encBits) :
Controlled (fun (w : α) => selectionFeasibilityPolynomial (F w) ⋯ (C.massExponent w) ⋯ (word w)) enc (a + 21)

Assemble the coordinate-selection feasibility polynomial at counting level a + 21. The degree, norm and prime bounds for each row family are computed at address zero.

The selection feasibility polynomial has a real zero exactly when a source zero in the coordinate root grid satisfies all fingerprint tests supplied by the word.

theorem Cslib.Complexity.RealAlgebraic.exists_coordinateSelectionWitness {n d mass : ℕ} (F : MvPolynomial (Fin n) ℤ) (hF : F.totalDegree ≤ d + 1) (hmass : F.coeffNorm1 ≤ 2 ^ mass) (hd : 1 ≤ d) (hn : 0 < n) {x : Fin n → ℝ} (hx : x ∈ MvPolynomial.CriticalSystem.coordinateRootGrid ⋯ F hF) :
∃ (word : List Bool), word.length = coordinateFingerprintWitnessWidth ((d + 1) ^ n) n ∧ ∀ (y : Fin n → ℝ), (y ∈ MvPolynomial.CriticalSystem.coordinateRootGrid ⋯ F hF ∧ ∀ (i : Fin n), 0 < Polynomial.eval₂ (Int.castRingHom ℝ) (y i) (wordCoordinateFingerprintLabel F hF mass hn word ↑i)) ↔ y = x

Each coordinate root grid point has a fixed-width word whose fingerprint labels select precisely that point in the grid. This adapts lean-canny's CoordinateFingerprintSelection and ChoiceTupleCompleteness at 970f28a5ecefc1327402ade16c068aa4b1b2c183.

noncomputable def Cslib.Complexity.RealAlgebraic.selectionCounterexamplePolynomial {n u d : ℕ} (F : MvPolynomial (Fin n) ℤ) (R : MvPolynomial (Fin (n + u)) ℤ) (hF : F.totalDegree ≤ d + 1) (mass : ℕ) (hn : 0 < n) (word : List Bool) :
MvPolynomial (Fin (n + u + n)) ℤ

Feasibility of a selected source zero together with a zero of the counterexample equation R. The coordinates are the selected point, the extra variables, then the auxiliary variables for the fingerprint labels.

noncomputable def Cslib.Complexity.RealAlgebraic.Controlled.selectionCounterexample {α : Type} {n u : α → ℕ} {enc : α ↪ List Bool} {a : ℕ} {F : (w : α) → MvPolynomial (Fin (n w)) ℤ} {R : (w : α) → MvPolynomial (Fin (n w + u w)) ℤ} (C : Controlled F enc a) (CR : Controlled R enc (a + 20)) (hu : Turing.MultiTapeTM.ComputableInPolyTime u enc Turing.MultiTapeTM.encUnary) (E : Turing.MultiTapeTM.Decoder enc) {d : α → ℕ} (hn : ∀ (w : α), 0 < n w) (hdpos : ∀ (w : α), 1 ≤ d w) (hF : ∀ (w : α), (F w).totalDegree ≤ d w + 1) (hd : Turing.MultiTapeTM.ComputableInPolyTime d enc Turing.MultiTapeTM.encNat) (word : α → List Bool) (hword : Turing.MultiTapeTM.ComputableInPolyTime word enc Turing.MultiTapeTM.encBits) :
Controlled (fun (w : α) => selectionCounterexamplePolynomial (F w) (R w) ⋯ (C.massExponent w) ⋯ (word w)) enc (a + 21)

Assemble the selected counterexample system at counting level a + 21 when the extra equation is controlled at level a + 20 and the extra arity is unary-polytime.

theorem Cslib.Complexity.RealAlgebraic.exists_selectionCounterexamplePolynomial_zero_iff {n u d : ℕ} (F : MvPolynomial (Fin n) ℤ) (R : MvPolynomial (Fin (n + u)) ℤ) (hF : F.totalDegree ≤ d + 1) (mass : ℕ) (hn : 0 < n) (word : List Bool) :
(∃ (z : Fin (n + u + n) → ℝ), MvPolynomial.eval₂ (Int.castRingHom ℝ) z (selectionCounterexamplePolynomial F R hF mass hn word) = 0) ↔ ∃ (x : Fin n → ℝ) (y : Fin u → ℝ), MvPolynomial.eval₂ (Int.castRingHom ℝ) x F = 0 ∧ x ∈ MvPolynomial.CriticalSystem.coordinateRootGrid ⋯ F hF ∧ (∀ (i : Fin n), 0 < Polynomial.eval₂ (Int.castRingHom ℝ) (x i) (wordCoordinateFingerprintLabel F hF mass hn word ↑i)) ∧ MvPolynomial.eval₂ (Int.castRingHom ℝ) (fun (i : Fin (n + u)) => Fin.addCases x y i) R = 0

The counterexample system has a real zero exactly when some selected source zero extends to a zero of the extra equation.

Reorder a polynomial from witness-then-parameter coordinates to parameter-then-witness coordinates, with an unused leading slot for the reciprocal variable.

theorem Cslib.Complexity.RealAlgebraic.eval₂_counterexamplePolynomial {n m : ℕ} {S : Type u_1} [CommRing S] (f : ℤ →+* S) (P : MvPolynomial (Fin (n + m)) ℤ) (c : Fin (m + 1) → S) (z : Fin n → S) :
MvPolynomial.eval₂ f (fun (i : Fin (m + 1 + n)) => Fin.addCases c z i) (counterexamplePolynomial P) = MvPolynomial.eval₂ f (fun (i : Fin (n + m)) => Fin.addCases z (fun (i : Fin m) => c i.succ) i) P

The first entry of the parameter block is ignored. Evaluation uses the remaining parameters and the full witness block in their original order.

Reorder the counterexample equation without increasing its counting level. Both block sizes are computed in unary, and absent entries of the evaluation point continue to be read as zero.