Axiom Policy
Reference for Lema's fixed axiom floor, configurable store axiom policies, and five-step axiom footprint auditing.
Every proof and satisfaction object accepted into a Lema store records the exact transitive set of axioms (axioms) on which it depends. Lema enforces axiom discipline at two levels:
- The fixed floor: An unconfigurable, compile-time ban on unsound, partial, or compiler-trusting axioms (
sorryAx,native_decide,unsafe, and user-declaredaxiomconstants). - The store and project policy: A configurable allowlist (defaulting to standard Lean classical mathematics:
propext,Quot.sound,Classical.choice) enforced at store acceptance (lema init --axioms) and project governance (lema.policy/v1require.axioms).
The fixed floor (always rejected)
No store configuration, policy record, or waiver can admit an object that depends on any of the following constants or mechanisms:
| Rejected mechanism | Kernel constant / tag | Why it is blocked |
|---|---|---|
Incomplete proofs (sorry, admit) | sorryAx | Proves arbitrary false propositions. |
Native evaluation (native_decide) | Lean.ofReduceBool, Lean.ofReduceNat, Lean.trustCompiler, *_native | Bypasses kernel reduction by trusting unverified native code generation and execution. |
| User-declared axioms | axiom ... (AxiomVal outside Init) | Allows arbitrary unproved assumptions to masquerade as theorems. |
| Unsafe definitions | unsafe def, partial def | Violates logical consistency or termination guarantees. |
Configurable foundational axioms
Above the fixed floor, a store or project policy may allow any subset of Lean’s three standard foundational axioms:
| Axiom name | Lean signature / role | Used by |
|---|---|---|
propext | ∀ {a b : Prop}, (a ↔ b) → a = b | Propositional extensionality, simp rewriting under binders, and quotient soundness. |
Quot.sound | ∀ {α : Sort u} {r : α → α → Prop} {a b : α}, r a b → Quot.mk r a = Quot.mk r b | Quotient types, Std equivalence classes, and extensional equality lemmas. |
Classical.choice | ∀ {α : Sort u}, Nonempty α → α | Law of the excluded middle (Classical.em) and classical case splits in proofs (by_cases). |
By default, lema new and lema init allow all three (["propext", "Quot.sound", "Classical.choice"]). You can restrict a store to a constructive subset at initialization time:
# Constructive + extensional store (disallows Classical.choice)
lema init ./my-store --axioms propext,Quot.sound
# Pure Martin-Lof type theory store (zero axioms)
lema init ./pure-store --axioms ""See Narrow the Axiom Policy for how to tighten require.axioms on an existing project reference via lema.policy/v1.
Four enforcement layers
Lema checks axiom footprints at four independent boundaries:
- Syntax and elaboration guard (
crates/lema-native-runtime): Rejectsaxiom,unsafe,partial, andnative_decidein.leansource before export. - Checked export (
lema.checked-export/v3): RunsLean.collectAxiomsinside the elaboration sandbox and verifies that every exported proof’s footprint is a subset of the three standard axioms. - Source-free kernel replay (
crates/lema-lean-check): Reconstructs the declaration graph in a clean Lean4.34.1kernel, re-computes the transitive axiom footprint from the kernel environment, checks that it matches theaxiomsarray declared in thelema.core/v4object, and verifies that it is a subset of the store’s allowed axiom list. - Governance and release gates (
crates/lema-store): When advancing a project reference (lema commit/ref.publish) or creating a release (lema release), the store verifies that every object in the snapshot’s transitive closure satisfiesrequire.axiomsin the activelema.policy/v1record.
Five-step transitive footprint audit
When crates/lema-lean-check replays a proof or satisfaction object P, it computes P’s axiom footprint in five deterministic steps:
- Dependency closure: Topologically sorts all objects reachable through
P.refs. - Fresh kernel replay: Replays each dependency in order into a fresh Lean
4.34.1kernel environment initialized only with the pinnedInitlibrary. - Kernel
collectAxiomswalk: Traverses every constant referenced inP’s kernel expression tree and collects allAxiomValconstants encountered. - Fixed-floor and allowlist check: Rejects
Pimmediately if any collected axiom is outside the store’s configured allowlist. - Exact set equality: Verifies that the sorted list of collected axioms equals
P.axiomsbyte-for-byte before writing the verification receipt.
Why Classical.choice in proofs never enters LemaIR execution
In Lean 4, propositions (Prop, Sort 0) are proof-irrelevant and erased during compilation. Lema separates proof verification from runtime execution:
- A
theoremor law proof (prooforsatisfactionobject) may useClassical.choiceto reason by contradiction or excluded middle if allowed by the store’s axiom policy. - An executable
defcompiled intolema.ir/v1(crates/lema-ir) for the register VM (crates/lema-vm) cannot invokeClassical.choiceto produce runtime data (UInt64,ByteArray,Prog, and so on). If a reachable computational function attempts to extract runtime data from a noncomputableClassical.choiceapplication,crates/lema-irrejects the declaration at compile time.
Lema v0.3.2 · Updated 29 October 2026 · Version and compatibility