Documentation

DescriptiveComplexity.TransitiveClosure

FO(TC): first-order logic with transitive closure #

The logic that captures nondeterministic logarithmic space on ordered structures (Immerman 1987): first-order logic extended with a transitive-closure operator. If φ(x̄, ȳ) defines a binary relation on k-tuples, then TC[x̄, ȳ. φ](ū, v̄) says that is reachable from ū in the φ-graph.

The operator as data #

As everywhere in this library, the operator is not added to Mathlib's FirstOrder.Language.BoundedFormula as a new constructor – that would mean redoing relabelling, substitution and realization for an extended syntax, and losing every existing lemma. It is kept at the Lean level instead: a DescriptiveComplexity.TCSpec bundles the arity k, a first-order transition formula over the ordered expansion with two k-tuples of free variables, and the two endpoint formulas; reachability itself is Relation.ReflTransGen, whose induction principles then do the work in proofs. This is the same move as DescriptiveComplexity.HornProgram for SO-Horn and DescriptiveComplexity.KromProgram for SO-Krom.

A single application of TC in front of a first-order matrix is not a restriction on ordered structures: Immerman's normal form makes every FO(posTC) formula equivalent to one, just as a single existential block suffices for DescriptiveComplexity.SigmaSODefinable. The library takes that normal form as the definition (DescriptiveComplexity.TCDefinable), exactly as it takes Σ₁-definability as the definition of NP rather than proving Fagin's theorem against a machine.

What this is for #

DescriptiveComplexity.NL is already defined, by the Krom fragment (DescriptiveComplexity.LogSpace), and the two coincide (DescriptiveComplexity.tcDefinable_iff_mem_NL), so FO(TC) is not set up as a second complexity class; the modes are what would make that possible, should it become useful. A walk whose state were only a tuple of elements could not be pulled back through an interpretation, whose tags vary from node to node, and could not carry the finite data a translation needs (the atom index and sign of a literal, say); carrying it in coordinates would fail on a one-element universe. FO(TC) is here as the logic in which two things are naturally stated:

The canonical example is DescriptiveComplexity.reach_tcDefinable – REACH is a TC, at arity one and with a single mode, over the edge relation between the marked sources and the marked targets.

Specifications #

A single-TC definition: the transition formula of a graph on k-tuples, together with formulas for the admissible start and end tuples. All three are first-order over the ordered expansion of the vocabulary, so that they may mention the linear order, as the ordered setting of the capture theorem allows.

Instances For
    Dependency graph
    @[reducible, inline]

    A node of the walk: a mode together with a k-tuple of elements.

    Equations
    Instances For
      Dependency graph
      def DescriptiveComplexity.TCSpec.Step {L : FirstOrder.Language} (spec : TCSpec L) {A : Type} [L.Structure A] [LinearOrder A] (a b : spec.Node A) :

      One step of the walk: the transition formula of the two modes, read with the current tuple on the left and the next one on the right.

      Equations
      Instances For
        Dependency graph
        @[reducible, inline]
        abbrev DescriptiveComplexity.TCSpec.Reach {L : FirstOrder.Language} (spec : TCSpec L) {A : Type} [L.Structure A] [LinearOrder A] :
        spec.Node Aspec.Node AProp

        Reachability in the walk: the reflexive-transitive closure of DescriptiveComplexity.TCSpec.Step.

        Equations
        Instances For
          Dependency graph

          A node is a starting node when its tuple satisfies the source formula of its mode.

          Equations
          Instances For
            Dependency graph

            A node is accepting when its tuple satisfies the target formula of its mode.

            Equations
            Instances For
              Dependency graph

              The structure is accepted: some accepting node is reachable from some starting node.

              Equations
              Instances For
                Dependency graph

                Isomorphism-invariance #

                The image of a node under an isomorphism: same mode, transported tuple.

                Equations
                Instances For
                  Dependency graph
                  theorem DescriptiveComplexity.TCSpec.step_equiv {L : FirstOrder.Language} (spec : TCSpec L) {A B : Type} [L.Structure A] [LinearOrder A] [L.Structure B] [LinearOrder B] (e : (L.sum FirstOrder.Language.order).Equiv A B) (a b : spec.Node A) :
                  spec.Step (spec.mapNode e a) (spec.mapNode e b) spec.Step a b

                  One step is preserved by an isomorphism of the ordered expansions.

                  Dependency graph
                  theorem DescriptiveComplexity.TCSpec.reach_equiv {L : FirstOrder.Language} (spec : TCSpec L) {A B : Type} [L.Structure A] [LinearOrder A] [L.Structure B] [LinearOrder B] (e : (L.sum FirstOrder.Language.order).Equiv A B) {a b : spec.Node A} (h : spec.Reach a b) :
                  spec.Reach (spec.mapNode e a) (spec.mapNode e b)

                  Reachability is preserved by an isomorphism of the ordered expansions.

                  Dependency graph

                  Acceptance is isomorphism-invariant (for isomorphisms of the ordered expansions, the order being visible to the formulas).

                  Dependency graph

                  FO(TC) definability #

                  A decision problem is FO(TC) definable if, on nonempty finite ordered structures, it is defined by a single transitive closure: there is a DescriptiveComplexity.TCSpec whose accepting tuples are reachable from its starting tuples exactly on the yes-instances.

                  As for DescriptiveComplexity.SigmaSOHornDefinable, the equivalence is required for every linear order on the universe, so this is order-invariant FO(TC) definability: the problem itself does not see the order, while the transition and endpoint formulas may.

                  Equations
                  Instances For
                    Dependency graph

                    FO(TC) definability only depends on the finite instances of a problem.

                    Dependency graph