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

    Finite disjunction of a list of formulas.

    Equations
    Instances For
      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
      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

      Padded tuples #

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

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

      Equations
      Instances For
        def DescriptiveComplexity.Agree {A : Type} {D : ℕ} (m : ℕ) (u x : Fin D → A) :

        Two D-tuples agree below m.

        Equations
        Instances For
          def DescriptiveComplexity.pad {A : Type} {D : ℕ} (a₀ : A) {m : ℕ} (w : Fin m → A) :
          Fin D → A

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

          Equations
          Instances For
            def DescriptiveComplexity.pref {A : Type} {D m : ℕ} (h : m ≤ D) (u : Fin D → A) :
            Fin m → A

            The prefix of a D-tuple.

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

              A canonical tuple is the padding of its prefix.

              theorem DescriptiveComplexity.eq_pad_of_canon_agree {A : Type} {D : ℕ} [PartialOrder A] {a₀ : A} (h₀ : IsBot a₀) {m : ℕ} (h : m ≤ D) {u x : Fin D → A} (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.

              theorem DescriptiveComplexity.pref_pad_snoc {A : Type} {D : ℕ} (a₀ : A) {m : ℕ} (h : m ≤ D) (w : Fin m → A) (a : A) :
              pref h (pad a₀ (Fin.snoc w a)) = w
              theorem DescriptiveComplexity.agree_pad_snoc_pref {A : Type} {D : ℕ} (a₀ a : A) {m : ℕ} (h : m ≤ D) (u : Fin D → A) :
              Agree m u (pad a₀ (Fin.snoc (pref h u) a))

              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 m → Fin D) (u x : Fin D → A) :

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

              Equations
              Instances For
                theorem DescriptiveComplexity.padTup_pad {A : Type} {D : ℕ} [LE A] {a₀ : A} (h₀ : IsBot a₀) {m : ℕ} (f : Fin m → Fin D) (u : Fin D → A) :
                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.

                theorem DescriptiveComplexity.eq_pad_of_padTup {A : Type} {D : ℕ} [PartialOrder A] {a₀ : A} (h₀ : IsBot a₀) {m : ℕ} {f : Fin m → Fin D} {u x : Fin D → A} (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.

                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 D → A} (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.

                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

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

                  Equations
                  Instances For

                    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
                      noncomputable def DescriptiveComplexity.padTupF {L : FirstOrder.Language} {γ : Type} {D m : ℕ} (f : Fin m → Fin 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

                        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)
                        @[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)
                        @[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)
                        @[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)
                        @[simp]
                        theorem DescriptiveComplexity.realize_padTupF {L : FirstOrder.Language} {γ : Type} {D : ℕ} {A : Type} [L.Structure A] [LinearOrder A] {v : γ → A} {m : ℕ} {f : Fin m → Fin 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)