Reference. Verified Foundations for Differential Privacy
Differential privacy (DP) has become the gold standard for privacy-preserving data analysis, but implementing it correctly has proven challenging. Prior work has focused on verifying DP at a high level, assuming either that the foundations are correct or that a perfect source of random noise is available. However, the underlying theory of differential privacy can be very complex and subtle. Flaws in basic mechanisms and random number generation have been a critical source of vulnerabilities in real-world DP systems. In this paper, we present SampCert, the first comprehensive, mechanized foundation for executable implementations of differential privacy. SampCert is written in Lean with over 12,000 lines of proof. It offers a generic and extensible notion of DP, a framework for constructing and composing DP mechanisms, and formally verified implementations of Laplace and Gaussian sampling algorithms. SampCert provides (1) a mechanized foundation for developing the next generation of differentially private algorithms, and (2) mechanically verified primitives that can be deployed in production systems. Indeed, SampCert’s verified algorithms power the DP offerings of Amazon Web Services, demonstrating its real-world impact. SampCert’s key innovations include: (1) A generic DP foundation that can be instantiated for various DP definitions (e.g., pure, concentrated, Rényi DP); (2) formally verified discrete Laplace and Gaussian sampling algorithms that avoid the pitfalls of floating-point implementations; and (3) a simple probability monad and novel proof techniques that streamline the formalization. To enable proving complex correctness properties of DP and random number generation, SampCert makes heavy use of Lean’s extensive Mathlib library, leveraging theorems in Fourier analysis, measure and probability theory, number theory, and topology.
Cite
Cited by (2)
Modular Verification of Differential Privacy in Probabilistic Higher-Order Separation Logic haselwarter-2026-modular
Differential privacy is the standard method for privacy-preserving data analysis. The importance of having strong guarantees on the reliability of implementations of differentially private algorithms is widely recognized and has sparked fruitful research on formal methods. However, the design patterns and language features used in modern DP libraries as well as the classes of guarantees that the library designers wish to establish often fall outside of the scope of previous verification approaches. We introduce a program logic suitable for verifying differentially private implementations written in complex, general-purpose programming languages. Our logic has first-class support for reasoning about privacy budgets as a separation logic resource. The expressiveness of the logic and the target language allow our approach to handle common programming patterns used in the implementation of libraries for differential privacy, such as privacy filters and caching. While previous work has focused on developing guarantees for programs written in domain-specific languages or for privacy mechanisms in isolation, our logic can reason modularly about primitives, higher-order combinators, and interactive algorithms. We demonstrate the applicability of our approach by implementing a verified library of differential privacy mechanisms, including an online version of the Sparse Vector Technique, as well as a privacy filter inspired by the popular Python library OpenDP, which crucially relies on our ability to handle the combination of randomization, local state, and higher-order functions. We demonstrate that our specifications are general and reusable by instantiating them to verify clients of our library. All of our results have been foundationally verified in the Rocq Prover.
Verifying Exact Samplers for Continuous Distributions with a Discrete Program Logic demedeiros-2026-verifying
Most implementations of sampling algorithms for continuous distributions use floating-point numbers, which introduce round-off errors and approximations. These errors can be difficult to analyze, and can cause security issues when used in algorithms for differential privacy. An alternative is to use exact sampling algorithms based on computable reals, which can lazily generate the digits of a continuous sample to arbitrary precision. However, these algorithms are intricate, and implementing and using them involves a combination of semantically challenging language features, such as probabilistic choice, higher-order functions, and dynamically-allocated mutable state. In this paper we present Continuous-Eris, a higher-order separation logic for verifying the correctness of exact sampling algorithms for computable distributions. To demonstrate Continuous-Eris, we verify the correctness of computable samplers for the uniform, Gaussian, and Laplace distributions, as well as a library for exact real arithmetic for working with generated samples. All of the results in this paper have been verified in the Rocq proof assistant.
Cites 49 works (0 here)
External (49)
- Artifact for Verified Foundations for Differential Privacy (2025)
- Artifact for Verified Foundations for Differential Privacy (2025)
- Formalization of Differential Privacy in Isabelle/HOL (2025)
- Contextual Linear Types for Differential Privacy (2023)
- Verified Differential Privacy for Finite Computers (CoqPL 2023) (2023)
- Are We There Yet? Timing and Floating-Point Attacks on Differential Privacy Systems (2022)
- Tumult Analytics: a robust, easy-to-use, scalable, and expressive framework for differential privacy (2022)
- DDUO: General-Purpose Dynamic Analysis for Differential Privacy (2021)
- Coupled Relational Symbolic Execution for Differential Privacy (2021)
- The Lean 4 Theorem Prover and Programming Language (2021)
- Learning Differentially Private Mechanisms (2021)
- A list of real-world uses of differential privacy (2021)
- The discrete gaussian for differential privacy (2020)
- CheckDP: An Automated and Integrated Approach for Proving Differential Privacy or Finding Precise Counterexamples (2020)
- Testing differential privacy with dual interpreters (2020)
- Duet: an expressive higher-order language and linear type system for statically enforcing differential privacy (2019)
- Proving differential privacy with shadow execution (2019)
- Diffprivlib: the IBM differential privacy library (2019)
- Differentially private SQL with bounded user contribution (2019)
- The U.S. Census Bureau Adopts Differential Privacy (2018)
- Synthesizing coupling proofs of differential privacy (2018)
- DP-Finder (2018)
- Detecting Violations of Differential Privacy (2018)
- Differential privacy on finite computers (2017)
- Understanding the sparse vector technique for differential privacy (2017)
- Rényi Differential Privacy (2017)
- Differential Privacy Overview (Apple) (2017)
- Privacy loss in Apple's implementation of differential privacy on MacOS 10.12 (2017)
- Advanced Probabilistic Couplings for Differential Privacy (2016)
- Proving Differential Privacy via Probabilistic Couplings (2016)
- Concentrated Differential Privacy: Simplifications, Extensions, and Lower Bounds (2016)
- PSI: Exact Symbolic Inference for Probabilistic Programs (2016)
- LightDP: towards automating differential privacy proofs (2016)
- Concentrated differential privacy (2016)
- A Verified Compiler for Probability Density Functions (2015)
- The Algorithmic Foundations of Differential Privacy (2014)
- Linear dependent types for differential privacy (2013)
- Probabilistic relational reasoning for differential privacy (2012)
- On significance of the least significant bits for differential privacy (2012)
- A Categorical Approach to Probability Theory (2010)
- Dafny: An Automatic Program Verifier for Functional Correctness (2010)
- Distance makes the types grow stronger (2010)
- Privacy integrated queries (2009)
- A Machine-Checked Proof of the Average-Case Complexity of Quicksort in Coq (2009)
- Proofs of Randomized Algorithms in Coq (2006)
- Our Data, Ourselves: Privacy Via Distributed Noise Generation (2006)
- Calibrating Noise to Sensitivity in Private Data Analysis (2006)
- Formal verification of probabilistic algorithms (Tech. Rep. UCAM-CL-TR-566) (2003)
- Simple Demographics Often Identify People Uniquely (2000)