
openpremise
io.github.OpenPremise/openpremise
Formal verification for AI code (Lean 4 + Rust): auth, DB, and post-quantum crypto checks.
Documentation
OpenPremise
OpenPremise is a small deterministic kernel that evaluates software requirements and shows, for each one, exactly what the answer rests on.
Why OpenPremise
Software assurance has long been stuck between whole-tree formal proofs that take months per repository, pattern heuristics that miss real bugs or drown engineers in false alarms, and manual review bottlenecks that cannot keep pace with shipping code. OpenPremise breaks that deadlock with three ideas:
- A compiled Rust kernel, with Lean 4.35.0 models beside it.
assure-kernelbuilds offline with zero external crate dependencies and evaluates applications deterministically using linear-time indexed lookups (100,000route facts in0.94 s,615xfaster than linear scans), rejecting inputs over16 MiBor64 MiBfail-closed. Every Lean proof compiles with warnings treated as errors. - Premised Formal Graphs. Instead of stalling until every database, framework, and runtime is proved from first principles, OpenPremise records each external dependency as an explicit, content-addressed premise in premises/PREMISES.json (
922premises and798footing records at this commit). Discharging or proving one premise strengthens every evaluation and pack that rests on it. - Soundness as Data. Rules, fact types (
kinds), vocabulary (words), and claim tables are declared as pure data under kernel/profiles/ (10built-in profiles) and packs/ (15.oppackpacks, including11Lean-backed post-quantum cryptography packs; guide in build-a-pack). The same rule engine evaluates all built-in profiles as well as external stacks supplied viaassure-kernel check --facts-file.
Hosted Assure (MCP & GitHub Action)
Run the open-source kernel locally below, or use the hosted service (openpremise.com) with keyless local MCP and GitHub OIDC pull-request checks ($5 free starter credit, ~50M deterministic tokens):
- GitHub Action (coding agent one-liner): tell your coding agent to follow skills/assure/SKILL.md (for post-quantum checks, set
send-pqc-files: true). - Local MCP client: download assure-mcp.pyz and assure-mcp.pyz.sha256, then verify with
shasum -a 256 -c assure-mcp.pyz.sha256.
Outcomes and honesty
Every requirement evaluates to one of three plain outcomes: holds, not established, or disproven. Under the general floor, an answer resting on a named repository assumption carries a qualified word (such as holds_on_assumed_interpreter or holds_on_assumed_code) and stays out of plain totals. The same input always produces the same output.
Our target design (requirements.md) is for every holds claim to cite a replayable Lean theorem (basis: "theorem") alongside every premise it rests on. Today:
- Every
holdsclaim names every premise it rests on and each premise's footing, but cites no theorem yet (0theorems named). Itsbasisreadsjudgement, and itsunprovedlist states what remains and the work that would prove it. - Every
not_establishedclaim names the reason and the exact work that would establish it.
OpenPremise is the open-source engine and premise graph. OpenPremise Assure is the hosted service built on it. Everything needed to run an evaluation yourself is in this repository.
What a premise is
Software rests on library releases, programming languages, external servers, and tools. An evaluation of your repository cannot prove what PostgreSQL 16 does with a role flag. Instead, that statement about PostgreSQL is written down once as a premise, pinned to its release.
A premise carries no weight until it has a footing: a replayable record showing how the statement was tied to the pinned release — a run on an isolated host, a source read by two independent readers, or a model validated against the release itself. Single-hand grade: "genesis" footings are admitted only while premises/FLOOR.json is "open", state that up front, and carry the work needed to raise them (see premises/).
Every premise sits in premises/PREMISES.json with its footing in premises/footings/. When a proof lands beneath a premise, its debt falls; when a counterexample is found, every requirement resting on it turns to not_established. What your own code does is a requirement to establish, not a library premise.
What an assumption is
A premise describes something pinned outside your repository and lives in the ledger. A repository assumption describes the repository being evaluated: an unstated interpreter release (assumed) or a code shape the reader does not inspect directly (assumed_code). A repository assumption is not a library premise, adds no footing, lowers no premise debt, and never enters the ledger.
Code assumptions come in two kinds, listed with subject before surroundings:
subject: the code the claim is about uses a form the reader does not inspect directly.surroundings: other code (such as an indirect store) that could change the answer.
Each code-assumption item carries its plain sentence, locations (path and line), why it applies (bearing), and its closer (On Enterprise: ..., the action on Enterprise that establishes it without assuming it).
Configurations and premise floors
OpenPremise uses the general floor (--premise-floor general) by default and for general Assure accounts. When the evidence otherwise supports a decision, this floor can report holds or disproven under a named repository assumption or an admitted genesis footing, keeping assumption-qualified results out of plain totals.
On Enterprise configuration, the strict floor (--premise-floor strict) reports not_established whenever a decision depends on any repository assumption or any library footing below the floor. Read the reason and work fields for the exact actions needed to establish the claim without assuming it.
Find your way
| I want to… | Start here |
|---|---|
| Run an evaluation | kernel/RUN-YOUR-OWN-CHECKER.md: build the binary and run it on a sample. |
| Understand a verdict | read-a-verdict: outcome words (ANSWER-WORDS.json), reasons, and premises. |
| Inspect a premise | premises/: each premise, its pinned release, and its footing record. |
| Change a rule | kernel/profiles/: each profile's rules, fact types, vocabulary, and claims table. |
| Decompile tests | decompile-tests: convert eligible property tests into .oppack rules and witnesses. |
| Read a proof | grammar/: Lean models and theorems; profiles/ holds profile proofs. |
| Reproduce the CI gates | ci/: validation tools and specification rows. |
| Contribute | CONTRIBUTING.md: add a premise, a pack, a profile, or a theorem. |
Top-level folders and short labels are mapped in READING-THE-TREE.md. requirements.md states what this repository is for; each major folder carries its own requirements.md beneath it.
Build
You need Rust 1.99.1, Lean 4.35.0, and Python 3.14 (rust-toolchain.toml, lean-toolchain).
cargo build --locked --offline --release -p assure-kernel
lake build
cargo build needs no network (zero external crate dependencies) and writes target/release/assure-kernel. lake build compiles every Lean file in the repository; if a proof fails, the build fails.
Run one evaluation
This walkthrough runs pg-declared (declared PostgreSQL) on the sample bundles in kernel/samples/pg-declared/. See kernel/RUN-YOUR-OWN-CHECKER.md for Python and other profiles.
1. Lay the pinned profile folder.
python3.14 -I -B tools/profile_folder.py lay --repo "$PWD" --profile pg-declared --served yes --out "$PWD/pinned"
--repo must be an absolute path; the command prints the SHA-256 of each laid file.
2. Run the kernel.
mkdir out
target/release/assure-kernel check --profile pg-declared \
--snapshot kernel/samples/pg-declared/collected/administrators-only/bundle/raw/catalog_snapshot.json \
--declaration kernel/samples/pg-declared/collected/administrators-only/declaration.json \
--side-file kernel/samples/pg-declared/collected/administrators-only/bundle/COLLECTION-SIDECAR.json \
--pinned pinned --out out/claims.json
The kernel reads only the passed files and --pinned, opens no network connection, spawns no subprocess, reads no environment variable or clock, and never executes its input.
| Exit | Outcome | Output |
|---|---|---|
0 | An answer. | Writes claims.json, answer.json, facts.json, and names.json into out/. |
3 | Declaration refused. | Writes one refusal document at --out and check: ended: declaration_refused on stderr. |
2 | Input or setup stop. | One line on stderr; nothing written. |
Exit 70 or 101 signals an internal kernel fault. The parent folder for --out must exist.
3. Read the verdict.
claims.json: one claim per obligation (3holds:SU-1,SU-2,SU-3;0disproven;37not established onadministrators-only), with outcome words, premises, footings, andunprovedwork.answer.json/facts.json/names.json: the rule derivation chain, extracted facts, and SHA-256 digests of every input and rule file read.
Run the same command on kernel/samples/pg-declared/collected/extra-superuser/ to see SU-1 flip to disproven (2 holds, 1 disproven, 37 not established). Run any command twice: output files are byte-for-byte identical.
What is served today
Ten profiles live in kernel/profiles/ and are built into assure-kernel check. Only pg-declared ships with ready-to-run samples (where SU-1, SU-2, and SU-3 decide on the collected PostgreSQL 16.15 samples at general, and 0/40 decide at strict or on hand-written samples; see LIMITS.md for per-profile gaps and footing status).
| Profile | Obligations | Ruled | Footed premises |
|---|---|---|---|
pg-declared | 40 | 27 | 107 / 107 |
pg-observed | 72 | 39 | 40 / 40 |
mysql-declared | 50 | 3 | 3 / 3 |
http-observed | 16 | 9 | 9 / 10 |
python/django | 11 | 11 | 355 / 355 |
python/flask | 8 | 8 | 25 / 27 |
python/fastapi | 11 | 1 | 7 / 7 |
python/stdlib-http | 11 | 1 | 18 / 19 |
javascript/express | 1 | 1 | 2 / 2 |
javascript/nextjs | 1 | 1 | 1 / 1 |
Across all ten profiles: 443 claim lines (0 naming a theorem), 922 ledger premises (0 proved), 798 footing records (643 reads, 155 runs; 599 at grade: "genesis", 199 non-genesis), 15 .oppack directories, and 37 rule files. Print live counts at any commit:
python3.14 -I -B tools/coverage_counts.py --repo "$PWD"
Extend it
- Add a premise: state what a public library release does, attach a footing, and submit it.
- Add a pack or profile: declare fact types, makers, rules, footed premises, and test cases as data.
- Add a theorem: prove in Lean what a requirement's outcome means or what a premise states, and wire it into the gate.
All paths are documented in CONTRIBUTING.md.
Licence
Apache License 2.0. See LICENSE.
Copyright 2026 Symbolia Assurance Pty Ltd.
The premises in this repository describe public releases of external projects. Each premise cites the release and public archive by file, line range, and digest. Those projects are not part of OpenPremise and are not distributed with it; each remains under its own licence.
No installation packages available.