-
Notifications
You must be signed in to change notification settings - Fork 439
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
chore: ensure that the rfl
tactic tries Iff.rfl
#5359
Conversation
Iff.rfl
with @[refl]
Iff.rfl
(and not Iff.refl
) with @[refl]
leanprover-community-mathlib4-bot
commented
Sep 16, 2024
•
edited by leanprover-community-bot
Loading
edited by leanprover-community-bot
Mathlib CI status (docs):
|
64cf780
to
5ba85ce
Compare
Just curious: When does the difference matter? |
Iff.rfl
(and not Iff.refl
) with @[refl]
@[refl]
from Iff.refl
to Iff.rfl
When it's in leanprover-community/mathlib4#16839. And I needed no adaptation of mathlib at all here, unlike #5329. |
Hmm, but can you explain why it makes a difference? Because I’d expect the argument is solved by unification with the goal in any case. Compare (e.g. on https://live.lean-lang.org/, without mathlib and without #5329 yet) that both these work: attribute [refl] Iff.refl
example : True ↔ True := by apply_rfl attribute [refl] Iff.refl
example : True ↔ True := by apply_rfl |
For the simple reason that /-- The order on `DFinsupp`s over a partial order embeds into the order on functions -/
def orderEmbeddingToFun : (Π₀ i, α i) ↪o ∀ i, α i where
toFun := DFunLike.coe
inj' := DFunLike.coe_injective
map_rel_iff' := by exact Iff.refl I get the very explanatory error
|
Ah, but lean4/src/Lean/Meta/Tactic/Rfl.lean Line 68 in 45af92f
I’d expect (Sorry for being an annoying reviewer her, but I’d just make sure we are not missing something here. Also in light of the imminent changes to the |
@nomeata /-- The order on `DFinsupp`s over a partial order embeds into the order on functions -/
def orderEmbeddingToFun : (Π₀ i, α i) ↪o ∀ i, α i where
toFun := DFunLike.coe
inj' := DFunLike.coe_injective
map_rel_iff' := by apply Iff.refl
But it succeeds if implicit variables are pulled away first: /-- The order on `DFinsupp`s over a partial order embeds into the order on functions -/
def orderEmbeddingToFun : (Π₀ i, α i) ↪o ∀ i, α i where
toFun := DFunLike.coe
inj' := DFunLike.coe_injective
map_rel_iff' {a b} := by apply Iff.refl -- `Iff.rfl` works here too |
Interesting, so it's the implicit variables in the goal that matter here! That might explain some of the adaption changes I had to do for my changes to If with Maybe a test case should go with this PR to test this corner case behavior, and to make sure it isn't broken again in the future. |
How am I to write a test case? What should I put in there? |
Some small, self-contained code that breaks with current |
@nomeata I'm still confused. On current master this is what is working (without a /-- The order on `DFinsupp`s over a partial order embeds into the order on functions -/
def orderEmbeddingToFun : (Π₀ i, α i) ↪o ∀ i, α i where
toFun := DFunLike.coe
inj' := DFunLike.coe_injective
map_rel_iff' := by rfl In the testing branch for this PR it actually breaks. I can't find any code that works in this testing branch but not on master. |
Now I am confused, then what is this PR fixing? |
In short, you were wrong to make me remove the macro in #5329. The lack of that macro is what led @semorrison to have me add adaptation notes in leanprover-community/mathlib4#16839. I am now trying to make a mathlib-free test case that works on master but breaks on import Mathlib.Logic.Equiv.Defs
import Mathlib.Order.Basic
universe u v
structure DFinsupp (β : Nat → Type u) where
instance {β} : DFunLike (DFinsupp β) Nat β := sorry
variable {α : Nat → Type u} [∀ i, LE (α i)]
instance : LE (DFinsupp α) := ⟨fun f g ↦ ∀ i, f i ≤ g i⟩
example : ∀ {a b : DFinsupp α}, DFunLike.coe a ≤ DFunLike.coe b ↔ a ≤ b := by
rfl |
Hmm, yes, that may be. Or maybe I was wrong to rely on “OK, mathlib builds now. The necessary modifications were very small.” In any case, clearly the lean4 test suite is insufficient, else it is hard to tell which behaviours are accidential and which are a feature. Thanks for condensing the issue! |
@[refl]
from Iff.refl
to Iff.rfl
rfl
tactic tries Iff.rfl
Thanks for the test case! That helped to understand the issue better; the underlying problem here is that |
@nomeata, do you think it is reasonable to proceed with this PR in the meantime? It would allow us cleaning up the four regressions on Mathlib's nightlty-testing. |
Hmm, wouldn’t it be better to understand if they are really regressions, or use of an “accidental feature” first? |
But fair enough, we can change later. If |
Revert the removal of the macro containing
Iff.rfl
in #5329; it was causing errors in leanprover-community/mathlib4#16839.