Counting auxiliary pushdown automata #
Turing.CountingAuxPDA equips an auxiliary pushdown automaton with an ordered list of transition
occurrences at each local view (control state, input symbol, work-tape symbols, top stack symbol),
mirroring Turing.MultiTapeCTM and Turing.MultiTapeCTM.CountsInSpace. Repeated entries in the
transition list count as distinct branches.
A branch is a list of occurrence indices stopping at the first halted configuration. An out-of-range
index or an action attempting StackOp.pop on an empty stack fails (step? = none) and is never
counted as an accepting or rejecting branch. CountingAuxPDA.HaltsWithin requires every reachable
running configuration to have a nonempty transition list, every listed transition to avoid stack
underflow, and every branch to halt within the clock bound.
This is original machine infrastructure for cslib-frontier #7920 (Work Package 3), supplying the
exact accepting-path count behind Cslib.Complexity.UAuxPDA and Cslib.Complexity.coUAuxPDA.
Main definitions #
Turing.CountingAuxPDA: counting auxiliary pushdown automaton with ordered transition lists.Turing.CountingAuxPDA.toAuxPDA: forget transition multiplicity to obtain anAuxPDA.Turing.CountingAuxPDA.step?,Turing.CountingAuxPDA.lts,Turing.CountingAuxPDA.runBranch,Turing.CountingAuxPDA.branches: occurrence-labelled transitions and bounded terminal branches.Turing.CountingAuxPDA.HaltsWithin: all-branches clock bound excluding stuck states and stack underflow.Turing.CountingAuxPDA.branchCount,Turing.CountingAuxPDA.acceptCount,Turing.CountingAuxPDA.rejectCount: exact terminal branch counts.Turing.CountingAuxPDA.CountsInTimeAndSpace: accepting-count witness with work space and all-branches clock bounds.Turing.CountingAuxPDA.ofMultiTapeCTM: embedding of aMultiTapeCTMwith an unused stack.
Main results #
Turing.CountingAuxPDA.mem_branches_iff:branchesenumerates exactly the bounded first-halting traces.Turing.CountingAuxPDA.HaltsWithin.branches_eq,Turing.CountingAuxPDA.HaltsWithin.branchCount_eq: sufficient clocks are stable under increase.Turing.CountingAuxPDA.HaltsWithin.branchCount_pos_iff: positive count equals existence of a halted unlabelled run path with the verdict.Turing.CountingAuxPDA.CountsInTimeAndSpace.decidesInTimeAndSpace: forgetting multiplicity gives a nondeterministicAuxPDAdecider within the same space and time bounds.Turing.CountingAuxPDA.ofMultiTapeCTM_acceptCount,Turing.CountingAuxPDA.ofMultiTapeCTM_haltsWithin_iff: exact branch-count preservation fromMultiTapeCTM.
References #
A counting auxiliary pushdown automaton: at each local view (control state, input head symbol,
work-tape head symbols, top stack symbol), tr gives an ordered list of transition occurrences.
Repeated entries in the list count as distinct branches.
The ordered list of live transition occurrences at cfg; empty when halted.
Forget transition multiplicity to obtain the underlying nondeterministic AuxPDA.
Execute occurrence index at cfg. Returns none when halted, out of range, or on stack
underflow.
The labelled transition system of M on input, labelled by occurrence index.
Replay a list of occurrence indices from cfg, stopping without padding after halting.
If every configuration offers at most one occurrence, any two complete traces from the same configuration have the same occurrence list.
Before halting, an unlabelled toAuxPDA step is precisely a valid occurrence index.
Enumerate all first-halting occurrence traces of length at most fuel starting from cfg.
Underflowing transitions (apply? = none) contribute no branches.
branches enumerates precisely the first-halting occurrence traces within fuel steps.
A path of running toAuxPDA steps can be replayed by occurrence indices.
A successful occurrence replay yields a path of running toAuxPDA steps.
Every branch from cfg halts within fuel steps, with no stuck configurations and no stack
underflow on any reachable transition occurrence.
- halt {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} {M : CountingAuxPDA k Symbol StackSym State} {fuel : ℕ} {cfg : AuxPDA.Cfg k Symbol StackSym State input} (halted : cfg.Halted) : M.HaltsWithin fuel cfg
- step {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} {M : CountingAuxPDA k Symbol StackSym State} {fuel : ℕ} {cfg : AuxPDA.Cfg k Symbol StackSym State input} (nonempty : M.actions cfg ≠ []) (valid : ∀ (index : Fin (M.actions cfg).length), ((M.actions cfg)[↑index].apply? cfg).isSome = true) (next : ∀ (index : Fin (M.actions cfg).length) (nextCfg : AuxPDA.Cfg k Symbol StackSym State input), (M.actions cfg)[↑index].apply? cfg = some nextCfg → M.HaltsWithin fuel nextCfg) : M.HaltsWithin (fuel + 1) cfg
A successful halting trace of a machine with at most one occurrence per configuration bounds every computation from its starting configuration.
A counting-machine clock bounds every unlabelled toAuxPDA path from cfg.
Enlarging a sufficient clock preserves HaltsWithin.
No valid replay can exceed an all-branches halting clock.
Increasing a sufficient clock does not change the finite set of terminal branches.
A HaltsWithin clock guarantees at least one terminal branch.
Count terminal branches whose final output satisfies verdict. Failed replays (stuck states
or stack underflow) are never counted.
A positive branch count within a sufficient clock is equivalent to existence of a halted
unlabelled toAuxPDA run path realizing verdict.
Complementary verdicts partition the terminal branches without counting stuck or underflowing traces.
Branch counts at a running configuration sum over transition occurrences (skipping any underflowing occurrences).
Accepting branch count under the standard [true] output convention.
Rejecting branch count: terminal outputs other than [true] (excluding stuck or underflowing
branches).
M realizes the accepting count f within work space s and all-branches clock t relative
to enc: every prefix visits at most s a work-tape cells, every branch halts within t a steps
without stuck states or stack underflow, and f a equals M.acceptCount (t a) from the initial
configuration.
Monotone resource closure for CountsInTimeAndSpace: increasing either the space bound or the
clock bound preserves the exact accepting count.
Forgetting transition multiplicity gives a nondeterministic AuxPDA decider within the
same work space and clock bounds.
Embedding multi-tape counting Turing machines #
Embed any MultiTapeCTM into a CountingAuxPDA that leaves the stack unchanged
(StackOp.stay) on every occurrence.
The auxiliary lift of a deterministic tape machine offers at most one occurrence.
A deterministic tape routine has exactly one complete AuxPDA occurrence trace under a sufficient clock. Running the routine leaves the existing stack untouched.