Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Complexity.LogSpace.QueryMachine.Offset

Query machines with a runtime input offset #

withOffset retains a binary offset alongside the complete supplied machine state and adds it only to input queries. The other components delegate unchanged. withOffset_runFrom proves agreement at every clock with the original machine on word.drop offset, including absent reads when the offset or query is past the end of the word. No prefix, suffix or transcript is stored.

The five native component certificates preserve a supplied linear encoded-state workspace contract. withOffset_runFrom_encoding_le charges the framed binary offset in addition to the complete inner-state bound; that bound must include any suspended caller/callee context. These are original operational/component facts, not a native initializer/executor composition. A native execution compiler must separately charge its original-input position and supply its initialization, halting and physical callee resource contracts. Time is not bounded by space here.

A runtime input offset and the complete active or suspended machine state.

  • offset : ℕ

    First cell of the logical input within the original word.

  • inner : σ

    Complete state of the supplied machine.

theorem Turing.QueryMachine.encLocated_inner_budget (σ : Type) (encS : σ ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Located σ} :
MultiTapeTM.ComputableInSpace g✝ encIn✝ (encLocated σ encS) S✝ → MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).inner) encIn✝ encS S✝
theorem Turing.QueryMachine.encLocated_offset_polyTime (σ : Type) (encS : σ ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → Located σ} :
MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encLocated σ encS) → MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).offset) encIn✝ MultiTapeTM.encNat

Framed binary offset followed by the supplied state word, with no additional framing.

theorem Turing.QueryMachine.encLocated_mk_deg (σ : Type) (encS : σ ↪ List Bool) :
MultiTapeTM.ComputableInDegree (fun (p : ℕ × σ) => { offset := p.1, inner := p.2 }) (encLocatedFields σ encS) (encLocated σ encS) 1 1
theorem Turing.QueryMachine.encLocated_inner_length_le (σ : Type) (encS : σ ↪ List Bool) (a : Located σ) :
(encS a.inner).length ≤ ((encLocated σ encS) a).length
theorem Turing.QueryMachine.encLocated_mk_inO (σ : Type) (encS : σ ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 : γ → ℕ} {x1 : γ → σ} {T1 S1 : γ → ℕ} (h0 : MultiTapeTM.ComputableInO x0 encIn MultiTapeTM.encNat T0 S0) (h1 : MultiTapeTM.ComputableInO x1 encIn encS T1 S1) :
MultiTapeTM.ComputableInO (fun (x : γ) => { offset := x0 x, inner := x1 x }) encIn (encLocated σ encS) (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
@[simp]
theorem Turing.QueryMachine.encLocated_apply (σ : Type) (encS : σ ↪ List Bool) (a : Located σ) :
(encLocated σ encS) a = (encLocatedFields σ encS) (a.offset, a.inner)
theorem Turing.QueryMachine.encLocated_inner_inO (σ : Type) (encS : σ ↪ List Bool) :
MultiTapeTM.ComputableInO Located.inner (encLocated σ encS) encS (fun (a : Located σ) => ((encLocated σ encS) a).length) fun (a : Located σ) => ((encLocated σ encS) a).length
@[reducible, inline]

The tuple of the fields of encLocated.

theorem Turing.QueryMachine.encLocated_mk_budget (σ : Type) (encS : σ ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {budget x0 : γ → ℕ} {x1 : γ → σ} (h0 : MultiTapeTM.ComputableInSpace x0 encIn MultiTapeTM.encNat budget) (h1 : MultiTapeTM.ComputableInSpace x1 encIn encS budget) :
MultiTapeTM.ComputableInSpace (fun (x : γ) => { offset := x0 x, inner := x1 x }) encIn (encLocated σ encS) budget
theorem Turing.QueryMachine.encLocated_mk_polyTime (σ : Type) (encS : σ ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → ℕ} {x1 : γ → σ} (h0 : MultiTapeTM.ComputableInPolyTime x0 encIn MultiTapeTM.encNat) (h1 : MultiTapeTM.ComputableInPolyTime x1 encIn encS) :
MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { offset := x0 x, inner := x1 x }) encIn (encLocated σ encS)
theorem Turing.QueryMachine.encLocated_offset_budget (σ : Type) (encS : σ ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → Located σ} :
MultiTapeTM.ComputableInSpace g✝ encIn✝ (encLocated σ encS) S✝ → MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).offset) encIn✝ MultiTapeTM.encNat S✝
theorem Turing.QueryMachine.encLocated_inner_polyTime (σ : Type) (encS : σ ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → Located σ} :
MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encLocated σ encS) → MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).inner) encIn✝ encS
theorem Turing.QueryMachine.length_encLocated {σ : Type} (encS : σ ↪ List Bool) (s : Located σ) :
((encLocated σ encS) s).length = 2 * (MultiTapeTM.encNat s.offset).length + 1 + (encS s.inner).length

Exact charge for retaining a binary offset with a complete supplied state.

Relocate queries using a runtime offset, delegating all remaining components unchanged. The default initial offset is zero; a caller can supply a located runtime state with runFrom.

theorem Turing.QueryMachine.withOffset_runFrom {σ : Type} (M : QueryMachine σ) (word : List Bool) (offset : ℕ) (start : σ) (t : ℕ) :
M.withOffset.runFrom word { offset := offset, inner := start } t = { offset := offset, inner := M.runFrom (List.drop offset word) start t }

Exact all-clock dropped-word simulation, including halted and out-of-range states.

Native query dispatch charges addition of the retained binary offset.

Native transition dispatch retains the offset and applies the supplied transition once.

Native emissions use the supplied component on the unchanged inner state and reply.

Native halting dispatch tests the unchanged inner state.

Native final-output dispatch uses the unchanged supplied final-output component.

theorem Turing.QueryMachine.withOffset_runFrom_encoding_le {σ : Type} (M : QueryMachine σ) (encS : σ ↪ List Bool) (word : List Bool) (offset : ℕ) (start : σ) (B T : ℕ) (h : ∀ t ≤ T, (encS (M.runFrom (List.drop offset word) start t)).length ≤ B) (t : ℕ) :
t ≤ T → ((encLocated σ encS) (M.withOffset.runFrom word { offset := offset, inner := start } t)).length ≤ 2 * (MultiTapeTM.encNat offset).length + 1 + B

Every clock charges the framed binary offset in addition to the supplied complete state bound. The inner bound must already include any suspended caller and callee.