Manuscript Offprint
arXiv:2610.23604A Taxonomy of Predicate Transformer Monads for Specifying Monadic Programs
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abigail Pribisova , Yao Li , Cezar-Constantin Andrici , Cătălin Hritcu , Kenji Maillard , and Exequiel Rivas
MPI-SP, Bochum, Germany
{abigail.pribisova,cezar.andrici,catalin.hritcu}@mpi-sp.org
Portland State University, USA liyao@pdx.edu
Inria, Nantes, France kenji.maillard@inria.fr
Tallinn University of Technology, Estonia execuiel.rivas@ttu.ee
Abstract. Monads of weakest precondition predicate transformers are the foundation of several verification frameworks for monadic programs. For specifying monadic computations with nondeterminism and nontermination, in addition to weakest preconditions, we introduce the first strongest postcondition monads covering all combinations of angelic or demonic nondeterminism and partial or total interpretations of nontermination. For extending these base strongest postcondition monads with side effects such as mutable state, monad transformers do not yield the expected monads, so we instead generalize the base monads to arrows and use arrow transformers. We give a taxonomy of weakest precondition and strongest postcondition monads, for the base monads and for their versions with state, and show that the known relationships between under- and over-approximate triples based on predicate transformers already hold at the level of the predicate transformers themselves. We use the predicate transformer monads to define under- and over-approximate triples and, where possible, Dijkstra monads. Finally, we relate these two specification styles.
Keywords: strongest postcondition · weakest precondition · monads · arrows · program logics · under-approximation · over-approximation
1 Introduction
Program logics provide a formal way to specify what programs can or should do, and to verify that programs meet their specifications. For programs with non-determinism, a logic usually either takes a demonic interpretation, requiring all executions to satisfy the specification, or an angelic one requiring the existence of such an execution. For divergence, a total interpretation requires termination, while a partial/liberal one allows divergence. These logics are often presented as deductive systems over triples relating a precondition p, a program c, and a post-condition q. The semantics of triples can often be phrased via Dijkstra's weakest precondition (wp) or strongest postcondition (sp) predicate transformers [10–12].
Pribisova et al.
For example, the triple is valid in partial correctness Hoare logic [3, 16] exactly when , where dwlp is the demonic, liberal wp variant [11]. In fact, this logic admits a second such characterization [37]: the triple is also valid exactly when , for , the angelic, total sp variant.
These predicate transformer characterizations of triples are not limited to reasoning about correctness. O'Hearn's incorrectness logic [30], which specifies which states a program can reach (e.g., error states), uses the same transformer with the implication reversed; the triple is valid exactly when . Unlike Hoare logic, there is no equivalent wp characterization [37]. Incorrectness logic triples are called under-approximate, as q under-approximates the reachable states . In contrast, Hoare logic triples are over-approximate, as q over-approximates the reachable states. For simple imperative programs, Verscht and Kaminski [37] taxonomize these under- and over-approximate triples for four wp variants and four sp variants [37, 39], corresponding to the standard interpretations of nondeterminism and nontermination: angelic-demonic and total-liberal.
Triples and wps have also been used to verify monadic programs [13, 14, 26, 28, 29, 32–35], which can be shallowly embedded in proof assistants, making verification convenient. A key insight was that the specifications of monadic programs also have monadic structure, so they compose with ret and bind as the programs do. Swamy et al. [33, 34] showed that wps form such a monad. But how do we define wps modularly, one effect at a time? Maillard et al. [26] observe that if we start with a base monotone wp monad , where is the type of propositions, we can add effects with the same monad transformers as for computation monads. For instance, the state monad transformer turns into the usual monad of stateful wps, of type . Such wp monads have been used in verification frameworks including [2, 26, 33, 34] and Loom [14].
Monads of sps are less understood. For a start, monotone sps alone do not form a lawful monad. Maillard et al. obtain a base sp monad of type SPost(A) := P → (A → P) by further restricting the carrier to predicate transformers whose postconditions imply the precondition. We observe that the resulting monad can specify not only pure programs, but also nondeterministic and nonterminating ones, under an angelic and total interpretation. In this paper we introduce the first sp monads for all four interpretations of nondeterminism and nontermination by instead restricting the carrier to standard classes of predicate transformers [8]: the angelic monad variants are disjunctive (i.e., preserve potentially infinite non-empty disjunctions), demonic ones conjunctive (i.e., preserve such conjunctions), total ones strict (i.e., ⊥ precondition results in ⊥ postcondition), and liberal ones terminating (i.e., ⊥ precondition results in ⊥
For sps, angelic and demonic refer to whether some or all of the initial states from which a final state is reachable must satisfy the precondition. This matters when several initial states reach the same final state, even in deterministic programs [37]. Similarly, the postcondition of a total sp only contains final states reached from the precondition, while that of a liberal sp also contains final states that nothing reaches.
postcondition). Applying similar restrictions to the monotone wp monad gives one wp monad per interpretation. While these four wp monads are submonads of the WPure monad above, the four sp monads are more interesting, since each of them needs its own ret and bind tailored to its carrier restriction.
When also considering effects such as state, a further challenge is effect modularity: adding the ability to reason about new effects by applying a monad transformer, which yields a lawful monad for free. The state monad transformer, however, does not turn these base sp monads into the monads we expect for stateful sps, producing instead: . Such an sp takes one initial state and, separately, one precondition proposition, whereas a stateful sp should take a precondition that is a predicate over initial states, as in the type . Underlying this is a more basic challenge: even setting modularity aside, there was no known way to construct lawful stateful sp monads of the expected shape, which need a restricted carrier and a matching ret and bind, separately for each of the four interpretations.
We solve both challenges by generalizing our sp monads to Hughes arrows with application [17], since arrow transformers then yield stateful sp monads of the expected shape in an effect-modular way. We start with a base arrow of type SPArr(B, A) := (B → P) → (A → P) satisfying a variant of the carrier restrictions above. By fixing the input type B to unit, an arrow with application yields a monad [24]:
Moreover, since arrows have an input type, which arrow transformers can extend, applying the state arrow transformer gives us , which, when the input type is fixed, provides the expected shape of a stateful sp monad. Crucially, the resulting stateful monads inherit the carrier restriction and lawfulness of the base arrow, since the state arrow transformer only adds the state to the input and output types.
This allows us to give a taxonomy of these base and stateful sp and wp monads (Fig. 1, in §4) and show that the relationships established by Verscht and Kaminski [37] between under- and over-approximate triples already hold for the predicate transformers themselves. Additionally, we use the predicate transformer monads to define under- and over-approximate triples and, where possible, Dijkstra monads [2, 26, 33]. A Dijkstra monad is a monad-like structure of computations indexed by elements of a specification monad [26]. A specification monad is ordered by specification precision so that bind is monotone [15, 20].
We make the following contributions:
▶ We introduce the first lawful sp monads covering all four interpretations of nondeterminism and nontermination. They are derived from arrows with application restricted to preserve non-empty disjunctions (angelic) or conjunctions (demonic), and ⊥ (total) or ⊥ (liberal). This allows adding state using arrow transformers, whereas monad transformers do not yield the expected monads. We also obtain four base wp monads by applying similar restrictions directly to the monotone wp monad [26]. Unlike the wp monads, which are all submonads of the same monad, each sp monad has its own ret and bind.
Pribisova et al.
▶ We recast Verscht and Kaminski's taxonomy of triples [37] as a taxonomy of the eight wp and sp monads, and show that the relationships they establish between under- and over-approximate triples already hold for predicate transformers, both for the base monads and for their versions with state.
▶ We construct triples (precondition, monadic computation, postcondition) in terms of monad morphisms from our base computation monad of nondeterminism and nontermination into our eight wp and sp monads. We also add state and exceptions to both the computation monad and the wp and sp monads and lift the monad morphisms for free, through monad transformers as in DM4All [2, 26] and through arrow transformers for the sps. This, for instance, allows us to define the semantics of incorrectness logic triples for monadic programs as , analogous to O'Hearn's original definition above [30]. We use the monad morphisms to prove that simple programs satisfy triples for both correctness and incorrectness in a style inspired by Loom [14], though focused not on automation but on generality, since we consider both over- and under-approximation, sps, and general wps.
▶ We show that our new asp and dslp monads and all wp monads form specification monads [26]. This lets us verify monadic programs by comparing the specification produced by one of our monad morphisms with the intended specification using the specification monad's order. This covers both over- and under-approximation by flipping the order, and as for triples, we use this to verify simple monadic programs. As these predicate transformer monads are specification monads, our monad morphisms targeting them give rise to Dijkstra monads [26]. The dsp and aslp monads have binds that are not monotone with respect to their natural orders, so they are not specification monads, which limits how specifications can be weakened and composed.
▶ For intended specifications expressed as triples, we show that the Loom-inspired verification style and the Dijkstra monad-inspired one are conceptually equivalent for the specification monads based on wps as well as over-approximate asp and under-approximate dslp. This requires turning triples into predicate transformers, which we show is possible for the specification monads above, but not for under-approximate asp and over-approximate dslp.
To study the expressive power of our stateful sp and wp specification monads, we compare them to stateful versions of existing specification monads [26], such as predicates on results and pairs of pre- and postconditions, by establishing Galois connections, some of which are isomorphisms. In particular, we show that the known isomorphism [25] between the predicate monad and the base sp monad of Maillard et al. extends to isomorphisms between asp and dwlp and between dslp and awp as specification monads in the stateful setting.
▶ We fully mechanize all definitions and proofs in Rocq.
Artifact and use of AI. The Rocq development is available at https://github.com/lastland/SpecMonad/tree/main/Code. It was developed in part interactively with the help of AI coding agents (Claude, Codex, and OpenCode), es-pecially for proofs, which are machine-checked by Rocq. Any AI-generated code that affects the trusted computing base (definitions and theorem statements) was carefully reviewed by the authors. AI agents were used to help with IATEX programming and to improve some of the text of the paper; we wrote the original text, checked all proposed improvements, and take full responsibility for the paper and artifact.
We call this base wp monad WP. This monadic structure of wps has been exploited to naturally compose specifications, and to map monadic computations to their predicate transformer semantics [26].
Predicates over any type are ordered as subsets, or equivalently by pointwise logical implication, which we write : for iff . In general, one works with monotone predicate transformers that preserve the order relations on predicates [8, 12]. The monotonicity condition on wp is, for all postconditions :
For example, is a monotone predicate transformer, as the condition unfolds into which trivially holds. is also a monotone predicate transformer, provided that both and are monotone predicate transformers.
Moreover, not only predicates are ordered, but also predicate transformers themselves can be ordered in a pointwise manner:
Then, a natural question is whether the monadic structure preserves such order on predicate transformers. For weakest precondition monads, both ret and bind preserve the order above.
For stateful programs with state type S, preconditions must refer to the initial state and postconditions to the result and final state. Following Maillard et al. [26], we can do so systematically by applying the state monad transformer StT to the WP monad described above. Now the postcondition predicates are not only
Pribisova et al.
on the underlying type, but also on the state (A × S → P), while preconditions are predicates over the initial state (S → P). This gives the following monadic structure on StT(WP)(S, A) := (A × S → P) → S → P, which is essentially the same as above, but threading around the state:
Again, these predicates are naturally ordered, and we restrict the carrier to predicate transformers that are monotone. For this monad, the monadic structure (ret, bind) also respects the monotonicity condition.
3 Strongest Postcondition Monads
In contrast to wps, sps map preconditions to postconditions. In the base case, an sp is therefore a function from predicates on 1 to predicates on A, of type . Unlike for wps, there is no well-known monad of a similar shape to inspire our definitions of ret and bind.
3.1 Base sp Monads
Maillard et al. [26] define a base sp monad, , with the following ret and bind, inspired by the treatment of skip and sequencing in the classical strongest postcondition calculus [12]:
(ang)
To satisfy the monad laws, they consider monotone sps of the smaller type (pre: ) (A ), where . This smaller type suffices for the monad laws, and we observe that it is, in fact, equivalent to a carrier of disjunctive, strict sps.
Disjunctivity and strictness (along with conjunctivity and termination, introduced shortly) are properties of predicate transformers that form classes closed under sequential composition. Therefore, they are usually called homomorphism properties. Using an sp as an example, for every non-empty family of preconditions , the disjunctivity condition on sp states that:
where the disjunction of predicates is taken pointwise:
An sp is strict when it maps to , i.e., preserves empty disjunctions. The disjunctivity condition is defined with respect to preconditions of any shape. In order to provide intuition, we briefly switch to the stateful setting, where computations take an initial state and (potentially) produce an output.
For disjunctivity, Back and von Wright [8] showed that disjunctive predicate transformers correspond to angelic interpretations of program semantics.
For now, fix an output that the computation can produce, and consider the initial states from which it can produce . An angelic includes in the post-condition when some of these initial states satisfy the precondition . For a precondition , some initial state that produces satisfies () only if that initial state satisfies () or satisfies (), with the same argument working for any non-empty family of preconditions. The precondition is checked on each initial state separately.
For strictness, Back and von Wright [8] showed that strict predicate transformers correspond to a total interpretation of program semantics. A total interpretation of an sp requires that the postcondition only includes outputs that the computation produces from an initial state in the precondition. Therefore, if the precondition is empty, , then no such outputs exist, . We therefore define as the angelic, total monad, with a carrier restricted to strict, disjunctive sps, meaning sps preserving all disjunctions, whether empty or non-empty, represented by the following refinement type:
and with the same ret and bind as (ang). We note that the strictness condition is covered by the empty case.
Two other properties of interest are conjunctivity and termination. An sp is conjunctive when for every non-empty family of preconditions
where the conjunction of predicates is taken pointwise:
An sp is terminating when it maps to , i.e., preserves empty conjunctions.
For conjunctivity, Back and von Wright [8] showed that conjunctive predicate transformers correspond to demonic interpretations of program semantics. Again, fix an output r and consider the initial states from which the computation can produce it. A demonic sp includes r in when all of these states satisfy p. Every initial state that produces r satisfies only if every such initial state satisfies and every such initial state satisfies . Here, the precondition is also checked on each initial state separately. The main difference is that an angelic sp looks for one initial state that satisfies the precondition, while a demonic sp looks for one initial state that falsifies it.
For termination, Back and von Wright [8] showed that terminating predicate transformers correspond to a partial interpretation of program semantics. A partial interpretation of an sp requires that the postcondition includes outputs that no initial state produces, as well as outputs produced from initial states in the precondition. Therefore, if all initial states satisfy the precondition, the precondition, then this represents all possible outputs, either produced from some initial state or produced by none, which is the postcondition.
We care about these classes for two reasons. These classes are carrier restrictions under which our other sp monads are lawful. Without disjunctivity
Pribisova et al.
or conjunctivity, the associativity of our stateful bind fails We work through a counterexample in Appendix E. Additionally, they match the four interpretations of nondeterminism and nontermination, so each of our monads contains exactly the predicate transformers of programs under its interpretation.
Keeping the ret and bind from above while changing only the carrier restriction to conjunctive, terminating sps does not yield the corresponding monad. The restricted carrier has the following refinement type, where the empty case expresses termination:
We obtain a lawful demonic, liberal monad by also modifying the ret and bind as follows:
(dem)
The total ret says that is produced and equals , and pre holds . The partial one says that if is produced and equals , then pre holds , which vacuously admits every . The angelic bind says that is produced through some intermediate value and pre holds . The demonic one says that, for every intermediate value , if is produced through , then pre holds .
To construct and , we restrict their carriers to conjunctive, strict sps and to disjunctive, terminating sps, respectively. To define ret and bind, we build on the observation of Verscht and Kaminski [37, §3.2.4] that dsp and aslp predicate transformers do not have an inductive definition but can be defined in terms of asp and dslp transformers. For ret, we get:
Defining bind is not so straightforward though. Simply taking bind does not type-check, since and expect asp and dslp predicate transformers, whereas m and f a are dsp or aslp predicate transformers. Let us consider just . We utilize the fact that a dsp predicate transformer can be decomposed into an asp component and a dslp component, whose conjunction characterizes the same set of results as the dsp predicate transformer itself. We calculate this asp component as follows:
The first conjunct, , states that is produced. The second conjunct, , rules out that does not hold while is produced, so holds or is not produced. The conjunction of the two admits exactly when is produced and holds, which is the behavior of an predicate transformer.
We calculate the component as follows:
The first disjunct, sp pre a, states that pre holds and a is produced. The second disjunct, , states that a is not produced. The disjunction of the two admits a exactly when a being produced implies pre holding, which is the behavior of a dslp predicate transformer. Both “exactly when” steps are classical. Deriving pre from a being produced together with produced), and turning the implication back into the disjunction, use excluded middle.
We prove that for any sp : SP (A), sp admits the same outputs as the conjunction aspOf sp ∧ dslpOf sp (§F.1). We can therefore define bind as follows, for m : SP (A) and f : A → SP (B):
This gives us a lawful SP (A) monad. For SP (A), we have similar functions aspOf and dslpOf, but we construct bind via the disjunction of the asp and dslp components. In §F.2, we give these function definitions and prove that the disjunction admits the same outputs as the original aslp transformer.
This gives us four “pure” base sp monads. When reasoning about monadic programs like stateful programs, we would like to apply monad transformers to pure sp monads to derive effectful sp monads, as is done on the wp side [25]. Unfortunately, using the state monad transformer to derive their stateful versions gives an unexpected type: . Such sps take an initial state and a separate proposition and return a postcondition, whereas stateful sps should take a precondition that ranges over initial states and return a postcondition. This is a lawful monad, but it is unclear how to interpret its elements as stateful sps.
3.2 Base sp Arrows
To remedy this, we observe that a monad is only parameterized by an output type, and an sp that wants to lift the type of its preconditions automatically, like on the wp side, would benefit from a structure that is parameterized over both an input and output type. Based on this observation, we propose using Hughes' arrows and arrow transformers to derive stateful sps [17]. Arrows are parameterized by both an input type and an output type, which gives precise control over how lifting affects both the input and output.
In its basic form, an arrow can be defined as a structure with the following operations:
Intuitively, arr lifts a function to an arrow. The operation composes two arrows x and y together by feeding the output of x to the input of y, and first takes an arrow x and makes it an arrow that additionally carries an “environment”. The first operator is also known as the strength of arrows [4]. These arrows need to satisfy particular arrow laws, detailed in Appendix A.
Pribisova et al.
All monads yield arrows, but not all arrows can be turned into monads [24]. Given a monad M, we can derive an arrow as follows:
In Hughes [17], this is known as the Kleisli operation, producing a Kleisli arrow. This means that arrows are more general, but less expressive than monads. In this paper, we are only interested in structures as expressive as monads, so we consider arrows Arr with an additional application method, or app:
This variant of arrows is also defined by Hughes. The app method itself is an arrow, which takes another arrow of type and a value of type as input. It applies the arrow to the value of to obtain an output of type . This operator gives arrows the same expressiveness as monads [7]. Indeed, given an arrow with application, we can turn it into a monad by fixing the input: . The monad operations can be derived as follows:
Fixing the input type of a lawful arrow with application gives a lawful monad [17, 24], which allows us to prove the monad laws once, generically, from the arrow laws and the laws of app.
We note that we do not use the Kleisli arrows constructed by applying the Kleisli operation to our base sp monads. Every monad has a Kleisli arrow. Applying the state arrow transformer to that arrow and then fixing its input yields the same monad as applying the state monad transformer to the original monad. Therefore, we would still end up with sps of an unexpected shape. Instead, we use arrows where the input type gives the type over which preconditions are defined, so threading state through the input changes the type of the preconditions. A monad, indexed only by its output, cannot thread state through the type of the preconditions the same way.
Additionally, we can construct structured maps between arrows called arrow morphisms, which need to satisfy arrow morphism laws. An arrow morphism is a parametric family such that , , and , along with laws for choice and application ( ).
Returning to strongest postconditions, we construct base sp arrows that mirror our base sp monads: , and . We start from monotone base sp arrows of the type , where represents preconditions and represents postconditions. Therefore, monotonicity states that for any two preconditions , . We present and and refer to Appendix B for and . Their asp and dslp components are the aspOf and dslpOf of §3.1 with , , and taken pointwise. They are defined for every input and output type, so the stateful monads of §3.3 need no separate definition.
For , we restrict the arrow carrier to disjunctive, strict , mirroring the carrier restriction of the monad. For every family of preconditions on the input B:
The empty families give strictness, and non-empty families give disjunctivity. Monotonicity and strictness alone are not enough: without disjunctivity, the arrow laws fail ( E.3). Fixing B = 1 gives a monad carrier isomorphic to the carrier of .
We then define the arrow operations so that fixing B = 1 gives the same ret and bind as , which we show in §C.1:
app : ArrASP(ArrASP(B, A) × B, A) := λpre a. ∃f. ∃b.pre (f, b) ∧ f(λx. x = b) a
Intuitively, an output is admitted when some input that satisfies the precondition produces it. The definitions mirror the ret and bind of (ang), except that the precondition is now a predicate on an explicit input, over which we also quantify. ret v admits v when pre holds, while arr f admits f b for some input b that satisfies pre. At B = 1, arr (λ_. v) is ret v. Composition passes the postcondition of f to g as its precondition. Unlike bind, it needs no quantifier over intermediate values, since g, being disjunctive, quantifies over its own input. first f runs f on the first component of the input and passes the second component c through unchanged, so f receives the precondition restricted to the inputs paired with c. Finally, app takes over the existential of bind. Where bind quantifies over an intermediate value a to select the continuation f a, app quantifies over its input, an arrow f and an argument b, and runs f from exactly b.
For , we restrict the arrow carrier to conjunctive, terminating , mirroring the carrier restriction of the monad. For every family of preconditions on the input :
The empty families give termination, and non-empty families give conjunctivity. Fixing B = 1 gives a monad carrier isomorphic to the carrier of .
The relevant arrow operations are:
The definitions of and first are the same as for so we omit them. Fixing again gives the ret and bind of ( C.2). Intuitively, an output is admitted when every input that produces it satisfies the precondition, which holds vacuously for outputs and no input produces. As for , the definitions follow the ret and bind of (dem) but quantify over the explicit input, now universally. Where ret v admits a when implies pre, arr f admits
Pribisova et al.
a when every input with satisfies pre; at , is . Composition and first are unchanged, since a conjunctive quantifies universally over its own input. Here, app takes over the universal quantifier of bind, so it admits when every arrow and argument from which produces satisfy pre. Following Atkey [7], a lawful app can also be seen as a property of the arrow rather than extra structure, reflecting that the arrow corresponds to a monad.
3.3 Stateful sp Arrows and Monads
Recall that a lawful arrow, or one that satisfies the arrow laws, with application gives a lawful monad once its input type is fixed. If we start from a lawful arrow of type , then applying the state arrow transformer [17] gives . Fixing gives a lawful monad whose type is isomorphic to the expected shape of stateful sps, .
We apply the state arrow transformer to each of our base sp arrows and fix B = 1. We present the resulting and monad definitions here and refer to Appendix D for the arrow definitions, along with the and monad definitions. We check by hand that these definitions match our intuition.
Unfolding the derived ret and bind of and gives:
(ang-st)
(dem-st)
These are exactly the base definitions with the precondition now a predicate on states. ret checks the precondition on the current state, and bind hands the continuation f a the postcondition produced by m at the value a and precondition pre, which is a predicate on intermediate states.
3.4 Monads vs. Arrows
We now revisit the mismatch between the stateful sp carriers obtained using monad and arrow transformers. Focusing on angelic strongest postconditions, we show how the two constructions become isomorphic after appropriately restricting their carriers. As noted in §3.1, applying the state monad transformer to the base monad SPASP on A yields StT(SPASP)(S, A), with carrier S → P → (A × S → P). By contrast, applying the state arrow transformer to ArrASP and fixing its input type to 1 yields StArrT(ArrASP)(S, 1, A), with carrier (1 × S → P) → (A × S → P). Since the unit component is trivial, this carrier is isomorphic to (S → P) → (A × S → P). Although these carriers have different shapes, restricting both to monotone, strict, and disjunctive predicate transformers makes them isomorphic:
To see this isomorphism more concretely, consider the following maps:
which are inverses of each other.
Therefore, in this paper, we choose to work with the more familiar stateful sp presentation based on arrows. The wp side needs no arrows, since the state monad transformer gives the expected shape: . We mainly use arrows as a construction device to automatically derive lawful stateful arrows and, correspondingly, lawful stateful monads. Our study focuses on the resulting monads. We seek to showcase the behavior of these sp monads in contexts that previously only considered wp monads, such as in forming Dijkstra monads. Additionally, working with monads keeps the treatment uniform with the wp side.
From here on, we work with wp and sp monads. The taxonomy of §4, the triples, and the ordering on predicate transformers of §5 are all stated in terms of ret, bind, monad morphisms, and monadic relations. The state arrow transformer adds state to the sp monads and also lifts arrow morphisms. These maps preserve arrow structure, just as monad morphisms preserve monad structure. Since, in our setting, an arrow morphism gives a monad morphism once the input is fixed [7], we obtain the monad morphisms into the sp monads from arrow morphisms. Therefore, the state arrow transformer also “lifts” our monad morphisms. The monadic relations are proved for the base and stateful cases separately, but we believe that a similar lift from the base to the stateful case via monad and arrow transformers, could be formalized in future work.
3.5 Refined WP Monads for Nondeterminism and Nontermination
As needed for our taxonomy in §4, we also construct wp monads containing exactly the wps that match the four interpretations of nondeterminism and nontermination. We use the same carrier restrictions to construct these wp monads: disjunctive for the angelic and conjunctive for the demonic interpretation of nondeterminism, and strict for the total and terminating for the partial interpretation of nontermination. Unlike the sp monads, WP does not need such carrier restrictions in order to be a lawful monad, but they allow us to define the monads WP_AWP, WP_DWLP, WP_DWP, and WP_AWLP, corresponding to our four sp monads. All the wp monads share the ret and bind of WP, since ret satisfies all four homomorphism properties and bind preserves each of them. This makes the four wp monads submonads of WP, each carrier is a subset of WP's that is closed under its ret and bind, so each inherits WP's monad structure and laws, and any two wps can be compared inside WP (§4.2).
4 Taxonomy of Predicate Transformer Monads
We recast the taxonomy of triples of Verscht and Kaminski [37] as a taxonomy of predicate transformer monads. In Fig. 1, diagram (a) details the relationships
Pribisova et al.

(a) Base monads

(b) Monads with state
Implication Contrapositive Adjunct
Fig. 1. Monadic relations between the monads of predicate transformers, with the SP monads on top and the WP monads below, (a) for the base monads and (b) for the monads with state. In (a), and are isomorphic ( ) to and . Unmarked implications relate the elements of the two monads; in (b), * and ★ mark implications that compare their aspOf and dslpOf components, respectively. An adjunction points from its left adjoint to its right adjoint.
for our base effects of nondeterminism and nontermination, for which some of the sp monads are isomorphic ( ) while diagram (b) details the relationships between the monads obtained after adding the state effect, which corresponds to the stateful triple taxonomy of Verscht and Kaminski. We replicate the implications, the contrapositive relations, and the Galois connections between triples as monadic relations between the predicate transformer monads.
4.1 Taxonomy of Triples
Verscht and Kaminski present a taxonomy of triples. Each triple relates a program , a precondition , and a postcondition . Its validity is expressed using a predicate transformer variant, for example as . They relate triples using three relations: implications, contrapositivity and Galois connections. For implication, one triple implies another if validity of a triple in one logic implies its validity in the other logic. For contrapositivity, two triples are contrapositives if one triple is valid in one logic iff the other triple is valid in the other logic with the precondition and postcondition negated. Given predicate transformers and , and form a Galois connection when for any and , is valid if and only if is valid. Here, is the left adjoint and is the right adjoint.
Analyzing their taxonomy of triples, which they construct by fixing the precondition, postcondition, and program, except that a contrapositive relation negates the precondition and the postcondition, leads us to the following observations, which inspire our recast.
First, for imperative programs, predicate transformers are defined recursively over the structure of the program. However, it need not be so. In our setting, predicate transformers can be studied apart from programs and constructed using the ret and bind of the monadic structure. Therefore, we claim that the relationships between triples can also be observed at the level of the bare predicate transformers, not indexed by a program, witnessed by monadic relations.
Second, Verscht and Kaminski's taxonomy is comprised of triples that over- or under-approximate a predicate transformer, where, for example, is under-approximate and is over-approximate. The implications that exist among under-approximate triples are dual to the ones that exist among over-approximate triples. For example, in the under-approximate version, . However, for the over-approximate version, .
Third, for contrapositives, each relation is between an under-approximate and an over-approximate triple, and it exists in a dualized form. For example, is contrapositive to . Dually, is contrapositive to .
Fourth, for the adjunctions, the relations are dual with respect to which predicate transformer is the left adjoint or right adjoint, or vice versa. The Galois connection between predicate transformers when sp is the left adjoint and the wp is the right adjoint is represented by . The other Galois connection when wp is the left adjoint and the sp is the right adjoint is represented by .
We demonstrate that, for implications and contrapositives, each pair of dual relationships is characterized by a single monadic relation, and the two adjunctions are characterized by two monadic relations. Therefore, each implication or contrapositive edge of Fig. 1 represents two arrows of Verscht and Kaminski's diagram, and each Galois edge one.
4.2 Monadic Relations
Maillard et al. [26] introduce monadic relations as a way of relating a computation monad to a specification monad, which are monads where bind is monotone with respect to the ordering. The definition of a monadic relation constrains ret and bind but does not use an ordering, so it applies to any two monads. We use monadic relations to relate our predicate transformer monads.
Definition 1 (Monadic relation [26]). A monadic relation between monads and is a family of relations , indexed by types A, satisfying the following conditions:
Pribisova et al.
▷ for every , ,
▷ and for every , , , and , we have
We build the following monadic relations based on relations between the predicate transformers, as explained below. We present the monadic relations between the stateful wp and sp monads to more directly connect to the stateful setting of the taxonomy of triples [37]; however, the base monadic relations can be similarly constructed for the relationships detailed in the left diagram of Fig. 1, the details of which we leave to Appendix G.
Implication Relation The taxonomy of triples has implications among the wp triples and among the sp triples. We represent them as monadic relations among the wp monads and among the sp monads. Each monadic relation relates the elements of two monads, that is, two wps or two sps.
The four stateful wp monads have different carriers, but each is a submonad of , the monad of stateful monotone wps, which we call and discuss in §3.5, so any two wps can be compared within this monad. We compare them with the pointwise order:
This order is a monadic relation between any two wp monads, because they share ret and bind, and bind is monotone, which satisfies both requirements of a monadic relation. If , then every under-approximate triple of implies the same triple of , and every over-approximate triple of implies the same triple of . So the opposite order gives the implications between under-approximate triples.
Monads of sps are not so straightforward. Without state, the monad taxonomy collapses into the left taxonomy in Fig. 1, since and coincide with and , as described in §4.3. With state, the four stateful sp monads share the type of stateful monotone sps, , and we, again, start from the pointwise order:
However, this is not a monadic relation between any of the sp monads because the bind requirement is not satisfied. Every implication between sp monads has or at one end, and their bind is not monotone for , as demonstrated in Fig. 2. Since bind is computed through the aspOf and dslpOf components, we instead compare components: a element dsp is related to an element asp when aspOf(dsp) asp and to a element dslp when dslpOf(dsp) dslp. Likewise, an element aslp is related to them when asp aspOf(aslp) and when dslp dslpOf(aslp). These relations are monadic, and are represented by the marks * (aspOf) and (dslpOf) in Fig. 1. Additionally, each implies between the sps themselves: a dsp is the conjunction of its components and an aslp their disjunction (Lemma 7 and Lemma 9), so

(a)
(b)
Fig. 2. Sequencing two computations, with initial state 1, intermediate states 2 and 3, and final state 4. The first computation m maps pre to m pre, which bind passes to the continuation as its precondition. (a) The case: state 4 is reachable only from initial states in pre (green path), so the postcondition should contain it. A bind that only sees m pre excludes it, because the continuation also reaches 4 from state 3, which is outside m pre (orange path). (b) The case: state 4 is reachable only from an initial state outside pre (green path), so the postcondition should not contain it. A bind that only sees m pre includes it, because the continuation also reaches 4 from state 3, which is inside m pre (orange path).
and , and likewise for . By transitivity, gives , and gives .
Contrapositive Relation The taxonomy of triples has contrapositives between over-approximate and under-approximate wp triples, and between the over-approximate and under-approximate sp triples. We represent them as monadic relations between wp monads and between sp monads.
For wp, we again work with . We relate two wps when each is the negation of the other applied to the negated postcondition:
This is a monadic relation between the monads and and the monads and , pairing their elements one to one. If , then the under-approximate triple of is the contrapositive of the over-approximate triple of , that is, . The relation is symmetric, so the over-approximate triple of is likewise the contrapositive of the under-approximate triple of .
For sp, we again work in and use the same relation, now negating the precondition:
This is a monadic relation between the monads and and between the monads and , pairing again their elements one to one. Unlike for implications, bind preserves this relation, so no components
Pribisova et al.
are needed, even for and . The reason is that negation exchanges the two components, and , and, by De Morgan, turns the conjunction used by into the disjunction used by :
If , then the under-approximate triple of is the contrapositive of the over-approximate triple of , that is, , and symmetrically.
Adjunct Relations The taxonomy of triples has two Galois connections connecting an over-approximate wp triple and an under-approximate sp triple, and vice versa. Working with WP and SP , we define the relation capturing sps that are left adjoint to wps:
In a dual fashion, the relation relates sps right adjoint to wps:
Both relations are compatible with the monadic structures involved.
Lemma 1. 1. L is a monadic relation between SP equipped with the angelic monadic operations (ang-st) and WP . Moreover, if L sp wp, then sp is disjunctive and strict while wp is conjunctive and terminating.
- R is a monadic relation between SP equipped with the demonic monadic operations (dem-st) and WP . Moreover, if R sp wp, then sp is conjunctive and terminating while wp is disjunctive and strict.
In both cases, the left adjoint preserves all disjunctions and the right adjoint all conjunctions. As a consequence, L restricts to a monadic relation between and , and R to one between and . §6 will further show that both pair elements one to one. The relations L and R are dual in the following sense:
As a result, one can traverse the above diagrams along the adjunction relation and across the diamonds along the contrapositive relation.
4.3 Base Case Collapse
Without state, and coincide with and . They have the same elements, ret, and bind, and hence the same natural order. This is why the left diagram of Fig. 1 relates them by isomorphisms and two-headed implications.
Every element of these monads is the transformer of a program, a relation R from the initial point to results ( ), and for every R,
So the carriers coincide, and since ret and bind compute the transformers of the returned and the sequenced program, they coincide too. The identity is an isomorphism of ordered monads and .
This is the reversibility collapse of Verscht and Kaminski [37]. For programs in which every final state has at most one initial state, angelic and demonic sps coincide. Without state, every computation has this property, so the collapse holds for the monads themselves, not only for particular programs. With state, a result can be reached from two different initial states, one inside pre and one outside, as in Fig. 2, so they can be differentiated.
In summary, the relations of the left diagram of Fig. 1 hold for the base monads, and those of the right diagram hold with state. They are proved for the base and state case independently, but we believe that future work can introduce a way to lift these monadic relations via the state monad and arrow transformers.
5 Specification of Monadic Programs Using Predicate Transformer Monads
Thus far, we have considered wps and sps independent of computations. However, in order to use a predicate transformer to specify a program, a predicate transformer semantics should be fixed to interpret the behavior of the program. For monadic programs, Maillard et al. [26] propose to use a monad morphism from the computation monad into the monad of predicate transformers to capture a specific semantics. A monad morphism consists of a family of maps for every type , satisfying the following equations:
The predicate transformer produced by a monad morphism represents the most precise embodiment of the program semantics with respect to the interpretation. We use monad morphisms below in one of two ways: to define a predicate transformer triple instantiated with a (pre, post) specification [14], or to compare the predicate transformer of a program to other predicate transformer specifications via an ordering on the predicate transformer monad [2, 26, 34].
On the one hand, a (pre, post) specification can be validated by checking:
This approach is at the core of the Loom verification framework in Lean [14]. Since this check works with any monad morphism, we can use all of our predicate transformer monads to construct monadic variants of all the triples from [37].
On the other hand, a wp specification w can be validated by checking:
Pribisova et al.
In order to facilitate a structured interaction between composition and the weakening of specifications, the bind of the monad of predicate transformers has to be monotone with respect to the ordering, as follows:
Monads with this property, also called specification monads, are integral to the construction of Dijkstra monads and the heart of verification frameworks like F* [2, 26, 34]. Of our new sp monads, SP and SP are specification monads and can, therefore, be used to construct new Dijkstra monads based on sps.
The rest of this section works out and compares these two styles: §5.1 gives monad morphisms from the stateful computation monad StT(NDiv)(S, A) into our eight stateful predicate transformer monads. §5.2 derives them from morphisms from the base computation monad NDiv into our base predicate transformer monads. This lifting uses the state monad and arrow transformers on the wp and sp sides, respectively. §5.3 uses these morphisms to define under- and over-approximate triples in the style of [14] and discusses how they compose. §5.4 turns to the Dijkstra monad-style and discusses when the two styles coincide. Finally, we build Dijkstra monads over the six specification monads, excluding SP and SP , whose binds are not monotone for their natural orders.
5.1 Constructing Stateful Monad Morphisms
As stated above, a common approach to derive a predicate transformer that interprets the behavior of a program is to construct a monad morphism from the computation monad to the monad of predicate transformers. Such a morphism typically interprets the outcomes of the computation. For nondeterminism and nontermination, a computation applied to a start state gives the set of all its outcomes, each a result or divergence, which the morphism can interpret angelically (some result must satisfy the postcondition) or demonically (all of them must), forbiding divergence (total) or permitting it (liberal).
We start with a base computation monad with only nondeterminism and nontermination, which we call NDiv, and construct the stateful version by applying the state monad transformer, StT(NDiv)(S, A), which we will call State. A computation m of the computation monad maps a start state s to a nonempty set m s of outcomes. An outcome o is either a result , written val(r), or divergence, written div. We write for the monad morphism into WP , with the interpreted effect on top and the variant below, and likewise for the other seven. The four wp monad morphisms are:
The four sp monad morphisms quantify over the start states and their outcomes:
(4)
As in Verscht and Kaminski [37], where dsp and aslp are defined as the conjunction and the disjunction of asp and dslp, we define and as the pointwise conjunction and disjunction of and .
5.2 Lifting Morphisms
Now, we describe how we could have derived those same stateful monad morphisms from base monad morphisms using the state monad and arrow transformers.
For wps, we construct base monad morphisms from NDiv into the base wp monads, which we write without the superscript. As shown below, they largely mirror their stateful counterparts:
(5)
The state monad transformer also lifts monad morphisms: if is a monad morphism from NDiv to WP, then applying it at each initial state, s. , is a monad morphism from StT(NDiv)(S, A) to StT(WP)(S, A) = WP (S, A). In fact, this is how the stateful wp morphisms of Eq. (3) are defined. We also use the exception monad transformer, ExcT, below the state monad transformer, giving monad morphisms from StT(ExcT(NDiv))(S, A) to W (S, A), defined in Appendix H.
For sps, we construct base arrow morphisms from the Kleisli arrow of NDiv into the four base sp arrows. They largely mirror their stateful counterparts, and since arrows have a non-unit input type, unlike the base sp monads, the morphisms into ArrDSP and ArrASP, and into ArrDSLP and ArrASLP, remain distinct:
(6)
The state arrow transformer likewise lifts arrow morphisms: if is an arrow morphism from the Kleisli arrow of NDiv, KI(NDiv), to an sp arrow Arr, then the same , at the input and output types and , is an arrow morphism from StArrT(KI(NDiv))(S, B, A) to StArrT(Arr)(S, B, A). Fixing the input to 1 turns it into a monad morphism from StT(NDiv)(S, A) to the stateful sp monad, since a stateful computation m is the arrow . m s from
Pribisova et al.
. The stateful sp morphisms of Eq. (4) are exactly these lifts; for instance, . We also use the exception arrow transformer, , below the state arrow transformer, which in the same way gives monad morphisms from into the sp monads with state and exceptions, defined in Appendix H.
5.3 Triples from Monad Morphisms
We use the generic wp triples of Loom [14], of the following form:
where the above ordering corresponds to under-approximate triples and the flipped ordering corresponds to over-approximate triples.
We define a generic sp triple analogously:
For each stateful monad morphism of §5.1, we fix a program m, a precondition p, and a postcondition q, and construct the corresponding over- and under-approximate wp and sp triples, where the over-approximate version uses the opposite ordering on predicates in the triple definitions above.
Each edge of diagram (b) of Fig. 1 yields a connection between triples; we give one example per kind of edge. is related to by the implication relation, so we obtain an implication between the over-approximate triples and , and the reverse one between the under-approximate triples. is related to by the contrapositive relation, so we obtain a contrapositive relation between and . Finally, is related to by the adjunction relation, so we obtain an adjunction, which at this level is a Galois connection, between and . This allows us to reconstruct all of the triples in [37] and derive the same relationships.
We can also use these triples to verify monadic programs with a concrete pre- and postcondition specification in a style inspired by Loom [14]. Notably, we can verify incorrectness logic triples, focusing here on two variants: O'Hearn's incorrectness logic [30], where triple validity is determined by , and Lisbon logic [14, 27], where triple validity is determined by .
Consider the following monadic program :
Evaluating the monad morphisms targeting WP and SP gives:
Consider the following precondition, . , and postcondition, . . Now, evaluating the triple validity as shown above gives:
This example illustrates that the two incorrectness logics are indeed different: as noted in the introduction, O'Hearn's incorrectness logic has no wp characterization [37]. Intuitively, the Lisbon triple needs every initial state in p to reach some final state in q, while incorrectness logic only needs every final state in q to be reached by some initial state in p. If we slightly modify the precondition to is even, then both triples hold:
Composition Monadic programs are sequenced using bind, where the continuation takes the returned value of the first computation. Triples can be sequenced similarly. Given and, for every returned value , , assume also that for all and . By monotonicity of , we have . . Here we recognize WP's bind from Eq. (1). By the monad morphism law, this simplifies to . The over-approximate rule flips the three orderings and side condition, , and holds for the same reason, so all eight kinds of wp triples compose.
The sp triples are less uniform. For and , the analogous rules hold in both directions. This covers Hoare logic, as the over-approximate triple, and incorrectness logic [30], as the under-approximate one. An under-approximate triple is the conjunction of an triple and a triple, and so is an over-approximate triple, so these compose through their components.
The two remaining kinds, over-approximate triples and under-approximate triples, do not compose. Fig. 2(a) is a counterexample for : take , , and . The first computation takes exactly to . From , the second computation gives the empty postcondition, because state 4 is also reachable from state 3, which is outside of . Both premises and the side condition hold, but the conclusion fails: in the sequenced computation, state 4 is reachable only from , since the first computation never produces state 3. Fig. 2(b) gives the dual counterexample for . In both cases, the intermediate assertions do not say which intermediate states the first computation can actually produce.
5.4 Predicate Transformers as Ordered Specifications
We next cover another way of specifying a monadic program: directly by a predicate transformer, which is compared against the one computed by the monad morphism. While the generic triple definitions differ between wp and sp, comparing a specification given as a predicate transformer pt against the one computed by the monad morphism takes the same form for all variants: an inequation in the order of the predicate transformer monad,
Pribisova et al.
depending on the direction of approximation. The first states that pt over-approximates the transformer computed for m, and the second that it under-approximates it.
As explained at the start of §5, for specification monads, bind must be monotone with respect to the ordering. This allows us to arbitrarily weaken specifications and compose them in the expected manner, as shown for wps
where the conclusion follows from the monad morphism laws. The same rule holds with the order reversed, for specifications that under-approximate.
For all the wp monads, , and , which are specification monads, such comparisons compose as above and give rise to the corresponding Dijkstra monads, which we will shortly define. For and , bind is not monotone with respect to the natural ordering on sps defined in §4.2.
Such a comparison verifies a monadic program against a concrete predicate transformer specification. We demonstrate this technique on Lisbon logic, for the same program as before and the following specification: post s. is even post ((), 0). Evaluating the monad morphism gives:
Since Lisbon logic is under-approximate, the comparison is , which unfolds to
and this holds by the second disjunct.
In fact, this predicate transformer is equivalent to the pre- and postcondition pair from before. This is an established result between some sets of triples and orderings over predicate transformers; for example, Swamy et al. [34] write pre- and postcondition specifications as abbreviations for wps. It is more natural to work with pairs of pre- and postconditions [22]. To connect these specifications to predicate transformers, Swamy et al. showed that any pre- and postcondition pair, , can be embedded into a wp as follows
such that if and only if . We name this embedding to represent that it corresponds to the under-approximate wp triple.
Over-approximate wp triples can also be expressed in terms of the order on WP thanks to a dual embedding pp2wp :
With both orderings flipped, we have that if and only if . Both embeddings produce monotone wps, but they may lie outside the carrier of the wp monad of the triple. The comparison therefore uses the order of , of which the four wp monads are submonads.
A natural question is whether similar embeddings exist for the two sp specification monads. We show that they exist for over-approximate triples and under-approximate triples, exactly those triples that are in a Galois connection with a wp variant:
such that if and only if and if and only if .
The other two sp triples have no such embedding:
Lemma 2. Let S have two distinct states and let A be inhabited.
-
The under-approximate triple, that is, the incorrectness triple, has no embedding: for some pre and post, there is no element of such that, for every , holds exactly when post (pre) does.
-
The over-approximate triple has no embedding: for some pre and post, there is no element of such that, for every , holds exactly when (pre) post does.
Proof. We prove the first part; the second is dual, with conjunctivity in place of disjunctivity, and we prove it in Appendix I. An element of is strict and disjunctive, so it satisfies : it commits to the start state from which each result is reached, whereas the incorrectness triple only asks that the results in post be reachable from some state of pre. Take distinct states and , a result , , and . A program whose only result is , reached only from , and a program whose only result is , reached only from , both satisfy the triple, so such a would satisfy and . At a single start state , one of the two bounds is always , so , and hence by disjunctivity. But holds for every , so the triple would have to hold for every program. It does not hold for a program that always diverges: such a program reaches no result, so is not reachable from pre.
Now, this does not stop one from specifying a program with an predicate transformer, and some of those predicate transformers might correspond to incorrectness logic triples. However, there does not exist an embedding that converts an incorrectness triple into a corresponding predicate transformer for every triple.
Dijkstra Monads The monad laws make specifications compose. Monotonicity of bind extends this structured composition to weakened specifications, as described above. This property is necessary for constructing Dijkstra monads.
Definition 2 (Dijkstra monad [26, §5]). A Dijkstra monad over a specification monad , that is, a monad with a preorder on each for which is monotone, is given by:
▷ for every type A and specification w : WA, a type DAw of computations specified by w,
Pribisova et al.
▷ a return and a bind specified by the return and bind of W, satisfying the monad laws (which are well-typed because W satisfies them),
▷ and a weakening along the order of W, compatible with bind:
The comparison rule for bind at the start of this subsection is exactly this typing rule for bind, with being the computations such that . For specifications that under-approximate, the computations with form a Dijkstra monad for the reversed order, for which bind is monotone as well. We construct Dijkstra monads indexed with specifications from , through each of the four wp monad morphisms, and from and , which are specification monads, but not for and . We construct them from the monad morphisms from the computation monads into these specification monads. As shown in [26], such monad morphisms naturally give rise to Dijkstra monads. A key benefit of Dijkstra monads is that they only contain computations that satisfy their specification, which was the foundation of verification frameworks like .
As demonstrated above, triples for all the wp monads, over-approximate triples, and under-approximate triples can be represented by predicate transformers. The corresponding Dijkstra monads can therefore contain exactly the computations that satisfy those triples. Additionally, we show that all of the examples that we verified using the corresponding triple can also be proved to be elements within the corresponding Dijkstra monad. For under-approximate and over-approximate , one can still specify programs by the predicate transformer, but there does not exist an embedding from the triple into a predicate transformer for an arbitrary triple.
6 Galois Connections Between Specification Monads
Beyond the taxonomy established for the various monads of wps and sps, one can wonder how expressive these variants are. To that end, Maillard et al. [26] show that WP and SPost can be related through Galois connections to two simpler monads PrePost and Pred, where WP indicates that the order is flipped.
(†)
A Galois connection between two specification monads and consists of monotone natural transformations and , such that iff for any and A. PrePost consists of pairs of a precondition and a postcondition, while Pred only retains the postcondition. Maillard [25] further showed that in the pure case, the Galois connection between SPost and Pred on the left establishes an isomorphism of specification monads.
In the rest of this section, we extend this analysis in terms of Galois connections to the stateful case. We consider submonads of monotone, stateful backward predicate transformers and monotone, stateful forward predicate transformers described by healthiness properties. While the angelic (ang-st) and demonic (dem-st) operations on do not satisfy all monad laws, it is still meaningful to ask when these operations are preserved by a natural transformation from or to other monads. Specifically, we compare it with ordered with pointwise logical implication and endowed with the monadic operations:
bind . .
asserts that the returned value is the given and the state is left unchanged, while for and existentially quantifies over an intermediate result value and state , satisfying the postcondition and passed to the continuation .
Recall from §4.2 that L relates sps that are left adjoint to wps. We now show that any predicate induces such a pair where and are stateful variants of the maps displayed at , defined as
Equipping SP with the angelic monadic structure (ang-st), and are both monotone monad morphisms.
Returning to L, given , and , we have that
which establishes . This observation yields a characterization of the relation in the following sense.
Lemma 3. For sp : SP (S, A) and wp : WP (S, A), L sp wp holds if and only if there exists p : Pred (S, A), such that sp = p and wp = p.
Intuitively, this characterization of L holds because we can reconstruct a predicate out of a disjunctive and strict sp or a conjunctive and terminating wp. Indeed, paralleling the pure case (†), and both have right adjoints :
When considering merely monotone sps rather than conjunctive and strict ones, the demonic bind is more adequately expressed as as it satisfies some inequations refining the monad laws.
Pribisova et al.
and given by
preserves the demonic monadic structure on while does not preserve 's bind. We observed that L restricted to a relation between and . We can further this remark by inspecting the nuclei of the adjunctions and : (1) every is a fix point of both and , (2) the fix points of are exactly elements of , and (3) the fix points of are exactly elements of WP_{DWLP}^{St}^{op}. As a result, we obtain the characterization of L and a chain of correspondences
\begin{array}{r c l c r}{\mathsf{S P}_{\mathsf{A S P}}^{\mathsf{S t}}}&{\cong}&{\mathsf{P r e d}^{\mathsf{S t}}}&{\cong}&{\mathsf{W P}_{\mathsf{D W L P}}^{\mathsf{S t}}^{\mathsf{o p}}.}\end{array}We can now turn to the case of R, where a similar story unfolds with respect to the specification monad , with the same carrier and monadic structure as but with order reversed. Consider the maps , , , and , defined as
We can show that all maps are monotone, natural in A, and the corresponding pairs form Galois connections: and . Moreover, , and are monad morphisms if we equip with the demonic monadic operations (dem-st), while fails to preserve , s bind.
For any , we have that . Indeed, given and ,
We also obtain a characterization of R in terms of .
Lemma 4. For sp : SP (S, A) and wp : WP (S, A), R sp wp holds if and only if there exists p : Pred (S, A), such that sp = p and wp = p.
Again, we can investigate the nuclei of the adjunctions and : (1) every is a fix point of both and , (2) the fix points of are exactly elements of , and (3) the fix points of are exactly elements of \text{WP}_{\text{AWP}}^{\text{St}}^{\text{op}}. As a result, we get another chain of correspondences:
\begin{array}{r c c c c}{\mathsf{S P}_{\mathsf{D S L P}}^{\mathsf{S t}}}&{\cong}&{\mathsf{P r e d}^{\mathsf{S t}^{\mathsf{o p}}}}&{\cong}&{\mathsf{W P}_{\mathsf{A W P}}^{\mathsf{S t}}^{\mathsf{o p}}}\end{array}7 Formalization in Rocq
All definitions and results presented in this paper are formalized in Rocq (about 28k lines), assuming the axioms of functional extensionality, propositional extensionality, and excluded middle.
We use the triples of §5 to verify about 30 small example programs, including all the sequential examples of O'Hearn [30]. These examples cover state, state and exceptions, recursion, and loops and together use all sixteen kinds of triples. The programs are written as interaction trees [38], and a monad morphism maps them to the computation monad of §5.
8 Related Work
Hoare-like logics. Incorrectness logic was first proposed by de Vries and Koutavas [9] under the name reverse Hoare logic. The term “incorrectness logic” was coined by O’Hearn [30] later. Since then, many variants of it have been studied, including partial incorrectness logic [39], underspecified incorrectness logic [36], sufficient incorrectness logic (a.k.a. Lisbon logic) [5, 6], etc. Verscht and Kaminski [37] taxonomize Hoare-like triples in an imperative setting and inspired our work. Starting from the classical strongest postcondition and the strongest liberal postcondition of Zhang and Kaminski [39], which they call asp and dslp, they complete the picture with two novel variants, dsp and aslp. They also observe that aslp and dsp cannot be defined by induction on the program structure and propose that they can be represented using disjunctions and conjunctions of asp and dslp, respectively [37, §3.2.4]. We extend their work to monadic functional programs with different combinations of effects, and construct a predicate transformer monad for each of the four sp variants.
Outcome logics. Outcome logic [40] unifies correctness and incorrectness reasoning in a single program logic, whose semantics is expressed in a monad and whose assertions describe the collection of outcomes that a program produces. It expresses the dwlp and awp triples but not the dwp and awlp triples, which need nontermination as an outcome [23]. Total outcome logic [23] adds this outcome and expresses every logic of the taxonomy of Verscht and Kaminski [37], and logics in between, with one proof system. It expresses the dsp and aslp logics as combinations of two triples, without defining the two transformers directly; here, they are elements of their own monads, and . Both logics use a monad to give imperative programs their semantics, and one logic to state all the triples. We instead make the predicate transformers themselves monads. Each triple is read off a monad morphism from the computation monad, the relations of the taxonomy become relations between these monads, and monad transformers extend these monads to state and exceptions. Unlike our work, outcome logics also cover probabilistic choice.
Pribisova et al.
Predicate transformers forming monads. Jacobs [18] studies predicate transformers as a monad, with wp as a monad morphism into it, Hasuo [15] derives wps generically from monads enriched with an order, and Aguirre et al. [1] develop wps in fibrations, where sp arises as the left adjoint of wp, as in our relation L (§6). Instead of deriving predicate transformers from the computation monad, we restrict the carriers of our monads to combinations of the homomorphism properties of Back and von Wright [8].
Dijkstra monads and specification monads. Swamy et al. [33] introduced Dijkstra monads in the context of for reasoning intrinsically about stateful programs using backward predicate transformers represented as elements of a continuation monad to stateful predicates. The Dijkstra monad methodology was then extended to a variety of effects [2, 26]. Maillard et al. [26] decompose Dijkstra monads as a triple of a computation monad M, a specification monad W and a monad morphism interpreting programs as specifications. While their work mention forward predicate transformers, their strategy to effect modularity using monad transformers does not apply directly to provide an intuitive specification monad for stateful forward predicate transformers as we show in this paper. Using arrow transformers, we obtain predicate transformers of the expected shape.
Verification using monad morphisms. Gladshtein et al. [14] build foundational verifiers in Lean based on predicate transformer triples. They derive wp calculi from ordered monad algebras and lift them through a library of monad transformers, for state, exceptions, divergence with total or partial correctness, and nondeterminism with demonic or angelic choice. Their incorrectness proofs use angelic wps, as in Lisbon logic, and they do not consider sps. Like us, they obtain effect modularity from transformers, but they lift algebras through monad transformers, whereas we lift monad morphisms through monad transformers and arrow morphisms through arrow transformers.
9 Conclusion and Future Work
This work introduces strongest postcondition monads for all combinations of angelic or demonic nondeterminism and total or liberal interpretations of non-termination, and extends them with state and exceptions by generalizing to arrows and applying arrow transformers. Together with the corresponding weakest precondition monads, these allow us to recast the taxonomy of triples presented by Verscht and Kaminski [37] as a taxonomy of predicate transformer monads, both for the base monads and for their versions with state. We demonstrate how they can be used to specify simple monadic programs, with and without state and exceptions, in a Loom-inspired style [14] and in the style of Dijkstra monads [26], and relate the two styles. All our results are mechanized in Rocq.
Further work is needed to investigate whether these foundational results can underpin a practical verification framework in the style of Loom [14] that supports sps, general wps, and both under- and over-approximation, ideally allowing these different kinds of reasoning to be meaningfully combined. To that end, considering further computational effects such as IO and continuations would widen the applicability of our findings. This would benefit from making the taxonomy and the Galois connections of §6 effect-modular, which is not straightforward: some of the maps and carriers involved lack a full monad or arrow structure, so one would need transformers that, like the state transformers, do not depend on the full structure. Finally, this work also reveals unexpected skew monadic structures on monotone forward predicate transformers SP that could be interesting to investigate on their own, inspired by the seminal work of Lack and Street [21] on skew monoidales.
Acknowledgments. This work was in part funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany's Excellence Strategy – EXC 2092 CASA – 390781972. Exequiel Rivas was funded by the Estonian Research Council starting grant PSG749.
Appendix A Arrow and Arrow Morphism Laws
All arrow laws regarding arrows with application are shown below:
We use to represent the equality defined on the arrow, which is defined as logical equivalence on sps arrows. All these laws are defined by Hughes [17]. We also state laws of arrow transformers defined by Hughes and prove that state and option arrow transformers satisfy these laws.
In addition, we show that all our sps arrows are choice arrows, and they satisfy relevant laws defined by Hughes and the additional choice arrow distribution law defined by Paterson [31].
An arrow morphism from an arrow A to an arrow B, both with choice and application, is a family that respects , so that
Pribisova et al.
implies , and satisfies the following laws:
The first three are the laws of Atkey [7, Def. 4.4], and the last two preserve choice and application. Since takes an arrow of A as input and an arrow of B, the law for app first maps the input arrow with . We use it, together with the laws of B, to show that an arrow morphism is, at each fixed input, a monad morphism between the monads of the two arrows.
Appendix B The Arr and Arr Arrows
For , we restrict the arrow carrier to conjunctive, strict , mirroring the carrier restriction of the monad. For every non-empty family of preconditions on the input :
As for the monad, a dsp arrow splits into an asp and a dslp component, where sp ( . ) a states that a is reachable:
Every sp admits the same outputs as aspOf sp ∧ dslpOf sp. Each arrow operation applies the ArrASP operation to the asp components and the ArrDSLP operation to the dslp components, and conjoins the results:
In app, aspOf a states that f can produce a from b. Composing the dsp transformers directly, c. g (f pre) c, would not work: it breaks the law arr arr arr whenever maps a value produced by and a value never produced by to the same output, as in Fig. 2.
Dually, for , we restrict the arrow carrier to disjunctive, terminating , mirroring the carrier restriction of the monad. For every non-empty family of preconditions on the input :
Here a states that a is reachable, and the components are
Every sp admits the same outputs as aspOf sp ∨ dslpOf sp, and the arrow operations are those of ArrDSP(B, A) with ∨ in place of ∧.
Both are lawful arrows with application: they satisfy all the laws of Appendix A. Fixing B = 1 gives the ret and bind of SP (A) and SP (A) from §3.
Appendix C Fixing the Input of the Arr and Arr Arrows
This appendix shows that fixing B = 1 in and gives the carriers and the ret and bind of (ang) and (dem).
A precondition pre : 1 → P is determined by the proposition pre *, where * is the unique element of 1, and a proposition p is the precondition λ_.p. We identify the two, (1 → P) ≅ P, and write pre for both. The identification commutes with pointwise disjunctions and conjunctions, so an sp_arr : (1 → P) → (A → P) preserves all disjunctions, respectively all conjunctions, exactly when the corresponding sp : P → (A → P) does. Hence the carrier of ArrASP(1, A) corresponds to that of SPASP(A), and the carrier of ArrDSLP(1, A) to that of SPDSLP(A), up to logical equivalence, which is the equality of the arrows. All these sps are monotone, so they respect logical equivalence of preconditions, which we use without mention.
Recall the ret and bind derived from an arrow with application ( ), where . :
Since passes the postcondition of to as its precondition, bind pre = app , where
Below, u, i, j, x, and y range over 1, a over A, b over B, and g over the arrows from 1 to B.
Pribisova et al.
C.1 The Angelic Arrow
Lemma 5. For every sp : SP_{ASP}(A), pre : P, and a : A, sp pre a pre sp a.
Proof. Take the index set , which is inhabited exactly when pre holds, and the constant family . Then is equivalent to pre, so disjunctivity gives sp pre , which is pre .
So an element of admits a exactly when a is produced, , and pre holds. For ret, unfolding arr gives
the ret of (ang). For bind, unfolding arr, first, arr, and app in turn gives
app
In the last line, is because 1 has a single element, so at , app asks whether produces . By Lemma 5 for , the conjunction pre is ( pre ) , so
the bind of (ang). Every step is constructive.
C.2 The Demonic Arrow
Lemma 6. For every sp : SP_{DSLP}(A), pre : P, and a : A, sp pre a pre sp a.
Proof. Take the index set and the constant family . Then is , which by excluded middle is equivalent to pre, so conjunctivity gives sp pre , which is and, again by excluded middle, pre .
So an element of admits a exactly when pre holds or a is not produced, . For ret,
the ret of (dem). For bind, the same unfolding gives
app
In the last two lines, ranges over , so is , and at , app again asks whether produces : every precondition that accepts for holds.
By Lemma 6 for , this is : taking gives one direction, and for the other, gives . Then, by excluded middle and Lemma 6 again,
the bind of (dem). Unlike the angelic derivation, this one is classical.
Appendix D Stateful sp Arrows and Monads
This appendix gives the stateful arrows of §3.3 and the ret and bind of and .
D.1 The Stateful Arrows
The state arrow transformer [17] threads a state through the input and the output of an arrow, , with the operations
,
,
,
.
The state passes through arr unchanged, first moves it next to the input of f and back, and app hands it to the applied arrow together with its input. For StArrT(ArrASP)(S, B, A), unfolding the operations of §3.2 gives
and for StArrT(ArrDSLP)(S, B, A)
In both stateful arrows, uses the corresponding base-arrow composition. Their definitions of coincide because the base definitions of first coincide and the stateful definitions apply only to bijections. For such bijections , both arrows give . . Applying the transformer to the operations of and (Appendix B) gives their stateful arrows in the same way.
D.2 The Stateful dsp and aslp Monads
Fixing B = 1 gives the monads of §3.3, whose elements are dsp, respectively aslp, arrows from to , with preconditions over states, . Their asp and dslp components are therefore the aspOf and dslpOf of Appendix B
Pribisova et al.
at input , and, as for the base monads, ret and bind are computed through them. For ,
where , , , and are those of (ang-st) and (dem-st). For , ret and bind are the same with in place of . Since v implies v, these simplify to v and v.
Appendix E Counterexamples to the Monad and Arrow Laws
This appendix works through the counterexamples behind the carrier restrictions of §3. Each keeps the operations of one of our monads or arrows but drops its homomorphism restriction:
▷ §E.1: the stateful ret and bind of SP (S, A) on monotone, strict sps, without disjunctivity;
▷ §E.2: the stateful ret and bind of SP (S, A) on monotone, terminating sps, without conjunctivity;
▷ §E.3: the operations of and on monotone, strict, respectively terminating, .
The two monads fail associativity and the two arrows the arrow law first . Each counterexample uses a transformer that inspects two inputs at once, which disjunctivity, respectively conjunctivity, rules out.
E.1 Associativity Without Disjunctivity
Consider , whose elements are monotone stateful sps of type (pre: . Here is the codomain condition of ; for monotone sps, it amounts to strictness. We use the ret and bind of from (ang-st). The unit laws hold, but bind is not associative as soon as there are two distinct states and two distinct values . Take, for any inhabited types B and C,
When its precondition is satisfiable, admits every result; ends in when , in when , and has no result otherwise; and has a result only if its precondition contains both and . All three are monotone and have the restricted type. For and , compare
bind (bind m f) ( ) pre r and bind m ( ) pre r.
Since pre holds for all and , the intermediate states that passes on to are . , so , , and otherwise. Unfolding bind, the left-hand side is equivalent to . (. . ) and the right-hand side to . . (. ) . On the left, receives the union and admits . On the right, is chosen first and receives a single , none of which contains both states, so it does not. A disjunctive would satisfy and make the two sides agree.
E.2 Associativity Without Conjunctivity
The demonic monad has the dual codomain, which amounts to termination, with , and the ret and bind (dem-st) of . Again the unit laws hold and associativity fails, now with the dual transformers
where accepts a precondition that contains at least one of and . Take and . Since pre is false, the intermediate states passed on to are , so , , and otherwise. The left-hand side is equivalent to . (. ) , which fails because contains neither state. The right-hand side is equivalent to . ( ) , which holds because every contains or . A conjunctive would make the two sides agree.
E.3 Arrow Laws Without Disjunctivity or Conjunctivity
The same phenomenon breaks the arrow laws. Let consist of the monotone, strict of type , where , with the operations of . Fixing gives the lawful monad , yet the arrow is not lawful: the law first fails. Take distinct and , and
Writing , we have , , and otherwise. Unfolding the operations, for any ,
The left-hand side is false, since no contains both and , and the right-hand side is true, since . A disjunctive would make the two sides agree, which is why restricts its carrier to disjunctive . Dually,
Pribisova et al.
for the demonic arrow of monotone, terminating with the operations of , the same law fails for and the complementary precondition , now with the left-hand side true and the right-hand side false.
Appendix F Decomposing dsp and aslp Predicate Transformers
This appendix proves that an element of admits the same outputs as the conjunction of its asp and dslp components, that an element of admits the same outputs as their disjunction, and that in both cases the components lie in and .
F.1 Components of SP (A)
Recall the components of an element sp of SP (A) from §3.1,
and that the carrier of consists of the strict, conjunctive, and hence monotone, sps.
Lemma 7. For every sp : SP (A), pre : P, and a : A,
Proof. Suppose sp pre a. Then dslpOf sp pre a holds by its first disjunct, and sp ⊥ a holds by monotonicity. If sp (¬pre) a also held, conjunctivity would give sp (pre ∧ ¬pre) a, and monotonicity sp ⊥ a, which strictness rules out. So ¬(sp (¬pre) a), and aspOf sp pre a holds. Conversely, aspOf sp pre a gives sp ⊥ a, which rules out the second disjunct of dslpOf sp pre a, so its first disjunct, sp pre a, holds.
This proof is constructive. Classical reasoning is needed only to show that the components satisfy the carrier restrictions of and .
Lemma 8. For every sp : SP (A), aspOf sp is strict and disjunctive, and dslpOf sp is terminating and conjunctive.
Proof. Both components are monotone because sp is and negation reverses implication. aspOf sp ⊥ a is sp ⊥ a ∧ ¬(sp ⊥ a), which is false, so aspOf sp is strict. For a non-empty family , ¬∃i. is ∀i. ¬, and conjunctivity of sp turns ¬(sp (¬∃i. ) a) into ¬∀i. sp (¬) a. By excluded middle, this is ∃i. ¬(sp (¬) a), which makes aspOf sp disjunctive. dslpOf sp ⊥ a is sp ⊥ a ∨ ¬(sp ⊥ a), which holds by excluded middle, so dslpOf sp is terminating. Its conjunctivity follows from that of sp by a case split, again by excluded middle, on whether sp ⊥ a holds.
F.2 Components of SP (A)
The carrier of consists of the terminating, disjunctive, and hence monotone, sps. For an element sp, the output a is admitted under the precondition, , exactly when a is not produced, and we calculate the two components as follows:
In aspOf sp, the second conjunct, , states that a is produced, and the first, sp pre a, states that a being produced implies pre holding; together they admit a exactly when a is produced and pre holds, which is the behavior of an asp predicate transformer. In dslpOf sp, the first disjunct, , negates the statement that if a is produced, then holds. Classically, this means that a is produced and pre holds. The second disjunct, sp , states that a is not produced. Together, the two disjuncts admit a exactly when the implication “if a is produced, then pre holds” is true, as required by a dslp predicate transformer. As for SP (A), these readings are classical. The bind of SP (A) is the disjunction of the binds of the components:
Lemma 9. For every sp : SP (A), pre : P, and a : A,
Proof. Suppose sp pre a. By excluded middle, either sp ⊥ a holds, and then so does the second disjunct of dslpOf sp pre a, or it does not, and then aspOf sp pre a holds. Conversely, aspOf sp pre a contains sp pre a as its first conjunct, and sp ⊥ a gives sp pre a by monotonicity. It remains to derive sp pre a from ¬(sp (¬pre) a). Termination gives sp ⊥ a, and by excluded middle ⊥ is pre∨¬pre, so disjunctivity gives sp pre a ∨ sp (¬pre) a, whose second disjunct is ruled out.
Unlike the decomposition of , this one is classical in both directions.
Lemma 10. For every sp : SP (A), aspOf sp is strict and disjunctive, and dslpOf sp is terminating and conjunctive.
Proof. Both components are monotone because sp is and negation reverses implication. aspOf sp ⊥ a is sp ⊥ a ∧ ¬(sp ⊥ a), which is false, so aspOf sp is strict, and it is disjunctive because sp is and ¬(sp ⊥ a) does not depend on the precondition; both arguments are constructive. dslpOf sp ⊥ a is ¬(sp ⊥ a) ∨ sp ⊥ a, which holds by excluded middle, so dslpOf sp is terminating. For a non-empty family (p_i)_{i∈I}, excluded middle turns ¬∀i. p_i into ∃i. ¬p_i, so disjunctivity of sp turns ¬(sp (¬∀i. p_i) a) into ∀i. ¬(sp (¬p_i) a), and a case split, again by excluded middle, on whether sp ⊥ a holds makes dslpOf sp conjunctive.
Pribisova et al.
The same definitions and proofs apply to the arrow components of Appendix B, with , , and taken pointwise.
Appendix G Monadic Relations Between the Base Monads
This appendix gives the monadic relations of the left diagram of Fig. 1. They are the relations of §4.2 with propositions in place of predicates on states: the base wp monads are submonads of , and the elements of the base sp monads have type .
Implication. For wp, the pointwise order
is a monadic relation between any two base wp monads, because they share ret and their bind is monotone. For sp, the pointwise order
is a monadic relation without the components that it needs with state. Each implication of the left diagram goes from or to or , and without state every element of the former is below every element of the latter: by Lemma 5, implies pre, and by Lemma 6, pre implies . Both lemmas apply to and as well, since these coincide with and , as described next. The relation is therefore total between these monads, and so it is monadic.
Isomorphism. Without state, and have the same elements, ret, and bind, and so do and ( ). The equality of sps,
is therefore a monadic relation between each pair, and it relates their elements one to one. It gives the implication in both directions: the double-headed arrows marked in Fig. 1.
Contrapositive. For wp, the monadic relation
relates to , and also to . For sp, the monadic relation
relates to , and also to . As with state, both pair elements one to one, and no components are needed.
Adjunction. The relations
relate an sp and a wp that form a Galois connection, with the sp as the left adjoint in L and as the right adjoint in R. They are monadic relations between and , and between and , respectively. Without state, an element of or is determined by the outputs it produces, an element of , so we prove both relations between and (§4.3).
Appendix H Monad Morphisms with State and Exceptions
The exception monad transformer adds an exceptional outcome to a monad, , where None is the exception. We apply it below the state monad transformer, on both sides:
A computation maps a start state to a non-empty set of outcomes, each a result Some , an exception None, which discards the state, or divergence, and the postconditions of the specifications also constrain the exception. Lifting the base wp morphisms of §5.2 through both transformers applies them at each start state, at the type option :
where ranges over option , a result or the exception. The exception and the state monad transformers both lift monad morphisms, so these are monad morphisms from to .
On the sp side, the exception arrow transformer changes the output of an arrow, , and we apply it below the state arrow transformer, so that an arrow of is an arrow of from to option . Lifting the base arrow morphisms of §5.2 through both transformers and fixing the input to 1 gives, for a computation of ,
where v ranges over option , so postconditions also constrain the exception, and divergence is never an output. These are the definitions of Eq. (4) with a result or the exception in place of a result, and they are monad morphisms because both arrow transformers lift arrow morphisms.
Pribisova et al.
Appendix I No Embedding for the Over-Approximate dslp Triple
We prove the second part of Lemma 2. The over-approximate triple, , has no embedding either: there is no element of such that, for every , holds exactly when the triple does. The argument is dual to the one for the incorrectness triple in §5.4, with conjunctivity in place of disjunctivity. An element of satisfies
where the empty meet, at , is by termination. So commits to the start state from which each result it excludes is reached, whereas the triple only asks that each result outside post be reachable from some state outside pre.
For example, let and let post contain every result except . A result whose start states all lie in pre must then differ from , so the triple holds exactly when is reachable from or . A program whose only result is , reached only from , and a program whose only result is , reached only from , both satisfy the triple, so such a would satisfy and . At a precondition , one of the two lower bounds is always : at they are and , and at every other result both hold vacuously. So , and hence by conjunctivity. But holds for every , so the triple would have to hold for every program. It does not: a program that always diverges reaches no result, so is not reachable from or .
This is also an instance of the contrapositive relation of §4.2. The dual of an element of is an element of , duality reverses the order and maps to , and the over-approximate triple for (pre, post) holds exactly when the incorrectness triple for does. So the dual of an embedding for the first would be an embedding for the second; with and , this is the example of §5.4.
References
[1] A. Aguirre, S. Katsumata, and S. Kura. Weakest preconditions in fibrations. Math. Struct. Comput. Sci., 32(4):472–510, 2022.
[2] D. Ahman, C. Hritcu, K. Maillard, G. Martínez, G. Plotkin, J. Protzenko, A. Rastogi, and N. Swamy. Dijkstra monads for free. POPL. 2017.
[3] K. R. Apt. Ten years of Hoare's logic: A survey – part II: Nondeterminism. Theor. Comput. Sci., 28(1–2):83–109, 1984.
[4] K. Asada. Arrows are strong monads. In V. Capretta and J. Chapman, editors, Proceedings of the 3rd ACM SIGPLAN Workshop on Mathematically Structured Functional Programming, MSFP@ICFP 2010, Baltimore, MD, USA, September 25, 2010. 2010.
[5] F. Ascari, R. Bruni, R. Gori, and F. Logozzo. Revealing sources of (memory) errors via backward analysis. Proc. ACM Program. Lang., 9(OOPSLA1):1321–1348, 2025.
[6] F. Ascari, R. Bruni, R. Gori, and A. Raad. U-turn: Enhancing incorrectness analysis by reversing direction. Proc. ACM Program. Lang., 10(POPL):1326–1352, 2026.
[7] R. Atkey. What is a categorical model of arrows? Electronic Notes in Theoretical Computer Science, 229(5):19–37, 2011. Proceedings of the Second Workshop on Mathematically Structured Functional Programming (MSFP 2008).
[8] R.-J. Back and J. von Wright. Refinement Calculus: A Systematic Introduction. Graduate Texts in Computer Science. Springer, 1998.
[9] E. de Vries and V. Koutavas. Reverse Hoare logic. In G. Barthe, A. Pardo, and G. Schneider, editors, Software Engineering and Formal Methods - 9th International Conference, SEFM 2011, Montevideo, Uruguay, November 14-18, 2011. Proceedings. 2011.
[10] E. W. Dijkstra. Guarded commands, nondeterminacy and formal derivation of programs. CACM, 18(8):453–457, 1975.
[11] E. W. Dijkstra. A Discipline of Programming. Prentice Hall PTR, Upper Saddle River, NJ, USA, 1st edition, 1976.
[12] E. W. Dijkstra and C. S. Scholten. Predicate Calculus and Program Semantics. Texts and Monographs in Computer Science. Springer-Verlag, 1990.
[13] G. Ebner, G. Martínez, A. Rastogi, T. Dardinier, M. Frisella, T. Ramananandro, and N. Swamy. PulseCore: An impredicative concurrent separation logic for dependently typed programs. Proc. ACM Program. Lang., 9(PLDI), 2025.
[14] V. Gladshtein, G. Pirlea, Q. Zhao, V. Kurin, and I. Sergey. Foundational multimodal program verifiers. Proc. ACM Program. Lang., 10(POPL):2233–2264, 2026.
[15] I. Hasuo. Generic weakest precondition semantics from monads enriched with order. Theor. Comput. Sci., 604:2–29, 2015.
[16] C. A. R. Hoare. An axiomatic basis for computer programming. Commun. ACM, 12(10):576–580, 1969.
[17] J. Hughes. Generalising monads to arrows. Sci. Comput. Program., 37(1–3): 67–111, 2000.
[18] B. Jacobs. Dijkstra and Hoare monads in monadic computation. Theor. Comput. Sci., 604:30–45, 2015.
[19] K. Jensen. Connection between Dijkstra’s predicate-transformers and denotational continuation-semantics. DAIMI Report Series 7.86, 1978.
[20] S. Katsumata and T. Sato. Preorders on monads and coalgebraic simulations. FOSSACS, 2013.
[21] S. Lack and R. Street. Skew monoidales, skew warpings and quantum categories. Theory and Applications of Categories, 26(15):385–402, 2012.
[22] K. R. M. Leino. Efficient weakest preconditions. Inf. Process. Lett., 93(6):281–288, 2005.
[23] J. Li, N. Zilberstein, and A. Silva. Total outcome logic: Unified reasoning for a taxonomy of program logics. CoRR, abs/2411.00197, 2024.
[24] S. Lindley, P. Wadler, and J. Yallop. Idioms are oblivious, arrows are meticulous, monads are promiscuous. Electron. Notes Theor. Comput. Sci., 229(5):97–117, 2011.
[25] K. Maillard. Principles of Program Verification for Arbitrary Monadic Effects. PhD thesis, Université Paris Sciences et Lettres, 2019.
[26] K. Maillard, D. Ahman, R. Atkey, G. Martínez, C. Hritcu, E. Rivas, and E. Tanter. Dijkstra monads for all. PACMPL, 3(ICFP), 2019.
[27] B. Möller, P. O'Hearn, and T. Hoare. On algebra of program correctness and incorrectness. In Relational and Algebraic Methods in Computer Science - 19th
Pribisova et al.
International Conference, RAMiCS 2021, Marseille, France, November 2-5, 2021, Proceedings. 2021.
[28] A. Nanevski, G. Morrisett, A. Shinnar, P. Govereau, and L. Birkedal. Ynot: dependent types for imperative programs. ICFP. 2008.
[29] A. Nanevski, J. G. Morrisett, and L. Birkedal. Hoare type theory, polymorphism and separation. JFP, 18(5-6):865–911, 2008.
[30] P. W. O'Hearn. Incorrectness logic. Proc. ACM Program. Lang., 4(POPL):10:1–10:32, 2020.
[31] R. Paterson. Arrows and computation. In J. Gibbons and O. de Moor, editors, The Fun of Programming, pages 201–222. Palgrave, 2003.
[32] L. Silver and S. Zdancewic. Dijkstra monads forever: termination-sensitive specifications for interaction trees. Proc. ACM Program. Lang., 5(POPL):1–28, 2021.
[33] N. Swamy, J. Weinberger, C. Schlesinger, J. Chen, and B. Livshits. Verifying higher-order programs with the Dijkstra monad. PLDI, 2013.
[34] N. Swamy, C. Hritcu, C. Keller, A. Rastogi, A. Delignat-Lavaud, S. Forest, K. Bhargavan, C. Fournet, P.-Y. Strub, M. Kohlweiss, J.-K. Zinzindohoué, and S. Zanella-Béguelin. Dependent types and multi-monadic effects in F*. POPL. 2016.
[35] W. Swierstra and T. Baanen. A predicate transformer semantics for effects (functional pearl). PACMPL, 3(ICFP):103:1–103:26, 2019.
[36] F. Verbeek, M. S. Sefat, Z. Fu, and B. Ravindran. On extending incorrectness logic with backwards reasoning. Proc. ACM Program. Lang., 9(POPL):391–415, 2025.
[37] L. Verscht and B. L. Kaminski. A taxonomy of Hoare-like logics: Towards a holistic view using predicate transformers and Kleene algebras with top and tests. Proc. ACM Program. Lang., 9(POPL):1782–1811, 2025.
[38] L. Xia, Y. Zakowski, P. He, C. Hur, G. Malecha, B. C. Pierce, and S. Zdancewic. Interaction trees: representing recursive and impure programs in Coq. Proc. ACM Program. Lang., 4(POPL):51:1–51:32, 2020.
[39] L. Zhang and B. L. Kaminski. Quantitative strongest post: a calculus for reasoning about the flow of quantitative information. Proc. ACM Program. Lang., 6(OOPSLA1):1–29, 2022.
[40] N. Zilberstein, D. Dreyer, and A. Silva. Outcome logic: A unifying foundation for correctness and incorrectness reasoning. Proc. ACM Program. Lang., 7(OOPSLA1):522–550, 2023.