Documentation

DescriptiveComplexity.Padding

Canonically padded tuples #

Shared machinery for interpretations whose tags need tuples of different lengths. The universe of a DescriptiveComplexity.FOInterpretation is Tag × A^dim for a single dimension dim, so an element meant to carry an m-tuple with m < dim must fix its remaining coordinates; otherwise the same intended element would have several representatives, which for the SAT-family reductions would mean several distinct propositional variables standing for the same atom.

The convention here is to pad with a minimum of the input order: a tuple is DescriptiveComplexity.Canon m when every coordinate from m on is a minimum. This is the one place where the reductions of the library need their input structure to be ordered. The file provides

Formula builders are parameterized by maps Fin D → γ selecting the free variables holding each tuple, so that they can be instantiated at the variable types of the defining formulas of an interpretation (Fin 1 × Fin D, Fin 2 × Fin D).

Clients: the Tseitin encoding of DescriptiveComplexity.Problems.Sat.Tseitin and the Horn discharge of DescriptiveComplexity.Problems.HornSat.Hardness.

Finite conjunctions and disjunctions of formulas #

Finite conjunction of a list of formulas.

Equations
Instances For
    Dependency graph

    Finite disjunction of a list of formulas.

    Equations
    Instances For
      Dependency graph
      theorem DescriptiveComplexity.realize_listInf {L' : FirstOrder.Language} {γ A : Type} [L'.Structure A] {v : γA} (l : List (L'.Formula γ)) :
      (listInf l).Realize v φl, φ.Realize v
      Dependency graph
      theorem DescriptiveComplexity.realize_listSup {L' : FirstOrder.Language} {γ A : Type} [L'.Structure A] {v : γA} (l : List (L'.Formula γ)) :
      (listSup l).Realize v φl, φ.Realize v
      Dependency graph

      Padded tuples #

      def DescriptiveComplexity.Canon {A : Type} {D : } [LE A] (m : ) (u : Fin DA) :

      A D-tuple is canonical at context length m: every coordinate from m on is a minimum of the order.

      Equations
      Instances For
        Dependency graph
        def DescriptiveComplexity.Agree {A : Type} {D : } (m : ) (u x : Fin DA) :

        Two D-tuples agree below m.

        Equations
        Instances For
          Dependency graph
          def DescriptiveComplexity.pad {A : Type} {D : } (a₀ : A) {m : } (w : Fin mA) :
          Fin DA

          Pad a context tuple to a D-tuple with a (minimal) element.

          Equations
          Instances For
            Dependency graph
            def DescriptiveComplexity.pref {A : Type} {D m : } (h : m D) (u : Fin DA) :
            Fin mA

            The prefix of a D-tuple.

            Equations
            Instances For
              Dependency graph
              theorem DescriptiveComplexity.pref_pad {A : Type} {D : } (a₀ : A) {m : } (h : m D) (w : Fin mA) :
              pref h (pad a₀ w) = w
              Dependency graph
              theorem DescriptiveComplexity.canon_pad {A : Type} {D : } [LE A] {a₀ : A} (h₀ : IsBot a₀) (m : ) (w : Fin mA) :
              Canon m (pad a₀ w)
              Dependency graph
              theorem DescriptiveComplexity.agree_pad_pad {A : Type} {D : } (a₀ : A) {m : } (w : Fin mA) (a : A) :
              Agree m (pad a₀ (Fin.snoc w a)) (pad a₀ w)
              Dependency graph
              theorem DescriptiveComplexity.pad_pref_of_canon {A : Type} {D : } [PartialOrder A] {a₀ : A} (h₀ : IsBot a₀) {m : } (h : m D) {u : Fin DA} (hc : Canon m u) :
              pad a₀ (pref h u) = u

              A canonical tuple is the padding of its prefix.

              Dependency graph
              theorem DescriptiveComplexity.eq_pad_of_canon_agree {A : Type} {D : } [PartialOrder A] {a₀ : A} (h₀ : IsBot a₀) {m : } (h : m D) {u x : Fin DA} (hcx : Canon m x) (ha : Agree m u x) :
              x = pad a₀ (pref h u)

              A tuple canonical at m agreeing with u below m is the padding of u's prefix.

              Dependency graph
              theorem DescriptiveComplexity.pref_pad_snoc {A : Type} {D : } (a₀ : A) {m : } (h : m D) (w : Fin mA) (a : A) :
              pref h (pad a₀ (Fin.snoc w a)) = w
              Dependency graph
              theorem DescriptiveComplexity.agree_pad_snoc_pref {A : Type} {D : } (a₀ a : A) {m : } (h : m D) (u : Fin DA) :
              Agree m u (pad a₀ (Fin.snoc (pref h u) a))
              Dependency graph

              Tuples read through an index map #

              An interpretation encoding second-order atoms as elements needs one element per atom R (x_{f 0}, …, x_{f (m-1)}), whose coordinates are read from a context tuple u through an index map f. Canonical padding makes that element unique.

              def DescriptiveComplexity.PadTup {A : Type} {D : } [LE A] {m : } (f : Fin mFin D) (u x : Fin DA) :

              x is the canonically padded, length-m tuple read from u through the index map f.

              Equations
              Instances For
                Dependency graph
                theorem DescriptiveComplexity.padTup_pad {A : Type} {D : } [LE A] {a₀ : A} (h₀ : IsBot a₀) {m : } (f : Fin mFin D) (u : Fin DA) :
                PadTup f u (pad a₀ fun (j : Fin m) => u (f j))

                The canonical padding of the tuple read through f does satisfy DescriptiveComplexity.PadTup.

                Dependency graph
                theorem DescriptiveComplexity.eq_pad_of_padTup {A : Type} {D : } [PartialOrder A] {a₀ : A} (h₀ : IsBot a₀) {m : } {f : Fin mFin D} {u x : Fin DA} (h : PadTup f u x) :
                x = pad a₀ fun (j : Fin m) => u (f j)

                Conversely, a tuple satisfying DescriptiveComplexity.PadTup is that canonical padding: the element encoding an atom is unique.

                Dependency graph
                theorem DescriptiveComplexity.eq_pad_snoc_of_canon_agree {A : Type} {D : } [PartialOrder A] {a₀ : A} (h₀ : IsBot a₀) {m : } (h : m < D) {u x : Fin DA} (hcx : Canon (m + 1) x) (ha : Agree m u x) :
                x = pad a₀ (Fin.snoc (pref u) (x m, h))

                A tuple canonical at m + 1 agreeing below m with u is the padding of the prefix of u extended by its own coordinate m.

                Dependency graph
                Dependency graph
                noncomputable def DescriptiveComplexity.canonF {L : FirstOrder.Language} {γ : Type} {D : } (m : ) (c : Fin Dγ) :

                The coordinates of c from m on are minima, as a formula: c holds a canonically padded context tuple of length m.

                Equations
                Instances For
                  Dependency graph

                  The tuples held by u and x are equal, as a formula.

                  Equations
                  Instances For
                    Dependency graph

                    The tuples held by u and x agree below m, as a formula.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Dependency graph
                      noncomputable def DescriptiveComplexity.padTupF {L : FirstOrder.Language} {γ : Type} {D m : } (f : Fin mFin D) (u x : Fin Dγ) :

                      The tuple held by x is the canonically padded, length-m tuple read from u through the index map f, as a formula.

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

                        Realization of the builders #

                        @[simp]
                        theorem DescriptiveComplexity.realize_botF {L : FirstOrder.Language} {γ A : Type} [L.Structure A] [LinearOrder A] {v : γA} {x : γ} :
                        (botF x).Realize v IsBot (v x)
                        Dependency graph
                        @[simp]
                        theorem DescriptiveComplexity.realize_canonF {L : FirstOrder.Language} {γ : Type} {D : } {A : Type} [L.Structure A] [LinearOrder A] {v : γA} {m : } {c : Fin Dγ} :
                        (canonF m c).Realize v Canon m fun (j : Fin D) => v (c j)
                        Dependency graph
                        @[simp]
                        theorem DescriptiveComplexity.realize_eqTupF {L : FirstOrder.Language} {γ : Type} {D : } {A : Type} [L.Structure A] [LinearOrder A] {v : γA} {u x : Fin Dγ} :
                        (eqTupF u x).Realize v (fun (j : Fin D) => v (x j)) = fun (j : Fin D) => v (u j)
                        Dependency graph
                        @[simp]
                        theorem DescriptiveComplexity.realize_agreeF {L : FirstOrder.Language} {γ : Type} {D : } {A : Type} [L.Structure A] [LinearOrder A] {v : γA} {m : } {u x : Fin Dγ} :
                        (agreeF m u x).Realize v Agree m (fun (j : Fin D) => v (u j)) fun (j : Fin D) => v (x j)
                        Dependency graph
                        @[simp]
                        theorem DescriptiveComplexity.realize_padTupF {L : FirstOrder.Language} {γ : Type} {D : } {A : Type} [L.Structure A] [LinearOrder A] {v : γA} {m : } {f : Fin mFin D} {u x : Fin Dγ} :
                        (padTupF f u x).Realize v PadTup f (fun (j : Fin D) => v (u j)) fun (j : Fin D) => v (x j)
                        Dependency graph