Documentation

CslibFrontier.Computability.Circuit.Frontier.TensorNetwork.TruncatedAlgorithm

Polynomial truncation order from a contraction over A_P #

Theorem D.1 of [OAI26k] (p. 53) contracts networks whose entries lie in B_{P,ℓ} = (ℤ / 2 ^ P)[V] / (V ^ ℓ). This file states its interface for described networks (Cslib.Circuits.Frontier.TruncatedContractionAlgorithm) and assembles it (Cslib.Circuits.Frontier.TruncatedContractionAlgorithm.ofCore) from a native contraction over A_P = (ℤ / 2 ^ P)[U] / (f) of the specialized networks, at the modulus f = FastContraction.modulus m of a network with m edges.

The interface. One native certificate computes the truncated contraction (DescribedNetwork.truncContraction) from (P, ℓ, r, G), with P and ℓ in unary. For all constants C, D and d there is K such that, on every network admissible at a size s ≥ 2 with constant C, precision 1 ≤ P ≤ D s (⌊log₂ s⌋ + 1) and truncation order 1 ≤ ℓ ≤ D (s + 1) ^ d, it takes time at most K (n + 1) ^ K 2 ^ (K s / √⌊log₂ s⌋) and space at most K (n + 1) ^ K, for the encoded length n of the input. This is the shape of Cslib.Complexity.CountingSimulation.ContractionAlgorithm.

The assembly branches on whether the modulus has enough residues for the N = (ℓ - 1) k + 1 interpolation points (Cslib.Circuits.Frontier.truncGuard):

On admissible inputs with at most C s vertices, at least s edges and polynomial ℓ, the first branch is eventually taken. The modulus already has degree 2 * 3 ^ ⌊log₂ (4 ⌊log₂ m⌋ + 2)⌋, which eventually exceeds every fixed multiple of log₂ m. The explicit sufficient threshold is max (C D) (2 ^ (2 ^ (d + 2))) (Cslib.Circuits.Frontier.truncGuard_of_polynomial_le). Below it, direct summation costs a constant factor. The older and smaller linear-order threshold is also retained.

The logarithmic factor in precision and the polynomial truncation range strengthen the stated range of Theorem D.1. These extensions are proved here; they are not attributed to its statement.

The hypotheses on the contraction over A_P are those of the interface planned in #1538 for milestone E1: it is correct on every network at the modulus of its number of edges, and meets the bound of the interface on the networks admissible for it. The assembly also asks that the specialized networks of admissible networks be admissible for it, and that the entries be computed within time poly(L) 2 ^ O(s) and polynomial space for the encoded length L of the network (for the small sizes). The reduction itself is ours, not the manuscript's; see CslibFrontier/Computability/Circuit/Frontier/TensorNetwork/Truncated.lean.

Main definitions #

Main results #

References #

structure Cslib.Circuits.Frontier.TruncatedContractionAlgorithm {T : Type} (encT : T ↪ List Bool) (entry : T → List Bool → List ℕ) (Admissible : ℕ → ℕ → ℕ × DescribedNetwork T → Prop) :

The interface of Theorem D.1 at truncation order ℓ for described networks. One native certificate computes the truncated contraction from (P, ℓ, r, G), with P and ℓ in unary. For all constants C, D, d there is K such that, on every network admissible at a size s ≥ 2 with constant C, precision 1 ≤ P ≤ D s (⌊log₂ s⌋ + 1) and order 1 ≤ ℓ ≤ D (s + 1) ^ d, its time is at most K (n + 1) ^ K 2 ^ (K s / √⌊log₂ s⌋) and its space at most K (n + 1) ^ K, where n is the encoded length of the input. Outside admissible inputs the certificate need only be correct.

theorem Cslib.Circuits.Frontier.TruncatedContractionAlgorithm.bound {T : Type} {encT : T ↪ List Bool} {entry : T → List Bool → List ℕ} {Admissible : ℕ → ℕ → ℕ × DescribedNetwork T → Prop} (A : TruncatedContractionAlgorithm encT entry Admissible) (C D : ℕ) :
∃ (K : ℕ), ∀ (s P ℓ r : ℕ) (G : DescribedNetwork T), 2 ≤ s → 1 ≤ P → P ≤ D * s → 1 ≤ ℓ → ℓ ≤ D * s → Admissible C s (r, G) → A.certificate.time (P, ℓ, r, G) ≤ K * (((encTrunc encT) (P, ℓ, r, G)).length + 1) ^ K * 2 ^ (K * s / (Nat.log 2 s).sqrt) ∧ A.certificate.space (P, ℓ, r, G) ≤ K * (((encTrunc encT) (P, ℓ, r, G)).length + 1) ^ K

The linear precision and truncation range of Theorem D.1 is a special case of the enlarged range.

The guard #

The guard at an input (P, ℓ, r, G): the modulus FastContraction.modulus m of the network G with m edges has at least as many residues as the (ℓ - 1) k + 1 interpolation points.

theorem Cslib.Circuits.Frontier.truncGuard_of_le {T : Type} {C D s P ℓ r : ℕ} {G : DescribedNetwork T} (hs : 4 * (C * D + 1) ≤ s) (hℓ : ℓ ≤ D * s) (hk : G.vertices.length ≤ C * s) (hm : s ≤ G.numEdges) :

Admissible inputs pass the guard from some size on. With at most C s vertices, at least s edges and ℓ ≤ D s, the guard holds once s ≥ 4 (C D + 1): the modulus has degree at least 4 ⌊log₂ m⌋, so more than m ^ 4 / 16 ≥ C D s ^ 2 + 1 residues.

theorem Cslib.Circuits.Frontier.truncGuard_of_polynomial_le {T : Type} {C D d s P ℓ r : ℕ} {G : DescribedNetwork T} (hs : max (C * D) (2 ^ 2 ^ (d + 2)) ≤ s) (hℓ : ℓ ≤ D * (s + 1) ^ d) (hk : G.vertices.length ≤ C * s) (hm : s ≤ G.numEdges) :

Every fixed polynomial truncation order eventually passes the same interpolation guard. The threshold is independent of the network, its precision and its encoding length.

The fast branch #

The input of the reduction at the modulus of the network.

The reduction at the modulus of the network: the native reduction of truncation order ℓ to contractions over A_P, with the modulus FastContraction.modulus m for m edges.

The reduction is correct on guarded inputs, for a contraction over A_P that is correct at the modulus of the number of edges.

The assembly #

noncomputable def Cslib.Circuits.Frontier.TruncatedContractionAlgorithm.ofCore {T : Type} {encT : T ↪ List Bool} {core : ℕ × List ℕ × ℕ × DescribedNetwork (SpecDesc T) → List ℕ} {entry : T → List Bool → List ℕ} {Adm : ℕ → ℕ → ℕ × DescribedNetwork T → Prop} {CoreAdm : ℕ → ℕ → ℕ × DescribedNetwork (SpecDesc T) → Prop} (cc : GenericRAM.NativeCertificate core (encCore encT) (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat)) (hval : ∀ (P r : ℕ) (G' : DescribedNetwork (SpecDesc T)), GaloisRingArith.val P (FastContraction.modulus G'.numEdges) (core (P, FastContraction.modulus G'.numEdges, r, G')) = DescribedNetwork.contraction (fun (d : SpecDesc T) (bs : List Bool) => GaloisRingArith.val P (FastContraction.modulus G'.numEdges) (specEntry entry d bs)) G') (hcore : ∀ (C D : ℕ), ∃ (K : ℕ), ∀ (s P r : ℕ) (G' : DescribedNetwork (SpecDesc T)), 2 ≤ s → 1 ≤ P → P ≤ D * s * (Nat.log 2 s + 1) → CoreAdm C s (r, G') → cc.time (P, FastContraction.modulus G'.numEdges, r, G') ≤ K * (((encCore encT) (P, FastContraction.modulus G'.numEdges, r, G')).length + 1) ^ K * 2 ^ (K * s / (Nat.log 2 s).sqrt) ∧ cc.space (P, FastContraction.modulus G'.numEdges, r, G') ≤ K * (((encCore encT) (P, FastContraction.modulus G'.numEdges, r, G')).length + 1) ^ K) (htransfer : ∀ (C D d : ℕ), ∃ (C' : ℕ), ∀ (s P ℓ r k : ℕ) (G : DescribedNetwork T), 2 ≤ s → 1 ≤ P → P ≤ D * s * (Nat.log 2 s + 1) → 1 ≤ ℓ → ℓ ≤ D * (s + 1) ^ d → Adm C s (r, G) → CoreAdm C' s (r, DescribedNetwork.specNet P ℓ (FastContraction.modulus G.numEdges) (FastContraction.digits (FastContraction.modulus G.numEdges).length k) G)) (ce : GenericRAM.NativeCertificate (fun (q : T × List Bool) => entry q.1 q.2) (Turing.MultiTapeTM.encPair encT Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat)) (hentry : ∀ (C : ℕ), ∃ (K : ℕ), ∀ (s r : ℕ) (G : DescribedNetwork T), Adm C s (r, G) → ∀ v ∈ G.vertices, ∀ (bs : List Bool), bs.length = v.1.length → ce.time (v.2, bs) ≤ K * (((DescribedNetwork.encDescribed encT) G).length + 1) ^ K * 2 ^ (K * s) ∧ ce.space (v.2, bs) ≤ K * (((DescribedNetwork.encDescribed encT) G).length + 1) ^ K) (hshape : ∀ (C s r : ℕ) (G : DescribedNetwork T), Adm C s (r, G) → s ≤ G.numEdges ∧ G.numEdges ≤ C * s ∧ G.vertices.length ≤ C * s) :

Theorem D.1 at truncation order ℓ, from a contraction over A_P. Let cc be a native contraction over A_P of specialized networks that is correct on every network at the modulus FastContraction.modulus m of its number m of edges (hval) and meets the interface's bound on the networks admissible for it (hcore, for an admissibility CoreAdm). Suppose that the networks specialized at the digit points of admissible networks are admissible for it (htransfer), that admissible networks have between s and C s edges and at most C s vertices (hshape), and that the entries take time K (L + 1) ^ K 2 ^ (K s) and space K (L + 1) ^ K on admissible networks of encoded length L (hentry). Then branching on truncGuard to the reduction around cc or to direct summation is a truncated contraction algorithm.