Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(data/pfun): Remove unneeded assumption from pfun.fix_induction #12920

Closed
wants to merge 2 commits into from

Conversation

prakol16
Copy link
Collaborator

@prakol16 prakol16 commented Mar 24, 2022

Removed a hypothesis from pfun.fix_induction. Note that it was two "layers" deep, so this is actually a strengthening. The original can be recovered by

/-- A recursion principle for `pfun.fix`. -/
@[elab_as_eliminator] def fix_induction_original
  {f : α →. β ⊕ α} {b : β} {C : α → Sort*} {a : α} (h : b ∈ f.fix a)
  (H : ∀ a', b ∈ f.fix a' →
    (∀ a'', /- this hypothesis was removed -/ b ∈ f.fix a'' → sum.inr a'' ∈ f a' → C a'') → C a') : C a :=
by { apply fix_induction h, intros, apply H; tauto, }

Note that eval_induction copies this syntax, so the same argument was removed there as well.

This allows for some simplifications of other parts of the code. Unfortunately, it was hard to figure out what was going on in the very dense parts of tm_to_partrec.lean and partrec.lean. I mostly just mechanically removed the hypotheses that were unnecessarily being supplied, and then checked if that caused some variable to be unused and removed that etc. But I cannot tell if this allows for greater simplifications.

I also extracted two lemmas fix_fwd and fix_stop that I thought would be useful on their own.


Open in Gitpod

@prakol16 prakol16 added the awaiting-review The author would like community review of the PR label Mar 25, 2022
@digama0
Copy link
Member

digama0 commented Mar 25, 2022

bors r+

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Mar 25, 2022
bors bot pushed a commit that referenced this pull request Mar 25, 2022
…12920)

Removed a hypothesis from `pfun.fix_induction`. Note that it was two "layers" deep, so this is actually a strengthening. The original can be recovered by

```lean
/-- A recursion principle for `pfun.fix`. -/
@[elab_as_eliminator] def fix_induction_original
  {f : α →. β ⊕ α} {b : β} {C : α → Sort*} {a : α} (h : b ∈ f.fix a)
  (H : ∀ a', b ∈ f.fix a' →
    (∀ a'', /- this hypothesis was removed -/ b ∈ f.fix a'' → sum.inr a'' ∈ f a' → C a'') → C a') : C a :=
by { apply fix_induction h, intros, apply H; tauto, }
```

Note that `eval_induction` copies this syntax, so the same argument was removed there as well.

This allows for some simplifications of other parts of the code. Unfortunately, it was hard to figure out what was going on in the very dense parts of `tm_to_partrec.lean` and `partrec.lean`. I mostly just mechanically removed the hypotheses that were unnecessarily being supplied, and then checked if that caused some variable to be unused and removed that etc. But I cannot tell if this allows for greater simplifications.

I also extracted two lemmas `fix_fwd` and `fix_stop` that I thought would be useful on their own.
@bors
Copy link

bors bot commented Mar 25, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/pfun): Remove unneeded assumption from pfun.fix_induction [Merged by Bors] - feat(data/pfun): Remove unneeded assumption from pfun.fix_induction Mar 25, 2022
@bors bors bot closed this Mar 25, 2022
@bors bors bot deleted the pfun_strengthen_induction branch March 25, 2022 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants