The interpreter machine #
U is the multi-input Turing machine interpreting the programs of Instr.lean: a state is
a program, a position in it and the phase of the instruction there (Ctl), and one step
executes one phase of the current instruction (execInstr), producing head moves, writes,
an optional output symbol and the next control: the same instruction in another phase,
the next instruction, a jump to the start of another program, or a halt.
The instructions' semantics, phase by phase, is documented on execInstr; their
specifications as reachability triples are in Routines.lean.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The semantics of an instruction phase, given the symbols under the input heads as
and the work heads bs.
Equations
- One or more equations did not get rendered due to their size.
- MIPRE.TM.Interp.execInstr (MIPRE.TM.Interp.Instr.copyTree src dst ch) ph as bs = MIPRE.TM.Interp.Act.base MIPRE.TM.Interp.Next.halt
- MIPRE.TM.Interp.execInstr (MIPRE.TM.Interp.Instr.write t s) ph as bs = ((MIPRE.TM.Interp.Act.base MIPRE.TM.Interp.Next.adv).ww t (some s)).mw t 1
- MIPRE.TM.Interp.execInstr (MIPRE.TM.Interp.Instr.move t dir) ph as bs = (MIPRE.TM.Interp.Act.base MIPRE.TM.Interp.Next.adv).mw t (if dir = true then 1 else -1)
- MIPRE.TM.Interp.execInstr (MIPRE.TM.Interp.Instr.rewind t) MIPRE.TM.Interp.Phase.p0 as bs = (MIPRE.TM.Interp.Act.base (MIPRE.TM.Interp.Next.stay MIPRE.TM.Interp.Phase.p1)).mw t (-1)
- MIPRE.TM.Interp.execInstr (MIPRE.TM.Interp.Instr.leftToMarker m t) MIPRE.TM.Interp.Phase.p0 as bs = (MIPRE.TM.Interp.Act.base (MIPRE.TM.Interp.Next.stay MIPRE.TM.Interp.Phase.p1)).mw t (-1)
- MIPRE.TM.Interp.execInstr (MIPRE.TM.Interp.Instr.popBack m t) MIPRE.TM.Interp.Phase.p0 as bs = (MIPRE.TM.Interp.Act.base (MIPRE.TM.Interp.Next.stay MIPRE.TM.Interp.Phase.p1)).mw t (-1)
- MIPRE.TM.Interp.execInstr MIPRE.TM.Interp.Instr.getEnv MIPRE.TM.Interp.Phase.p0 as bs = (MIPRE.TM.Interp.Act.base (MIPRE.TM.Interp.Next.stay MIPRE.TM.Interp.Phase.p1)).mw MIPRE.TM.Interp.E (-1)
- MIPRE.TM.Interp.execInstr MIPRE.TM.Interp.Instr.getEnv MIPRE.TM.Interp.Phase.p2 as bs = (MIPRE.TM.Interp.Act.base (MIPRE.TM.Interp.Next.stay MIPRE.TM.Interp.Phase.p3)).mw MIPRE.TM.Interp.C 1
- MIPRE.TM.Interp.execInstr MIPRE.TM.Interp.Instr.getEnv MIPRE.TM.Interp.Phase.p7 as bs = (MIPRE.TM.Interp.Act.base (MIPRE.TM.Interp.Next.stay MIPRE.TM.Interp.Phase.p6)).mw MIPRE.TM.Interp.C 1
- MIPRE.TM.Interp.execInstr (MIPRE.TM.Interp.Instr.jump target) ph as bs = MIPRE.TM.Interp.Act.base (MIPRE.TM.Interp.Next.jmp target)
- MIPRE.TM.Interp.execInstr (MIPRE.TM.Interp.Instr.emit s) ph as bs = (MIPRE.TM.Interp.Act.base MIPRE.TM.Interp.Next.adv).emit s
- MIPRE.TM.Interp.execInstr MIPRE.TM.Interp.Instr.halt ph as bs = MIPRE.TM.Interp.Act.base MIPRE.TM.Interp.Next.halt
- MIPRE.TM.Interp.execInstr (MIPRE.TM.Interp.Instr.rewindInput j) MIPRE.TM.Interp.Phase.p0 as bs = (MIPRE.TM.Interp.Act.base (MIPRE.TM.Interp.Next.stay MIPRE.TM.Interp.Phase.p1)).mi j (-1)
- MIPRE.TM.Interp.execInstr (MIPRE.TM.Interp.Instr.moveInput j dir) ph as bs = (MIPRE.TM.Interp.Act.base MIPRE.TM.Interp.Next.adv).mi j (if dir = true then 1 else -1)
Instances For
The instruction at a position of a program (halt past the end).
Equations
- MIPRE.TM.Interp.instrAt k pc = (MIPRE.TM.Interp.prog k).getD (↑pc) MIPRE.TM.Interp.Instr.halt
Instances For
The control after a step.
Equations
- MIPRE.TM.Interp.resolve k pc (MIPRE.TM.Interp.Next.stay ph) = some { k := k, pc := pc, ph := ph }
- MIPRE.TM.Interp.resolve k pc MIPRE.TM.Interp.Next.adv = if h : ↑pc + 1 < MIPRE.TM.Interp.maxPc then some { k := k, pc := ⟨↑pc + 1, h⟩, ph := MIPRE.TM.Interp.Phase.p0 } else none
- MIPRE.TM.Interp.resolve k pc (MIPRE.TM.Interp.Next.jmp k') = some { k := k', pc := ⟨0, MIPRE.TM.Interp.resolve._proof_3⟩, ph := MIPRE.TM.Interp.Phase.p0 }
- MIPRE.TM.Interp.resolve k pc MIPRE.TM.Interp.Next.halt = none
Instances For
The interpreter machine.
Equations
- One or more equations did not get rendered due to their size.