Zulip Chat Archive
Stream: general
Topic: formalizing context free grammars and lr parsers
Paige Thomas (Sep 15 2024 at 05:37):
I'm starting to embark on a project to do this, and I'm just wondering if anyone might have any general advice or pointers to resources. So far I have found this and this, and am coding here for now.
Yaël Dillies (Sep 15 2024 at 06:20):
Did you ask @Martin Dvořák ?
Paige Thomas (Sep 15 2024 at 06:22):
No, why?
Yaël Dillies (Sep 15 2024 at 06:22):
Actually, are you at all aware of docs#ContextFreeGrammar ?
Paige Thomas (Sep 15 2024 at 06:22):
yeah, I think this will involve a lot more though.
Yaël Dillies (Sep 15 2024 at 06:23):
Sure, I'm just seeing your Lean file and thinking "The whole first few hundred lines are already in mathlib" :smile:
Paige Thomas (Sep 15 2024 at 06:24):
:)
Rida Hamadani (Sep 15 2024 at 08:21):
There is also #13514
Martin Dvořák (Sep 16 2024 at 07:29):
My main advice is that, if you want your work to be useful for the community, you should not be reïnventing Mathlib.
Instead, look at what Mathlib already has in this directory:
https://github.com/leanprover-community/mathlib4/tree/master/Mathlib/Computability
Create PRs with whatever is missing and you need for your work.
Paige Thomas (Sep 17 2024 at 05:13):
To be honest, the idea of contributing to Mathlib is pretty anxiety inducing. My workflow doesn't tend to lend itself to a stable API.
Violeta Hernández (Sep 17 2024 at 07:47):
Well, that's why the review process exists! We're glad to help suggest improvements.
Riccardo Brasca (Sep 17 2024 at 07:53):
Please don't be stressed about the review! Sometimes it takes time (just because we are all busy) but we are very happy to have new contributors. If you are unsure about anything, feel free to ask here!
Damiano Testa (Sep 17 2024 at 08:01):
Besides, a repository with some developed theory is useful to the community, even if it is not in mathlib!
Ira Fesefeldt (Sep 17 2024 at 08:46):
I felt that overcoming my anxiety this year contributing to mathlib was one of the best ideas to get better at lean, because I felt that the reviews were always very helpful, nice and productive.
Yaël Dillies (Sep 17 2024 at 09:04):
... and I liked your PRs!
Martin Dvořák (Sep 18 2024 at 10:37):
Kayla Thomas said:
To be honest, the idea of contributing to Mathlib is pretty anxiety inducing. My workflow doesn't tend to lend itself to a stable API.
Your repository will still be useful as a standalone project if it is compatible with Mathlib.
Less so if it competes against Mathlib (in the sense that you write your own definitions of DFA, CFG, etc and prove some results about them that are not proved for the DFA, CFG, etc in Mathlib).
Shreyas Srinivas (Sep 18 2024 at 14:24):
Counterpoint, don't focus on integrating things with Mathlib. Freely try things out, and see what works. You can leave the integration with mathlib for a later point. People will still be happy to help.
Shreyas Srinivas (Sep 18 2024 at 14:35):
(deleted)
Paige Thomas (Sep 19 2024 at 05:42):
Thank you all :) I'm kind of leaning towards @Shreyas Srinivas 's suggestion for now, in part because there is a large PhD thesis of HOL4 code on context free grammars that I want to try and translate closely from.
Paige Thomas (Sep 20 2024 at 03:54):
If anyone is interested, this is the HOL4 code: https://github.com/mn200/CFL-HOL
I'm starting with: https://github.com/mn200/CFL-HOL/blob/master/lib/grammarDefScript.sml
Paige Thomas (Sep 20 2024 at 16:36):
(deleted)
Last updated: May 02 2025 at 03:31 UTC