⊢ Core Concepts in Computational Logic
Explore the fundamental frameworks that underpin mathematical reasoning and computation.
📜 Foundational Theorems of Logic and Computation
These landmark results define the boundaries of what can be proven and computed.
🖼️ Visualizing Logic and Computation
🔗 Explore Related Mathematical Disciplines
📖 What is Computational Logic? The Mathematics of Reasoning
Computational logic is the study of formal systems for reasoning and computation. It bridges pure logic—the study of valid inference—with computer science—the study of what can be computed and how. From the simplest propositional statements to the most complex automated theorem provers, computational logic provides the theoretical foundation for programming languages, artificial intelligence, hardware verification, and the very limits of mathematical knowledge.
The Three Pillars of Computational Logic
- Formal Logic: The syntax and semantics of logical languages (propositional, predicate, modal, temporal)
- Proof Theory: The structure of mathematical proofs and systems for formal reasoning
- Computability Theory: What can and cannot be computed by machines (Turing machines, decidability, complexity)
📊 Propositional and Predicate Logic: The Languages of Reasoning
Propositional Logic
The simplest formal logic, where propositions (statements that are true or false) are combined using logical connectives:
- Conjunction (∧): P and Q — true only when both are true
- Disjunction (∨): P or Q — true when at least one is true
- Negation (¬): not P — reverses truth value
- Implication (→): if P then Q — false only when P is true and Q is false
- Biconditional (↔): P if and only if Q — true when P and Q have the same truth value
Predicate Logic (First-Order Logic)
Extends propositional logic with quantifiers and predicates that describe properties of objects:
- Universal Quantifier (∀): "for all" — ∀x P(x) means P holds for every x
- Existential Quantifier (∃): "there exists" — ∃x P(x) means there is some x for which P holds
- Predicates: Properties like Human(x), Loves(x,y), GreaterThan(x,y)
- Functions: Objects derived from others, like father(x)
Example: ∃x (Cat(x) ∧ Black(x)) — There exists a black cat.
📝 Proof Theory: The Structure of Mathematical Proofs
Natural Deduction
Natural deduction captures the way mathematicians actually reason. Key inference rules include:
- Modus Ponens: From P and P→Q, conclude Q
- Modus Tollens: From ¬Q and P→Q, conclude ¬P
- Hypothetical Syllogism: From P→Q and Q→R, conclude P→R
- Universal Instantiation: From ∀x P(x), conclude P(c)
- Existential Introduction: From P(c), conclude ∃x P(x)
Sequent Calculus and Cut Elimination
Gerhard Gentzen's sequent calculus provides a more systematic framework for proofs. The cut elimination theorem shows that any proof can be transformed into one that avoids the "cut" rule—a kind of lemma-use—establishing the consistency of logic and providing a foundation for automated theorem proving.
Intuitionistic Logic vs Classical Logic
Classical logic accepts the law of excluded middle (P ∨ ¬P). Intuitionistic logic rejects this, requiring constructive proofs—to prove ∃x P(x), you must actually construct an x. This distinction has profound implications for computation: intuitionistic proofs correspond to programs (the Curry-Howard correspondence).
💻 Computability Theory: What Can Be Computed?
Turing Machines
Alan Turing's abstract model of computation defines what it means for a function to be computable. A Turing machine consists of:
- An infinite tape divided into cells, each holding a symbol
- A head that reads and writes symbols and moves left or right
- A finite set of states, including a start state and halt states
- A transition function defining behavior
The Church-Turing Thesis states that any effectively computable function can be computed by a Turing machine—making Turing machines the universal model of computation.
Decidability and Undecidability
A problem is decidable if there exists an algorithm that always gives a correct yes/no answer. Many problems are undecidable:
- Halting Problem: Cannot determine if a program halts (Turing, 1936)
- Post Correspondence Problem: Undecidable problem about string matching
- Hilbert's Tenth Problem: No algorithm to determine if a Diophantine equation has integer solutions
- Word Problem for Groups: Cannot determine if two words represent the same group element
• First Incompleteness Theorem: Any consistent formal system containing arithmetic cannot prove all true statements—there are true but unprovable statements.
• Second Incompleteness Theorem: No consistent formal system can prove its own consistency.
⏱️ Complexity Theory: The Efficiency of Computation
P vs NP: The Greatest Unsolved Problem
While computability asks "can we solve it?", complexity asks "how efficiently can we solve it?"
- P (Polynomial Time): Problems solvable in time O(nᵏ)—tractable problems
- NP (Nondeterministic Polynomial Time): Problems whose solutions can be verified in polynomial time
- NP-Complete: The hardest problems in NP—if any NP-complete problem is in P, then P = NP
- EXPTIME: Problems solvable in exponential time
Classic NP-Complete Problems
- Satisfiability (SAT): Given a Boolean formula, is there a satisfying assignment?
- Traveling Salesman: Find the shortest route visiting all cities
- Graph Coloring: Can a graph be colored with k colors?
- Subset Sum: Does a subset of numbers sum to a target?
- Clique: Is there a complete subgraph of size k?
🤖 Automated Reasoning: Logic in Practice
SAT Solvers
Propositional satisfiability (SAT) solvers are the workhorses of automated reasoning. Modern solvers use:
- DPLL Algorithm: Backtracking search with unit propagation
- Conflict-Driven Clause Learning (CDCL): Learn from conflicts to prune search space
- Randomized Restarts: Avoid getting stuck in bad search paths
- Preprocessing: Simplify formulas before solving
SMT Solvers (Satisfiability Modulo Theories)
SMT solvers extend SAT with theories like arithmetic, arrays, and bit vectors. Applications include:
- Software Verification: Prove programs have no bugs
- Hardware Verification: Verify chip designs
- Program Synthesis: Automatically generate code from specifications
- Type Checking: Advanced type systems (Rust borrow checker, Haskell type inference)
Theorem Provers and Proof Assistants
- Coq: Interactive theorem prover based on dependent types
- Lean: Modern proof assistant used in mathematics (Lean 4)
- Isabelle/HOL: Generic theorem prover for higher-order logic
- Agda: Dependently typed programming language and proof system
📋 Logic Programming: Computation as Deduction
Prolog and Horn Clauses
Logic programming languages like Prolog express computation as logical deduction using Horn clauses (rules of the form A ← B₁ ∧ ... ∧ Bₙ). A Prolog program is a set of facts and rules; computation is a search for proofs.
parent(john, mary).
parent(mary, susan).
ancestor(X, Y) :- parent(X, Y).
ancestor(X, Z) :- parent(X, Y), ancestor(Y, Z).
Datalog and Databases
Datalog is a restricted logic programming language used in database query languages, network analysis, and declarative programming. Unlike Prolog, Datalog guarantees termination and is widely used in industry.
Applications
- Expert Systems: Rule-based reasoning systems
- Knowledge Graphs: Semantic web reasoning (RDF, OWL)
- Network Analysis: Reachability and path finding
- Static Analysis: Program analysis and verification
📚 How to Master Computational Logic
Recommended Approach
- Learn the Syntax First: Master the precise syntax of propositional and predicate logic before tackling semantics and proofs.
- Practice Proofs: Work through natural deduction proofs manually. Start with propositional logic, then move to predicate logic.
- Study the Landmark Theorems: Gödel's incompleteness theorems, Turing's halting problem, and Church's theorem define the boundaries of logic—understand their proofs.
- Implement a Theorem Prover: Build a simple SAT solver or resolution prover to understand automated reasoning deeply.
- Learn Prolog: Experience logic programming firsthand. Solve puzzles, build knowledge bases, and see computation as deduction.
Recommended Resources
- Textbooks: Enderton's A Mathematical Introduction to Logic, Boolos & Jeffrey's Computability and Logic, Ben-Ari's Mathematical Logic for Computer Science
- Online Resources: Stanford's Logic I & II (online), MIT OpenCourseWare 6.042 Mathematics for Computer Science
- Tools: Lean 4 for interactive theorem proving, SWI-Prolog for logic programming, Z3 for SMT solving