Zulip Chat Archive
Stream: mathlib4
Topic: minor bug in `lift` tactic
Johan Commelin (Jul 06 2024 at 05:13):
MWE
import Mathlib.Tactic.Lift
abbrev MyNat := ℕ
example (n : ℤ) (hn : n ≥ 0) : True := by
lift n to MyNat using hn
-- type of `n` is `ℕ` instead of `MyNat`, in the goal state
trivial
Johan Commelin (Jul 06 2024 at 05:14):
This means that we can not use dot-notation on n
for all the juicy decls in the MyNat
namespace.
Eric Wieser (Jul 06 2024 at 09:07):
Does this work using def
?
Kevin Buzzard (Jul 06 2024 at 09:39):
This works fine for me with (oh I see, it's supposed to compile). The same phenomenon occurs with example
on a recent master...def
.
Vincent Beffara (Jul 06 2024 at 09:49):
You can always do this
import Mathlib.Tactic.Lift
abbrev MyNat := ℕ
example (n : ℤ) (hn : n ≥ 0) : True := by
lift n to MyNat using hn
change MyNat at n
trivial
but it's annoying
Kevin Buzzard (Jul 06 2024 at 10:43):
Right but I would imagine that this still counts as a minor bug.
Johan Commelin (Jul 06 2024 at 16:34):
Right, I am using change
right now. But it shouldn't be needed.
Kyle Miller (Jul 06 2024 at 18:16):
I was trying to step through what lift
roughly does, but the way I'm doing it preserves MyNat
:
abbrev MyNat := ℕ
example (n : ℤ) (hn : n ≥ 0) : True := by
have := @CanLift.prf ℤ MyNat _ _ _ n hn
obtain ⟨n', hn'⟩ := this
subst hn'
/-
n' : MyNat
hn : ↑n' ≥ 0
⊢ True
-/
I'm not sure what the deal is exactly.
Kyle Miller (Jul 06 2024 at 18:18):
I noticed that lift
uses simp
to substitute away the variable. That can be done more efficiently and accurately with subst
Johan Commelin (Aug 16 2024 at 07:55):
Filed as
lift tactic does not respect abbreviations #15865
Last updated: May 02 2025 at 03:31 UTC