Documentation

Complexity.Logics.FirstOrder.Interpretation.Tagged

Tagged interpretations #

Reductions between problems often build structures whose elements are of several kinds: the literal vertices and the clause gadgets of a graph built from a formula, the variables and the clauses of a formula built from a structure. A tagged interpretation I of L' in L (Cslib.Logic.FO.TaggedInterpretation) has a finite type T of tags and, for each tag t, a type ι t of coordinates and a domain formula; the interpreted structure I.Model M is the disjoint union over the tags t of the tuples ι t → M satisfying the domain formula of t, and a relation symbol is defined, for each choice of tags of its arguments, by a formula in the coordinates of the arguments. Senellart and Gnatenko's interpretations are tagged in this way, with the same coordinates Fin dim for every tag Senellart and Gnatenko.

The first-order interpretations of this library (Cslib.Logic.FO.Interpretation) are untagged, and the structures are unordered and have no constants, so a tag cannot be named by a fixed element. It is named by an equality pattern instead: the coordinates of the compiled interpretation I.toInterpretation S are two coordinates p ≠ q, a coordinate per tag, equal to q at the tag of the element and to p at the others, and the coordinates of every tag, those of the other tags equal to p. Every ordered pair p ≠ q thus carries a copy of I.Model M, and the compiled structure is isomorphic to Copies J (I.Model M), the disjoint union of copies indexed by the pairs J (Cslib.Logic.FO.TaggedInterpretation.copiesEquiv). A structure with at most one element has no such pair; on it, the compiled interpretation is a given interpretation S of dimension one (Cslib.Logic.FO.TaggedInterpretation.subsingletonEquiv).

So a tagged interpretation gives an order-free reduction to every class that is closed under isomorphism and under taking a positive number of disjoint copies, such as satisfiability of formulas in conjunctive normal form or colorability of graphs (Cslib.Logic.FO.Reduces.of_tagged).

Binary relations of tagged interpretations are conveniently defined by templates (Cslib.Logic.FO.TaggedInterpretation.Template): a template from tag t relates an element of tag t whose coordinates satisfy a guard to the elements of a target tag whose coordinates are copied from it, or are arbitrary.

Main definitions #

Main results #

References #

structure Cslib.Logic.FO.TaggedInterpretation (L : FirstOrder.Language) (L' : FirstOrder.Language) (T : Type u_1) (ι : T → Type u_2) :
Type (max (max (max (max u u_1) u_2) v) v')

A tagged interpretation of L' in L: for each tag t a domain formula in the coordinates ι t, and for each relation symbol of arity n and each choice of tags of its n arguments a formula in their coordinates.

  • domain (t : T) : L.Formula (ι t)

    The domain formula of each tag.

  • rel {n : ℕ} : L'.Relations n → (ts : Fin n → T) → L.Formula ((j : Fin n) × ι (ts j))

    The formula defining a relation symbol among arguments of the given tags.

Instances For

    In a structure with at most one element: the formula ∀ x y, x = y.

    Instances For
      def Cslib.Logic.FO.TaggedInterpretation.Model {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} (I : TaggedInterpretation L L' T ι) (M : Type w) [L.Structure M] :
      Type (max (max u_2 w) u_1)

      The universe of the structure interpreted by I in M: for each tag, the tuples satisfying its domain formula.

      Instances For
        instance Cslib.Logic.FO.TaggedInterpretation.instFiniteModel {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] [Finite T] [∀ (t : T), Finite (ι t)] [Finite M] :
        def Cslib.Logic.FO.TaggedInterpretation.Model.toSigma {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] (e : I.Model M) :
        (t : T) × (ι t → M)

        The tag and coordinates of an element of the interpreted structure.

        Instances For
          theorem Cslib.Logic.FO.TaggedInterpretation.Model.ext_toSigma {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] {e e' : I.Model M} (h : e.toSigma = e'.toSigma) :
          e = e'
          @[instance_reducible]

          The structure interpreted by I: a relation holds of some elements when its defining formula for their tags holds of their coordinates.

          theorem Cslib.Logic.FO.TaggedInterpretation.relMap_model {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] [L'.IsRelational] {n : ℕ} (R : L'.Relations n) (xs : Fin n → I.Model M) :
          FirstOrder.Language.Structure.RelMap R xs ↔ (I.rel R fun (j : Fin n) => (xs j).fst).Realize fun (p : (j : Fin n) × ι (xs j).fst) => ↑(xs p.fst).snd p.snd

          Renaming tags #

          def Cslib.Logic.FO.TaggedInterpretation.reindex {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type u_1} {T' : Type u_2} {ι : T → Type u_3} (I : TaggedInterpretation L L' T ι) (e : T ≃ T') :
          TaggedInterpretation L L' T' (ι ∘ ⇑e.symm)

          The tagged interpretation with tags renamed along e.

          Instances For
            def Cslib.Logic.FO.TaggedInterpretation.reindexEquiv {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type u_1} {T' : Type u_2} {ι : T → Type u_3} (I : TaggedInterpretation L L' T ι) [L'.IsRelational] (e : T ≃ T') (M : Type w) [L.Structure M] :
            L'.Equiv ((I.reindex e).Model M) (I.Model M)

            Renaming the tags of a tagged interpretation does not change the interpreted structure, up to isomorphism.

            Instances For

              Disjoint copies #

              structure Cslib.Logic.FO.Copies (J : Type u_1) (N : Type u_2) :
              Type (max u_1 u_2)

              The disjoint union of copies of N indexed by J: a relation holds of some elements of one copy when it holds of them in N.

              • idx : J

                The copy containing the element.

              • val : N

                The element of N it is a copy of.

              Instances For
                def Cslib.Logic.FO.Copies.equivProd {J : Type u_1} {N : Type u_2} :
                Copies J N ≃ J × N

                The copies, as pairs.

                Instances For
                  instance Cslib.Logic.FO.Copies.instFinite {J : Type u_1} {N : Type u_2} [Finite J] [Finite N] :
                  @[instance_reducible]
                  theorem Cslib.Logic.FO.Copies.relMap_copies {L' : FirstOrder.Language} {J : Type u_1} {N : Type u_2} [L'.IsRelational] [L'.Structure N] {n : ℕ} (R : L'.Relations n) (xs : Fin n → Copies J N) :
                  FirstOrder.Language.Structure.RelMap R xs ↔ (∀ (i j : Fin n), (xs i).idx = (xs j).idx) ∧ FirstOrder.Language.Structure.RelMap R fun (i : Fin n) => (xs i).val

                  A binary relation holds of two elements of the copies when they are in the same copy and related in N.

                  A unary relation in a copy holds exactly when it holds of the underlying element.

                  theorem Cslib.Logic.FO.Copies.ncard_set_val {J : Type u_1} {N : Type u_2} (s : Set N) :

                  The copies of a set have cardinality the number of copies times its cardinality.

                  A class of structures is invariant under copies when a finite structure belongs to it exactly when the disjoint union of a finite positive number of copies of it does.

                  Instances For

                    The compiled interpretation #

                    @[reducible, inline]

                    The coordinates of the compiled interpretation: the two coordinates p and q of a copy, a coordinate for each tag, and the coordinates of every tag.

                    Instances For
                      @[reducible, inline]

                      The first coordinate of a copy.

                      Instances For
                        @[reducible, inline]

                        The second coordinate of a copy, distinct from the first.

                        Instances For
                          @[reducible, inline]
                          abbrev Cslib.Logic.FO.TaggedInterpretation.Coord.tag {T : Type} {ι : T → Type} (t : T) :
                          Coord T ι

                          The coordinate of a tag, equal to q at the tag of an element and to p at the others.

                          Instances For
                            @[reducible, inline]
                            abbrev Cslib.Logic.FO.TaggedInterpretation.Coord.data {T : Type} {ι : T → Type} (σ : (t : T) × ι t) :
                            Coord T ι

                            A coordinate of a tag, equal to p unless the element has this tag.

                            Instances For
                              noncomputable def Cslib.Logic.FO.TaggedInterpretation.domainAt {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} [Finite T] [∀ (t : T), Finite (ι t)] (I : TaggedInterpretation L L' T ι) (t : T) :
                              L.Formula (Coord T ι)

                              The domain formula of the compiled interpretation on elements of tag t: the coordinates p and q are distinct, the coordinate of each tag is q at t and p elsewhere, the coordinates of the other tags are p, and the coordinates of t satisfy its domain formula.

                              Instances For
                                noncomputable def Cslib.Logic.FO.TaggedInterpretation.relAt {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} [Finite T] (I : TaggedInterpretation L L' T ι) {n : ℕ} (R : L'.Relations n) :
                                L.Formula (Fin n × Coord T ι)

                                The formula defining a relation symbol in the compiled interpretation: all arguments belong to the same copy, and the formula of I for their tags holds of their coordinates.

                                Instances For
                                  noncomputable def Cslib.Logic.FO.TaggedInterpretation.toInterpretation {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} [Finite T] [∀ (t : T), Finite (ι t)] (I : TaggedInterpretation L L' T ι) (S : Interpretation L L' Unit) :
                                  Interpretation L L' (Coord T ι)

                                  The compiled interpretation of a tagged interpretation I, using the interpretation S of dimension one on structures with at most one element.

                                  Instances For
                                    theorem Cslib.Logic.FO.TaggedInterpretation.realize_domainAt {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} [Finite T] [∀ (t : T), Finite (ι t)] {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] (t : T) (c : Coord T ι → M) :
                                    (I.domainAt t).Realize c ↔ c Coord.p ≠ c Coord.q ∧ (∀ (t' : T), c (Coord.tag t') = if t' = t then c Coord.q else c Coord.p) ∧ (∀ (σ : (t' : T) × ι t'), σ.fst ≠ t → c (Coord.data σ) = c Coord.p) ∧ (I.domain t).Realize fun (i : ι t) => c (Coord.data ⟨t, i⟩)
                                    theorem Cslib.Logic.FO.TaggedInterpretation.realize_relAt {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} [Finite T] {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] {n : ℕ} (R : L'.Relations n) (c : Fin n × Coord T ι → M) :
                                    (I.relAt R).Realize c ↔ (∀ (j j' : Fin n), c (j, Coord.p) = c (j', Coord.p) ∧ c (j, Coord.q) = c (j', Coord.q)) ∧ ∃ (ts : Fin n → T), (∀ (j : Fin n), c (j, Coord.tag (ts j)) = c (j, Coord.q)) ∧ (I.rel R ts).Realize fun (σ : (j : Fin n) × ι (ts j)) => c (σ.fst, Coord.data ⟨ts σ.fst, σ.snd⟩)
                                    theorem Cslib.Logic.FO.TaggedInterpretation.realize_toInterpretation_domain_of_nontrivial {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} [Finite T] [∀ (t : T), Finite (ι t)] {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] (S : Interpretation L L' Unit) [Nontrivial M] (c : Coord T ι → M) :
                                    (I.toInterpretation S).domain.Realize c ↔ ∃ (t : T), (I.domainAt t).Realize c
                                    theorem Cslib.Logic.FO.TaggedInterpretation.realize_toInterpretation_rel_of_subsingleton {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} [Finite T] [∀ (t : T), Finite (ι t)] {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] (S : Interpretation L L' Unit) [Subsingleton M] {n : ℕ} (R : L'.Relations n) (c : Fin n × Coord T ι → M) :
                                    ((I.toInterpretation S).rel R).Realize c ↔ (S.rel R).Realize fun (x : Fin n × Unit) => c (x.1, Coord.p)
                                    theorem Cslib.Logic.FO.TaggedInterpretation.realize_toInterpretation_rel_of_nontrivial {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} [Finite T] [∀ (t : T), Finite (ι t)] {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] (S : Interpretation L L' Unit) [Nontrivial M] {n : ℕ} (R : L'.Relations n) (c : Fin n × Coord T ι → M) :

                                    Structures with at most one element #

                                    def Cslib.Logic.FO.TaggedInterpretation.subsingletonEquiv {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} [Finite T] [∀ (t : T), Finite (ι t)] {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] (S : Interpretation L L' Unit) [L'.IsRelational] [Subsingleton M] :
                                    L'.Equiv ((I.toInterpretation S).Model M) (S.Model M)

                                    On a structure with at most one element, the compiled interpretation is the interpretation S.

                                    Instances For

                                      Structures with two distinct elements #

                                      The ordered pairs of distinct elements, each indexing a copy of the tagged structure.

                                      Instances For
                                        noncomputable def Cslib.Logic.FO.TaggedInterpretation.coords {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] (a b : M) (e : I.Model M) :
                                        Coord T ι → M

                                        The coordinates of an element e of the tagged structure in the copy of the pair (a, b): the coordinates p and q are a and b.

                                        Instances For
                                          @[simp]
                                          theorem Cslib.Logic.FO.TaggedInterpretation.coords_data_self {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] (a b : M) (e : I.Model M) (i : ι e.fst) :
                                          coords a b e (Coord.data ⟨e.fst, i⟩) = ↑e.snd i
                                          theorem Cslib.Logic.FO.TaggedInterpretation.realize_domainAt_coords {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} [Finite T] [∀ (t : T), Finite (ι t)] {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] (a b : M) (h : a ≠ b) (e : I.Model M) :
                                          (I.domainAt e.fst).Realize (coords a b e)
                                          noncomputable def Cslib.Logic.FO.TaggedInterpretation.ofCopies {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} [Finite T] [∀ (t : T), Finite (ι t)] {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] (S : Interpretation L L' Unit) [Nontrivial M] (x : Copies (Pairs M) (I.Model M)) :

                                          The map from the copies of the tagged structure to the compiled structure.

                                          Instances For
                                            noncomputable def Cslib.Logic.FO.TaggedInterpretation.copiesEquiv {L : FirstOrder.Language} {L' : FirstOrder.Language} {T : Type} {ι : T → Type} [Finite T] [∀ (t : T), Finite (ι t)] {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] (S : Interpretation L L' Unit) [L'.IsRelational] [Nontrivial M] :
                                            L'.Equiv (Copies (Pairs M) (I.Model M)) ((I.toInterpretation S).Model M)

                                            On a structure with two distinct elements, the compiled interpretation is a disjoint union of copies of the tagged one, a copy for each ordered pair of distinct elements.

                                            Instances For

                                              On a structure with two distinct elements, the compiled interpretation of a tagged interpretation whose structures are nonempty is nontrivial: there are at least two copies.

                                              Reductions by tagged interpretations #

                                              theorem Cslib.Logic.FO.Reduces.of_tagged {L : FirstOrder.Language} {L' : FirstOrder.Language} [L'.IsRelational] {K : Set (CategoryTheory.Bundled L.Structure)} {K' : Set (CategoryTheory.Bundled L'.Structure)} (hK' : IsoClosed K') (hcopy : CopyInvariant K') {T : Type} [Finite T] {ι : T → Type} [∀ (t : T), Finite (ι t)] (I : TaggedInterpretation L L' T ι) (S : Interpretation L L' Unit) (hlarge : ∀ (M : CategoryTheory.Bundled L.Structure) [Finite ↑M], Nontrivial ↑M → (M ∈ K ↔ CategoryTheory.Bundled.of (I.Model ↑M) ∈ K')) (hsmall : ∀ (M : CategoryTheory.Bundled L.Structure) [Finite ↑M], Subsingleton ↑M → (M ∈ K ↔ CategoryTheory.Bundled.of (S.Model ↑M) ∈ K')) :
                                              Reduces K K'

                                              Tagged interpretations give order-free reductions to classes closed under isomorphism and under copies: if the structure interpreted by I decides membership on the finite structures with two distinct elements, and the interpretation S of dimension one decides it on those with at most one element, then the compiled interpretation is a order-free reduction.

                                              Templates for binary relations #

                                              structure Cslib.Logic.FO.TaggedInterpretation.Template (L : FirstOrder.Language) {T : Type u_3} (ι : T → Type u_4) (t : T) :
                                              Type (max (max (max u u_3) u_4) v)

                                              A template for a binary relation from elements of tag t: it relates an element of tag t whose coordinates x satisfy the guard to the elements of tag target whose coordinate j is x i whenever map j = some i, the coordinates j with map j = none being arbitrary.

                                              • target : T

                                                The tag of the related elements.

                                              • guard : L.Formula (ι t)

                                                The condition on the coordinates of the element of tag t.

                                              • map : ι self.target → Option (ι t)

                                                The coordinates of the related elements copied from the element of tag t.

                                              Instances For
                                                def Cslib.Logic.FO.TaggedInterpretation.Template.Compat {L : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} {t : T} (τ : Template L ι t) {M : Type w} (x : ι t → M) (y : ι τ.target → M) :

                                                The tuples of tag τ.target related to the coordinates x of an element of tag t.

                                                Instances For
                                                  def Cslib.Logic.FO.TaggedInterpretation.Template.Holds {L : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} {t : T} (τ : Template L ι t) {M : Type w} [L.Structure M] (x : ι t → M) (e : (w : T) × (ι w → M)) :

                                                  The template relates the coordinates x of an element of tag t to an element of tag w with coordinates y.

                                                  Instances For
                                                    noncomputable def Cslib.Logic.FO.TaggedInterpretation.Template.formula {L : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} {t : T} (τ : Template L ι t) [∀ (t : T), Finite (ι t)] (w : T) :
                                                    L.Formula (ι t ⊕ ι w)

                                                    The formula of a template, relating an element of tag t to an element of tag w.

                                                    Instances For
                                                      theorem Cslib.Logic.FO.TaggedInterpretation.Template.realize_formula {L : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} {t : T} (τ : Template L ι t) {M : Type w} [∀ (t : T), Finite (ι t)] [L.Structure M] {w : T} (x : ι t → M) (y : ι w → M) :
                                                      (τ.formula w).Realize (Sum.elim x y) ↔ τ.Holds x ⟨w, y⟩

                                                      The formula of a template holds of the coordinates of two elements exactly when the template relates them.

                                                      noncomputable def Cslib.Logic.FO.TaggedInterpretation.Template.listFormula {L : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} {t : T} [∀ (t : T), Finite (ι t)] (l : List (Template L ι t)) (w : T) :
                                                      L.Formula (ι t ⊕ ι w)

                                                      The disjunction of the formulas of a list of templates.

                                                      Instances For
                                                        theorem Cslib.Logic.FO.TaggedInterpretation.Template.realize_listFormula {L : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} {t : T} {M : Type w} [∀ (t : T), Finite (ι t)] [L.Structure M] (l : List (Template L ι t)) {w : T} (x : ι t → M) (y : ι w → M) :
                                                        (listFormula l w).Realize (Sum.elim x y) ↔ ∃ τ ∈ l, τ.Holds x ⟨w, y⟩

                                                        The formula of a list of templates holds exactly when one of them relates the elements.

                                                        def Cslib.Logic.FO.TaggedInterpretation.binaryRel {L : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} (F : (t w : T) → L.Formula (ι t ⊕ ι w)) (ts : Fin 2 → T) :
                                                        L.Formula ((j : Fin 2) × ι (ts j))

                                                        The formula of a binary relation among arguments of tags ts 0 and ts 1, from a formula in the coordinates of the two arguments.

                                                        Instances For
                                                          theorem Cslib.Logic.FO.TaggedInterpretation.relMap_binaryRel {L : FirstOrder.Language} {T : Type u_1} {ι : T → Type u_2} {L' : FirstOrder.Language} [L'.IsRelational] {I : TaggedInterpretation L L' T ι} {M : Type w} [L.Structure M] {R : L'.Relations 2} {F : (t w : T) → L.Formula (ι t ⊕ ι w)} (hR : ∀ (ts : Fin 2 → T), I.rel R ts = binaryRel F ts) (a b : I.Model M) :