Using judgment_mathlib

judgment_mathlib

judgment_mathlib is the one binary proof library the system uses: the theorems of Isabelle2025-2 that Scalar's HOL model rests on, with their complete proofs, as a format-2.2 proof-DAG library (proof-DAG format) over the Isabelle profile. Scalar's HOL model and bridges read the theorems they need from it: the H-1 carrier's inputs, the model's axioms and definition correspondences, the bridges, the class instances, the analytic library, and the H-2 interpretation.

The library is data, not a package. No package imports it, and it is not in the repository: it is fetched into a directory of its own and opened with judgment_store's Library.

The pinned version

Version (the manifest identity CURRENT names) dde4c488c83cd03f33345666297fbf42ed7087c7fd6998f1f198970fd4131652
Format proof-DAG library format 2.2 (library header 4, termbank format 2), profile isabelle
Contents the manifest, CURRENT, and 118 proof partitions; 619,490,666 bytes (591 MiB)
Published as library.tar.zst (Git LFS, 616,643,449 bytes) with SHA256SUMS and library-files.sha256, at this repository's tag isabelle-186-root-v6-binary-f2-20261126

The pin is VERSION in scripts/fetch_judgment_mathlib.py and JUDGMENT_MATHLIB_VERSION in Scalar's test support. Opening names the pin explicitly, so a directory whose CURRENT is the pin, or a later version of it, opens at the pin; any other version is refused (FORMAT). This build reads proof-DAG library format 2.2; an incompatible library format is refused with VERSION.

Where it lives

The library's default directory is $XDG_DATA_HOME/judgment_mathlib, or $HOME/.local/share/judgment_mathlib when XDG_DATA_HOME is unset. JUDGMENT_MATHLIB names another directory. Pixi's activation sets JUDGMENT_MATHLIB to the default directory unless it is already set, so in pixi run and pixi shell it names the directory in use.

# From an installed judgment package (Mojo, Python, or CLI — no Git LFS needed):
judgment-fetch-mathlib

# Or programmatically in Mojo or Python (same API in both languages):
#   judgment.fetch_mathlib()           # -> $JUDGMENT_MATHLIB or ~/.local/share/judgment_mathlib
#   judgment.fetch_mathlib("/my/dir")  # -> custom directory

# From a source checkout (fetches via Git LFS tag):
pixi run fetch-judgment-mathlib

scripts/fetch_judgment_mathlib.py fetches the tag from the checkout's origin remote into a temporary bare repository, leaving the checkout's own object store untouched; it needs git with Git LFS, and tar with zstd support. It checks the archive against SHA256SUMS, extracts it, checks every file against library-files.sha256 and CURRENT against the pin, and moves the library into $JUDGMENT_MATHLIB (--dest DIR names another directory). A directory that already holds the pinned version is verified and kept. A directory holding another library fails that verification ("library file missing or changed") and is left as it is; move or remove it, then fetch again. An existing directory without a library is refused. The temporary directory is made beside the destination when its parent exists, and needs room for the archive and the extracted library together, about 1.2 GB.

To install it by hand, without Git LFS, download library.tar.zst, SHA256SUMS and library-files.sha256 from the tag's GitHub release, then:

sha256sum -c SHA256SUMS
tar --zstd -xf library.tar.zst
sha256sum -c library-files.sha256
cat retained-lib6/CURRENT      # the pinned version, dde4c488…

and move retained-lib6 to the library directory.

Scalar's model and bridge gates (pixi run test-scalar-integration) need the library. The checked-native cases run in tests/scalar_tests/integration/test_checked_library.mojo, which loads and rechecks the pinned version once and fails if it is absent. pixi run build and pixi run test run without it. The statement-only model tests and the small judgment_mathlib fixtures report their real-library steps as skipped when none is installed. An unsupported format fails with VERSION.

What it holds

The library is the conversion of one extended OpenTheory article (judgment.extended.6): the 186 roots of the Isabelle theory Judgment_Mathlib.Judgment_Mathlib with their complete proof closure, 3,070 named theorem publications in all (the 186 roots and 2,884 witnesses of type definitions, instances, and class relations). Every definition, type definition, and class they mention is included. Their dependency closure includes Pure, HOL, HOL-Library, HOL-Analysis, and HOL-Computational_Algebra, including formal power series, factorial rings, the Euclidean algorithm, primes, extended numbers, multisets, cardinality, topology, vector spaces, and transcendental functions.

The roots are the inputs and obligations of Scalar's HOL model and bridges, proved in Isabelle; the obligations were generated from scalar's checked kernel terms:

Theorems From Used by
scalar_x8_* Scalar_X8_Imports: exp_add at complex, the carrier's witness, pair and direction facts the H-1 carrier
scalar_x82_* Scalar_Model_Export: the eight axioms and 27 definition correspondences build_model
scalar_x83_* Scalar_Bridge_Export: 26 bridge equations and 14 counterexamples build_bridges
scalar_x84_sum_swap Scalar_Class_Export: the finite-sum theorem used at the class instances build_classes
scalar_x85_* Scalar_Analysis_Export: the analytic laws and special values build_analysis

The Isabelle theory sources are not part of the system. The obligations survive only as the exported proofs inside the library, which the kernel rechecks when it loads the library in full. The names in the table are the library's: its sessions and theories keep their Isabelle names.

Opening it

Everything opens the library with the Store's Library (loading a library), at the pinned version:

var library = Library.open(path, Optional(Identity.from_hex(VERSION)))

# The roots' statements only, over the core and the Isabelle profile:
var session = Session.open(library.profile_snapshot(budget))
var facts = session.import_theorems[Library](library, names)

# The whole version, every partition loaded and every row rechecked:
var whole = Session.open(library.snapshot(budget, workers))
  • Library.open verifies the manifest of the requested version and reads no partition. A directory that does not hold the version is refused (FORMAT or DIGEST), and one that holds a library of an older format with VERSION.
  • Statement import. A session over Library.profile_snapshot holds the logic core and the Isabelle profile, including the profile class HOL.type. import_theorems imports the named roots trusted, with their Isabelle provenance, together with their declaration and signature closure and the whole class layer (ST9.8). No proof is read: a statement-only import remains an explicit assumption. Scalar's model reads its roots this way.
  • The whole version. Library.snapshot(budget, workers) loads all 118 partitions into a fresh bank over the profile and rechecks every row with judgment_core's stateless checker, on workers parallel workers; Library.recheck performs the same check and returns its report. A session over the snapshot has the library's theorems as its own declarations. The H-2 gates open the library this way.

A root's library name is its long name, Judgment_Mathlib.Judgment_Mathlib.<alias>, normalized as ST9.9 says (normalized_theorem_name). In a session, an entity the library declares is named Isabelle.Isabelle2025-2.<session>.<kind>.<qualified>, such as Isabelle.Isabelle2025-2.HOL.constant.Groups.zero_class.zero; the profile's own class HOL.type and constant classical.epsilon keep their names.

Scalar's test support

tests/scalar_tests/support/judgment_mathlib.mojo wraps these calls for Scalar's model and bridge tests. It is test code, not a public API:

Helper Gives
judgment_mathlib_default_path() the default directory
judgment_mathlib_path() JUDGMENT_MATHLIB when it is set and non-empty, else the default directory when it holds a library, else none
judgment_mathlib_version() the pin, JUDGMENT_MATHLIB_VERSION
root_name(alias), root_theory() a root's library name; the root theory's catalogue path
scalar_roots(library, budget) the library names of the scalar_x82_* roots the model reads
open_judgment_mathlib(path, names, budget) a JudgmentMathlib: a session over the profile snapshot with the named roots imported statement-only, the library, and the roots
open_judgment_mathlib_snapshot(path, budget, workers) a session over the whole version, rechecked
judgment_mathlib_full_name(session, kind, name) an entity's session name, by kind (type, constant, class) and theory-qualified name
judgment_mathlib_entities(session, wanted) the (kind, name, session name) rows Scalar's NativeNames table records, all or nothing

JudgmentMathlib.root, full_name, type, class_, and constant look up a root or an entity in its session. Entity lookups probe inside a transaction that is always discarded, so a lookup leaves the session unchanged whether it answers or fails (G9). Both openers refuse a library that is not over the Isabelle profile (LIBRARY). A model or bridge gate that finds no library either says that its steps are skipped or fails; it never runs Isabelle.

The helpers' own tests (tests/judgment_mathlib/test_dag_judgment_mathlib.mojo) run on a small committed library of the same shape, tests/judgment_mathlib/fixtures/dag_judgment_mathlib, converted from dag_judgment_mathlib.art over the Isabelle profile. The test converts the article again and checks it against FIXTURE_VERSION; a fixture in an unsupported format fails the check; dag_judgment_mathlib.mojo regenerates the fixture, as its docstring says.

Isabelle

Using the library needs no Isabelle. Exporting a new article does: scripts/isabelle/isabelle.py pins the official Isabelle2025-2 release and the isabelle_bridge commit, and the tasks isabelle-install, isabelle-check, isabelle-build, and isabelle install, check, build, and run them in the isolated home .cache/isabelle-home. The converter's Isabelle name-override table, scripts/isabelle/isabelle_names.tsv, is the --names input of ST9.9; tests/judgment_mathlib/test_isabelle_names_table.mojo checks it. The repository holds no Isabelle theory and no pipeline that regenerates the article from theories.

Approved subject mapping

The approved classification uses the top two levels of MSC 2020 and the policy choices below. Subject assignments describe placement; they do not establish proof authority.

Approved policy choices

  1. Arities and class relations: retain the declaring theory as the classification origin so an instance and its witness share one traceable home.
  2. Code generation and test tools: use the top-level Computer science (68) for Enum, Main, datatype infrastructure, and numeral encodings.
  3. Foundations: split General logic (03B) (Pure, HOL, Typedef, inductive reasoning) from Set theory (03E) (sets, functions, relations, cardinality, well-founded constructions, BNF theories).
  4. Root families: use Functions of a complex variable (30) for the carrier, model, and bridge families (scalar_x8_*, scalar_x82_*, scalar_x83_*), Combinatorics/Enumerative combinatorics (05A) for finite-sum swapping (scalar_x84_*), and Special functions/Elementary classical functions (33B) for the analysis family (scalar_x85_*).
judgment v1.0.0 for Mojo 1.2 · Apache License 2.0 with LLVM Exceptions · Source on GitHub