Zulip Chat Archive
Stream: mathlib4
Topic: apply? failure
Nir Paz (Nov 12 2023 at 20:50):
Should apply?
get this?
import Mathlib
def re (n m : ℕ) : Prop := n = m
instance reSetoid : Setoid ℕ where
r := re
iseqv := ⟨Eq.refl, Eq.symm, Eq.trans⟩
example (a b : ℕ) (h : Quotient.mk' a = Quotient.mk' b) : re a b := by apply?
Quotient.exact h
works.
Eric Wieser (Nov 12 2023 at 23:43):
No, because apply?
isn't allowed to look at how you defined re
Eric Wieser (Nov 12 2023 at 23:43):
If you replace it with abbrev re
instead of def re
, which apply?
is allowed to look through, then it works
Nir Paz (Nov 16 2023 at 18:50):
What about this?
import Mathlib
example (P Q : Prop) (h : P → Q) (h' : ¬Q) : ¬P := by exact?
Patrick Massot (Nov 16 2023 at 18:59):
I think this is simply not stated in Mathlib.
Eric Rodriguez (Nov 16 2023 at 18:59):
docs#mt I thought
Eric Rodriguez (Nov 16 2023 at 18:59):
But I thought this may be the performance optimisation stuff
Patrick Massot (Nov 16 2023 at 19:00):
Eric is right and I was wrong.
Scott Morrison (Nov 17 2023 at 01:58):
Eric, Patrick, and I were all wrong. In fact it was a bug (one of the horsemen!) fixed now in std4#368 and #8458.
Nir Paz (Nov 17 2023 at 04:07):
Cool! Is there a rule of thumb for when it's ok for apply to not find a single-theorem-solution, like due to "optimization stuff"?
Nir Paz (Nov 17 2023 at 04:08):
Because I always think of that as a problem and I guess sometimes it's not
Nir Paz (Nov 17 2023 at 04:09):
(Excluding things like my first example with def
s)
Scott Morrison (Nov 17 2023 at 04:13):
As far as I know, after #8458 and #8459 land, I think the claim is:
if you can prove a goal via
apply X; solve_by_elim*
for someX
, thenexact?
should work
and
if you can prove a collection of goals via
apply X; apply Y; ...; apply Z
, where all theX Y Z
are hypotheses, thensolve_by_elim*
should work
These are probably wrong, but I'd be happy to see more examples where they are wrong!
Joachim Breitner (Nov 17 2023 at 06:54):
Great way to phrase the specification for these tactics. Maybe could be part of the docstring?
Last updated: Dec 20 2023 at 11:08 UTC