Skip to main content

kernel_v0 — Verum's bootstrap meta-theory

kernel_v0 is the Verum-language mirror of the host-implementation trusted-base proof-term checker. It lives at core/verify/kernel_v0/ and ships a hand-auditable 10-rule rule description used by the bootstrap manifest and its audits. Its existence does not establish every other kernel rule or a self-hosted checking implementation.

The architectural goal is an executable Verum checker with a verifiable bootstrap chain. The current registry slot is a Rust wrapper: it calls the direct checker and then inspects rule manifests and policy. Self-hosting requires an additional implementation and a compilation trust argument.

For the layered three-rule-tier architecture see Trusted kernel. For the three-kernel differential testing — including kernel_v0 as the third algorithmic slot — see Three-kernel architecture.

1. The architectural picture​

Verum-side rule descriptions → bootstrap manifest and citations
↓
.vproof → direct Certificate::verify → manifest/policy checks
↓
kernel_v0 registry-slot verdict

The manifest classifies rules as structurally discharged, attributed to a framework, or carrying an outstanding obligation. An empty outstanding-IOU list is a property of that classification. It does not mean every cited result has been replayed as a local proof or that the implementation's soundness follows from the list.

2. The 10 minimal rules​

RuleFileStatusDescription
K-Varrules/k_var.vrProvedVariable lookup in context: Γ, x:A ⊢ x : A
K-Univrules/k_univ.vrProvedUniverse(l) : Universe(succ l) — universe stratification, polymorphic over level expressions (Concrete/Var/Succ/Max)
K-Pi-Formrules/k_pi_form.vrDischargedByFramework (mathlib4)Π-type formation: (A:U(n)) → (B:U(m)) in U(max(n,m))
K-Lam-Introrules/k_lam_intro.vrDischargedByFramework (mathlib4)λ introduction: body's type under binder gives Π type
K-App-Elimrules/k_app_elim.vrDischargedByFramework (mathlib4)Apply elimination + substitution
K-Betarules/k_beta.vrDischargedByFramework (mathlib4)β-reduction (λx.M) N ⤳ M[N/x] is type-preserving
K-Etarules/k_eta.vrDischargedByFramework (lean4_stdlib)η-equivalence λx.(f x) ≡ f when x ∉ FV(f)
K-Subrules/k_sub.vrDischargedByFramework (mathlib4)Subtyping (universe cumulativity)
K-FwAxrules/k_fwax.vrProvedFoundation-aware axiom admission (Prop-only)
K-Posrules/k_pos.vrProvedPositivity check (Berardi 1998 — non-positive ⇒ ⊥)

Status reflects the broader 38-rule kernel-soundness corpus at core/verify/kernel_soundness/. Four of the ten are already proved structurally; six are DischargedByFramework with cited upstream proofs (mathlib4 / lean4_stdlib). Zero rules sit at Admitted — both the kernel-v0 manifest's status table below AND the broader 38-rule registry have an empty iou_axiom_specs(). See framework axioms — IOU registry for the discharge protocol.

The audit gate verum audit --kernel-v0-roster walks the manifest and confirms every rule has its corresponding .vr file. Drift between manifest and filesystem is a build failure.

3. Trust base — what the auditor reads​

The trusted base is small enough for an auditor to read end to end:

ComponentTrust contribution
proof_checker moduleextended-CoC checker (Π/Σ/Id with universe polymorphism) — 13 rules, bidirectional infer + check
kernel_v0/ Verum sourcehand-auditable 10-rule mirror; one file per rule plus soundness lemmas
Manifest verifierstructural type-check + manifest audit-cleanness + meta-soundness footprint + per-rule strict-intrinsic dispatch

The Verum-side descriptions make judgments and obligations inspectable in the language. A complete self-hosting claim additionally needs execution of the checker, preservation through its compiler and an explicit bootstrap trust chain. Changing the implementation language alone does not discharge those obligations.

4. The differential-kernel role​

kernel_v0 is the third slot in verum audit --differential-kernel:

SlotImplementationStatus
1proof_checker (Algorithm A — bidirectional + WHNF)active
2proof_checker_nbe (Algorithm B — NbE)active
3KernelV0Kernel (Algorithm C — manifest-driven verifier consuming the Verum-source kernel_v0/ manifest)active

The differential gate's invariant strengthens: every certificate is compared across the selected registry slots. The third slot depends on the first; disagreements require inspection of both term-checking and policy outcomes.

5. The file layout​

core/verify/kernel_v0/
├── README.md ← architectural overview
├── mod.vr ← module aggregator
├── core_term.vr ← CoreTerm inductive (mirrors proof_checker::Term)
├── context.vr ← Context (de Bruijn-indexed type stack)
├── judgment.vr ← Γ ⊢ t : T judgment (well-typedness)
├── soundness.vr ← top-level soundness lemma
├── rules/
│ ├── mod.vr ← rule aggregator
│ ├── k_var.vr ← K-Var
│ ├── k_univ.vr ← K-Univ
│ ├── k_pi_form.vr ← K-Pi-Form
│ ├── k_lam_intro.vr ← K-Lam-Intro
│ ├── k_app_elim.vr ← K-App-Elim
│ ├── k_beta.vr ← K-Beta
│ ├── k_eta.vr ← K-Eta
│ ├── k_sub.vr ← K-Sub
│ ├── k_fwax.vr ← K-FwAx
│ └── k_pos.vr ← K-Pos
└── lemmas/
├── mod.vr ← lemma aggregator
├── beta.vr ← β-confluence (Newman's lemma)
├── eta.vr ← η-confluence
├── sub.vr ← subtyping refl/trans
├── subst.vr ← substitution lemma
└── cartesian.vr ← Cartesian closure of contexts

Every file is hand-readable Verum source.

6. Per-rule verbosity — K-Var worked example​

A representative file (rules/k_var.vr) ships:

  • The judgment: Γ ⊢ Var(n) : Γ[n] for a well-formed context.
  • The Verum encoding as introduce_var, returning Maybe<Derivation> — a variable derivation when lookup succeeds, and None otherwise.
  • A soundness lemma: "if K-Var admits (Γ, n), then Γ[n] is well-typed in Γ".
  • The lemma's discharge: a structural induction on the context's de Bruijn level.

Each of the 10 rule files has the same structure — judgment + encoding + lemma + discharge or admit. Auditors read the file end-to-end without external dependencies.

7. Discharge dashboard — every rule is audit-clean​

The 10 kernel_v0 rules split into two L4-acceptable discharge classes:

$ verum audit --kernel-v0-roster

rule status citation
───────────── ────────────────────── ───────────────────────────────────
K-Var discharged (structural — verum_kernel::proof_checker)
K-Univ discharged (structural — verum_kernel::proof_checker)
K-Pi-Form discharged_by_framework mathlib4 / Mathlib.LambdaCalculus.LambdaPi
.KindPreservation.pi_form_universe_max
K-Lam-Intro discharged_by_framework mathlib4 / Mathlib.LambdaCalculus.LambdaPi
.Substitution.context_extension
K-App-Elim discharged_by_framework mathlib4 / Mathlib.LambdaCalculus.LambdaPi
.Substitution.subst_preserves_typing
K-Beta discharged_by_framework mathlib4 / Mathlib.Computability.Lambda.ChurchRosser
K-Eta discharged_by_framework lean4_stdlib / Function.funext
K-Sub discharged_by_framework mathlib4 / Mathlib.SetTheory.Ordinal.Cumulative
.cumulative_hierarchy
K-FwAx discharged (structural — verum_kernel::proof_checker)
K-Pos discharged (structural — Berardi 1998 positivity check)

4 / 10 structurally discharged
6 / 10 discharged-by-framework (vetted upstream citation)
0 / 10 admitted_with_iou
0 / 10 not_yet_attested

audit-clean: 10 / 10 ✓ load-bearing

The 6 framework-discharged rules each carry a structured citation triple (lemma_path, framework, citation):

  • lemma_path — the path to the discharge stub in core/verify/kernel_v0/lemmas/ carrying the same @framework attribute (e.g. core.verify.kernel_v0.lemmas.beta.church_rosser_confluence).
  • framework — the upstream framework name (mathlib4 / lean4_stdlib).
  • citation — the concrete upstream artefact identifier (e.g. Mathlib.Computability.Lambda.ChurchRosser).

The audit policy accepts both structurally discharged and framework-attributed statuses. These are different evidence kinds. A citation triple can identify an intended upstream result; it does not verify that result's existence, its exact assumptions, or its applicability to this implementation merely by being present. A consumer requiring local replay must retain the corresponding proof artifact and interpretation separately.

8. Why a separate Verum-side mirror​

The mirror exposes the intended judgments, their dependencies and their source-level presentation. It supports manifest-drift checks and provides an interface for an eventual executable Verum checker.

The existing differential gate compares the direct and NbE algorithms; its bootstrap slot adds checks on the mirror's manifest while reusing the direct verdict. This is useful audit infrastructure with a clear boundary, not evidence that a second implementation is already running in Verum.

9. Cross-references​