feat(LambdaCalculus): basics of named representation (alpha equivalence and capture-avoiding substitution)#458
Open
yinhaoxuan wants to merge 9 commits intoleanprover:mainfrom
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds the first core results for a named untyped lambda-calculus development in CSLib, including α-equivalence and capture-avoiding substitution properties, complementing the existing Basic definitions.
Changes:
- Extend
Named.Untyped.Basicwith α-equivalence (AlphaEquiv), renaming utilities, and capture-avoiding substitution (subst/Subst). - Add
Named.Untyped.Propertiesproving key metatheory: α-equivalence is an equivalence relation and substitution lemmas (incl. commutativity/substitution lemma). - Introduce supporting lemmas about variables, renaming, contexts, and preservation results.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
Cslib/Languages/LambdaCalculus/Named/Untyped/Basic.lean |
Defines the syntax and core operations (fv/bv/vars, rename, α-equivalence, substitution + notation support). |
Cslib/Languages/LambdaCalculus/Named/Untyped/Properties.lean |
Adds theorems establishing α-equivalence properties and capture-avoiding substitution metatheory. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Named representation of untyped lambda calculus.
Basic.lean
First, we define a naive variable renaming.
Second, we define alpha-equivalence according to "Gabbay and Pitts, A New Approach to Abstract Syntax with Variable Binding, 2002".
Third, we define capture-avoiding substitution.
Properties.lean
AlphaEquiv.refl: reflexivity of alpha-equivalence
AlphaEquiv.symm: symmetry of alpha-equivalence
AlphaEquiv.trans: transitivity of alpha-equivalence
Subst.relation_iff_function: the relational and functional definition of capture-avoiding substitution are equivalent, modulo alpha-equivalence
subst.commutativity: commutativity of substitution, more commonly known as "substitution lemma (e.g. in Barendregt 1984)"