miniproof
miniproof states the laws of a language's operations and commands as a small equational theory, and checks the proofs written in it. From a theory it generates a Haskell record of functions and a polysemy effect, and it turns the laws into properties that test an interpreter.
The NixLab review gate decides whether a merge request may merge. Its verdicts are a theory of three constructors and one operation, join, which combines two verdicts. The gate's verdict is the join of every rule's settled verdict.
-- verdicts form a chain: approve < hold < reject
data Verdict = approve | hold | reject
op join : Verdict -> Verdict -> Verdict
eq joinAssoc : join a (join b c) = join (join a b) c
eq joinComm : join a b = join b a
eq joinIdem : join a a = a
eq approveIdentity : join approve a = a
eq rejectAbsorbs : join reject a = reject
thm holdOverApprove : join hold approve = hold
= join approve hold by joinComm
= hold by approveIdentityThe theorem holdOverApprove is proved in two steps. The first cites joinComm and the second cites approveIdentity. miniproof checks that each step follows from the equation it cites, and refuses the proof if one does not.
A theory declares sorts, data sorts, operations, commands and named equations. It can import other theories.
Each theorem carries a written proof. miniproof checks every step against the equation, theorem or premise it cites, and refuses a step that does not follow.
Template Haskell compiles a theory under a binding to Haskell types. Its operations become a record of functions, and its commands become a polysemy effect.
Each equation becomes a property that any value of that record must satisfy. Each law over programs becomes a property that both sides, run through a pure interpreter from the same state, give the same answer and the same final state.
These are planned and not yet available. Each links to the issue that tracks it.
miniproof is not a general proof assistant. It checks equational proofs about the operations and commands of a language. The metatheory of a language belongs in Agda, compiled to Haskell through agda2hs.