Documentation

DescriptiveComplexity.Problems.DagIso.FromDigraphIso

Digraph Isomorphism reduces to DAG Isomorphism #

The substantial half of GI-completeness: an arbitrary directed graph is turned into a DAG whose isomorphisms are exactly the isomorphisms of the graph. Every arc is subdivided twice,

  u  ⟶  a(u,v)  ⟶  b(u,v)  ⟵  v

so that the arc u ⟶ v becomes a three-level pattern: the tail u points at the middle node a(u,v), which points at the end node b(u,v), which the head v also points at. Subdividing once would not do – with a single node per arc the two endpoints would be interchangeable and the direction of the arc lost; here the tail is the vertex pointing at a middle node and the head the vertex pointing at an end node.

The construction is acyclic by inspection: every arc goes from level 0 (vertices) to level 1 (middle nodes) or level 2 (end nodes), or from level 1 to level 2. That is also the topological order the instance must carry, and it needs no formula at all – it is read off the tags (DescriptiveComplexity.DagIso.ltF), which is why the reduction stays order-free: FirstOrder.Language.twoGraphs carries its own vertex marks, so the same gadget runs on the pattern side and on the host side inside a single interpretation, junk staying unmarked.

The three levels are recovered from the arcs alone, without any counting: a vertex node is one with no incoming arc, an end node one with an incoming but no outgoing arc, and a middle node has both (DescriptiveComplexity.DagIso.pat_no_in_vPt and its siblings). An isomorphism of the two DAGs therefore preserves the levels, and reading it on level 0 gives the isomorphism of the graphs.

The tags: the three levels of the construction #

The three kinds of node of the gadget: a vertex, the middle node of an arc, the end node of an arc.

  • vtx : NodeTag

    A copy of a vertex of the input graph (level 0).

  • arcMid : NodeTag

    The middle node a(u,v) of an arc u ⟶ v (level 1).

  • arcEnd : NodeTag

    The end node b(u,v) of an arc u ⟶ v (level 2).

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

    The defining formulas #

    Being a node of the gadget, for one side of the instance: a vertex node is a diagonal pair whose entry is a marked vertex, and an arc node is a pair that is an arc between two marked vertices.

    Equations
    Instances For
      Dependency graph

      The arcs of the gadget: u ⟶ a(u,v), a(u,v) ⟶ b(u,v) and v ⟶ b(u,v), and nothing else.

      Equations
      Instances For
        Dependency graph
        Dependency graph

        The interpretation of Digraph Isomorphism into DAG Isomorphism: two dimensions (an arc is a pair), three tags (the three levels), the same gadget run on the pattern side and on the host side.

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

          The points of the gadget #

          A point at the vertex level; it is a node only when its two coordinates agree (DescriptiveComplexity.DagIso.pat_vPt2).

          Equations
          Instances For
            Dependency graph

            The vertex node of a vertex.

            Equations
            Instances For
              Dependency graph
              Dependency graph
              Dependency graph
              theorem DescriptiveComplexity.DagIso.two_eta {A : Type} (w : Fin 2A) :
              w = ![w 0, w 1]
              Dependency graph
              theorem DescriptiveComplexity.DagIso.vtx_eta {A : Type} (w : Fin 2A) :
              (NodeTag.vtx, w) = vPt2 (w 0) (w 1)

              A point of the vertex level, in named form.

              Dependency graph
              theorem DescriptiveComplexity.DagIso.mid_eta {A : Type} (w : Fin 2A) :
              (NodeTag.arcMid, w) = midPt (w 0) (w 1)

              A point of the middle level, in named form.

              Dependency graph
              theorem DescriptiveComplexity.DagIso.end_eta {A : Type} (w : Fin 2A) :
              (NodeTag.arcEnd, w) = endPt (w 0) (w 1)

              A point of the end level, in named form.

              Dependency graph
              Dependency graph
              theorem DescriptiveComplexity.DagIso.midPt_inj {A : Type} {u v u' v' : A} (h : midPt u v = midPt u' v') :
              u = u' v = v'
              Dependency graph

              What the gadget builds, on the pattern side #

              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph
              theorem DescriptiveComplexity.DagIso.patV_cases {A : Type} [FirstOrder.Language.twoGraphs.Structure A] {p : incInterp.Map A} (h : TDPatV p) :
              (∃ (v : A), TGPatV v p = vPt v) (∃ (u : A) (v : A), (TGPatV u TGPatV v TGPatE u v) p = midPt u v) ∃ (u : A) (v : A), (TGPatV u TGPatV v TGPatE u v) p = endPt u v

              A pattern node is a vertex node, a middle node or an end node. The hypothesis is unfolded by rcases rather than by rw: the defining formula's realization is definitionally a conjunction, and a pair literal at FOInterpretation.Map type does not match at rewriting transparency.

              Dependency graph

              The only arcs are the three of the gadget: the tags of an arc's endpoints climb the three levels. The six forbidden tag combinations need no argument – their defining formula is , so the hypothesis is False.

              Dependency graph

              Nothing points at a vertex node: level 0 is the bottom.

              Dependency graph

              An end node points at nothing: level 2 is the top.

              Dependency graph

              Two middle nodes are never joined: they sit at the same level.

              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph

              What the gadget builds, on the host side #

              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph
              theorem DescriptiveComplexity.DagIso.hostV_cases {A : Type} [FirstOrder.Language.twoGraphs.Structure A] {p : incInterp.Map A} (h : TDHostV p) :
              (∃ (v : A), TGHostV v p = vPt v) (∃ (u : A) (v : A), (TGHostV u TGHostV v TGHostE u v) p = midPt u v) ∃ (u : A) (v : A), (TGHostV u TGHostV v TGHostE u v) p = endPt u v

              A host node is a vertex node, a middle node or an end node. The hypothesis is unfolded by rcases rather than by rw: the defining formula's realization is definitionally a conjunction, and a pair literal at FOInterpretation.Map type does not match at rewriting transparency.

              Dependency graph

              The only arcs are the three of the gadget: the tags of an arc's endpoints climb the three levels. The six forbidden tag combinations need no argument – their defining formula is , so the hypothesis is False.

              Dependency graph

              Nothing points at a vertex node: level 0 is the bottom.

              Dependency graph

              An end node points at nothing: level 2 is the top.

              Dependency graph

              Two middle nodes are never joined: they sit at the same level.

              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph

              The gadget is acyclic: the levels #

              Dependency graph
              Dependency graph
              Dependency graph

              Arcs climb the levels, on the pattern side.

              Dependency graph

              Arcs climb the levels, on the host side.

              Dependency graph

              The pattern side of the image is a DAG, with the carried order as witness: the order is the level comparison, so irreflexivity and transitivity are those of < on , and every arc climbs a level.

              Dependency graph
              Dependency graph

              From an isomorphism of the graphs to one of the DAGs #

              A map of the universe, lifted to the nodes of the gadget: it keeps the level and acts on both coordinates.

              Equations
              Instances For
                Dependency graph
                @[simp]
                theorem DescriptiveComplexity.DagIso.liftMap_vPt {A : Type} (g : AA) (v : A) :
                liftMap g (vPt v) = vPt (g v)
                Dependency graph
                @[simp]
                theorem DescriptiveComplexity.DagIso.liftMap_midPt {A : Type} (g : AA) (u v : A) :
                liftMap g (midPt u v) = midPt (g u) (g v)
                Dependency graph
                @[simp]
                theorem DescriptiveComplexity.DagIso.liftMap_endPt {A : Type} (g : AA) (u v : A) :
                liftMap g (endPt u v) = endPt (g u) (g v)
                Dependency graph
                theorem DescriptiveComplexity.DagIso.liftMap_tag {A : Type} (g : AA) (p : incInterp.Map A) :
                (liftMap g p).1 = p.1
                Dependency graph

                Both coordinates of a pattern node are marked vertices.

                Dependency graph
                theorem DescriptiveComplexity.DagIso.relIsoOn_map {A : Type} [FirstOrder.Language.twoGraphs.Structure A] (g : AA) (hmaps : ∀ (x : A), TGPatV xTGHostV (g x)) (hinj : ∀ (x y : A), TGPatV xTGPatV yg x = g yx = y) (hsurj : ∀ (y : A), TGHostV y∃ (x : A), TGPatV x g x = y) (hedge : ∀ (x y : A), TGPatV xTGPatV y → (TGPatE x y TGHostE (g x) (g y))) :

                The gadget is functorial and faithful: an isomorphism of the two marked graphs lifts, level by level, to an isomorphism of the two DAGs. The six combinations of levels that carry no arc are dispatched by the level lemmas, the three that do by the corresponding characterizations.

                Dependency graph

                From an isomorphism of the DAGs back to one of the graphs #

                theorem DescriptiveComplexity.DagIso.image_vPt {A : Type} [FirstOrder.Language.twoGraphs.Structure A] (F : incInterp.Map AincInterp.Map A) (hmaps : ∀ (p : incInterp.Map A), TDPatV pTDHostV (F p)) (hsurj : ∀ (q : incInterp.Map A), TDHostV q∃ (p : incInterp.Map A), TDPatV p F p = q) (hedge : ∀ (p q : incInterp.Map A), TDPatV pTDPatV q → (TDPatArc p q TDHostArc (F p) (F q))) {v : A} (hv : TGPatV v) :
                ∃ (w : A), TGHostV w F (vPt v) = vPt w

                An isomorphism of the DAGs sends vertex nodes to vertex nodes: they are the nodes nothing points at, and that is preserved because every host node is the image of a pattern node.

                Dependency graph
                theorem DescriptiveComplexity.DagIso.image_endPt_no_out {A : Type} [FirstOrder.Language.twoGraphs.Structure A] (F : incInterp.Map AincInterp.Map A) (hsurj : ∀ (q : incInterp.Map A), TDHostV q∃ (p : incInterp.Map A), TDPatV p F p = q) (hedge : ∀ (p q : incInterp.Map A), TDPatV pTDPatV q → (TDPatArc p q TDHostArc (F p) (F q))) {x y : A} (he : TDPatV (endPt x y)) (q : incInterp.Map A) (hq : TDHostV q) :
                ¬TDHostArc (F (endPt x y)) q

                Nothing follows the image of an end node: end nodes are the nodes with no outgoing arc, and that too is preserved.

                Dependency graph
                theorem DescriptiveComplexity.DagIso.image_midPt_shape {A : Type} [FirstOrder.Language.twoGraphs.Structure A] (F : incInterp.Map AincInterp.Map A) (hmaps : ∀ (p : incInterp.Map A), TDPatV pTDHostV (F p)) (hedge : ∀ (p q : incInterp.Map A), TDPatV pTDPatV q → (TDPatArc p q TDHostArc (F p) (F q))) {x y : A} (hx : TGPatV x) (hy : TGPatV y) (hxy : TGPatE x y) :
                ∃ (x' : A) (y' : A), (TGHostV x' TGHostV y' TGHostE x' y') F (midPt x y) = midPt x' y'

                The image of a middle node is a middle node: it has both an incoming and an outgoing arc, which no other level has.

                Dependency graph
                theorem DescriptiveComplexity.DagIso.image_endPt_shape {A : Type} [FirstOrder.Language.twoGraphs.Structure A] (F : incInterp.Map AincInterp.Map A) (hmaps : ∀ (p : incInterp.Map A), TDPatV pTDHostV (F p)) (hsurj : ∀ (q : incInterp.Map A), TDHostV q∃ (p : incInterp.Map A), TDPatV p F p = q) (hedge : ∀ (p q : incInterp.Map A), TDPatV pTDPatV q → (TDPatArc p q TDHostArc (F p) (F q))) {x y : A} (hx : TGPatV x) (hy : TGPatV y) (hxy : TGPatE x y) :
                ∃ (x' : A) (y' : A), (TGHostV x' TGHostV y' TGHostE x' y') F (endPt x y) = endPt x' y'

                The image of an end node is an end node.

                Dependency graph
                theorem DescriptiveComplexity.DagIso.image_midPt_eq {A : Type} [FirstOrder.Language.twoGraphs.Structure A] (F : incInterp.Map AincInterp.Map A) (hmaps : ∀ (p : incInterp.Map A), TDPatV pTDHostV (F p)) (hsurj : ∀ (q : incInterp.Map A), TDHostV q∃ (p : incInterp.Map A), TDPatV p F p = q) (hedge : ∀ (p q : incInterp.Map A), TDPatV pTDPatV q → (TDPatArc p q TDHostArc (F p) (F q))) (g : AA) (hg : ∀ (v : A), TGPatV vTGHostV (g v) F (vPt v) = vPt (g v)) {x y : A} (hx : TGPatV x) (hy : TGPatV y) (hxy : TGPatE x y) :
                F (midPt x y) = midPt (g x) (g y) F (endPt x y) = endPt (g x) (g y)

                The image of the middle node of an arc is the middle node of the image arc: the tail is pinned by the arc from the tail's vertex node, the head by the arc from the head's vertex node through the end node.

                Dependency graph

                Correctness of the reduction #

                Reading an isomorphism of the DAGs on level 0: it maps vertex nodes to vertex nodes, so it restricts to a bijection of the marked vertices, and the arcs of the graphs are recovered from the arcs of the gadget through the middle and end nodes.

                Dependency graph

                Correctness of the reduction: the two graphs are isomorphic exactly when the two DAGs built from them are.

                Dependency graph

                Digraph Isomorphism FO-reduces to DAG Isomorphism: subdivide every arc twice, and carry the level comparison as the topological order. Two dimensions, three tags, and no order on the input – the reduction is order-free, as every reduction between isomorphism problems must be.

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