Examples and verification cases

Copy Markdown View Source

Start with Getting Started, then use the Case Studies for complete file and IEx examples across the public analysis workflows. Use Test Performance Calibration to choose test-run job/thread settings. The guides below provide deeper detail. Interactive examples run in iex -S mix; test commands run from the repository root.

GuidePurpose
Verify Lean declarationsSupply a proof for a translated function, including a module compiled in IEx
Compare cost contracts and reuse a verified boundDerive an integer cost bound, compare contracts, and transfer the bound
Port models and supported clientsCheck finite traces, conditional model completion, and a supported Core Erlang client
Public RPC verification workflowVerify RPC models, conditional completion and restricted source bounds through the shared boundary
Restricted RPC source connectionConnect a helper-contracted Core client to finite normal-execution and conditional cost theorems
Conditional RPC completionProve termination or success under explicit continuation progress, separately from cost safety
RPC participant cost safetyProve conditional participant bounds and replay unary integer server contracts
RPC mailbox and conditionsCheck selective receive, ordered matching, queue retention and explicit message/count conditions
Initial RPC modelCheck a supplied single-attempt protocol and correlation tokens without claiming mailbox semantics or cost bounds
Symbolic list boundsUnderstand traversal bounds and find list, input-contract, and composition examples

The module documentation contains additional API examples. The proof reference records what Lean checks and which conditions remain assumptions. The following cases reuse those proof rules:

Verification caseDetailed account
Integer sizes, arithmetic, variance, and CRC expressionsInteger costs
Membership, reversal, and conditional reversalList bounds guide
Map and struct operationsMap and struct proofs
One ring-buffer insertionSingle-insertion model
Consecutive ring-buffer insertions and FIFO contentsInsertion sequences
Fixed progress and periodic resetsShared transition rule
Port outcomes, finite prefixes, and supported client correspondencePort workflow
Contract comparison and verified bound reusePublic API evaluation

To print the integer workflow's upper-bound formulas, contracts, conditions, and checked theorem names:

REDUCTION_BOUNDS_REPORT=1 mix test --only cost_contract_workflow --trace

To print the Port workflow's formulas, conditions, completion assumptions, verification scopes, diagnostics, and checked theorem names:

REDUCTION_BOUNDS_REPORT=1 mix test --only port_workflow

To reproduce the tagged list and ring-buffer verification cases:

mix test --only case_study --trace

These commands evaluate mathematical cost models. They do not measure runtime reductions or execution time. See the roadmap for work beyond the checked prototype.