Documentation

DescriptiveComplexity.Counting.Digits.Formulas

Arithmetic on numbers given by formulas #

A number is given by a formula ν with a distinguished block of ℓ variables, the position: under a valuation of the other variables, ν holds of the positions of the digits 1, a position being an ℓ-tuple of elements and the positions being ordered lexicographically. This file builds, from such formulas, the formulas of

and identifies what they hold of (DescriptiveComplexity.Digits.AddSet, DescriptiveComplexity.Digits.DblSet) with the digits of the sum and of the double (DescriptiveComplexity.Digits.addSet_tupBits, DescriptiveComplexity.Digits.dblSet_tupBits). The numbers are read modulo 2 ^ (n ^ ℓ), n being the size of the structure, and the operations are exact modulo that.

The vocabulary N of the formulas is arbitrary; it receives the ordered vocabulary through a map ι, along which the order formulas of DescriptiveComplexity.OrderWalk are read.

Sets of positions #

def DescriptiveComplexity.Digits.tupBits {A : Type} [LinearOrder A] {ℓ : ℕ} (n : ℕ) (p : Fin ℓ → A) :

The positions of the digits 1 of a number, the positions being the ℓ-tuples in lexicographic order.

Equations
Instances For
    Dependency graph
    def DescriptiveComplexity.Digits.AddSet {A : Type} [LinearOrder A] {ℓ : ℕ} (X Y : (Fin ℓ → A) → Prop) (p : Fin ℓ → A) :

    The sum of two sets of positions, by carry lookahead.

    Equations
    Instances For
      Dependency graph
      def DescriptiveComplexity.Digits.DblSet {A : Type} [LinearOrder A] {ℓ : ℕ} (X : (Fin ℓ → A) → Prop) (p : Fin ℓ → A) :

      The double of a set of positions: its shift by one position.

      Equations
      Instances For
        Dependency graph
        Dependency graph
        Dependency graph

        The formulas #

        The exclusive or of two formulas.

        Equations
        Instances For
          Dependency graph
          def DescriptiveComplexity.Digits.atQ {N : FirstOrder.Language} {ℓ : ℕ} {γ : Type} (ν : N.Formula (γ ⊕ Fin ℓ)) :
          N.Formula ((γ ⊕ Fin ℓ) ⊕ Fin ℓ)

          A number formula, read at the position bound by one more quantifier block.

          Equations
          Instances For
            Dependency graph
            def DescriptiveComplexity.Digits.atR {N : FirstOrder.Language} {ℓ : ℕ} {γ : Type} (ν : N.Formula (γ ⊕ Fin ℓ)) :
            N.Formula (((γ ⊕ Fin ℓ) ⊕ Fin ℓ) ⊕ Fin ℓ)

            A number formula, read at the position bound by a second quantifier block.

            Equations
            Instances For
              Dependency graph
              noncomputable def DescriptiveComplexity.Digits.carryF {K N : FirstOrder.Language} (ι : K.sum FirstOrder.Language.order →ᴸ N) {ℓ : ℕ} {γ : Type} (ν₁ ν₂ : N.Formula (γ ⊕ Fin ℓ)) :
              N.Formula (γ ⊕ Fin ℓ)

              The carry into a position: some lower position generates it, and every position in between propagates it.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Dependency graph
                noncomputable def DescriptiveComplexity.Digits.addF {K N : FirstOrder.Language} (ι : K.sum FirstOrder.Language.order →ᴸ N) {ℓ : ℕ} {γ : Type} (ν₁ ν₂ : N.Formula (γ ⊕ Fin ℓ)) :
                N.Formula (γ ⊕ Fin ℓ)

                The sum of two numbers.

                Equations
                Instances For
                  Dependency graph
                  Dependency graph
                  theorem DescriptiveComplexity.Digits.realize_xorF {N : FirstOrder.Language} {γ A : Type} [N.Structure A] (φ ψ : N.Formula γ) (v : γ → A) :
                  (xorF φ ψ).Realize v ↔ Xor (φ.Realize v) (ψ.Realize v)
                  Dependency graph
                  theorem DescriptiveComplexity.Digits.realize_atQ {N : FirstOrder.Language} {ℓ : ℕ} {γ A : Type} [N.Structure A] (ν : N.Formula (γ ⊕ Fin ℓ)) (g : γ → A) (p q : Fin ℓ → A) :
                  (atQ ν).Realize (Sum.elim (Sum.elim g p) q) ↔ ν.Realize (Sum.elim g q)
                  Dependency graph
                  theorem DescriptiveComplexity.Digits.realize_atR {N : FirstOrder.Language} {ℓ : ℕ} {γ A : Type} [N.Structure A] (ν : N.Formula (γ ⊕ Fin ℓ)) (g : γ → A) (p q r : Fin ℓ → A) :
                  (atR ν).Realize (Sum.elim (Sum.elim (Sum.elim g p) q) r) ↔ ν.Realize (Sum.elim g r)
                  Dependency graph

                  A quantifier block before the position #

                  noncomputable def DescriptiveComplexity.Digits.exMid {N : FirstOrder.Language} {γ : Type} {ℓ m : ℕ} (ξ : N.Formula ((γ ⊕ Fin m) ⊕ Fin ℓ)) :
                  N.Formula (γ ⊕ Fin ℓ)

                  Existential quantification over a block of variables that is not the last one: the position stays last.

                  Equations
                  Instances For
                    Dependency graph
                    def DescriptiveComplexity.Digits.weaken {N : FirstOrder.Language} {γ : Type} {ℓ m : ℕ} (ν : N.Formula (γ ⊕ Fin ℓ)) :
                    N.Formula ((γ ⊕ Fin m) ⊕ Fin ℓ)

                    A formula that does not mention a block of variables.

                    Equations
                    Instances For
                      Dependency graph