Component architecture

Article conversion

OpenTheory articles are converted directly into proof-DAG libraries of library format 2.2 (ST9). Article.open, article additions through LibraryChange.publish, and the command-line converter use one typed conversion request and the same construction, checking, and publication path. The CLI alone parses command-line text; common request normalization runs before the bank or workers are created.

The stages are:

  1. Streaming input. Articles are read through judgment_store's ArticleInput / SeekableArticleInput and Article APIs under explicit ArticleLimits (ST6), validating byte length, SHA-256 digests, and UTF-8 / command syntax without trusting the source.
  2. DAG construction and checking. Article commands populate proof-DAG rows in termbank.dag over the fixed profile (such as the classical / Isabelle profile). An article variable is a local fixed by its name and type. A statement the profile, a base version or an earlier command already provides is matched by its canonical closure and declared once (Rule L1); such lookups write no row, so the published bytes do not depend on which statements were looked up. judgment_core's stateless checker verifies declarations and proof chunks (check_declaration, check_theory, check_dag_chunk) in parallel across immutable DagCheckView slices with bounded Scratch allocations; worker concurrency changes no proof semantics and no published byte (G1). Independent ready inferences also compute their conclusions concurrently in private kernel scratch. The producer alone interns those results and commits proof rows, in article order. The checker plans chunks on demand and retains its worker pool and scratch across newly published prefixes.
  3. Publication. Verified rows, statement keys, theorem aliases, and partition provenance are written as integrity-checked kind-6 proof-DAG partitions and a kind-4 format-2.2 manifest (Library / LibraryChange), committed atomically through CURRENT (partition publication). Each local is written with its type and name, followed by the context entry that binds it. Complete codec blocks compress and hash concurrently in bounded groups. One partition can be installed while the next is encoded; metadata and CURRENT are committed only after all owned writes have joined.
  4. Independent readback. Opening a published library (Library.open) and loading a full snapshot (Library.snapshot) or statement-only roots (Library.profile_snapshot and a session's import_theorem or import_theorems) checks container integrity and, for full snapshots, independently rechecks every proof chunk through judgment_core. The supplied profile is the exact permitted axiom basis; names, provenance, and source identities grant no mathematical authority.

Conversion, theorem replay, and snapshot publication share profile construction. Every operation owns its bank and charges its construction work. Identifying a library's profile compares its already checked manifest against immutable, sorted identity descriptors for the classical and Isabelle profiles; it does not build candidate banks or reread CURRENT. Identification grants no trust: loads and imports still compare their actual profile identities.

test_library_profiles rebuilds both profiles and checks the descriptors, and rejects changed, truncated, or reordered lists. After an intentional profile change, regenerate the descriptors against the current Store build with pixi run mojo run -I build/.current scripts/store/generate_profiles.mojo > src/judgment_store/_profile_descriptors.mojo, then rebuild and run that regression. Profile changes require separate review; this mechanism does not change their axioms or serialized form.

judgment v1.0.0 for Mojo 1.2 · Apache License 2.0 with LLVM Exceptions · Source on GitHub