Teaching Software to Prove Itself: From Mathematical Foundations to AI-Driven Proof Engineering
Part I: Foundations of Correctness
Chapter 1: Beyond Testing: Why Software Needs Proofs
- The Illusion of Exhaustive Testing
- Catastrophes, Bugs and the Cost of Trust
- What It Means for Software to Be Correct
- The Verification Landscape and This Book’s Roadmap
Chapter 2: The Language of Logic: Propositions, Predicates and Proofs
- Propositional Logic and Truth Tables
- Predicate Logic: Quantifiers and Variables
- Inference Rules and Proof Trees
- Proof Strategies: Contradiction, Induction, Cases
- From Propositions to Proofs: The Kernel Connection
Chapter 3: Sets, Functions, Relations and the Art of Induction
- Set Theory for Programmers
- Functions, Relations and Equivalences
- Induction and Recursion as the Same Idea
- Invariants: The Engine of Inductive Reasoning
- From Mathematics to Programs: The Big Picture
Chapter 4: Types, Terms and the Curry-Howard Correspondence
- Types as Specifications
- Simply Typed Lambda Calculus
- The Curry-Howard Correspondence
- From Simple Types to Dependent Types
- The Big Picture: Types, Logic and Computation
Part II: Semantics and Verification Calculi
Chapter 5: Giving Meaning to Programs: Operational and Denotational Semantics
- Why Semantics Matters
- Operational Semantics: Small Steps and Big Steps
- Denotational Semantics: Programs as Functions
- Axiomatic Semantics: Meaning Through Logic
- From Semantics to Verification
Chapter 6: Hoare Logic: Preconditions, Postconditions and Invariants
- Hoare Triples and the Logic of Commands
- Loop Invariants and Partial Correctness
- Total Correctness and Termination
- Weakest Preconditions: Inverting the Logic
- From Hoare Logic to Modern Verification
Chapter 7: Reasoning About Time: Temporal Logic and Reactive Systems
- Safety, Liveness and Fairness
- Linear Temporal Logic
- Computation Tree Logic and Branching Time
- Specifying Real Systems: APIs, Protocols and Schedulers
- From Temporal Logic to Model Checking
Chapter 8: From Propositions to Solvers: SAT, SMT and Z3
- SAT: The First Decision Problem
- SMT: SAT Modulo Theories
- Z3 and SMT-LIB: The Practitioner’s Solver
- From SAT/SMT to Verification
Part III: Automated Verification Techniques
Chapter 9: Model Checking: Exhaustive State-Space Reasoning
- The Model Checking Problem
- Explicit and Symbolic State Exploration
- LTL Model Checking and Counterexamples
- Tools in Practice: SPIN, NuSMV, TLA+, Apalache
- From Model Checking to Abstract Interpretation
Chapter 10: Abstract Interpretation: Sound Approximation at Scale
- Fixpoints and Iterative Analysis
- Abstract Domains and Transfer Functions
- Widening, Narrowing and Precision
- Real Analyses: Astrée, Polyspace and Bug Finders
- From Abstract Interpretation to Refinement Types
Chapter 11: Refinement Types and Liquid Types
- Types That Describe More Than Shape
- Refinement Types and Predicates
- Liquid Types and Type Inference
- Refinement in Practice
- From Refinement Types to Program Synthesis
Chapter 12: Program Synthesis: From Specification to Implementation
- The Synthesis Problem
- Enumeration, Sketching and CEGIS
- Learning-Guided and Grammar-Based Synthesis
- Synthesis Meets Verification
Part IV: The Proof Assistant Ecosystem
Chapter 13: Proof Assistants Compared: Architectures of Trust
- The Proof Kernel: Small, Trusted and Fast
- Proof Assistants at a Glance: Coq, Isabelle/HOL, Dafny, F*, Lean
- Proof Relevance, Extraction and Code Generation
- Choosing a Tool: A Decision Framework
- From Comparison to Deep Dive
Chapter 14: Lean 4 Inside and Out: Types, Kernel and Elaborator
- The Calculus of Inductive Constructions and Lean’s Type System
- The Lean 4 Kernel: Soundness and Trust
- The Elaborator and Implicit Arguments
- Universes, Metatheory and Extraction
- Bringing It All Together
- Looking Ahead
Chapter 15: Lean 4 Tactics, Metaprogramming and mathlib
- Term Mode vs Tactic Mode
- The Tactic Framework and Metaprogramming
- mathlib: The Library of Modern Mathematics
- Lean in the Engineering Workflow
- Bringing It All Together
Chapter 16: Verified Software in Lean: Algorithms, Data Structures and Mathematics
- Project Setup: lake, Directories and Dependencies
- Verified Lists and Sorting
- Verified Trees, Hashing and Search
- A Verified Micro-Math Library and Running the Suite
- What We Have Built
Chapter 17: Verification at Scale: Concurrency, Systems and Security
- Concurrency and the Heisenbugs of Shared State
- Distributed Systems and TLA+
- Security and Cryptographic Verification
- Financial Calculations and API Contracts
- Summary
Part V: AI Meets Verification
Chapter 18: The History and Landscape of Automated Theorem Proving
- Classical Automated Theorem Proving
- The Rise of SMT and Verification Engines
- Benchmarks: TPTP, Mizar, F2F, MiniF2F
- A Diagram of Automated Theorem Proving
- Summary
Chapter 19: Large Language Models as Proof Engineers
- LLMs for Mathematics: Capabilities and Limits
- LeanDojo, ReProver and Proof Editing
- AlphaProof, AlphaGeometry and Competition-Level Reasoning
- Hallucinations, Soundness and the Kernel as Arbiter
- A Diagram of LLM-Based Proof Engineering
- Summary
Chapter 20: Building an AI-Assisted Verification Pipeline
- Architecture: From Natural Language to Checked Proof
- Specification Generation and Refinement
- Agentic Proof Search with RAG and Feedback Loops
- The Complete Project: Repository, Commands and Results
- A Diagram of the Complete Pipeline
- Summary
Chapter 21: Trust, Soundness and the Future of Proof Engineering
- The Trust Stack: From Hardware to Theorems
- Specification Gaps and the Limits of Guarantees
- What AI Can and Cannot Replace
- The Road Ahead: Proof Engineering as a Discipline
- A Diagram of the Future Verification Ecosystem
- Conclusion of Part V
Conclusion: Software That Knows It Is Correct
References
- Mathematical Foundations
- Automated Reasoning and Solvers
- Proof Assistants
- Systems and Security Verification
- Automated Theorem Proving History
- AI and Theorem Proving
- Software Failures and Case Studies
- Verification Tools and Infrastructure