---
title: Uniformly Traced Distributive Copy-Discard Categories
url: https://www.emergentmind.com/topics/uniformly-traced-distributive-copy-discard-categories
type: topic
---

# Uniformly Traced Distributive Copy-Discard Categories

Searching arXiv for the specified paper and closely related context.
Searching arXiv for "2507.18238 Program Logics via Distributive Monoidal Categories"
Uniformly traced distributive copy-discard categories are the categorical structures called **imperative categories** in "Program Logics via Distributive Monoidal Categories" [2507.18238]. They are presented as a foundation for imperative computation and for deriving multiple program logics, including correctness, incorrectness, and relational Hoare logic, from a common algebraic base. In the paper’s formulation, the multicategorical core is a **uniformly traced distributive multicategory** equipped with copy-discard structure on unary morphisms; an **imperative category** is then an imperative multicategory with representable coproducts. The structure combines symmetric (pre)monoidal composition, finite coproducts and distributivity, cocommutative comonoids for copying and discarding, and a trace presented as a fixpoint operator. The resulting package is used to model variables, control flow, iteration, and loop invariants within a single denotational and proof-theoretic framework [2507.18238].

## 1. Base categorical structure

The paper works in the setting of strict symmetric premonoidal and monoidal categories. A strict premonoidal category is a category $C$ equipped with a sesquifunctor $\otimes : (C,C) \to C$ and a unit object $I$ such that, on objects,
$$
A \otimes (B \otimes C) = (A \otimes B) \otimes C
\quad\text{and}\quad
A \otimes I = A = I \otimes A,
$$
and on morphisms the tensor is separately associative and unital:
$$
(f \otimes id_B)\otimes id_C = f \otimes (id_B \otimes id_C),
$$
$$
(id_A \otimes g)\otimes id_C = id_A \otimes (g \otimes id_C),
$$
$$
id_A \otimes (id_B \otimes h) = (id_A \otimes id_B)\otimes h,
$$
$$
id_I \otimes f = f = f \otimes id_I.
$$
A morphism $f:A\to A'$ is **central** if for any $g:B\to B'$ the interchange axiom holds:
$$
[(f \otimes id_B)\circ (id_{A'} \otimes g)] =
[(id_{A'} \otimes g)\circ (f \otimes id_{B'})].
$$
A monoidal category is a premonoidal category in which all morphisms are central, and a symmetric premonoidal category has symmetries $\sigma_{A,B}:A\otimes B\to B\otimes A$ satisfying the usual coherence equations.

This distinction between monoidal and premonoidal structure is operationally important in the paper. The internal language includes an **interchange axiom** that axiomatizes centrality on terms; with interchange one recovers monoidality, while dropping interchange models premonoidal effects. This gives the framework a direct connection to effect-sensitive semantics without altering the basic treatment of copying, branching, and looping.

## 2. Copy-discard and distributive structure

A copy-discard premonoidal category is a symmetric premonoidal category in which each object $X$ carries a compatible and central cocommutative comonoid structure, given by a copy morphism $\Delta_X:X\to X\otimes X$ and a discard morphism $!_X:X\to I$. These satisfy coassociativity,
$$
(\Delta_X \otimes id_X)\circ \Delta_X = (id_X \otimes \Delta_X)\circ \Delta_X,
$$
cocommutativity,
$$
\sigma_{X,X}\circ \Delta_X = \Delta_X,
$$
and counitality,
$$
\lambda_X \circ (!_X \otimes id_X)\circ \Delta_X = id_X,
\qquad
\rho_X \circ (id_X \otimes !_X)\circ \Delta_X = id_X.
$$
They are also compatible with tensor and unit:
$$
\Delta_{X\otimes Y} = (\Delta_X \otimes \Delta_Y)\circ (id_X \otimes \sigma_{X,Y}\otimes id_Y),
$$
$$
!_{X\otimes Y} = (!_X \otimes !_Y),
\qquad
\Delta_I = id_I,
\qquad
!_I = id_I.
$$

The paper defines a morphism $f:X\to Y$ to be **deterministic** if it preserves copying,
$$
\Delta_Y \circ f = (f \otimes f)\circ \Delta_X,
$$
and **total** if it preserves discarding,
$$
!_Y \circ f = !_X.
$$
These notions are used directly in the assignment and guard rules of the derived program logics.

A **distributive copy-discard category** is then a copy-discard category $(C,\otimes,I)$ with chosen finite coproducts, binary $+$ and nullary $0$, such that the canonical distributors are natural isomorphisms:
$$
\delta^L_{X;Y,Z}: X\otimes (Y+Z) \to (X\otimes Y) + (X\otimes Z),
$$
$$
\delta^R_{X,Y;Z}: (X+Y)\otimes Z \to (X\otimes Z) + (Y\otimes Z).
$$
The paper assumes the natural coherence associated with Laplaza-style distributivity, and uses both binary coproducts and unbiased finite coproducts $\Sigma$ with injections $inj_{i,n}$ and case maps.

Under the paper’s assumptions, copy and discard are compatible with coproducts. Writing $\nabla : X+X \to X$ for codiagonal, the paper gives:
$$
!_{X+Y} = (!_X + !_Y)\circ !_1,
$$
and
$$
\Delta_{X+Y} =
(\Delta_X + \Delta_{X\otimes Y} + \Delta_{Y\otimes X} + \Delta_Y)
\circ
(\delta_{X;X,Y} + \delta_{Y;X,Y})
\circ
\delta_{X,Y;X+Y}.
$$
It also records an inverse-distributor identity ensuring coherent interaction between tensor, coproduct, and copying. In particular, the structure maps of coproducts are total and deterministic [2507.18238].

The paper explicitly motivates this combination of axioms as a semantics of imperative computation. Copy-discard provides “variable wires,” distributivity and finite coproducts model guards and case analysis, and the distinction between deterministic and total morphisms gives precise hypotheses for assignment and branching principles.

## 3. Trace, fixpoint, and uniformity

The traced component is formulated multicategorically. Standard traced monoidal structure is recalled through a family
$$
Tr^X_{A,B}: C(A\otimes X, B\otimes X)\to C(A,B),
$$
satisfying dinaturality, superposing, yanking, and vanishing. In the paper, however, trace is presented through a fixpoint operator on a traced distributive multicategory:
$$
fix : \mathcal{C}(X;X,Y_1,\ldots,Y_n)\to \mathcal{C}(X;Y_1,\ldots,Y_n).
$$
Its axioms are:

- morphism naturality:
  $$
  fix(f)\circ (a_1,\ldots,a_n) = fix(f\circ (a_1,\ldots,a_n));
  $$
- action naturality:
  $$
  *\{fix(f)\}{\sigma} = fix(*\{f\}{id_1+\sigma});
  $$
- strength:
  $$
  fix(f \triangleright X)=fix(f)\triangleright X,
  \qquad
  fix(X \triangleleft f)=X\triangleleft fix(f);
  $$
- duplication:
  $$
  fix(fix(f)) = fix(*\{f\}{[id_1,id_1]+id_n});
  $$
- dinaturality:
  $$
  fix(*\{f\circ_1 g\}{[id_n,id_n]})
  =
  g\circ_1 fix(*\{f\circ_1 g\}{[id_n,id_n,id_n]}).
  $$

These axioms encode the usual trace laws in the multicategorical setting. The paper states that yanking and superposing correspond to instances of strength and duplication, dinaturality is the sliding axiom, and vanishing corresponds to special cases of fix with units and empties under representability.

The distinctive additional principle is **uniformity**. A uniformly traced distributive multicategory, also called an **Elgot multicategory** in the paper, requires that if
$$
*\{h \circ (f_1,\ldots,f_n)\}{(\nu_n + id_m)} =
g \circ *\{(id,\ldots,id,h,\ldots,h)\}{(id_n + \nu_m)},
$$
then
$$
*\{h \circ (fix(f_1),\ldots,fix(f_n))\}{\nu_n}
=
fix(*\{g\}{\nu_m}).
$$
The posetal form strengthens this to forward and backward inequalities: if the premise holds with $\leq$, then the conclusion holds with $\leq$, and if the premise holds with $\geq$, then the conclusion holds with $\geq$.

This posetal uniformity is central to the program-logic applications. The paper states that uniformity formalizes the proof principle that invariance under one unfolding step extends to invariance under the whole loop. In monoidal-categorical terms, its posetal version coincides with Hasegawa’s notion, expressed through the implication that existence of $u:U\to V$ such that
$$
f\circ (u\oplus id_Y) \leq (u\oplus id_X)\circ g
$$
implies
$$
tr(f)\leq tr(g),
$$
with a dual formulation for the converse inequality [2507.18238].

## 4. Internal language and imperative constructs

The paper introduces an internal language for imperative multicategories. Its terms denote morphisms of the free traced distributive copy-discard multicategory, and its types are **normalized polynomials**, that is, sums of tensors of basic types. A context is written
$$
\Gamma = x_1:X_1,\ldots,x_n:X_n,
$$
and an index
$$
\Delta = (\alpha_1:\Psi_1),\ldots,(\alpha_m:\Psi_m),
$$
where each label $\alpha$ names an exit together with its vector of variable types.

The primitive constructors are **return**, **generator**, and **loop**. Return takes a label in the index and variables in the context and forms a term $\Gamma \vdash \alpha(x_1,\ldots,x_n):\Delta$. Generator applies a signature symbol
$$
f \in \Sigma(X_1,\ldots,X_n;(Y_{1,1},\ldots,Y_{1,m_1}),\ldots,(Y_{\ell,1},\ldots,Y_{\ell,m_\ell}))
$$
to input variables, together with branch terms. Loop introduces a label and binds variables:
if $(u_1:X_1),\ldots,(u_n:X_n),\Gamma \vdash p:(\alpha:X_1,\ldots,X_n),\Delta$, then
$$
\Gamma \vdash \{\alpha(x_1,\ldots,x_n)\}\{u_1,\ldots,u_n.p\}:\Delta.
$$

Three groups of equations organize the language. First, the **interchange axiom** expresses centrality of independent computations and recovers monoidality from premonoidal structure. Second, the **loop axioms** express dinaturality, diagonal behavior, and uniformity syntactically. Third, a **fixpoint rule** states that looping is a fixpoint for label substitution:
if $(\vec u:X),\Gamma \vdash p:(\alpha:\vec X),\Delta$, then
$$
\Gamma \vdash \{\alpha(\vec x)\}\{\vec u.p\}
\equiv
((p[\vec u/\vec x])[\alpha/\{\alpha(\vec x)\}\{\vec u.p\}]).
$$

On top of this language, the paper derives combinators for guards, predicates, commands, and states. Guards $b:\Gamma\vdash b:(\alpha_1:(),\alpha_2:())$ include left and right constants, negation, conjunction, disjunction, and a branch operator
$$
[b]\{t_1\}\{t_2\} \equiv b\{\alpha_1,\alpha_2\}\{t_1,t_2\}.
$$
Predicates $p:\Gamma\vdash p:(\nu:())$ include
$$
\top \equiv \nu(),
\qquad
\bot \equiv \{\omega()\}\{\omega()\},
$$
together with conjunction, conditional combination $p +_b q$, and the predicate associated to a guard,
$$
b^\# \equiv [b]\{\top\}\{\bot\}.
$$

Commands $c:\Gamma\vdash c:(\eta:(X_1,\ldots,X_n))$ include skip, composition, assert, abort, assignment, generator assignment, conditional, and while. The key derived command forms are:
$$
skip \equiv \eta(\vec x),
$$
$$
(c_1;c_2) \equiv c_1\{\eta\}\{\vec x.c_2\},
$$
$$
\{p\} \equiv p\{\nu\}\{\eta(\vec x)\},
$$
$$
abort \equiv \bot,
$$
$$
if\ b\ then\ c_1\ else\ c_2 \equiv [b]\{c_1\}\{c_2\},
$$
and
$$
while\ b\ do\ c \equiv \{\alpha(\vec x)\}\{\, b\{c\}\{\eta\{\vec x.\alpha(\vec x)\}\}\,\}.
$$
The paper records the loop unfolding equation
$$
while\ b\ do\ c \equiv \{b\}\{(c;while\ b\ do\ c)\}\{\},
$$
which is used repeatedly in the derived logics [2507.18238].

The denotational semantics theorem interprets every generator and term in any imperative multicategory using normalized coproducts and coactions of labels. Return uses finite-set opposite maps $\sigma^\star$ built from copy-discard structure, generator semantics threads inputs via $\nu$ and distributes branches via coactions, and loop semantics uses fixpoint to thread updated and non-updated variables. The paper states that this semantics is sound with respect to the language axioms and complete via the syntactic model.

## 5. Program logics derived from the axioms

The paper defines validity of triples through inequalities in the poset structure of a posetal imperative category. The basic forms are:

- **state correctness**: $s \circ c \leq t$;
- **predicate correctness**: $p \leq c \circ q$;
- **assertion correctness**: $\{p\}\circ c \leq c \circ \{q\}$;

together with their incorrectness variants obtained by replacing $\leq$ with $\geq$.

For **Hoare logic**, the paper proves that in any posetal imperative category with $\bot \leq f$ and $f\circ \top \leq \top$ for all $f$, the following rules are valid: skip, composition, assignment for deterministic and total expressions, choice, loop, unroll, deterministic-guard if-else, deterministic-guard while, monotonicity, conjunction, fail, assert-then, top, and bottom. The loop principle is especially direct:
from
$$
\{p\}\{c\}\{p\},
$$
infer
$$
\{p\}\{while\ b\ do\ c\}\{p\}.
$$
For deterministic guards, the paper also derives
$$
\{b^\# \wedge p\}\{c\}\{p\}
\;\Rightarrow\;
\{p\}\{while\ b\ do\ c\}\{p \wedge \neg b^\#\}.
$$
The stated proof ingredients are interchange of predicates and guards, determinism and totality of guards, the definitions of predicates and commands, and posetal uniformity, which discharges loop invariants.

For **incorrectness logic**, valid rules include skip, composition, composition(error), assignment, non-deterministic assignment via sample, branch rules for the two sides of conditionals, convexity for constant guards, iteration rules, monotonicity, assert, fail, and bottom. The paper explicitly gives:
$$
\vdash \{s\}\{while\ b\ do\ c\}\{s \wedge \neg b^\#\},
$$
and the iteration step
$$
\{s \wedge b^\#\}\{c;while\ b\ do\ c\}\{t\}
\;\Rightarrow\;
\{s\}\{while\ b\ do\ c\}\{t\}.
$$

For **outcome-like logic**, the paper proves analogous rules for predicates: skip, composition, deterministic assignment, sample, unroll, choice under total guards, if-else under total and deterministic guards, an assert rule, convexity for constant guards, monotonicity, and bottom.

The framework also yields **relational program logics** through couplings. A coupling of $f_1:X_1\to Y_1$ and $f_2:X_2\to Y_2$ is a morphism
$$
h:X_1\otimes X_2 \to Y_1\otimes Y_2 + Y_1 + Y_2
$$
such that
$$
h\circ [\pi_1,id,0] = \pi_1 \circ f_1
\qquad\text{and}\qquad
h\circ [\pi_2,0,id] = \pi_2 \circ f_2.
$$
Strong couplings are those whose image lies in the first summand, and synchronization is obtained by following $h$ with the map to that summand. A relational assertion-correctness triple $\{p\}\{c \sim c'\}\{q\}$ holds if there is a coupling with
$$
\{p\}\circ \{h\} \leq \{h\}\circ \{q\}.
$$
The paper derives relational Hoare logic rules for skip, composition, assignment, choice, if-else, loop, monotonicity, symmetry, and one-sided rules; it also gives a relational predicate-incorrectness logic formulated with $\geq$ [2507.18238].

## 6. Models, semantics, and research context

The paper gives several concrete models:

- Set with the maybe monad: $\mathrm{Par}(\mathbf{Set})$;
- Set with the powerset monad: $\mathrm{Rel}(\mathbf{Set})$;
- Set with the discrete subdistribution monad;
- Standard Borel spaces with the measurable subdistribution monad.

These are described as commutative strong monads over cartesian, hence copy-discard, base categories, yielding distributive (pre)monoidal Kleisli categories. Under partial additivity and $\mathbf{Dcpo}_\bot$-enrichment assumptions, the Kleisli categories have a uniform trace on coproducts by Jacobs’ theorem. The paper then proves posetal uniformity by adapting Hasuo’s generic trace theory: lax and oplax coalgebra morphisms yield the forward and backward inequalities, and therefore the trace is posetally uniform. Consequently, these Kleisli categories are posetal imperative categories.

The paper’s stated version of **Jacobs’ theorem** is: if $C$ has countable coproducts, $T$ is a partially additive monad, the Kleisli category $Kl(T)$ is $\mathbf{Dcpo}_\bot$-enriched, and cotuplings are monotone, then $Kl(T)$ has a uniform trace on its coproduct monoidal structure. Combined with commutative strength, this yields imperative categories. This places the abstract axioms in direct contact with standard semantic settings for partiality, relations, and probability.

The paper also provides string-diagram intuition. Return labels are coproduct injections, generator semantics is case analysis, and loop semantics is described through a fixpoint with a coalgebra to a final coalgebra $\Sigma Y$, so that
$$
tr(f) = \kappa_X \circ !_{\hat f \circ \nabla},
$$
capturing “unfolding until exit.” Yanking, sliding, and superposing correspond to loop axioms; distributivity is depicted by wiring boxes across sums; and copy-discard appears as splitters and terminations for variable wires.

In relation to prior work, the paper places its fixpoint axioms in the lineage of Joyal–Street–Verity traced monoidal categories, extending Hasegawa-style uniformity to a posetal multicategorical setting. Its use of distributive categories relies on classical coherence in the sense of Laplaza. Its multicategorical presentation is aligned with cocartesian multicategories and colored Lawvere theories as used by Hermida, Curien, and Cartwright. Its treatment of premonoidal structure connects with Freyd-category and control semantics associated with Power, Robinson, Levy, and Heunen. The distinction between guards and predicates is explicitly compared with effectus theory, and the iteration principles are linked to Elgot and Arbib–Manes traced cocartesian semantics. A plausible implication is that the framework is designed as a unifying algebraic interface across relational, partial, and stochastic semantics while preserving the distinctions between guards and predicates and between correctness and incorrectness reasoning [2507.18238].

Source: https://www.emergentmind.com/topics/uniformly-traced-distributive-copy-discard-categories