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
"""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
"""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:
- Guided sequence: Tutorials (starting at Lesson 1.1: Prove your first theorem).
- Reference: Quick reference and Writing proofs.
- Application integration: Use in your project (Mojo) or Proofs from Python.
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 withbuild_scalar, derive guarded equalities withtransfer, prove polynomial identities withreifyandidentity, and search for counterexamples withrefute. See Scalar workflows. - Binary libraries, OpenTheory, and theory interpretations: build
pixi run build-core-storeand 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 raisesLIMITwithout modifying the session. You can raise the limit (or passUInt64.MAX/2**64 - 1to 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 withSession.open(snapshot), and callspill()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.