The RTL consumes 32-bit instruction words. The ISA proof layer consumes
decoded instructions. This chapter starts the bridge by defining the encoded
instruction object, the bit layout, the decoder, and the field-roundtrip
theorem that says every encoded field is recovered exactly.
The low sixteen bits are deliberately raw bits. li and blz interpret them
as signed two's-complement immediates; local pointer instructions interpret
the same bits as an unsigned local address.
The encoder is ordinary arithmetic over a natural number before the final
32-bit wrap. The next theorem is the guard: all encoded Honeycomb instruction words
fit in 32 bits, so the final BitVec.ofNat does not lose information.
Field extraction is then a checked arithmetic theorem. This is the base lemma
for the next refinement step, where the decoded instruction at the RTL pc
will be connected to the ISA-level DecodedInstr.toInstr.
The final roundtrip theorem composes those field facts with the decoder:
encoding and then decoding an instruction word returns the same encoded
instruction object, and therefore the same decoded ISA instruction.
The word-memory bridge then lifts the single-word theorem to program memory:
if the program memory is generated by the Lean encoder, fetching and decoding
the word at pc produces exactly the DecodedInstr consumed by the execute
refinement theorem.