Relational monad algebras #
This file introduces a two-monad relational analogue of MAlgOrdered:
MAlgRelOrdered m₁ m₂ lwith a relational weakest-precondition operatorrwp.- Generic relational triple rules (
pure,consequence,bind). - Side-lifting instances for heterogeneous stacks (
StateT,OptionT,ExceptT).
Attribution:
- Loom repository: https://github.com/verse-lab/loom
- POPL 2026 paper: Foundational Multi-Modal Program Verifiers, Vladimir Gladshtein, George Pîrlea, Qiyuan Zhao, Vitaly Kurin, Ilya Sergey. DOI: https://doi.org/10.1145/3776719
Ordered relational monad algebra between two monads.
- rwp {α β : Type u} : m₁ α → m₂ β → (α → β → l) → l
Relational weakest precondition.
Pure rule for the relational weakest precondition.
- rwp_mono {α β : Type u} {x : m₁ α} {y : m₂ β} {post post' : α → β → l} (hpost : ∀ (a : α) (b : β), post a b ≤ post' a b) : rwp x y post ≤ rwp x y post'
Monotonicity in the relational postcondition.
- rwp_bind_le {α β γ δ : Type u} (x : m₁ α) (y : m₂ β) (f : α → m₁ γ) (g : β → m₂ δ) (post : γ → δ → l) : (rwp x y fun (a : α) (b : β) => rwp (f a) (g b) post) ≤ rwp (x >>= f) (y >>= g) post
Sequential composition rule for relational WPs.
Instances
Relational weakest precondition induced by MAlgRelOrdered.
Instances For
Mapping on the left program is monotone for relational WP.
Mapping on the right program is monotone for relational WP.
Left StateT lift for heterogeneous relational algebras.
Right StateT lift for heterogeneous relational algebras.
Two-sided StateT instance: both sides carry their own state.
The postcondition takes both output values and both final states.
Right OptionT lift (interpreting none as ⊥).
Left OptionT lift (interpreting none as ⊥).
Right ExceptT lift (interpreting exceptions as ⊥).
Left ExceptT lift (interpreting exceptions as ⊥).