Papers
Topics
Authors
Recent
Search
2000 character limit reached

Weighted Existential Second-Order Logic

Updated 7 July 2026
  • Weighted Existential Second-Order Logic is a semiring-valued extension of ESO that computes numerical values by aggregating witness contributions through addition and multiplication.
  • It enriches traditional logic with semiring constants and weighted connectives, enabling algebraic evaluation over finite structures.
  • The logic underpins a weighted analogue of Fagin’s theorem, bridging descriptive complexity and quantitative computation in domains like optimization and counting.

Weighted Existential Second-Order Logic is a semiring-valued extension of existential second-order logic in which formulas do not return only a Boolean truth value, but compute an element of a semiring by aggregating the contributions of witnesses through addition and multiplication. In the formulation developed for descriptive complexity, the logic is interpreted over a semiring S=(S,+,,0,1)\mathcal S=(S,+,\cdot,0,1), extends ordinary first- and second-order syntax by semiring constants and weighted connectives, and gives existential and universal quantifiers an aggregative semantics: existential quantification becomes summation over assignments, and universal quantification becomes product over assignments. The fragment usually denoted wESO[S]\mathrm{wESO}[\mathcal S] places all second-order quantifiers at the front and restricts them to existential quantification, yielding a weighted analogue of Fagin’s existential-second-order characterization of NP\mathsf{NP} (Badia et al., 2024).

1. Semiring-valued interpretation

Weighted existential second-order logic is defined relative to a semiring. The underlying value domain is a structure

S=(S,+,,0,1),\mathcal S = (S,+,\cdot,0,1),

where (S,+,0)(S,+,0) is a commutative monoid, (S,,1)(S,\cdot,1) is a monoid, multiplication distributes over addition, and s0=0s=0s\cdot 0=0\cdot s=0 (Badia et al., 2024). In this setting, a formula denotes a value in SS, not merely a truth value.

This semantic shift is the central departure from ordinary existential second-order logic. Ordinary ESO asks whether there exists a second-order assignment making a Boolean matrix true. Weighted ESO instead lets each assignment contribute a semiring value, and the logic aggregates those values. The resulting semantics computes what the source characterizes as a “formal sum over witnesses” rather than a yes/no answer (Badia et al., 2024).

The semiring assumptions determine which structural classes can be treated uniformly. For ordered finite structures, the main weighted existential-second-order characterization works for arbitrary semirings, including non-commutative ones. For arbitrary structures, the corresponding theorem requires the semiring to be idempotent and commutative (Badia et al., 2024). This distinction reflects the role of ordering in fixing the evaluation order of products arising from universal quantification.

A closely related semiring-based viewpoint appears in weighted logic on trees, where formulas are evaluated in a fixed but arbitrary commutative semiring

S=(S,,,0,1),S=(S,\oplus,\odot,\mathbf 0,\mathbf 1),

and the semantics of a formula is a weight [φ](ξ,ρ)S[\varphi](\xi,\rho)\in S assigned to a tree wESO[S]\mathrm{wESO}[\mathcal S]0 under an assignment wESO[S]\mathrm{wESO}[\mathcal S]1 (Fülöp et al., 2012). This suggests a broad algebraic template: weighted logics replace satisfaction by valuation, while retaining a logical syntax rich enough to describe recognizable or computationally natural quantitative classes.

2. Syntax and quantitative semantics

The weighted formalism extends ordinary logic with semiring constants and algebraic connectives. Weighted first-order formulas are generated by

wESO[S]\mathrm{wESO}[\mathcal S]2

where wESO[S]\mathrm{wESO}[\mathcal S]3 is an ordinary first-order formula and wESO[S]\mathrm{wESO}[\mathcal S]4 is a semiring constant. Weighted second-order formulas add second-order variables and quantifiers: wESO[S]\mathrm{wESO}[\mathcal S]5 (Badia et al., 2024).

For a finite structure wESO[S]\mathrm{wESO}[\mathcal S]6 and an assignment wESO[S]\mathrm{wESO}[\mathcal S]7, the semantics is a value

wESO[S]\mathrm{wESO}[\mathcal S]8

Boolean formulas contribute wESO[S]\mathrm{wESO}[\mathcal S]9 when satisfied and NP\mathsf{NP}0 otherwise; semiring constants denote themselves; addition and multiplication interpret weighted disjunction and conjunction; and the quantifiers aggregate over all assignments. Explicitly,

NP\mathsf{NP}1

NP\mathsf{NP}2

with analogous clauses for second-order quantification over interpretations of relation variables (Badia et al., 2024).

The crucial point is that the logical symbols retain their syntactic status while their semantics becomes algebraic. Existential quantification is no longer an existential test; it is a sum over all choices. Universal quantification is no longer a universal test; it is a product over all choices (Badia et al., 2024). The same pattern appears in weighted MSO on trees, where NP\mathsf{NP}3 becomes addition, NP\mathsf{NP}4 becomes multiplication, NP\mathsf{NP}5 becomes summation over positions or subsets, and NP\mathsf{NP}6 becomes product over positions or subsets (Fülöp et al., 2012).

If the semiring is commutative, the order of multiplication in universal quantifiers does not matter. If it is not commutative, the ordered-structure setting fixes an ordering on finite structures and uses it to define the product order (Badia et al., 2024). This is one of the technical reasons the ordered version of the theory is the baseline formulation.

3. The fragment NP\mathsf{NP}7

Weighted existential second-order logic, written NP\mathsf{NP}8, is the fragment in which all second-order quantifiers occur only at the front and are existential, or equivalently additive in the weighted semantics. Its formulas have the shape

NP\mathsf{NP}9

where S=(S,+,,0,1),\mathcal S = (S,+,\cdot,0,1),0 is built from first-order logic plus weighted connectives and quantifiers (Badia et al., 2024).

Although this fragment is the weighted analogue of classical ESO, it is structurally richer than ordinary existential second-order logic because the matrix S=(S,+,,0,1),\mathcal S = (S,+,\cdot,0,1),1 may contain weighted addition, weighted multiplication, and first-order quantifiers interpreted semiring-theoretically (Badia et al., 2024). As a result, S=(S,+,,0,1),\mathcal S = (S,+,\cdot,0,1),2 does not merely assert the existence of a certificate. It can aggregate over many witnesses and combine their local contributions multiplicatively and additively within one formula.

The logic therefore refines the existential-second-order paradigm rather than replacing it. In ordinary ESO, the existential second-order prefix guesses relations and the matrix checks a Boolean property. In weighted ESO, each second-order assignment contributes a semiring value, and the overall formula sums those values (Badia et al., 2024). The source emphasizes that, because semirings generally lack negation, the weighted formalism must use conjunctions and universal quantifiers in a way that is absent from ordinary ESO characterizations. A plausible implication is that the matrix of a weighted ESO sentence is not merely a verification device; it is also the mechanism that computes the weight of each guessed witness.

This weighted existential-second-order perspective should be distinguished from unrelated negationless generalizations of S=(S,+,,0,1),\mathcal S = (S,+,\cdot,0,1),3. Positive logics, for example, study logics closed under S=(S,+,,0,1),\mathcal S = (S,+,\cdot,0,1),4 but not required to be closed under negation, and construct proper extensions of S=(S,+,,0,1),\mathcal S = (S,+,\cdot,0,1),5 via generalized quantifiers S=(S,+,,0,1),\mathcal S = (S,+,\cdot,0,1),6 based on density in S=(S,+,,0,1),\mathcal S = (S,+,\cdot,0,1),7. That line of work does not develop weighted semantics, semiring interpretations, or weighted ESO machinery (Shelah et al., 2020).

4. Descriptive-complexity characterization

The principal descriptive-complexity result is a weighted version of Fagin’s theorem. Over finite ordered structures,

S=(S,+,,0,1),\mathcal S = (S,+,\cdot,0,1),8

and over arbitrary finite structures the same characterization holds when S=(S,+,,0,1),\mathcal S = (S,+,\cdot,0,1),9 is idempotent and commutative (Badia et al., 2024).

In the ordered case, the statement means two things. First, every (S,+,0)(S,+,0)0-definable series is computable by a polynomial-time weighted Turing machine over (S,+,0)(S,+,0)1. Second, every series in (S,+,0)(S,+,0)2 is definable in (S,+,0)(S,+,0)3 (Badia et al., 2024). The theorem extends the classical correspondence between ESO and (S,+,0)(S,+,0)4 from decision problems to quantitative computation over semirings.

The intuition mirrors the standard existential-second-order account of nondeterminism. In the classical setting, second-order witnesses encode certificates. In the weighted setting, a computation corresponds to a sum over second-order assignments encoding runs, with each assignment contributing the product of its transition weights (Badia et al., 2024). The weighted semantics thus internalizes both nondeterministic branching and path-weight accumulation.

The proof has two directions. From logic to machines, a weighted (S,+,0)(S,+,0)5 formula is evaluated by a nondeterministic weighted Turing machine that guesses assignments, evaluates the Boolean structure, and multiplies or sums weights exactly as specified by the semantics. The treatment of weighted conjunctions and weighted universal quantifiers proceeds by running component computations sequentially and restoring the tape, using distributivity to preserve the intended semiring expression (Badia et al., 2024). From machines to logic, a weighted polynomial-time Turing machine is encoded by existential second-order relations describing tape contents, head positions, and states, while the weighted matrix computes the weight of the encoded accepting run (Badia et al., 2024).

The role of order is structural rather than cosmetic. Ordered structures let formulas index time steps and tape positions by tuples from the domain, which is necessary for the machine-to-logic simulation. For unordered structures, commutativity of multiplication ensures that products do not depend on an arbitrary traversal order, and idempotence of addition removes dependence on the chosen ordering relation (Badia et al., 2024).

5. Relation to weighted monadic logic on trees

Weighted existential second-order logic is part of a broader landscape of weighted descriptive formalisms. In weighted monadic second-order logic on trees, recognizable weighted tree languages coincide with weighted MSO over commutative semirings and with several restricted logical fragments, including formulas of the form

(S,+,0)(S,+,0)6

where (S,+,0)(S,+,0)7 is a suitable step formula (Fülöp et al., 2012).

The tree setting differs in both domain and operator repertoire. The logic is interpreted over trees rather than arbitrary finite structures, and the main transitive-closure characterization uses a branching transitive closure operator (S,+,0)(S,+,0)8 designed to mirror the branching structure of trees. The central equivalence theorem states that for a weighted tree language (S,+,0)(S,+,0)9, recognizability, (S,,1)(S,\cdot,1)0-definability over suitable step-formula fragments, (S,,1)(S,\cdot,1)1-definability with one existential second-order quantifier followed by one universal first-order quantifier, and RMSO-definability are equivalent (Fülöp et al., 2012).

The (S,,1)(S,\cdot,1)2 normal form is especially relevant to weighted existential second-order logic because it exhibits a restricted existential-second-order pattern that is nonetheless complete for recognizable weighted tree languages under the assumptions of the paper (Fülöp et al., 2012). Here the existential set variable encodes the unfolding of a branching transitive-closure computation, while the universal first-order quantifier enforces local consistency conditions. This suggests that existential second-order quantification in weighted settings can serve not only as a witness mechanism for computation paths, as in weighted Fagin-style results, but also as a compact encoding of recursive combinatorial structure.

The tree results also clarify a common misconception. It is not sufficient to transfer string-based transitive-closure ideas directly to trees. The source explicitly notes that ordinary (S,,1)(S,\cdot,1)3 is too weak for MSO on trees, and that (S,,1)(S,\cdot,1)4 is introduced precisely because tree computations branch (Fülöp et al., 2012). In other words, the expressive behavior of weighted existential quantification depends strongly on the ambient structural class.

6. Scope, distinctions, and recurrent misunderstandings

One recurrent misunderstanding is to treat weighted existential second-order logic as ordinary ESO with numerical annotations. The formal semantics is stronger and more systematic than that. The logic computes semiring values by summing over witnesses and multiplying local contributions, so its output is an algebraic object rather than a truth value (Badia et al., 2024). The source explicitly contrasts the weighted setting with ordinary FO/SO by observing that existential quantifiers become sums and universal quantifiers become products.

A second misunderstanding is to assume that weighted ESO eliminates the need for universal quantification. The cited account states the opposite: because semirings generally lack negation, the weighted formalism must use conjunctions and universal quantifiers in a way that is absent from ordinary ESO characterizations (Badia et al., 2024). Thus, despite the existential second-order prefix, the matrix may rely essentially on universal first-order structure.

A third misunderstanding is to conflate weighted existential second-order logic with positive logics merely because both weaken the classical dependence on negation. Positive logics are defined as logics without negation except in front of atomic and first-order formulas, and the cited work studies generalized quantifiers (S,,1)(S,\cdot,1)5, Compactness, and Downward Löwenheim–Skolem phenomena in that negationless setting (Shelah et al., 2020). It explicitly does not discuss weights, semirings, valuation-based interpretation, or weighted ESO. The overlap is therefore conceptual rather than technical.

Finally, there is a structural distinction between general weighted ESO and the restricted (S,,1)(S,\cdot,1)6 patterns arising in weighted tree logic. The latter are complete for recognizable weighted tree languages in the specific framework of weighted MSO on trees over commutative semirings (Fülöp et al., 2012). They should not be identified with the full (S,,1)(S,\cdot,1)7 fragment used in the weighted Fagin theorem, although they exemplify how existential second-order quantification can be combined with local first-order checking in a weighted environment.

7. Significance within weighted logic and descriptive complexity

Weighted existential second-order logic occupies a central position in the development of quantitative descriptive complexity. It provides a machine-independent formalism for (S,,1)(S,\cdot,1)8-style weighted computation over semirings and thereby extends the classical existential-second-order viewpoint from decision problems to quantitative problems (Badia et al., 2024). The source identifies this extension as encompassing classical (S,,1)(S,\cdot,1)9 when s0=0s=0s\cdot 0=0\cdot s=00, counting-style settings such as s0=0s=0s\cdot 0=0\cdot s=01 when s0=0s=0s\cdot 0=0\cdot s=02, modular and parity settings such as s0=0s=0s\cdot 0=0\cdot s=03 and s0=0s=0s\cdot 0=0\cdot s=04, optimization-style semirings such as max-plus and min-plus, and fuzzy computation (Badia et al., 2024).

Within weighted logic more broadly, the formalism aligns with a recurring theme: semiring semantics makes it possible to express recognizability, accumulation of local weights, and aggregation over witnesses in a uniform logical language. In weighted tree logic, this idea connects weighted MSO, weighted tree automata, branching transitive closure, and restricted existential-universal second-order forms (Fülöp et al., 2012). In descriptive complexity over arbitrary finite structures, it yields the weighted analogue of Fagin’s theorem and related logical characterizations of weighted complexity classes (Badia et al., 2024).

Taken together, these results locate weighted existential second-order logic at the interface of algebraic semantics, automata-theoretic recognizability, and complexity-theoretic definability. Its defining feature is not merely the presence of second-order existential quantifiers, but the semiring-valued interpretation that turns existential quantification into aggregation over witnesses and thereby recasts nondeterminism as quantitative accumulation.

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

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

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

Follow Topic

Get notified by email when new papers are published related to Weighted Existential Second-Order Logic.