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:
- PARITY is in LOGSPACE (
DescriptiveComplexity.parity_mem_LOGSPACE), by one deterministic walk along the order: carry a bit, flip it at each marked element. The walk isDescriptiveComplexity.parSpec, its mode is the parity of the marked elements seen so far, and it is functional outright (DescriptiveComplexity.functional_parSpec), so determinizing changes nothing (DescriptiveComplexity.TCSpec.det_accepts_iff). - PARITY is not first-order definable, even order-invariantly
(
DescriptiveComplexity.parity_not_foDefinable): EVEN is the special case where everything is marked, an FO reduction of one line (DescriptiveComplexity.evenParityInterp), and first-order definability travels backward along reductions.
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.
Dependency graph
Dependency graph
The relational vocabulary of a marked subset: a finite set with a distinguished subset of it.
Equations
- FirstOrder.Language.markedSet = { Functions := fun (x : ℕ) => Empty, Relations := FirstOrder.Language.markedSetRel }
Instances For
Dependency graph
The relation symbols of the language.
- mark : markedSetRel 1
mark x: the elementxbelongs to the marked subset.
Instances For
Dependency graph
Dependency graph
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
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.
Instances For
Dependency graph
The problem #
The marked subset of a structure.
Equations
Instances For
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
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The value of PARITY, unfolded.
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.
x is marked, as a formula over the ordered expansion.
Equations
Instances For
Dependency graph
Dependency graph
The number of marked elements up to and including x.
Equations
Instances For
Dependency graph
The mode carried at x: whether an even number of marked elements has been
seen so far.
Equations
Instances For
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
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The prefix of a minimum is the minimum itself, when it is marked.
Dependency graph
The prefix of an unmarked minimum is empty.
Dependency graph
The prefix grows by one along a cover onto a marked element.
Dependency graph
The prefix is unchanged along a cover onto an unmarked element.
Dependency graph
The mode of a marked minimum is odd.
Dependency graph
The mode of an unmarked minimum is even.
Dependency graph
The mode flips along a cover onto a marked element.
Dependency graph
The mode is unchanged along a cover onto an unmarked element.
Dependency graph
The walk reaches every element, in the mode its prefix prescribes.
Dependency graph
The mode of a reachable node is the parity of its prefix: the invariant that reads the walk backwards.
Dependency graph
The walk accepts exactly the structures whose marked subset is even: it visits every element once, from the minimum to the maximum, so the mode it ends in is the parity of the whole marked subset.
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.
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
- DescriptiveComplexity.evenParityInterp = { relFormula := fun {x : ℕ} (x_1 : FirstOrder.Language.markedSet.Relations x) (x_2 : Fin x → Unit) => ⊤ }
Instances For
Dependency graph
Every point of the interpreted structure is marked.
Dependency graph
EVEN reduces to PARITY: mark everything.
Equations
- One or more equations did not get rendered due to their size.
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.