Get Started

Getting started

judgment v1.0.0 supports Linux (linux-64, linux-aarch64) and Apple Silicon macOS (osx-arm64) with Mojo 1.2 and Python 3. Both languages call the same compiled shared library (prebuilt core) without recompiling the library on user edits.

Language selector

The Mojo / Python toggle above any code example or API signature applies across the site and persists in browser storage.

1. Install

Python (pip / uv)

For Python 3.10+ on Linux (x86_64, aarch64) and Apple Silicon macOS, install judgment-prover directly from PyPI (no Pixi or compilation required):

pip install judgment-prover
# or: uv add judgment-prover

The wheel bundles the full Store-enabled core (libjudgment_store), the Python package (import judgment), and judgment-fetch-mathlib:

python my_proof.py
judgment-fetch-mathlib   # optional: download judgment_mathlib (589 MiB)

Mojo + Python with Pixi (modular-community)

Once the modular-community channel pull request merges, add judgment to any Pixi project configured with the max, modular-community, and conda-forge channels:

[workspace]
channels = ["https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"]
platforms = ["linux-64", "linux-aarch64", "osx-arm64"]
pixi add judgment mojo=1.2

Then run Mojo or Python directly with no -I, linker flags, or PYTHONPATH:

pixi run mojo run my_proof.mojo
pixi run python my_proof.py

To download the optional verified Isabelle math library (judgment_mathlib, 589 MiB) on demand, call judgment.fetch_mathlib() from Mojo or Python, or run judgment-fetch-mathlib.

2. Or build the core from a source checkout

Clone the repository, install the locked environment with Pixi, and build the prebuilt core:

git clone https://github.com/Spellbound-Mojo/judgment.git
cd judgment
pixi install --locked
pixi run build-core

This produces .cache/prebuilt-core/lib/libjudgment.so on Linux or libjudgment.dylib on macOS.

  • Initial build requirements: approximately 40–50 minutes on 4 cores (~10 GB RAM with 2 parallel workers). On constrained hardware, build serially with pixi run build && pixi run python bindings/build_core.py --jobs 1 (~5 GB RAM).
  • Optional Store support: for versioned binary libraries, OpenTheory interchange, and theory interpretations, run pixi run build-core-store (~3 additional minutes, reusing the compiled default parts).

Once built, editing user proof scripts does not recompile the core.

3. Run a checked proof

From the repository root, run the starter example in either language.

Mojo (links against the thin client in a few seconds):

pixi run core-run docs/examples/library/quick_start_goal.mojo

Python (~30 ms startup, no compilation):

PYTHONPATH=bindings/python pixi run python docs/examples/python/first_proof.py

Output:

Proved: (P and Q) implies (Q and P)
Remaining hypotheses: 0

Interactive Python REPL:

PYTHONPATH=bindings/python pixi run python
from judgment import Session, implies

4. Minimal goal-first proof

The example declares two propositions, assumes \(P \land Q\), projects \(Q\) and \(P\), constructs \(Q \land P\), and checks the resulting theorem in the kernel:

Mojo

quick_start_goal.mojo Download
"""Complete a goal-first proof by composing checked facts directly."""

from judgment import Session, implies


def main() raises:
    var s = Session()
    var P = s.prop("P")
    var Q = s.prop("Q")

    var proof = s.theorem("swap", implies(P & Q, Q & P))
    var h = proof.intro("h")
    proof.exact(proof.conjoin(proof.right(h), proof.left(h)))
    var theorem = proof.finish()
    print(theorem)

Run from the repository root pixi run core-run docs/examples/library/quick_start_goal.mojo

Output

⊢ P ∧ Q → Q ∧ P

Python

quick_start_goal.py Download
"""Complete a goal-first proof by composing checked facts directly."""

from judgment import Session, implies


def main():
    s = Session()
    P = s.prop("P")
    Q = s.prop("Q")

    proof = s.theorem("swap", implies(P & Q, Q & P))
    h = proof.intro("h")
    proof.exact(proof.conjoin(proof.right(h), proof.left(h)))
    theorem = proof.finish()
    print(theorem)


if __name__ == "__main__":
    main()

Run from the repository root PYTHONPATH=bindings/python:docs/examples/python/library pixi run python docs/examples/python/library/quick_start_goal.py

Output

⊢ P ∧ Q → Q ∧ P

Next steps:

5. Symbolic mathematics and persistence

A fresh Session() provides minimal HOL (Prop, equality, connectives, and quantifiers) with no implicit arithmetic axioms.

  • Extended-complex mathematics (Scalar): construct checked profiles with build_scalar, derive guarded equalities with transfer, prove polynomial identities with reify and identity, and search for counterexamples with refute. See Scalar workflows.
  • Binary libraries, OpenTheory, and theory interpretations: build pixi run build-core-store and see Proof libraries & OpenTheory.

6. Direct-package Mojo builds (optional)

Most Mojo and Python workflows run against the prebuilt core, including Session, tactics, Scalar symbolic and numeric tools, Library, Article, and theory interpretations.

Compile Mojo packages directly only when using Mojo-only optional packages (judgment_nat for Peano naturals, judgment_search for concurrent search) or low-level judgment_core / termbank APIs:

pixi run build          # core packages (judgment, scalar, judgment_core, termbank)
pixi run build-nat      # optional judgment_nat
pixi run build-search   # optional judgment_search
pixi run build-store    # optional judgment_store (direct package + fp_mojo IO)

Pass -I build (or -I src) to mojo run or mojo build. For ordinary proof authoring, prefer pixi run core-run to avoid recompiling the library IR on each edit.

Session memory and spill storage

For large workloads, Session provides two memory controls in both Mojo and Python:

  • Workspace memory cap: session.set_memory_limit(bytes) limits live workspace storage (memory_used() / memory_limit()). Exceeding the cap raises LIMIT without modifying the session. You can raise the limit (or pass UInt64.MAX / 2**64 - 1 to uncap it) and retry.
  • Out-of-core spill: session.set_spill_directory("/existing/dir") sets a private spill directory for verified chunks in the shared snapshot bank. Seal the session, reopen the snapshot with Session.open(snapshot), and call spill() to move verified pages to disk while keeping them readable.

What the limit covers

set_memory_limit counts workspace chunk storage. It does not include the shared snapshot bank's 64 MiB spill cache or general allocator overhead, so it is not a process-wide RSS cap. Configure limits and spill directories outside open transactions and child forks.

See Lesson 5.12: Memory limits, spill, and judgment_mathlib for a runnable Mojo and Python example.

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