Mixed-record frame transport tactic #
Word-RAM proofs routinely package persistent state predicates as a Prop-valued structure
(such as ImpFrame, KargerFrame, or Schoening.Frame) or a Prop-valued conjunction
definition (such as HeaderConstsRep, TableSlotsRep, KeysValsRep, or Instances.Output)
mixing register equations, memory equations, Block.Realizes / Block.HoldsList views,
quantified cell invariants, and state-independent bounds (≤, Nodup, Fits).
When a state y steps to a later state z (through Data.set / Data.write / Data.havoc
updates, equalities z.regs = y.regs / z.mem = y.mem, execution frames, Modifies, Set.EqOn,
or quantified memory frames ∀ a, P a → z.mem a = y.mem a), transporting h : S … y to S … z
otherwise requires a hand-written .congr / .reframe theorem and per-file macro for every
record type.
struct_frame pairs each leaf field of the goal S … z 1-to-1 with the matching field of
h : S … y and closes:
- unchanged (
isDefEq) orrflfields (Nodup,Fits, bounds, self-frame tail); - register equations, using
regs_frame(RegsFrame.tryProve) orwram_simp/hregs; Block.Realizes,Block.HoldsList, andHeapAssertion.holdsfields, usingram_keepagainst local updates,Modifies,Set.EqOn, or quantified memory frames;- memory equations
m' a = vand quantified invariants∀ x, P x → …(including transparent wrapper predicates such asPartialAtor nested readss k = some (m' a)), usingmem_frame(MemFrame.tryProve) and direct frame rewriting (discharging index bounds withomega,decide, and silent@[wram_arith]unfolding, automatically supplyingFin.isLtand non-state bounds fromh).
Any field whose nonlinear arithmetic side condition cannot be discharged automatically is left
as a focused subgoal with h's corresponding field already introduced so the proof only has to
supply the missing bound.
Main definitions #
struct_frame: the tactic (struct_frameorstruct_frame h).
struct_frame transports a Prop-valued structure or conjunction predicate from a prior
state hypothesis h : S … y to the goal S … z by pairing fields 1-to-1:
- unchanged (
isDefEq) andrflfields (Nodup,Fits, bounds, self-frames) close immediately; - register equations transfer through
regs_frame,wram_simp, orz.regs = y.regs; Block.Realizes,Block.HoldsList, andHeapAssertion.holdstransfer throughram_keepagainstData.writeupdates,Modifies,Set.EqOn, or quantified memory frames;- memory equations and quantified invariants (including transparent wrappers such as
PartialAtand nested readss k = some (z.mem a)) transfer throughmem_frameand local memory-frame rewriting, checking arithmetic side conditions withomega,decide, and silent@[wram_arith]unfolding.
With no argument, struct_frame uses the most recent hypothesis with the same head constant as
the goal. Any field that cannot be discharged automatically is left as a focused subgoal with a
local hprev hypothesis holding the corresponding field of h.