Skip to content
LeanLearn
Level 2~25 minLean 4

Proving and using OR

To prove 'P or Q' you choose a side. To use it, you must handle both possibilities. Learn left, right and proof by cases.

You will be able to
  • Prove P ∨ Q by proving one side with left or right.
  • Use a hypothesis h : P ∨ Q with rcases, handling both cases.
  • Explain why using an OR requires a proof for each case.

Recommended first: Proving and using AND, OR: at least one. You can start anyway. Nothing is locked.

EncounterActivity 1 of 7

Encounter

Proving P∨QP \lor Q is easier than proving P∧QP \land Q: you only need one side. In Lean, left says "I will prove the left side, PP" and right says "I will prove QQ".

Using h:P∨Qh : P \lor Q is harder. You know one of them is true, but not which. So you must prepare for both: proof by cases.

  • Case 1: suppose PP. Prove the goal.
  • Case 2: suppose QQ. Prove the goal.

In Lean: rcases h with hp | hq creates the two cases. The | separates the alternatives.

Imagine a friend will arrive by bus or by train. To be sure you meet them, you must have a plan for the bus station and a plan for the train station.