Documentation

DescriptiveComplexity.Arithmetic

The numeric predicates: the arithmetic expansion of a vocabulary #

The vocabulary of the bottom class of the ordered world. A finite linearly ordered universe is an initial segment of , by the rank of an element (DescriptiveComplexity.orank, the number of its strict predecessors), and this file makes the arithmetic of that segment available to formulas: the language FirstOrder.Language.arith has a binary and two ternary symbols plus and times, interpreted on a finite linear order by

Relations, not functions, and therefore truncated: a sum or product that does not fit in the universe simply has no witness, and “x + y overflows” is the first-order ¬∃z, plus x y z (DescriptiveComplexity.no_plus_iff_card_le).

Why relations of the order, and not a new sort of data #

The numeric predicates are not extra input relations that an instance happens to carry: they are functions of the linear order, computed by orank. Three consequences, all of them design constraints rather than remarks.

The transport from the ordered expansion #

DescriptiveComplexity.sumOrderToArith is the language map L.sum Language.order →ᴸ L.sum Language.arith sending to , with its FirstOrder.Language.LHom.IsExpansionOn instance, so that every FO(≤) sentence and every FO(≤) gadget formula of this library can be read as an arithmetic one (DescriptiveComplexity.FODefinable.ac0Definable is the consumer).

It is stated at the level of the sum rather than as a map Language.order →ᴸ Language.arith lifted by LHom.sumMap, deliberately: Language.order.Structure is not an instance in Mathlib (it would fire on every LE), so the generic sumMap instance would have to be fed a letI-supplied structure at every use site, whereas the sum-level map has both structures available by instance search.

What is here, and what needs it #

Besides the vocabulary and its semantics: the formula builders (aLeF, aLtF, aPlusF, aTimesF, aMaxF, aMinF) with their realization lemmas, the overflow characterization, and one worked sentence – DescriptiveComplexity.evenCardSentence, which says that the universe has an even number of elements, by reading the parity of the rank of its greatest element. That sentence is what separates FO(≤) from AC⁰ (DescriptiveComplexity.Problems.Even), and it is the smallest example of the one thing the numeric predicates buy over a bare order: access to the size of the universe, one bit at a time.

Relation symbols of the arithmetic vocabulary.

  • le : arithRel 2

    le x y: the rank of x is at most the rank of y, i.e., x ≤ y.

  • plus : arithRel 3

    plus x y z: the ranks satisfy orank x + orank y = orank z.

  • times : arithRel 3

    times x y z: the ranks satisfy orank x * orank y = orank z.

Instances For
    Dependency graph
    Dependency graph
    Dependency graph

    The relational vocabulary of the numeric predicates: a linear order and the graphs of addition and multiplication of ranks. Interpreted canonically on every finite linear order by DescriptiveComplexity.arithStructure.

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

      The order symbol of the arithmetic vocabulary.

      Equations
      Instances For
        Dependency graph
        @[reducible, inline]

        The addition symbol of the arithmetic vocabulary.

        Equations
        Instances For
          Dependency graph
          @[reducible, inline]

          The multiplication symbol of the arithmetic vocabulary.

          Equations
          Instances For
            Dependency graph

            The canonical interpretation on a finite linear order #

            @[instance_reducible]

            The numeric predicates of a finite linear order: is the order, and plus/times are the graphs of addition and multiplication of ranks. Both are truncated: a value that is not the rank of an element of A is not related to anything.

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

            The symbols of the arithmetic expansion of a vocabulary #

            @[reducible, inline]

            The order symbol, in the arithmetic expansion of L.

            Equations
            Instances For
              Dependency graph
              @[reducible, inline]

              The addition symbol, in the arithmetic expansion of L.

              Equations
              Instances For
                Dependency graph
                @[reducible, inline]

                The multiplication symbol, in the arithmetic expansion of L.

                Equations
                Instances For
                  Dependency graph

                  The numeric predicates of the arithmetic expansion #

                  Dependency graph
                  Dependency graph
                  Dependency graph

                  The transport of an ordered formula into the arithmetic expansion #

                  The arithmetic expansion extends the ordered one: the language map sending the order symbol of Language.order to the order symbol of Language.arith, and every input symbol to itself.

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

                    The transport is an expansion: both vocabularies read as the order and the input symbols as themselves.

                    Dependency graph

                    Formula builders #

                    x ≤ y, as a formula over the arithmetic expansion.

                    Equations
                    Instances For
                      Dependency graph

                      x < y, as a formula over the arithmetic expansion.

                      Equations
                      Instances For
                        Dependency graph

                        x + y = z, as a formula over the arithmetic expansion.

                        Equations
                        Instances For
                          Dependency graph
                          Dependency graph
                          Dependency graph
                          Dependency graph
                          @[simp]
                          theorem DescriptiveComplexity.realize_aLeF {L : FirstOrder.Language} {α A : Type} [L.Structure A] [LinearOrder A] {v : αA} (x y : α) :
                          (aLeF x y).Realize v v x v y
                          Dependency graph
                          @[simp]
                          theorem DescriptiveComplexity.realize_aLtF {L : FirstOrder.Language} {α A : Type} [L.Structure A] [LinearOrder A] {v : αA} (x y : α) :
                          (aLtF x y).Realize v v x < v y
                          Dependency graph
                          @[simp]
                          theorem DescriptiveComplexity.realize_aPlusF {L : FirstOrder.Language} {α A : Type} [L.Structure A] [LinearOrder A] {v : αA} (x y z : α) :
                          (aPlusF x y z).Realize v orank (v x) + orank (v y) = orank (v z)
                          Dependency graph
                          @[simp]
                          theorem DescriptiveComplexity.realize_aTimesF {L : FirstOrder.Language} {α A : Type} [L.Structure A] [LinearOrder A] {v : αA} (x y z : α) :
                          (aTimesF x y z).Realize v orank (v x) * orank (v y) = orank (v z)
                          Dependency graph
                          @[simp]
                          theorem DescriptiveComplexity.realize_aMinF {L : FirstOrder.Language} {α A : Type} [L.Structure A] [LinearOrder A] {v : αA} (x : α) :
                          (aMinF x).Realize v ∀ (a : A), v x a
                          Dependency graph
                          @[simp]
                          theorem DescriptiveComplexity.realize_aMaxF {L : FirstOrder.Language} {α A : Type} [L.Structure A] [LinearOrder A] {v : αA} (x : α) :
                          (aMaxF x).Realize v ∀ (a : A), a v x
                          Dependency graph

                          Ranks, minima and covers #

                          The order facts every walk over the ranks needs, stated once here because both routes to a complexity bound use them: the induction of DescriptiveComplexity.ArithmeticFixedPoint and the head programs of DescriptiveComplexity.HeadArith.

                          theorem DescriptiveComplexity.isMin_of_orank_eq_zero {A : Type} [LinearOrder A] [Finite A] {z : A} (h : orank z = 0) (a : A) :
                          z a

                          An element of rank 0 is least.

                          Dependency graph
                          theorem DescriptiveComplexity.orank_eq_succ_of_pred {A : Type} [LinearOrder A] [Finite A] {y' y : A} (h1 : y' < y) (h2 : ∀ (a : A), ¬(y' < a a < y)) :
                          orank y = orank y' + 1

                          The rank of an element with an immediate predecessor is one more.

                          Dependency graph
                          theorem DescriptiveComplexity.covBy_of_orank_succ {A : Type} [LinearOrder A] [Finite A] {w z : A} (h : orank z = orank w + 1) :
                          w z

                          A rank one higher is a cover: the converse of DescriptiveComplexity.orank_covBy, which is what lets a walk step a head by choosing the element of the next rank.

                          Dependency graph
                          theorem DescriptiveComplexity.exists_pred_of_orank_succ {A : Type} [LinearOrder A] [Finite A] {z : A} {k : } (h : orank z = k + 1) :
                          ∃ (z' : A), orank z' = k z' < z ∀ (a : A), ¬(z' < a a < z)

                          An element of positive rank has an immediate predecessor, of the rank below.

                          Dependency graph

                          Truncation, and the size of the universe #

                          theorem DescriptiveComplexity.no_plus_iff_card_le {A : Type} [LinearOrder A] [Finite A] (x y : A) :
                          (¬∃ (z : A), orank x + orank y = orank z) Nat.card A orank x + orank y

                          Addition is truncated at the size of the universe: a sum has a witness exactly when it is small enough to be a rank. This is what makes “x + y overflows” a first-order statement.

                          Dependency graph
                          theorem DescriptiveComplexity.even_card_iff_forall_isTop {A : Type} [LinearOrder A] [Finite A] [Nonempty A] :
                          Even (Nat.card A) ∀ (z : A), (∀ (a : A), a z)¬∃ (h : A), orank h + orank h = orank z

                          The parity of the universe is a numeric predicate. The greatest element has rank Nat.card A - 1, so the universe has an even number of elements exactly when no element doubles to the greatest one. The order alone cannot say this (DescriptiveComplexity.even_not_foDefinable); addition can.

                          Dependency graph

                          A sentence for the parity of the universe #

                          The universe has an even number of elements, as a sentence of the arithmetic expansion: no maximum is the double of anything. The two quantifiers are the whole sentence – nothing about the input vocabulary is read, so this is a statement about the size of the instance, which is exactly what a bare order cannot express and the numeric predicates can.

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