Newclid
Newclid is an open-source, easy-to-use fast solver for plane geometry problems.
Installation
Using uv (recommended)
Follow uv installation instructions
uv add newclid[yuclid]
Using pip
pip install newclid[yuclid]
Building from source
Follow uv installation instructions
git clone https://github.com/Newclid/Newclid.git
cd Newclid
uv sync
If you run into issues to build yuclid, you might need to set an environment variable like CXX=/usr/bin/g++-14, try adding environment variable that are present in .env. If you still have issues, submit an issue.
Quickstart
To simply solve a problem using Newclid, use the command line.
For example with a JGEX problem:
newclid jgex --problem-id orthocenter_consequence_aux --file ./problems_datasets/examples.txt
Or with a ggb problem:
newclid ggb --file ./notebooks/ggb_exports/incenter.ggb --goals "eqangle C B B D B D B A"
See other command line interface options with:
newclid --help
newclid jgex --help
newclid ggb --help
For more complex applications, use the Python interface. Below is a minimal example to build a problem setup from a JGEX string, then solve it:
from newclid import GeometricSolverBuilder, GeometricSolver
import numpy as np
# Set the random generator
rng = np.random.default_rng()
# Build the problem setup from JGEX string
problem_setup = JGEXProblemBuilder(rng=rng).with_problem_from_txt(
"a b c = triangle a b c; "
"d = on_tline d b a c, on_tline d c a b; "
"e = on_line e a c, on_line e b d "
"? perp a d b c"
).build()
# We now build the solver on the problem
solver: GeometricSolver = GeometricSolverBuilder().build(problem_setup)
# And run the solver
success = solver.run()
if success:
print("Successfuly solved the problem! Proof:")
solver.write_proof_steps()
else:
print("Failed to solve the problem...")
print(f"Run infos {solver.run_infos}")
In the notebooks
folder you will find more tutorials, for example:
imo_2025.ipynb
to run and solve a problem from the IMO 2025 P2 problem and build the animated proof.
geogebra_problem.ipynb
to run and solve a problem from a ggb file.
jgex_problem.ipynb
to run and solve a problem from a JGEX string.
multiple_JGEX_problems.ipynb
to run and solve problems from a file with multiple JGEX problems, one at a time or in bulk.
heuristics_implementation.ipynb
to run a collection of problems and try to solve them using human-made heuristics to add auxiliary points to a problem.
You can also check tests
to see some more advanced examples of scripts using the Python interface.
Documentation
See the online documentation for more detailed information about Newclid.
Contributing
Clone the repository
git clone https://github.com/Newclid/Newclid.git
cd Newclid
Install uv
Follow installation instructions
Install as an editable package with dev requirements
uv sync
Install pre-commit and pre-push checks
pre-commit install -t pre-commit -t pre-push
Run tests
pytest tests
About Newclid
Newclid is a successor to AlphaGeometry, introduced in this early 2024 Nature paper: Solving Olympiad Geometry without Human Demonstrations. whose original codebase can be found here.
If you found Newclid useful, please cite us as:
@article{newclid2024sicca,
author = {Sicca, Vladmir and Xia, Tianxiang and F\'ed\'erico, Math\"is and Gorinski, Philip John and Frieder, Simon and Jui, Shangling},
journal = {arXiv preprint},
title = {Newclid: A User-Friendly Replacement for AlphaGeometry with Agentic Support},
year = {2024}
}
The AlphaGeometry checkpoints and vocabulary are made available under the terms of the Creative Commons Attribution 4.0 International (CC BY 4.0) license. You can find details at: https://creativecommons.org/licenses/by/4.0/legalcode