Skip to content

feat(LambdaCalculus): basics of named representation (alpha equivalence and capture-avoiding substitution)#458

Open
yinhaoxuan wants to merge 9 commits intoleanprover:mainfrom
yinhaoxuan:named_lambda_calculus
Open

feat(LambdaCalculus): basics of named representation (alpha equivalence and capture-avoiding substitution)#458
yinhaoxuan wants to merge 9 commits intoleanprover:mainfrom
yinhaoxuan:named_lambda_calculus

Conversation

@yinhaoxuan
Copy link
Copy Markdown

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)"

@yinhaoxuan yinhaoxuan requested a review from chenson2018 as a code owner March 25, 2026 17:32
Copilot AI review requested due to automatic review settings March 25, 2026 17:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.Basic with α-equivalence (AlphaEquiv), renaming utilities, and capture-avoiding substitution (subst / Subst).
  • Add Named.Untyped.Properties proving 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.

@yinhaoxuan yinhaoxuan requested a review from fmontesi as a code owner March 25, 2026 17:51
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