import MyNat.Definition
namespace MyNat
open MyNat
Proposition world.
Level 8 : (P → Q) → (¬ Q → ¬ P)
There is a false proposition false
, with no proof. It is easy to check that ¬ Q
is equivalent to
Q ⟹ false
, and in this tutorial we call this
not_iff_imp_false (P : Prop) : ¬ P ↔ (P → false)
which we can prove here using the simp
tactic:
theoremnot_iff_imp_false (not_iff_imp_false: ∀ (P : Prop), ¬P ↔ P → false = trueP :P: PropProp) : ¬Prop: TypeP ↔ (P: PropP →P: Propfalse) :=false: BoolP: Prop¬P ↔ P → false = trueGoals accomplished! 🐙
So you can start the proof of the contrapositive below with
repeat rw [not_iff_imp_false]
to get rid of the two occurrences of ¬
, and I'm sure you can take it from there. At some point
your goal might be to prove false
. At that point I guess you must be proving something by
contradiction. Or are you?
Lemma : contrapositive
If P
and Q
are propositions, and P⟹ Q
, then
¬ Q⟹ ¬ P
.
lemmacontrapositive (contrapositive: ∀ (P Q : Prop), (P → Q) → ¬Q → ¬PPP: PropQ :Q: PropProp) : (Prop: TypeP →P: PropQ) → (¬Q: PropQ → ¬Q: PropP) :=P: PropP, Q: Prop(P → Q) → ¬Q → ¬PP, Q: Prop(P → Q) → ¬Q → ¬PP, Q: Prop(P → Q) → ¬Q → ¬PP, Q: Prop(P → Q) → (Q → false = true) → P → false = trueP, Q: Prop(P → Q) → (Q → false = true) → ¬PP, Q: Prop
f: P → Q(Q → false = true) → P → false = trueP, Q: Prop
f: P → Q
h: Q → false = trueP → false = trueP, Q: Prop
f: P → Q
h: Q → false = true
p: Pfalse = trueP, Q: Prop
f: P → Q
h: Q → false = true
p: PQP, Q: Prop
f: P → Q
h: Q → false = true
p: PPGoals accomplished! 🐙
Technical note
All of that rewriting you did with rw
in addition world was rewriting hypothesis of the form
h : X = Y
, but you can also rw [h]
if h : P ↔ Q
(because propositional extensionality says
that if P ⟺ Q
then P = Q
, and mathematicians use this whether or not they notice.)
Next up Level 9