Skip to content

[Merged by Bors] - fix: return early in library_search if initial solveByElim succeeds#2302

Closed
dwrensha wants to merge 1 commit intomasterfrom
library-search-return-none
Closed

[Merged by Bors] - fix: return early in library_search if initial solveByElim succeeds#2302
dwrensha wants to merge 1 commit intomasterfrom
library-search-return-none

Conversation

@dwrensha
Copy link
Copy Markdown
Member

Fixes a bug introduced in #856.
If solveByElim succeeds, then we should return early. Otherwise, we look through all lemmas in the environment and find something like namedPattern or Eq.mp and unnecessarily wrap the result in that.

See #2276 for an example bad output caused by this bug.

Another example is this test:

example (P : Prop) (p : P) : P := by library_search

On master, it emits exact namedPattern p p rfl, and after this PR it correctly emits exact p.

@gebner
Copy link
Copy Markdown
Member

gebner commented Feb 15, 2023

exact namedPattern p p rfl

We should probably filter out namedPattern/id/outParam/etc. somehow.

bors r+

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Feb 15, 2023
bors bot pushed a commit that referenced this pull request Feb 15, 2023
…2302)

Fixes a bug introduced in #856.
If `solveByElim` succeeds, then we should return early. Otherwise, we look through all lemmas in the environment and find something like `namedPattern` or `Eq.mp` and unnecessarily wrap the result in that.

See #2276 for an example bad output caused by this bug.

Another example is this test: https://github.com/leanprover-community/mathlib4/blob/4ed65899eca4909e9b8f23a113b52ff8cb3f5d41/test/librarySearch.lean#L15
On master, it emits `exact namedPattern p p rfl`, and after this PR it correctly emits `exact p`.
@bors
Copy link
Copy Markdown

bors bot commented Feb 15, 2023

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title fix: return early in library_search if initial solveByElim succeeds [Merged by Bors] - fix: return early in library_search if initial solveByElim succeeds Feb 15, 2023
@bors bors bot closed this Feb 15, 2023
@bors bors bot deleted the library-search-return-none branch February 15, 2023 17:47
mo271 pushed a commit that referenced this pull request Feb 18, 2023
…2302)

Fixes a bug introduced in #856.
If `solveByElim` succeeds, then we should return early. Otherwise, we look through all lemmas in the environment and find something like `namedPattern` or `Eq.mp` and unnecessarily wrap the result in that.

See #2276 for an example bad output caused by this bug.

Another example is this test: https://github.com/leanprover-community/mathlib4/blob/4ed65899eca4909e9b8f23a113b52ff8cb3f5d41/test/librarySearch.lean#L15
On master, it emits `exact namedPattern p p rfl`, and after this PR it correctly emits `exact p`.
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.

2 participants