Rational Lawvere Logic
Abstract
We study Rational Lawvere logic (). This logic is defined over the extended positive reals with an algebraic structure combining the Lawvere quantale (with the reversed order on the extended reals and a sum as tensor) and a multiplicative quantale (with the usual order on the extended reals and a multiplication as tensor); together they provide a semiring structure. The logic is designed for complex quantitative reasoning, including sequents expressing inequalities between rational functions over the extended positive reals. We give a deduction system and demonstrate its expressiveness by deriving a classical result from probability theory relating the Kantorovich and total variation distances. Our deductive system is complete for finitely axiomatizable theories. The proof of completeness relies on the Krivine-Stengle Positivstellensatz.
We additionally provide complexity results for both and its affine fragment . We consider two decision problems: the satisfiability of a set of sequents and whether a sequent follows from a finite set of sequent. We show that both problems lie in PSPACE for , and we give sharper complexity bounds for : the first problem is NP-complete, while the second is co-NP-complete.
Keywords and phrases:
Quantitative reasoning, complete deductive system, Lawvere’s quantaleCategory:
Invited PaperFunding:
Radu Mardare: EPSRC grant EP/Y000455/1, A correct-by-construction approach to approximate computation and ARIA TA1.1 project Predicate Logic as a Foundation for Verified ML.Copyright and License:
2012 ACM Subject Classification:
Theory of computation LogicEditors:
Stefano Guerrini and Barbara KönigSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Some recent developments in theoretical computer science have questioned the usefulness of equality in semantics, advocating more nuanced, quantitative approaches to equivalence. For instance, exact equality is often too rigid for probabilistic systems where small changes can disrupt equivalence between processes. To address this, researchers used metrics to measure differences, thus shifting the focus from strict equivalence to quantitative comparisons. Metric-based reasoning has also been applied to other areas, such as privacy, security [19, 53], computational resource analysis [37, 38], and symbolic computation [26].
As a result, theories of semantic equality have evolved into quantitative frameworks, focusing on measuring differences rather than asserting equality. Notable examples include theories for program analysis [3, 15, 16, 39, 36, 38], distances for processes [20, 21, 24, 25, 5, 6, 10], and quantitative equational logics over algebras of terms [43, 44, 7, 45, 8, 48, 49, 1, 2]. The latter, in particular, focuses on providing foundations for quantitative reasoning. The basic idea is to replace traditional equations between terms of an algebra with quantitative equations of the form , expressing that and are at most apart, for a real . Thus, quantitative algebraic theories are used to reason about the distances between elements of an algebra. However, equational logic is only one of many forms of logic and a question arises: how can extensions of classical logic be used to provide foundations for quantitative reasoning?
In his seminal work [40], Lawvere views the extended non-negative reals as the objects of a complete monoidal-closed category with as the sets of morphisms and an extended sum as tensor. A -enriched category is then a generalised metric space. Further, in the introduction to [41], he regards the extended non-negative reals as a kind of truth-value, with and as “true ” and “false ”, and speaks of -valued relations. Further, all sups (= -limits) are preserved by tensoring, and so is a quantale, which we call the Lawvere quantale. We argue that logical reasoning on the Lawvere quantale of truth values is a natural choice for studying metric spaces. Lawvere’s generalized metric spaces are -valued preorders in it. A quantitative equation is expressed as a sequent , which corresponds to the inequality .
From a logical point of view, -valued propositional logic is then a natural place to start. Bacci et al. [9] began exploring a class of such quantitative logics, referred to as Lawvere logics111The logics are named in honor of Lawvere.. Among them, Affine Lawvere propositional logic () was the most expressive. This logic features a tensor operation, interpreted as addition in the Lawvere quantale, a linear implication, interpreted as the adjoint residuum of addition, constants for all non-negative real numbers, and scalar multiplication by non-negative reals. So all affine functions on can be expressed in . Logical conjunction and disjunction are derived operators. Sequents in are interpreted as affine inequalities on .
A key innovation of [9] was the use of theorems from linear algebra, specifically Farkas’ Lemma [23] and Motzkin’s transposition theorem [50], to help establish completeness: consequence relations between finite sets of sequents and sequents were reduced to consequence relations between finite sets of linear inequalities and linear inequalities. This established a strong link between logic and classical arithmetic. However, many real-world quantitative phenomena involve non-linear interactions, making it desirable to express polynomial inequalities.
In this paper, we take on the challenge of developing Rational Lawvere Logic (). This logic extends by adding multiplication and division as logical connectives, enabling sequents to represent rational inequalities. Our approach builds on Lawvere’s idea by giving logical status to both sum and multiplication, with the key innovation being that the truth values come from a semiring structure involving two quantales over : the additive Lawvere one (with reverse order and sum as tensor), and the multiplicative one (with the natural order and multiplication as tensor).
Our main contributions are:
-
1.
We give a deduction system for and demonstrate its expressiveness by (a) deriving a classical result from probability theory relating the Kantorovich and the total variation distances and (b) giving an embedding of quantitative equational logic in it (Section 5).
-
2.
We prove completeness for finitely axiomatizable theories (Theorem 9). (There is no finitary complete consistent proof system for general theories (Theorem 15) as compactness fails.) The core of the completeness proof differs significantly from that in [9]. Rather than reducing to formally proving relations between linear inequalities, when we can use Farkas’ Lemma or Motzkin’s transposition theorem, we reduce to formally proving relations between polynomial inequalities, when we can use Krivine-Stengle’s Positivstellensatz [35, 58, 13], a real analogue of Hilbert’s Nullstellensatz. As all such polynomial relations can be directly expressed in the logic, this indicates a prima facie need for the Positivstellensatz.
-
3.
Unlike , allows formulas and sequents to be “booleanized .” We use this to prove a deduction theorem (Theorem 8) that is not available in .
-
4.
The completeness proof employs a linear-time non-deterministic reduction that translates any inference to a set of inferences in polynomial form. Notably, when applied to inferences, it significantly simplifies the normalisation algorithm proposed in [9]. Perhaps this technique can be helpful to obtain, and/or simplify, other completeness proofs.
-
5.
Relying on the reduction discussed above, we establish complexity results for two fundamental decision problems (for both and ): the semantical consequence of a sequent from a finite set of sequents, and the satisfiability of a finite set of sequents. We show that semantical consequence is in PSPACE for and is co-NP-complete for (Theorem 17), and obtain as a corollary that satisfiability is in PSPACE for and is NP-complete for (Corollary 18).
Related Work.
Connections between arithmetic and logical reasoning are well known. A completeness interpretation of Farkas’ Lemma appears already in the literature (e.g., in [46]). In algebraic complexity there is the Nullstellensatz proof system which uses a simple reduction of propositional satisfaction to polynomial equation solvability (e.g., [11, 52]) and the Positivstellensatz calculus [29] which considers polynomial inequalities.
Parallel to Lawvere’s real-valued approach we must mention the vast development of fuzzy logic, for example [51, 12, 31]. Fuzzy logic generally employs (if not explicitly) quantales on the real interval . The most relevant for us is product logic [32, 30, 56, 22], defined over the multiplicative quantale on . Through the quantale isomorphism , corresponds to product logic extended with constants in , and corresponds to a further extension with an operation . Neither of these extensions seems to be in the literature. Moreover, this interpretation of the logical connectives seems unnatural for quantitative reasoning over , and impedes direct access to results we use, e.g., in linear algebra (such as Khachiyan’s ellipsoid method, used for complexity), and in real algebraic geometry (such as the Krivine-Stengle Positivstellensatz, used for completeness).
We must also mention the extensive works on graded (or weighted) structures, such as linear logic’s exponentials, comonads, types, or categories (e.g., [33, 28, 4, 17, 18, 42]). The gradings usually employ general semirings of some kind. However in particular is also discussed, for example in [28, 4, 33, 18]. Various possibilities for multiplication are considered: two commutative ones (ours is one) and a non-commutative one. In Section 2, we discuss all the possible monotonic, commutative, and associative addition and multiplication operations on that extend the usual ones on . They are all definable in our logic (as are the non-commutative ones, as a straightforward extension of our discussion shows).
Synopsis.
Section 2 gives preliminary definitions and notation. Section 3 gives the syntax and semantics of , and Section 4 presents a deduction system for it. Section 5 presents some nontrivial applications. Section 6 develops the completeness result. Section 7 gives the complexity results for and its affine fragment . Section 8 gives concluding remarks and discusses future work.
2 Preliminaries and Notation
A quantale [55] is a complete lattice with a binary, associative operation (tensor) that distributes over joins in each argument; distributivity and completeness entail that the tensor has both right adjoints. A quantale is commutative if its tensor is; and unital if there is an element (unit) s.t. , for all ; if the unit is the top element, the quantale is integral. For commutative quantales, the right adjoints of and coincide.
As mentioned in the introduction, our interest concerns the extended non-negative reals . We next discuss ways of extending sum and multiplication from the positive reals to and analyse the choices of quantales that one obtains from these extensions. To avoid confusion, in what follows we always use and on with respect to the natural order , even when we speak of structures using different orders.
Addition.
We would like to extend sum from the positive reals to so that we still get a sum that is associative, commutative, and monotonic w.r.t (equivalently w.r.t. ). One can show there are three choices for defining such a sum, as given in Table 1, with being the addition of the Lawvere quantale.
|
|
|
|
|
|
|
|
|
Lemma 1.
-
1.
is a commutative, unital, integral quantale; is not a quantale.
-
2.
is a commutative quantale; is not a quantale.
-
3.
Neither nor are quantales.
Thus, for an additive quantale on , if we use the natural order , the correct choice for sum is ; if we use the reverse order , the correct choice is . The first is not unital, since ; the Lawvere quantale, is both unital and integral. We chose , as this enables us to directly encode examples from quantitative equational logic (Section 5). The right adjoint to , can be explicitly formulated in terms of truncated substruction , appropriately extended to as shown in Table 1. Indeed, it holds that .
Multiplication.
One can show there are two associative, commutative, and monotonic extensions of multiplication from to : and , as given in Table 1.
Lemma 2.
-
1.
is a commutative, unital quantale; is not a quantale.
-
2.
is a commutative, unital quantale; is not a quantale.
Thus, for a multiplicative quantale on , if we use the natural order , it is ; if we use the reverse order , it is . We discuss our choice of multiplication in relation to the Lawvere quantale. On the one hand, if the choice were dictated by the quantale order, would seem the natural candidate. On the other hand, unlike , choosing yields a semiring (both multiplications distribute over , but the unit of is not the null element for , as ). Ultimately, we choose . While no choice is perfect, having a semiring enables us to directly encode examples from measure theory (Section 5) and to obtain a deduction theorem (Theorem 8).
Although the logic will use the order of the Lawvere quantale, we will still exploit the quantalic structure associated with by adding as a logical connective the right adjoint to , which can be explicitly formulated in terms of division , appropriately extended to as given in Table 1. Indeed, it holds that .
We conclude by showing that the other operations, namely , , and , can be expressed in terms of , , , and (and so, eventually, in ). First, binary sups and infs can be:
Lemma 3.
For we have:
-
1.
-
2.
Next, we define functions by and . These are “boolean functions” returning either or (i.e., and in the Lawvere quantale), as:
Hence, is a test for , while is a test for . We can next define a conditional using and :
and finally obtain:
Lemma 4.
For we have:
-
1.
-
2.
-
3.
Hereafter, when working on , we simply write for the sum instead of and for the multiplication instead of . The other operations, namely and (written as a fraction), are those from Table 1. We continue writing for the natural order on and for Lawvere’s order.
3 Rational Lawvere Logic
In this section, we introduce Rational Lawvere logic (), a propositional logic interpreted over our semiring on . It extends Affine Lawvere logic () of [9], enabling one to reason with inequalities between rational functions over the non-negative extended reals.
Syntax.
Let be a set of propositional letters, ranged over by . The formulas of are freely generated by the following grammar, for arbitrary and .
We define expected logical connectives as derived operators:
We assume the following precedence rule: multiplication and division have highest precedence, followed by , then , next and , and finally and have lowest precedence. Thus, is interpreted as the formula .
Semantics.
Interpretations are maps , extended to all formulas as follows:
Consequently, the derived connectives are interpreted as follows (recall Lemma 3):
Affine Lawvere Logic.
Boolean formulas.
While, in , an interpretation evaluates a formula to a value in , formulas such as or evaluate either to (“true”) or to (“false”). For example:
We call such formulas boolean. They yield derived operators, such as:
These have useful “boolean” meanings. For example:
Using them, we can express useful facts, e.g., says that “ is finite” and that “ is strictly positive”. We use and as synonyms for and .
Sequents.
A sequent in is a syntactic construct of the form
| (Sequent) |
where is a finite ordered list of formulas, possibly with repetitions, the antecedents of the sequent, and the formula is its consequent. For and such lists of formulas, denotes their concatenation; and is a sequent with no antecedents.
A sequent is satisfied by an interpretation (alternatively, is a model for the sequent), denoted , whenever
| (Semantics of sequents) |
In particular, means that . We write and say that is a model for if satisfies all sequents in . A sequent is satisfiable if it has a model; it is unsatisfiable if it has no models; it is a tautology if it is satisfied by all interpretations. In particular, , , and are tautologies, while is not.
Note the distinction between and the boolean formula : while for all interpretations , we have iff , it may not hold that , as could be a non-zero finite number.
Definition 5 (Semantic Consequence).
A sequent is a semantic consequence of a set of sequents, in symbols , if every model of is also a model of .
4 Deduction System for
An inference rule is a syntactic construct of the form with a finite set of sequents, the hypotheses, and a sequent, the conclusion. As usual with inference rules, we may write for (so repetitions do not matter for hypotheses, only for sequents); for in hypotheses; and for both and .
Definition 6 (Disjunctive Consequence).
Given a set of inference rules for a sublogic of containing , the disjunctive consequence relation it induces is the smallest relation between finite sets of sequents and sequents such that:
-
1.
If then .
-
2.
.
-
3.
If and then (for ).
-
4.
If and then .
Note that weakening holds: if then . We say is -provable from if , omitting if understood from the context, when we may write for .
Disjunctive consequence for is that induced by the inference rules in Table 2; we use the same name to refer to it. It contains basic inference rules of logical deduction: (cut), weakening (weak) and permutation (perm) (note that contraction is not sound). The rule (bot) behaves as expected. (zero) guarantees that the additive quantale is integral and (one) that one is finite. We also have weak-excluded-middle (wem), stating that any formula is either finite or infinite, a prelinearity rule (lin) that ensures the strong connectivity of the quantale order. (prem) is a double inference that allows us to merge premises using ; and (quant) is the double inference representing the (right) quantale implication rule. The cancellation (canc) and subtraction (sub) rules encode standard properties of addition and truncated subtraction, adjusted to allow for infinity. (prem) and (zero), together with the basic inference rules and (top), entail that forms an ordered commutative monoid with a zero. (comp), (assoc), (unit) and (comm) express that multiplication is an ordered commutative monoid with a unit. Together with (distrib) and (null) we then see that we have an ordered commutative semiring. Next, (zm) states that if a product is zero, then one of its factors must also be zero. (sum) and (mult) ensure that and logical multiplication correspond to and respectively when applied to real constants. Finally, (adj) states the adjunction in the multiplicative quantale and (div) is a cancellation rule for multiplication.
Theorem 7 (Soundness).
If a sequent is provable from in , then is a semantic consequence of . In symbols: implies .
In , is provably equivalent to ; moreover is provably equivalent to . Hence, without loss of generality, we may assume that arbitrary sequents are of the form .
Theorem 8 (Deduction Theorem).
For arbitrary formulas in , we have
In [9] it is shown that does not enjoy a deduction theorem, not even in the weak form that holds for fuzzy logics, such as Łukasiewicz, Gödel, or product logics [31]. This is because we have proven that is not possible to “internalize” provability in the language of . However, in , the expressivity provided by multiplication allows us to “booleanize” the sequents.
5 Applications: Proving Properties of Distances
In this section, we show how the deductive system of can be used to reason about distances on probability distributions, namely, the total variation, the Kantorovich and the -Wasserstein distances, and we discuss embedding quantitative equational logic in .
Let be a finite (extended) metric space with distances between and possibly taking as value. Denote by generic discrete probabilities on and by their probabilities at .
Total Variation.
The total variation distance , is encoded in by the formula . A simple example to start with is to demonstrate that the total variation is a pseudo-metric, i.e., satisfies the axioms of reflexivity, symmetry, and triangle inequality, which can be expressed in :
The first two are trivial to derive. The derivation of the third is shown below:
Note that (perm) is used implicitly and some steps of the derivation use meta-rules which are derivable from the rules in Table 2, such as () and ().
The total variation is not just a pseudo-metric, but a proper metric satisfying the Fréchet positivity axiom, which can be expressed in by the sequent
The above uses the boolean formulas of , which can be expressed using multiplication by . In fact, this is a non-linear property that cannot be captured by as it allows only affine formulas.
Kantorovich distance.
The Kantorovich distance333Also known as the Wasserstein distance or Earth mover’s distance. between and can be defined using the following two equivalent (dual) formulations
| (K-R duality) |
where ranges over joint probability distributions with as left-marginal (i.e., , for all ) and as right-marginal (i.e., , for all ); and over non-expanding -valued maps on , i.e., , for all .
As its definitions involve (infimum) on one hand, and (supremum) on the other hand, we cannot express the Kantorovich distance as a single formula in . However, we can still reason about it if we can find a finite set of sequents that uniquely characterises its value. The set we propose, hereafter denoted by , contains the following sequents:
where , , and are propositional atoms. This set is derived by following the steps of the proof of (strong) duality in linear programs [57], tailored to the K-R duality presented above. The sequents to the left represent the conjunction of the constraints from both the primal and dual linear programs (i.e., the marginal conditions on and the non-expanding condition on ). Those to the right imply , corresponding to the optimality condition for the feasible solutions. The atom is a convenience.
This encoding is such that all the models of assign the atom value , i.e., the Kantorovich distance between and . Indeed, next we show that from we can deduce
| and | (1) |
The above follows by deriving the following two sequents from
as they imply . Note that this corresponds to the steps of the proof of weak duality in linear programs. We show only the derivation of the first one as the other is similar. Below we provide only the schematic steps of the derivation, which would otherwise take too much space
| (left-marginal) | ||||
| (distr, prem, perm, non-expanding) | ||||
| (distr, right-marginal) |
In the above a concatenation of the form means that both and are derivable; the desired result follows by repeated applications of (cut).
Now that we have established a way to encode the Kantorovich distance, we can prove some of its properties. A well-known result from [27] relating the Kantorovich distance with the total variation is , where . According to our encoding, such a statement is equivalent to establishing the provability of from .
Due to a lack of space, below, we provide only the sketch of the proof. The key steps of it are to show that the sequents below follow from for all
from which, by using (quant), (), one gets . Thus, by applying the inference rules of , (1), and the fact that for all , we get
The desired inference follows from the above by repeated applications of (cut).
Quantitative Equational Logic (QEL).
We showed in in [9] how one can embed the finitary part of QEL in (i.e., the axioms and rules of QEL other than its infinitary rule). To do so, we add, as propositional letters in our logic, all the equalities of the form for all terms of a chosen quantitative algebra. A quantitative equation such as is then encoded in Lawvere logic as the sequent , or equivalently as .
Next, a quantitative judgement such as the triangle inequality, which in QA has the form
can be encoded in Lawvere logic as follows, if we want to emphasize and ,
or if and are generic, we can use an even more compact encoding that emphasize the relation between triangle inequality and transitivity
The logic of [9] lacks a deduction theorem, and the embedding of QEL in therefore relied on extending with certain inference rules. However, in this problem disappears, as the inferences in [9, Table 2] can be formalized as proper sequents using the deduction theorem (Theorem 8), exactly as we have done above for the triangle inequality.
Additionally, while can handle only affine functions, can encode more complex examples, including polynomials and rational functions and even rational powers.
For instance, interpolative barycentric algebras (IBAs) were introduced in [43] as a quantitative generalization of Stone’s barycentric algebras [59]. Barycentric algebras, sometimes called convex algebras, have binary operators for , where the intended interpretation of on reals or distributions is the -convex combination of and . To characterize the -Wasserstein metric on the space of distributions for a strictly positive integer , IBAs must satisfy the following axiom:
This can be encoded in using a couple of judgements. Let be a fresh propositional letter; then can be represented in by:
The compact quantitative algebraic theories of [47] have the property (in the case of QEL) that if a sequent is provable, then it is provable without the infinitary rule. So our finitary encodings of theories in are complete for compact theories in that any QEL consequence of such a theory is also, via the encoding, an consequence. As shown in [47], the theories of rational Wasserstein metrics are compact, as is the theory of quantitative semilattices [9].
6 Completeness and Incompleteness
We first prove that is complete for finite theories.
Theorem 9 (Finite Completeness).
Let be a finite set of sequents in . If a sequent is a semantic consequence of , then is provable from . That is, implies .
The proof plan is to reduce the statement above to a restricted form of completeness, which applies only to sequents in a certain polynomial form and allows us to appeal to Krivine-Stengle’s Positivstellensatz to obtain the desired result.
Definition 10.
A formula in is in polynomial form if it is built up from propositional letters and constants using addition and multiplication (equivalently, if it has no occurrences of , , or ).
Formulas in polynomial form evidently correspond to polynomials with positive coefficients over the propositional letters of , and we have iff is provable. Further, every polynomial with positive coefficients is obtained in this way, and we may identify polynomials with positive coefficients with corresponding formulas in polynomial form (chosen in some standard manner). Note that , which by definition is , is not in polynomial form. We extend the definition of polynomial form to sequents and sets of sequents in the obvious way: is in polynomial form if all and are; a set of sequents is in polynomial form if all its elements are. We say that a sequent is finitising if it is of the form , and that a set of finitising sequents restricts a set of sequents if it contains for every propositional letter occurring in .
Theorem 11 (Polynomial Completeness).
Let be a sequent and a finite set of sequents, all in polynomial form, and let be a set of finitising sequents restricting . Then, implies .
Note that represents a restricted form of semantical consequence where the models are assumed to be -valued.
Before delving into the proof of Theorem 11 – which constitutes the core of the completeness result – we describe our non-deterministic linear reduction to it. The reduction is specified by rules, being finite sets
of moves between configurations of the form , where is a finite set of sequents and is a sequent. To be sound, a rule must satisfy the following two properties:
- Reliability:
-
implies (i.e., if is a semantical consequence of , then each is semantical consequence of ).
- Faithfulness:
-
implies (i.e., if is provable from the , then is provable from ).
We present the reduction by means of rule schemas and divide it into five phases, performed in the following order: (1) reduction to PCF, (2) elimination of , (3) elimination of , (4) choice of domain; and (5) reduction to polynomial form. For ease of presentation, without loss of generality, we assume that all sequents are either of the form (with exactly one antecedent) or (finitising).
Phase 1 (Reduction to PCF).
The first reduction comprises the following nine one-move rule schemas. The intent is to reduce the judgments in both the premises and the conclusions of configurations to a simplified canonical form, propositional canonical form (PCF), where logical connectives are applied only to propositional letters.
| (C) | ||||
| (-L) | ||||
| (-R) | ||||
| (-L) | ||||
| (-R) | ||||
| (-L) | ||||
| (-R) | ||||
| (-L) | ||||
| (-R) |
where are fresh propositional letters not occurring in the source configurations of the moves (chosen in a standard way) and at least one among or is not a propositional letter.
The correctness of the rules follows from the monotonicity properties of the connectives: and are monotone in both arguments; is antimonotone in its first argument and monotone in its second; and is monotone in its first argument and antimonotone its second.
Observe that, since the rules bring subformulas to the top level, their repeated application ensures that every sequent is eventually brought into PCF. The next phases will keep sequents in this form, except for finitising ones.
Phase 2 (Elimination of ).
The following two rule schemas (the first with three moves) are designed to eliminate all occurrences of :
| (-EL1) | ||||
| (-EL2) | ||||
| (-EL3) | ||||
| (-ER) |
where are propositional letters and , chosen in a standard way, is fresh in the move source configurations. The rule (-EL) removes occurrences of on the left-hand side of sequents; its correctness relies on the axioms (lin) and (wem). Dually, the rule (-R) removes occurrences of on the right-hand side of sequents; its correctness follows from (quant). The fresh propositional letter is used to maintain the sequents in PCF. As for the previous phase, repeated applications of these rules ensure the elimination of from all sequents except the finitising ones.
Phase 3 (Elimination of ).
The two rule schemas below (the second one comprising four moves) remove all occurrences of :
| (-EL) | ||||
| (-ER1) | ||||
| (-ER2) | ||||
| (-ER3) | ||||
| (-ER4) |
where are propositional letters and are fresh in the source configurations (chosen in a standard way). The rule (-EL) removes occurrences of on the left-hand side of sequents; its correctness follows from (adj). Dually, the rule (-ER) removes from the right-hand side of sequents; its soundness follows from (lin). The propositional letter is used to encode that is non-zero using the combinations of the sequents and ; the propositional letter to maintain the sequent in PCF.
Phase 4 (Choice of domain).
This is a rule schema comprising two moves:
| (F) | ||||
| () |
where is a propositional letter occurring in such that neither nor are in .
The moves (F) and () correspond, respectively, to non-deterministically choosing whether is finite or infinite. This phase is completed when all propositional letters in have been “tagged” in one of the two ways above. Note that the applicability conditions ensure that the rules are never applied vacuously or repeated twice on the same propositional letter.
Phase 5 (Reduction to Polynomial Form).
Recall that a formula is in polynomial form if it has no occurrences of , , or . The last two requirements have been taken care of by the previous phases. This phase, which we split into two stages, concerns the first requirement.
Stage 1. It removes the occurrences of infinitary propositional letters () by means of the following seven rule schemas (the last two comprising two moves each)
| (-E) | ||||
| (-CL) | ||||
| (-CR) | ||||
| (-PL) | ||||
| (-PR) | ||||
| (-SL) | ||||
| (-SR) | ||||
| (-ML1) | ||||
| (-ML2) | ||||
| (-MR1) | ||||
| (-MR2) |
where are propositional letters and is fresh. The rules (-PL), (-PR), (-SL), (-SR), (-ML), and (-MR) remove an occurrence of the infinitary propositional letter when it appears atomically or in logical connectives — we assume they apply up to commutativity of and . The rules (-CL) and (-CR) remove the occurrence of from the conclusion. Once these rules can no longer apply, the rule (-E) removes .
As the rule schemas apply for arbitrary infinitary propositional letters , their repeated application will eventually eliminate all the occurrences of such propositional letters.
Stage 2. After the previous phases, the only sequents that are not in polynomial form apart from the finitising ones are either trivially valid () or finitarily unsatisfiable (). The following two one-move rule schemas eliminate the last occurrences of :
| (Valid) | ||||
| (Unsat) |
where, and are obtained from by replacing sequents of the form with (which is still valid), and sequents of the form , where , with (which is still unsatisfiable), respectively. Note that and are in polynomial form.
Proposition 12.
-
1.
The rules of the reduction are reliable and faithful.
-
2.
The non-deterministic tree of moves is finite and the leaves are configurations of the form where and are in polynomial form, and is a finitising set of sequents restricting .
-
3.
If the formulas of the initial configuration contain only rational constants, then so do all the configurations of the tree, and the height of the tree is linear in the size of , as is the maximum size of the configurations in the tree.
In the above, the size of a formula is intended as the total number of logical connectives and propositional atoms it contains, plus the number of bits required for the binary representation of the constants444For a rational , we assume the common encoding format , where bin denotes binary encoding and is a separator symbol not in the binary alphabet .. The size of a set of judgments is the sum of the sizes of its formulas, and similarly for configurations.
Now we are ready to prove polynomial completeness:
Proof of Theorem 11.
Let be a sequent and be a finite set of sequents, all in polynomial form, and let be a set of finitising sequents restricting . Assume that (thus, any -valued model of is also a model for ).
Identifying polynomial formulas with their corresponding polynomials , the -valued models of are the solutions of the following system of polynomial inequalities
where are the propositional letters occurring in . We recall one form of Krivine-Stengle’s Positivstellensatz [35, 58] (see also [13, Corollary 4.4.3]).
Theorem 13 (Positivstellensatz).
Let -variate polynomials over the reals and denote by their semialgebraic set and by the cone generated by them (i.e., the subsemiring generated by and squares of polynomials). Then,
By the Positivstellensatz, there are polynomials (obtained using sums and multiplications from , , and squares of arbitrary polynomials) and integer such that
The first step is to find formulas , such that:
| (2) |
To this end, for any polynomial , write and for its positive and negative parts, such that and both and have positive coefficients. For any set of judgements , formula , and polynomial , define
where . The next lemma allows us to turn equalities between not-necessarily positive polynomials into provable equalities between formulas in polynomial form.
Lemma 14.
Let be polynomials and be formulas in . Then
-
1.
If and , then is provable from and .
-
2.
If and , then and .
-
3.
If has only positive coefficients, then .
-
4.
.
-
5.
If have only positive coefficients and is provable from and , then .
Now, using Lemma 14.(2–5) we get formulas and such that (for ). By Lemma 14.(2–4), we further obtain . By combining the above with Lemma 14.(2) we finally get and . Then, Lemma 14.(1) gives us , obtaining (2), as required.
We next show that . There are two cases. (Case ) From the conclusion of (2) we obtain and so . Then , as required. (Case ) From the conclusion of (2) we get . If , this is , which is a contradiction. Otherwise, we get with , and so . From this, we derive (recall that, ) and thus , as required.
With that we can prove our main completeness theorem, Theorem 9. The root node of the reduction tree is where . By Proposition 12, the leaf nodes have the form where and are in polynomial form, and is a finitising set of sequents restricting . As the rules are reliable we have for all leaf nodes. Then, by polynomial completeness, we have for them, and, finally, as the rules are faithful, we have , as required.
Turning to incompleteness, define consequential compactness to be that if is valid for a set of sequents , then is valid for some finite (using the evident extension of validity to allow an infinite set of hypotheses). This fails as the counterexample with and shows. As only a propositional letter and rational numbers are used here, we have:
Theorem 15 (Incompleteness).
There can be no finitary complete consistent proof system for any sublogic of containing a propositional letter and the rational numbers.
The more usual compactness notion is that if every finite subset of a set of sequents has a model, then so does . The two are equivalent: if compactness fails with then consequential compactness fails with ; and if consequential compactness fails with then compactness fails with .
7 Complexity Results
In this section, we give complexity bounds for two fundamental decision problems:
Definition 16 (Decision problems).
-
The satisfiability problem asks, given a finite set of sequents , whether has a model, i.e., whether , for some .
-
The semantical consequence problem asks, given a finite set of sequents and a sequent , whether every model of is also a model of , i.e., whether .
We restrict our attention to the case where formulas only have rational constants. The sizes of formulas, sequents, and sets of sequents are defined as discussed after Proposition 12.
Theorem 17.
Semantical consequence is in PSPACE for and co-NP complete for .
Using faithfulness, reliability, and polynomial completeness, we see that the root node of the reduction tree is valid, in the sense that , iff all the leaf nodes are. Membership of -consequence in PSPACE follows by considering a nondeterministic exploration of the tree making use at the leafs of the fact that satisfiability in the existential theory of the reals [14, 54] is in PSPACE. For , membership in co-NP is proved similarly, but now via reduction to the infeasibility of linear programs [34]; co-NP hardness follows by a linear-time reduction from boolean propositional logic.
Observe that has a model if and only if is not a semantical consequence of , in symbols, . We therefore obtain:
Corollary 18.
Satisfiability is in PSPACE for and is NP-complete for .
Moreover, as is a sublanguage of , satisfiability in is at least NP-hard.
8 Conclusions
We have developed and studied Rational Lawvere logic (), a logic based on two quantales on : one additive and one multiplicative, forming a semiring. We presented a deduction system for and showed the logic is complete for finitely axiomatized theories (but necessarily incomplete for general theories). The core of the completeness proof draws on a result from real algebraic geometry, the Krivine-Stengle Positivstellensatz, providing evidence of a deep connection between arithmetic and logical reasoning. We additionally presented new complexity results for both and its affine fragment (). The satisfiability of a finite set of sequents is NP-complete in and in PSPACE for ; and semantical consequence from a finite set of sequents is co-NP-complete in and in PSPACE for .
There are several possibilities for further work. One can ask if general theories have complete infinitary proof systems. One might seek a finitary approximation theory, building on the Weierstrass approximation theorem that continuous real-valued functions on compact subsets can be approximated arbitrarily well by polynomials, Natural extensions of beckon: predicate logics, modal logics, and -calculi.
References
- [1] Jirí Adámek. Varieties of quantitative algebras and their monads. In Christel Baier and Dana Fisman, editors, LICS ’22: 37th Annual ACM/IEEE Symposium on Logic in Computer Science, Haifa, Israel, August 2 - 5, 2022, pages 9:1–9:10. ACM, 2022. doi:10.1145/3531130.3532405.
- [2] Jirí Adámek, Matej Dostál, and Jirí Velebil. Strongly finitary monads for varieties of quantitative algebras. In Paolo Baldan and Valeria de Paiva, editors, 10th Conference on Algebra and Coalgebra in Computer Science, CALCO 2023, June 19-21, 2023, Indiana University Bloomington, IN, USA, volume 270 of LIPIcs, pages 10:1–10:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPIcs.CALCO.2023.10.
- [3] André Arnold and Maurice Nivat. Metric interpretations of infinite trees and semantics of non deterministic recursive programs. Theor. Comput. Sci., 11:181–205, 1980. doi:10.1016/0304-3975(80)90045-6.
- [4] Arthur Azevedo de Amorim, Marco Gaboardi, Justin Hsu, Shin-ya Katsumata, and Ikram Cherigui. A semantic account of metric preservation. ACM SIGPLAN Notices, 52(1):545–556, 2017.
- [5] Giorgio Bacci, Giovanni Bacci, Kim G. Larsen, and Radu Mardare. Converging from branching to linear metrics on Markov chains. Math. Struct. Comput. Sci., 29(1):3–37, 2019. doi:10.1017/S0960129517000160.
- [6] Giorgio Bacci, Giovanni Bacci, Kim G. Larsen, Radu Mardare, Qiyi Tang, and Franck van Breugel. Computing probabilistic bisimilarity distances for probabilistic automata. In Wan J. Fokkink and Rob van Glabbeek, editors, 30th International Conference on Concurrency Theory, CONCUR 2019, August 27-30, 2019, Amsterdam, the Netherlands, volume 140 of LIPIcs, pages 9:1–9:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPIcs.CONCUR.2019.9.
- [7] Giorgio Bacci, Radu Mardare, Prakash Panangaden, and Gordon D. Plotkin. An algebraic theory of Markov processes. In Anuj Dawar and Erich Grädel, editors, Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2018, Oxford, UK, July 09-12, 2018, pages 679–688. ACM, 2018. doi:10.1145/3209108.3209177.
- [8] Giorgio Bacci, Radu Mardare, Prakash Panangaden, and Gordon D. Plotkin. Tensor of quantitative equational theories. In 9th Conference on Algebra and Coalgebra in Computer Science, 2021.
- [9] Giorgio Bacci, Radu Mardare, Prakash Panangaden, and Gordon D. Plotkin. Propositional logics for the lawvere quantale. In Proceedings of the39th Conference on Mathematical Foundations of Programming Semantics MFPS XXXIX (MFPS 2023). ENTICS, 2023.
- [10] Paolo Baldan, Filippo Bonchi, Henning Kerstan, and Barbara König. Behavioral metrics via functor lifting. In Venkatesh Raman and S. P. Suresh, editors, 34th International Conference on Foundation of Software Technology and Theoretical Computer Science, FSTTCS 2014, December 15-17, 2014, New Delhi, India, volume 29 of LIPIcs, pages 403–415. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2014. doi:10.4230/LIPIcs.FSTTCS.2014.403.
- [11] Paul Beame, Russell Impagliazzo, Jan Krajíček, Toniann Pitassi, and Pavel Pudlák. Lower bounds on hilbert’s nullstellensatz and propositional proofs. Proceedings of the London Mathematical Society, 3(1):1–26, 1996.
- [12] Radim Belohlavek. Fuzzy relational systems: foundations and principles, volume 20. Springer Science & Business Media, 2012.
- [13] Jacek Bochnak, Michel Coste, and Marie-Françoise Roy. Real Algebraic Geometry, volume 36 of A Series of Modern Surveys in Mathematics. Springer Science & Business Media, 1998.
- [14] John F. Canny. Some algebraic and geometric computations in PSPACE. In Janos Simon, editor, Proceedings of the 20th Annual ACM Symposium on Theory of Computing, (STOC), pages 460–467. ACM, 1988. doi:10.1145/62212.62257.
- [15] Raphaëlle Crubillé and Ugo Dal Lago. Metric reasoning about -terms: The affine case. In 30th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2015, Kyoto, Japan, July 6-10, 2015, pages 633–644. IEEE Computer Society, 2015. doi:10.1109/LICS.2015.64.
- [16] Raphaëlle Crubillé and Ugo Dal Lago. Metric reasoning about -terms: The general case. In Hongseok Yang, editor, Programming Languages and Systems - 26th European Symposium on Programming, ESOP 2017, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2017, Uppsala, Sweden, April 22-29, 2017, Proceedings, volume 10201 of Lecture Notes in Computer Science, pages 341–367. Springer, 2017.
- [17] Francesco Dagnino and Fabio Pasquali. Logical foundations of quantitative equality. In Christel Baier and Dana Fisman, editors, LICS ’22: 37th Annual ACM/IEEE Symposium on Logic in Computer Science, Haifa, Israel, August 2 - 5, 2022, pages 16:1–16:13. ACM, 2022. doi:10.1145/3531130.3533337.
- [18] Ugo Dal Lago and Francesco Gavazzo. A relational theory of effects and coeffects. Proceedings of the ACM on Programming Languages, 6(POPL):1–28, 2022. doi:10.1145/3498692.
- [19] Arthur Azevedo de Amorim, Marco Gaboardi, Justin Hsu, Shin-ya Katsumata, and Ikram Cherigui. A semantic account of metric preservation. In Giuseppe Castagna and Andrew D. Gordon, editors, Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, Paris, France, January 18-20, 2017, pages 545–556. ACM, 2017. doi:10.1145/3009837.3009890.
- [20] J. Desharnais, V. Gupta, R. Jagadeesan, and P. Panangaden. Metrics for labeled Markov systems. In Proceedings of CONCUR99, number 1664 in Lecture Notes in Computer Science. Springer-Verlag, 1999.
- [21] Josée Desharnais, Vineet Gupta, Radhakrishnan Jagadeesan, and Prakash Panangaden. A metric for labelled Markov processes. Theoretical Computer Science, 318(3):323–354, June 2004.
- [22] Francesc Esteva, Lluís Godo, Petr Hájek, and Mirko Navara. Residuated fuzzy logics with an involutive negation. Archive for mathematical logic, 39(2):103–124, 2000. doi:10.1007/S001530050006.
- [23] Julius Farkas. Theorie der einfachen ungleichungen. Journal für die reine und angewandte Mathematik (Crelles Journal), 1902(124):1–27, 1902.
- [24] Norm Ferns, Prakash Panangaden, and Doina Precup. Metrics for finite Markov decision precesses. In Proceedings of the 20th Conference on Uncertainty in Artificial Intelligence, pages 162–169, July 2004. URL: https://dslpitt.org/uai/displayArticleDetails.jsp?mmnu=1&smnu=2&article_id=1103&proceeding_id=20.
- [25] Norm Ferns, Prakash Panangaden, and Doina Precup. Metrics for Markov decision processes with infinite state spaces. In Proceedings of the 21st Conference on Uncertainty in Artificial Intelligence, pages 201–208, July 2005. URL: https://dslpitt.org/uai/displayArticleDetails.jsp?mmnu=1&smnu=2&article_id=1175&proceeding_id=21.
- [26] Francesco Gavazzo and Cecilia Di Florio. Elements of quantitative rewriting. Proc. ACM Program. Lang., 7(POPL):1832–1863, 2023. doi:10.1145/3571256.
- [27] Alison L. Gibbs and Francis Edward Su. On choosing and bounding probability metrics. International Statistical Review, 70(3):419–435, 2002.
- [28] Marco Grandis. Categories, norms and weights. Journal of Homotopy and Related Structures, 2(2):171–186, 2007.
- [29] Dima Grigoriev and Nicolai N. Vorobjov Jr. Complexity of null-and positivstellensatz proofs. Ann. Pure Appl. Log., 113(1-3):153–160, 2001. doi:10.1016/S0168-0072(01)00055-0.
- [30] Petr Hájek. What is mathematical fuzzy logic. Fuzzy sets and systems, 157(5):597–603, 2006. doi:10.1016/J.FSS.2005.10.004.
- [31] Petr Hájek. Metamathematics of fuzzy logic. Springer Science & Business Media, 2013.
- [32] Petr Hájek, Lluís Godo, and Francesc Esteva. A complete many-valued logic with product-conjunction. Archive for mathematical logic, 35:191–208, 1996. doi:10.1007/BF01268618.
- [33] Shin-ya Katsumata. A double category theoretic analysis of graded linear exponential comonads. In Foundations of Software Science and Computation Structures: 21st International Conference, FOSSACS 2018, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2018, Thessaloniki, Greece, April 14–20, 2018. Proceedings 21, pages 110–127. Springer, 2018. doi:10.1007/978-3-319-89366-2_6.
- [34] L.G. Khachiyan. Polynomial algorithms in linear programming. USSR Computational Mathematics and Mathematical Physics, 20(1):53–72, 1980. doi:10.1016/0041-5553(80)90061-0.
- [35] Jean-Louis Krivine. Anneaux préordonnés. Journal d’analyse mathématique, 12:p–307, 1964.
- [36] Ugo Dal Lago and Francesco Gavazzo. Differential logical relations, part II increments and derivatives. Theor. Comput. Sci., 895:34–47, 2021. doi:10.1016/J.TCS.2021.09.027.
- [37] Ugo Dal Lago and Francesco Gavazzo. Modal reasoning = metric reasoning, via lawvere. CoRR, abs/2103.03871, 2021. arXiv:2103.03871.
- [38] Ugo Dal Lago and Francesco Gavazzo. A relational theory of effects and coeffects. Proc. ACM Program. Lang., 6(POPL):1–28, 2022. doi:10.1145/3498692.
- [39] Ugo Dal Lago, Francesco Gavazzo, and Akira Yoshimizu. Differential logical relations, part I: the simply-typed case. In Christel Baier, Ioannis Chatzigiannakis, Paola Flocchini, and Stefano Leonardi, editors, 46th International Colloquium on Automata, Languages, and Programming, ICALP 2019, July 9-12, 2019, Patras, Greece, volume 132 of LIPIcs, pages 111:1–111:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPIcs.ICALP.2019.111.
- [40] Francis William Lawvere. Metric spaces, generalized logic, and closed categories. Rendiconti del seminario matématico e fisico di Milano, 43(1):135–166, 1973.
- [41] Francis William Lawvere. Metric spaces, generalized logic, and closed categories. Reprints in Theory and Applications of Categories, 1:1–37, 2002. Originally published in Rendiconti del Seminario Matematico e Fisico di Milano, XLIII (1973), 135–166. URL: http://www.tac.mta.ca/tac/reprints/articles/1/tr1.pdf.
- [42] Jean-Simon Pacaud Lemay and Jean-Baptiste Vienney. Graded differential categories and graded differential linear logic. In Marie Kerjean and Paul Blain Levy, editors, Proceedings of the 39th Conference on the Mathematical Foundations of Programming Semantics, MFPS XXXIX, Indiana University, Bloomington, IN, USA, June 21-23, 2023, volume 3 of EPTICS. EpiSciences, 2023. doi:10.46298/ENTICS.12290.
- [43] Radu Mardare, Prakash Panangaden, and Gordon Plotkin. Quantitative algebraic reasoning. In Proceedings of the 31st Annual ACM-IEEE Symposium on Logic in Computer Science, pages 700–709, 2016. doi:10.1145/2933575.2934518.
- [44] Radu Mardare, Prakash Panangaden, and Gordon Plotkin. On the axiomatizability of quantitative algebras. In Proceedings of the 32nd Annual ACM-IEEE Symposium on Logic in Computer Science, 2017.
- [45] Radu Mardare, Prakash Panangaden, and Gordon Plotkin. Fixed-points for quantitative equational logics. In Proceedings of the ACM-IEEE Symposium on Logic in Computer Science, 2021.
- [46] Jiří Matoušek and Bernd Gärtner. Understanding and using linear programming, volume 1. Springer, 2007.
- [47] Matteo Mio. Compact quantitative theories of convex algebras. In Stefan Milius and Clemens Kupke, editors, MFPS’25: 41st Conference on Mathematical Foundations of Programming Semantics, Glasgow, Scotland, June 16–20, 2025, page ?? EPTS, 2025. to appear.
- [48] Matteo Mio, Ralph Sarkis, and Valeria Vignudelli. Combining nondeterminism, probability, and termination: Equational and metric reasoning. In 36th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2021, Rome, Italy, June 29 - July 2, 2021, pages 1–14. IEEE, 2021. doi:10.1109/LICS52264.2021.9470717.
- [49] Matteo Mio, Ralph Sarkis, and Valeria Vignudelli. Beyond nonexpansive operations in quantitative algebraic reasoning. In Christel Baier and Dana Fisman, editors, LICS’22: 37th Annual ACM/IEEE Symposium on Logic in Computer Science, Haifa, Israel, August 2–5, 2022, pages 52:1–52:13. ACM, 2022. doi:10.1145/3531130.3533366.
- [50] Théodore Samuel Motzkin. Two consequences of the transposition theorem on linear inequalities. Econometrica (pre-1986), 19(2):184, 1951.
- [51] Jan Pavelka. On fuzzy logic i, ii, iii. Zeit. Math. Logik u. Grundl. Math., 25:447–464, 1979.
- [52] Toniann Pitassi and Iddo Tzameret. Algebraic proof complexity: Progress, frontiers and challenges. ACM SIGLOG News, 3(3):21–43, 2016. doi:10.1145/2984450.2984455.
- [53] Jason Reed and Benjamin C. Pierce. Distance makes the types grow stronger: a calculus for differential privacy. In Paul Hudak and Stephanie Weirich, editors, Proceeding of the 15th ACM SIGPLAN international conference on Functional programming, ICFP 2010, Baltimore, Maryland, USA, September 27-29, 2010, pages 157–168. ACM, 2010. doi:10.1145/1863543.1863568.
- [54] James Renegar. On the computational complexity and geometry of the first-order theory of the reals. Part I: Introduction. Preliminaries. The geometry of semi-algebraic sets. The decision problem for the existential theory of the reals. Journal of Symbolic Computation, 13(3):255–299, 1992. doi:10.1016/S0747-7171(10)80003-3.
- [55] Kimmo I. Rosenthal. Quantales and their applications. Longman Scientific and Technical, 1990.
- [56] Petr Savickỳ, Roberto Cignoli, Francesc Esteva, Lluís Godo, and Carles Noguera. On product logic with truth-constants. Journal of Logic and Computation, 16(2):205–225, 2006. doi:10.1093/LOGCOM/EXI075.
- [57] Alexander Schrijver. Theory of linear and integer programming. John Wiley & Sons, 1998.
- [58] G Stengle. A nullstellensatz and a positivstellensatz in semialgebraic geometry. Mathematische Annalen, 207(2):87–97, 1974.
- [59] Marshall H. Stone. Postulates for the barycentric calculus. Annali di Matematica Pura ed Applicata, 29(1):25–30, December 1949.
