Documentation

CslibFrontier.Computability.Complexity.Classes.CountingSimulation.FastAlgorithm

The fast contraction algorithm, assembled #

The contraction interface (CountingSimulation.ContractionAlgorithm) for admissible explicit networks, from the native machine of the recursion of Theorem D.1 of [OAI26k] (FastContraction.fastCertificate), reduced to its remaining obligations (CountingSimulation.contractionAlgorithmOfFast).

The guard (CountingSimulation.fastGuard) tests what ExplicitAdmissible already implies (rows first, full tables) and the degree bound degreeBound m of the schedule (§D.4.2, (D.6), p. 58). An admissible network of degree at most C ⌊log₂ s⌋ fails it only for s below a threshold depending on C (CountingSimulation.exists_le_of_fastGuard_eq_false), since degreeBound m ≥ m ^ (9 / 10) and m ≥ s.

The clock is subexponential on admissible inputs: with m ≤ C s edges and precision P ≤ D s it is at most 2 ^ (K₀ (C + D) s / √⌊log₂ s⌋) (CountingSimulation.fuel_le).

The resources. CountingSimulation.FastAnalysis is the resource analysis of the recursion on admissible guarded inputs: a derivation of the root with polynomial depth, node sizes and leaf space, leaf time poly(n) 2 ^ O(s / √⌊log₂ s⌋), and, from some size on, a node count within the clock. From it and polynomial-time components of the scheme, the fast machine meets the interface's bounds (CountingSimulation.fastCertificate_le), through Cslib.Algorithms.StackRecursion.Scheme.certificate_le. Below the size threshold the run may not finish, and the machine falls back to direct summation, at a constant factor.

The guard is polynomial-time (CountingSimulation.fastGuard_polyTime), with the rows-first test DescribedNetwork.rowsFirst_polyTime.

For the native child builder (FastContraction.nativeMk), the components of the scheme are polynomial-time (FastContraction.scheme_nativeMk_polyTime), and the step, the passage of well-formedness to the children and the well-formed roots are proved; there the one remaining obligation is the resource analysis (CountingSimulation.contractionAlgorithmOfNative).

Remaining obligations (the hypotheses of CountingSimulation.contractionAlgorithmOfFast): the components of the scheme in polynomial time, the correctness of one active call (FastContraction.StepCorrect), the passage of well-formedness to the children (FastContraction.WFChildren) and to the root, and the resource analysis.

Main definitions #

Main results #

References #

The guard of the fast algorithm: the network is rows-first bipartite at its number of rows, every table lists the values at all bit strings on its ports, and its maximum degree is at most degreeBound m, for m its number of edges.

Admissible networks failing the guard are small. For every C there is s₀ such that a network admissible at size s with constant C that fails fastGuard has s ≤ s₀.

The guard in polynomial time #

The guard is polynomial-time: the rows-first test (DescribedNetwork.rowsFirst_polyTime), the lengths of the tables and the degrees of the vertices.

The clock #

The clock is subexponential on admissible inputs: with m ≤ C s edges and precision P ≤ D s, it is at most 2 ^ (K₀ (C + D) s / √⌊log₂ s⌋).

The resources of the fast machine #

The resource analysis of the fast machine, the remaining obligation of the running time. For all constants C and D there are K and s₀ such that on every input (P, r, G) with 2 ≤ s, 1 ≤ P ≤ D s, G admissible at size s with constant C and passing the guard, the root of the capped input has a derivation whose nodes, frames and values are at most F long, whose leaves take time at most TL and space at most SL, with H open calls, such that H + F + SL ≤ K (n + 1) ^ K and TL ≤ K (n + 1) ^ K 2 ^ (K s / √⌊log₂ s⌋) for the input length n; and from s₀ on its N nodes fit in the clock, 2 N - 1 ≤ fuel.

theorem Cslib.Complexity.CountingSimulation.exists_clockedRun_le (K₁ Ka c d r₁ e₁ r₂ e₂ kf : ℕ) :
∃ (K : ℕ), ∀ {s S n B fuel H F TL SL A AS runT runS pre preS rest restS : ℕ}, n < B → runT ≤ A + (fuel + 1) * (K₁ * ((H + 1) * (F + 1)) ^ K₁ + TL + ((Turing.MultiTapeTM.encNat fuel).length + 1) ^ 2) → runS ≤ AS + K₁ * ((H + 1) * (F + 1)) ^ K₁ + SL + (Turing.MultiTapeTM.encNat fuel).length → pre + preS + A + AS + (Turing.MultiTapeTM.encNat fuel).length ≤ c * B ^ d → rest + restS ≤ r₁ * B ^ e₁ + r₂ * B ^ e₂ → fuel ≤ 2 ^ (kf * s / S) → H + F + SL ≤ Ka * B ^ Ka → TL ≤ Ka * B ^ Ka * 2 ^ (Ka * s / S) → pre + (2 * runT + n + rest) ≤ K * B ^ K * 2 ^ (K * s / S) ∧ preS + (2 * runS + n + restS) ≤ K * B ^ K

The budget of a clocked run, the arithmetic shared by the fast machines (CountingSimulation.fastCertificate_le, CountingSimulation.exists_fastCore_le). Take a run bounded as in Cslib.Algorithms.StackRecursion.Scheme.certificate_le with constant K₁, whose derivation has open calls, node sizes and leaf space at most Ka B ^ Ka, leaf time at most Ka B ^ Ka 2 ^ (Ka s / S) and clock at most 2 ^ (kf s / S), for B above the input length n; let the steps pre before it and the fuel and root machines cost at most c B ^ d, and the output step rest at most r₁ B ^ e₁ + r₂ B ^ e₂. Then the steps, twice the run, the input and the output step are at most K B ^ K 2 ^ (K s / S) in time and K B ^ K in space, for one K depending only on the constants.

theorem Cslib.Complexity.CountingSimulation.outputStep_le {β : Type u_1} {o : Option (ℕ × β)} {valid : ℕ × β → Prop} {tagT tagS decT decS fstT fstS : ℕ × β → ℕ} {dirT dirS s s₀ Y Z : ℕ} {w : β} (hval : ∀ (v : ℕ × β), o = some v → valid v) (hdec : ∀ (v : ℕ × β), valid v → tagT v + tagS v + decT v + decS v + fstT v + fstS v ≤ Y) (hbig : s₀ ≤ s → o = some (0, w)) (hdir : s < s₀ → dirT ≤ Z) (hdirS : dirS ≤ Z) :
((o.elim dirT fun (v : ℕ × β) => tagT v + if decide (v.1 = 0) = true then decT v else fstT v + dirT) + o.elim dirS fun (v : ℕ × β) => tagS v + if decide (v.1 = 0) = true then decS v else fstS v + dirS) ≤ 2 * Y + 2 * Z

The output step of a clocked run, shared by the fast machines (CountingSimulation.fastCertificate_le, CountingSimulation.exists_fastCore_le). A value with tag 0 is decoded; any other value, or no value, falls back to direct summation. If decoding a value of the run costs at most Y, direct summation costs at most Z below a size s₀, and from s₀ on the run returns a value with tag 0, then the output step costs at most 2 Y + 2 Z in time and space together.

theorem Cslib.Complexity.CountingSimulation.le_of_le_encPair {γ β : Type} {encIn : γ ↪ List Bool} {encV : β ↪ List Bool} {q : γ} {v : β} {t c d Ka F B : ℕ} (ht : t ≤ c * (((Turing.MultiTapeTM.encPair encIn encV) (q, v)).length + 1) ^ d) (hB : B = (encIn q).length + 1) (hv : (encV v).length ≤ F) (hF : F ≤ Ka * B ^ Ka) :
t ≤ c * (Ka + 2) ^ d * B ^ ((Ka + 1) * d)

The cost of decoding a value, for the output step of a clocked run (outputStep_le): a cost polynomial in the length of the pair (q, v) is at most c (Ka + 2) ^ d B ^ ((Ka + 1) d) when B is one more than the length of q and v is at most Ka B ^ Ka long.

The fast machine within the interface's bounds. Given polynomial-time components of the scheme and the resource analysis, for all constants C and D there is K such that on every guarded input admissible at size s ≥ 2 with constant C and with precision 1 ≤ P ≤ D s, the fast machine takes time at most K (n + 1) ^ K 2 ^ (K s / √⌊log₂ s⌋) and space at most K (n + 1) ^ K.

The contraction algorithm from the fast machine, given its remaining obligations: polynomial-time components of the scheme, the correctness of one active call and the passage of well-formedness to the children (FastContraction.StepCorrect, FastContraction.WFChildren), well-formed roots on guarded inputs, and the resource analysis (FastAnalysis). It branches on the guard (ContractionAlgorithm.ofGuarded) to the fast machine or to direct summation.

Guarded inputs have well-formed roots: the modulus is irreducible modulo 2, and the tables as descriptors keep the rows-first ports.

The contraction algorithm from the native recursion, given its one remaining obligation, the resource analysis. The components of the scheme are polynomial-time (FastContraction.scheme_nativeMk_polyTime), and the step, the passage of well-formedness to the children and the well-formed roots are proved (FastContraction.stepCorrect_nativeMk, FastContraction.wfChildren_nativeMk, CountingSimulation.wf_root).