Discharging a procedure's contract #
Ways to establish a Procedure.contractTriple, and the bridges that make a concrete
procedure's contract decidable. The definitions being established live in
Strata.Languages.Core.Logic.ContractToHoareTriple.
Key results #
Procedure.contractTriple_of— supplies the procedure and body, discharging the name lookup and the.structuredobligation once.Procedure.contractTriple_of_coreandProcedure.contractTriple_of_core_typed— retain the concrete Core entry facts needed by evaluator-sensitive body proofs.Procedure.contractTriple_nilandProcedure.contractTriple_nil_of_ensuresAmongRequires— an empty body meets a contract whose non-freeensuresclauses are all among itsrequires.Procedure.contractTriple_singleton_cmd— a one-command body, reduced to a single obligation about that command'sEvalCommandEstep.Procedure.checkAsPredicate_of_exprEq— transfers the reading of a captured check to another clause with the same expression.assertionsValid_defaultAssertEvents— turns non-freecontract clauses that hold in every world into a valid assertion-event trace.Procedure.inputAsPredicate_int— anintinput holds an integer at a well-formed entry satisfying the input typing.
A snapshot of a procedure's non-free contract clauses as assert events is
assertion-valid whenever every such clause holds in every world.
Transfer the reading of a captured check to another clause with the same
expression, given that the environment's runtime factory is over factory.
Build a contractTriple from the name lookup, body, and body judgement.
The factory, old-inout, and input-typing clauses of contractTriple's
precondition are discarded by weakening, so the body proof needs only the
preconditions.
Build a contractTriple whose body proof may assume the concrete factory and
old-inout relation but does not need runtime input-value typing. The separate
hchecksTyped argument discharges contractTriple's static requirement that each
contract clause type-check as bool.
Build a contractTriple while retaining every entry fact, including values
matching the types of the procedure's input and inout formals.
A contract whose every non-free ensures is literally one of the
requires is met by an empty body: nothing runs, so the precondition still
holds at the end.
An empty body meets a contract whose non-free ensures clauses are all among its
requires, with the containment settled by the decidable ensuresAmongRequires.
A one-command body. The cmd rule reduces a contract over [.cmd c] to a
single semantic obligation about c.
An input of type int holds an integer of the runtime factory at an entry with a
well-formed store satisfying the procedure's input typing.