Definition
Theorem proving is the discipline of constructing formal mathematical proofs that demonstrate specific properties hold for a system under all possible conditions. Unlike testing, which validates behavior against a finite set of inputs, theorem proving provides absolute certainty: a proven property holds universally, with no counterexample possible. The proof itself serves as a machine-checkable certificate of correctness, verified by a small trusted kernel that is orders of magnitude simpler than the system being proven.
The field divides into two major branches. Interactive theorem provers (ITPs) such as Lean4, Coq, Isabelle/HOL, and Agda provide a formal language for expressing propositions and a tactic language for constructing proofs, with human guidance directing the proof search. Automated theorem provers (ATPs) such as Z3, Vampire, and E attempt to discover proofs without human intervention, typically for decidable fragments of first-order logic. Modern systems increasingly blur this boundary: Lean4's omega and decide tactics invoke automated solvers, while ATPs can be called as oracles within interactive proofs.
In the context of safety-critical and intelligence platforms, theorem proving provides guarantees that no amount of testing can match. A proof that a security policy correctly enforces access control holds for every possible request, not merely the requests in a test suite. This distinction is especially important for epistemic systems where the correctness of reasoning processes directly impacts the trustworthiness of conclusions drawn from evidence.
Historical Foundations
The theoretical underpinnings of theorem proving trace back to the early twentieth century. Frege's Begriffsschrift (1879) introduced the first formal logical system, Gentzen's natural deduction and sequent calculus (1935) provided the proof-theoretic foundations still used today, and Curry and Howard independently observed the correspondence between proofs and programs that would later bear their names.
| Era | Milestone | Significance |
|---|---|---|
| 1879 | Frege's Begriffsschrift | First formal logical calculus |
| 1935 | Gentzen's sequent calculus | Foundation for proof search and cut elimination |
| 1958 | Curry-Howard correspondence | Proofs as programs, propositions as types |
| 1972 | Edinburgh LCF | First tactic-based interactive prover with a small trusted kernel |
| 1985 | Coq (Calculus of Constructions) | Dependent types for expressive specifications |
| 2005 | Gonthier's Four Color Theorem proof | First major mathematical result machine-verified |
| 2017 | Lean (Microsoft Research) | Modern ITP with metaprogramming and automation |
| 2021 | Lean4 | Production-grade rewrite with compiled tactics and FFI |
| 2025 | Prismatic QEVE integration | Lean4 proofs in epistemic verification pipelines |
The LCF approach, pioneered by Robin Milner, established the architectural pattern still dominant today: a small, trusted proof-checking kernel (typically hundreds of lines) validates all proof steps, while an arbitrarily complex tactic layer constructs proofs. This ensures that bugs in tactics cannot produce invalid proofs -- only the kernel must be correct.
Interactive vs Automated Proving
The choice between interactive and automated theorem proving depends on the complexity and expressiveness required by the property being verified.
| Dimension | Interactive (ITP) | Automated (ATP) |
|---|---|---|
| Human effort | High -- user guides proof construction | Low -- solver searches autonomously |
| Expressiveness | Arbitrary higher-order logic, dependent types | Typically first-order, quantifier-free fragments |
| Proof output | Full proof term, machine-checkable | Proof trace or SAT certificate |
| Scalability | Limited by human bandwidth | Limited by decidability and search space |
| Confidence | Kernel-verified, highest assurance | Sound within theory, potential for solver bugs |
| Use case | Complex invariants, security policies, algorithms | SMT obligations, arithmetic bounds, decidable theories |
In practice, modern verification workflows combine both: an interactive prover establishes the high-level proof structure, delegating decidable sub-goals to automated tactics. Lean4's omega tactic handles linear arithmetic, simp applies rewriting rules automatically, and native_decide compiles decision procedures for finite domains.
Dependent Type Theory
Lean4 is built on the Calculus of Inductive Constructions (CIC), a dependent type theory where types can depend on values. This expressiveness allows specifications to capture precise invariants that simpler type systems cannot express.
-- A vector type where the length is part of the type
inductive Vec (a : Type) : Nat -> Type where
| nil : Vec a 0
| cons : a -> Vec a n -> Vec a (n + 1)
-- append preserves length at the type level
def Vec.append : Vec a m -> Vec a n -> Vec a (m + n)
| .nil, ys => ys
| .cons x xs, ys => .cons x (xs.append ys)
In this example, the type Vec a n encodes the list length n as part of the type itself. The append function's return type Vec a (m + n) is a theorem stating that appending a vector of length m to a vector of length n produces a vector of length m + n. The compiler verifies this automatically -- no separate proof is needed.
Key concepts in dependent type theory relevant to Prismatic's verification infrastructure include:
- Propositions as types: A proposition
Pis represented as a type; a proof ofPis a term of that type - Proof irrelevance: Two proofs of the same proposition are interchangeable (in
Prop) - Universe polymorphism: Types are organized into a hierarchy (
Type 0,Type 1, ...) to avoid paradoxes - Inductive families: Data types indexed by values, enabling precise specifications
The Curry-Howard Correspondence
The Curry-Howard correspondence is the foundational insight connecting logic and computation: every type corresponds to a proposition, and every program of that type corresponds to a proof of that proposition. This isomorphism means that type-checking a program is equivalent to verifying a proof.
| Logic | Programming | Example |
|---|---|---|
| Proposition | Type | Nat -> Nat |
| Proof | Program | fun n => n + 1 |
| Implication (A implies B) | Function type | A -> B |
| Conjunction (A and B) | Product type | A x B |
| Disjunction (A or B) | Sum type | A + B |
| Universal quantifier | Dependent function | (n : Nat) -> P n |
| Existential quantifier | Dependent pair | (n, proof) |
| False | Empty type | Empty |
For the Prismatic Platform, this correspondence means that verified Lean4 code is simultaneously a program and a proof of its specification. When the QEVE framework validates an epistemic property, the Lean4 proof term is both executable verification logic and a mathematical certificate of correctness.
Proof Tactics and Strategies
Tactics are the primary interface for constructing proofs in interactive theorem provers. A tactic transforms a proof goal (an unproven proposition) into zero or more simpler sub-goals. When all sub-goals are discharged, the proof is complete.
-- Proving commutativity of addition in Lean4
theorem add_comm : forall (m n : Nat), m + n = n + m := by
intro m n
induction m with
| zero => simp [Nat.zero_add, Nat.add_zero]
| succ m ih => simp [Nat.succ_add, Nat.add_succ, ih]
Common tactic families used in Prismatic's verification workflows include:
| Tactic | Purpose | Automation Level |
|---|---|---|
intro | Introduce hypotheses from the goal | Manual |
apply | Apply a lemma matching the goal's shape | Manual |
induction | Structural induction on an inductive type | Manual |
simp | Simplification using rewriting rules | Semi-automated |
omega | Linear arithmetic decision procedure | Fully automated |
decide | Decision procedure for decidable propositions | Fully automated |
aesop | Automated reasoning by search | Fully automated |
native_decide | Compiled decision procedure for finite domains | Fully automated |
The art of interactive theorem proving lies in decomposing complex goals into sub-goals amenable to automated tactics. Experienced practitioners develop intuition for when manual structural reasoning is needed versus when automation can handle the remaining obligations.
Lean4 in the Prismatic Platform
The Prismatic Platform integrates Lean4 as its primary theorem prover within the QEVE (Quantitative Epistemic Verification Engine) framework. Lean4 was chosen for its combination of expressiveness, performance (compiled tactics), metaprogramming capabilities, and active development momentum.
Prismatic's Lean4 integration covers three verification domains:
Data Integrity Invariants: Proofs that storage operations preserve data consistency across the seven backend adapters. For example, proving that the ETS cache adapter's write-through policy guarantees that a successful write is visible to all subsequent reads.
Security Policy Correctness: Formal proofs that RBAC policies correctly enforce access control, that authentication flows cannot be bypassed, and that information flow constraints prevent unauthorized data exposure.
Epistemic Axiom Compliance: Verification that the NABLA Infinity framework's seven axioms are satisfied by the platform's reasoning pipelines. This includes proving that signal plurality requirements are met, that contradiction preservation is maintained, and that provenance chains are complete.
-- Simplified epistemic axiom: signal plurality
-- Every belief must be supported by at least 2 independent sources
theorem signal_plurality_preserved
(b : Belief) (sources : List Source)
(h_plurality : sources.length >= 2)
(h_independent : Pairwise Independent sources)
: ValidBelief b sources := by
exact ValidBelief.mk b sources h_plurality h_independentTrinity Gate Formal Necessity Layer
The Trinity Gate is the Prismatic Platform's three-layer verification gate through which all epistemic claims must pass before being established as platform knowledge. Theorem proving provides the third and most rigorous layer: formal necessity.
| Layer | Method | What It Verifies | Tool |
|---|---|---|---|
| 1. Structural Consistency | Graph theory | Belief network forms a valid DAG | KuzuDB queries |
| 2. Logical Consistency | Rule-based reasoning | Propositions follow logical rules | Elixir rule engine |
| 3. Formal Necessity | Theorem proving | Claims proven in formal systems | Lean4 |
The formal necessity layer ensures that critical claims are not merely consistent or logically sound but are mathematically proven. This is particularly important for security-critical properties (where a single counterexample could represent an exploitable vulnerability) and for epistemic properties (where reasoning correctness determines the trustworthiness of all downstream conclusions).
The QEVE framework orchestrates the interaction between these layers: when a claim reaches the formal necessity check, QEVE translates the claim into a Lean4 proposition, invokes the prover, and either accepts the resulting proof certificate or reports the unprovable obligation back to the epistemic pipeline for further investigation.
Theorem Proving vs Property-Based Testing
Theorem proving and property-based testing are complementary verification techniques that occupy different points on the assurance-effort tradeoff.
| Dimension | Theorem Proving | Property-Based Testing |
|---|---|---|
| Coverage | All possible inputs (universal) | Random sample of inputs (statistical) |
| Assurance level | Absolute (mathematical proof) | High confidence (no counterexample found) |
| Effort required | High (expert knowledge, proof construction) | Moderate (property definition, generator writing) |
| Feedback speed | Slow (proof development takes hours to days) | Fast (seconds to minutes per test run) |
| Counterexamples | N/A (proves impossibility of counterexamples) | Automatic shrinking to minimal counterexample |
| Maintenance | Proofs must track specification changes | Tests adapt more easily to changes |
| Tool maturity | Lean4, Coq (academic roots, growing adoption) | StreamData, PropEr (mature, widely adopted) |
The Prismatic Platform uses both: property-based testing with StreamData provides rapid feedback during development, while Lean4 proofs provide the highest assurance for critical invariants that survive into the Trinity Gate formal necessity layer. The Monte Carlo verification component of QEVE bridges the gap by using statistical methods to build confidence before investing in full formal proofs.
Practical Considerations
Deploying theorem proving in a production platform introduces engineering challenges beyond proof construction.
Proof maintenance: As specifications evolve, proofs must be updated. Lean4's type-checking ensures that broken proofs are caught immediately (they fail to compile), but updating proofs requires expertise. Prismatic mitigates this by keeping proofs modular and aligned with the platform's compositional architecture.
Proof performance: Complex proofs can take significant compilation time. Lean4's compiled tactics and incremental compilation help, but large proof developments may still require minutes to build. The QEVE framework caches verified proof certificates to avoid re-verification.
Specification fidelity: A proof is only as meaningful as its specification. If the formal model diverges from the actual system behavior, the proof guarantees nothing about the real system. Prismatic addresses this through the adapter contract test suite, which validates that the formal model and the implementation agree on observable behavior.
Expertise requirements: Theorem proving requires specialized knowledge. The White Team's invariant-prover agent encapsulates this expertise, providing a reusable interface that other platform components can invoke without deep familiarity with Lean4's tactic language.
Related Terms
- Formal Verification - Broader discipline encompassing theorem proving, model checking, and abstract interpretation
- Lean4 - Interactive theorem prover used by the platform for QEVE proofs
- QEVE - Verification engine orchestrating Lean4, NABLA, and Monte Carlo verification
- Trinity Gate - Three-layer verification gate where theorem proving provides formal necessity
- Property-Based Testing - Probabilistic complement to formal proofs using random input generation
- Monte Carlo Verification - Statistical verification bridging testing and formal proof
- Epistemic Pipeline - 16-level pipeline where proven properties feed confidence scoring
- NABLA Infinity - Epistemic framework whose axioms are formally verified
- Consciousness Traits - Platform traits whose invariants are proven in Lean4
- Typespec - Elixir type annotations complementing formal proofs at the implementation level
See Also
- Architecture - Verification architecture and Trinity Gate integration
- Technologies - Proof assistant tooling and formal methods stack
- Agents - White Team invariant-prover agent specification
Connect & Contribute
Created by Tomáš Korcak (korczis) | Open Source under GHL