Documentation

DescriptiveComplexity.Problems.Reachability

Reachability, and the Horn fragment at work #

The problem REACH – is some marked target reachable from some marked source in a directed graph? – and its complement UNREACH, over the vocabulary FirstOrder.Language.stGraph of graphs with marked sources and targets.

The point of this file is UNREACH: it is the worked instance of the SO-Horn fragment of DescriptiveComplexity.SecondOrderHorn. Its Horn program guesses a binary relation T and forces it, by two rules, to contain the transitive closure of the edge relation, then rules out with a goal clause the case of a marked target lying in T (or being itself a marked source):

             edge(x, y) → T(x, y)
  T(x, y) ∧  edge(y, z) → T(x, z)
  T(x, y) ∧ source(x) ∧ target(y) → ⊥
            source(x) ∧ target(x) → ⊥

Such a program is satisfiable exactly when its least model – here the transitive closure – already satisfies the goal clauses, which is why the existential second-order quantifier in front of a Horn kernel expresses a polynomial-time property rather than a nondeterministic guess. That is the content of DescriptiveComplexity.unreach_sigmaSOHornDefinable, and with the Horn discharge it gives DescriptiveComplexity.unreach_le_hornSat: UNREACH first-order reduces to HORN-SAT.

Note that it is the complement that the fragment defines: goal clauses can only rule models out. This is the usual state of affairs for SO-Horn, and harmless, both problems being in polynomial time.

The same file also places UNREACH one level lower, in DescriptiveComplexity.NL: the Krom fragment defines it by a two-literal program guessing the set U of vertices from which a marked target is reachable,

              target(x) → U(x)
  edge(x, y)            → ¬U(y) ∨ U(x)
              source(x) → ¬U(x)

and the same asymmetry appears one level down, for the same reason. A clausal fragment states closure and rejection, so it defines UNREACH head-on (DescriptiveComplexity.unreach_mem_NL) while REACH would need the guessed set to be contained in the true reachable set – a minimality condition no clause can impose. At the Horn level the way out was the equivalence with FO(LFP), a full logic closed under negation; at the Krom level the corresponding statement is NL = coNL, i.e. Immerman–Szelepcsényi, and it is what carries DescriptiveComplexity.unreach_mem_NL over to REACH ∈ NL (DescriptiveComplexity.reach_mem_NL, in DescriptiveComplexity.ImmermanSzelepcsenyi).

Relation symbols of the vocabulary of graphs with marked sources and targets.

Instances For
    Dependency graph
    Dependency graph
    Dependency graph

    The relational vocabulary of directed graphs with marked sources and targets.

    Equations
    Instances For
      Dependency graph
      Dependency graph
      Dependency graph
      Dependency graph
      Dependency graph
      @[reducible, inline]

      The edge symbol in the ordered expansion.

      Equations
      Instances For
        Dependency graph
        @[reducible, inline]

        The marked-source symbol in the ordered expansion.

        Equations
        Instances For
          Dependency graph
          @[reducible, inline]

          The marked-target symbol in the ordered expansion.

          Equations
          Instances For
            Dependency graph

            The problem #

            Dependency graph
            Dependency graph
            Dependency graph

            Some marked target is reachable from some marked source, along a (possibly empty) directed path.

            Equations
            Instances For
              Dependency graph
              Dependency graph

              REACH, as a problem on graphs with marked sources and targets.

              Equations
              Instances For
                Dependency graph

                UNREACH, the complement of REACH: no marked target is reachable from a marked source.

                Equations
                Instances For
                  Dependency graph

                  The Horn program #

                  The block of the SO-Horn definition of UNREACH: one binary relation variable, forced to contain the transitive closure of the edge relation.

                  Equations
                  Instances For
                    Dependency graph

                    The atom T (xᵢ, xⱼ) of the guessed relation.

                    Equations
                    Instances For
                      Dependency graph

                      The guard edge (xᵢ, xⱼ). Guards live over the ordered expansion of the vocabulary, as DescriptiveComplexity.SigmaSOHornDefinable requires; this program happens not to need the order.

                      Equations
                      Instances For
                        Dependency graph
                        Dependency graph
                        Dependency graph
                        Dependency graph
                        Dependency graph
                        Dependency graph

                        Goal clause: no vertex is both a marked source and a marked target (the empty path).

                        Equations
                        Instances For
                          Dependency graph

                          The Horn program defining UNREACH: two rules generating the transitive closure of the edge relation into T, and two goal clauses forbidding a marked target to be reached from a marked source.

                          Equations
                          Instances For
                            Dependency graph

                            Correctness of the program #

                            The relation guessed by an assignment of the block.

                            Equations
                            Instances For
                              Dependency graph
                              theorem DescriptiveComplexity.reachProgram_holds_iff {A : Type} [FirstOrder.Language.stGraph.Structure A] [LinearOrder A] (ρ : reachBlock.Assignment A) :
                              reachProgram.Holds ρ ((∀ (x y : A), SGEdge x yTRel ρ x y) ∀ (x y z : A), TRel ρ x ySGEdge y zTRel ρ x z) (∀ (x y : A), TRel ρ x ySGSource xSGTarget yFalse) ∀ (x : A), SGSource xSGTarget xFalse

                              What it means for an assignment to satisfy the program: the guessed relation contains the transitive closure of the edge relation, and meets no source-target pair.

                              Dependency graph

                              The transitive closure of the edge relation, as an assignment of the block: the least model of the two rules of the program.

                              Equations
                              Instances For
                                Dependency graph
                                Dependency graph
                                theorem DescriptiveComplexity.transGen_tRel {A : Type} [FirstOrder.Language.stGraph.Structure A] {ρ : reachBlock.Assignment A} (h1 : ∀ (x y : A), SGEdge x yTRel ρ x y) (h2 : ∀ (x y z : A), TRel ρ x ySGEdge y zTRel ρ x z) {a b : A} (h : Relation.TransGen SGEdge a b) :
                                TRel ρ a b

                                Any model of the two rules of the program contains the transitive closure of the edge relation.

                                Dependency graph

                                UNREACH is SO-Horn definable #

                                UNREACH is SO-Horn definable: the guessed relation is forced to contain the transitive closure of the edge relation, and the goal clauses forbid it to link a marked source to a marked target. The witness in the nontrivial direction is the transitive closure – the least model of the two rules.

                                Dependency graph

                                UNREACH is in PTIME, by definition of the class as SO-Horn definability.

                                Dependency graph

                                UNREACH first-order reduces to HORN-SAT, by the Horn discharge.

                                Dependency graph

                                UNREACH is FO(LFP) definable, being SO-Horn definable.

                                Dependency graph

                                REACH is FO(LFP) definable – and this is a statement the Horn fragment cannot make head-on. Reachability is the complement of the SO-Horn definable UNREACH, and complementing is free in the logic (DescriptiveComplexity.LFPDefinable.compl), while a goal clause can only reject.

                                Dependency graph

                                REACH is in PTIME after all: what the fragment cannot say head-on it can say through the equivalence with FO(LFP) (DescriptiveComplexity.SigmaSOHornDefinable.compl).

                                Dependency graph

                                UNREACH is SO-Krom definable, hence in NL #

                                The Krom fragment needs no transitive closure: it guesses the set of vertices from which a marked target is reachable, closes it under predecessors – a two-literal implication – and forbids a marked source to belong to it.

                                The block of the SO-Krom definition of UNREACH: one unary relation variable, the set of vertices from which a marked target is reachable.

                                Equations
                                Instances For
                                  Dependency graph

                                  The atom U xᵢ of the guessed set.

                                  Equations
                                  Instances For
                                    Dependency graph

                                    The literal U xᵢ, positive or negated.

                                    Equations
                                    Instances For
                                      Dependency graph
                                      Dependency graph

                                      U is closed under predecessors: an edge into U starts in U.

                                      Equations
                                      Instances For
                                        Dependency graph
                                        Dependency graph
                                        Dependency graph

                                        The set guessed by an assignment of the block.

                                        Equations
                                        Instances For
                                          Dependency graph
                                          theorem DescriptiveComplexity.unreachKromProgram_holds_iff {A : Type} [FirstOrder.Language.stGraph.Structure A] [LinearOrder A] (ρ : uBlock.Assignment A) :
                                          unreachKromProgram.Holds ρ (∀ (x : A), SGTarget xURel ρ x) (∀ (x y : A), SGEdge x yURel ρ yURel ρ x) ∀ (x : A), SGSource x¬URel ρ x

                                          What it means for an assignment to satisfy the Krom program: the guessed set contains the marked targets, is closed under predecessors, and avoids the marked sources.

                                          Dependency graph

                                          The set of vertices from which a marked target is reachable: the witness of the nontrivial direction.

                                          Equations
                                          Instances For
                                            Dependency graph
                                            Dependency graph
                                            theorem DescriptiveComplexity.uRel_of_reflTransGen {A : Type} [FirstOrder.Language.stGraph.Structure A] {ρ : uBlock.Assignment A} (h2 : ∀ (x y : A), SGEdge x yURel ρ yURel ρ x) {x y : A} (h : Relation.ReflTransGen SGEdge x y) :
                                            URel ρ yURel ρ x

                                            A set closed under predecessors and containing the marked targets contains every vertex from which a marked target is reachable.

                                            Dependency graph

                                            UNREACH is SO-Krom definable: guess the set of vertices from which a marked target is reachable. The clauses are two-literal – the closure rule is ¬U(y) ∨ U(x) – so no transitive closure has to be built, unlike in the Horn program above.

                                            Dependency graph

                                            UNREACH is in NL, by definition of the class as SO-Krom definability.

                                            Dependency graph

                                            REACH is FO(TC) definable #

                                            The canonical example of DescriptiveComplexity.TCDefinable, and the one the logic is shaped after: REACH is a transitive closure, at arity one, of the edge relation between the marked sources and the marked targets. Note the contrast with the two clausal fragments above, which define the complement head-on: here it is reachability itself that is stated, which is why closing FO(TC) under complement (Immerman–Szelepcsényi) is what REACH ∈ NL waits on.

                                            The transition formula of the walk: an edge from the current vertex to the next one.

                                            Equations
                                            Instances For
                                              Dependency graph
                                              Dependency graph
                                              Dependency graph
                                              @[reducible, inline]

                                              REACH as a single transitive closure: a walk along edges, from a marked source to a marked target.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                Dependency graph
                                                Dependency graph
                                                Dependency graph
                                                Dependency graph

                                                A path in the graph is a walk of the specification.

                                                Dependency graph

                                                A walk of the specification is a path in the graph.

                                                Dependency graph

                                                REACH is FO(TC) definable: it is a single transitive closure of the edge relation, at arity one.

                                                Dependency graph