Theorem W, stage B1: the framework #
- Arrays whose entries all satisfy a predicate, across
modify,push,set!andsetX. - Updates of single fields of a core keep
WB Kwhen the new values are below2^K. HT K P0 m Q: a Hoare triple for the stored-value bound at fixed parametersP0. From every state withWB Kand parametersP0, every run ofm(normal, or ended by an error) ends in such a state, and a normal result satisfiesQ. Reads return bounded values (the result predicate ofgetisWB Kitself), so a value read from the state and written back is bounded without any invariant (class R ofdocs/WORD.md§2). The tactichtdecomposes a computation into its primitive updates, likepres.
Values that need more than WB (labels: the guards and LabRoom; sizes: the cost invariants;
fresh indices: the record counts) appear as hypotheses of the lemmas that write them.
Arrays whose entries satisfy a predicate #
Single-field updates #
Reading the bound back.
Reads, in apply form (for the tactic vb) #
Close v < 2 ^ K for a value read from a good state, a bounded argument, or 0.
Equations
- OrderMaintenance.Proof.Word.tacticVb = Lean.ParserDescr.node `OrderMaintenance.Proof.Word.tacticVb 1024 (Lean.ParserDescr.nonReservedSymbol "vb" false)
Instances For
A record bound after an update with bounded values: unfold, split, and close each field.
Equations
- OrderMaintenance.Proof.Word.tacticRecb = Lean.ParserDescr.node `OrderMaintenance.Proof.Word.tacticRecb 1024 (Lean.ParserDescr.nonReservedSymbol "recb" false)
Instances For
Close the changed components left by wbx: arrays written with setX, modify, push or
set!, records updated with bounded values, and values.
Equations
- OrderMaintenance.Proof.Word.tacticWbv = Lean.ParserDescr.node `OrderMaintenance.Proof.Word.tacticWbv 1024 (Lean.ParserDescr.nonReservedSymbol "wbv" false)
Instances For
Records #
Unfold the record bounds into plain inequalities (for omega).
Equations
- OrderMaintenance.Proof.Word.tacticBnd = Lean.ParserDescr.node `OrderMaintenance.Proof.Word.tacticBnd 1024 (Lean.ParserDescr.nonReservedSymbol "bnd" false)
Instances For
The Hoare triple #
The stored-value bound across a computation, at fixed parameters P0: from a state with
WB K and parameters P0, every run of m ends (normally or by an error) in such a state, and
a normal result satisfies Q.
Equations
- One or more equations did not get rendered due to their size.
Instances For
pure, remembering the value.
A failed guard has no normal result.
A loop over a list, each iteration knowing its element is in the list.
A normal run from a good state ends in a good state.
Any run from a good state ends in a good state.
Reads.
Reading the parameters gives P0.
Decompose a computation into primitive state updates, using the given lemmas for calls. The
results of binds become anonymous hypotheses. Leaves goals of the form
∀ s, WB K s → s.P = P0 → WB K (f s) ∧ (f s).P = P0 for the updates, and the result
predicates of pure.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Applies the stored-value Hoare rules, splitting the core computation into primitive steps.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Split WB K s' into its components and close those that s' shares with a state t of which
h : WB K t. The remaining goals are the components that changed.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Close the goals ht leaves: an update goal, by wbx and wbv; a result goal, by vb.
Equations
- OrderMaintenance.Proof.Word.tacticHtfin = Lean.ParserDescr.node `OrderMaintenance.Proof.Word.tacticHtfin 1024 (Lean.ParserDescr.nonReservedSymbol "htfin" false)