The input-tape routines #
copyUnary, copyInputBits, checkLen and buildAnswer read an input tape from its
head to the blank after the input, writing on a work tape; their specifications are by
induction on the remaining suffix of the input.
theorem
MIPRE.TM.Interp.WEff.single
{input : Fin 7 → List Sym}
{t : WT}
{c c' : Cfg input}
{s : Sym}
(htape : c'.workTapes t = Function.update (c.workTapes t) (c.workTapePos t) (some s))
(hpos : c'.workTapePos t = c.workTapePos t + 1)
:
copyUnary #
copyInputBits #
checkLen #
theorem
MIPRE.TM.Interp.exec_checkLen
{input : Fin 7 → List Sym}
{k : ProgId}
{pc : Fin maxPc}
{j ref : IT}
(hins : instrAt k pc = Instr.checkLen j ref)
(hpc : ↑pc + 1 < maxPc)
(hjr : j ≠ ref)
(m : ℕ)
(c : Cfg input)
(q : ℕ)
:
c.state = at_ k pc →
↑(c.inputPos j) = q + 1 →
↑(c.inputPos ref) = q + 1 →
(input j).length = q + m →
q + m ≤ (input ref).length →
∃ (c' : Cfg input),
Reach c (m + 1) c' [] ∧ c'.state = next_ k pc hpc ∧ Untouched c c' [j, ref] [] ∧ ↑(c'.inputPos j) = (input j).length + 1 ∧ ↑(c'.inputPos ref) = (input j).length + 1
From position q + 1 on both j and ref, with |j| - q ≤ |ref| - q: both heads advance
to the end of j.
buildAnswer #
The bit of an input symbol.
Instances For
The written form of an answer suffix: S(encode (l.map boolOf)).
Equations
Instances For
theorem
MIPRE.TM.Interp.exec_buildAnswer
{input : Fin 7 → List Sym}
{k : ProgId}
{pc : Fin maxPc}
{j : IT}
{dst : WT}
(hins : instrAt k pc = Instr.buildAnswer j dst)
(hpc : ↑pc + 1 < maxPc)
(hbits : ∀ s ∈ input j, s = Sym.zero ∨ s = Sym.one)
(m : ℕ)
(c : Cfg input)
(q : ℕ)
:
From position q + 1 of a bit input j: S(encode) of the remaining bits.