Hoare Logic for Core #
The structural Hoare rules of Imperative.Logic.Hoare, instantiated for Core directly
over its own language of statement lists, EventLang.coreBlock: there is a single
judgement, Triple, conditioned on Core.Logic.BlockInitEnvWF.
Contents #
Triple, and the rules false_pre, consequence, cmd, set, init, seq,
exit_cons, block, skip, ite and while_rule.
Why the rules are here and not in a HoareProps module #
As in Strata.DL.Imperative.Logic.HoareTemplate: the rules below are the logic rather than
properties of it, so they stay with the judgements they introduce. What does live
separately is the contract integration: ContractToHoareTriple defines the
contract reading, ContractToHoareTripleProps discharges it, and HoareCall
provides the rule for procedure calls.
The Core triple #
Core Hoare triple with an explicit event-condition interpretation.
Equations
- Core.Logic.Hoare.TripleWith π φ conditionInterp params Pre ss Post = Strata.Logic.Hoare.TripleWith (Core.Logic.EventLang.coreBlock π φ) conditionInterp params Pre ss Post
Instances For
Core Hoare triple over statement lists.
Equations
- Core.Logic.Hoare.Triple π φ params Pre ss Post = Core.Logic.Hoare.TripleWith π φ (Imperative.EvaluatorBasedInterp Core.Expression) params Pre ss Post
Instances For
Parametric rules #
False precondition proves anything.
Consequence (weakening): strengthen the precondition, weaken the postcondition.
Rules for a single command #
A generic single Core command. h receives the full InitEnvWF params (.cmd c) ρ₀,
including the WellFormedSemanticEval bundle that EvalCommandE needs.
Assignment. The value written is quantified inside hpost, next to the evaluation
that produced it: which value e takes depends on the environment, so fixing one
outside would demand that Pre determine it.
Declaration. InitState differs from UpdateState only in requiring the slot to
have been undefined beforehand, which the postcondition never inspects.
Structural rules #
Sequencing: glue two triples along the concatenation of their statement lists.
hnofd keeps the factory constant across the prefix's run, which is what lets the
well-formedness condition be re-established on the suffix; see
Imperative.Logic.Hoare.seq_append for why hnoesc is needed.
An exit ends the statement list where it stands, leaving the
environment untouched, so the precondition survives to the exiting configuration.
The statements after it never run. An enclosing block catches the exit.
Wrap a statement list in a labelled block. Post must not mention the names the
body scopes (PostWF), and hnofd keeps the factory constant across the body, so
leaving the block restores nothing.
Empty block is skip. No lowering condition: the generic rule instantiates
skip_block at the trivial block condition.
If-then-else rule.
While rule. hcov says the body's exits are all caught inside the body,
and hInv_proj that the invariant survives the body block's store
projection.