Skip to content

Latest commit

 

History

History
287 lines (226 loc) · 12.3 KB

CORPUS-ADAPTERS.adoc

File metadata and controls

287 lines (226 loc) · 12.3 KB

Corpus Adapters — Index

Status: canonical. Updated 2026-06-01 as part of the saturation campaign (see docs/decisions/2026-06-01-saturation-campaign.adoc), and 2026-10-22 with the estate’s own TCB languages (spark_ada, creusot) and the hyperpolymath_estate profile.

Each adapter is a pub fn ingest(root: &Path) -> Result<Corpus> in src/rust/corpus/<name>.rs, structurally indexing a proof tree into Corpus (src/rust/corpus/mod.rs:138). Hazards (axioms, sorry, believe_me, cheat, …) populate AxiomUsage per entry.

Adapter table

Adapter File extensions Canonical source URL Hazard flags surfaced Status

agda

*.agda

https://github.com/agda/agda

postulate, believe_me, assert_total, sorry, trustme

shipped pre-2026-04

coq

*.v

https://github.com/coq/coq

Axiom, Parameter, Admitted

shipped pre-2026-04

lean

*.lean

https://github.com/leanprover-community/mathlib4

sorry, axiom, admit

shipped pre-2026-04

idris2

*.idr / *.ipkg

https://github.com/idris-lang/Idris2

believe_me, assert_total, postulate

shipped pre-2026-04

isabelle

*.thy

https://www.isa-afp.org/

axiomatization, axiom, sorry, oops, consts, nitpick, quickcheck

NEW 2026-06-01

metamath

*.mm

https://github.com/metamath/set.mm

$a axiom usage, ? admitted in proof

NEW 2026-06-01

mizar

*.miz, *.abs

https://mizar.org/version/current/mml/

@proof sketch, commented-theorem, consider-without-proof

NEW 2026-06-01

hol_light

*.ml (HOL Light filter)

https://github.com/jrh13/hol-light

new_axiom, mk_thm, free ASSUME, failwith “not yet”

NEW 2026-06-01

hol4

*Script.sml

https://github.com/HOL-Theorem-Prover/HOL

new_axiom, mk_thm, cheat, CHEAT_TAC

NEW 2026-06-01

dafny

*.dfy

https://github.com/dafny-lang/dafny

assume, :axiom, extern, expect, :fuel 0

NEW 2026-06-01

why3

*.mlw, *.why

https://gitlab.inria.fr/why3/why3

axiom, val function (uninterpreted), val lemma, assume, absurd

NEW 2026-06-01

fstar

*.fst, *.fsti

https://github.com/FStarLang/FStar

assume, admit, magic, Obj.magic, unsafe_coerce, admit_smt_queries

NEW 2026-06-01

acl2_books

*.lisp, *.acl2

https://github.com/acl2/acl2

defaxiom, defstub, skip-proofs (top-level surfaced), ld-skip-proofsp, local-in-theory-nil

NEW 2026-06-01

tptp

*.p, *.tptp

https://tptp.org/

no_conjecture (axiom-only file), TFF/THF dialects not fully supported

NEW 2026-06-01

smtlib

*.smt2, *.smt

https://smt-lib.org/benchmarks.shtml

status_unknown, uninterpreted (declared-not-defined), unnamed_bang_pattern

NEW 2026-06-01

proofnet

*.jsonl

https://github.com/zhangir-azerbayev/ProofNet

sorry, admit, axiom, no_formal_proof

NEW 2026-06-01

minif2f

*.lean, *.thy, *.ml, *.mm, *.v (multi)

https://github.com/openai/miniF2F

sorry, admit, Admitted, empty_body, todo

NEW 2026-06-01

spark_ada

*.ads, *.adb

https://github.com/AdaCore/spark2014 (and sparklib)

pragma Assume, old-style --# assume, proof disabled via pragma Annotate, pragma Suppress, Unchecked_Conversion, pragma Import, SPARK_Mode => Off

NEW 2026-10-22

creusot

*.rs (Creusot-annotated)

https://github.com/creusot-rs/creusot

#[trusted] (reported as a postulate), unsafe, transmute, unimplemented!/todo!, extern "C", #[cfg(creusot)]

NEW 2026-10-22

hyperpolymath_estate

multi (profile: *.idr under every src/abi/, *.agda under the five type libraries)

the estate’s own repositories

everything the delegating adapters report, plus repo: and layer: module tags

NEW 2026-10-22

Coverage summary

Pre-2026-04: 4 adapters (agda, coq, lean, idris2). Post-2026-06-01: 17 adapters — 4.25× expansion. From 2026-10-22: 20 adapters, the three additions being the ones the estate’s own stack is written in rather than another public corpus (Ada/SPARK, Rust/Creusot, and the estate profile).

Estate corpus profile (hyperpolymath_estate)

The profile adapter is the one addition that is not a public corpus: it indexes the estate’s own lemmas first.

just corpus-ingest-estate              # ROOT defaults to .. (the repo parent)
cargo run --bin echidna -- corpus ingest --root .. --adapter hyperpolymath_estate

The manifest is data/corpus-profiles/hyperpolymath-estate.toml:

Rule What it indexes

name = "*"`, `+paths = ["src/abi"], adapter = "idris2"

The ABI tree of every repository under the root. This is how "`*.idr` under src/abi/, whatever the repo" is expressed without listing repositories that do not exist yet.

echo-types, epistemic-types, secret-types, tropical-types, choreographic-types (adapter = "agda")

The five Agda type-theory libraries. paths = ["src", ""] because not all of them keep src/.

Merging semantics:

  • Each sub-tree is indexed by its own adapter, so its hazard detection, AxiomUsage and type-discipline tags are the real ones.

  • Module names gain a repo:: prefix and carry repo:<name> / layer:<layer> in ModuleEntry::options.

  • Entry qualified names gain the same prefix, so by_qualified stays unique across repositories.

  • CorpusEntry::dependencies keeps bare local names, so a symbol named in two repositories resolves across them — deliberate, because "the same concept, proved twice" is the case the index wants to find — at the cost of not distinguishing the two in the dependency list.

  • Corpus::reindex_links() (not reindex()`) rebuilds the maps, because re-running `+reindex() would re-detect disciplines with the profile’s adapter name and throw away what the sub-adapters found.

ECHIDNA_ESTATE_MANIFEST=/path/to/manifest.toml overrides the location; with no manifest the built-in copy in profile.rs is used, and manifest_file_matches_builtin keeps the two in step.

Test fixtures

Every adapter has a minimal smoke fixture under tests/corpus_fixtures/<adapter>/ (spark_ada and creusot ship one each and are driven end-to-end by tests/corpus_estate_adapters.rs; the hyperpolymath_estate profile has no fixture directory because its tests synthesise repository trees in a tempdir instead). Fixtures cover the happy-path decl parse plus at least one hazard-detection case. They are intentionally tiny — the goal is “compile + smoke correctness”, not “extensive coverage”. Larger evaluation corpora live outside the repo (mathlib4 etc. are fetched at training time via just provision-corpora).

Cross-prover synonyms

Every adapter has a corresponding per-prover synonyms TOML at data/synonyms/<adapter>.toml listing tactic / decl / hazard vocabulary with canonical-and-aliases form. Plus five cross-prover taxonomic dictionaries (underscore-prefix; merged into SynonymTable via merge_external() or merge_cross_prover_dicts()):

  • _msc2020.toml — 181 MSC2020 codes for cross-domain classification (68Qxx and 68Nxx complete; 03B/03C/03D/03F for logic and proof theory)

  • _wordnet_math.toml — 81 lemmas from WordNet 3.1 math sub-hierarchy

  • _conceptnet_seed.toml — 53 pre-fetched ConceptNet 5.7 edges for offline-resilient semantic_class resolution

  • _disciplines.toml — 41 rows for the 42 TypeChecker disciplines

  • _verification_systems.toml — 665 program-verification concepts (bitvectors, memory layout, separation/region framing, termination measures, resource algebras, information flow, estate layer boundaries). This is the dictionary that ProofNet/MiniF2F-shaped vocabularies do not cover.

Wiring into downstream consumers

  1. suggest: src/rust/suggest/synonyms.rs::SynonymTable::load_all() reads per-prover TOMLs. The cross-prover dictionaries are loaded via load_cross_prover_dicts() and merged with merge_external() or merge_cross_prover_dicts().

  2. octad emission: src/rust/corpus/octad.rs::Corpus::emit_octads() walks any Corpus produced by any adapter and emits 8-modality octads into VeriSimDB (see docs/architecture/VERISIM-ER-SCHEMA.adoc).

  3. GNN training: src/julia/training/train.jl consumes premises_<adapter>.jsonl files under training_data/. The new adapters can produce these files via cargo run --bin corpus-emit -- --adapter <name> --output training_data/premises_<name>.jsonl (TODO — wire CLI).

When to add a new adapter

  • Upstream proof library has > 100 declarations AND

  • The library has a stable file format (not a daily-changing CI artifact) AND

  • A real prover backend exists in src/rust/provers/ OR it’s a recognised ML evaluation set (ProofNet, MiniF2F, NaturalProofs, …).

Drop the new file under src/rust/corpus/<name>.rs, add it to mod.rs, write at least 2 unit tests, add a fixture under tests/corpus_fixtures/<name>/, add an entry to this index, and add the per-prover synonyms TOML at data/synonyms/<name>.toml (omit if it’s a format like TPTP/SMT-LIB rather than a prover).

Open backlog (next saturation wave)

Ordered by which obligation the estate cannot currently index, not by how well known the corpus is.

Adapter Why it is where it is Rank

src/rust/corpus/iris.rs (Coq Iris)

Separation logic with ghost state, invariants and ownership — the closest existing corpus to the Zig borrow/region model and to the Rust/Creusot Inv/Perm vocabulary. Every frame-rule, slice_disjoint and ghost_resource row in _verification_systems.toml should be anchored to a real Iris lemma, and today none is. Pulled to the top.

next

src/rust/corpus/tlaps.rs (TLA+ Proofs)

Temporal safety and liveness proofs. The Elixir/OTP layer’s MAA protocols and the SNIF boundary are temporal properties, and none of the 20 shipped adapters indexes a temporal proof at all — so this is the only gap that is a category gap rather than a coverage gap. Pulled to the top.

next

src/rust/corpus/mathcomp.rs (Coq MathComp)

Distinct from generic coq.rs: SSReflect’s / and rewrite idioms make generic extraction lossy.

high

src/rust/corpus/cubical_agda.rs (Cubical Agda stdlib)

The univalent layer under the homotopy_fiber / path-algebra vocabulary. _msc2020.toml already carries 18N60 and 18N45 for it.

high

src/rust/corpus/pvs.rs (PVS theories)

Longest-standing gap in the interactive-assistant set.

medium

src/rust/corpus/naturalproofs.rs (NL to Coq dataset)

Another NL/formal pair set; overlaps ProofNet.

medium

src/rust/corpus/alphaproof.rs (DeepMind 2024 olympiad set)

Demoted to the bottom. There is no published corpus or file format to ingest — AlphaProof’s outputs are not released in a form an adapter could walk — so this would be a filename with no data behind it. It also adds nothing to the TCB languages: the vocabulary is olympiad mathematics, which ProofNet and MiniF2F already cover. Revisit only if DeepMind publishes the archive.

lowest

src/rust/corpus/naproche.rs (Naproche-SAD)

Demoted to the bottom. A small library written in controlled natural language; the extractable structure is the CNL skeleton rather than proof vocabulary, and no estate layer uses CNL.

lowest

Drop here as upstream URLs are confirmed and at least one production consumer needs each.

Type-discipline detection

See docs/architecture/TYPE-DISCIPLINE-EMBEDDING.adoc for the canonical specification.

Every adapter calls detect_disciplines(adapter_name, statement, proof, registry) (src/rust/disciplines/detector.rs) on every CorpusEntry post-extraction. The detector returns Vec<TypeDiscipline> against the 39-discipline taxonomy used by the HP type-checker ecosystem (src/rust/provers/hp_ecosystem.rs:63-126, dispatched via TypedWasm Sigma parameters), and the result is surfaced as CorpusEntry.type_discipline_tags.

The tags flow through SemanticPayload (src/rust/verisim_bridge.rs, new field per VERISIM-ER-SCHEMA.adoc E2 / Cap’n Proto @11) into VeriSimDB and into the Julia GNN training pipeline as a 39-dim multi-hot feature vector per example. See sub-table §4 of TYPE-DISCIPLINE-EMBEDDING.adoc for the per-adapter × per-family expected-hit-frequency matrix.