Median-Closed Semilinear Constraints
- Median-closed semilinear constraints are defined by semilinear relations preserved by the coordinatewise median, forming a tractable class for CSPs over ℚ.
- Their characterization via bijunctive formulas called 'bends' enables efficient variable elimination and strong polynomial-time decision procedures.
- The work establishes a sharp tractability boundary, as adding non-median-preserving relations leads to NP-hardness in semilinear CSPs.
Median-closed semilinear constraints are semilinear relations over the rationals that are preserved by the coordinatewise median operation. In the setting of constraint satisfaction problems (CSPs) over , they define a natural non-convex tractable class strictly larger than the convex semilinear case. Semilinear relations are exactly Boolean combinations of linear half-spaces, and convex semilinear relations are precisely those preserved by taking averages. The central result for median-closed semilinear constraints is that their CSP admits a polynomial-time, indeed strongly polynomial, decision procedure, while any proper semilinear expansion by a relation not preserved by median yields NP-hardness. This places median-closure at a sharp tractability boundary for a large family of linear-arithmetic constraints (Bodirsky et al., 2018).
1. Formal setting and basic definitions
The domain is . A -ary relation is semilinear if it is definable by a quantifier-free formula over ; equivalently, it is a finite Boolean combination of closed half-spaces. A typical presentation is
with rational vectors and rational scalars .
For , the coordinatewise median is defined by
where 0 is the middle element of 1. A relation 2 is median-closed if 3 implies 4. Equivalently, 5 is a polymorphism of the relational structure whose relations include 6 (Bodirsky et al., 2018).
This notion sits between purely geometric and algebraic viewpoints. On the geometric side, semilinear sets generalize polyhedra by allowing arbitrary Boolean combinations of linear inequalities. On the algebraic side, preservation by median is a polymorphism condition that constrains allowable relations. The resulting class is non-convex in general, but still structurally rigid enough to support a polynomial-time CSP algorithm.
2. Relation to convexity and representative examples
Convex semilinear relations form the classical tractable case: their CSP is polynomial-time equivalent to linear programming. In this setting, convexity is characterized by preservation under averaging. Median-closed semilinear relations properly generalize this class, showing that tractability is not confined to convexity (Bodirsky et al., 2018).
The paper identifies several important examples contained in the median-closed class. These include all TVPI constraints, that is, linear inequalities of the form 7 with at most two variables per inequality. They also include unary constraints 8 for arbitrary finite 9; for instance, 0 can be enforced by a formula such as 1. Another family consists of disjunctive bounds such as 2, or more generally 3, where each comparison symbol can be one of 4.
These examples are significant because none of them need be convex. Finite-domain-like unary restrictions and simple disjunctions of bounds are typically outside the convex framework, yet they remain median-invariant. A plausible implication is that median-closure captures a robust form of “discrete-looking” structure inside rational semilinear geometry without requiring integrality constraints, whose addition is known to render the problem NP-complete.
3. Bijunctive structure and the role of bends
The tractability proof begins by exploiting the fact that the coordinatewise median is a majority operation, satisfying identities such as 5. In the infinite-domain universal-algebraic theory, invariance under a majority operation implies 2-decomposability. In the semilinear setting, this yields a concrete syntactic characterization: a semilinear relation 6 is median-closed if and only if it can be expressed as a conjunction of “bends” (Bodirsky et al., 2018).
A bend is a formula of the form
7
where each bound 8 is one of 9, 0, 1, or 2, and where 3. In effect, bends provide a bijunctive syntax for median-closed semilinear constraints.
For higher arity, a median-closed 4-ary relation decomposes into 2-ary projections of this form together with possible unary bounds. The algorithmic consequence is that satisfiability can be decided by working with these bijunctive constraints. This is the structural core of the result: the polymorphism condition is translated into a normal form that supports propagation and elimination.
The significance of this characterization extends beyond syntax. It identifies a precise analogue, for semilinear relations over 5, of the role that bijunctive formulas play in finite-domain CSP classifications. This suggests a Schaefer-style perspective in which median is the governing polymorphism of a maximal tractable non-convex class.
4. Polynomial-time algorithm
The algorithm generalizes classical work on TVPI feasibility by Aspvall–Shiloach and Hochbaum–Naor, which in turn relies on Shostak’s characterization of unsatisfiable TVPI systems via certain cycles and paths. For general bends, the paper introduces the notion of a “handcuff”: two cycles of bends attached by a path. Its key theorem states that a conjunction of bends is satisfiable if and only if it is free of handcuff refutations (Bodirsky et al., 2018).
On top of this characterization, the paper defines a strongly polynomial subroutine 6 for a satisfiable set 7 of bends. The subroutine decides in 8 arithmetic steps whether 9 remains satisfiable, where 0 is the number of variables and 1 the number of bends. The mechanism alternates between two operations. First, bound propagation derives stronger bounds on one variable from a bend and a current bound on another variable. Second, cycle detection analyzes a closed propagation cycle at some variable 2 by computing the corresponding residue bend and using it to strengthen the bound at 3. If no contradiction arises after 4 rounds, the instance is handcuff-consistent and hence globally satisfiable.
This propagation procedure is embedded into a variable-elimination scheme in the style of Hochbaum–Naor. For a chosen variable 5, one computes the breakpoints
6
at which the strongest disjunct in a bend involving 7 can change, and then performs a binary search over the set 8 to find the largest 9 such that 0 is still satisfiable. On the interval 1, every bend involving 2 reduces to one of its three disjuncts, so 3 appears only in linear inequalities or trivial bounds. One can then eliminate 4 by Fourier–Motzkin elimination in quadratic time in the number of remaining bends.
No new breakpoints are created, and there are 5 propagation calls per eliminated variable. Since each propagation call costs 6 arithmetic operations and elimination contributes an additional 7 work overall, the full algorithm is strongly polynomial, essentially 8. The paper also states that the arithmetic is performed on input numbers of size 9.
5. Maximal tractability and the hardness boundary
The tractability result is maximal in the semilinear setting. If 0 is a semilinear relation not preserved by median, then there exist tuples 1 whose coordinatewise median lies outside 2. Let 3 be the finite set of all coordinates appearing in these tuples. Restricting 4 to 5 produces a finite-domain relation 6 that is not preserved by the median polymorphism on 7 (Bodirsky et al., 2018).
The argument then invokes finite-domain clone theory and CSP complexity. On any finite linearly ordered domain 8, the clone generated by median is a minimal majority clone, and adjoining any relation that violates median-invariance yields an NP-hard finite-domain CSP. The paper cites this in connection with work of Pöschel–Kalužnin and Bulatov–Jeavons–Krokhin. By embedding the resulting finite language back into 9, it follows that
0
is already NP-hard.
In this sense, median-closed semilinear relations form a maximal tractable class: one cannot enlarge the class by adding any non-median-closed semilinear relation without crossing into NP-hardness. This is stronger than merely proving that a particular algorithm works; it identifies an exact frontier. A common oversimplification is to treat semilinear CSP tractability over 1 as essentially equivalent to convexity. The maximality theorem shows that there exists a larger, natural non-convex region of tractability, but only up to the median boundary.
6. Position within CSP theory and related implications
The result fits into a broader program of classifying the complexity of semilinear constraint languages over 2. The paper explicitly places it alongside the search for an infinite-domain analogue of Schaefer-style classifications and notes the parallel with the finite-domain dichotomy associated with Bulatov and Zhuk (Bodirsky et al., 2018).
One implication concerns the relationship with linear programming. Convex semilinear CSPs are exactly those preserved by the averaging operation 3, and their complexity is polynomial-time equivalent to linear programming. Median-closed constraints strictly extend this convex regime while remaining in 4. This separates the geometric notion of convexity from the algebraic notion of median preservation and shows that the latter can still support efficient decision procedures.
Another implication concerns submodularity in the valued-CSP setting. The paper states that submodular cost functions on 5 must have supports preserved by both 6 and 7, and therefore also by median. Consequently, the feasibility part of submodular semilinear VCSPs reduces to a median-closed semilinear CSP and is polynomial-time solvable.
The paper also records an open problem: whether similarly maximal tractable classes exist for max-closed or min-closed semilinear relations. Each of these classes strictly contains the median-closed one, but their tractability remains unresolved. This suggests that the median case is both a completed classification point and a benchmark for subsequent work on broader non-convex semilinear polymorphism classes.