Skip to content

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:

  1. The fixed floor: An unconfigurable, compile-time ban on unsound, partial, or compiler-trusting axioms (sorryAx, native_decide, unsafe, and user-declared axiom constants).
  2. 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/v1 require.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 mechanismKernel constant / tagWhy it is blocked
Incomplete proofs (sorry, admit)sorryAxProves arbitrary false propositions.
Native evaluation (native_decide)Lean.ofReduceBool, Lean.ofReduceNat, Lean.trustCompiler, *_nativeBypasses kernel reduction by trusting unverified native code generation and execution.
User-declared axiomsaxiom ... (AxiomVal outside Init)Allows arbitrary unproved assumptions to masquerade as theorems.
Unsafe definitionsunsafe def, partial defViolates 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 nameLean signature / roleUsed by
propext∀ {a b : Prop}, (a ↔ b) → a = bPropositional 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 bQuotient 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:

Shell
# 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:

  1. Syntax and elaboration guard (crates/lema-native-runtime): Rejects axiom, unsafe, partial, and native_decide in .lean source before export.
  2. Checked export (lema.checked-export/v3): Runs Lean.collectAxioms inside the elaboration sandbox and verifies that every exported proof’s footprint is a subset of the three standard axioms.
  3. Source-free kernel replay (crates/lema-lean-check): Reconstructs the declaration graph in a clean Lean 4.34.1 kernel, re-computes the transitive axiom footprint from the kernel environment, checks that it matches the axioms array declared in the lema.core/v4 object, and verifies that it is a subset of the store’s allowed axiom list.
  4. 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 satisfies require.axioms in the active lema.policy/v1 record.

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:

  1. Dependency closure: Topologically sorts all objects reachable through P.refs.
  2. Fresh kernel replay: Replays each dependency in order into a fresh Lean 4.34.1 kernel environment initialized only with the pinned Init library.
  3. Kernel collectAxioms walk: Traverses every constant referenced in P’s kernel expression tree and collects all AxiomVal constants encountered.
  4. Fixed-floor and allowlist check: Rejects P immediately if any collected axiom is outside the store’s configured allowlist.
  5. Exact set equality: Verifies that the sorted list of collected axioms equals P.axioms byte-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 theorem or law proof (proof or satisfaction object) may use Classical.choice to reason by contradiction or excluded middle if allowed by the store’s axiom policy.
  • An executable def compiled into lema.ir/v1 (crates/lema-ir) for the register VM (crates/lema-vm) cannot invoke Classical.choice to produce runtime data (UInt64, ByteArray, Prog, and so on). If a reachable computational function attempts to extract runtime data from a noncomputable Classical.choice application, crates/lema-ir rejects the declaration at compile time.

Lema v0.3.2 · Updated 29 October 2026 · Version and compatibility