1.10. 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! 🐙
Exercise 6. Disjunction distributes over conjunction.
theorem exercise6 (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 7. An implication into a conjunction splits into two implications.
theorem exercise7 (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 8. From a disjunction and the negation of one disjunct, the other holds.
theorem exercise8 (P Q : Prop) : (P ∨ Q) → ¬P → Q := P:PropQ:Prop⊢ P ∨ Q → ¬P → Q
All goals completed! 🐙
Exercise 9. No proposition is equivalent to its own negation.
theorem exercise9 (P : Prop) : ¬(P ↔ ¬P) := P:Prop⊢ ¬(P ↔ ¬P)
All goals completed! 🐙
Exercise 10. Of any two propositions, one implies the other. It requires classical reasoning; consider a case analysis on Classical.em P.
theorem exercise10 (P Q : Prop) : (P → Q) ∨ (Q → P) := P:PropQ:Prop⊢ (P → Q) ∨ (Q → P)
All goals completed! 🐙