Algorithm Search⌘K

Theoremadvanced

NP-completeness of the interval algebra

Also called NP-completeness of interval algebra consistency.

Deciding whether a network of Allen interval relations has a solution is NP-complete, by a reduction from 3-SAT; algebraic closure is therefore not a complete test.

This theorem says that the consistency problem of Allen's interval algebra is NP-complete: given a qualitative constraint network on nn intervals, with a set of the 13 base relations on each pair, deciding whether some intervals on the real line satisfy every label is as hard as 3-SAT. Vilain and Kautz proved hardness in 1986. The theorem explains why Allen's constraint propagation and algebraic closure can accept a network with no solution, and it is the starting point for the search for tractable subclasses, settled by the Nebel-Bürckert theorem for ORD-Horn and by the classification of tractable subclasses.

Statement

The problem. CSP(IA)\mathrm{CSP}(\mathrm{IA}): the input is a network on intervals 0,…,n−10, \ldots, n-1 with a label Cij⊆{b,m,o,s,d,f,eq,fi,di,si,oi,mi,bi}C_{ij} \subseteq \{b, m, o, s, d, f, eq, fi, di, si, oi, mi, bi\} on each pair, given as a 13-bit mask, so the input size is Θ(n2)\Theta(n^2). A solution assigns to each interval ii two reals xi−<xi+x_i^- < x_i^+ so that the base relation between ii and jj is in CijC_{ij} for all i<ji < j.

Theorem. CSP(IA)\mathrm{CSP}(\mathrm{IA}) is NP-complete. Hardness holds already for networks whose labels are among {d}\{d\}, {di}\{di\}, {m,mi}\{m, mi\}, {b,bi}\{b, bi\}, {m,s,bi}\{m, s, bi\} and {b,bi,m,mi}\{b, bi, m, mi\}.

The reduction below is from 3-SAT with exactly three distinct literals in every clause, which is NP-complete: a clause with fewer literals can be padded with new variables in the usual way.

In plain words

Intervals on a line can stand for true and false. Put one short interval in the middle. For each yes-or-no variable, place a pair of intervals so that one of them must lie left of the middle and the other right of it; left means false, right means true. For each clause, add a long interval around the middle and one helper interval per literal, each wrapped around its literal. A helper of a false literal must sit at the left end of the long interval, and there is room for at most two helpers there, since helpers may touch but not overlap. So every clause needs a true literal. That turns any satisfiability puzzle into an interval puzzle of about the same size, so no fast method can solve every interval puzzle unless it can solve every such puzzle.

Proof

Membership in NP. A solution can be replaced by one whose 2n2n endpoints are integers in {0,…,2n−1}\{0, \ldots, 2n-1\}, since the base relations depend only on the order of the endpoints: map each endpoint to the number of distinct endpoint values below it. So a certificate is a list of 2n2n such integers. The verifier checks xi−<xi+x_i^- < x_i^+ for each ii and computes the base relation of each pair from 4 comparisons, in O(n2)O(n^2) time.

Hardness. Let φ\varphi be a 3-CNF formula with variables v1,…,vkv_1, \ldots, v_k and clauses c1,…,cmc_1, \ldots, c_m, each with exactly 3 distinct literals. Build a network with these intervals and labels, where "XRYX \mathrel{R} Y" means the label of (X,Y)(X, Y):

  • a middle interval MM;
  • for each variable vv: intervals XvX_v, PvP_v and NvN_v with M{d}XvM \mathrel{\{d\}} X_v, Pv{m,mi}XvP_v \mathrel{\{m, mi\}} X_v, Nv{m,mi}XvN_v \mathrel{\{m, mi\}} X_v and Pv{b,bi}NvP_v \mathrel{\{b, bi\}} N_v; the interval of the literal vv is PvP_v and that of ¬v\neg v is NvN_v;
  • for each clause cc: an interval QcQ_c with Qc{di}MQ_c \mathrel{\{di\}} M, and for each literal ℓ\ell of cc, with literal interval LL, a placeholder Fc,ℓF_{c,\ell} with Fc,ℓ{di}LF_{c,\ell} \mathrel{\{di\}} L, Fc,ℓ{b,bi}MF_{c,\ell} \mathrel{\{b, bi\}} M and Fc,ℓ{m,s,bi}QcF_{c,\ell} \mathrel{\{m, s, bi\}} Q_c; the three placeholders of cc are pairwise {b,bi,m,mi}\{b, bi, m, mi\}.

All other pairs are universal. There are 1+3k+4m1 + 3k + 4m intervals, so the network is built in polynomial time. Call a literal interval true if it lies after MM and false if it lies before MM.

Claim 1 (variables). In every solution, for each vv exactly one of PvP_v, NvN_v is true. Both meet XvX_v on one side or the other. They cannot both meet it from the same side, because then they would share an endpoint, which {b,bi}\{b, bi\} forbids. So one ends where XvX_v starts and the other starts where XvX_v ends. Since MM lies strictly inside XvX_v, the first is before MM and the second after MM.

Claim 2 (placeholders). Let F=Fc,ℓF = F_{c,\ell} with literal interval LL. If LL is false, FF contains LL and so starts before MM; with {b,bi}\{b, bi\} this gives FbMF \mathrel{b} M, and since MM lies inside QcQ_c, FbiQcF \mathrel{bi} Q_c is impossible, so FmQcF \mathrel{m} Q_c or FsQcF \mathrel{s} Q_c.

Claim 3 (clauses). At most two placeholders of a clause are in {m,s}\{m, s\} with QcQ_c. Two placeholders with mm both end at the start of QcQ_c, and two with ss both start at the start of QcQ_c. In either case they share an endpoint in a way that {b,bi,m,mi}\{b, bi, m, mi\} forbids. So a third one has no place. With Claim 2, every clause has a true literal, and Claim 1 makes the truth values a well-defined assignment. So a solution gives a satisfying assignment.

Converse. Take a satisfying assignment, and order the literal intervals so that all are pairwise disjoint: the false ones in a row left of MM, the true ones in a row right of MM, each XvX_v stretching from the end of its false interval to the start of its true one. Let M=(0,1)M = (0, 1). For a clause cc with one false literal L1L_1, start QcQ_c just after the end of L1L_1 and put Fc,ℓ1F_{c,\ell_1} around L1L_1, ending at the start of QcQ_c. With a second false literal L2L_2 further right, start QcQ_c between L1L_1 and L2L_2 instead, and let Fc,ℓ2F_{c,\ell_2} start with QcQ_c and end between L2L_2 and MM. End QcQ_c just after MM, and wrap each true literal in its own disjoint placeholder after QcQ_c ends. The placeholders of one clause meet or are disjoint, every label holds, and the network is consistent. □\square

The construction and both directions were checked by machine on random 3-CNF formulas with up to 3 variables, including the unsatisfiable formula with all 8 clauses on 3 variables, whose network has 42 intervals.

Consequences

  • Propagation is incomplete. Unless P = NP, no polynomial algorithm decides all interval networks, so algebraic closure must accept some networks without a solution. The 42-interval network of the unsatisfiable formula above is one: algebraic closure leaves no label empty. A smaller one has 4 intervals: 0{o,si}10 \mathrel{\{o, si\}} 1, 0{fi,si}20 \mathrel{\{fi, si\}} 2, 0{o,fi}30 \mathrel{\{o, fi\}} 3, 1{m,mi}21 \mathrel{\{m, mi\}} 2, 1{b,f}31 \mathrel{\{b, f\}} 3, 2{b,s}32 \mathrel{\{b, s\}} 3 is closed and has no solution.
  • Search is needed. Complete solvers backtrack over refinements of the labels, with propagation at each node; see Allen's constraint propagation.
  • Related problems are hard. Computing the minimal network, or deciding whether a base relation is possible between two intervals, is NP-hard, since either decides consistency. Calculi that contain the interval algebra, such as the rectangle algebra, inherit the hardness.
  • Tractable subclasses. The labels used by the reduction, such as {b,bi}\{b, bi\} and {m,mi}\{m, mi\}, must be avoided by any tractable subclass. This leads to the ORD-Horn subclass and the classification of tractable subclasses.

Tightness

  • Membership is exact. The problem is in NP for all 8192 relations, so the theorem is not about a harder class.
  • Small labels are enough, but not single ones. The reduction uses labels of at most 4 base relations. With the 13 base relations alone the problem is in P, since algebraic closure decides atomic networks, so hardness needs some disjunctive labels.
  • Dichotomy. Krokhin, Jeavons and Jonsson (2003) proved that every subset of the 8192 relations gives a problem that is either in P or NP-complete, and listed the 18 maximal tractable subclasses. The ORD-Horn subclass, 868 relations, is the only one of them that contains all 13 base relations.
  • Three distinct literals. The clause gadget needs them. With two placeholders, both may be false, one meeting QcQ_c and one starting it; and two placeholders around the same literal interval cannot be disjoint.

History

Allen (1983) gave the algebra and noted that his propagation is incomplete. Vilain and Kautz (1986) proved that consistency is NP-hard, and the revised report of Vilain, Kautz and van Beek (1990) gave the reduction from 3-SAT in detail. Nebel and Bürckert (1995) found the maximal tractable ORD-Horn subclass, and Krokhin, Jeavons and Jonsson (2003) completed the classification of all subclasses.

References

  1. Marc Vilain and Henry Kautz, Constraint propagation algorithms for temporal reasoning, Proceedings of AAAI-86, 1986, pages 377 to 382, the theorem that consistency of interval networks is NP-hard, and the incompleteness of propagation
  2. Marc Vilain, Henry Kautz and Peter van Beek, Constraint propagation algorithms for temporal reasoning, a revised report, in Readings in Qualitative Reasoning about Physical Systems, Morgan Kaufmann, 1990, pages 373 to 381 (the reduction from 3-SAT with variable and clause gadgets)
  3. Bernhard Nebel and Hans-Jürgen Bürckert, Reasoning about temporal relations, a maximal tractable subclass of Allen's interval algebra, Journal of the ACM 42(1), 1995, pages 43 to 66 (membership in NP, and the relations that make the problem hard)
  4. Andrei Krokhin, Peter Jeavons and Peter Jonsson, Reasoning about temporal relations, the tractable subalgebras of Allen's interval algebra, Journal of the ACM 50(5), 2003, pages 591 to 640 (every subclass of the interval algebra is either tractable or NP-complete)
  5. James F. Allen, Maintaining knowledge about temporal intervals, Communications of the ACM 26(11), 1983, pages 832 to 843 (the interval algebra and its incomplete propagation)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/HEBZH8/text.yaml