Skip to content

feat: helper lemmas for use in the planned strong norm proof#381

Open
WegmannDavid wants to merge 12 commits intoleanprover:mainfrom
WegmannDavid:pr/StrongNorm
Open

feat: helper lemmas for use in the planned strong norm proof#381
WegmannDavid wants to merge 12 commits intoleanprover:mainfrom
WegmannDavid:pr/StrongNorm

Conversation

@WegmannDavid
Copy link

No description provided.

@chenson2018 chenson2018 changed the title added helper lemmas for use in the planned strong norm proof feat: helper lemmas for use in the planned strong norm proof Mar 1, 2026
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.

These are mostly suggestions about style and generality. Please ask if you have questions about anything!

exact subst_lc (LC.abs xs m mem) h_lc
case abs => grind [abs <| free_union Var]
all_goals grind

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please only leave one newline between each theorem.

case abs => grind [abs <| free_union Var]
all_goals grind

/-- Substitution respects a single reduction step. -/
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is now more general than the above, so we should have

/-- Substitution of a locally closed term respects a single reduction step. -/
lemma redex_subst_cong_lc (s s' t : Term Var) (x : Var) (step : s ⭢βᶠ s') (h_lc : LC t) :
    s [ x := t ] ⭢βᶠ s' [ x := t ] := ... -- proof omitted

/-- Substitution respects a single reduction step of a free variable. -/
lemma redex_subst_cong (s s' : Term Var) (x y : Var) (step : s ⭢βᶠ s') :
    s [ x := fvar y ] ⭢βᶠ s' [ x := fvar y ] := by
  grind [redex_subst_cong_lc]

Please note that I tweaked the docstrings a bit.

(The redex_subst_cong name should probably change, but these earliest modules have bad naming in general so I'll come back and do that myself.)

rw [open_close fresh M 0 ?_, open_close fresh M' 0 ?_]
all_goals grind [redex_abs_close]

theorem redex_abs_fvar_finset_exists (xs : Finset Var)
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 I'd add this as a theorem, because it is exactly the definition of the constructor. Anywhere (like below in steps_open_l_abs) you would use this, you can just do cases on the M.abs ⭢βᶠ M'.abs and get the same result.

Copy link
Author

Choose a reason for hiding this comment

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

You are right.

· apply ih_l
· grind[Term.subst_lc, FullBeta.step_lc_r]

lemma steps_subst_cong2 {x : Var} (s t t' : Term Var) (step : t ↠βᶠ t') (h_lc : LC s) :
Copy link
Collaborator

Choose a reason for hiding this comment

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

A better name without a number?

Copy link
Author

Choose a reason for hiding this comment

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

steps_subst_cong_r? I was not sure how to name many of these, I did not yet figure out the naming algorithm behind the existing lemmas.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems fine. (As I think I mentioned elsewhere I need to overhaul the naming for these modules, so any difficultly picking names is probably my fault!)

LcAt i (M⟦i ↝ N⟧) → LcAt (i + 1) M := by
induction M generalizing i <;> try grind

lemma open_abs_lc [HasFresh Var] : forall {M N : Term Var},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use named hypotheses here.

WegmannDavid and others added 10 commits March 1, 2026 11:52
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
@chenson2018
Copy link
Collaborator

Please also add a short description to the PR.

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