Bounded Turing-machine configurations in RAM registers #
This file fixes the register representation used by the Turing-machine to RAM
simulation. Register zero stores the finite-state code, the next n + 2
registers store the input/work/output head positions, and the remaining
registers store a dense bounded window of every named tape.
Blank symbols use code zero. Consequently registers outside the representation and blank cells inside it agree with the RAM's finite-support convention.
A field in a bounded configuration: state, a named tape head, or a named
tape cell. Named tapes use input/work/output indices 0, 1..n, n+1.
Equations
Instances For
Explicit contiguous ordering of all fields in the bounded representation.
Equations
- Complexity.RAM.TMConfig.fieldEquiv n bound = ((Equiv.refl (Fin 1)).sumCongr (((Equiv.refl (Fin (n + 2))).sumCongr finProdFinEquiv).trans finSumFinEquiv)).trans finSumFinEquiv
Instances For
The field holding the Turing-machine state.
Equations
Instances For
The field holding one named tape's head position.
Equations
- Complexity.RAM.TMConfig.headField tape = Sum.inr (Sum.inl tape)
Instances For
Concrete register address of a bounded-configuration field.
Equations
- Complexity.RAM.TMConfig.fieldReg field = ↑((Complexity.RAM.TMConfig.fieldEquiv n bound) field)
Instances For
Code the tape alphabet with blank represented by zero.
Equations
Instances For
Decode a RAM word as a tape symbol; invalid words decode to blank.
Equations
Instances For
Canonical numeric code of a finite Turing-machine state.
Equations
- Complexity.RAM.TMConfig.stateCode tm state = ↑((Fintype.equivFin tm.Q) state)
Instances For
Decode a valid state code, using the start state as the default for an invalid RAM word.
Equations
- Complexity.RAM.TMConfig.stateDecode tm code = if h : code < Fintype.card tm.Q then (Fintype.equivFin tm.Q).symm ⟨code, h⟩ else tm.qstart
Instances For
Select a named tape by its input/work/output index.
Equations
Instances For
A tape is contained in the encoded window when every later cell is blank.
Equations
- Complexity.RAM.TMConfig.TapeBounded tape bound = ∀ (position : ℕ), bound < position → tape.cells position = Complexity.Γ.blank
Instances For
Every named tape in a configuration is contained in the encoded window.
Equations
- Complexity.RAM.TMConfig.Bounded cfg bound = ∀ (tape : Fin (n + 2)), Complexity.RAM.TMConfig.TapeBounded (Complexity.RAM.TMConfig.tapeAt cfg tape) bound
Instances For
Every named head lies inside the encoded cell window.
Equations
- Complexity.RAM.TMConfig.HeadsBounded cfg bound = ∀ (tape : Fin (n + 2)), (Complexity.RAM.TMConfig.tapeAt cfg tape).head ≤ bound
Instances For
A configuration can be stepped inside a bounded representation when both its nonblank cells and every named head lie in the represented window.
Equations
- Complexity.RAM.TMConfig.WithinWindow cfg bound = (Complexity.RAM.TMConfig.Bounded cfg bound ∧ Complexity.RAM.TMConfig.HeadsBounded cfg bound)
Instances For
Natural-number value stored for one representation field.
Equations
- Complexity.RAM.TMConfig.fieldValue tm bound cfg (Sum.inl val) = Complexity.RAM.TMConfig.stateCode tm cfg.state
- Complexity.RAM.TMConfig.fieldValue tm bound cfg (Sum.inr (Sum.inl tape)) = (Complexity.RAM.TMConfig.tapeAt cfg tape).head
- Complexity.RAM.TMConfig.fieldValue tm bound cfg (Sum.inr (Sum.inr (tape, position))) = Complexity.RAM.TMConfig.symbolCode ((Complexity.RAM.TMConfig.tapeAt cfg tape).cells ↑position)
Instances For
Register store containing a bounded Turing-machine configuration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A RAM store represents a bounded TM configuration when every state/head/cell field has its prescribed value. Scratch registers outside this interface are deliberately unconstrained, allowing successive simulation blocks to compose.
Equations
- One or more equations did not get rendered due to their size.
Instances For
RAM configuration positioned at the beginning of a simulation block.
Equations
- Complexity.RAM.TMConfig.encode tm bound cfg = { pc := 0, regs := Complexity.RAM.TMConfig.encodeRegs tm bound cfg }
Instances For
Decode a bounded register layout into a Turing-machine configuration.
Equations
- One or more equations did not get rendered due to their size.