Metakit / API

@doeixd/metakit/prove

Dev-only prover (@doeixd/metakit/prove): the synchronous Interval and Zone checks first, then the Z3 solver for what they leave undecided.

The solver reads an expression as evaluation does: every term is a value and whether it is null, an operator over a null operand is null, and and or are Kleene, and a rule holds only where it is true. Text and arrays are not modelled beyond their length and count, so a goal that rests on more is undecided. Whatever the solver assigns is replayed through the Schemas and the evaluator before it is called a counterexample.

Functions

fnProve that fn satisfies its Hoare contract for every input admitted by fn.paramsSchema and fn.where: well-definedness (no refusal), fn.returns…
invariantProve that every value schema accepts satisfies goal: that it is true, not null and not refused. Runs Tier 3 first; asks Z3 where it is undecided, and for a…
machineVerify every transition in a Machine under strict/pinned CI discipline:
policyProve that goal holds of every environment the Schemas of shape accept and every rule of options.hypotheses holds of.
policyAllConsistentCheck consistency (reachability) of every rule in pol: ok is true only when every rule is proved reachable (True); unreachable lists every rule proved dead…
policyConsistentWhether rule, one of pol.rules, can allow anything: True with a rule some environment satisfies, False for a rule none does (a dead rule), and Unknown where…
policyImpliesProve that rule from of pol (with the row and principal Schemas) entails its rule to: non-disclosure is pol.rules.Update entailing pol.rules.Read.
transitionProve that transition leaves every state stateSchema accepts, under an input its input Schema accepts and a guard that holds, a state the Schema still…

Values

SolverThe solver used for escalation. Supply another backend with Layer.succeed.
SolverAnswer
z3SolverLayerThe built-in lazy local Z3 backend.

Classes

SolverUnavailableErrorz3-solver, an optional peer, could not be loaded when a proof needed it.

Interfaces

MachineProofEntry
MachineProofReport
PolicyConsistencyReportReport returned by Prove.policyAllConsistent.
ProveOptions
SolverBackendA backend solves one problem at a time per call and can register resources in its scope.
SolverProblemThe goal handed to a backend after the synchronous checks.
WitnessReportStructured counterexample report for a refuted transition.