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.
- edge : stGraphRel 2
edge a b: there is an edge fromatob. - source : stGraphRel 1
source a: the vertexais a marked source. - target : stGraphRel 1
target a: the vertexais a marked target.
Instances For
Dependency graph
Dependency graph
Equations
- One or more equations did not get rendered due to their size.
- FirstOrder.Language.instDecidableEqStGraphRel.decEq FirstOrder.Language.stGraphRel.edge FirstOrder.Language.stGraphRel.edge = isTrue FirstOrder.Language.instDecidableEqStGraphRel.decEq._proof_1
Instances For
Dependency graph
The relational vocabulary of directed graphs with marked sources and targets.
Equations
- FirstOrder.Language.stGraph = { Functions := fun (x : ℕ) => Empty, Relations := FirstOrder.Language.stGraphRel }
Instances For
Dependency graph
Dependency graph
The edge symbol.
Instances For
Dependency graph
The marked-source symbol.
Instances For
Dependency graph
The marked-target symbol.
Instances For
Dependency graph
The edge symbol in the ordered expansion.
Instances For
Dependency graph
The marked-source symbol in the ordered expansion.
Instances For
Dependency graph
The marked-target symbol in the ordered expansion.
Instances For
Dependency graph
The problem #
The edge relation of a marked graph.
Equations
Instances For
Dependency graph
Being a marked source.
Equations
Instances For
Dependency graph
Being a marked target.
Equations
Instances For
Dependency graph
Some marked target is reachable from some marked source, along a (possibly empty) directed path.
Equations
- DescriptiveComplexity.Reachable A = ∃ (s : A) (t : A), DescriptiveComplexity.SGSource s ∧ DescriptiveComplexity.SGTarget t ∧ Relation.ReflTransGen DescriptiveComplexity.SGEdge s t
Instances For
Dependency graph
Reachability is isomorphism-invariant.
Dependency graph
REACH, as a problem on graphs with marked sources and targets.
Equations
- DescriptiveComplexity.REACH = { Holds := fun (A : Type) (inst : FirstOrder.Language.stGraph.Structure A) => DescriptiveComplexity.Reachable A, iso_invariant := ⋯ }
Instances For
Dependency graph
UNREACH, the complement of REACH: no marked target is reachable from a marked source.
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.
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
The guard source xᵢ.
Equations
Instances For
Dependency graph
The guard target xᵢ.
Equations
Instances For
Dependency graph
Base rule: an edge is in T.
Equations
- DescriptiveComplexity.reachC1 = { guard := DescriptiveComplexity.edgeG 0 1, body := [], head := some (DescriptiveComplexity.tAtom 0 1) }
Instances For
Dependency graph
Inductive rule: T is closed under appending an edge.
Equations
- DescriptiveComplexity.reachC2 = { guard := DescriptiveComplexity.edgeG 1 2, body := [DescriptiveComplexity.tAtom 0 1], head := some (DescriptiveComplexity.tAtom 0 2) }
Instances For
Dependency graph
Goal clause: no marked target is in T from a marked source.
Equations
- DescriptiveComplexity.reachC3 = { guard := DescriptiveComplexity.sourceG 0 ⊓ DescriptiveComplexity.targetG 1, body := [DescriptiveComplexity.tAtom 0 1], head := none }
Instances For
Dependency graph
Goal clause: no vertex is both a marked source and a marked target (the empty path).
Equations
- DescriptiveComplexity.reachC4 = { guard := DescriptiveComplexity.sourceG 0 ⊓ DescriptiveComplexity.targetG 0, body := [], head := none }
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.
Instances For
Dependency graph
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
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.
Instances For
Dependency graph
The atom U xᵢ of the guessed set.
Instances For
Dependency graph
The literal U xᵢ, positive or negated.
Equations
- DescriptiveComplexity.uLit i pos = { atom := DescriptiveComplexity.uAtom i, positive := pos }
Instances For
Dependency graph
A marked target belongs to U.
Equations
- DescriptiveComplexity.unreachK1 = { guard := DescriptiveComplexity.targetG 0, lit₁ := some (DescriptiveComplexity.uLit 0 true), lit₂ := none }
Instances For
Dependency graph
U is closed under predecessors: an edge into U starts in U.
Equations
- DescriptiveComplexity.unreachK2 = { guard := DescriptiveComplexity.edgeG 0 1, lit₁ := some (DescriptiveComplexity.uLit 1 false), lit₂ := some (DescriptiveComplexity.uLit 0 true) }
Instances For
Dependency graph
No marked source belongs to U.
Equations
- DescriptiveComplexity.unreachK3 = { guard := DescriptiveComplexity.sourceG 0, lit₁ := some (DescriptiveComplexity.uLit 0 false), lit₂ := none }
Instances For
Dependency graph
The Krom program defining UNREACH.
Equations
Instances For
Dependency graph
The set guessed by an assignment of the block.
Instances For
Dependency graph
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
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
The starting tuples of the walk: the marked sources.
Equations
Instances For
Dependency graph
The accepting tuples of the walk: the marked targets.
Equations
Instances For
Dependency graph
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.