* Unit 3 --- Propositions and Proofs :PROPERTIES: :CUSTOM_ID: unit-3-propositions-and-proofs :END: *Tutorial 1: Lean 4 Fundamentals* · [[../README.org][← Back to README]] ** Goals :PROPERTIES: :CUSTOM_ID: goals :END: - Understand propositions as types (Curry-Howard) - Write basic proofs using =example= and =theorem= - Use the tactic language: =intro=, =apply=, =exact=, =have= ** Source :PROPERTIES: :CUSTOM_ID: source :END: /Theorem Proving in Lean 4/ (TPIL), Chapters 2--3 → https://leanprover.github.io/theorem_proving_in_lean4/ ** Concepts :PROPERTIES: :CUSTOM_ID: concepts :END: | Concept | Lean | |---------------------+-------------------------------------------------------------| | Proposition | =P : Prop= --- a type whose terms are proofs | | Implication =P → Q= | Function from proofs of =P= to proofs of =Q= | | Conjunction =P ∧ Q= | =And.intro= (constructor), =.left= / =.right= (projections) | | Disjunction =P ∨ Q= | =Or.inl= / =Or.inr= | | Negation =¬ P= | =P → False= | | Tactics | =intro=, =apply=, =exact=, =have=, =assumption= | ** Exercises :PROPERTIES: :CUSTOM_ID: exercises :END: *** Exercise 3.1 --- Implicational logic :PROPERTIES: :CUSTOM_ID: exercise-3.1-implicational-logic :END: #+begin_src lean -- (a) Identity theorem id_prop (A : Prop) : A → A := by intro h exact h -- (b) Composition theorem compose (A B C : Prop) : (A → B) → (B → C) → (A → C) := by sorry -- (c) Currying theorem curry (A B C : Prop) : (A → B → C) → (A ∧ B → C) := by sorry #+end_src *** Exercise 3.2 --- Conjunction and disjunction :PROPERTIES: :CUSTOM_ID: exercise-3.2-conjunction-and-disjunction :END: #+begin_src lean -- (a) Swap conjuncts theorem and_comm (A B : Prop) : A ∧ B → B ∧ A := by sorry -- (b) Disjunction is symmetric theorem or_comm (A B : Prop) : A ∨ B → B ∨ A := by sorry -- (c) Forward reasoning with `have` theorem forward_example (A B C : Prop) (h1 : A → B) (h2 : B → C) (ha : A) : C := by have hb : B := h1 ha sorry #+end_src *** Exercise 3.3 --- Negation :PROPERTIES: :CUSTOM_ID: exercise-3.3-negation :END: #+begin_src lean -- (a) Contradiction theorem contrapositive (A B : Prop) : (A → B) → (¬ B → ¬ A) := by sorry -- (b) Double negation introduction theorem double_neg_intro (A : Prop) : A → ¬ ¬ A := by sorry -- (c) Ex falso quodlibet theorem ex_falso (A : Prop) : False → A := by sorry #+end_src -------------- ← [[file:02-inductive-types.org][Previous: Unit 2]] · Next: [[file:04-quantifiers-and-equality.org][Unit 4 --- Quantifiers and Equality]]