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: let apply_fun use CoeFun and dependent functions #2890

Closed
wants to merge 4 commits into from

Conversation

kmill
Copy link
Contributor

@kmill kmill commented Mar 15, 2023

Changes apply_fun to use the main function application elaborator, then uses Lean.MVarId.congrN to solve for a congruence proof. This means that apply_fun f at h should work whenever f applies to both sides of the equation h (even when coercions need to be involved).


Open in Gitpod

@kmill kmill added WIP Work in progress t-meta Tactics, attributes or user commands labels Mar 15, 2023
@kmill
Copy link
Contributor Author

kmill commented Mar 15, 2023

@semorrison The TermElab monad ends up being very helpful here, and I was able to delete a lot of what I wrote. Floris mentioned Term.elabAppArgs to me today, which ends up doing most of the work. It's nice being able to use this rather than writing my own half-baked version of the elaborator!

Who would have thought apply_fun could do this?

example (f : ℤ ≃ ℤ) (a b : ℕ) (h : a = b) : True := by
  apply_fun f at h
  guard_hyp h : f a = f b -- coercions on `f`, `a`, and `b`!

@kmill kmill added awaiting-review The author would like community review of the PR and removed WIP Work in progress labels Mar 15, 2023
@semorrison
Copy link
Contributor

bors merge

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review The author would like community review of the PR labels Mar 16, 2023
bors bot pushed a commit that referenced this pull request Mar 16, 2023
Changes `apply_fun` to use the main function application elaborator, then uses `Lean.MVarId.congrN` to solve for a congruence proof. This means that `apply_fun f at h` should work whenever `f` applies to both sides of the equation `h` (even when coercions need to be involved).
@bors
Copy link

bors bot commented Mar 16, 2023

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat: let apply_fun use CoeFun and dependent functions [Merged by Bors] - feat: let apply_fun use CoeFun and dependent functions Mar 16, 2023
@bors bors bot closed this Mar 16, 2023
@bors bors bot deleted the kmill_apply_fun_funlike branch March 16, 2023 04:30
bors bot pushed a commit that referenced this pull request Mar 16, 2023
Now that #2890 is merged, we can restore the line of code in #2850 that had to be changed because of the corresponding bug.



Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has been sent to bors. t-meta Tactics, attributes or user commands
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants