import Mathlib.Tactic.LeftRight
import Mathlib.Tactic.Basic
import Mathlib.Tactic.Cases
Advanced proposition world.
Level 7: or_symm
Proving that (P ∨ Q) ⟹ (Q ∨ P)
involves an element of danger. intro h
is the obvious start. But
now, even though the goal is an ∨
statement, both left
and right
put you in a situation with
an impossible goal. Fortunately, after intro h
you can do cases h with
. Then something new
happens: because there are two ways to prove P ∨ Q
(namely, proving P
or proving Q
), the
cases
tactic turns one goal into two, one for each case. Each branch is easy to solve
using the left
and right
tactics we used in Level 6.
Lemma
If P
and Q
are true/false statements, then P ∨ Q ⟹ Q ∨ P.
lemmaor_symm (or_symm: ∀ (P Q : Prop), P ∨ Q → Q ∨ PPP: PropQ :Q: PropProp) :Prop: TypeP ∨P: PropQ →Q: PropQ ∨Q: PropP :=P: PropP, Q: PropP ∨ Q → Q ∨ PP, Q: Prop
h: P ∨ QQ ∨ PP, Q: Prop
h: P ∨ QQ ∨ PP, Q: Prop
hp: P
inlQ ∨ PP, Q: Prop
hp: P
inl.hPGoals accomplished! 🐙P, Q: Prop
hq: Q
inrQ ∨ PP, Q: Prop
hq: Q
inr.hQGoals accomplished! 🐙
Next up Level 8