Skip to content

Conversation

Linyxus
Copy link

@Linyxus Linyxus commented Aug 13, 2025

This adds a mechanisation of System Fsub in a home-brewed style which I call "well-scoped" style. The two key ingredients are intrinsically scoped de Bruijn indices for by-construction well-formedness and context morphisms for a uniform infrastructure of context manipulation (weakening, narrowing, substitution, etc). See the entry file for more details.

@Linyxus Linyxus requested a review from a team as a code owner August 13, 2025 15:17
@fmontesi fmontesi requested a review from chenson2018 as a code owner August 27, 2025 14:16
Copy link
Collaborator

@chenson2018 chenson2018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have left review comments mostly pertaining to style and making proofs more compact. I think grind would help here, but do not consider it a blocking requirement.

As I mentioned on the Zulip, the biggest thing we do require is documentation, ideally for every theorem, definition, and inductive.

@@ -0,0 +1,2 @@
import Cslib.Computability.LambdaCalculus.WellScoped.FSub.Substitution.Core
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that this style of reexports is necessary, do you have any thoughts @fmontesi?

@Linyxus
Copy link
Author

Linyxus commented Aug 28, 2025

Thanks @chenson2018 a lot for your reviews! My bandwidth is a bit jammed recently so I didn't improve the documentation as promised. I will get back to it, addressing the reviews, improving docs and compacting proofs ASAP.

@Linyxus
Copy link
Author

Linyxus commented Sep 14, 2025

I have populated the files and definitions with documentation, and addressed most of the comments (except for those I didn't mark as resolved). Thanks again for these feedbacks!

@Linyxus Linyxus requested a review from chenson2018 September 14, 2025 12:19
@Linyxus
Copy link
Author

Linyxus commented Sep 14, 2025

regarding paper references for this approach, I believe the one used by AutoSubst2 is really close.

@chenson2018
Copy link
Collaborator

Thanks for addressing the review comments. I will take a look again this week. Regarding your comment:

regarding paper references for this approach, I believe the one used by AutoSubst2 is really close.

I have also been looking at porting some formalization in the Autosubst2 style to Lean. I think what we may want to do is first add well-scoped STLC. This may make this PR take a little more time, but ensure we end up with consistency between them. (I am not asking you to do this, I will write it).

@Linyxus
Copy link
Author

Linyxus commented Sep 14, 2025

Sure! I just finished a draft on a tutorial of this "well-scoped" approach and am putting it on arXiv. Can be an interesting reference too for this PR.

Regarding autosubst2, I think another thing that is really interesting & valuable to have is a "port" of it in Lean (or something like it that generates boilerplates). I have repeated the boilerplate of this approach for various calculi and am a bit tired of it. 😂 I can image such a tool will be a hyper productivity boost.

@chenson2018
Copy link
Collaborator

chenson2018 commented Sep 14, 2025

Regarding autosubst2, I think another thing that is really interesting & valuable to have is a "port" of it in Lean (or something like it that generates boilerplates). I have repeated the boilerplate of this approach for various calculi and am a bit tired of it. 😂 I can image such a tool will be a hyper productivity boost.

Yes, I agree! I have been thinking this over for a while actually. Regarding the implementation, I think because of Lean's metaprogramming features, we could natively write something that looks like the MetaCoq implementation of Austosubst2. (I've also been tossing around the idea of if features like attributes could change the user interface for the better)

I am currently auditing a semantics course using Autosubst2 and was planning to try to follow along with making a Lean port. When I have the start of something I'll ping you for your thoughts!

Lean linter is doing more and more things, no?
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.

2 participants