A General Framework for Sound and Complete Floyd-Hoare Logics
This paper presents an abstraction of Hoare logic to traced symmetric monoidal categories, a very general framework for the theory of systems. Our abstraction is based on a traced monoidal functor from an arbitrary traced monoidal category into the category of pre-orders and monotone relations. We give several examples of how our theory generalises usual Hoare logics (partial correctness of while programs, partial correctness of pointer programs), and provide some case studies on how it can be used to develop new Hoare logics (run-time analysis of while programs and stream circuits).
💡 Research Summary
The paper proposes a highly abstract, category‑theoretic formulation of Hoare logic that works uniformly for any computational or dynamical system whose semantics can be expressed as a traced symmetric monoidal category (TSMC). The authors introduce the “Hoare category” H, whose objects are pre‑ordered sets and whose morphisms are monotone relations. H is itself a symmetric monoidal category under cartesian product, and it carries a trace operation induced by the product, making it a TSMC.
A central notion is the verification functor H : S → H, where S is a TSMC that models the semantics of a block‑diagram language L (e.g., while programs, pointer programs, stream circuits). The functor must strictly preserve the three structural operations of L: sequential composition, parallel composition, and feedback (trace). These preservation conditions are expressed as (SC1)–(SC3) in the paper. When such a functor exists, a concrete program A with semantics ⟦A⟧ : X → Y induces a monotone relation H(⟦A⟧) : H(X) → H(Y). An abstract Hoare triple {P} A {Q} is then defined simply as the relational statement P H(⟦A⟧) Q.
The authors give a syntactic axiom system HL(L,⟦·⟧,H) that mirrors the usual Hoare rules but is entirely derived from the categorical structure: an axiom for each primitive block diagram, a consequence rule (monotonicity), a sequential composition rule (Seq), a parallel composition rule (Par), and a feedback rule (Fb). Because the rules are justified solely by the functorial preservation properties, any system that admits a verification functor automatically inherits a sound and complete Hoare‑style logic.
Soundness follows immediately from the monotonicity of H(⟦·⟧) and the preservation of composition, product, and trace. Completeness is proved by showing that any true triple {P} A {Q} can be derived by decomposing A into primitive blocks and applying the appropriate rule; the existence of an intermediate assertion Q for sequential composition is guaranteed by the functor’s respect for composition.
Four concrete instantiations illustrate the framework’s breadth:
-
Partial correctness of while programs – S is the category of flow‑charts (objects are sets of states, morphisms are relations), and H maps each state set to the preorder of logical assertions ordered by entailment. The verification functor reproduces the classic Hoare logic.
-
Separation logic for pointer programs – The same categorical skeleton is used, but H now interprets assertions as resource specifications (sets of heap fragments) ordered by inclusion, yielding O’Hearn‑Reynolds’ separation logic as a special case.
-
Run‑time analysis – Assertions become numeric upper bounds on execution steps, forming a preorder under ≤. The trace operator models loop unrolling, and the resulting Hoare rules give sound and complete reasoning about termination and time complexity.
-
Stream circuits (linear dynamical systems) – Objects are signal spaces, morphisms are linear relations, and feedback corresponds to the usual signal‑flow trace. Assertions are predicates on signal amplitudes (e.g., energy bounds), allowing verification of stability and performance properties.
The paper also situates its contribution relative to earlier categorical approaches (Lawvere theories, 2‑categories, etc.), emphasizing that the trace structure of TSMCs captures feedback and unbounded iteration directly, which is essential for modeling loops and continuous‑time systems without auxiliary fixed‑point constructions.
In conclusion, by abstracting Hoare logic to the level of traced symmetric monoidal categories and a single verification functor, the authors provide a uniform recipe for building sound and complete Hoare‑style logics for a wide variety of computational models. The framework promises extensibility to more exotic domains such as quantum circuits, distributed protocols, or hybrid systems, and suggests a path toward automated generation of verification functors, potentially integrating with proof assistants and model‑checking tools.
Comments & Academic Discussion
Loading comments...
Leave a Comment