Documentation

CslibFrontier.Computability.Machines.AuxPDA.BoundedSurfaceSpace

Native numeric queries on bounded AuxPDA surfaces #

The finite surface encoding has one ternary digit per work-tape cell. From the window radius and the binary input length, the routines compute the surface count and initial surface index. They also decode binary surface IDs, read the original input at a stored head position, and decide bounded stay and matched push-pop edges using a fixed machine's transition table.

theorem Turing.AuxPDA.boundedSurfaceCard_inSpace {α : Type} {enc : α ↪ List Bool} {n s budget : α → ℕ} (stackSize stateCount tapes : ℕ) (hn : MultiTapeTM.ComputableInSpace n enc MultiTapeTM.encNat budget) (hs : MultiTapeTM.ComputableInSpace s enc MultiTapeTM.encNat budget) (hRadius : MultiTapeTM.BigOLe s budget) :
MultiTapeTM.ComputableInSpace (fun (x : α) => boundedSurfaceCard stackSize stateCount tapes (n x) (s x)) enc MultiTapeTM.encNat budget

Compute the exact surface count with a budget covering the radius and the binary input length. The tape count, state count and stack alphabet size are fixed.

theorem Turing.AuxPDA.boundedSurfaceStartIndex_inSpace {α : Type} {enc : α ↪ List Bool} {s budget : α → ℕ} (mStack mState k stateCode : ℕ) (hs : MultiTapeTM.ComputableInSpace s enc MultiTapeTM.encNat budget) (hRadius : MultiTapeTM.BigOLe s budget) :
MultiTapeTM.ComputableInSpace (fun (x : α) => boundedSurfaceStartIndex mStack mState k (s x) stateCode) enc MultiTapeTM.encNat budget

Compute the initial surface index within the budget of the window radius.

Framed binary encodings of the six surface digits.

theorem Turing.AuxPDA.encBoundedSurfaceDigits_mk_deg :
MultiTapeTM.ComputableInDegree (fun (p : ℕ × ℕ × ℕ × ℕ × ℕ × ℕ) => { inputPos := p.1, state := p.2.1, workPositions := p.2.2.1, workContents := p.2.2.2.1, top := p.2.2.2.2.1, output := p.2.2.2.2.2 }) encBoundedSurfaceDigitsFields encBoundedSurfaceDigits 1 1
theorem Turing.AuxPDA.encBoundedSurfaceDigits_workContents_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → BoundedSurfaceDigits} :
theorem Turing.AuxPDA.encBoundedSurfaceDigits_output_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → BoundedSurfaceDigits} :
MultiTapeTM.ComputableInSpace g✝ encIn✝ encBoundedSurfaceDigits S✝ → MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).output) encIn✝ MultiTapeTM.encNat S✝
theorem Turing.AuxPDA.encBoundedSurfaceDigits_top_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → BoundedSurfaceDigits} :
MultiTapeTM.ComputableInSpace g✝ encIn✝ encBoundedSurfaceDigits S✝ → MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).top) encIn✝ MultiTapeTM.encNat S✝
theorem Turing.AuxPDA.encBoundedSurfaceDigits_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget x0 x1 x2 x3 x4 x5 : γ → ℕ} (h0 : MultiTapeTM.ComputableInSpace x0 encIn MultiTapeTM.encNat budget) (h1 : MultiTapeTM.ComputableInSpace x1 encIn MultiTapeTM.encNat budget) (h2 : MultiTapeTM.ComputableInSpace x2 encIn MultiTapeTM.encNat budget) (h3 : MultiTapeTM.ComputableInSpace x3 encIn MultiTapeTM.encNat budget) (h4 : MultiTapeTM.ComputableInSpace x4 encIn MultiTapeTM.encNat budget) (h5 : MultiTapeTM.ComputableInSpace x5 encIn MultiTapeTM.encNat budget) :
MultiTapeTM.ComputableInSpace (fun (x : γ) => { inputPos := x0 x, state := x1 x, workPositions := x2 x, workContents := x3 x, top := x4 x, output := x5 x }) encIn encBoundedSurfaceDigits budget
theorem Turing.AuxPDA.encBoundedSurfaceDigits_state_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → BoundedSurfaceDigits} :
MultiTapeTM.ComputableInSpace g✝ encIn✝ encBoundedSurfaceDigits S✝ → MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).state) encIn✝ MultiTapeTM.encNat S✝
theorem Turing.AuxPDA.encBoundedSurfaceDigits_mk_polyTime {γ : Type} {encIn : γ ↪ List Bool} {x0 x1 x2 x3 x4 x5 : γ → ℕ} (h0 : MultiTapeTM.ComputableInPolyTime x0 encIn MultiTapeTM.encNat) (h1 : MultiTapeTM.ComputableInPolyTime x1 encIn MultiTapeTM.encNat) (h2 : MultiTapeTM.ComputableInPolyTime x2 encIn MultiTapeTM.encNat) (h3 : MultiTapeTM.ComputableInPolyTime x3 encIn MultiTapeTM.encNat) (h4 : MultiTapeTM.ComputableInPolyTime x4 encIn MultiTapeTM.encNat) (h5 : MultiTapeTM.ComputableInPolyTime x5 encIn MultiTapeTM.encNat) :
MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { inputPos := x0 x, state := x1 x, workPositions := x2 x, workContents := x3 x, top := x4 x, output := x5 x }) encIn encBoundedSurfaceDigits
theorem Turing.AuxPDA.encBoundedSurfaceDigits_workPositions_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → BoundedSurfaceDigits} :
theorem Turing.AuxPDA.encBoundedSurfaceDigits_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 x1 T1 S1 x2 T2 S2 x3 T3 S3 x4 T4 S4 x5 T5 S5 : γ → ℕ} (h0 : MultiTapeTM.ComputableInO x0 encIn MultiTapeTM.encNat T0 S0) (h1 : MultiTapeTM.ComputableInO x1 encIn MultiTapeTM.encNat T1 S1) (h2 : MultiTapeTM.ComputableInO x2 encIn MultiTapeTM.encNat T2 S2) (h3 : MultiTapeTM.ComputableInO x3 encIn MultiTapeTM.encNat T3 S3) (h4 : MultiTapeTM.ComputableInO x4 encIn MultiTapeTM.encNat T4 S4) (h5 : MultiTapeTM.ComputableInO x5 encIn MultiTapeTM.encNat T5 S5) :
MultiTapeTM.ComputableInO (fun (x : γ) => { inputPos := x0 x, state := x1 x, workPositions := x2 x, workContents := x3 x, top := x4 x, output := x5 x }) encIn encBoundedSurfaceDigits (fun (x : γ) => T0 x + (T1 x + (T2 x + (T3 x + (T4 x + T5 x))))) fun (x : γ) => S0 x + (S1 x + (S2 x + (S3 x + (S4 x + S5 x))))
theorem Turing.AuxPDA.encBoundedSurfaceDigits_inputPos_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → BoundedSurfaceDigits} :
theorem Turing.AuxPDA.boundedSurfaceDigits_inSpace {α : Type} {enc : α ↪ List Bool} {s index budget : α → ℕ} (stackSize stateCount tapes : ℕ) (hi : MultiTapeTM.ComputableInSpace index enc MultiTapeTM.encNat budget) (hs : MultiTapeTM.ComputableInSpace s enc MultiTapeTM.encNat budget) (hRadius : MultiTapeTM.BigOLe s budget) :
MultiTapeTM.ComputableInSpace (fun (x : α) => boundedSurfaceDigits stackSize stateCount tapes (s x) (index x)) enc encBoundedSurfaceDigits budget

Decode a binary surface ID within a budget covering the ID and the window radius.

def Turing.AuxPDA.boundedSurfaceInputSymbol (mStack mState k s index : ℕ) (input : List Bool) :

Read the original input at the head position stored in a numbered bounded surface.

theorem Turing.AuxPDA.boundedSurfaceInputSymbol_eq {k mStack mState : ℕ} {StackSym : Type u_1} {State : Type u_2} {input : List Bool} {s : ℕ} (u : BoundedSurfaceCfg k StackSym State input s) (eStack : StackSym ≃ Fin mStack) (eState : State ≃ Fin mState) :
boundedSurfaceInputSymbol mStack mState k s (↑((boundedSurfaceEquivFin eStack eState input s) u)) input = u.inputSymbol

Reading the original input through a valid surface ID agrees with the native input head.

theorem Turing.AuxPDA.boundedSurfaceInputSymbol_inSpace {α ρ : Type} {encA : α ↪ List Bool} {encR : ρ ↪ List Bool} {s index budget : ρ × α → ℕ} (mStack mState k : ℕ) (hContext : MultiTapeTM.ComputableInSpace.CoversContext encR encA budget) (hi : MultiTapeTM.ComputableInSpace index (MultiTapeTM.encPair encR encA) MultiTapeTM.encNat budget) (hs : MultiTapeTM.ComputableInSpace s (MultiTapeTM.encPair encR encA) MultiTapeTM.encNat budget) (hRadius : MultiTapeTM.BigOLe s budget) :
MultiTapeTM.ComputableInSpace (fun (p : ρ × α) => boundedSurfaceInputSymbol mStack mState k (s p) (index p) (encA p.2)) (MultiTapeTM.encPair encR encA) (MultiTapeTM.encOption MultiTapeTM.encBool) budget

A numbered surface reads the original input within the workspace for its stored ID.

theorem Turing.AuxPDA.boundedSurfaceDigits_acceptsEmpty_inSpace {α : Type} {enc : α ↪ List Bool} {s index budget : α → ℕ} (stackSize stateCount tapes : ℕ) (hi : MultiTapeTM.ComputableInSpace index enc MultiTapeTM.encNat budget) (hs : MultiTapeTM.ComputableInSpace s enc MultiTapeTM.encNat budget) (hRadius : MultiTapeTM.BigOLe s budget) :
MultiTapeTM.ComputableInSpace (fun (x : α) => (boundedSurfaceDigits stackSize stateCount tapes (s x) (index x)).acceptsEmpty) enc MultiTapeTM.encBool budget

Recognize an accepting empty-stack surface from its binary ID within the decoder's budget.

theorem Turing.AuxPDA.BoundedSurfaceDigits.workHead_inSpace {α : Type} {enc : α ↪ List Bool} {d : α → BoundedSurfaceDigits} {s budget : α → ℕ} {k : ℕ} (i : Fin k) (hd : MultiTapeTM.ComputableInSpace d enc encBoundedSurfaceDigits budget) (hs : MultiTapeTM.ComputableInSpace s enc MultiTapeTM.encNat budget) :
MultiTapeTM.ComputableInSpace (fun (x : α) => (d x).workHead k (s x) ↑i) enc MultiTapeTM.encNat budget

Read a selected work-head offset within the supplied workspace budget.

theorem Turing.AuxPDA.BoundedSurfaceDigits.workSymbol_inSpace {α : Type} {enc : α ↪ List Bool} {d : α → BoundedSurfaceDigits} {s budget : α → ℕ} {k : ℕ} (i : Fin k) (hd : MultiTapeTM.ComputableInSpace d enc encBoundedSurfaceDigits budget) (hs : MultiTapeTM.ComputableInSpace s enc MultiTapeTM.encNat budget) (hRadius : MultiTapeTM.BigOLe s budget) :
MultiTapeTM.ComputableInSpace (fun (x : α) => (d x).workSymbol k (s x) ↑i) enc MultiTapeTM.encNat budget

Read a selected work symbol within the supplied workspace budget. Only powers whose exponent is bounded by the window width are used to extract the ternary digit.

theorem Turing.AuxPDA.BoundedSurfaceDigits.writtenWorkTapeWord_inSpace {α : Type} {enc : α ↪ List Bool} {d : α → BoundedSurfaceDigits} {s value budget : α → ℕ} {k : ℕ} (i : Fin k) (hd : MultiTapeTM.ComputableInSpace d enc encBoundedSurfaceDigits budget) (hs : MultiTapeTM.ComputableInSpace s enc MultiTapeTM.encNat budget) (hRadius : MultiTapeTM.BigOLe s budget) (hv : MultiTapeTM.ComputableInSpace value enc MultiTapeTM.encNat budget) :
MultiTapeTM.ComputableInSpace (fun (x : α) => (d x).writtenWorkTapeWord k (s x) (↑i) (value x)) enc MultiTapeTM.encNat budget

Compute the selected work tape's ternary word after a write within the supplied budget.

theorem Turing.AuxPDA.BoundedSurfaceDigits.matchesWorkTape_inSpace {α : Type} {enc : α ↪ List Bool} {before after : α → BoundedSurfaceDigits} {s budget : α → ℕ} {k : ℕ} (i : Fin k) (write : Option (Option Bool)) (step : SignType) (hb : MultiTapeTM.ComputableInSpace before enc encBoundedSurfaceDigits budget) (ha : MultiTapeTM.ComputableInSpace after enc encBoundedSurfaceDigits budget) (hs : MultiTapeTM.ComputableInSpace s enc MultiTapeTM.encNat budget) (hRadius : MultiTapeTM.BigOLe s budget) :
MultiTapeTM.ComputableInSpace (fun (x : α) => (before x).matchesWorkTape (after x) k (s x) (↑i) write step) enc MultiTapeTM.encBool budget

Test a fixed work-tape action against two decoded surface IDs within the same workspace.

theorem Turing.AuxPDA.BoundedSurfaceDigits.matchesObservation_inSpace {α : Type} {enc : α ↪ List Bool} {d : α → BoundedSurfaceDigits} {s budget : α → ℕ} {k mStack mState : ℕ} {StackSym : Type u_1} {State : Type u_2} (state : State) (top : Option StackSym) (work : Fin k → Option Bool) (eStack : StackSym ≃ Fin mStack) (eState : State ≃ Fin mState) (hd : MultiTapeTM.ComputableInSpace d enc encBoundedSurfaceDigits budget) (hs : MultiTapeTM.ComputableInSpace s enc MultiTapeTM.encNat budget) (hRadius : MultiTapeTM.BigOLe s budget) :
MultiTapeTM.ComputableInSpace (fun (x : α) => (d x).matchesObservation (s x) state top work eStack eState) enc MultiTapeTM.encBool budget

Check a fixed transition's required observation within the supplied workspace.

theorem Turing.AuxPDA.BoundedSurfaceDigits.matchesTapeAction_inSpace {α : Type} {enc : α ↪ List Bool} {before after : α → BoundedSurfaceDigits} {n s budget : α → ℕ} {k mStack mState : ℕ} {StackSym : Type u_1} {State : Type u_2} (act : Turing.Action k Bool State) (newTop : Option StackSym) (eStack : StackSym ≃ Fin mStack) (eState : State ≃ Fin mState) (hb : MultiTapeTM.ComputableInSpace before enc encBoundedSurfaceDigits budget) (ha : MultiTapeTM.ComputableInSpace after enc encBoundedSurfaceDigits budget) (hn : MultiTapeTM.ComputableInSpace n enc MultiTapeTM.encNat budget) (hs : MultiTapeTM.ComputableInSpace s enc MultiTapeTM.encNat budget) (hRadius : MultiTapeTM.BigOLe s budget) :
MultiTapeTM.ComputableInSpace (fun (x : α) => (before x).matchesTapeAction (after x) (n x) (s x) act newTop eStack eState) enc MultiTapeTM.encBool budget

Test a fixed tape action and destination stack top within the same workspace budget.

noncomputable def Turing.AuxPDA.boundedStayWithSymbol {k mStack mState : ℕ} {StackSym State : Type} [Fintype StackSym] [Fintype State] (eStack : StackSym ≃ Fin mStack) (eState : State ≃ Fin mState) (M : AuxPDA k Bool StackSym State) (n s u v : ℕ) (symbol : Option Bool) :

Test a stay edge between numbered surfaces using the symbol read at the source input head.

theorem Turing.AuxPDA.boundedStayWithSymbol_eq_true {k mStack mState : ℕ} {StackSym State : Type} [Fintype StackSym] [Fintype State] (eStack : StackSym ≃ Fin mStack) (eState : State ≃ Fin mState) (M : AuxPDA k Bool StackSym State) {input : List Bool} {s : ℕ} (u v : BoundedSurfaceCfg k StackSym State input s) :
boundedStayWithSymbol eStack eState M input.length s (↑((boundedSurfaceEquivFin eStack eState input s) u)) (↑((boundedSurfaceEquivFin eStack eState input s) v)) u.inputSymbol = true ↔ M.BoundedStayStep u v

The query recognizes exactly a stay edge, including the halted self-loop.

noncomputable def Turing.AuxPDA.boundedPushPopWithSymbols {k mStack mState : ℕ} {StackSym State : Type} [Fintype StackSym] [Fintype State] (eStack : StackSym ≃ Fin mStack) (eState : State ≃ Fin mState) (M : AuxPDA k Bool StackSym State) (n s u u' v' v : ℕ) (pushSymbol popSymbol : Option Bool) :

Test a matched push-pop edge using the symbols read at the push and pop source heads.

theorem Turing.AuxPDA.boundedPushPopWithSymbols_eq_true {k mStack mState : ℕ} {StackSym State : Type} [Fintype StackSym] [Fintype State] (eStack : StackSym ≃ Fin mStack) (eState : State ≃ Fin mState) (M : AuxPDA k Bool StackSym State) {input : List Bool} {s : ℕ} (u u' v' v : BoundedSurfaceCfg k StackSym State input s) :
boundedPushPopWithSymbols eStack eState M input.length s (↑((boundedSurfaceEquivFin eStack eState input s) u)) (↑((boundedSurfaceEquivFin eStack eState input s) u')) (↑((boundedSurfaceEquivFin eStack eState input s) v')) (↑((boundedSurfaceEquivFin eStack eState input s) v)) u.inputSymbol v'.inputSymbol = true ↔ M.BoundedPushPopStep u u' v' v

The push and pop use the same pushed symbol and restore the original top of the stack.

theorem Turing.AuxPDA.boundedStayWithSymbol_inSpace {k mStack mState : ℕ} {StackSym State : Type} [Fintype StackSym] [Fintype State] (eStack : StackSym ≃ Fin mStack) (eState : State ≃ Fin mState) {α : Type} {enc : α ↪ List Bool} {n s u v budget : α → ℕ} {symbol : α → Option Bool} (M : AuxPDA k Bool StackSym State) (hn : MultiTapeTM.ComputableInSpace n enc MultiTapeTM.encNat budget) (hs : MultiTapeTM.ComputableInSpace s enc MultiTapeTM.encNat budget) (hRadius : MultiTapeTM.BigOLe s budget) (hu : MultiTapeTM.ComputableInSpace u enc MultiTapeTM.encNat budget) (hv : MultiTapeTM.ComputableInSpace v enc MultiTapeTM.encNat budget) (hSymbol : MultiTapeTM.ComputableInSpace symbol enc (MultiTapeTM.encOption MultiTapeTM.encBool) budget) :
MultiTapeTM.ComputableInSpace (fun (x : α) => boundedStayWithSymbol eStack eState M (n x) (s x) (u x) (v x) (symbol x)) enc MultiTapeTM.encBool budget

The numbered stay-edge query preserves the common budget of the indices and input symbol.

theorem Turing.AuxPDA.boundedPushPopWithSymbols_inSpace {k mStack mState : ℕ} {StackSym State : Type} [Fintype StackSym] [Fintype State] (eStack : StackSym ≃ Fin mStack) (eState : State ≃ Fin mState) {α : Type} {enc : α ↪ List Bool} {n s u u' v' v budget : α → ℕ} {pushSymbol popSymbol : α → Option Bool} (M : AuxPDA k Bool StackSym State) (hn : MultiTapeTM.ComputableInSpace n enc MultiTapeTM.encNat budget) (hs : MultiTapeTM.ComputableInSpace s enc MultiTapeTM.encNat budget) (hRadius : MultiTapeTM.BigOLe s budget) (hu : MultiTapeTM.ComputableInSpace u enc MultiTapeTM.encNat budget) (hu' : MultiTapeTM.ComputableInSpace u' enc MultiTapeTM.encNat budget) (hv' : MultiTapeTM.ComputableInSpace v' enc MultiTapeTM.encNat budget) (hv : MultiTapeTM.ComputableInSpace v enc MultiTapeTM.encNat budget) (hPush : MultiTapeTM.ComputableInSpace pushSymbol enc (MultiTapeTM.encOption MultiTapeTM.encBool) budget) (hPop : MultiTapeTM.ComputableInSpace popSymbol enc (MultiTapeTM.encOption MultiTapeTM.encBool) budget) :
MultiTapeTM.ComputableInSpace (fun (x : α) => boundedPushPopWithSymbols eStack eState M (n x) (s x) (u x) (u' x) (v' x) (v x) (pushSymbol x) (popSymbol x)) enc MultiTapeTM.encBool budget

Both halves of the numbered push-pop query preserve the common workspace budget.