Papers
Topics
Authors
Recent
Search
2000 character limit reached

Internal Language for Imperative Multicategories

Updated 7 July 2026
  • Internal Language for Imperative Multicategories is a formal syntax–semantics interface for effectful, multi-output computations using uniformly traced distributive multicategories.
  • It unifies multimorphisms, labels, coproduct-based control flow, and fixpoint-based looping within a single algebraic framework.
  • The framework provides sound denotational semantics and derived program logics for correctness, incorrectness, and relational reasoning.

Searching arXiv for the cited papers and directly related work on imperative multicategories, effect categories, and categorical program logics. Internal language for imperative multicategories is a formal syntax–semantics interface for effectful, multi-output computation in which programs are interpreted in imperative multicategories, namely uniformly traced distributive multicategories whose unary morphisms form a copy-discard category. In this setting, multimorphisms, labels, coproduct-based control flow, and fixpoint-based looping are handled within a single algebraic framework, and representability yields imperative categories together with derived program logics for correctness, incorrectness, and relational reasoning (Bonchi et al., 24 Jul 2025). Its immediate categorical background is the earlier theory of effect categories, where semi-products and sequential products were introduced to model multiple arguments in the presence of effects, distinguishing pure from arbitrary functions and strong equations from semi-equations (0707.1432).

1. Historical and conceptual antecedents

Dumas–Duval–Reynaud’s theory of effect categories extends a cartesian weak category VV of pure functions by a weak category CC of all functions, while also distinguishing two notions of equation: strong equations, denoted \equiv, and semi-equations, denoted \sqsubseteq (0707.1432). The relation \sqsubseteq is weaker than \equiv, is transitive, coincides with \equiv on VV, satisfies substitution, and satisfies replacement only when the postcomposed arrow is pure. This decorated setting permits binary semi-products in cases where one leg is pure and, from these, left and right sequential products

f1f2=(idY1×f2)(f1×idX2),f1f2=(f1×idY2)(idX1×f2).f_1 \ltimes f_2 = (id_{Y_1}\times f_2)\circ (f_1\times id_{X_2}), \qquad f_1 \rtimes f_2 = (f_1\times id_{Y_2})\circ (id_{X_1}\times f_2).

These constructions encode evaluation order explicitly, and in general f1f2f_1\ltimes f_2 and CC0 need not coincide up to CC1; when CC2 and CC3, sequential products recover the ordinary cartesian product (0707.1432).

Although multicategories are not directly defined in that earlier paper, a multicategory-like structure can be constructed from a cartesian effect category by iterating sequential products and composing with pure “collectors.” For a common domain CC4, one defines left sequential pairings such as

CC5

and more generally CC6 by associating to the left. Judgments then distinguish pure from effectful terms, and equations distinguish strong from weak equality. This suggests a direct precursor to the later internal language: multiple arguments are not combined by an undifferentiated cartesian product, but by ordered composition whose laws are controlled by weakened projection principles and observational equality (0707.1432).

2. Categorical substrate of imperative multicategories

The 2025 formulation begins from symmetric premonoidal structure. A copy-discard premonoidal category CC7 is a symmetric premonoidal category in which each object CC8 has copy and discard maps

CC9

forming a central cocommutative comonoid compatible with \equiv0 and with the unit object. Concretely, the axioms include coassociativity, counit, cocommutativity, monoidal compatibility

\equiv1

and unit compatibility \equiv2, \equiv3 (Bonchi et al., 24 Jul 2025).

A distributive monoidal category is finitely cocomplete and has canonical distributors

\equiv4

as natural isomorphisms. On the multicategorical side, a cocartesian multicategory carries coactions by finite functions \equiv5, written \equiv6, and a distributive multicategory is additionally equipped with a tensor on multimorphisms satisfying associativity, unitality, and an interchange law (Bonchi et al., 24 Jul 2025).

A traced distributive multicategory is then defined by a fixpoint operator

\equiv7

subject to morphism naturality, action naturality, strength, duplication, and dinaturality. Uniformity strengthens the ordinary traced setting: if

\equiv8

then

\equiv9

An imperative multicategory is precisely a uniformly traced distributive multicategory whose unary morphisms form a copy-discard category. An imperative category is a representable imperative multicategory, so that coproducts are represented by objects \sqsubseteq0 with injections and case maps, yielding a distributive copy-discard category with uniform trace on coproduct (Bonchi et al., 24 Jul 2025).

3. Syntax, binding structure, and equational theory

The internal language is defined over a distributive signature \sqsubseteq1, where \sqsubseteq2 is a set of basic types and each generator set

\sqsubseteq3

is intended as a family of multimorphisms

\sqsubseteq4

Variables are drawn from a countably infinite set \sqsubseteq5, labels from a countably infinite set \sqsubseteq6, a context has the form \sqsubseteq7, and an index is a list \sqsubseteq8 of available jump targets with their arities (Bonchi et al., 24 Jul 2025).

Judgments have the form \sqsubseteq9. The primitive term formers are return, generator, and loop. Return yields

\sqsubseteq0

when \sqsubseteq1. A generator term has the shape

\sqsubseteq2

and a loop term has the shape

\sqsubseteq3

The language is quotiented by \sqsubseteq4-equivalence, and it admits both variable substitution and label substitution. Variable substitution is defined inductively, for example

\sqsubseteq5

while label substitution includes the clause

\sqsubseteq6

These substitution operations generate derived structural rules such as exchange, contraction, weakening, whiskering, and multiwhiskering (Bonchi et al., 24 Jul 2025).

The equational theory is governed by an interchange axiom and loop axioms. Interchange states that two independent computations can be rearranged into an equivalent tensor-like form over the combined index \sqsubseteq7. The loop axioms are dinaturality, diagonal, and uniformity. The diagonal axiom identifies nested loops with a single loop after a suitable label substitution, and the non-posetal uniformity axiom expresses precisely the fixpoint uniformity needed for invariant-style reasoning (Bonchi et al., 24 Jul 2025).

A posetal version enriches each generator set with a partial order and adds monotonicity rules for return, loop, and generators. It also includes top and bottom principles and a posetal uniformity rule, in forward and backward form, that lifts inequalities on guarded bodies to inequalities on the resulting loops. This order-enriched layer is what later supports correctness and incorrectness logics (Bonchi et al., 24 Jul 2025).

4. Denotational semantics, soundness, and completeness

Given an assignment of basic types and generators into an imperative multicategory, the semantics interprets objects by \sqsubseteq8 and extends to lists by

\sqsubseteq9

Each generator \equiv0 is interpreted by

\equiv1

Return terms are interpreted using copy-discard reindexing \equiv2 and injection into the appropriate coproduct branch:

\equiv3

Loop terms are interpreted by composing a reindexing map, the fixpoint operator, and branch projections \equiv4, while generator terms are interpreted by duplicating the input and distributing over the branches of the coproduct (Bonchi et al., 24 Jul 2025).

This denotational semantics is sound for the language axioms and complete via a syntactic model. The soundness theorem states that the interpretation respects the interchange and loop axioms. The completeness theorem states that the syntactic model of terms itself forms an imperative multicategory, with multicategory structure, cocartesian coactions, predistributive copy-discard structure, and fixpoint or trace axioms; therefore any equation valid in all imperative multicategories already holds in the syntax (Bonchi et al., 24 Jul 2025).

Representability connects the multicategorical language to more familiar categorical semantics. Imperative categories arise as representable imperative multicategories or as Kleisli categories of partially additive monads such as the maybe, powerset, and subdistribution monads on distributive categories. Under the hypotheses of Jacobs’s theorem and Hasuo’s generic trace theory, these Kleisli categories carry uniform and posetal uniform traces, yielding posetal imperative categories (Bonchi et al., 24 Jul 2025).

5. Derived guarded-command structure and program logics

Within the internal language one derives an adaptation of Dijkstra’s guarded command language. Guards have type \equiv5 with \equiv6, and the derived combinators include left and right constants, negation, conjunction, disjunction, and guarded pick

\equiv7

Predicates have type \equiv8 with \equiv9, and derived forms include \equiv0, \equiv1, conjunction, conditionals, guard-to-predicate conversion \equiv2, and variable substitution. Commands are endomorphisms \equiv3 with \equiv4; the language derives skip, abort, sequencing, assertions, variable assignment, generator assignment, if-then-else, and while. Among the key equalities are associativity and unit laws for sequencing, simplifications for constant guards, and loop unfolding:

\equiv5

States, observations, choices, samples, cosubstitutions, and mute operations are defined similarly (Bonchi et al., 24 Jul 2025).

The same formalism yields several program logics. A correctness triple \equiv6 is valid when

\equiv7

In any posetal imperative category with \equiv8 and \equiv9, one obtains rules such as skip, composition, deterministic-total assignment, guarded choice, loop invariance by uniformity, loop unrolling, deterministic if-then-else, deterministic while, monotonicity, conjunction, fail, assert, and top or bottom rules. An incorrectness triple VV0 is valid when VV1, and an outcome-like predicate-correctness triple VV2 is valid when VV3 (Bonchi et al., 24 Jul 2025).

Relational program logics are derived via couplings. A coupling of VV4 and VV5 is a morphism

VV6

satisfying the prescribed marginal equations, and strong couplings are those factoring through the first injection. Relational correctness and incorrectness rules then follow from coupling composition, product couplings for total morphisms, symmetry, and if/while couplings under total or deterministic guards. The result is a uniform derivation of unary and relational logics from the same internal language and the same categorical axioms (Bonchi et al., 24 Jul 2025).

6. Relation to effect categories, examples, and limitations

The internal language for imperative multicategories generalizes the earlier insight that multiple arguments in effectful settings must be treated sequentially rather than by ordinary cartesian products. In effect categories, a semi-product

VV7

exists when one leg is pure, and sequential products VV8 and VV9 enforce evaluation order. Projection laws then mix strong and weak equations, and swap or associativity hold only in decorated form. The 2025 multicategorical language packages the same phenomenon into a structure with distributivity for choice, copy-discard for dataflow and assertions, and uniform trace for loops; standard traced monoidal categories do not by themselves enforce uniformity, and the 2025 framework treats that extra principle as essential for invariant reasoning (Bonchi et al., 24 Jul 2025, 0707.1432).

The motivating examples from effect categories make the point concrete. For partiality, one takes f1f2=(idY1×f2)(f1×idX2),f1f2=(f1×idY2)(idX1×f2).f_1 \ltimes f_2 = (id_{Y_1}\times f_2)\circ (f_1\times id_{X_2}), \qquad f_1 \rtimes f_2 = (f_1\times id_{Y_2})\circ (id_{X_1}\times f_2).0 and f1f2=(idY1×f2)(f1×idX2),f1f2=(f1×idY2)(idX1×f2).f_1 \ltimes f_2 = (id_{Y_1}\times f_2)\circ (f_1\times id_{X_2}), \qquad f_1 \rtimes f_2 = (f_1\times id_{Y_2})\circ (id_{X_1}\times f_2).1, with f1f2=(idY1×f2)(f1×idX2),f1f2=(f1×idY2)(idX1×f2).f_1 \ltimes f_2 = (id_{Y_1}\times f_2)\circ (f_1\times id_{X_2}), \qquad f_1 \rtimes f_2 = (f_1\times id_{Y_2})\circ (id_{X_1}\times f_2).2 iff f1f2=(idY1×f2)(f1×idX2),f1f2=(f1×idY2)(idX1×f2).f_1 \ltimes f_2 = (id_{Y_1}\times f_2)\circ (f_1\times id_{X_2}), \qquad f_1 \rtimes f_2 = (f_1\times id_{Y_2})\circ (id_{X_1}\times f_2).3 and f1f2=(idY1×f2)(f1×idX2),f1f2=(f1×idY2)(idX1×f2).f_1 \ltimes f_2 = (id_{Y_1}\times f_2)\circ (f_1\times id_{X_2}), \qquad f_1 \rtimes f_2 = (f_1\times id_{Y_2})\circ (id_{X_1}\times f_2).4 for f1f2=(idY1×f2)(f1×idX2),f1f2=(f1×idY2)(idX1×f2).f_1 \ltimes f_2 = (id_{Y_1}\times f_2)\circ (f_1\times id_{X_2}), \qquad f_1 \rtimes f_2 = (f_1\times id_{Y_2})\circ (id_{X_1}\times f_2).5. For state, one starts from a cartesian category f1f2=(idY1×f2)(f1×idX2),f1f2=(f1×idY2)(idX1×f2).f_1 \ltimes f_2 = (id_{Y_1}\times f_2)\circ (f_1\times id_{X_2}), \qquad f_1 \rtimes f_2 = (f_1\times id_{Y_2})\circ (id_{X_1}\times f_2).6 with distinguished f1f2=(idY1×f2)(f1×idX2),f1f2=(f1×idY2)(idX1×f2).f_1 \ltimes f_2 = (id_{Y_1}\times f_2)\circ (f_1\times id_{X_2}), \qquad f_1 \rtimes f_2 = (f_1\times id_{Y_2})\circ (id_{X_1}\times f_2).7 and interprets arrows f1f2=(idY1×f2)(f1×idX2),f1f2=(f1×idY2)(idX1×f2).f_1 \ltimes f_2 = (id_{Y_1}\times f_2)\circ (f_1\times id_{X_2}), \qquad f_1 \rtimes f_2 = (f_1\times id_{Y_2})\circ (id_{X_1}\times f_2).8 in f1f2=(idY1×f2)(f1×idX2),f1f2=(f1×idY2)(idX1×f2).f_1 \ltimes f_2 = (id_{Y_1}\times f_2)\circ (f_1\times id_{X_2}), \qquad f_1 \rtimes f_2 = (f_1\times id_{Y_2})\circ (id_{X_1}\times f_2).9 as arrows f1f2f_1\ltimes f_20 in f1f2f_1\ltimes f_21; the semi-congruence is observational equality on results, while state changes may differ. In both cases the failure of full cartesian behavior explains why left and right sequencing need not coincide. The worked imperative example with write and read makes the order explicit: the composite

f1f2f_1\ltimes f_22

has the intended semantics “write f1f2f_1\ltimes f_23; then read at f1f2f_1\ltimes f_24” (0707.1432).

Several limitations are explicit. In effect categories, the semi-congruence may be non-symmetric and does not satisfy full replacement, so decorated proofs cannot always be transported verbatim from cartesian categories. In imperative multicategories, the theory assumes finite coproducts, distributivity with f1f2f_1\ltimes f_25, copy-discard comonoids, posetal enrichment, and uniform trace; the internal language is unstructured, and some proof rules depend on determinism, totality, or posetal uniformity. The stated open directions include external logic beyond internal predicate combinators, separation logic and premonoidal semantics, enrichment from posets to metrics or quantales, broader characterizations of posetal uniformity, nesting of multiple effects, exceptions, closed Freyd categories, traced premonoidal categories, and diagrammatic logics of decorations (Bonchi et al., 24 Jul 2025)

Definition Search Book Streamline Icon: https://streamlinehq.com
References (2)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Internal Language for Imperative Multicategories.