Program Verification via Constrained Horn Clauses

This direction is no longer present in the current build. Its last version stays readable and citable here.

Version 1 of 116 papers18 conceptsfrozen 2026-10-04

The central challenge of program verification is finding a formal proof that a program never enters an "error" state. Traditionally, this required building bespoke analyzers for every language and every property. A powerful research direction has emerged to unify these efforts: translating program semantics into Constrained Horn Clauses (CHCs) and using general-purpose Satisfiability Modulo Theories (SMT) solvers to find the proof.

By decoupling the description of the program from the search for its correctness, researchers have created a flexible, automated pipeline for verifying everything from Android apps to blockchain smart contracts.

The Core Abstraction: Programs as Logic

To verify a program, we must reason about its state transitions. A Constrained Horn Clause is a logical implication of the form: $$P_1(x) \land \dots \land P_n(x) \land \phi(x, x') \implies Q(x')$$ In the context of verification, these predicates ($P, Q$) represent sets of safe program states, and the constraint ($\phi$) represents a command or transition (like x = x + 1).

As Bishoksan Kafle and colleagues explain in An iterative approach to precondition inference using constrained Horn clauses, this representation transforms program safety into a logical consistency task. If an SMT solver can find a "satisfying assignment" for these predicates—essentially a mathematical description of the safe states—it has effectively synthesized an inductive invariant. This invariant serves as a formal proof that the error state is unreachable.

Decoupling Analysis from Resolution

The primary advantage of this approach is modularity. Once a program is converted into CHCs, the verification engine doesn't need to know if the original code was written in C, Java, or Solidity.

For example, Ilya Grishchenko and Matteo Maffei applied this to mobile security in HornDroid: Practical and Sound Static Analysis of Android Applications by SMT Solving. By translating Android bytecode and lifecycle events into Horn clauses, they could use off-the-shelf solvers to detect data leaks. This allowed them to outperform specialized tools because they could leverage the rapid advancements in general SMT solving technology.

Similarly, Clara Schneidewind and her team developed eThor: Practical and Provably Sound Static Analysis of Ethereum Smart Contracts, which models the Ethereum Virtual Machine (EVM) using CHCs. This approach allowed them to provide mathematical guarantees of soundness in a domain where bugs often lead to immediate financial loss.

Handling Complexity: Higher-Order and Probabilistic Code

The CHC framework is surprisingly expressive, capable of modeling features that are traditionally difficult for static analysis:

Why It Works: The Power of SMT

The "magic" of this direction lies in the efficiency of modern solvers. Tools like CBMC, described by Daniel Kroening and Peter Schrammel in CBMC: The C Bounded Model Checker, transform program logic into bit-precise equations. When a solver finds these equations are unsatisfiable, it confirms the program is safe. If they are satisfiable, the solver provides a "counterexample"—a concrete execution trace that proves a bug exists.

By unifying these diverse problems—from reentrancy in smart contracts (Chang Chu in CEIHorn) to thread synchronization (Deepak D'Souza and P. Madhusudan in Horn-ICE Learning for Synthesizing Invariants and Contracts)—under the umbrella of Constrained Horn Clauses, the field has moved toward a "universal compiler" for formal proofs.

Papers in this version

History & citationVersion 1 · 2026-10-04

No longer present in the current build · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_program_verification_via_constrained_hor_658cb841,
  title = {Program Verification via Constrained Horn Clauses},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/program-verification-via-constrained-horn-clauses/rdr_658cb841f5f64105ae12ee81eff2ff49},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-25},
}

This exact version (version 1, frozen text):

@misc{lacuna_program_verification_via_constrained_hor_658cb841_v1,
  title = {Program Verification via Constrained Horn Clauses},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/program-verification-via-constrained-horn-clauses/rdr_658cb841f5f64105ae12ee81eff2ff49/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-25},
}