System architecture

Packages and dependencies

judgment is one repository and one versioned system. Its packages have separate responsibilities and a shared Mojo 1.2 toolchain, and all of them are built from the checkout.

The graph

A → B means that A may import B directly. Every package may import std.

termbank        → fp
judgment_core   → termbank, apn_mojo, fp
judgment_shell  → judgment_core, termbank, apn_mojo, fp
judgment_nat    → judgment_shell, judgment_core, termbank, apn_mojo, fp
judgment_search → judgment_shell, judgment_core, fp
scalar          → judgment_shell, judgment_core, termbank, apn_mojo, fp
judgment        → judgment_shell, scalar
judgment_store  → judgment_shell, judgment_core, termbank, apn_mojo, fp
Package Role Trusted
termbank Proof-DAG storage (termbank.dag), budgets, hashing, and error types yes
judgment_core The stateless checking kernel: the only creator of checked verdicts yes
judgment_shell Sessions, proof construction, authoring, theorem storage, law bundles, the engine protocol no
scalar The extended-complex profile its axioms
judgment_nat Natural numbers, induction, and primitive recursion (optional) no
judgment_search Concurrent proof search over session forks (optional) no
judgment The public entry point no
judgment_store Format-2.2 proof-DAG persistence, OpenTheory articles, and checked session interpretations (optional) no

scalar and judgment_nat are theory packages. They declare their theories through judgment_shell's public Session API and the kernel's public rules, so the stateless checker establishes every result they return. scalar admits its profile's axioms (Scalar); judgment_nat admits none: it builds on the classical principles a profile already declares (natural numbers).

The judgment package is the public entry point. It reexports the Session, expression, proof, tactic, and calculation APIs and the explicit Scalar profile builders. Reexports retain their original types and proof semantics. Low-level clients import the stateless checker and construction engine from judgment_core, and proof-DAG storage from termbank and termbank.dag. Implementation packages cannot import the public entry point.

judgment_shell keeps Session in ws_session.mojo and the rest of the session in private modules: its handles (_ws_handles), state and tables (_ws_state), row lookups and names (_ws_rows), terms (_ws_terms), replay (_ws_replay), dependencies and labels (_ws_details), opening and export (_ws_export), transactions and forks (_ws_transactions), and bank snapshots with theorem import and export records (_ws_snapshots). The state's _SessionTables owns the namespace, bindings, imports, provenance, and theorem metadata copied by snapshots and forks, together with their copy-cost accounting. Operation setup and rollback share helpers that preserve spent work and invalidate discarded handles (G3, G6, G9). The module map lists every module. Other packages use only its root exports.

Store is optional. pixi run build produces the default packages; pixi run build-store also produces judgment_store. Scalar and the facade have no dependency on Store. Applications that persist or import proofs opt in with an explicit judgment_store import.

The Isabelle/HOL theories the system uses are not a package. They are judgment_mathlib, a format-2.2 proof-DAG library kept outside the repository and opened with Store's Library (Library.profile_snapshot and a statement-only import of its roots, or Library.snapshot for the whole version, rechecked), so ordinary runs never invoke Isabelle. Scalar does not depend on it: Scalar's model builders take a session and entity names supplied by the caller, which Scalar's model and bridge tests read from the library.

judgment_nat is optional too: pixi run build-nat produces it, and python scripts/suite.py --with-nat selects its tests under tests/nat/; pixi run test-nat runs them with docstrings-nat. No other package imports it.

judgment_search, concurrent proof search, is optional as well: pixi run build-search produces it and pixi run test-search runs its tests under tests/search/ (python scripts/suite.py --with-search). It runs candidate programs on forks of a Session with fp's IO runtime; Session stays synchronous, and no other package, the facade included, imports it.

APN supplies exact integers and rationals. FP Mojo (fp) supplies the algebraic data types, exhaustive matching, and bounded concurrency primitives used across the stack. Both remain external runtime dependencies installed from modular-community at the versions pinned in pixi.toml; both are part of the trusted base. judgment_shell, judgment_nat, scalar, and judgment_store also use fp for their own data types; that use is untrusted like the rest of those packages. The Isabelle bridge is used only to regenerate source articles and is not part of the trusted kernel: proof imports establish judgments through kernel checking. Source provenance does not replace a proof; statement-only imports remain explicit assumptions.

Enforcement and build ownership

scripts/packages.py owns direct import edges, build order, optional components, and the export inventory. The graph supplies transitive prerequisites for the immutable package build and compiler cache. A component rebuild invalidates its consumers without invalidating unrelated packages.

pixi run layering checks every source package, including the optional ones. Cross-package imports must use root exports (plus termbank.dag where permitted); private module paths and relative escapes are rejected. The checker resolves absolute and relative imports before checking the kernel's test-hook restrictions and acyclic internal module graph, and rejects a construction of a Verdict outside judgment_core.checker. pixi run kernel-isolation checks that no checking module of judgment_core reaches the writer of termbank.dag through its imports (KC1.1).

The public facade also has strict private-member lint. Implementation packages retain their own private object machinery and the structural import checks. The lexical checker does not infer receiver types or prove member ownership. Private kernel- and bank-storage access remains prohibited and requires source review; see the trusted base.

The prebuilt core

The prebuilt core is not a package: it is the judgment facade compiled once into a shared library, libjudgment, and in its Store variant libjudgment_store, which also binds the Store's Library, LibraryChange, and Article for persistence and interchange. bindings/generator/generate.py generates its shims (bindings/core/), the ABI description (bindings/abi.json), and the generated layers of a Mojo client (bindings/mojo_client/) and a Python client (bindings/python/) from the facade's public declarations. The shims call only the facade's public API and convert arguments and results, so the core adds no trusted code. pixi run binding-coverage, which layering runs, fails when a public facade overload is neither bound nor skipped with a reason, when a binding names a non-public symbol, or when the generated files are stale.

Package names and identifiers

from judgment import Session is the public authoring import; from judgment_shell import Session names the same type. Low-level checking clients import judgment_core and termbank.dag.

Package names are not part of logical declarations, profile axioms, or stored proof and article formats. The extended-article pragma judgment.extended.N (ST6.5) is a format identifier, not a package name.

Further packages

Algorithms and certification remain separate. Engines are theory-independent: they consume law bundles and the protocol in judgment_shell, and do not import Scalar or the public facade. A new package's direct imports are added to the graph in scripts/packages.py.

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