The monadic formulation of the strongly-connected component algorithm caught my attention; it's really elegant and concise. I hope that the https://github.com/leanprover/functional_programming_in_lean book will eventually explain the nifty Lean4 programming tricks involved!
I would like to use this library to formulate in Lean4 some algorithms I've been working on in Scala3; see: https://github.com/NicolasRouquette/scala3-bundle-closure
However, the current Graph library is tied to Lean4's symbols as graph vertices:
https://github.com/yatima-inc/yatima-lang/blob/ada78d298e08e495b307cb639f4305731f3af663/Yatima/Compiler/Graph.lean#L32-L34
So as a fun exercise to flex my new Lean4 programming brain, I extracted your library and parameterized it:
https://github.com/NicolasRouquette/YatimaGraphLib
To facilitate comparison w/ your original source, I've kept the same file/directory organization & names.
In writing a simple test, I noticed that the buildG function should add the edge target as a vertex in the map.
See:
https://github.com/NicolasRouquette/YatimaGraphLib/blob/d74377ead019a05a43b11b0fff535abe3b3466dd/src/lean4/Yatima/Compiler/Graph.lean#L28:L36
If this idea makes sense, are you interested in a PR?
The monadic formulation of the strongly-connected component algorithm caught my attention; it's really elegant and concise. I hope that the https://github.com/leanprover/functional_programming_in_lean book will eventually explain the nifty Lean4 programming tricks involved!
I would like to use this library to formulate in Lean4 some algorithms I've been working on in Scala3; see: https://github.com/NicolasRouquette/scala3-bundle-closure
However, the current Graph library is tied to Lean4's symbols as graph vertices:
https://github.com/yatima-inc/yatima-lang/blob/ada78d298e08e495b307cb639f4305731f3af663/Yatima/Compiler/Graph.lean#L32-L34
So as a fun exercise to flex my new Lean4 programming brain, I extracted your library and parameterized it:
https://github.com/NicolasRouquette/YatimaGraphLib
To facilitate comparison w/ your original source, I've kept the same file/directory organization & names.
In writing a simple test, I noticed that the
buildGfunction should add the edge target as a vertex in the map.See:
https://github.com/NicolasRouquette/YatimaGraphLib/blob/d74377ead019a05a43b11b0fff535abe3b3466dd/src/lean4/Yatima/Compiler/Graph.lean#L28:L36
If this idea makes sense, are you interested in a PR?