An assertion type is equipped with a CompleteLattice structure,
used as the carrier for pre- and postconditions.
Instances
Total nondeterministic functions #
CompleteLattice can embed propositions (⌜_⌝) but not values of an arbitrary type α.
NondetFun Pred Fun α equips an assertion lattice Pred with a notion of total
nondeterministic functions Fun into α. For example, at Pred = Nat → Prop the instances
are set up such that Fun := Nat → α, a function reading the Nat state. The assertion
EvalsTo f a states that f evaluates to the value a; in the example it is
fun s => ⌜f s = a⌝. The law total states that f evaluates to some value:
(⨆ a, EvalsTo f a) = ⊤. The value type α is the outParam because instances are
synthesized while only the function f is at hand: resolution knows Pred and Fun and
computes α, whose values first occur in the assertions the instance builds.
Pred interprets values of Fun as total nondeterministic functions into α. The value type
α is an outParam computed from Pred and Fun.
- EvalsTo : Fun → α → Pred
Relates a nondeterministic function to a value inside the assertion lattice.
Every function hits some value.
Instances
Pure (state-independent) nondeterministic functions into α are just values of α.
Low priority so that the σ-indexed instance is preferred when both apply.
Equations
- Std.Internal.Do.Assertion.instNondetFun = { EvalsTo := fun (f a : α) => Lean.Order.CompleteLattice.ofProp (f = a), total := ⋯ }
State-dependent nondeterministic functions: a function for σ → Pred is a σ-indexed
function for Pred.
Equations
- Std.Internal.Do.Assertion.instNondetFunForall = { EvalsTo := fun (f : σ → Fun) (a : α) (s : σ) => Std.Internal.Do.Assertion.NondetFun.EvalsTo (f s) a, total := ⋯ }
Prop-valued, fixed-arity specializations of NondetFun.evalsTo_apply: the graph of a
state-dependent function at a state-indexed Prop lattice, applied to its states, is an
equation. Fixing the carrier to Prop (a ground instance) leaves every parameter recoverable
from the trigger, so these are usable @[grind =] lemmas where the general evalsTo_apply is
not.
Eliminate the covering join of EvalsTo from the left of an entailment.