The deterministic counting simulation, assembled from its interfaces #
This module assembles the deterministic simulation of #1833 from the two interfaces of
Cslib.Complexity.CountingSimulation.NetworkFamily and
Cslib.Complexity.CountingSimulation.ContractionAlgorithm. It is conditional: every result
here assumes a network family and a contraction algorithm, which are proved separately.
On an input x with clock t, the simulation (Cslib.Complexity.CountingSimulation.simulate)
visits the scheduleCount heads t movement schedules one at a time, contracts the network of each
modulo 2 ^ (paddedTime t + 1), and adds the residues modulo the same power of two
(Cslib.Complexity.CountingSimulation.modSum). Since the count is at most 2 ^ (paddedTime t),
the residue of the sum is the count itself (Cslib.Complexity.CountingSimulation.simulate_eq).
Its cost is the number of schedules times the cost of one network, and its workspace that of one
network and an accumulator (Cslib.Complexity.CountingSimulation.exists_computableInO_simulate).
With the clock t = c * T n of a time-constructible T n ≥ max n 2, the schedules number
3 ^ O(T / log T), so the total time is 2 ^ O(T / √(log T)) in the natural-number scale of
Nat.exists_three_pow_mul_le_two_pow_div_sqrt_log_two, and the space is polynomial in T
(Cslib.Complexity.CountingSimulation.exists_computableInO_count). The counting core first
returns the exact count and its padded clock
(Cslib.Complexity.CountingSimulation.exists_computableInO_countPair). Polynomial-time
postprocessing, including the comparisons deciding acceptance, is derived from that core by
Cslib.Complexity.CountingSimulation.exists_computableInO_countWith.
Main definitions #
Cslib.Complexity.CountingSimulation.scheduleResidue: the contraction of the network of one schedule, modulo2 ^ (paddedTime t + 1).Cslib.Complexity.CountingSimulation.simulate: the streamed sum of these residues.
Main results #
Cslib.Complexity.CountingSimulation.simulate_eq: the simulation computes the count.Cslib.Complexity.CountingSimulation.exists_computableInO_simulate: its time and space bounds in terms of the clock.Cslib.Complexity.CountingSimulation.exists_computableInO_countPair: the exact count and padded clock within the claimed joint bounds.Cslib.Complexity.CountingSimulation.exists_computableInO_count: the exact count alone.Cslib.Complexity.CountingSimulation.exists_computableInO_countWith: polynomial-time postprocessing of the clock and count within the same resource scale.
The algorithm and its correctness #
The value of the network of the schedule p.2 for the input p.1.1 and the clock p.1.2,
modulo 2 ^ (paddedTime p.1.2 + 1).
The simulation on the input p.1 with the clock p.2: when |p.1| ≤ p.2 and 2 ≤ p.2,
the residues of the networks of all schedules, summed one at a time modulo
2 ^ (paddedTime p.2 + 1); otherwise 0.
The simulation computes the count: when |x| ≤ t and 2 ≤ t, and the count at the padded
time is at most 2 ^ paddedTime t, the residue of the sum of the network values modulo
2 ^ (paddedTime t + 1) is the count itself.
Polynomial-time parameters #
Resource bounds #
Time and space of the simulation (conditional on the interfaces). For a constant k, the
simulation on an input x with clock t runs within time
k * (|x| + t + 1) ^ k * scheduleCount heads t * 2 ^ (k * t / √⌊log₂ t⌋) and space
k * (|x| + t + 1) ^ k: it contracts one network per schedule, keeping one network, its
contraction workspace and an accumulator.
Exact counting within time 2 ^ O(T / √(log T)) and polynomial space (conditional on
both interfaces). The result contains the padded clock in unary and the exact count in binary.
No decision rule or postprocessing function is part of this theorem.
Any polynomial-time function of the exact count and its padded clock has the same
subexponential time and polynomial-space scale. This is postprocessing of
exists_computableInO_countPair, rather than an additional counting algorithm.
The exact count at the padded clock, with binary output, inherits the counting core's subexponential time and polynomial workspace.