An Internal Language for Categories Enriched over Generalised Metric Spaces
Abstract: Programs with a continuous state space or that interact with physical processes often require notions of equivalence going beyond the standard binary setting in which equivalence either holds or does not hold. In this paper we explore the idea of equivalence taking values in a quantale V, which covers the cases of (in)equations and (ultra)metric equations among others. Our main result is the introduction of a V-equational deductive system for linear λ-calculus together with a proof that it is sound and complete (in fact, an internal language) for a class of enriched autonomous categories. In the case of inequations, we get an internal language for autonomous categories enriched over partial orders. In the case of (ultra)metric equations, we get an internal language for autonomous categories enriched over (ultra)metric spaces. We use our results to obtain examples of inequational and metric equational systems for higher-order programs that contain real-time and probabilistic behaviour
- Propositional Logics for the Lawvere Quantale (2023)
- The syntactic side of autonomous categories enriched over generalised metric spaces (2022)
- A Category-Theoretic Framework for Dependent Effect Systems (2026)
- A vector logic for intensional formal semantics (2026)
- Computing Distinguishing Formulae for Threshold-Based Behavioural Distances (2026)
- On the Metric Nature of (Differential) Logical Relations (2026)
- A Simple Categorical Calculus of Interacting Processes (2026)
- Relational Dualities and Bisimulation (2026)
- Multicategorical Semantics for Untyped Effects (2026)
- Syntax and semantics of focalisation with relative monads and comonads (2026)
Summary
- The paper develops a framework where quantitative relations between program terms are expressed through quantale-valued equations, extending classical linear λ-calculus to handle metric, ultrasonic, and inequational reasoning.
- The calculus utilizes enriched autonomous categories to interpret these quantitative equations, providing sound and complete semantic foundations.
- This approach enabled modeling probabilistic programs and demonstrating compositional, high-order comparative capabilities within quantitative calculi limits.
The paper develops a quantitative internal language for autonomous categories enriched over generalized metric spaces. Its central move is to replace ordinary equations between linear λ-terms with equations indexed by elements of a commutative unital quantale. This construction simultaneously encompasses ordinary equations, inequations, fuzzy relations, metric bounds, and ultrametric bounds. The resulting calculus is shown to be sound and complete for a corresponding class of V-enriched autonomous categories, thereby extending the classical correspondence between linear λ-calculus and symmetric monoidal closed categories (2105.08473).
Problem setting and conceptual framework
Standard equational reasoning identifies two terms either completely or not at all. That binary notion is inadequate when programs operate over continuous states or interact with quantitative phenomena such as execution time, probability, numerical error, or physical dynamics. The paper instead considers judgments of the form
Γ⊢v=qw:A,
where q is an element of a quantale V. The interpretation of q depends on the quantale. In the Lawvere metric quantale, q is an upper bound on the distance between the denotations of v and w; in the Boolean quantale, the judgment becomes an inequation; in the ultrametric quantale, composition of bounds uses maximum rather than addition.
The quantale assumptions are substantive. The underlying lattice is required to be continuous and to possess a basis V0 closed under finite joins, quantale multiplication, and containing the unit. The calculus only admits labels from V1, allowing the formal system to use finitely representable quantitative values such as extended nonnegative rationals. Integrality, meaning that the quantale unit is the lattice top element, is also assumed. These conditions support the Archimedean rule and ensure that the enriched categorical structures used later are autonomous.
The syntactic language is the exponential-free multiplicative fragment of intuitionistic linear logic. Types are generated from ground types, the tensor unit, tensor, and linear implication. Contexts are ordered lists of distinct typed variables, and terms use tensor introduction and elimination, unit introduction and elimination, linear abstraction, application, and operation symbols. A technically important design choice is that exchange is admissible but not a primitive rule. Contexts are combined through restricted shuffles preserving the internal order of each component. This gives every typing judgment a unique derivation, which makes its interpretation as a categorical morphism unambiguous. The paper consequently separates syntactic exchange from the semantic symmetry isomorphisms of an autonomous category.
Quantale-valued deduction
The quantitative deductive system extends ordinary congruence reasoning with rules whose labels reflect the quantale structure. Reflexivity is labeled by the top element, transitivity combines labels using quantale multiplication, and weakening permits a bound to be relaxed along the lattice order. The Archimedean rule reconstructs a judgment labeled by V2 from judgments labeled by all basis elements way-below V3. Finite joins combine independently established bounds.
The compatibility rules propagate quantitative estimates through the syntax. For an operation symbol, the output bound is the quantale product of the input bounds. Tensor, sequencing, tensor elimination, abstraction, application, permutation, and substitution receive analogous rules. In the metric quantale, these are exactly the expected compositional principles: errors add under sequential or multiplicative composition, while non-expansive operations preserve bounds.
The omission of a general symmetry rule is deliberate and important. If the rule
V4
were admitted for every quantale, the Boolean instance would collapse inequations into equations. The Boolean interpretation of V5 is V6; imposing symmetry would immediately yield V7. Symmetry is therefore imposed only for symmetric theories, which are the appropriate theories for metric and ultrametric semantics. This distinction allows the same formal framework to express both directed refinement and symmetric distance.
For the Boolean quantale, labels are V8 and V9. The label λ0 expresses an inequation, while label λ1 is universally valid. For the metric quantale, the order is reversed relative to the usual order on nonnegative distances: a larger numerical distance corresponds to a smaller quantale element. Consequently, weakening has the correct interpretation that a bound of λ2 entails every less precise bound λ3 with λ4 in ordinary numerical order. The paper also notes that finite or linearly ordered quantales simplify the deductive system: in a finite quantale, the Archimedean rule is unnecessary, and for linearly ordered quantales the finite-join rule is largely redundant apart from deriving the bottom-labeled judgment.
Enriched categorical semantics
The semantic counterpart of quantale-valued equality is enrichment. A λ5-category assigns to each pair of objects a value measuring their relatedness, subject to reflexivity and transitivity expressed through the quantale. Depending on λ6, these structures specialize to preorders, fuzzy preorders, generalized metric spaces, or generalized ultrametric spaces.
The paper does not merely enrich the hom-sets of an autonomous category arbitrarily. For a category λ7 to serve as a model, every hom-set λ8 must be a λ9-category, composition must be a Γ⊢v=qw:A,0-functor, tensor must be enriched, and the adjunction
Γ⊢v=qw:A,1
must be a Γ⊢v=qw:A,2-adjunction. This is the precise categorical structure needed to interpret the quantitative congruence rules for linear Γ⊢v=qw:A,3-calculus.
A judgment Γ⊢v=qw:A,4 is satisfied when the enrichment value between the denotations of Γ⊢v=qw:A,5 and Γ⊢v=qw:A,6 is at least Γ⊢v=qw:A,7. This inequality orientation is essential: in the metric instance, it says that the distance between the denotations is at most the specified bound. Enriched composition supplies the semantic basis for transitivity, while enriched tensor and application supply the compatibility principles.
The semantic treatment of exchange and substitution relies on the canonical splitting, joining, and permutation morphisms induced by the autonomous structure. These morphisms are isomorphisms, so they preserve enrichment values in both directions. The paper’s soundness proof consequently combines ordinary coherence for symmetric monoidal closed categories with the enriched functoriality of composition, tensor, and internal hom.
Soundness, completeness, and the internal language theorem
The main formal result establishes soundness and completeness for varietal linear Γ⊢v=qw:A,8-theories. A theory is called varietal when the enriched hom-objects generated by its terms are small. This size condition is needed because the target models are locally small enriched categories.
For completeness, the authors construct a syntactic category. Given types Γ⊢v=qw:A,9 and q0, the hom-object is first formed from all terms q1 such that q2. Its enrichment is defined by
q3
This produces a potentially non-separated q4-category. The authors then quotient by the equivalence relation identifying terms mutually related at the top quantale value. The quotient is separated and supplies the hom-object of the syntactic category.
This quotient construction has two roles. First, it identifies exactly the terms that must denote the same morphism under the ordinary autonomous equations. Second, it makes the syntactic category compatible with the enriched semantics while retaining quantitative distinctions below the top value. Thus two terms may be identified as morphisms when their top-labeled equations hold in both directions, yet still carry a nontrivial quantitative relation before or after quotienting.
The resulting category is autonomous, and its enrichment is preserved by composition and tensor. The proof of enriched composition follows the deduction rule for substitution: if q5 is close to q6 and q7 is close to q8, then substituting q9 and V0 into V1 and V2 yields a bound obtained by quantale multiplication. The enriched closed structure follows from the abstraction and application rules and from the enriched adjunction between tensor and internal hom.
The completeness argument uses continuity of the quantale in an essential way. If a model validates V3, then the enrichment value between the denotations is at least V4. Since the chosen basis approximates every quantale element through way-below elements, each basis element V5 can be bounded by a finite join of derivable labels. The join and weakening rules derive V6, after which the Archimedean rule reconstructs V7. Without continuity and the basis assumptions, this syntactic recovery of arbitrary semantic bounds would not follow.
The internal language theorem states that every V8-enriched autonomous category is V9-equivalent to the syntactic category of its internal language. The internal language contains the objects and morphisms of the category as ground types and operation symbols, together with all quantitative equations satisfied by their interpretation. The theorem therefore establishes not merely adequacy for a class of models but a categorical reconstruction result: enriched autonomous categories can be represented, up to enriched equivalence, by quantitative linear q0-theories.
Concrete instances of the framework
Ordered and metric time
The paper first models operations q1 that add q2 units of latency. The metric theory includes exact equations for zero delay and additive composition,
q3
as well as the quantitative relation
q4
The semantic model interprets q5 as q6 and q7 as q8. This realizes the label as an upper bound on the difference in execution time. The same operations can be interpreted in the Boolean quantale, replacing metric bounds with the directed relation
q9
The paper derives an inequation between higher-order programs that compose a function with one or two successive unit delays. Its significance is that the quantitative system propagates a first-order cost ordering through higher-order application without requiring an explicit operational semantics for the composed programs. The result depends on monotonicity of the model and should therefore be understood as a semantic consequence of the chosen ordered interpretation, not as a general theorem about arbitrary operational notions of running time.
Probabilistic programs and Banach-space semantics
The more substantial example uses the metric quantale and the category q0 of Banach spaces and short linear maps. Ground types are interpreted as spaces of finite Borel measures, equipped with total variation distance. Addition is interpreted by pushforward along addition, while probabilistic operations are interpreted by pushforward along Markov kernels.
The core axiom is
q1
The bound is the total variation distance between Bernoulli distributions with parameters q2 and q3. The authors establish that q4 is a metric-enriched autonomous category and that the probabilistic operations satisfy the axiom under the total variation norm.
The strongest application concerns two higher-order random-walk terms:
q5
The deductive system derives
q6
without computing the denotations of the two operators q7. This is a particularly clear demonstration of the paper’s intended benefit: a local quantitative axiom about a primitive probabilistic operation yields a global distance bound for higher-order programs through compositional rules. Tensor additionally extends the reasoning to products and higher-dimensional random walks.
The result is a bound rather than an algorithm for exact semantic distance. Its validity rests on the specific Banach-space interpretation, the total variation metric, and the shortness of all semantic operations. It does not establish that the same syntactic estimate is tight under alternative metrics or probabilistic semantics.
Relation to prior semantic approaches
The paper differs from metric logical relations, applicative bisimilarity, context distance, and graded type systems in the location of the quantitative structure. Logical relations and bisimulation typically define a semantic or operational relation externally to the equational theory. Graded type systems encode quantitative information in typing judgments, often to track resource usage or coeffects. Here, quantitative information is intrinsic to the equality relation between terms. The calculus remains a linear q8-calculus, but its equational theory is enriched by quantale-valued judgments.
The construction is close in spirit to metric universal algebra, especially in its use of approximate equations, Archimedean closure, and quotienting pseudometric structures into separated metric structures. Its distinctive contribution is the integration of these ideas with higher-order linear syntax and autonomous categorical semantics. The internal language theorem places metric and inequational reasoning within the same categorical framework as ordinary linear q9-calculus.
The final functorial discussion connects three levels of semantics: v0-enriched autonomous categories, ordinary autonomous categories, and thin autonomous categories or lineales. Discretizing hom-sets embeds ordinary categorical models into the quantitative setting, while collapsing hom-sets recovers the coarse order-theoretic semantics. This clarifies that quantale enrichment is not merely an alternative notation for equations: it adds structure distinguishing multiple morphisms between the same objects by their quantitative relationships.
Limitations and open questions
The principal technical limitation is the scope of the assumptions on v1. Continuity, a basis closed under the relevant operations, and integrality are sufficient for the theorems but exclude some potentially useful quantales or require additional verification in concrete cases. The framework also starts with the exponential-free linear calculus. Consequently, weakening, contraction, recursion, and general nonlinear function duplication are not covered directly.
The examples are semantic demonstrations rather than implementations or empirical evaluations. The probabilistic example proves soundness in a Banach-space model, but the paper does not provide an automated decision procedure, complexity analysis, or a general method for discovering useful quantitative axioms. The claim that the derived random-walk estimate is easy to obtain syntactically is supported by the derivation, but the scalability of proof search for larger theories remains open.
The paper also leaves unresolved how the theory should be extended to affine, Cartesian, and mixed linear-nonlinear calculi. In those systems, structural rules such as weakening and contraction would interact nontrivially with quantitative composition. A further open issue is the appropriate categorical notion of morphism between v2-theories and the construction of an equivalence between a category or quasicategory of theories and one of enriched autonomous categories. Finally, the ultrametric and Gödel instances are identified as important applications, but their detailed higher-order examples are not developed to the same extent as the Boolean and metric cases.
Conclusion
The paper establishes a general quantitative extension of the internal-language correspondence for linear v3-calculus. Quantale-valued equations provide a uniform syntax for inequational, fuzzy, metric, and ultrametric reasoning, while v4-enriched autonomous categories provide the corresponding semantics. The soundness, completeness, and enriched internal-language theorems show that this correspondence is structurally exact under the stated continuity, basis, integrality, and smallness assumptions. The time and probabilistic examples demonstrate how local quantitative axioms can yield compositional bounds for higher-order programs, including nontrivial probabilistic operators whose exact denotations are difficult to compare directly (2105.08473).
Paper to Video (Beta)
No one has generated a video about this paper yet.
Whiteboard
No one has generated a whiteboard explanation for this paper yet.
Paper Prompts
Sign up for free to create and run prompts on this paper.
Top Community Prompts
Open Problems
We haven't generated a list of open problems mentioned in this paper yet.
Continue Learning
- Can this quantal internal language framework be extended to encompass other types of linear or nonlinear calculi?
- Which specific applications of probabilistic programs or operations over time would benefit most from this extended calculus?
- Are there any automatic decision procedures or methods for verifying the soundness of local quantitative axioms in specific models?
- How does the paper's soundness and completeness framework compare with applicative bisimilarity or graded type systems?
- Find recent papers about generalized-ultrimetric frameworks for probabilistic program inference.