Calls that keep the registers a routine does not write #
wram_call spec with y post continues from a routine's contract with data y about which only
the contract's conclusion is known. A register the routine never writes keeps its contents
(Cslib.WordRAM.ExecWithin.regs_eq), but the continuation does not see that: every contract
restates the registers its caller still needs, and every caller passes them on by hand.
x.havoc c v m is the data reached from x by a run of c about which nothing else is known:
the registers c does not write hold what they hold in x, the others hold v, and memory is
m. Every run of c from x ends in such data (Cslib.WordRAM.ExecWithin.eq_havoc). Reading a
register of it is decided by evaluating c.Preserves i, so wram_exec and wram_simp reduce a
read of an unwritten register to the read in x, and through the earlier writes to its value,
with the simp set they already use.
wram_call spec framed with v m post is wram_call with the data reached in this form
(Cslib.WordRAM.WP.of_spec_havoc). The contract may leave its hypotheses out, as in
wram_call (routine_spec a b ..) framed with v m post: each is simplified with wram_simp and
the given lemmas and proved by a hypothesis, by fits or by omega, and those that remain
follow the continuation as goals. The contract's conclusion is simplified in the same way
before post names its parts, so that it speaks of v, m and the caller's data.
Main definitions #
Cslib.WordRAM.Data.havoc: the data after a run of a program, with the registers it does not write kept.wram_call … framed with v m post: continue from a contract, keeping those registers.
Main results #
Cslib.WordRAM.ExecWithin.eq_havoc: a run ofcfromxends inx.havoc c v m.Cslib.WordRAM.WP.of_spec_havoc: the rule of the framed call.
A run of c from x ends in x.havoc c v m, for the registers and memory reached.
Continue from a routine's contract at its instruction allowance. The data reached is the caller's with the registers the routine writes, and memory, replaced.
Apply a fixed-time, direct, or time-indexed routine contract and expose its continuation. Only bank-view projections are normalized; the callee program remains closed.
Extensions:
Direct
wram_call hwithoutwith(for bareExecWithin/Execcontracts), optional hint lemmas[h₁, …], andrenamedbank forms.Apply a routine contract and keep the registers the routine does not write: the data reached is the caller's data
xwith the registers the routine writes replaced byvand memory bym(x.havoc c v m), sowram_execandwram_simpreduce later reads of the other registers to their values inx. Hypotheses the contract leaves out, as in(routine_spec a b ..), are simplified withwram_simpand the given lemmas and proved by a hypothesis, up to reducible unfolding, or byfitsoromega; those that remain follow the continuation. The contract's conclusion is simplified in the same way before the patterns aftervandmname its parts.