Slotted e-graphs and independent minimal-CIC kernel diversity
Design for binder-aware equality saturation and an independent checker for the minimal CIC fragment.
Scope and boundary
Slotted e-graphs extend the existing congruence-closure prover with bounded reasoning under binders. The mathematical elaborator uses a guarded fallback for lambda and beta equalities. Existing certificates · Qualification record
The independent minimal-CIC checker addresses bugs that rocq c and rocqchk
could share because both use Rocq's OCaml implementation. The Python checker
can recheck selected Gallina units alongside Rocq through check-minicic --dual.
Local package replay uses the declared Gallina subset.
Slotted e-graphs for binder-aware equality saturation
HoldFast's slotted e-graph represents bound variables by their binder depth
in slot nodes. Canonical binder names make alpha-equivalent terms share an
e-class, while free variables retain their spelling.
fun x => f xandfun y => f yhave the same canonical form, so inserting either reuses the same e-class without an alpha-rewrite rule.push_versionandpop_versionisolate branch-local equations. Separate caps bound nodes, merges and saturation iterations.saturate_and_explain(lhs, rhs)finds a shortest path through recorded equality edges and emits a Gallina certificate for Rocq replay.slotted_cert_soundrelates the checked certificate to the modeled equality. A negative control checks thatfun x => xdiffers fromfun x => ywhereyis free.
Independent minimal-CIC second proof checker
The standalone Python checker implements a subset of Gallina without sharing Rocq code. Its checks include the following features.
- Enforced minimal-CIC boundary: Refuses
SProp, universe/sort polymorphism (Polymorphic,Cumulative,NonCumulative),CoInductive/CoFixpoint,Module Type, primitiveRegister/Primitive,vm_cast_no_check,native_cast_no_check,native_compute,Admitted/admit,Type in Type,Unset Guard/Unset Positivity, andAxiom,ParameterorConjecturedeclarations before parsing. - Core trusted checking algorithms:
- Predicative universe checking:
Prop : Type(0),Type(i) : Type(i+1),Prod(_, Prop) : Prop, andProd(Type(i), Type(j)) : Type(max(i, j))with strict prohibition ofType(i) : Type(i)cycles (no_type_in_type), plus inductive constructor universe predicativity (ctor_arg_fits,large_inductive_rejected). - Strict positivity &
Propelimination checking: Every inductive constructor domain checks delta-normalized (whnf) strict positivity (strictly_positive_arg), rejecting negative occurrences even behind transparent definitions, and restrictsProp -> Typelarge elimination to empty or single-constructor prop-argument inductives (prop_elim_allowed). - Structural fixpoint guard checking: Every recursive
Fixcall must apply a strict structural subterm of the inductiverec_argparameter at argument positionrec_arg(fix_call_guarded,fix_wrong_arg_rejected), rejecting divergingFix f (n : nat) := f nand argument-swapping exploits. - Fuel-bounded conversion (
whnf/convertible) checks alpha, beta, delta, iota, zeta and eta conversion, including constructor-indexedMatchbranches and dependent motives. Exhausted fuel leaves the check unresolved.
- Predicative universe checking:
Dual-kernel acceptance requires both the independent checker and Rocq
(rocq c and rocqchk) to accept the same inputs with empty assumption sets.
Local Gallina packages
Supply a root .v unit and its reachable local units with repeated
--dependency arguments. Each filename stem names a unique unit. Leading
Require declarations resolve qualified references, and Require Import
also exposes the unit's top-level declarations unqualified. The checker
resolves the dependency graph before checking declarations in each unit.
Missing units, cycles, unreachable inputs and assumption declarations fail.
python tools/run.py holdfast-parser check-minicic Consumer.v --dependency Support.v --dual
The package check accepts up to 64 units of 65,536 bytes each and reports the
SHA-256 of each exact input and a digest of the ordered closure. With --dual,
Rocq compiles the same bytes in a fresh directory with scrubbed search paths,
and rocqchk checks the closure with an empty assumption allowance. The
package input uses the minimal-CIC Gallina subset. The ordinary mathematical
package emitter's library imports, Gallina prelude and tactics require a
wider checker or a compatible proof-term producer.
Locked mathematical packages
Proof obligations
| Obligation | Required artifact and refusal predicate |
|---|---|
SE-alpha |
Give alpha-equivalent terms one canonical form. Keep bound slot nodes distinct from free variables, including "$slot_0". |
SE-cert-sound |
Prove check_cert_sound and slotted_cert_sound over explicit de Bruijn terms (SEquiv) and replay reconstructed SlottedCert Gallina proofs in Rocq; refuse unproved rewrites and budget overruns. |
SE-capture-avoid |
Prove eval_subst_sound and beta_eval_sound and reject variable-capture rewrites such as lam x. x = lam x. y. |
MC-universes |
Prove no_type_in_type, prod_sort_predicative, and large_inductive_rejected; reject Type : Type, impredicative large inductives, SProp, and Polymorphic. |
MC-positivity |
Prove strict-positivity refusal of negative recursive inductives (strict_positivity_rejects_negative_rec, strict_positivity_rejects_nested_negative) even behind delta definitions, plus prop_or_elim_to_type_rejected. |
MC-guard |
Enforce fix_call_guarded (fix_wrong_arg_rejected) rejecting unguarded or wrong-argument recursive Fix definitions while accepting structurally decreasing functions (myadd). |
MC-dual-check |
Cross-verify identical minimal-CIC Gallina modules in both Rocq 9.3.0 (rocqchk) and minicic_checker with empty assumption sets. |
Qualification and implementation artifacts
| Component | Artifact | Role |
|---|---|---|
| Rocq slotted soundness proof | slotted_egraph_soundness.v | Zero-axiom SlottedEGraphSoundness β/λ-congruence and certificate checker soundness (rocqchk) |
| Slotted e-graph prototype | slotted_egraph.py | Canonical-slot α-hash-consing, versioned saturation, shortest-path explanations and Gallina emission |
| Rocq minimal-CIC spec | minicic_spec.v | Zero-axiom MiniCicSpec universe non-circularity and negative-inductive refusal specification (rocqchk) |
| Independent second kernel | minicic_checker.py | Standalone minimal-CIC typechecker, Gallina parser, positivity/guard checker, and SHA-256 verdicts |
| Qualification records | Q25ev · Q25ew | Slotted e-graph and independent kernel diversity tracks |