Elementary equivalence versus isomorphism in semiring semantics
EElementary equivalence versus isomorphism insemiring semantics
Erich Grädel ! RWTH Aachen University, Germany
Lovro Mrkonjić ! RWTH Aachen University, Germany
Abstract
We study the first-order axiomatisability of finite semiring interpretations or, equivalently, thequestion whether elementary equivalence and isomorphism coincide for valuations of atomic factsover a finite universe into a commutative semiring. Contrary to the classical case of Boolean semantics,where every finite structure can obviously be axiomatised up to isomorphism by a first-order sentence,the situation in semiring semantics is rather different, and strongly depends on the underlyingsemiring. We prove that for a number of important semirings, including min-max semirings, andthe semirings of positive Boolean expressions, there exist finite semiring interpretations that areelementarily equivalent but not isomorphic. The same is true for the polynomial semirings S [ X ], B [ X ] and W [ X ] that are universal for the classes of absorptive, idempotent, and fully idempotentsemirings, respectively. On the other side, we prove that for other, practically relevant, semiringssuch as the Viterby semiring V , the tropical semiring T , the natural semiring N and the universalpolynomial semiring N [ X ], all finite semiring interpretations are first-order axiomatisable (and thuselementary equivalence implies isomorphism), although some of the axiomatisations that we exhibituse an infinite set of axioms. Theory of Computation → Finite Model Theory
Keywords and phrases semiring semantics, elementary equivalence, axiomatisability
Semiring semantics is based on the idea to evaluate logical statements not just by true or false , but by values in some commutative semiring ( K, + , · , , B = ( {⊥ , ⊤} , ∨ , ∧ , ⊥ , ⊤ )is used. Valuations in other semirings provide additional information, beyond the truth orfalsity of a statement: the Viterbi-semiring V = ([0 , R , max , · , ,
1) models confidence scores ,the tropical semiring T = ( R ∞ + , min , + , ∞ ,
0) is used for cost analysis , and min-max-semirings( K, max , min , a, b ) for a totally ordered set ( K, < ) can model, for instance, different accesslevels . More generally, semirings of polynomials, such as N [ X ], W [ X ] or B [ X ], allow us totrack the role of specific atomic facts for the evaluation of a logical statement, to describeevaluation strategies for a formula, and to determine which combinations of literals provethe truth of a formula.Some of the motivation for the study of semiring semantics comes from the successfuldevelopment of semiring provenance in database theory and related fields (see e.g. [5, 6, 8,13, 14, 17, 18, 19]), and the fact that the typical applications of provenance analysis, such asconfidence scores, cost analysis, proof counting, and the understanding of evaluation strategiesare of importance in many other areas of logic as well. However, semiring provenance analysisfor database queries had originally been largely confined to positive query languages, such asconjunctive queries, positive relational algebra, and Datalog, and the treatment of negationposes non-trivial algebraic problems. Only recently, semiring semantics has been extendedto logics with negation, and in particular to full first-order logic [11, 12], by means of newalgebraic constructions based on quotient semirings. Semiring semantics has also been studied a r X i v : . [ m a t h . L O ] F e b Elementary equivalence versus isomorphism in semiring semantics for other logics, including modal logics, description logics, guarded logics, and fixed-point logic[1, 2, 3, 4], and this paper is part of a larger project devoted to a systematic study of semiringsemantics for various logics. An important objective in this context is the understanding ofthe model theory of semiring semantics , and the development of model-theoretic methods forsemiring interpretations.It turns out that this is much more involved and diverse than for Boolean semantics. Inthe standard semantics, a model A assigns to each (instantiated) atomic formula a Booleanvalue, whereas K -interpretations π , for a suitable semiring K , generalise this by assigningto each literal a semiring value in K , where 0 is interpreted as false and all other semiringvalues as nuances of true . Interpreting disjunction by + and conjunction by · , we can extend π to provide semiring valuations π (cid:74) φ (cid:75) ∈ K for all first-order sentences φ , written in negationnormal form. Semiring semantics thus gives a finer distinction of logical statements, andformulae that are equivalent in the Boolean sense (i.e. in the Boolean semiring) may havedifferent valuations in other semirings. As a consequence, standard facts of classical (finite)model theory may lead to interesting and sometimes rather difficult questions in semiringsemantics, and the answer may strongly depend on algebraic properties of the underlyingsemiring. Specific such questions that we study here concern the first-order axiomatisability offinite K -interpretations or, what amounts to the same, the relationship between isomorphismand elementary equivalence in this context.It is a rather trivial fact of finite model theory that every finite structure A (with afinite vocabulary τ ) can be axiomatised, up to isomorphism, by a first-order sentence χ A . Inparticular, two finite τ -structures A and B are isomorphic if, and only if, they are elementarilyequivalent, in short A ≡ B , which means that they cannot be distinguished by any first-ordersentence. Is this also the case for semiring interpretations? Notice that standard notions suchas isomorphism and elementary equivalence generalise in a natural way from τ -structures tosemiring interpretations, which raises, for any given semiring K , the following ▶ Questions. 1.
Are elementary equivalent finite K -interpretations always isomorphic? Is every finite K -interpretation π A first-order axiomatisable, in the sense that there isa set of axioms Φ A ⊆ FO such that whenever π B (cid:74) φ (cid:75) = π A (cid:74) φ (cid:75) for all φ ∈ Φ A , then π B ∼ = π A ? Does every finite K -interpretation admit an axiomatisation by a finite set of axioms? Can every finite K -interpretation be axiomatised by a single first-order sentence?Clearly, the first two questions are equivalent, and a positive answer to the third questionimplies also positive ones to the first two. The converse is not necessarily true, because a first-order axiomatisation of a finite semiring interpretation might require an infinite collection ofsentences, and, contrary to the Boolean case, it is a priori also not clear that an axiomatisationby a finite set of sentences implies an axiomatisation by a single sentence, because from thevalue of a conjunction we cannot necessary infer the values of its components.We shall prove that the answers to these questions strongly depend on the chosensemiring. There are in fact rather simple semirings, such as min-max semirings with at leastthree elements, for which one can construct examples of non-isomorphic K -interpretationswhich are, however, elementarily equivalent. The standard method for proving elementaryequivalence in model theory, the Ehrenfeucht–Fraïssé method, seems not really available insemiring semantics, an aspect that we shall discuss at the end of this paper. To establishelementary equivalence, we shall hence develop new methods based on classes of semiringhomomorphisms and reduction arguments. Elementarily equivalent but non-isomorphicsemiring interpretations also exist for powerful polynomial semirings, such as S [ X ], B [ X ] and . Grädel and L. Mrkonjić 3 W [ X ] which are universal for the classes of absorptive, idempotent, and fully idempotentsemirings, respectively. On the other side, there are practically relevant semirings, such asthe Viterby semring V , the tropical semiring T , the natural semiring N and the universalpolynomial semiring N [ X ], for which any finite K -interpretation is first-order axiomatisable,thus elementary equivalence does indeed imply isomorphism. At least for V and T , finiteaxiomatisations are always possible, but not axiomatisations by a single sentence, so thereexist semirings where the answers to questions (3) and (4) are different. We briefly summarise semiring semantics for first-order logic, as introduced in [11]. ▶ Definition 1 (Semiring) . A commutative semiring K = ( K, + , · , ,
1) is an algebraicstructure with two binary operations such that ( K, + ,
0) and ( K, · ,
1) are commutativemonoids, multiplication distributes over addition and multiplication with zero annihilateselements. We refer to commutative semirings as semirings and identify K with its universe K if the operations are clear from the context.Let τ denote a finite relational vocabulary. We write Lit n ( τ ) for the set of atoms Rz andnegated atoms ¬ Rz with R ∈ τ and where z is any tuple of variables taken from { x , . . . , x n } .For a universe A , we write Lit A ( τ ) for the set of instantiated τ -literals Ra and ¬ Ra with a ∈ A arity( R ) . ▶ Definition 2 ( K -interpretation) . For a semiring K , a mapping π : Lit A ( τ ) → K is called a K - interpretation over the universe A with signature τ . We call π model-defining if exactlyone of the values π ( L ) and π ( L ) is zero for all pairs of opposing literals L, L ∈ Lit A ( τ ). Inthat case, π induces the classical model A π with A π | = L if, and only if, π ( L ) ̸ = 0. ▶ Definition 3 (Isomorphism) . K -interpretations π A : Lit A ( τ ) → K and π B : Lit B ( τ ) → K are isomorphic , denoted as π A ∼ = π B , if there is a bijective mapping σ : A → B such that π A ( L ) = π B ( σ ( L )) for all L ∈ Lit A ( τ ) , where σ ( L ) ∈ Lit B ( τ ) is defined by replacing each a ∈ A occurring in L with σ ( a ) ∈ B . Themapping σ is called an isomorphism , denoted as σ : π A ∼ −→ π B .Given a K -interpretation π : Lit A ( τ ) → K , a formula φ ( x ) ∈ FO( τ ) in negation normalform and an assignment a ⊆ A , the semiring semantics π (cid:74) φ ( a ) (cid:75) is straightforwardly definedby induction on FO( τ ). We first extend π by mapping equalities and inequalities to theirtruth values by π (cid:74) a = b (cid:75) := ( a = b a ̸ = b and π (cid:74) a ̸ = b (cid:75) := ( a = b a ̸ = b , and by interpreting disjunctions and existential quantifiers as sums, and conjunctions anduniversal quantifiers as products: π (cid:74) ψ ( a ) ∨ ϑ ( a ) (cid:75) := π (cid:74) ψ ( a ) (cid:75) + π (cid:74) ϑ ( a ) (cid:75) π (cid:74) ψ ( a ) ∧ ϑ ( a ) (cid:75) := π (cid:74) ψ ( a ) (cid:75) · π (cid:74) ϑ ( a ) (cid:75) π (cid:74) ∃ xϑ ( a, x ) (cid:75) := X a ∈ A π (cid:74) ϑ ( a, a ) (cid:75) π (cid:74) ∀ xϑ ( a, x ) (cid:75) := Y a ∈ A π (cid:74) ϑ ( a, a ) (cid:75) . Our goal is to analyse model-theoretic concepts from classical model theory under semiringsemantics.
Elementary equivalence versus isomorphism in semiring semantics ▶ Definition 4 (Elementary Equivalence) . Let π A : Lit A ( τ ) → K and π B : Lit B ( τ ) → K betwo K -interpretations, a ∈ A k and b ∈ B k be k -tuples and k ∈ N . The pairs π A , a and π B , b are elementarily equivalent , denoted as π A , a ≡ π B , b , if π A (cid:74) φ ( a ) (cid:75) = π B (cid:74) φ ( b ) (cid:75) for all φ ( x ) ∈ FO( τ ) with k free variables.They are m - equivalent with m ∈ N , denoted as π A , a ≡ m π B , b , if the above holds for allsuitable φ ( x ) with quantifier rank at most m .Clearly, the notions of isomorphism and elementary equivalence of K -interpretationsare natural generalisations of the corresponding definitions for τ -structures. Further, it isobvious that, as in classical semantics, isomorphism implies elementary equivalence. ▶ Lemma 5 (Isomorphism Lemma) . Let π A : Lit A ( τ ) → K and π B : Lit B ( τ ) → K be two K -interpretations, a ∈ A k and b ∈ B k be k -tuples and σ : π A ∼ −→ π B an isomorphism with σ ( a ) = b . Then, π A (cid:74) φ ( a ) (cid:75) = π B (cid:74) φ ( b ) (cid:75) holds for all φ ( x ) ∈ FO( τ ) with k free variables. Coarser definitions may be conceivable in semirings K with more than two elements, suchas replacing equality by a congruence relation ∼ ⊆ K × K . However, Definition 4 indirectlycovers these variants, since any non-trivial congruence relation ∼ on K induces a semiringhomomorphism h ∼ : K → K/ ∼ , which is compatible with FO-semantics as follows [11]. ▶ Lemma 6 (Fundamental Property) . Let π : Lit A ( τ ) → K be a K -interpretation and h : K → L a semiring homomorphism. Then, ( h ◦ π ) is an L -interpretation and ( h ◦ π ) (cid:74) φ ( a ) (cid:75) = h ( π (cid:74) φ ( a ) (cid:75) ) holds for all φ ( x ) ∈ FO( τ ) and a ⊆ A . Thus, the following diagram commutes. FO( τ ) K Lφ ( a ) π (cid:74) φ ( a ) (cid:75) ( h ◦ π ) (cid:74) φ ( a ) (cid:75) π (cid:74) • (cid:75) h ( h ◦ π ) (cid:74) • (cid:75) Semiring homomorphisms and the fundamental property open the possibility to reducesemiring semantics to the evaluation of polynomials. For a finite set X of abstract provenancetokens that are used to track atomic facts, consider the semiring N [ X ] of multivariate poly-nomials with indeterminates from X and coefficients from N , whose generality is formalisedby the following universal property [13]. ▶ Lemma 7 (Universal Property) . For each commutative semiring K , every assignment e : X → K induces a unique homomorphism h e : N [ X ] → K with h e ( x ) = e ( x ) for x ∈ X . . Grädel and L. Mrkonjić 5 To demonstrate the use of this property, consider the V -interpretation π V over A = { a, b } depicted below on the left and a corresponding N [ X ]-interpretation π on the right, whichmaps all the true literals to their own variable in X := { w, x, y, z } . π V : A P Q ¬ P ¬ Qa . . b . . π : A P Q ¬ P ¬ Qa x y b z w Given, for example, ψ := ∀ x ( P x ∨ Qx ), we get π V (cid:74) ψ (cid:75) = max { . , . } · max { , . } = 0 . p := π (cid:74) ψ (cid:75) = ( x + y ) · (0 + z ) = xz + yz , thenplugging in the values e : x . , y . , z . w . h e : N [ X ] → V , and evaluating p gives the same value h e ( p ) = max { . · . , . · . } = 0 . π (cid:74) ψ (cid:75) is re-usable,but the universality of N [ X ] also makes it relevant for model theory.Other polynomial semirings can be used to capture smaller classes of semirings, in thesense of the universal property. ▶ Definition 8 (Idempotence and Absorption) . A semiring K is called idempotent if a + a = a holds for all a ∈ K , that is, if addition is idempotent. It is multiplicatively idempotent if a · a = a for all a ∈ K . If both properties hold, we call K fully idempotent . Finally, a semiring K is absorptive if a + ab = a holds for all a, b ∈ K .Note that absorptive semirings are idempotent and if we replace addition with ∨ andmultiplication with ∧ , absorption corresponds to the absorptive law in lattices. In particular,absorptive and fully idempotent semirings are precisely the semirings induced by distributivelattices [16].By dropping coefficients from N [ X ], we get the semiring B [ X ] whose elements are justfinite sets of distinct monomials. It has the universal property for the class of idempotentsemirings.By dropping also exponents, we get the semiring W [ X ] of finite sums of monomials thatare linear in each argument, with the universal property for fully idempotent semirings.It is sometimes called the Why-semiring.For absorptive semirings, we require absorptive polynomials as introduced in [5]. Anabsorptive polynomial is a sum of distinct monomials over a finite set of variables X ,with absorption among monomials: a monomial m absorbs m , denoted m ⪰ m , ifit has smaller exponents, i.e. if m ( x ) ≤ m ( x ) for all x ∈ X , where m ( x ) denotesthe exponent of x in m . Notice that absorption is the inverse pointwise order on theexponents. For example, xy ⪰ x y and x ⪰ xy , but x y and xy are incomparable. Inan absorptive polynomial, we omit all monomials that would be absorbed, so absorptivepolynomials are ⪰ - antichains of monomials (which are always finite [12]). Consequently,addition and multiplication are defined as usual, but afterwards we drop all monomialsthat are absorbed. We write S [ X ] for the semiring of absorptive polynomials over thefinite variable set X with the aforementioned operations. The 0-element is the emptypolynomial and 1 denotes the polynomial consisting just of the monomial 1 (with all zeroexponents). It is not difficult to verify that this defines an absorptive semiring which hasthe universal property for the class of all absorptive semirings. Elementary equivalence versus isomorphism in semiring semantics
By dropping exponents from S [ X ], we obtain yet another polynomial semiring PosBool [ X ],which is universal for the fully idempotent and absorptive semirings. Incidentally, polyno-mials from PosBool [ X ], such as x + yz , represent all positive Boolean expressions over thevariables X up to equivalence, if we replace addition by disjunction and multiplication byconjunction, hence the name PosBool [ X ]. This is the distributive lattice freely generatedby the set X .The following figure, adapted from [16], shows the relationships between the aforemen-tioned classes of semirings, together with their respective universal polynomial semirings. all commutative semirings: N [ X ] idempotent semirings: B [ X ] distributivelattices: PosBool [ X ] fully idempotentsemirings: W [ X ] absorptivesemirings: S [ X ] We shall now, for certain semirings K , provide examples of finite, non-isomorphic K -interpretations that are, however, elementarily equivalent. We thus provide negative answersto Question (1) from the introduction, and hence also to Questions (2) to (4). For instance,we claim that the following two K -interpretations over the min-max-semiring with fourelements, K = { , , , } , are elementarily equivalent, but not isomorphic. π P Q : A P Q ¬ P ¬ Qa b c π QP : A P Q ¬ P ¬ Qa b c Observe that π QP is obtained from π P Q by permuting the relations P and Q , or visually,by permuting the “columns”. Moreover, for both interpretations, the Q -column can beobtained by permuting the P -column. Informally, these properties ensure that the twointerpretations are “sufficiently similar” so that no first-order sentence can distinguish them.Clearly, π P Q is not isomorphic to π QP , as intended. However, the only tool we presentedso far for proving elementary equivalence under semiring semantics is the Isomorphism Lemmaitself, which is not directly applicable for obvious reasons. Hence, we shall develop anothertool for proving elementary equivalence that enables the indirect use of the IsomorphismLemma after switching to a different semiring via homomorphisms. The central idea of the reduction technique is to “decompose” the semiring K via homo-morphisms. Observe that if π A ̸≡ π B , then there is a witnessing sentence ψ ∈ FO( τ ) with . Grädel and L. Mrkonjić 7 π A (cid:74) ψ (cid:75) ̸ = π B (cid:74) ψ (cid:75) , hence a pair of distinct elements a, b ∈ K with π A (cid:74) ψ (cid:75) =: a ̸ = b := π B (cid:74) ψ (cid:75) exists. If we can find two homomorphisms h A , h B : K → L with h A ( a ) ̸ = h B ( b ), but weare sure that the corresponding L -interpretations ( h A ◦ π A ) and ( h B ◦ π B ) are elementarilyequivalent, then we can exclude ( a, b ) as a witness for π A ̸≡ π B . If we are able to provideenough pairs of homomorphisms so that each distinct pair ( a, b ) can be excluded, then π A ≡ π B must hold. The following definition formalises the required properties. ▶ Definition 9 (Separating Homomorphism Pairs) . A set S ⊆ Hom ( K, L ) of homomorphismpairs h A , h B : K → L is called separating if for all a, b ∈ K with a ̸ = b , there is a pair( h A , h B ) ∈ S such that h A ( a ) ̸ = h B ( b ). S is called diagonal if h A = h B for all pairs( h A , h B ) ∈ S . In that case, we may write S as a subset of Hom( K, L ).Note that a single injective homomorphism h : K → L induces the diagonal separatingset S := { ( h, h ) } with just one element. Moreover, some semirings, such as PosBool [ X ], canbe completely decomposed into L := B using a diagonal separating set of semiring homomor-phisms as follows. Any subset Y ⊆ X induces a unique homomorphism h Y : PosBool [ X ] → B by h Y ( x ) = ⊤ for x ∈ Y and h Y ( x ) = ⊥ for x ∈ X \ Y . Clearly, for any p ∈ PosBool [ X ], wehave that h Y ( p ) = ⊤ if, and only if, p contains a monomial with only variables from Y . ▶ Lemma 10.
The set S := { h Y | Y ⊆ X } ⊆ Hom(
PosBool [ X ] , B ) is a diagonal separatingset of homomorphisms. Proof.
Consider p, q ∈ PosBool [ X ] such that p ̸ = q . Among the monomials that appear inone of the two polynomials p, q but not in the other, let m be one whose set Y of variables isminimal. By symmetry, we can assume that m appears in p but not in q . It follows that h Y ( p ) = ⊤ . We claim that h Y ( q ) = ⊥ . Otherwise q must contain a monomial m ′ with onlyvariables from Y . Since m ′ has less variables than m , m ′ must also be contained in p . But m ′ absorbs m , so m does not occur in p , a contradiction. ◀ On the other side, N [ X ], among other semirings, cannot be decomposed into B by adiagonal separating set. For example, h ( x + xy ) = h ( x ) ∨ ( h ( x ) ∧ h ( y )) = h ( x ) for allhomomorphisms h : N [ X ] → B , but x + xy ̸ = x . The reason why a decomposition into B would be useful for model theory is given by the following reduction technique. ▶ Proposition 11 (Reduction Technique) . Let π A : Lit A ( τ ) → K and π B : Lit B ( τ ) → K betwo K -interpretations, a ∈ A k and b ∈ B k be k -tuples and S ⊆ Hom ( K, L ) a separating setof homomorphism pairs. Then, for any formula φ ( x , . . . , x k ) ∈ FO( τ ) , we have that whenever ( h A ◦ π A ) (cid:74) φ ( a ) (cid:75) = ( h B ◦ π B ) (cid:74) φ ( b ) (cid:75) for all ( h A , h B ) ∈ S , then also π A (cid:74) φ ( a ) (cid:75) = π B (cid:74) φ ( b ) (cid:75) . Proof.
Suppose that π A (cid:74) φ ( a ) (cid:75) ̸ = π B (cid:74) φ ( b ) (cid:75) . Then, by definition of S , there exists a pair( h A , h B ) ∈ S such that h A ( π A (cid:74) φ ( a ) (cid:75) ) ̸ = h B ( π B (cid:74) φ ( b ) (cid:75) ). Applying the fundamental propertyyields ( h A ◦ π A ) (cid:74) φ ( a ) (cid:75) ̸ = ( h B ◦ π B ) (cid:74) φ ( b ) (cid:75) . ◀▶ Corollary 12.
With S as above, ( h A ◦ π A ) , a ≡ ( h B ◦ π B ) , b for all ( h A , h B ) ∈ S implies that π A , a ≡ π B , b . Moreover, for each m ∈ N , ( h A ◦ π A ) , a ≡ m ( h B ◦ π B ) , b for all ( h A , h B ) ∈ S implies π A , a ≡ m π B , b . If we choose the target semiring L := B , then the corollary shows that proving equivalencein K may be reduced to proving equivalence in B , which allows us to re-use results fromstandard semantics. Elementary equivalence versus isomorphism in semiring semantics
PosBool [ X ] and W [ X ] Consider the following two
PosBool [ X ]-interpretations π xy , π yx with X := { x, y } over theuniverse A := { a, b, c, d } with four elements and a signature τ := { P, Q } with two unaryrelation symbols. π xy : A P Q ¬ P ¬ Qa y x b x yc y x d y x π yx : A P Q ¬ P ¬ Qa y xb x y c x y d x y Thanks to Lemma 10, the four homomorphisms S = { h ∅ , h { x } , h { y } , h { x,y } } induce aseparating set on PosBool [ X ] and with Corollary 12, it suffices to show that ( h ◦ π xy ) ≡ ( h ◦ π yx )in B for all h ∈ S in order to prove π xy ≡ π yx on PosBool [ X ]. Indeed, the following tablesdemonstrate that ( h ◦ π xy ) ∼ = ( h ◦ π yx ) holds for all h ∈ S . h ∅ ◦ π xy : A P Q ¬ P ¬ Qa ⊥ ⊥ ⊥ ⊥ b ⊥ ⊥ ⊥ ⊥ c ⊥ ⊥ ⊥ ⊥ d ⊥ ⊥ ⊥ ⊥ h ∅ ◦ π yx : A P Q ¬ P ¬ Qa ⊥ ⊥ ⊥ ⊥ b ⊥ ⊥ ⊥ ⊥ c ⊥ ⊥ ⊥ ⊥ d ⊥ ⊥ ⊥ ⊥ h { x } ◦ π xy : A P Q ¬ P ¬ Qa ⊥ ⊥ ⊤ ⊥ b ⊤ ⊥ ⊥ ⊥ c ⊥ ⊤ ⊥ ⊥ d ⊥ ⊥ ⊥ ⊤ h { x } ◦ π yx : A P Q ¬ P ¬ Qa ⊥ ⊥ ⊥ ⊤ b ⊥ ⊤ ⊥ ⊥ c ⊤ ⊥ ⊥ ⊥ d ⊥ ⊥ ⊤ ⊥ h { y } ◦ π xy : A P Q ¬ P ¬ Qa ⊥ ⊤ ⊥ ⊥ b ⊥ ⊥ ⊥ ⊤ c ⊤ ⊥ ⊥ ⊥ d ⊥ ⊥ ⊤ ⊥ h { y } ◦ π yx : A P Q ¬ P ¬ Qa ⊤ ⊥ ⊥ ⊥ b ⊥ ⊥ ⊤ ⊥ c ⊥ ⊤ ⊥ ⊥ d ⊥ ⊥ ⊥ ⊤ h X ◦ π xy : A P Q ¬ P ¬ Qa ⊥ ⊤ ⊤ ⊥ b ⊤ ⊥ ⊥ ⊤ c ⊤ ⊤ ⊥ ⊥ d ⊥ ⊥ ⊤ ⊤ h X ◦ π yx : A P Q ¬ P ¬ Qa ⊤ ⊥ ⊥ ⊤ b ⊥ ⊤ ⊤ ⊥ c ⊤ ⊤ ⊥ ⊥ d ⊥ ⊥ ⊤ ⊤ Thus, we conclude that π xy ≡ π yx and due to π xy ̸∼ = π yx , this shows that for finite PosBool [ X ]-interpretations, elementary equivalence does not necessarily imply isomorphism.Moreover, similar examples can be constructed for any distributive lattice semiring K thanksto the universal property of PosBool [ X ], by assigning r, s ∈ K to the variables x, y : . Grädel and L. Mrkonjić 9 π rs : A P Q ¬ P ¬ Qa s r b r sc s r d s r π sr : A P Q ¬ P ¬ Qa s rb r s c r s d r s Clearly, π rs ≡ π sr holds as above, and the only requirement for π rs ̸∼ = π sr is that r and s must be distinct. This yields the following theorem. ▶ Theorem 13.
For any distributive lattice semiring K with at least three elements, there isa pair of finite K -interpretations π rs , π sr over a universe with four elements and a signaturewith two unary relation symbols such that π rs ≡ π sr , but π rs ̸∼ = π sr . Note that the two K -interpretations π P Q and π QP from the opening example of thissection can be shown to be elementarily equivalent using a similar technique as above.In fact, the above theorem even shows that the opening example was not minimal and acounterexample with only three semiring elements in K = { , , } exists.We shall strengthen the result from Theorem 13 to the class of all fully idempotentsemirings by simply regarding π xy and π yx as W [ X ]-interpretations instead of PosBool [ X ]-interpretations. However, the proof that π xy ≡ π yx becomes more involved, since a diagonalseparating set for W [ X ] into B does not exist. Nevertheless, a suitable separating set canbe obtained by exploiting homomorphisms into W [ X ] itself. Consider any permutation σ : X → X of the variables. Surely, it induces an automorphism h σ of W [ X ]. In the previousexample, if σ swaps the variables x and y , then applying h σ to π xy yields an interpretationthat is isomorphic to π yx , as illustrated below.( h σ ◦ π xy ) : A P Q ¬ P ¬ Qa x y b y xc x y d x y π yx : A P Q ¬ P ¬ Qa y xb x y c x y d x y With this insight, we can construct a suitable separating set S ⊆ Hom ( W [ X ] , W [ X ]),starting with the pair ( h σ , h id ) ∈ S . This pair alone does not separate W [ X ], since wehave x ̸ = y in W [ X ], but h σ ( x ) = y = h id ( y ). Hence, we add more homomorphisms byannihilating some variables, similarly to the construction for PosBool [ X ] in Lemma 10. Fixinga permutation σ : X → X , we want to construct a homomorphism h Yσ that annihilates allvariables in X \ Y and permutes the variables in Y . Observe that for each x ∈ Y there is aminimal number r ( x ) ≥ σ r ( x ) ( x ) ∈ Y . Formally, we define σ Y : X → Y ∪ { } bysetting σ Y ( x ) := σ r ( x ) ( x ) for x ∈ Y , and σ Y ( x ) := 0 for x ∈ X \ Y . Note that σ Y induces ahomomorphism h Yσ : W [ X ] → W [ X ]. ▶ Lemma 14. S := { ( h Yσ , h Y id ) | Y ⊆ X } ⊆ Hom ( W [ X ] , W [ X ]) is a separating set ofhomomorphism pairs. Proof.
Suppose that p ̸ = q for a pair p, q ∈ W [ X ]. A monomial in W [ X ] can be identifiedwith the set of its variables. Thus, without loss of generality, there is some Y ⊆ X with Y ∈ p and Y / ∈ q . Surely, h Yσ ( p ) contains the monomial h Yσ ( Y ) = Y , but h Y id ( q ) only containsmonomials from q , hence it does not contain Y and h Yσ ( p ) ̸ = h Y id ( q ). ◀ Before applying the reduction technique to obtain π xy ≡ π yx from Corollary 12, it onlyremains to show that ( h Yσ ◦ π xy ) ≡ ( h Y id ◦ π yx ) for all Y ⊆ X := { x, y } . Since we havealready illustrated ( h Xσ ◦ π xy ) ∼ = ( h X id ◦ π yx ) above, we only need to consider the cases where Y ⊊ X . But then, at most one variable is contained in Y and the remaining variables areannihilated by h Yσ and h Y id , thus ( h Yσ ◦ π xy ) ∼ = ( h Y id ◦ π yx ) clearly follows. The reductiontechnique then implies that π xy ≡ π yx on W [ X ], which can naturally be lifted to all fullyidempotent semirings thanks to the universal property. ▶ Theorem 15.
For any fully idempotent semiring K with at least three elements, there is apair of finite K -interpretations π rs , π sr over a universe with four elements and a signaturewith two unary relation symbols such that π rs ≡ π sr , but π rs ̸∼ = π sr . In conclusion, the proof of π xy ≡ π yx on PosBool [ X ] illustrates how elementary equival-ence in semiring semantics can be reduced to elementary equivalence on B by completelydecomposing PosBool [ X ] to B with homomorphisms. Moreover, the proof of elementaryequivalence on W [ X ] shows that it may even pay off to use separating sets of homomorphismsfrom W [ X ] to W [ X ] itself. The results of the previous section raise the question whether it is possible to construct asimilar example of non-isomorphic, but elementarily equivalent interpretations also for themost general semiring N [ X ], and lift it to all commutative semirings with at least threeelements. In order to show that this is not possible, we draw inspiration from classicalsemantics, where for each finite τ -structure A with universe A = { a , . . . , a n } one canconstruct a characteristic sentence χ A such that B | = χ A if, and only if, A ∼ = B . Thecharacteristic sentence is explicitly defined as χ A := ∃ x . . . ∃ x n ( φ ( x ) ∧ ψ ( x )) with φ ( x ) := ^ ≤ i For every K -interpretation π B : Lit B ( τ ) → K into an arbitrary semiring K and every tuple b = ( b , . . . , b n ) , we have that π B (cid:74) φ ( b ) (cid:75) = 1 if B = { b , . . . , b n } and b i ̸ = b j for i ̸ = j , and π B (cid:74) φ ( b ) (cid:75) = 0 , otherwise. Proof. Semiring interpretations evaluate equalities and inequalities to 0 and 1, so π B (cid:74) φ ( b ) (cid:75) = Y i 1) is used in confidence analysis, probabilisticparsing, and Hidden Markov Models (see [7, 9]). It is isomorphic to the tropical semiring T = ( R ∞ + , min , + , ∞ , x e − x . Hence, all results that we establish for the Viterbi semiring also hold for thetropical semiring. We can illustrate the shortcomings of the characteristic sentences in theirclassical form by very simple V -interpretations with one element. π : A P Q ¬ P ¬ Qa . . π : A P Q ¬ P ¬ Qa . . They are clearly not isomorphic, but trying to construct χ from π as above would yield χ = ∃ x ( φ ( x ) ∧ ψ ( x )) with ψ ( x ) = P x ∧ Qx , hence π (cid:74) χ (cid:75) = 0 . · . . · . π (cid:74) χ (cid:75) .However, under semiring semantics, and especially on the Viterbi semiring V , multiplica-tion need not be idempotent; hence we can hope to distinguish two interpretations by simplyrepeating one of the literals. In the given example, we can set ψ ( x ) := P x ∧ ( Qx ) , whichis short for P x ∧ Qx ∧ Qx , to obtain π (cid:74) χ (cid:75) = 0 . · . ̸ = 0 . · . = π (cid:74) χ (cid:75) . We nowgeneralise this idea to arbitrary finite V -interpretations. We shall associate with every finite V -interpretation π A : Lit A ( τ ) → V and every ε ∈ R + a characteristic sentence χ π A ,ε := ∃ x . . . ∃ x n ( φ ( x ) ∧ ψ ε ( x )) , with n := | A | and φ ( x ) as before, but a more involved construction of ψ ε ( x ):Let a = ( a , . . . , a n ) be some fixed order on A and L ( a ) , . . . , L k ( a ) an arbitrary enu-meration of the “true” literals in Lit A ( τ ) with π A ( L i ( a )) ̸ = 0. Further, fix a sequence f (1) , . . . , f ( k ) of “exponents” in N , where f (1) = 1 and f ( i + 1) is chosen large enough sothat( ∗ ) (1 − ε ) f ( i +1) < ε f (1)+ ··· + f ( i ) . Then, put ψ ε ( x ) := V ki =1 L i ( x ) f ( i ) , where “exponentiation” denotes repetition of a literal.The idea is that χ π A ,ε should characterise π A up to isomorphism by repeating the literalsin ψ ε ( x ) “sufficiently often” so that the contribution of each literal can be distinguished andchanging the value for one literal surely alters the final value of ψ ε ( x ). Since the elementsof V are from [0 , R , the values of the literals can change by an arbitrarily small amount,hence the “exponents” f ( i ) must depend on the “smallest possible change” ε . This intuitionis formalised as follows. ▶ Proposition 17. Let π A : Lit A ( τ ) → V and π B : Lit B ( τ ) → V be two finite, model-defining V -interpretations, which induce the finite set of values V := { π A ( L ) | L ∈ Lit A ( τ ) } ∪ { π B ( L ) | L ∈ Lit B ( τ ) } . Then, for every ε ∈ R bounded by < ε ≤ min {| r − s | | r, s ∈ V, r ̸ = s } , we have that π A (cid:74) χ π A ,ε (cid:75) = π B (cid:74) χ π A ,ε (cid:75) implies π A ∼ = π B . Proof. Assume π A (cid:74) χ π A ,ε (cid:75) = π B (cid:74) χ π A ,ε (cid:75) . By construction, π A (cid:74) χ π A ,ε (cid:75) > 0, so π B (cid:74) χ π A ,ε (cid:75) > ∃ x . . . ∃ x n in χ π A ,ε are interpreted as max in the Viterbi semiring V , this implies that | A | = | B | , and that we have enumerations a = ( a , . . . , a n ) and b = ( b , . . . , b n ) of the elements of A and B , suchthat π A (cid:74) χ π A ,ε (cid:75) = π A (cid:74) ψ ε ( a ) (cid:75) = π B (cid:74) ψ ε ( b ) (cid:75) = π B (cid:74) χ π A ,ε (cid:75) . Recall that π A (cid:74) ψ ε ( a ) (cid:75) = Q ki =1 π A ( L i ( a )) f ( i ) > 0, hence π A ( L ( a )) , . . . , π A ( L k ( a )) are allpositive. Accordingly, π B (cid:74) ψ ε ( b ) (cid:75) = Q ki =1 π B ( L i ( b )) f ( i ) > 0, so that π B ( L ( b )) , . . . , π B ( L k ( b ))are positive as well. Given that π A and π B share the same signature and universe size, anypermutations a , b of their elements yield the same number of positive literals, which is k bydefinition. We infer that all remaining literals in both interpretations are mapped to zero.Hence, for i = 1 , . . . , k , let r i := π A ( L i ( a )) > s i := π B ( L i ( b )) > r i = s i for all i ≤ k in order to concludethat a b is indeed an isomorphism from π A to π B .Towards a contradiction, assume that this is not the case and let j be the maximal indexamong 1 , . . . , k with r j ̸ = s j . We can assume that r j < s j . Since the difference between thetwo values is at least ε and since s j ≤ r j ≤ s j − ε ≤ s j − εs j = (1 − ε ) s j .Further, we have ε ≤ s i , r i ≤ i . It follows that r f (1)1 · · · r f ( j ) j ≤ r f ( j ) j ≤ (1 − ε ) f ( j ) s f ( j ) j ∗ < ε f (1)+ ··· + f ( j − · s f ( j ) j ≤ s f (1)1 · · · s f ( j ) j . However, since r i = s i for i = j + 1 , . . . , k , this would imply that π A (cid:74) ψ ε ( a ) (cid:75) = Y i ≤ k r f ( i ) i ̸ = Y i ≤ k s f ( i ) i = π B (cid:74) ψ ε ( b ) (cid:75) and hence π A (cid:74) χ π A ,ε (cid:75) ̸ = π B (cid:74) χ π A ,ε (cid:75) . ◀ Notice that none of the sentences χ π A ,ε characterises π A alone, but the countable set X π A := { χ π A ,ε | ε ∈ Q + } does so. No infinite V -interpretation π B agrees with π A on any ofthe ε -characteristic sentences χ π A ,ε due to φ ( x ), whereas for each finite V -interpretation π B ,one can calculate an ε ∈ Q to apply the proposition just proved. ▶ Theorem 18. For finite V -interpretations π A and π B , π A ≡ π B implies π A ∼ = π B . As a consequence, there are indeed interesting semirings beyond the Boolean semiring B ,where elementary equivalence implies isomorphism on finite interpretations. The characteristic set X π A raises the question whether a finite set of sentences sufficesto characterise a V -interpretation π A . We will answer this question positively using twoobservations. By Proposition 17, we observe that χ π A ,ε characterises π A up to isomorphisminside the class of V -interpretations that only use values in V = { π A ( L ) | L ∈ Lit A ( τ ) } , with ε := min {| r − s | | r, s ∈ V, r ̸ = s } . Hence, π A can be characterised by adding sentences toensure that no values outside of V are used.We will show that this is possible by building sentences that fix particular values π A ( L ). ▶ Definition 19. Let π : Lit A ( τ ) → V be a finite V -interpretation over a universe A with n elements and φ ( x ) ∈ FO( τ ) a formula with k ∈ N free variables. The sequence ( s iπ,φ ) ≤ i ≤ n k is defined as the non-increasingly sorted sequence of the values π (cid:74) φ ( a ) (cid:75) for a ∈ A k .In particular, s π,φ is the largest possible value π (cid:74) φ ( a ) (cid:75) ; further, s π,φ ≤ s π,φ is either thesecond largest one, or equal to s π,φ if the maximal value is shared by two distinct tuples a, b ∈ A k , and so on. We construct a series of sentences that fix the values ( s iπ,φ ) ≤ i ≤ n k . . Grädel and L. Mrkonjić 13 ▶ Lemma 20 (Sorting Lemma) . For φ ( x ) ∈ FO( τ ) with k free variables and ≤ i ≤ n k , let ψ iφ := ∃ x . . . ∃ x i (cid:16) ^ ≤ j<ℓ ≤ i x j ̸ = x ℓ ∧ i ^ j =1 φ ( x j ) (cid:17) where x , . . . x i are k -tuples of variables. Then, for any V -interpretation π : Lit A ( τ ) → V over a universe with n elements, we have that π (cid:74) ψ iφ (cid:75) = Y ≤ j ≤ i s jπ,φ for ≤ i ≤ n. Proof. Recall that existential quantifiers are interpreted as max on V . Due to monotonicityof multiplication, the maximum π (cid:74) ψ iπ,φ (cid:75) is achieved by picking the i pairwise distinct tuples a , . . . , a i that yield the largest values π (cid:74) φ ( a j ) (cid:75) = s jπ,φ and inserting them for x , . . . , x i .Clearly, this yields π (cid:74) ψ iφ (cid:75) = Q ≤ j ≤ i s jπ,φ . ◀ By observing that V is cancellative, i.e. ab = ac implies b = c for all a, b, c ∈ V with a ̸ = 0, we may disentangle the products Q ≤ j ≤ i s jπ,φ to draw the following conclusion. ▶ Corollary 21. Let φ ( x ) be as above, and consider two V -interpretations π : Lit A ( τ ) → V and π ′ : Lit B ( τ ) → V with | A | = | B | = n . If π and π ′ agree on Ψ := { ψ iφ | ≤ i ≤ n k } , then s iπ,φ = s iπ ′ ,φ for all ≤ i ≤ n k . In other words, the values π (cid:74) φ ( a ) (cid:75) for a ∈ A k and π ′ (cid:74) φ ( b ) (cid:75) for b ∈ B k are the same, up to permutation. If R ∈ τ is a k -ary relation, pick φ ( x ) := Rx and construct Ψ R := { ψ iRx | ≤ i ≤ n k } according to the Sorting Lemma. Similarly, construct Ψ ¬ R from φ ( x ) := ¬ Rx . Then, defineΨ τ := [ R ∈ τ Ψ R ∪ [ R ∈ τ Ψ ¬ R . Clearly, any two V -interpretations over τ that agree on Ψ τ use the same set of values from V .Putting this together with the characteristic sentences χ π A ,ε from Proposition 17 provides afinite axiomatisation of any V -interpretation. ▶ Theorem 22. Let π : Lit A ( τ ) → V be a finite V -interpretation. Then, Ψ τ ∪{ χ π,ε } is a finiteaxiomatisation of π up to isomorphism, where ε := min {| r − s | | r, s ∈ π (Lit A ( τ )) , r ̸ = s } . Proof. Let π ′ : Lit B ( τ ) → V agree with π on all sentences in Ψ τ ∪ { χ π,ε } . Due to theconstruction of χ π,ε , π ′ is finite and | A | = | B | . Since π ′ agrees with π on Ψ τ , we have { π ( L ) | L ∈ Lit A ( τ ) } = { π ′ ( L ) | L ∈ Lit B ( τ ) } . Thus, we can invoke Proposition 17 byobserving that V = π (Lit A ( τ )) and conclude that π (cid:74) χ π,ε (cid:75) = π ′ (cid:74) χ π,ε (cid:75) implies π ∼ = π ′ . ◀ Under classical semantics, any finite axiom system Φ ⊆ FO( τ ) can be collapsed to a singleaxiom ψ := V Φ, but this is not the case in semiring semantics. To illustrate this, we shallshow that there are V -interpretations that cannot be axiomatised up to isomorphism by asingle sentence. ▶ Proposition 23. There exist V -interpretations π : Lit A ( τ ) → V such that, for everysentence ψ ∈ FO( τ ) , there exists an interpretation π ′ : Lit A ( τ ) → V such that π ̸∼ = π ′ , but π (cid:74) ψ (cid:75) = π ′ (cid:74) ψ (cid:75) . Proof. Take an interpretation with just two atoms P a and Qa and with values π ( P a ) = p and π ( Qa ) = q such that 0 < p, q < k, ℓ ∈ Z to the equation p k q ℓ = 1, except k = ℓ = 0. Let π B be the corresponding B [ x, y ]-interpretation, with π B ( P a ) = x and π B ( Qa ) = y . A sentence ψ ∈ FO is evaluated under π B to a polynomial π B (cid:74) ψ (cid:75) ∈ B [ x, y ], and by the universal propertyfor idempotent semirings, the homomorphism h : B [ x, y ] → V induced by h ( x ) = p and h ( y ) = q maps π B (cid:74) ψ (cid:75) to π (cid:74) ψ (cid:75) . Writing π B (cid:74) ψ (cid:75) as a sum of monomials m = x i y j , we concludethat π (cid:74) ψ (cid:75) = p i q j is the maximal value m ( p, q ) for the monomials m occuring in π B (cid:74) ψ (cid:75) .Since p, q are multiplicatively independent, no other monomial can take the same value, i.e. m ′ ( p, q ) < m ( p, q ) for all other monomials m ′ in π B (cid:74) ψ (cid:75) . We now can certainly find a value r ̸ = p that is sufficiently close to p , and a value s such that r i s j = p i q j , i.e. m ( r, s ) = m ( p, q ),but m ′ ( r, s ) < m ( r, s ) for all other monomials m ′ in π B (cid:74) ψ (cid:75) . For the V -interpretation π ′ with π ′ ( P a ) = r and π ′ ( Qa ) = s this implies that π ′ (cid:74) ψ (cid:75) = r i s j = p i q j = π (cid:74) ψ (cid:75) , but clearly, π ′ ̸∼ = π . ◀ This result can be strengthened in many directions. It holds, in fact, for almost all V -interpretations, as long as they do not map all literals to either 0 or 1. Further, we shallexploit the isomorphism of V and T in order to prove explicit lower bounds on the numberof axioms that are needed to characterise an interpretation, depending on the number ofliterals mapped to multiplicatively independent values. T - and V -interpretations Recall that V = ([0 , R , max , · , , 1) is isomorphic to T = ( R ∞ + , min , + , ∞ , 0) via isomorphisms σ V → T ( a ) = − log b ( a ) for any fixed base b ∈ R > , and the corresponding inverse isomorphisms σ T → V ( a ) = b − a for any fixed b ∈ R > . We formulate our result in terms of T . ▶ Theorem 24. Let π : Lit A ( τ ) → T be any finite, model-defining T -interpretation with | A | = n and | Lit A ( τ ) | = 2 ℓ , such that its finite values π (Lit A ( τ )) \ {∞} are linearlyindependent over Q . Then, for any set of sentences Ψ ⊆ FO( τ ) with | Ψ | < ℓ , there is aninterpretation π ′ : Lit A ( τ ) → T such that π (cid:74) ψ (cid:75) = π ′ (cid:74) ψ (cid:75) for all ψ ∈ Ψ , but π ̸∼ = π ′ . Proof. Since π is model-defining, there are ℓ literals L in Lit A ( τ ) with π ( L ) ̸ = ∞ , which wecall the positive literals. Choose X := { x , . . . , x ℓ } and construct the B [ X ]-interpretation π B : Lit A ( τ ) → B [ X ] by assigning a unique variable to each of the positive literals. Clearly,there is a homomorphism h : B [ X ] → T with h ◦ π B = π induced by mapping each variableto the original value π ( L ) of the corresponding literal.Enumerate Ψ = { ψ , . . . , ψ j } arbitrarily with j < ℓ and construct the polynomials p i := π B (cid:74) ψ i (cid:75) ∈ B [ X ] for 1 ≤ i ≤ j . By the fundamental property, π (cid:74) ψ i (cid:75) = h ( p i ) holds for1 ≤ i ≤ j .We assume without loss of generality that p i ̸ = 0 for all 1 ≤ i ≤ j , and we will construct π ′ with the same positive literals as π . Thus, p i contains a monomial m i so that h ( m i ) is minimalamong { h ( m ) : m ∈ p i } . This monomial is unique thanks to the linear independence of thevalues of π , which guarantees that h ( m ) ̸ = h ( m ′ ) for m ̸ = m ′ . Suppose for a contradictionthat h ( m ) = h ( m ′ ). We may write h ( m ) = h ℓ Y i =1 x m ( x i ) i ! = ℓ X i =1 m ( x i ) · h ( x i ) , which implies that h ( m ) is a linear combination of the values of π . In particular, h ( m ) = h ( m ′ )implies that h ( m − m ′ ) = 0, hence m ( x i ) − m ′ ( x i ) = 0 for all 1 ≤ i ≤ j due to linearindependence.We conclude that there is a sufficiently small ε ∈ R > such that changing the numbers h ( x i ) by less than ε does not affect the monomial order. In other words, view the values . Grädel and L. Mrkonjić 15 v := ( h ( x ) , . . . , h ( x ℓ )) ∈ R ℓ ≥ as a vector and notice that any w ∈ R ℓ ≥ with | v − w | < ε preserves the monomial order, so that if we construct h ′ : B [ X ] → T induced by h ′ ( x i ) = w i for 1 ≤ i ≤ ℓ , we have h ( m ) < h ( m ′ ) if, and only if, h ′ ( m ) < h ′ ( m ′ ).To complete the proof, it remains to ensure that h ′ ( p i ) = h ( p i ) stays the same for all1 ≤ i ≤ j . By the above considerations, it suffices to ensure that h ′ ( m i ) = h ( m i ) forthe corresponding maximal monomials m , . . . , m j . Each of these monomials induces onecondition h ( m i ) − h ′ ( m i ) = 0, which translates to a linear equation h ( m i ) − h ′ ( m i ) = ℓ X i =1 m i ( x i )( h ( x i ) − h ′ ( x i )) = ℓ X i =1 m i ( x i ) · ( v i − w i ) = 0on ( v − w ).Since there are only j < ℓ equations and ℓ variables, the solution space is at least one-dimensional, meaning that we can pick w ̸ = v adequately with | v − w | < ε to satisfy allequations and obtain h ′ ( p i ) = h ( p i ) for all 1 ≤ i ≤ j . Note that due to linear independence,none of the entries from v was zero, hence it is possible to ensure that w only has positiveentries. We thus can pick π ′ := h ′ ◦ π B with the desired properties. ◀ This result translates to V thanks to isomorphism. Linear independence of values from T as Q -vectors translates to multiplicative independence of the corresponding values from V . N and N [ X ] We will now provide a similar analysis of axiomatisablity for the most general semiring N [ X ]by taking a detour via N . For the construction of the characteristic sentences for N , we shallneed the following combinatorial lemma. ▶ Lemma 25. For any two natural numbers k, c with c > , there exists a exponent e suchthat, for any two non-decreasing sequences r ≤ r ≤ · · · ≤ r k and s ≤ s ≤ · · · ≤ s k of k natural numbers, with r k , s k < c , the equation r e + · · · + r ek = s e + · · · + s ek implies that thetwo sequences are the same, i.e. r i = s i for all i ≤ k . Proof. Choose e large enough so that ( c/ ( c − e > k . Towards a contradiction, assumethat there are two distinct sequences r ≤ r ≤ . . . r k < c and s ≤ s ≤ . . . s k < c suchthat r e + · · · + r ek = s e + · · · + s ek . Let j be the maximal index with r j ̸ = s j . Thanksto additive cancellation, we can remove the summands with index i > j to obtain that r e + · · · + r ej = s e + · · · + s ej . By symmetry we can assume that r j < s j . Since s j < c , itfollows that s j > ( c/ ( c − r j and hence s ej > k · r ej . But this implies that r e + · · · + r ej ≤ j · r ej ≤ k · r ej < s ej ≤ s e + · · · + s ej , contradicting the equation above. ◀▶ Lemma 26. Let ( r , . . . r k ) , ( s , . . . , s k ) ∈ N k be strictly bounded by c , that is r i , s i < c forall i ≤ k . Then, there is an exponent e depending only on c and k such that k X i =1 r ei = k X i =1 s ei implies that there is a permutation σ ∈ S k such that r i = s σ ( i ) for all ≤ i ≤ k . Proof. Sort both sequences non-decreasingly, that is, permute them with ρ, τ ∈ S k so that r ρ (1) ≤ . . . ≤ r ρ ( k ) and s τ (1) ≤ . . . ≤ s τ ( k ) . By the previous Lemma, there is a suitable e suchthat r ρ ( i ) = s τ ( i ) for all i ≤ k . Then, σ := τ ◦ ρ − is the desired permutation. ◀ We are now ready to construct characteristic sentences for finite N -interpretations π A : Lit A ( τ ) → N . For n = | A | , let L ( x ) , . . . , L k ( x ) be an enumeration of all literalsin Lit n ( τ ). For any constant q ∈ N we define the q -characteristic sentence χ π A ,q as χ π A ,q := ∃ x . . . ∃ x n ( φ ( x ) ∧ ψ q ( x )) e , with ψ q ( x ) := k _ i =1 q i − · L i ( x ) , with φ ( x ) as given before and e is an exponent that depends on q, n and τ , according toLemma 26. The notation q i − · L i ( x ) denotes a disjunctive repetition of the literal L i ( x ) for q i − times.The idea of this construction is similar to the one for the Viterbi semiring. While ε -characteristic sentences work for V -interpretations where the differences of two distinctvalues are at least ε , q -characteristic sentences work for N -interpretations with values lessthan q . With this in mind, we can explain the construction of ψ q ( x ) as follows. If all valuesin π A are less than q , we can picture the value π A (cid:74) ψ q ( a ) (cid:75) = k X i =1 q i − π A ( L i ( a )) , to be in a number system with radix q , hence the values π A ( L i ( a )) can be seen as digits.Thus, it is immediately clear that for any N -interpretation π B with universe enumerated by b and values less than q , π A (cid:74) ψ q ( a ) (cid:75) = π B (cid:74) ψ q ( b ) (cid:75) implies that a ∼ −→ b is an isomorphism between π A and π B , since the corresponding “digits” π A ( L i ( a )) and π B ( L i ( b )) for each 1 ≤ i ≤ k have to be the same.The only remaining problem is the fact that existential quantifiers ∃ x . . . ∃ x n from χ π A ,q are interpreted as a sum in N . Thus, the value π A (cid:74) χ π A ,q (cid:75) is not induced by a single variableassignment a . The exponent e is used to separate the contributions of different variableassignments to the sum on the basis of Lemma 26. ▶ Theorem 27. Let π A and π B are finite N -interpretations with values less than q . Then π A (cid:74) χ π A ,q (cid:75) = π B (cid:74) χ π A ,q (cid:75) implies that π A ∼ = π B . Proof. Clearly, φ ( x ) takes care of the number of elements, hence we can assume a and b enumerate the universes of π A and π B . Now, we have π A (cid:74) χ π A ,q (cid:75) = X σ ∈ S n π A (cid:74) ψ q ( σ ( a )) (cid:75) e = X σ ∈ S n π B (cid:74) ψ q ( σ ( b )) (cid:75) e = π B (cid:74) χ π A ,q (cid:75) . Recall that ψ q ( x ) is constructed as a number with k “digits”, where the digits are the valuesof the literals π A ( L i ( a )) and π B ( L i ( b )), which are bounded by q . Hence, π A (cid:74) ψ q ( σ ( a )) (cid:75) and π B (cid:74) ψ q ( σ ( b )) (cid:75) are less than c := q k , which only depends on q , n and τ . By Lemma 26, thereis a sufficiently large e so that P σ ∈ S n π A (cid:74) ψ q ( σ ( a )) (cid:75) e = P σ ∈ S n π B (cid:74) ψ q ( σ ( b )) (cid:75) e implies thatboth sums share the same summands. In particular, there are permutations σ A , σ B ∈ S n such that π A (cid:74) ψ c ( σ A ( a )) (cid:75) = π B (cid:74) ψ c ( σ B ( b )) (cid:75) .Thanks to the construction of ψ c ( x ), this yields π A ( L i ( σ A ( a )) = π B ( L i ( σ B ( b )) for allliterals L i of Lit n ( τ ). Thus, σ B ◦ ( a b ) ◦ σ − A is an isomorphism from π A to π B . ◀ . Grädel and L. Mrkonjić 17 We can further use the q -characteristic sentences also for N [ X ]-interpretations instead of N -interpretations. Let X k = { x , . . . , x k } , and let N [ X k ]( C, n ) denote the set of polynomials p ∈ N [ X k ] with coefficients less than C and exponents less than n . If we choose a suitablevariable assignment X k → N , we can obtain a homomorphism that assigns unique values toall polynomials in N [ X k ]( C, n ). ▶ Lemma 28. The variable assignment x i C n i − for ≤ i ≤ k defines a homomorphism h : N [ X k ] → N which induces a bijection from N [ X k ]( C, n ) to { , . . . , c − } ⊆ N where c := C n k . Proof. We proceed by induction on the number of variables k ∈ N . The base case k = 0 istrivial, since N [ ∅ ] ∼ = N and the empty assignment induces the corresponding isomorphism.For k > 0, notice that N [ X k ] ∼ = N [ X k − ][ x k ]. Hence, each p ∈ N [ X k ]( C, n ) may be written as p = n − X i =0 q i x ik , where q i ∈ N [ X k − ]( C, n ) . Thus, applying the induced homomorphism h yields h ( p ) = n − X i =0 h ( q i ) h ( x k ) i = n − X i =0 h ′ ( q i )( C n k − ) i , where h ′ : N [ X k − ] → N is induced by x i C n i − for 1 ≤ i < k . By induction hypothesis therestriction h ′ | N [ X k − ]( C,n ) is a bijection from N [ X k − ]( C, n ) to { , . . . , C n k − − } . Clearly, h ( p ) may be seen as a number with n digits h ′ ( q i ) ∈ { , . . . , C n k − − } for 0 ≤ i < n in thenumber system with radix C n k − . Thus, any number in { , . . . , C n k − } can be uniquelyrepresented as h ( p ) for p ∈ N [ X k ]( C, n ), which completes the proof. ◀▶ Corollary 29. For finite N [ X ] -interpretations π A and π B whose values are contained in N [ X ]( C, n ) , π A (cid:74) χ π A ,c (cid:75) = π B (cid:74) χ π A ,c (cid:75) implies π A ∼ = π B with c := C n | X | . Proof. Transform π A and π B to N -interpretations π ′ A := h ◦ π A and π ′ B := h ◦ π B by applyingthe homomorphism from above. The fundamental property yields π ′ A (cid:74) χ π A ,c (cid:75) = π ′ B (cid:74) χ π A ,c (cid:75) .Since h | N [ X ]( C,n ) is a bijection from N [ X ]( C, n ) to { , . . . , c } , the values of π ′ A and π ′ B areless than c , hence we can invoke Theorem 27 to conclude π ′ A ∼ = π ′ B . Now, the injectivity of h on N [ X ]( C, n ) yields π A ∼ = π B . ◀ Similarly to the implications of Proposition 17 on the Viterbi semiring V , we conclude thatfinite N [ X ]-interpretations π A are characterised by a the set X π A := { χ π A ,c | c ∈ N , c > } ofcharacteristic sentences. The obvious consequence is that no counterexamples exist on N [ X ]. ▶ Theorem 30. For finite N [ X ] -interpretations π A and π B , π A ≡ π B implies π A ∼ = π B . Note that the results from this section provide an insight into the properties of semiringsthat facilitate the construction of characteristic sentences. We shall use these observations toseparate elementary equivalence from isomorphism in semirings that break those properties. One of the crucial properties for the characteristic sentences to work is cancellation. Weobserve that N [ X ] and N allow additive and multiplicative cancellation and V allows multi-plicative cancellation, that is, ab = ac implies b = c for all a ̸ = 0. Looking at ψ ε ( x ), we notice that cancellation is important to ensure that the contributions of all literals are preserved in aconjunction. Our analysis will show that there are non-isomorphic but elementary equivalentinterpretations for a large class of semirings that break cancellation. ▶ Definition 31. Let K be an idempotent semiring. A witness that K breaks cancellation isa triple a, b, c ∈ K \ { } such that (1) a + b = a + c = a and (2) ab = ac, but b ̸ = c. For any such triple, we define the following two non-isomorphic K -interpretations. π b : A R ¬ Rd a e b π c : A R ¬ Rd a e c ▶ Lemma 32. The K -interpretations π b and π c are elementarily equivalent. Proof. Consider the B [ X ] interpretation π : A R ¬ Rd x e y Let h b , h c : B [ X ] → K be the unique homomorphisms induced by x a, y b and x a, y c respectively. Obviously, π b = h b ◦ π and π c = h c ◦ π , hence, for each sentence ψ ∈ FO( { R } ), the fundamental property yields π b (cid:74) ψ (cid:75) = h b ( π (cid:74) ψ (cid:75) ) and π c (cid:74) ψ (cid:75) = h c ( π (cid:74) ψ (cid:75) ). Infact, if we set p := π (cid:74) ψ (cid:75) , we have π b (cid:74) ψ (cid:75) = h b ( p ) and π c (cid:74) ψ (cid:75) = h c ( p ), hence both interpretationsevaluate the same polynomial p under their own homomorphism.It remains to show that h b ( p ) = h c ( p ). The automorphism h of B [ X ] induced by swappingthe variables x and y yields the B [ X ]-interpretation h ◦ π = π : A R ¬ Rd y e x Clearly, π ∼ = π by swapping d and e , hence p = π (cid:74) ψ (cid:75) = π (cid:74) ψ (cid:75) = h ( π (cid:74) ψ (cid:75) ) = h ( p ). In otherwords, p is invariant under swapping variables, so for each pair i, j we have that x i y j ∈ p if,and only if, x j y i ∈ p . In particular, x i ∈ p ⇔ y i ∈ p ( ∗ ).Since p is finite and all exponents are less than some d ∈ N , we may write p as p = X i,j For each m ∈ M , h b ( m ) = a i b j = a i c j = h c ( m ) due to condition (2) and i > 0. Moreprecisely, if i > 0, we can invoke (2) inductively to transform ab j into ac j due to commutativityof multiplication. We now invoke condition (1) for each i ∈ I . For z ∈ { b, c } and usingidempotence of K (i), this yields a i + z i (1) = ( a + z ) i + z i = i X j =0 a i − j z j + z i = i − X j =0 a i − j z j + z i + z i ( i ) = i − X j =0 a i − j z j + z i = a i . Hence, h b ( x i + y i ) = a i + b i = a i = a i + c i = h c ( x i + y i ) for each i ∈ I holds as well. Together,we have h b ( p ) = X i ∈ I h b ( x i + y i ) + X m ∈ M h b ( m ) = X i ∈ I h c ( x i + y i ) + X m ∈ M h c ( m ) = h c ( p ) , which completes the proof, since ψ was arbitrary and π b (cid:74) ψ (cid:75) = h b ( p ) = h c ( p ) = π c (cid:74) ψ (cid:75) . ◀ Lemma 32 can be applied to many important semirings, such as B [ X ] itself and S [ X ]with an appropriate choice of a , b and c . ▶ Theorem 33. For X ⊇ { x, y } , there exists a pair of elementarily equivalent, but non-isomorphic K -interpretations in the shape of π b and π c for both K = B [ X ] and K = S [ X ] . Proof. For B [ X ], choose a := x + y + x + xy + y , b := x + y and c := x + xy + y toobtain the following pair of B [ X ]-interpretations. π b : A R ¬ Rd x + y + x + xy + y e x + y π c : A R ¬ Rd x + y + x + xy + y e x + xy + y To prove the desired properties, we only have to check conditions (1) and (2) fromDefinition 31 and then invoke Lemma 32. Condition (1) is obvious, and for (2), it suffices toexpand the products ab and ac to calculate that ab = ac = x + xy + x y + y + x + x y + x y + xy + y . An analogous construction works for the semiring of absorptive polynomials S [ X ]. Choose a := x + y , b := x + y and c := x + xy + y . Note that this is the same as the counterexampleon B [ X ] above after applying absorption, which yields the pair of S [ X ]-interpretations depictedbelow. π b : A R ¬ Rd x + y e x + y π c : A R ¬ Rd x + y e x + xy + y It is easy to verify that a , b and c also satisfy (1) and (2), which completes the proof. ◀ Our analysis of first-order axiomatisations and elementary equivalence of finite semiringinterpretations has revealed some remarkable differences between semiring semantics andclassical Boolean semantics. Depending on the underlying semiring, there may exist finitesemiring interpretations that are elementarily equivalent without being isomorphic. Indeed,this phenomenon happens already in very simple cases such as for min-max semirings withthree elements. On the other side, there are relevant semirings, used for instance in provenanceanalysis in databases such as the tropical semiring or the Viterbi semiring, where every finiteinterpretation is first-order axiomatisable, and in fact even by a finite set of axioms. However,and this is again an interesting difference to Boolean semantics, a finite axiomatisation doesnot imply an axiomatisation by a single axiom.Also for the semirings of polynomials, fundamental for a general provenance analysisthat reveals which combinations of atomic facts are responsible for the truth of a logicalstatement, the picture is not unique. While the most general semiring N [ X ], freely generatedby X , admits axiomatisations of all finite interpretations, so that elementary equivalenceimplies isomorphism, this is not the case for the semirings PosBool [ X ], S [ X ], B [ X ] and W [ X ]which are universal for important subclasses of semirings.In the study of elementary equivalence for semiring semantics, it turns out that there isno straightforward adaptation of Ehrenfeucht–Fraïssé games, or their generalisations such asHellas bijective pebble game [15], to semiring interpretations. Whatever the specific protocolof possible moves in such games may be, they always result in a localisation , in the sense thatsome tuples in the two structures are picked that are indistinguishable on the atomic level.As shown by the very simple example of the interpretations π P Q and π QP at the beginningof Sect. 4, this is not possible in semiring semantics. Although the two interpretations areelementarily equivalent, no element of the first “looks the same” as any element of the second,so any kind of localisation would result in a winning play of the Spoiler. It is an intriguingopen question how elementary equivalence of semiring interpretations can be captured by adifferent notion of comparison games or back-and-forth systems à la Fraïssé. This not beingavailable (yet), we have established elementary equivalence by different methods, based onhomomorphisms, which we believe to be of independent interest.There are many other model-theoretic issues that deserve to be studied in semiringsemantics. While we have limited ourselves here to finite semiring interpretations, thestudy of semiring semantics over infinite universes is of course very interesting as well. Itrequires certain restrictions on the underlying semirings, concerning existence and appropriatealgebraic properties of infinite sums and products, but there are useful semirings satisfyingsuch properties. A particularly interesting question is what kind of compactness andpreservation results are possible in such contexts.We finally remark that an altogether different approach to semiring interpretations wouldconsider them as two-sorted structures, one sort being a finite or infinite structure (or just aset), the second one consisting of the semiring, with functions from the first to the secondsort giving the semiring interpretation of the literals. This is very similar to the approach ofmetafinite model theory [10], and to get a reasonable logical theory it is important that theelements of the second sort, here the semiring, are treated differently than the elements of thefirst sort. In particular, quantifiers should range only over the first sort, and operations onthe second sort are just the algebraic semiring operations and their aggregates, together withequalities between terms. Such an approach is certainly useful for a number of questions andpermits the study of semiring interpretations via classical Boolean semantics. In particular, . Grädel and L. Mrkonjić 21 once semiring values are directly accessible in the logic, the construction of characteristicsentences, axiomatising a finite structure up to isomorphism, can easily be translated intosuch a setting. However, such an internalisation of the semiring values, from the meta-levelof truth values into the structures under consideration, does not really capture the essence ofsemiring semantics. References C. Bourgaux, A. Ozaki, R. Peñaloza, and L. Predoiu. Provenance for the description logicELHr. In Proceedings of IJCAI 2020 , pages 1862–1869, 2020. doi:10.24963/ijcai.2020/258 . K. Dannert and E. Grädel. Provenance analysis: A perspective for description logics? InC. Lutz et al., editor, Description Logic, Theory Combination, and All That , Lecture Notes inComputer Science Nr. 11560. Springer, 2019. doi:10.1007/978-3-030-22102-7_12 . K. Dannert and E. Grädel. Semiring provenance for guarded logics. In Hajnal Andréka andIstván Németi on Unity of Science: From Computing to Relativity Theory through AlgebraicLogic , Outstanding Contributions to Logic. Springer, 2020. K. Dannert, E. Grädel, M. Naaf, and V. Tannen. Semiring provenance for fixed-point logic.In Proceedings of CSL 2021 , 2021. D. Deutch, T. Milo, S. Roy, and V. Tannen. Circuits for datalog provenance. In Proc. 17thInternational Conference on Database Theory ICDT , pages 201–212, 2014. J. Doleschal, B. Kimelfeld, W. Martens, and L. Peterfreund. Weight annotation in informationextraction. In International Conference on Database Theory, ICDT 2020 , 2020. doi:10.4230/LIPIcs.ICDT.2020.8 . M. Droste and W. Kuich. Semirings and formal power series. In Handbook of WeightedAutomata , pages 3–28. Springer, 2009. F. Geerts and A. Poggi. On database query languages for K-relations. J. Applied Logic ,8(2):173–185, 2010. J. Goodman. Semiring parsing. Computational Linguistics , 25:573–605, 1999. E. Grädel and Y. Gurevich. Metafinite model theory. Information and Computation , 140:26–81,1998. E. Grädel and V. Tannen. Semiring provenance for first-order model checking. arXiv:1712.01980[cs.LO], 2017. URL: . E. Grädel and V. Tannen. Provenance analysis for logic and games. Moscow Journal ofCombinatorics and Number Theory , 9(3):203–228, 2020. doi:10.2140/moscow.2020.9.203 . T. Green, G. Karvounarakis, and V. Tannen. Provenance semirings. In Principles of DatabaseSystems PODS , pages 31–40, 2007. T. Green and V. Tannen. The semiring framework for database provenance. In Proceedings ofPODS , pages 93–99, 2017. L. Hella. Logical hierarchies in PTIME. In Proceedings of LICS 92 , pages 360–368, 1992. M. Naaf. Semirings for Provenance Analysis of Fixed Point Logics and Games . Msc thesis,RWTH Aachen University, 2019. A. Ozaki and R. Peñaloza. Provenance in ontology-based data access. In Description Logics2018 , volume 2211 of CEUR Workshop Proceedings , 2018. M. Raghothaman, J. Mendelson, D. Zhao, M Naik, and B. Scholz. Provenance-guided synthesisof datalog programs. Proc. ACM Program. Lang. , 4:62:1–62:27, 2020. doi:10.1145/3371130 . P. Senellart. Provenance and probabilities in relational databases: From theory to practice.