Match-loop ↔ lookup correspondence (pure list level) #
The body machine's key scan accepts a desc-tape segment exactly when the
abstract table lookup (TMDesc.lookup) would select the entry parsed from
that segment. This file proves the correspondence at the pure list level —
no machine steps (design appendix 2):
keyCells/keyCells_get— the six expected key-symbol cells ofBody.keyCell, as aΓwlist;MachMatch— the machine's segment-acceptance predicate (state-field prefix, six key cells, and full value length);machMatch_iff_parse— on a□-free segment,MachMatchholds iff the segment parses (parseEntry) with exactly the sought key;machFind+machFind_some_find?/machFind_none_find?/firstMatch_lookup/noMatch_lookup— the machine's first matching segment in thetakeFieldsplit is thefind?hit ofparseEntries, so its action is exactlyTMDesc.lookup's result (and no match ⟺ the default action);value_slices— the matched segment's value cells decode (viacellBit/grpΓw/grpDir, the machine's decoders) to the parsed entry's action fields.
bitsToSyms is injective.
bitsToSyms commutes with take.
bitsToSyms commutes with drop.
keyCells read as Γ cells is exactly keyCell 0 .. keyCell 5.
The machine's segment-acceptance predicate: the segment starts with
the state-tape symbols (cmpQ's lockstep compare), followed by the six
expected key cells (cmpS), and is long enough for the full value copy
(copyQ'/copyAct find no early □ — on the □-free segments
takeField produces, length is exactly that condition).
Equations
Instances For
Equations
- Complexity.TM.UTMBody.instDecidableMachMatch w stSyms keyCs seg = id inferInstance
The parse bridge: on a □-free segment, the machine's acceptance
predicate (state field = the w-bit encoding of q, six key cells =
keyCells of the simulated reads, full value length) holds iff the
segment parses to an entry whose key is exactly (q, simRead …).
The machine's segment walk at the list level: the first segment of the
takeField split that satisfies MachMatch, stopping (like
parseEntries) at the first empty segment.
Equations
- One or more equations did not get rendered due to their size.
- Complexity.TM.UTMBody.machFind w stSyms keyCs [] = none
- Complexity.TM.UTMBody.machFind w stSyms keyCs (Complexity.Γw.blank :: tail) = none
Instances For
TMDesc.lookup in terms of keyMatch.
The first-match correspondence, combined form: the find? hit of
the parsed table is exactly the parse of the machine's first
MachMatch-ing segment.
(a) The machine's first hit is the lookup's first hit: if the
machine's segment walk accepts seg, then seg parses to an entry e,
and e is exactly the table's find? hit for the sought key.
(b) No machine hit ⟺ no lookup hit: if the machine's segment walk
rejects every segment, the table's find? misses.
First-match ⇒ lookup: the action of the entry parsed from the
machine's first MachMatch-ing segment is exactly what TMDesc.lookup
returns on the table parsed from the same entry region.
No match ⇒ default: if the machine's segment walk rejects every
segment, TMDesc.lookup on the parsed table falls to the default
action.
The bit value the machine decodes from desc-segment cell i
(out-of-range reads default to □, i.e. false; the machine reads the
cell as Γ and applies cellBit).
Equations
Instances For
The value decode bridge: on a □-free segment that parses to e,
the value cells decode to e.act exactly as the machine reads them —
the w-cell state field at offset w+6 is the bit-symbol encoding of
e.act.q', and the five 2-cell groups at offsets 2w+6 .. 2w+14
decode via grpΓw/grpDir of the cellBit cell reads to
ww/wo/di/dw/dOut.