Documentation

Complexitylib.Classes.Containments.Internal.TallyLoopIndexed

A counting loop whose resting tapes change with the count #

⚠️ Unreviewed by Bolton

NTM.tallyLoop_hoareTime_of_hoare pins the tapes the tally state does not name to one bank, the same at every index. That is right for a loop whose only state is its counters — the path-counting machine of PP ⊆ PSPACE — but not for one carrying something alongside them.

The witness enumerator of PH ⊆ PSPACE is such a loop: its witness tape advances with the counter, so the bank it rests in is a function of the count. These are the same two rules with that bank indexed; the proofs are unchanged apart from the index.

Main results #

theorem Complexity.NTM.tallyLoop_hoareTime_of_hoare_indexed {n : } (tmBody tmTest : TM n) (cIdx aIdx rIdx : Fin n) (I : Tape) (rest : Fin nTape) (P : Bool) (mid : TM.TapePred n) (N bBody bTest : ) (hN : 1 N) (hI : TM.Parked I) (hrest : ∀ (v : ) (i : Fin n), TM.Parked (rest v i)) (hbody : v < N, tmBody.HoareTime (tallyPre cIdx aIdx rIdx I (rest v) P v) (mid v) bBody) (hmid : ∀ (v : ) (inp : Tape) (work : Fin nTape) (out : Tape), mid v inp work outTM.LoopParked inp work out) (htest : v < N, tmTest.HoareTime (mid v) (tallyPost cIdx aIdx rIdx I (rest (v + 1)) P N (v + 1)) bTest) :
(tmBody.loopTM tmTest).HoareTime (tallyPre cIdx aIdx rIdx I (rest 0) P 0) (tallyPost cIdx aIdx rIdx I (rest N) P N N) (N * (bBody + bTest + 5))

The counting loop, with a bank that changes with the count.

theorem Complexity.NTM.tallyLoop_keepsWindow_of_hoare_indexed {n : } (tmBody tmTest : TM n) (cIdx aIdx rIdx : Fin n) (I : Tape) (rest : Fin nTape) (P : Bool) (mid : TM.TapePred n) (N bBody bTest inputLength : ) (hN : 1 N) (hI : TM.Parked I) (hrest : ∀ (v : ) (i : Fin n), TM.Parked (rest v i)) (hIhead : I.head inputLength + 1) (hrestHead : ∀ (v : ) (i : Fin n), (rest v i).head 1) (hbody : v < N, tmBody.HoareTime (tallyPre cIdx aIdx rIdx I (rest v) P v) (mid v) bBody) (hmid : ∀ (v : ) (inp : Tape) (work : Fin nTape) (out : Tape), mid v inp work outTM.LoopParked inp work out) (htest : v < N, tmTest.HoareTime (mid v) (tallyPost cIdx aIdx rIdx I (rest (v + 1)) P N (v + 1)) bTest) (inp : Tape) (work : Fin nTape) (out : Tape) :
tallyPre cIdx aIdx rIdx I (rest 0) P 0 inp work out∀ (c : Cfg n (tmBody.loopTM tmTest).Q), (tmBody.loopTM tmTest).reaches { state := (tmBody.loopTM tmTest).qstart, input := inp, work := work, output := out } cc.WithinDecisionSpace inputLength (1 + (bBody + bTest + 5))

Its window, one iteration wide.