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.
proof_jimmy_piProof assistantABAB( )COMPUTER SAYS:NO!

Step by step

proof_ai_radiatorHEATER-2000

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.
proof_euclidαβγαβγ++= 180°γβ

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

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 deductionLean command
∧ Introexact And.intro a b
∧ Elimexact And.left h, exact And.right h
∨ Introexact Or.inl a, exact Or.inr b
∨ Elimapply Or.elim h, then prove both cases
→ Introintro a, then prove B
→ Elimexact f a

Derivation and Lean