Seven core patterns#
- maps · forallLimits per key: per account, per dayKeep a number per key in maps, decide a flag once per step, and quantify laws over every key at once.
- fixedInt · BitVecMachine integers: wrap, saturate or trap8, 16, 32 and 64-bit signed or unsigned integers with explicit overflow and division rounding modes.
- oneOf · stepLawA workflow: statuses that only move forwardModel order statuses with
oneOfand prove single-step transition laws withproveSteps. - chart · check()The same workflow as a statechartNested states, parallel regions, guards, extended state, history, reachability and ambiguity checks.
- gdp-wired/xstate · @xstate/graphWith XState, and model-based testsProve existing XState machines, generate app tests with
@xstate/graph, and check JSONL traces offline. - fun · gdp-tsA permission checkProve stateless authorization policies with
funand hold every call site to them withgdp-ts. - record · carriesListAn order with line itemsFold over a list carried by a request and prove fold lemmas by induction when the rule is built.
More shapes in the README#
More shapes, each in the README: sliding-window rate limits over a log of requests, sums over every
key of a map (M.sum()), laws over up to 64 steps in a row, “every ticket issued is eventually served”
(under weak or strong fairness), an implementation that behaves like a simpler spec, functions defined by a
recurrence with lemmas you state, and rules read from your own TypeScript.
What it proves · Writing laws · Checking existing code in 11 languages