Documentation

DescriptiveComplexity.Problems.Game.Membership

GAME is in PTIME #

The membership half: DescriptiveComplexity.GAME is FO(LFP) definable (DescriptiveComplexity.game_lfpDefinable), hence in DescriptiveComplexity.PTIME by the Immerman–Vardi capture theorem the library already carries.

Why a second relation variable is needed #

The winning set is a least fixed point, and two of its three clauses are Horn rules already. The third is not:

a universal node wins when it has a successor and every successor wins

has a universally quantified body, and a DescriptiveComplexity.HornClause carries a list of atoms, not a quantified one. The standard repair is to walk the order: a second variable allge x y – “every successor of x that is ≥ y wins” – is computed by a downward induction along the linear order, from the greatest element to the least, one immediate predecessor at a time (DescriptiveComplexity.order_induction_down). At the least element it says “every successor of x wins”, which is the body the third clause wanted.

That this stays a least fixed point is the point of doing it this way: allge is derivable exactly when the winners it quantifies over are already derived, so nothing is derived early and the two variables grow together.

@[reducible, inline]

The ordered expansion of the vocabulary of AND/OR graphs.

Equations
Instances For
    Dependency graph

    The block #

    The relation variables the fixed point computes.

    • win : GIx

      win x: the node x is winning.

    • allge : GIx

      allge x y: every successor of x that is at least y is winning.

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

      The block of the fixed point: the winning set, and the scan that collects a universal node's successors from the greatest element downwards.

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

        The guards #

        noncomputable def DescriptiveComplexity.Game.wonG {α : Type} (x : α) :

        The node x wins outright, as a guard.

        Equations
        Instances For
          Dependency graph
          noncomputable def DescriptiveComplexity.Game.univG {α : Type} (x : α) :

          The node x belongs to the universal player, as a guard.

          Equations
          Instances For
            Dependency graph
            noncomputable def DescriptiveComplexity.Game.startG {α : Type} (x : α) :

            The node x is a marked start, as a guard.

            Equations
            Instances For
              Dependency graph
              noncomputable def DescriptiveComplexity.Game.moveG {α : Type} (x y : α) :

              There is a move from x to y, as a guard.

              Equations
              Instances For
                Dependency graph
                Dependency graph
                Dependency graph
                Dependency graph
                @[simp]
                theorem DescriptiveComplexity.Game.realize_moveG {α A : Type} [FirstOrder.Language.andOrGraph.Structure A] [LinearOrder A] {v : αA} (x y : α) :
                (moveG x y).Realize v AGMove (v x) (v y)
                Dependency graph

                The rules #

                A node that wins outright is winning.

                Equations
                Instances For
                  Dependency graph

                  An existential node with a winning successor is winning.

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

                    A universal node with a successor, all of whose successors are winning, is winning: the scan has reached the least element.

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

                      The scan starts at the greatest element, which is not a successor.

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

                        The scan starts at the greatest element, which is a winning successor.

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

                          The scan steps down past an element that is not a successor.

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

                            The scan steps down past a winning successor.

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

                              The rules of the definition.

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

                                The output #

                                The output: some marked start is winning.

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

                                  The intended fixed point #

                                  The assignment the rules are meant to compute.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    Dependency graph
                                    theorem DescriptiveComplexity.Game.gameAssign_closed {A : Type} [FirstOrder.Language.andOrGraph.Structure A] [LinearOrder A] (c : HornClause agOrd gameBlock 3) :
                                    c gameRules∀ (a : SOAtom gameBlock 3), c.head = some a∀ (v : Fin 3A), c.guard.Realize v(∀ bc.body, b.Holds (gameAssign A) v)a.Holds (gameAssign A) v

                                    The intended assignment is closed under the rules, so the least fixed point is contained in it.

                                    Dependency graph

                                    Soundness: everything the rules derive about win is winning.

                                    Dependency graph

                                    Completeness: every winning node is derived #

                                    theorem DescriptiveComplexity.Game.allgeArgs₁ {A : Type} (x y w : A) :
                                    (fun (j : Fin (gameBlock.arity (allgeAt 0 1).idx)) => ![x, y, w] ((allgeAt 0 1).args j)) = ![x, y]

                                    The arguments of allge x y read out of the three variables.

                                    Dependency graph
                                    theorem DescriptiveComplexity.Game.allgeArgs₂ {A : Type} (x y w : A) :
                                    (fun (j : Fin (gameBlock.arity (allgeAt 0 2).idx)) => ![x, y, w] ((allgeAt 0 2).args j)) = ![x, w]

                                    The arguments of allge x z read out of the three variables.

                                    Dependency graph

                                    The scan is derivable at every element, by a downward induction along the order: this is the universal body the third rule needs.

                                    Dependency graph

                                    Completeness: every winning node is derived.

                                    Dependency graph

                                    Reading the output: some marked start is in the fixed point.

                                    Dependency graph

                                    GAME is FO(LFP) definable: the winning set is the least fixed point of the three clauses, the universal one carried by a scan of the order.

                                    Dependency graph

                                    GAME is in PTIME, through the formalized translation of FO(LFP) into the Horn fragment.

                                    Dependency graph