Leanpub Header

Skip to main content

Functional Programming and Proof Assistants

From Lambda Calculus to Verified Reasoning

Functional Programming and Proof Assistants
This book is 100% completeLast updated on 2026-11-12

What happens when code becomes mathematics and mathematics becomes something a machine can verify? Explore the foundations of functional programming, the elegance of lambda calculus and the surprising connection between types and logic. With hands-on work in Lean, Coq and Agda, discover how to turn mathematical ideas into proofs that computers can trust.

Minimum price

$25.00

$35.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
144
Pages
About

About

About the Book

This book takes you on a systematic journey from the mathematical foundations of functional programming to the art and science of formal theorem proving. You will learn why purity, immutability and algebraic data types matter, how lambda calculus serves as the theoretical core of all functional languages and how type theory unifies computation with logical reasoning through the Curry-Howard correspondence. Along the way, you will gain deep practical experience with Lean, Coq and Agda, proving everything from elementary arithmetic to sophisticated algebraic properties, while understanding the architecture, trade-offs and real-world impact of machine-verified reasoning.

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 Lambda Calculus to Verified Reasoning

Introduction

Chapter 1: The Functional Paradigm

  1. Computation Without Mutation: The Philosophical Basis
  2. Functional Programming and Mathematical Functions
  3. Historical Origins: Lambda Calculus, Lisp and the Search for Purity
  4. Referential Transparency and the Predictability of Programs
  5. The Connection Between Purity and Provable Correctness

Chapter 2: Lambda Calculus as the Foundation

  1. Syntax of the Lambda Calculus: Terms, Abstraction and Application
  2. Beta Reduction and the Mechanics of Computation
  3. Alpha Conversion and the Problem of Variable Capture
  4. Church Encodings: Numbers, Booleans and Pairs in Pure Lambda Terms
  5. Confluence, Normal Forms and the Halting Problem

Chapter 3: Evaluation Strategies and Control Flow

  1. Call-by-Value: The Eager Evaluation Model
  2. Call-by-Name and Call-by-Need: Lazy Evaluation Explained
  3. Normal Order vs Applicative Order Reduction
  4. Thunks, Sharing and the Cost of Laziness
  5. Strictness Analysis and the Pragmatics of Real Implementations

Chapter 4: Core Functional Concepts

  1. Pure Functions and the Elimination of Side Effects
  2. Immutability and Data as Mathematical Objects
  3. Lexical Scoping and the Structure of Environments
  4. Closures and Captured Environments in Practice
  5. First-Class and Higher-Order Functions

Chapter 5: Recursion and Functional Algorithms

  1. Recursion as the Replacement for Imperative Loops
  2. Structural Recursion and Data-Driven Termination
  3. Tail Recursion and Continuation-Passing Style
  4. Recursive Algorithms on Lists and Trees
  5. Proving Termination and Correctness of Recursive Functions

Chapter 6: Algebraic Data Types and Pattern Matching

  1. Product Types and Records as Tuples
  2. Sum Types and the Representation of Alternatives
  3. Algebraic Data Types in Practice
  4. Pattern Matching as Structural Decomposition
  5. Exhaustiveness Checking and Safe Case Analysis

Chapter 7: Type Systems and Type Theory

  1. What Type Systems Do: Safety, Documentation and Computation
  2. Parametric Polymorphism and Generic Programming
  3. Hindley-Milner Type Inference and the Algorithm W
  4. Type Expressiveness and the Spectrum of Type Systems
  5. From Type Safety to Type-Directed Reasoning

Chapter 8: Type Classes and Ad-hoc Polymorphism

  1. The Problem Type Classes Solve: Overloading Without Chaos
  2. Type Class Declarations, Instances and Resolution
  3. Functional Dependencies and Associated Types
  4. Type Classes as a Foundation for Abstraction
  5. Connection to Category Theory and Functorial Structure

Chapter 9: Category Theory and Functional Abstractions

  1. Categories, Objects and Morphisms: The Basic Structure
  2. Functors and the Preservation of Structure
  3. Applicative Functors and Pure Functions in Context
  4. Monads as Composable Computations
  5. Monoids and Foldable Structures

Chapter 10: Effect Systems and Managing Impurity

  1. The Problem of Effects in a Pure Language
  2. The IO Monad and Separating Pure and Impure
  3. State Monads and Computational Effects
  4. Alternative Effect Systems: Algebraic Effects and Handlers
  5. Pure Functional Concurrency and Software Transactional Memory

Chapter 11: Functional Program Architecture

  1. Composing Modules and Managing Dependencies
  2. Error Handling with Maybe, Either and Validation
  3. Functional Design Patterns: Visitors, Interpreters and Beyond
  4. Property-Based Testing and Generative Verification
  5. The Functional Architecture of Large Systems

Chapter 12: Propositional and Predicate Logic

  1. Propositions, Truth Values and Logical Connectives
  2. Truth Tables, Tautologies and Logical Equivalence
  3. Propositional Satisfiability and the Satisfiability Problem
  4. Predicates, Quantifiers and First-Order Logic
  5. Axioms, Inference Rules and Derivations

Chapter 13: Proof Systems and Natural Deduction

  1. Formal Proof Systems: From Axioms to Theorems
  2. Natural Deduction: Introduction and Elimination Rules
  3. Sequent Calculus and the Structure of Proofs
  4. Constructive vs Non-Constructive Proofs
  5. Proof Search and Automated Deduction

Chapter 14: Constructive Logic and Intuitionism

  1. The Intuitionistic Critique of Classical Logic
  2. Constructive Existence and the Brouwer-Heyting-Kolmogorov Interpretation
  3. Double Negation and the Law of Excluded Middle
  4. Continuity, Choice Principles and Intuitionistic Mathematics
  5. Implications for Computation and Proof Assistants

Chapter 15: Mathematical Induction and Recursive Definitions

  1. Mathematical Induction and the Well-Ordering Principle
  2. Strong Induction and Complete Induction
  3. Structural Induction on Inductive Types
  4. Recursive Definitions and Well-Founded Recursion
  5. Coinduction and Infinite Structures

Chapter 16: The Curry-Howard Correspondence

  1. The Historical Development of the Correspondence
  2. Propositions as Types: Mapping Logic to Type Theory
  3. Proofs as Programs: Constructing Inhabitants of Types
  4. Logical Connectives and Their Type-Theoretic Counterparts
  5. Quantifiers, Dependent Types and the Extended Correspondence

Chapter 17: Dependent Type Theory

  1. Dependent Types and the Blurring of Data and Prop
  2. Pi Types and Dependent Function Spaces
  3. Inductive Types and Recursive Structures
  4. Inductive Families and Indexed Types
  5. Universes, Hierarchy and Consistency

Chapter 18: The Calculus of Inductive Constructions

  1. The Structure of the Calculus of Inductive Constructions
  2. Typing Rules and the Judgemental Structure
  3. Inductive Definitions and Pattern Matching in CIC
  4. Computation, Conversion and Definitional Equality
  5. Strong Normalization and Logical Consistency

Chapter 19: Introduction to Proof Assistants

  1. What a Proof Assistant Does and Does Not Do
  2. Trusted Kernels and the Architecture of Verification
  3. Proof Terms, Checkers and the Role of Automation
  4. Axioms, Assumptions and the Trust Boundary
  5. Choosing a Proof Assistant for Your Purpose

Chapter 20: Lean: Installation, Workflow and Basics

  1. Installing Lean and Configuring the Development Environment
  2. Project Structure, Imports and Modules
  3. Basic Syntax, Declarations and Definitions
  4. Defining Functions and Inductive Types
  5. Writing Your First Theorems and Proofs

Chapter 21: Interactive Proof Development in Lean

  1. Term Mode vs Tactic Mode
  2. Basic Tactics: Assumption, Apply, Intros and Exact
  3. Rewriting, Simplification and Calculation
  4. Induction and Case Analysis Tactics
  5. Working with Algebraic Structures and Libraries
  6. Debugging Failed Proofs and Type Errors

Chapter 22: Advanced Lean and Formalization Case Studies

  1. Formalizing Recursive Algorithms and Their Correctness
  2. Verified Data Structures: Lists, Trees and Maps
  3. Algebraic Structures: Groups, Rings and Fields
  4. Relational Properties and Program Verification
  5. Large-Scale Formalization and Library Design

Chapter 23: Comparative Perspectives and Future Directions

  1. Comparing Lean, Coq and Agda: Foundations and Ecosystems
  2. Connections to Haskell, Idris and Dependent Programming
  3. SMT Solvers, Automated Theorem Proving and Hybrid Approaches
  4. Industrial Applications: Verified Compilers and Security
  5. Open Problems and Research Frontiers

Conclusion

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