Lecture 7
Logical proofs
Johannes Korbmacher Lecture slides
Logical methods for AI
Logical proofs
Lecture 7
What you’ll be able to do
Checking reasoning
- A proof: every step explicit.
- A machine can search for a proof, or check one.
- An AI proposes a proof; Lean checks it.
Step by step
Each conclusion can be used in a later step.
Proof systems
- Axiomatic systems: axioms (glossary, opens in a new tab) , few rules.
- Sequent calculi: judgments about assumptions and conclusions.
- Tableaux, resolution: systematic search.
- Natural deduction: rules for each connective.
Derivability
Natural deduction
(RAIN ∨ WIND) → COLD, COLD → HEATING, RAIN ⊢ HEATING
Introduction and elimination
Discharge
→ Intro: assume A, derive B, conclude A → B and discharge [A].
Temporary assumptions
⊢ RAIN → (RAIN ∨ WIND)
Reasoning by cases
SUN ∨ RAIN, ¬SUN ⊢ RAIN
Classical reasoning
¬⊥: a temporary assumption ¬A leads to ⊥, so A. Without it: intuitionistic logic (glossary, opens in a new tab) .
Finding a derivation
A derivation exists; finding it is proof search (glossary, opens in a new tab) . Work backwards from the goal:
- A ∧ B: prove each conjunct, then ∧ Intro.
- A → B: assume A, prove B, then → Intro.
- Stuck: assume the negation of the goal and derive ⊥.
Construct a derivation
Theorem provers
Proof assistants
A proof assistant (glossary, opens in a new tab) : we guide the construction; it checks every step. Lean, Rocq, Isabelle.
Automated provers
An automated theorem prover (glossary, opens in a new tab) searches for the proof itself: resolution, SAT solving. Vampire; SMT solvers such as Z3.
Types and type checking
- n : ℕ, and n + 1 : ℕ.
- a : A: a proof term (glossary, opens in a new tab) of the proposition A.
Proving A: constructing a term of type A. Checking the proof: checking its type.
The heating proof in Lean
Finding a proof in Lean
variable (A B : Prop)
example : A → (B → (A ∧ B)) := by
intro a
intro b
apply And.intro
· sorry
· sorry- intro a: assume a : A; the goal becomes B → (A ∧ B).
- apply And.intro: one goal per conjunct.
- sorry: a placeholder, not a proof. Here: exact a, exact b.
Curry–Howard
Propositions are types; proofs are programs: the Curry–Howard correspondence (glossary, opens in a new tab) .
| Natural deduction | Lean command |
|---|---|
| ∧ Intro | exact And.intro a b |
| ∧ Elim | exact And.left h, exact And.right h |
| ∨ Intro | exact Or.inl a, exact Or.inr b |
| ∨ Elim | apply Or.elim h, then prove both cases |
| → Intro | intro a, then prove B |
| → Elim | exact f a |
Derivation and Lean
Use ← / →, Page Up / Page Down, or Space to navigate. While you work in an app, only Page Up / Page Down change the slide. Press F for full screen and Esc to exit. Each slide has a shareable URL.
What is on the slidesText of every slide
The text of every slide, in order. Drawings are described in words, and interactive apps are named; the textbook chapter has each of them in full.