Solver for plane geometric problems.
Project description
Newclid is an open-source, easy-to-use fast solver for plane geometry problems.
Installation
Using pip
pip install newclid[yuclid]
From source
git clone https://github.com/Newclid/Newclid.git
cd Newclid
pip install -e .[yuclid]
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:
uv run newclid --help
uv run newclid jgex --help
uv run 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:
The Jupyter tutorial notebook geogebra_problems.ipynb to run and solve a problem from a ggb file.
The Jupyter tutorial notebook jgex_problems.ipynb to run and solve a problem from a JGEX string.
The Jupyter tutorial notebook multiple_JGEX_problems.ipynb to run and solve problems from a file with multiple JGEX problems, one at a time or in bulk.
The Jupyter tutorial notebook 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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file newclid-3.0.0.tar.gz.
File metadata
- Download URL: newclid-3.0.0.tar.gz
- Upload date:
- Size: 358.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae8fcd87524ab55018aebe475c83274834c0f099fb4ea37a0b44a8b0b8b2d8da
|
|
| MD5 |
48273f0d942365f56fca3f44c07b45ab
|
|
| BLAKE2b-256 |
31e1e057f267470f2a72a1ce004bb41d660db945b5ae46c0783aadee9e5b44fb
|
Provenance
The following attestation bundles were made for newclid-3.0.0.tar.gz:
Publisher:
publish-newclid.yml on Newclid/Newclid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
newclid-3.0.0.tar.gz -
Subject digest:
ae8fcd87524ab55018aebe475c83274834c0f099fb4ea37a0b44a8b0b8b2d8da - Sigstore transparency entry: 392437993
- Sigstore integration time:
-
Permalink:
Newclid/Newclid@468dd8e1a900e7a80579b00e3a5040f454dc2cb6 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/Newclid
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-newclid.yml@468dd8e1a900e7a80579b00e3a5040f454dc2cb6 -
Trigger Event:
release
-
Statement type: