Documentation

Complexitylib.Models.TuringMachine.Witness

Witness machines and nondeterministic machines #

An online witness machine is equivalent to an NTM with exactly the same time and charged-space bounds. The witness is external, read-only, and consumed left to right; nonconsuming steps cannot inspect it. This theorem does not identify a free two-way certificate tape with ordinary nondeterminism.

NTM.toWitnessTM supplies a witness-machine instance for every NTM. WitnessTM.toNTM removes the distinguished tape. The round trip recovers the original NTM, and both translations preserve acceptance and all-path resource bounds. Bounds are arbitrary functions, with no polynomial or constructibility hypotheses. Witness loading is part of initialization, not a charged computation. run_congr_prefix shows that the first t bits determine the visible t-step run, so infinite streams are only a representation of finite certificates.

theorem Complexity.WitnessTM.run_congr_prefix {k : ℕ} (W : WitnessTM k) (x : List Bool) (t : ℕ) (g h : ℕ → Bool) (hprefix : ∀ i < t, g i = h i) :
NTM.dropChoice (W.run x g t) = NTM.dropChoice (W.run x h t)

The first t witness bits determine the visible result of t steps. Unread tails need not agree, so a finite certificate of length t suffices.

theorem Complexity.WitnessTM.exists_run_eq_trace {k : ℕ} (W : WitnessTM k) (x : List Bool) (t : ℕ) (choices : Fin t → Bool) :
∃ (g : ℕ → Bool), NTM.dropChoice (W.run x g t) = W.toNTM.trace t choices (W.toNTM.initCfg x)

Every NTM trace has a witness run with exactly the same visible endpoint.

theorem Complexity.WitnessTM.exists_trace_eq_run {k : ℕ} (W : WitnessTM k) (x : List Bool) (t : ℕ) (g : ℕ → Bool) :
∃ (choices : Fin t → Bool), W.toNTM.trace t choices (W.toNTM.initCfg x) = NTM.dropChoice (W.run x g t)

Every witness run has an NTM trace with exactly the same visible endpoint.

Uniform halting bounds agree exactly in the two models.

Existential acceptance agrees at the same clock, including clock zero.

Time-bounded deciding agrees without changing the time bound.

A single machine's time and space bounds are preserved simultaneously.

Uniformly halting, space-bounded deciding agrees without extra charged space.

The simultaneous predicate recovers the existing space-only definition.

@[simp]

Supplying then removing the witness stream recovers the original NTM.

Every NTM has an online witness presentation with the exact same time bound.

Every NTM has an online witness presentation preserving both resource bounds.

Every NTM has an online witness presentation with the exact same space bound.