Skip to main content
QUICK REVIEW

[Paper Review] Kleene Algebra with Tests and Coq Tools for While Programs

Damien Pous|arXiv (Cornell University)|Feb 7, 2013
Logic, programming, and type systemsComputer Science17 references6 citations
TL;DR

This paper presents a Coq library for Kleene Algebra with Tests (KAT), providing a reflexive decision procedure for equational reasoning over while programs. It enables automated verification of program equivalences, Hoare logic rules, compiler optimizations, and complex flowchart scheme equivalences by formalizing completeness, a decision procedure, and hypothesis elimination in a machine-checked setting.

ABSTRACT

We present a Coq library about Kleene algebra with tests, including a proof of their completeness over the appropriate notion of languages, a decision procedure for their equational theory, and tools for exploiting hypotheses of a particular shape in such a theory. Kleene algebra with tests make it possible to represent if-then-else statements and while loops in most imperative programming languages. They were actually introduced by Kozen as an alternative to propositional Hoare logic. We show how to exploit the corresponding Coq tools in the context of program verification by proving equivalences of while programs, correctness of some standard compiler optimisations, Hoare rules for partial correctness, and a particularly challenging equivalence of flowchart schemes.

Motivation & Objective

  • To provide a machine-checked, formal Coq library for Kleene Algebra with Tests (KAT) to support automated reasoning about imperative programs.
  • To formalize the completeness of KAT axioms over guarded string languages and develop a provably correct decision procedure for equational reasoning.
  • To enable automation in program verification by integrating reflexive tactics for KAT, reducing manual proof effort.
  • To support verification of challenging program equivalences, such as Paterson’s flowchart schemes, by eliminating complex manual derivations.

Proposed method

  • The authors formalize KAT as a combination of a Kleene algebra and a Boolean algebra with a homomorphism from tests to Kleene elements.
  • They develop a reflexive tactic in Coq that leverages automata-based algorithms to decide language equivalence of KAT expressions.
  • The decision procedure is built on formalized regular expression derivatives, finite sets, and matrix representations, ensuring correctness and completeness.
  • A completeness proof is established over the model of guarded string languages, relying on foundational formalizations of finite sums, atoms, and expansion theorems.
  • Hypothesis elimination techniques are implemented to simplify reasoning by removing redundant or redundant-like assumptions.
  • The library is designed to be extensible, supporting future formalizations of relation algebra fragments like Kleene algebra with converse or allegories.

Experimental results

Research questions

  • RQ1Can a reflexive decision procedure be formally implemented in Coq for the equational theory of Kleene Algebra with Tests (KAT)?
  • RQ2How can completeness of KAT axioms over guarded string languages be formally proven within Coq?
  • RQ3To what extent can automated tactics in Coq reduce the complexity of proving program equivalences in imperative languages?
  • RQ4Can the formalized KAT library automate the verification of standard compiler optimizations and Hoare logic rules?
  • RQ5How effective is the library in simplifying complex, published proofs such as those involving Paterson’s flowchart schemes?

Key findings

  • The Coq library formalizes the completeness of KAT axioms over guarded string languages, providing a solid foundation for equational reasoning.
  • The reflexive decision procedure correctly and efficiently checks KAT equational equivalences, enabling automation of proofs that were previously laborious.
  • The library reduces the proof length of complex examples—such as Paterson’s flowchart schemes—by replacing multi-page manual derivations with single tactic calls.
  • The formalization includes 4377 lines of specifications and 3020 lines of proofs, with a significant portion dedicated to completeness and decision procedures.
  • The library supports automation for Hoare logic rules and compiler optimizations, demonstrating practical utility beyond theoretical formalization.
  • The library is extensible and axiom-free, with components designed to support future formalizations of related algebraic structures like Kleene algebra with converse.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.