Zulip Chat Archive
Stream: lean4
Topic: Contrapositive theorem
Omnikar (Jul 31 2023 at 00:31):
What is the name of the theorem for (p → q) → ¬q → ¬p
?
Scott Morrison (Jul 31 2023 at 00:38):
import Mathlib.Logic.Basic
example : (p → q) → (¬q → ¬p) := Function.mt
Omnikar (Jul 31 2023 at 00:49):
What does mt stand for?
Mac Malone (Jul 31 2023 at 00:54):
@Omnikar modus tollens
Jireh Loreaux (Jul 31 2023 at 01:57):
Scott Morrison said:
import Mathlib.Logic.Basic example : (p → q) → (¬q → ¬p) := Function.mt
Scott, I think you mean:
import Mathlib.Tactic
example : (p → q) → (¬q → ¬p) := by exact? -- Try this: Function.mt
Jireh Loreaux (Jul 31 2023 at 01:58):
Omnikar, exact?
is a tactic that searches the library for the lemma that closes the goal.
Scott Morrison (Jul 31 2023 at 02:15):
Haha!!! I promise I tried that (aiming to post that was why I copied and pasted into a new window!) but mysteriously it didn't work for me. :-)
Jireh Loreaux (Jul 31 2023 at 02:49):
I didn't try it, so maybe it wouldn't have worked for me either!
Kevin Buzzard (Jul 31 2023 at 13:57):
It doesn't work for me either:
import Mathlib.Tactic
example : (p → q) → (¬q → ¬p) := by exact?
/-
`exact?` could not close the goal. Try `apply?` to see partial suggestions.
-/
@David Renshaw can you do your black magic again?
David Renshaw (Jul 31 2023 at 14:12):
weird. If I do
set_option trace.Tactic.librarySearch.lemmas true in
example : (p → q) → (¬q → ¬p) := by
exact?
then I see both mt
and Function.mt
show up as candidates:
[Tactic.librarySearch.lemmas] Candidate library_search lemmas:
[(mt, ),
(asymm, ),
(irrefl, ),
(Iff.not, mp),
(Not.imp, ),
(Iff.not, mpr),
(asymm_of, ),
(not_congr, mpr),
(imp_false, mp),
(not_congr, mp),
(irrefl_of, ),
(Not.intro, ),
(Eq.mpr_not, ),
(Function.mt, ),
...
David Renshaw (Jul 31 2023 at 14:12):
but for some reason neither is selected
Last updated: Dec 20 2023 at 11:08 UTC