Leanpub Header

Skip to main content

Formal Verification for Working Software Engineers

From First Principles to Production-Grade Verified Systems

Formal Verification for Working Software Engineers
This book is 100% completeLast updated on 2026-08-19

Formal verification does not have to live in research papers. This practical guide shows working software engineers how to turn real requirements into precise, machine-checkable guarantees, find bugs before they reach production and bring formal methods into everyday development, from application code to distributed and security-critical systems.

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
171
Pages
About

About

About the Book

This is a practical guide to formal verification written for software engineers who know how to write production code but have never used formal methods. You will learn to express precise properties about your software, choose the right verification technique for each problem, and integrate mathematical guarantees into real development workflows. By the end, you will be able to identify high-value verification targets, construct machine-checkable specifications, interpret solver results and counterexamples, develop proofs using modern tools, and progressively introduce formal verification into systems ranging from ordinary application code to concurrent, distributed, and security-critical software.

Bundle

Bundles that include this book

Author

About the Author

Steve Publications

Steve is a technology professional with more than 20 years of experience spanning software development, server infrastructure, cybersecurity, vulnerability research and reverse engineering. His work focuses on understanding complex systems, uncovering security weaknesses and developing practical solutions that make technology more secure, reliable and effective.

Through Steve Publications, he collaborates with experienced researchers, engineers and industry experts to create practical, technically rigorous books on various topics not limited to self-improvement, software development, cybersecurity, cloud computing, DevOps, artificial intelligence and enterprise technologies. His mission is to make complex technical subjects accessible through clear explanations, real-world examples and hands-on exercises that help IT professionals, students and technology enthusiasts build valuable, practical skills.

Steve Publications embraces AI as a supporting tool for translation, proofreading and editorial refinement, not as a substitute for original research, technical expertise, or hands-on experience. Some contributors choose to publish under pseudonyms to protect their privacy or maintain professional boundaries.

Behind every book is a commitment to technical accuracy, practical relevance and continuous improvement. Our publications are written, reviewed and maintained by experienced professionals, with support from a private community of more than 420 engineers and researchers. Rather than prioritizing volume or mass-produced AI-generated content, we focus on delivering reliable, useful resources that readers can apply in real-world environments.

We also welcome experienced professionals who want to share their knowledge by writing or reviewing books, particularly in specialized and emerging technology fields. If you have expertise to contribute, we invite you to get in touch and explore opportunities to collaborate.

Our commitment is simple: To deliver books that respect our readers' time, support their professional growth and provide lasting practical value. If a book does not meet your expectations, Leanpub offers a 60-day money-back guarantee.

Contents

Table of Contents

From First Principles to Production-Grade Verified Systems

Introduction: Why Testing Is Not Enough

  1. A History of Missed Bugs
  2. What Formal Verification Actually Means
  3. The Spectrum from Testing to Proofs
  4. How This Book Is Structured

Chapter 1: Properties, Specifications, and Invariants

  1. From Requirements to Precise Properties
  2. Preconditions and Postconditions: Contracts for Code
  3. Invariants: What Must Always Be True
  4. Assertions as Lightweight Verification
  5. State Machines and Behavioral Models
  6. Designing Specifications That Are Checkable
  7. Summary

Chapter 2: Logic and Mathematics for Verification

  1. Propositional Logic: Truth Tables and Equivalences
  2. Predicate Logic: Quantifiers and Properties Over Data
  3. Sets, Relations, and Functions as Specification Tools
  4. Boolean Algebra for Software Engineers
  5. Induction: Proving Things About Arbitrary Inputs
  6. Proof Techniques: Direct, Contradiction, Cases
  7. Summary

Chapter 3: Hoare Logic and Program Correctness

  1. Hoare Triples: The Language of Partial Correctness
  2. Rules of Inference for Imperative Programs
  3. P’ → P, {P} C {Q}, Q → Q’
  4. Weakest Preconditions: Reasoning Backwards
  5. Operational Semantics: Defining What Programs Mean
  6. Sequencing: ⟨C1, σ⟩ ⇓ σ’, ⟨C2, σ’⟩ ⇓ σ’’
  7. Total vs Partial Correctness and Termination
  8. Proof Trees for Real Code
  9. Summary

Chapter 4: Property-Based Testing as a Bridge to Formal Reasoning

  1. From Example Tests to Universal Properties
  2. QuickCheck, Hypothesis, and Property Frameworks
  3. Shrinking Counterexamples: Learning from Failure
  4. Invariants as Testable Properties
  5. When Property Testing Succeeds and Fails
  6. The Path from Properties to Proofs
  7. Summary

Chapter 5: SAT Solvers and Boolean Reasoning

  1. The Satisfiability Problem and Its Ubiquity
  2. Conjunctive Normal Form: Encoding Problems as Logic
  3. How SAT Solvers Work: DPLL and CDCL
  4. Using SAT Solvers in Practice: MiniSat, Z3
  5. Encoding Real Constraints for SAT
  6. Limits of Pure Boolean Reasoning
  7. Summary

Chapter 6: SMT Solvers and Constraint Solving

  1. From SAT to SMT: Adding Theories
  2. Core Theories: Arithmetic, Arrays, Bitvectors, Strings
  3. Z3 and Other Major SMT Solvers
  4. Encoding Programs as Constraints
  5. Solver-Aided Programming Patterns
  6. Interpreting Sat/Unsat and Models
  7. Summary

Chapter 7: Symbolic Execution and Path Analysis

  1. Symbolic Values and Path Conditions
  2. Exploring Branches Systematically
  3. Concolic Execution: Mixing Concrete and Symbolic
  4. Bounded Model Checking via Symbolic Execution
  5. Tools: KLEE, angr, CBMC
  6. Path Explosion and Practical Mitigations
  7. Summary

Chapter 8: Abstract Interpretation and Static Analysis

  1. The Idea of Abstraction: Precision vs Soundness
  2. Lattices and Fixpoints Made Intuitive
  3. Common Analyses: Nullability, Ranges, Taint
  4. Frama-C and the WP Plugin
  5. SPARK/Ada for Safety-Critical Code
  6. Trade-offs Between Soundness and Scalability
  7. Summary

Chapter 9: Model Checking and Temporal Logic

  1. State Spaces and Transition Systems
  2. Linear-Time vs Branching-Time Temporal Logic
  3. LTL and CTL: Specifying Behavioral Properties
  4. How Model Checkers Explore State Spaces
  5. TLA+ for Distributed Systems Design
  6. State Explosion and Symmetry Breaking
  7. Summary

Chapter 10: Deductive Verification with Contracts and Annotations

  1. The Deductive Verification Pipeline
  2. Dafny: Syntax, Contracts, and Automation
  3. Loop Invariants and Recursive Functions
  4. Framing Conditions and Modularity
  5. Verus and Rust Verification
  6. Debugging Failed Proofs
  7. Summary

Chapter 11: Separation Logic and Memory Reasoning

  1. The Problem of Shared Mutable State
  2. Separating Conjunctions and Spatial Reasoning
  3. Points-to Assertions and Heap Predicates
  4. Verifying Pointer Manipulation
  5. Prusti, Creusot, and Rust Verification
  6. Concurrent Separation Logic Basics
  7. Summary

Chapter 12: Concurrent Program Verification

  1. What Goes Wrong in Concurrent Code
  2. Linearizability and Atomicity Specifications
  3. Race Detection vs Race Proofs
  4. Lock-Based Reasoning and Ownership
  5. Verifying Concurrent Data Structures
  6. Tools: IronFleet, F*, Viper
  7. Summary

Chapter 13: Distributed Systems and Protocol Verification

  1. The Unique Challenges of Distributed Verification
  2. Specifying Consensus and Replication
  3. Alloy for Lightweight Structural Analysis
  4. Verifying Paxos, Raft, and CRDTs
  5. Handling Timeouts, Failures, and Network Partitions
  6. IronFleet: Verified End-to-End Distributed Systems
  7. Summary

Chapter 14: Theorem Proving with Proof Assistants

  1. When You Need a Proof Assistant
  2. Dependent Types and Propositions-as-Types
  3. Interactive Proof Development in Lean
  4. Tactics, Automation, and Proof Terms
  5. Coq/Rocq for Certified Software
  6. Isabelle/HOL for Large-Scale Verification
  7. Summary

Chapter 15: Verified Compilers and Systems Software

  1. Why Verify Compilers? The CompCert Story
  2. Verified Operating System Kernels (seL4, Fuchsia)
  3. Cryptographic Implementations in F* and Others
  4. Proof-Carrying Code and Capabilities
  5. Smart Contract Verification on Blockchains
  6. Lessons from Million-Line Verified Systems
  7. Summary

Chapter 16: Engineering Practice — Adoption, Workflows, and Culture

  1. Choosing What to Verify: Risk vs Effort
  2. The Trusted Computing Base and Its Limits
  3. Integrating Verification into CI Pipelines
  4. Specification Review and Proof Maintenance
  5. Combining Verification with Testing and Fuzzing
  6. Introducing Formal Methods to Engineering Teams
  7. Summary

Major Case Study: From Tests to Verified System

  1. The Component: Requirements and Initial Implementation
  2. Baseline Testing and Its Blind Spots
  3. Adding Property-Based Testing
  4. SMT-Based Contract Checking with Dafny
  5. Model Checking the State Machine in TLA+
  6. Machine-Checked Proofs for Critical Properties
  7. CI Integration and Regression Guarantees
  8. What We Learned: Costs, Benefits, Trade-offs
  9. Summary

Conclusion: The Future of Verified Software Engineering

  1. Where Formal Verification Has Succeeded
  2. AI and Language Models in Verification Workflows
  3. The Remaining Gaps Between Research and Practice
  4. A Pragmatic Philosophy for Verified Software
  5. Getting Started Tomorrow

References

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub