Documentation

DescriptiveComplexity.Problems.Parity

PARITY: the parity of a marked subset #

The problem the switching lemma is about, and the one DescriptiveComplexity.EVEN must not be confused with. The vocabulary is a single unary predicate, so an instance is a finite set with a marked subset, and the question is whether the marked subset has an even number of elements.

Why it is here, given that EVEN is already here #

DescriptiveComplexity.EVEN asks the parity of the universe – of the input's length – and that is AC⁰: an AC⁰ circuit family is indexed by the length, and in the logic the numeric predicates read the top rank (DescriptiveComplexity.even_ac0Definable). PARITY asks the parity of part of the input, and is the classical example of a problem outside AC⁰ (Ajtai 1983; Furst, Saxe & Sipser 1984; Håstad 1986). Keeping both in the catalog is what makes the distinction concrete rather than a warning in a docstring.

What is proved here is the easy side of that separation, and it is worth having on its own:

What would finish the story, and is not here #

AC⁰ ⊊ LOGSPACE is now one theorem away: PARITY ∉ AC⁰. That theorem is the switching lemma (Håstad 1986), a major formalization on its own, and nothing in this library proves any AC⁰ lower bound. The gap is deliberate and documented; what is recorded here is that the other three sides of the square – PARITY in LOGSPACE, PARITY not in FO(≤), EVEN in AC⁰, AC⁰ inside PTIME – are theorems.

The relation symbols of the language.

Instances For
    Dependency graph
    Dependency graph

    The relational vocabulary of a marked subset: a finite set with a distinguished subset of it.

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

      mark x: the element x belongs to the marked subset.

      Equations
      Instances For
        Dependency graph
        def FirstOrder.Language.instDecidableEqMarkedSetRel.decEq {a✝ : ℕ} (x✝ x✝¹ : markedSetRel a✝) :
        Decidable (x✝ = x✝¹)
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          Dependency graph
          @[reducible, inline]

          The marking symbol, in the ordered expansion. Sum-language symbols are referenced through an abbreviation with a declared type, never as a raw Sum.inl, or rw fails to match at implicit transparency.

          Equations
          Instances For
            Dependency graph

            The problem #

            Dependency graph
            Dependency graph

            PARITY: the marked subset has an even number of elements. Contrast DescriptiveComplexity.EVEN, which asks this of the universe: that one is AC⁰, this one is the classical AC⁰ lower bound.

            Equations
            Instances For
              Dependency graph
              Dependency graph

              PARITY is a deterministic walk #

              One bit, one element, one pass along the order: the mode is the parity of the marked elements up to and including the current one, so it flips exactly at a marked element. Both the successor and the new mode are determined by the current node, which is why the walk is functional and the determinization is free.

              Dependency graph
              @[simp]
              Dependency graph

              The transition of the parity walk: step to the immediate successor, and flip the mode exactly when the element stepped onto is marked.

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

                The walk starts at the minimum, in the mode that element prescribes: even unless the minimum is itself marked.

                Equations
                Instances For
                  Dependency graph

                  The walk accepts at the maximum, in the even mode.

                  Equations
                  Instances For
                    Dependency graph

                    PARITY as a single walk: one element, one bit, flipped at the marked elements.

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

                      The walk is functional: the successor of an element is unique in a finite linear order, and the new mode is determined by its markedness.

                      Dependency graph

                      PARITY is FO(DTC) definable, by the deterministic parity walk: the determinization changes nothing, the walk being functional.

                      Dependency graph

                      PARITY is in LOGSPACE. With DescriptiveComplexity.parity_not_foDefinable below, and the AC⁰ layer, this is three of the four sides of AC⁰ ⊊ LOGSPACE; the fourth is PARITY ∉ AC⁰, which this library does not prove. Registered in the Lax archive as Lax945089.ParityInLogSpace.parity_mem_LOGSPACE.

                      Dependency graph

                      EVEN is the special case where everything is marked #

                      The interpretation marking every element: EVEN read as an instance of PARITY, one dimension and one tag.

                      Equations
                      Instances For
                        Dependency graph

                        Every point of the interpreted structure is marked.

                        Dependency graph

                        EVEN reduces to PARITY: mark everything.

                        Equations
                        Instances For
                          Dependency graph

                          PARITY is not first-order definable, even order-invariantly: EVEN is not (DescriptiveComplexity.even_not_foDefinable), and it reduces to PARITY. Registered in the Lax archive as Lax945089.ParityInLogSpace.parity_not_foDefinable.

                          Dependency graph