Skip to main content
โšก Calmops

Basics and Concepts of First-Order Theorem Proving

Introduction

First-order theorem proving is the art and science of using computers to automatically prove mathematical theorems and verify logical statements. It combines logic, algorithms, and search strategies to derive conclusions from axioms and inference rules.

This guide introduces the foundational concepts you need to understand to work with first-order theorem proving.

What is First-Order Logic?

First-order logic (FOL) is a formal system that extends propositional logic with two key features:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Key Extensions in First-Order Logic                          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 1. Quantifiers: โˆ€ (for all), โˆƒ (exists)                     โ”‚
โ”‚ 2. Predicates: Statements about objects                     โ”‚
โ”‚ 3. Variables: Refer to objects in the domain                 โ”‚
โ”‚ 4. Functions: Map objects to objects                        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Simple Examples

-- Propositional: It is raining
is_raining

-- First-order: Socrates is human
Human(Socrates)

-- First-order: All humans are mortal
โˆ€x (Human(x) โ†’ Mortal(x))

-- First-order: Some bird can fly
โˆƒx (Bird(x) โˆง CanFly(x))

The Language of First-Order Logic

Building Blocks

% Constants (specific objects)
Socrates, Alice, 5, PlanetEarth

% Variables (placeholder for any object)
x, y, z, person, number

% Function symbols (map inputs to outputs)
Father(x)       -- unary function
Plus(x, y)      -- binary function
FatherOf(x, y)  -- could be predicate or function

% Predicate symbols (true/false statements)
Human(x)
Loves(x, y)
GreaterThan(x, y)

Formulas

-- Atomic formulas (predicates applied to terms)
Human(Socrates)
Loves(Alice, Bob)
GreaterThan(5, 3)

-- Compound formulas (using connectives)
Human(x) โˆง Mortal(x)           -- conjunction
ยฌHuman(x)                      -- negation
Human(x) โ†’ CanDie(x)           -- implication
โˆ€x (Human(x) โ†’ Mortal(x))      -- universal quantifier
โˆƒx (Bird(x) โˆง CanFly(x))      -- existential quantifier

Key Concepts in Theorem Proving

1. Axioms

Axioms are statements accepted as true without proof. They form the foundation of a theory:

% Axioms of equality
โˆ€x (x = x)                              -- reflexivity
โˆ€x โˆ€y (x = y โ†’ y = x)                   -- symmetry
โˆ€x โˆ€y โˆ€z ((x = y โˆง y = z) โ†’ x = z)     -- transitivity

% Axioms of arithmetic
โˆ€x (x + 0 = x)
โˆ€x โˆ€y (x + S(y) = S(x + y))

% Domain-specific axioms
โˆ€x (Human(x) โ†’ Mortal(x))
โˆ€x (Parent(x) โ†’ Human(x))

2. Theorems

A theorem is a statement that can be proven from axioms using inference rules:

-- If these are axioms:
โˆ€x (Human(x) โ†’ Mortal(x))
Human(Socrates)

-- Then this is a theorem:
Mortal(Socrates)

3. Inference Rules

Inference rules define how to derive new truths from existing ones:

% Modus Ponens (most fundamental)
P โ†’ Q    P
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
     Q

% Modus Tollens
P โ†’ Q    ยฌQ
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
     ยฌP

% Universal Instantiation
โˆ€x P(x)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   P(c)       -- for any constant c

% Existential Generalization
P(c)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
 โˆƒx P(x)

The Proof Process

What is a Proof?

A proof is a sequence of formulas where each formula is either:

  1. An axiom, or
  2. Derived from previous formulas using inference rules
% Example proof that Socrates is mortal

1. โˆ€x (Human(x) โ†’ Mortal(x))       -- Axiom
2. Human(Socrates)                  -- Given
3. Human(Socrates) โ†’ Mortal(Socrates)  -- Universal Instantiation (1)
4. Mortal(Socrates)                 -- Modus Ponens (2, 3)

QED

Types of Proofs

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Proof Techniques                                            โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โ€ข Direct Proof: Start from premises, reach conclusion      โ”‚
โ”‚ โ€ข Proof by Contradiction: Assume negation, derive conflict  โ”‚
โ”‚ โ€ข Proof by Induction: Base case + inductive step           โ”‚
โ”‚ โ€ข Proof by Cases: Cover all possible scenarios              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Semantics: What Do Formulas Mean?

Interpretations

An interpretation assigns meaning to the symbols:

% Consider: โˆ€x (Human(x) โ†’ Mortal(x))

-- Interpretation 1 (standard):
Domain = all humans
Human(x) = "x is a human"
Mortal(x) = "x is mortal"
-- Formula is TRUE

-- Interpretation 2 (alternative):
Domain = all creatures
Human(x) = "x is a robot"
Mortal(x) = "x runs on electricity"
-- Formula may be TRUE or FALSE depending on interpretation

Models

A model is an interpretation that makes all axioms true:

% If axioms are:
-- All humans are mortal
-- Socrates is human

% Then interpretation with:
-- Socrates is human
-- No immortal humans
-- Is a MODEL (makes all axioms true)

Validity and Satisfiability

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Key Semantic Concepts                                       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Valid (Tautology): True in EVERY interpretation            โ”‚
โ”‚                   โŠจ P โ†’ P                                  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Satisfiable: True in SOME interpretation                   โ”‚
โ”‚             โˆƒx P(x) is satisfiable                         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Unsatisfiable: False in EVERY interpretation               โ”‚
โ”‚               P โˆง ยฌP is unsatisfiable                      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Falsifiable: False in SOME interpretation                  โ”‚
โ”‚             โˆƒx ยฌP(x) is falsifiable                        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Soundness and Completeness

Soundness

A proof system is sound if everything it proves is actually true:

Soundness: If โŠข ฯ† (provable), then โŠจ ฯ† (valid)

-- If the prover says "P is proved"
-- Then P must be true in all models

Completeness

A proof system is complete if everything that’s true can be proved:

Completeness: If โŠจ ฯ† (valid), then โŠข ฯ† (provable)

-- If P is true in all models
-- Then there exists a proof of P

Gรถdel’s Incompleteness

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Important Limitation                                         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Gรถdel's First Incompleteness Theorem:                       โ”‚
โ”‚                                                             โ”‚
โ”‚ Any sufficiently expressive theory cannot be both          โ”‚
โ”‚ complete and consistent.                                    โ”‚
โ”‚                                                             โ”‚
โ”‚ This means: There will always be true statements           โ”‚
โ”‚ that cannot be proved within the theory.                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Basic Proof Strategies

1. Forward Chaining

Start from known facts, apply rules, work toward goal:

% Known: 
%   1. All mammals are warm-blooded
%   2. All warm-blooded animals have hearts
%   3. whales are mammals

% Forward chain:
% From 1 and 3: Whales are warm-blooded
% From 2 and above: Whales have hearts

2. Backward Chaining

Start from goal, work backward to find supporting facts:

% Goal: Prove "Socrates is mortal"

% Step 1: To prove Mortal(x), need Human(x)
% Step 2: To prove Human(Socrates), check axioms
% Step 3: Found: Human(Socrates) in axioms
% Step 4: Use โˆ€x (Human(x) โ†’ Mortal(x)) to complete proof

3. Resolution

Convert to clauses, resolve contradictions:

-- To prove P:
-- 1. Assume ยฌP
-- 2. Add axioms
-- 3. Derive contradiction (empty clause)
-- 4. Therefore P is proved

Common Techniques

Universal Instantiation

% From โˆ€x P(x), conclude P(c) for any constant c

โˆ€x (Human(x) โ†’ Mortal(x))
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Human(Socrates) โ†’ Mortal(Socrates)

Existential Instantiation

-- From โˆƒx P(x), introduce a NEW constant (Skolem constant)
-- The constant must be fresh (not used elsewhere)

โˆƒx (King(x) โˆง Just(x))
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
King(a) โˆง Just(a)    -- a is a NEW constant symbol

Chaining Quantifiers

-- Order matters!

โˆ€x โˆƒy (Loves(x, y))
-- For everyone, there is someone they love
-- (possibly different for each person)

โˆƒy โˆ€x (Loves(x, y))
-- There is someone who loves everyone
-- (the same person loves everyone)

Why Theorem Proving Matters

Applications

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Where Theorem Proving is Used                              โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โ€ข Software Verification: Proving program correctness       โ”‚
โ”‚ โ€ข Hardware Design: Verifying circuit properties            โ”‚
โ”‚ โ€ข Formal Methods: Safety-critical systems                   โ”‚
โ”‚ โ€ข Knowledge Representation: Automated reasoning             โ”‚
โ”‚ โ€ข Mathematics: Proving new theorems                        โ”‚
โ”‚ โ€ข AI: Logic-based learning and inference                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Example: Program Verification

% Prove: This swap function is correct

% Specification:
% โˆ€a โˆ€b { swap(a,b) returns (b,a) }

% Implementation:
swap(x, y):
    temp = x
    x = y
    y = temp
    return (x, y)

% Proof shows implementation meets specification

Summary

First-order theorem proving rests on several foundational concepts:

  • First-order logic uses quantifiers and predicates to express statements about objects
  • Axioms are accepted truths; theorems are derived truths
  • Inference rules like modus ponens enable mechanical reasoning
  • Soundness ensures proofs are valid; completeness ensures all truths are provable
  • Proof strategies like forward/backward chaining guide the search for proofs

Understanding these basics prepares you for more advanced topics in automated reasoning and formal verification.


Comments