Skip to content

feat(LocallyNameless/Untyped): generalize eta_subst_fvar#667

Open
lengyijun wants to merge 1 commit into
leanprover:mainfrom
awesome-lambda-calculus:eta_subst
Open

feat(LocallyNameless/Untyped): generalize eta_subst_fvar#667
lengyijun wants to merge 1 commit into
leanprover:mainfrom
awesome-lambda-calculus:eta_subst

Conversation

@lengyijun

@lengyijun lengyijun commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

step_subst_cong_l is the more general version

`step_subst_cong_l` is the more general version
@lengyijun lengyijun changed the title feat(LocallyNameless/Untyped): generalize eta_subst_fvar to eta_subst feat(LocallyNameless/Untyped): rm eta_subst_fvar Jun 20, 2026
induction steps with
| refl => rfl
| tail _ step ih => grind [step_subst_cong_l]
exact .single (Xi.abs {x} (by grind [step_subst_cong_l]))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It appears that (at the bottom of Properties) that we are missing a version of close_open_to_subst specialized to first openings, i.e. (m ^* x) ^ n = m [x := n] that if annotated with grind = would make the proof generated here better. Could you add this, please?

s [ x := N ] ⭢ηᶠ s' [ x := N ] := by
induction step
case base h => cases h with | eta lc => exact Xi.base (.eta (subst_lc lc lc_N))
case abs => grind [Xi.abs <| free_union Var, subst_open_var]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Probably better for performance:

Suggested change
case abs => grind [Xi.abs <| free_union Var, subst_open_var]
case abs => apply Xi.abs <| free_union Var; grind

/-- Abstracting then closing preserves a single η-reduction step. -/
lemma step_abs_close {x} (step : M ⭢ηᶠ M') (lc_M : LC M) : (M ^* x).abs ⭢ηᶠ (M' ^* x).abs := by
grind [Xi.abs ∅]
grind [step_subst_cong_l, Xi.abs ∅]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Similarly here

Suggested change
grind [step_subst_cong_l, Xi.abs ∅]
apply Xi.abs ∅
grind [step_subst_cong_l]

@chenson2018 chenson2018 changed the title feat(LocallyNameless/Untyped): rm eta_subst_fvar feat(LocallyNameless/Untyped): generalize eta_subst_fvar Jun 20, 2026
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