Documentation

CslibFrontier.Computability.Machines.AuxPDA.Counting

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 #

Main results #

References #

structure Turing.CountingAuxPDA (k : ℕ) (Symbol : Type u_1) (StackSym : Type u_2) (State : Type u_3) :
Type (max (max u_1 u_2) u_3)

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.

  • q₀ : State

    The initial control state.

  • tr (q : State) (input : Option Symbol) (work : Fin k → Option Symbol) (top : Option StackSym) : List (AuxPDA.Action k Symbol StackSym State)

    Ordered list of transition occurrences at each local view.

def Turing.CountingAuxPDA.actions {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (cfg : AuxPDA.Cfg k Symbol StackSym State input) :
List (AuxPDA.Action k Symbol StackSym State)

The ordered list of live transition occurrences at cfg; empty when halted.

def Turing.CountingAuxPDA.toAuxPDA {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} (M : CountingAuxPDA k Symbol StackSym State) :
AuxPDA k Symbol StackSym State

Forget transition multiplicity to obtain the underlying nondeterministic AuxPDA.

def Turing.CountingAuxPDA.step? {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (cfg : AuxPDA.Cfg k Symbol StackSym State input) (index : ℕ) :
Option (AuxPDA.Cfg k Symbol StackSym State input)

Execute occurrence index at cfg. Returns none when halted, out of range, or on stack underflow.

def Turing.CountingAuxPDA.lts {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} (M : CountingAuxPDA k Symbol StackSym State) (input : List Symbol) :
Cslib.LTS (AuxPDA.Cfg k Symbol StackSym State input) ℕ

The labelled transition system of M on input, labelled by occurrence index.

def Turing.CountingAuxPDA.runBranch {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) :
AuxPDA.Cfg k Symbol StackSym State input → List ℕ → Option (AuxPDA.Cfg k Symbol StackSym State input)

Replay a list of occurrence indices from cfg, stopping without padding after halting.

@[simp]
theorem Turing.CountingAuxPDA.runBranch_nil {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (cfg : AuxPDA.Cfg k Symbol StackSym State input) :
M.runBranch cfg [] = some cfg
theorem Turing.CountingAuxPDA.runBranch_cons {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (cfg : AuxPDA.Cfg k Symbol StackSym State input) (index : ℕ) (rest : List ℕ) :
M.runBranch cfg (index :: rest) = (M.step? cfg index).bind fun (next : AuxPDA.Cfg k Symbol StackSym State input) => M.runBranch next rest
theorem Turing.CountingAuxPDA.actions_of_halted {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) {cfg : AuxPDA.Cfg k Symbol StackSym State input} (h : cfg.Halted) :
M.actions cfg = []
theorem Turing.CountingAuxPDA.step?_of_halted {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) {cfg : AuxPDA.Cfg k Symbol StackSym State input} (h : cfg.Halted) (index : ℕ) :
M.step? cfg index = none
theorem Turing.CountingAuxPDA.runBranch_of_halted {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) {cfg : AuxPDA.Cfg k Symbol StackSym State input} (h : cfg.Halted) (choices : List ℕ) :
M.runBranch cfg choices = if choices = [] then some cfg else none
theorem Turing.CountingAuxPDA.runBranch_append {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (cfg : AuxPDA.Cfg k Symbol StackSym State input) (first second : List ℕ) :
M.runBranch cfg (first ++ second) = (M.runBranch cfg first).bind fun (next : AuxPDA.Cfg k Symbol StackSym State input) => M.runBranch next second
theorem Turing.CountingAuxPDA.runBranch_eq_some_iff {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (cfg final : AuxPDA.Cfg k Symbol StackSym State input) (choices : List ℕ) :
M.runBranch cfg choices = some final ↔ (M.lts input).MTr cfg choices final
theorem Turing.CountingAuxPDA.step?_eq_some_iff {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (cfg final : AuxPDA.Cfg k Symbol StackSym State input) (index : ℕ) :
M.step? cfg index = some final ↔ ∃ (h : index < (M.actions cfg).length), (M.actions cfg)[index].apply? cfg = some final
theorem Turing.CountingAuxPDA.runBranch_unique_of_actions_length_le_one {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (hdet : ∀ (cfg : AuxPDA.Cfg k Symbol StackSym State input), (M.actions cfg).length ≤ 1) {cfg x y : AuxPDA.Cfg k Symbol StackSym State input} {first second : List ℕ} (hx : M.runBranch cfg first = some x) (hy : M.runBranch cfg second = some y) (hxh : x.Halted) (hyh : y.Halted) :
first = second

If every configuration offers at most one occurrence, any two complete traces from the same configuration have the same occurrence list.

theorem Turing.CountingAuxPDA.step_toAuxPDA_iff {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) {cfg next : AuxPDA.Cfg k Symbol StackSym State input} (hrun : ¬cfg.Halted) :
M.toAuxPDA.Step cfg next ↔ ∃ (i : ℕ), M.step? cfg i = some next

Before halting, an unlabelled toAuxPDA step is precisely a valid occurrence index.

def Turing.CountingAuxPDA.branches {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) :
ℕ → AuxPDA.Cfg k Symbol StackSym State input → Finset (List ℕ)

Enumerate all first-halting occurrence traces of length at most fuel starting from cfg. Underflowing transitions (apply? = none) contribute no branches.

theorem Turing.CountingAuxPDA.branches_of_halted {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) {cfg : AuxPDA.Cfg k Symbol StackSym State input} (h : cfg.Halted) (fuel : ℕ) :
M.branches fuel cfg = {[]}
@[simp]
theorem Turing.CountingAuxPDA.nil_mem_branches {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (cfg : AuxPDA.Cfg k Symbol StackSym State input) (fuel : ℕ) :
[] ∈ M.branches fuel cfg ↔ cfg.Halted
theorem Turing.CountingAuxPDA.cons_mem_branches {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (cfg : AuxPDA.Cfg k Symbol StackSym State input) (fuel index : ℕ) (rest : List ℕ) :
index :: rest ∈ M.branches (fuel + 1) cfg ↔ ∃ (next : AuxPDA.Cfg k Symbol StackSym State input), M.step? cfg index = some next ∧ rest ∈ M.branches fuel next
theorem Turing.CountingAuxPDA.mem_branches_iff {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (cfg : AuxPDA.Cfg k Symbol StackSym State input) (fuel : ℕ) (choices : List ℕ) :
choices ∈ M.branches fuel cfg ↔ choices.length ≤ fuel ∧ ∃ (final : AuxPDA.Cfg k Symbol StackSym State input), M.runBranch cfg choices = some final ∧ final.Halted

branches enumerates precisely the first-halting occurrence traces within fuel steps.

theorem Turing.CountingAuxPDA.exists_runBranch_of_runningPath {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (p : RelSeries (M.toAuxPDA.runningStepRel input)) :
∃ (indices : List ℕ), M.runBranch p.head indices = some p.last ∧ indices.length = p.length

A path of running toAuxPDA steps can be replayed by occurrence indices.

theorem Turing.CountingAuxPDA.exists_runningPath_of_runBranch {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) {c d : AuxPDA.Cfg k Symbol StackSym State input} {indices : List ℕ} (h : M.runBranch c indices = some d) :
∃ (p : RelSeries (M.toAuxPDA.runningStepRel input)), p.head = c ∧ p.last = d ∧ p.length = indices.length

A successful occurrence replay yields a path of running toAuxPDA steps.

inductive Turing.CountingAuxPDA.HaltsWithin {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) :
ℕ → AuxPDA.Cfg k Symbol StackSym State input → Prop

Every branch from cfg halts within fuel steps, with no stuck configurations and no stack underflow on any reachable transition occurrence.

theorem Turing.CountingAuxPDA.haltsWithin_of_runBranch_of_actions_length_le_one {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (hdet : ∀ (cfg : AuxPDA.Cfg k Symbol StackSym State input), (M.actions cfg).length ≤ 1) {cfg final : AuxPDA.Cfg k Symbol StackSym State input} {indices : List ℕ} (hrun : M.runBranch cfg indices = some final) (hhalt : final.Halted) :
M.HaltsWithin indices.length cfg

A successful halting trace of a machine with at most one occurrence per configuration bounds every computation from its starting configuration.

theorem Turing.CountingAuxPDA.HaltsWithin.paths_halted {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} (h : M.HaltsWithin fuel cfg) (p : M.toAuxPDA.RunPath input) :
RelSeries.head p = cfg → fuel ≤ p.length → (RelSeries.last p).Halted

A counting-machine clock bounds every unlabelled toAuxPDA path from cfg.

theorem Turing.CountingAuxPDA.HaltsWithin.mono {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} {M : CountingAuxPDA k Symbol StackSym State} {cfg : AuxPDA.Cfg k Symbol StackSym State input} {fuel larger : ℕ} (h : M.HaltsWithin fuel cfg) (hle : fuel ≤ larger) :
M.HaltsWithin larger cfg

Enlarging a sufficient clock preserves HaltsWithin.

theorem Turing.CountingAuxPDA.HaltsWithin.length_le {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} {M : CountingAuxPDA k Symbol StackSym State} {cfg final : AuxPDA.Cfg k Symbol StackSym State input} {fuel : ℕ} (h : M.HaltsWithin fuel cfg) {choices : List ℕ} (hrun : M.runBranch cfg choices = some final) :
choices.length ≤ fuel

No valid replay can exceed an all-branches halting clock.

theorem Turing.CountingAuxPDA.HaltsWithin.branches_eq {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} {M : CountingAuxPDA k Symbol StackSym State} {cfg : AuxPDA.Cfg k Symbol StackSym State input} {fuel larger : ℕ} (h : M.HaltsWithin fuel cfg) (hle : fuel ≤ larger) :
M.branches larger cfg = M.branches fuel cfg

Increasing a sufficient clock does not change the finite set of terminal branches.

theorem Turing.CountingAuxPDA.HaltsWithin.branches_nonempty {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} {M : CountingAuxPDA k Symbol StackSym State} {cfg : AuxPDA.Cfg k Symbol StackSym State input} {fuel : ℕ} (h : M.HaltsWithin fuel cfg) :
(M.branches fuel cfg).Nonempty

A HaltsWithin clock guarantees at least one terminal branch.

def Turing.CountingAuxPDA.branchCount {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (verdict : List Symbol → Bool) (fuel : ℕ) (cfg : AuxPDA.Cfg k Symbol StackSym State input) :

Count terminal branches whose final output satisfies verdict. Failed replays (stuck states or stack underflow) are never counted.

theorem Turing.CountingAuxPDA.HaltsWithin.branchCount_eq {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} {M : CountingAuxPDA k Symbol StackSym State} {cfg : AuxPDA.Cfg k Symbol StackSym State input} {fuel larger : ℕ} (h : M.HaltsWithin fuel cfg) (hle : fuel ≤ larger) (verdict : List Symbol → Bool) :
M.branchCount verdict larger cfg = M.branchCount verdict fuel cfg
theorem Turing.CountingAuxPDA.HaltsWithin.branchCount_pos_iff {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} (h : M.HaltsWithin fuel cfg) (verdict : List Symbol → Bool) :
0 < M.branchCount verdict fuel cfg ↔ ∃ (p : M.toAuxPDA.RunPath input), RelSeries.head p = cfg ∧ (RelSeries.last p).Halted ∧ verdict (RelSeries.last p).tapes.output = true

A positive branch count within a sufficient clock is equivalent to existence of a halted unlabelled toAuxPDA run path realizing verdict.

theorem Turing.CountingAuxPDA.branchCount_add_not {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (verdict : List Symbol → Bool) (fuel : ℕ) (cfg : AuxPDA.Cfg k Symbol StackSym State input) :
M.branchCount verdict fuel cfg + M.branchCount (fun (out : List Symbol) => !verdict out) fuel cfg = (M.branches fuel cfg).card

Complementary verdicts partition the terminal branches without counting stuck or underflowing traces.

theorem Turing.CountingAuxPDA.branchCount_succ {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : CountingAuxPDA k Symbol StackSym State) (verdict : List Symbol → Bool) (cfg : AuxPDA.Cfg k Symbol StackSym State input) (fuel : ℕ) (state : State) (h : cfg.tapes.state = some state) :
M.branchCount verdict (fuel + 1) cfg = ∑ index : Fin (M.actions cfg).length, match (M.actions cfg)[↑index].apply? cfg with | none => 0 | some next => M.branchCount verdict fuel next

Branch counts at a running configuration sum over transition occurrences (skipping any underflowing occurrences).

def Turing.CountingAuxPDA.acceptCount {k : ℕ} {StackSym : Type u_2} {State : Type u_3} (M : CountingAuxPDA k Bool StackSym State) {input : List Bool} (fuel : ℕ) (cfg : AuxPDA.Cfg k Bool StackSym State input) :

Accepting branch count under the standard [true] output convention.

def Turing.CountingAuxPDA.rejectCount {k : ℕ} {StackSym : Type u_2} {State : Type u_3} (M : CountingAuxPDA k Bool StackSym State) {input : List Bool} (fuel : ℕ) (cfg : AuxPDA.Cfg k Bool StackSym State input) :

Rejecting branch count: terminal outputs other than [true] (excluding stuck or underflowing branches).

theorem Turing.CountingAuxPDA.acceptCount_add_rejectCount {k : ℕ} {StackSym : Type u_2} {State : Type u_3} (M : CountingAuxPDA k Bool StackSym State) {input : List Bool} (fuel : ℕ) (cfg : AuxPDA.Cfg k Bool StackSym State input) :
M.acceptCount fuel cfg + M.rejectCount fuel cfg = (M.branches fuel cfg).card
def Turing.CountingAuxPDA.CountsInTimeAndSpace {k : ℕ} {StackSym : Type u_2} {State : Type u_3} {α : Type u_4} (M : CountingAuxPDA k Bool StackSym State) (enc : α ↪ List Bool) (f s t : α → ℕ) :

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.

theorem Turing.CountingAuxPDA.CountsInTimeAndSpace.mono {k : ℕ} {StackSym : Type u_2} {State : Type u_3} {α : Type u_4} {M : CountingAuxPDA k Bool StackSym State} {enc : α ↪ List Bool} {f s s' t t' : α → ℕ} (h : M.CountsInTimeAndSpace enc f s t) (hs : ∀ (a : α), s a ≤ s' a) (ht : ∀ (a : α), t a ≤ t' a) :
M.CountsInTimeAndSpace enc f s' t'

Monotone resource closure for CountsInTimeAndSpace: increasing either the space bound or the clock bound preserves the exact accepting count.

theorem Turing.CountingAuxPDA.CountsInTimeAndSpace.decidesInTimeAndSpace {k : ℕ} {StackSym : Type u_2} {State : Type u_3} {α : Type u_4} {M : CountingAuxPDA k Bool StackSym State} {enc : α ↪ List Bool} {f s t : α → ℕ} {A : Set α} (h : M.CountsInTimeAndSpace enc f s t) (hA : ∀ (a : α), a ∈ A ↔ 0 < f a) :

Forgetting transition multiplicity gives a nondeterministic AuxPDA decider within the same work space and clock bounds.

Embedding multi-tape counting Turing machines #

def Turing.CountingAuxPDA.ofMultiTapeCTM {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} (M : MultiTapeCTM k Symbol State) :
CountingAuxPDA k Symbol StackSym State

Embed any MultiTapeCTM into a CountingAuxPDA that leaves the stack unchanged (StackOp.stay) on every occurrence.

theorem Turing.CountingAuxPDA.ofMultiTapeCTM_actions {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : MultiTapeCTM k Symbol State) (c : Cfg k Symbol State input) (s : List StackSym) :
(ofMultiTapeCTM M).actions { tapes := c, stack := s } = List.map (fun (act : Action k Symbol State) => { tape := act, stackOp := AuxPDA.StackOp.stay }) (M.actions c)
theorem Turing.CountingAuxPDA.ofMultiTapeCTM_step? {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : MultiTapeCTM k Symbol State) (c : Cfg k Symbol State input) (s : List StackSym) (i : ℕ) :
(ofMultiTapeCTM M).step? { tapes := c, stack := s } i = Option.map (fun (c' : Cfg k Symbol State input) => { tapes := c', stack := s }) (M.step? c i)
theorem Turing.CountingAuxPDA.ofMultiTapeCTM_runBranch {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : MultiTapeCTM k Symbol State) (c : Cfg k Symbol State input) (s : List StackSym) (choices : List ℕ) :
(ofMultiTapeCTM M).runBranch { tapes := c, stack := s } choices = Option.map (fun (c' : Cfg k Symbol State input) => { tapes := c', stack := s }) (M.runBranch c choices)
theorem Turing.CountingAuxPDA.ofMultiTapeCTM_branches {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : MultiTapeCTM k Symbol State) (fuel : ℕ) (c : Cfg k Symbol State input) (s : List StackSym) :
(ofMultiTapeCTM M).branches fuel { tapes := c, stack := s } = M.branches fuel c
theorem Turing.CountingAuxPDA.ofMultiTapeCTM_haltsWithin_iff {k : ℕ} {Symbol : Type u_1} {StackSym : Type u_2} {State : Type u_3} {input : List Symbol} (M : MultiTapeCTM k Symbol State) (fuel : ℕ) (c : Cfg k Symbol State input) (s : List StackSym) :
(ofMultiTapeCTM M).HaltsWithin fuel { tapes := c, stack := s } ↔ M.HaltsWithin fuel c
theorem Turing.CountingAuxPDA.ofMultiTapeCTM_acceptCount {k : ℕ} {StackSym : Type u_2} {State : Type u_3} (M : MultiTapeCTM k Bool State) {input : List Bool} (fuel : ℕ) (c : Cfg k Bool State input) (s : List StackSym) :
(ofMultiTapeCTM M).acceptCount fuel { tapes := c, stack := s } = M.acceptCount fuel c
theorem Turing.CountingAuxPDA.ofDeterministic_actions_length_le_one {k : ℕ} {State Alphabet Stack : Type} {input : List Alphabet} (tm : MultiTapeTM k Alphabet State) (cfg : AuxPDA.Cfg k Alphabet Stack State input) :

The auxiliary lift of a deterministic tape machine offers at most one occurrence.

theorem Turing.CountingAuxPDA.existsUnique_runBranch_ofDeterministic {k : ℕ} {State Symbol StackSym : Type} {input : List Symbol} (machine : MultiTapeTM k Symbol State) (cfg : AuxPDA.Cfg k Symbol StackSym State input) (fuel : ℕ) (h : (MultiTapeTM.runFrom cfg.tapes fuel).Halted) :
∃! indices : List ℕ, indices.length ≤ fuel ∧ (ofMultiTapeCTM (MultiTapeCTM.ofDeterministic machine)).runBranch cfg indices = some { tapes := MultiTapeTM.runFrom cfg.tapes fuel, stack := cfg.stack }

A deterministic tape routine has exactly one complete AuxPDA occurrence trace under a sufficient clock. Running the routine leaves the existing stack untouched.