Documentation

CslibFrontier.Computability.Complexity.RealAlgebraic.ControlledBoundedSum

Bounded sums of controlled polynomials #

A family indexed by binary naturals supplies a controlled sum below a polynomial-time binary bound. The modular evaluator uses a single counting-level sum. This also gives sums of squares, since modular powering preserves the summand's level.

Adapted from lean-canny's ControlledBoundedSum and ControlledSumSquares at 970f28a5ecefc1327402ade16c068aa4b1b2c183.

noncomputable def Cslib.Complexity.RealAlgebraic.Controlled.boundedSum {α : Type} {n : α → ℕ} {enc : α ↪ List Bool} {a : ℕ} {P : (w : α) → ℕ → MvPolynomial (Fin (n w)) ℤ} (C : Controlled (fun (q : α × ℕ) => P q.1 q.2) (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) a) (E : Turing.MultiTapeTM.Decoder enc) (hn : Turing.MultiTapeTM.ComputableInPolyTime n enc Turing.MultiTapeTM.encUnary) (N D b cutoff : α → ℕ) (hN : Turing.MultiTapeTM.ComputableInPolyTime N enc Turing.MultiTapeTM.encNat) (hD : Turing.MultiTapeTM.ComputableInPolyTime D enc Turing.MultiTapeTM.encNat) (hb : Turing.MultiTapeTM.ComputableInPolyTime b enc Turing.MultiTapeTM.encNat) (hcut : Turing.MultiTapeTM.ComputableInPolyTime cutoff enc Turing.MultiTapeTM.encNat) (hdeg : ∀ (w : α), ∀ i < N w, (P w i).totalDegree ≤ D w) (hmass : ∀ (w : α), ∀ i < N w, (P w i).coeffNorm1 ≤ 2 ^ b w) (hcutoff : ∀ (w : α), ∀ i < N w, C.cutoff (w, i) ≤ cutoff w) :
Controlled (fun (w : α) => ∑ i ∈ Finset.range (N w), P w i) enc (a + 1)

Sum the polynomials with indices below a binary bound at one extra counting level. The degree, coefficient norm and prime cutoff need only be bounded on those indices.

noncomputable def Cslib.Complexity.RealAlgebraic.Controlled.sumSquares {α : Type} {n : α → ℕ} {enc : α ↪ List Bool} {a : ℕ} {P : (w : α) → ℕ → MvPolynomial (Fin (n w)) ℤ} (C : Controlled (fun (q : α × ℕ) => P q.1 q.2) (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) a) (E : Turing.MultiTapeTM.Decoder enc) (hn : Turing.MultiTapeTM.ComputableInPolyTime n enc Turing.MultiTapeTM.encUnary) (N D b cutoff : α → ℕ) (hN : Turing.MultiTapeTM.ComputableInPolyTime N enc Turing.MultiTapeTM.encNat) (hD : Turing.MultiTapeTM.ComputableInPolyTime D enc Turing.MultiTapeTM.encNat) (hb : Turing.MultiTapeTM.ComputableInPolyTime b enc Turing.MultiTapeTM.encNat) (hcut : Turing.MultiTapeTM.ComputableInPolyTime cutoff enc Turing.MultiTapeTM.encNat) (hdeg : ∀ (w : α), ∀ i < N w, (P w i).totalDegree ≤ D w) (hmass : ∀ (w : α), ∀ i < N w, (P w i).coeffNorm1 ≤ 2 ^ b w) (hcutoff : ∀ (w : α), ∀ i < N w, C.cutoff (w, i) ≤ cutoff w) :
Controlled (fun (w : α) => ∑ i ∈ Finset.range (N w), P w i ^ 2) enc (a + 1)

Aggregate squared equations with the same one-level cost as a bounded sum.

@[simp]
theorem Cslib.Complexity.RealAlgebraic.Controlled.cutoff_sumSquares {α : Type} {n : α → ℕ} {enc : α ↪ List Bool} {a : ℕ} {P : (w : α) → ℕ → MvPolynomial (Fin (n w)) ℤ} (C : Controlled (fun (q : α × ℕ) => P q.1 q.2) (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) a) (E : Turing.MultiTapeTM.Decoder enc) (hn : Turing.MultiTapeTM.ComputableInPolyTime n enc Turing.MultiTapeTM.encUnary) (N D b cutoff : α → ℕ) (hN : Turing.MultiTapeTM.ComputableInPolyTime N enc Turing.MultiTapeTM.encNat) (hD : Turing.MultiTapeTM.ComputableInPolyTime D enc Turing.MultiTapeTM.encNat) (hb : Turing.MultiTapeTM.ComputableInPolyTime b enc Turing.MultiTapeTM.encNat) (hcut : Turing.MultiTapeTM.ComputableInPolyTime cutoff enc Turing.MultiTapeTM.encNat) (hdeg : ∀ (w : α), ∀ i < N w, (P w i).totalDegree ≤ D w) (hmass : ∀ (w : α), ∀ i < N w, (P w i).coeffNorm1 ≤ 2 ^ b w) (hcutoff : ∀ (w : α), ∀ i < N w, C.cutoff (w, i) ≤ cutoff w) :
(C.sumSquares E hn N D b cutoff hN hD hb hcut hdeg hmass hcutoff).cutoff = cutoff

Squaring the summands uses the supplied prime cutoff.