-
Notifications
You must be signed in to change notification settings - Fork 437
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
fix: make sure isDefEqSingleton
rule checks types
#6421
Open
kmill
wants to merge
3
commits into
leanprover:master
Choose a base branch
from
kmill:fix_6420
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Lean | ||
/-! | ||
# Testing fix to `isDefEqSingleton` | ||
https://github.com/leanprover/lean4/issues/6420 | ||
-/ | ||
|
||
/-! | ||
The following example used to print `unifiable? true`. | ||
-/ | ||
open Lean | ||
|
||
structure foo where | ||
bar : Nat | ||
|
||
/-- info: unifiable? false -/ | ||
#guard_msgs in | ||
#eval show MetaM Unit from do | ||
let lhs := Expr.const ``foo [] | ||
let m ← Meta.mkFreshExprMVar lhs | ||
let rhs := Expr.app (.const ``foo.bar []) m | ||
let defeq? ← Meta.isDefEq lhs rhs | ||
logInfo m!"unifiable? {defeq?}" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a comment explaining this change? It can be based on the PR description.
Additional requests regarding coding convetion:
let Expr.forallE _ ty ...
=>let .forallE _ ty ...
unless ← isDefEq ty (← inferType v) do
=>unless (← isDefEq ty (← inferType v)) do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
General question about
isDefEq
that came up in a Zulip discussion: some users believe that you are not supposed to useisDefEq
on terms if you have not already ensuredisDefEq
for their inferred types. Is that the case?If so, then this PR is not necessary, but it would raise a bunch of questions for me (I don't recall seeing any meta code that specifically ensured
isDefEq
on inferred types).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have time to context switch to this module right now. Moreover, I feel like this is going to be a really long thread. Let's create one at the Lean FRO Zulip.
BTW, I want to minimize as much as possible changes to
ExprDefEq.lean
, and do it in batches whenever we decide to the context switch.That said, at first sight, this PR is consistent with the current design. We already have functions such as
checkTypesAndAssign
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, were you able to trigger the bug without meta-programming? If not, I prefer to put this PR on hold.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, it's low-priority. I'll let you know if I manage to trigger it without meta-programming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to let you know, I pushed a simple example that uses just the
have
andexact
tactics. (Please feel free to keep this PR on hold.)