Skip to content

feat: demo DFS with mathlib Graph and TimeM - #804

Draft
Shreyas4991 wants to merge 1 commit into
leanprover:mainfrom
Shreyas4991:graph_algo_example
Draft

feat: demo DFS with mathlib Graph and TimeM#804
Shreyas4991 wants to merge 1 commit into
leanprover:mainfrom
Shreyas4991:graph_algo_example

Conversation

@Shreyas4991

@Shreyas4991 Shreyas4991 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Disclosure : This PR is not meant to be merged. Please do not review this PR with marging in mind. This PR is meant to demonstrate a point.

This PR is a demo that graph algorithms in the TimeM framework can indeed be built with mathlib's graph API and an adjacency list constructor. This PR is not meant to be merged. I believe the adjacency list constructor API belongs in mathlib. It serves to demonstrate that the claim made in #503 that graph theory needs to be reinvented to implement and verify graph algorithms.

AI Acknowledgement : I gave explicit instructions to codex on how to generate the adjacency list API and how to write the DFS algorithm on this structure and prove its correctness and time complexity. I also explicitly instructed codex to cost (tick) the DFS code in the TimeM writer monad at all data structure operations following the textbook analysis. I explicitly instructed codex to write DFS using two tail recursive loops. I do not vouch for the complete accuracy of this code, but I have skimmed it and all seems fine.

@Shreyas4991 Shreyas4991 changed the title feat: demo dis with mathlib Graphs and TimeM feat: demo DFS with mathlib Graphs and TimeM Aug 15, 2026
@Shreyas4991 Shreyas4991 changed the title feat: demo DFS with mathlib Graphs and TimeM feat: demo DFS with mathlib Graph and TimeM Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant