patrik-cihal/lean-graph
Theorem relational dependencies automatic extraction and visualization as a graph for Lean4.
{ "createdAt": "2023-12-08T15:13:51Z", "defaultBranch": "main", "description": "Theorem relational dependencies automatic extraction and visualization as a graph for Lean4.", "fullName": "patrik-cihal/lean-graph", "homepage": "", "language": "Rust", "name": "lean-graph", "pushedAt": "2025-09-19T12:10:48Z", "stargazersCount": 37, "topics": [], "updatedAt": "2025-11-14T21:51:46Z", "url": "https://github.com/patrik-cihal/lean-graph"}Lean Graph
Section titled “Lean Graph”Interactive visualization of dependencies for any theorem/definitions in your Lean project.
![Fermat last theorem four]!(fermat-last-theorem-4-example.png)
How to use
Section titled “How to use”(NO LONGER SUPPORTED) Run in your browser: lean-graph.com
Section titled “(NO LONGER SUPPORTED) Run in your browser: lean-graph.com”Run locally
Section titled “Run locally”- Get Rustup
- Install
Lean Graphby executing this command in your terminal:cargo install --git "https://github.com/patrik-cihal/lean-graph" - Run
Lean Graphfrom the terminmal under the namelean-graph
Extracting graph from .lean files
Section titled “Extracting graph from .lean files”- Copy the
DependencyExtractor.leaninto your project folder (either from GitHub, or download it in the web app) - In the top of the file import the files where are the theorems/definitions you want to extract the graph for
- In the bottom of the file there is an #eval line where you can specify your own custom theorem/definition name
- Uncomment that same line to get the
.jsonfile
What’s next
Section titled “What’s next”Additional features
Section titled “Additional features”- After clicking on node, allow for seeing the documentation
- Lazy loading of depending nodes
- Option to visualize any Mathlib constant, without the need of running script locally
If you want to see these features, any contribution is welcome.