1.6. Exercises
Prove each statement in Lean, replacing sorry with a proof. Download the exercise file Lecture01.lean and open it in VS Code.
Exercise 1. Implication composes.
theorem exercise1 (P Q R : Prop)
(hPQ : P → Q) (hQR : Q → R) : P → R := P:PropQ:PropR:ProphPQ:P → QhQR:Q → R⊢ P → R
All goals completed! 🐙
Exercise 2. Conjunction distributes over disjunction.
theorem exercise2 (P Q R : Prop) :
P ∧ (Q ∨ R) ↔ (P ∧ Q) ∨ (P ∧ R) := P:PropQ:PropR:Prop⊢ P ∧ (Q ∨ R) ↔ P ∧ Q ∨ P ∧ R
All goals completed! 🐙
Exercise 3. Disjunction associates.
theorem exercise3 (P Q R : Prop) :
(P ∨ Q) ∨ R → P ∨ (Q ∨ R) := P:PropQ:PropR:Prop⊢ (P ∨ Q) ∨ R → P ∨ Q ∨ R
All goals completed! 🐙
Exercise 4. This direction of the first De Morgan law is constructive.
theorem exercise4 (P Q : Prop) : ¬P ∨ ¬Q → ¬(P ∧ Q) := P:PropQ:Prop⊢ ¬P ∨ ¬Q → ¬(P ∧ Q)
All goals completed! 🐙
Exercise 5. Peirce's law.C. S. Peirce, On the Algebra of Logic: A Contribution to the Philosophy of Notation, American Journal of Mathematics 7(2), 1885, pp. 180–196. It requires classical reasoning; consider a case analysis on Classical.em P.
theorem exercise5 (P Q : Prop) : ((P → Q) → P) → P := P:PropQ:Prop⊢ ((P → Q) → P) → P
All goals completed! 🐙