Documentation

DescriptiveComplexity.Exponential.TagBits

Guessing a point of an expanded universe #

The translation lemma (DescriptiveComplexity.ExpExpansion.exists_translate) – an FO sentence over an expansion is a second-order sentence over the base – peels one quantifier at a time into one second-order block. What that block has to hold is a point of the expanded universe: a tag together with an assignment of the expansion's block.

The assignment half is what a block quantifier already ranges over. The tag half is the problem: everywhere else in this development a tag is static, chosen at formula-construction time (relSentence is indexed by a tuple of tags, ordSentence compares two of them by trichotomy). A quantified point chooses its tag at evaluation time, so the tag has to become part of the guessed object.

The encoding: extend the block by one arity-0 relation variable per tag (DescriptiveComplexity.SOBlock.withTag). An arity-0 variable is a bit – the same observation DescriptiveComplexity.PSpace's docstring makes about finite control in an SO(TC) walk – so a tag is a bit vector, and DescriptiveComplexity.SOBlock.tagGuardF is the sentence saying exactly one bit is set. Its correctness (DescriptiveComplexity.SOBlock.realize_tagGuardF) says the guard holds of an assignment exactly when that assignment is a tagged assignment, which is the form the peeling step consumes.

Nothing here depends on the expansion, only on a block and a finite tag type.

noncomputable def DescriptiveComplexity.finEnum (T : Type) [Finite T] :

An enumeration of a finite type, as a list. (SOBlock.ivars is this list at a block's index type; fold the two together when the translation lands.)

Equations
Instances For
    Dependency graph
    Dependency graph

    The block extended by tag bits #

    @[reducible, inline]

    A block extended with one arity-0 relation variable per tag. An arity-0 variable is a bit, so an assignment of this block is an assignment of B together with a bit vector naming a tag.

    An abbrev deliberately: with a semireducible def in between, instance search cannot see that the arity of a tag variable is 0, and Fin 0 → A stops being recognized as a subsingleton.

    Equations
    Instances For
      Dependency graph
      def DescriptiveComplexity.SOBlock.tagAssign {B : SOBlock} {T : Type} [Finite T] {A : Type} (t : T) (ρ : B.Assignment A) :

      The assignment of the extended block carrying a given tag and a given assignment: the bit of t' says t' = t.

      Equations
      Instances For
        Dependency graph

        A tag variable has arity 0, so its argument tuple is the empty one. Stated as an instance because Fin ((B.withTag T).arity (Sum.inl t)) is not syntactically Fin 0, and the Subsingleton/Inhabited facts the correctness proof needs are found through it.

        Dependency graph

        The assignment an extended assignment carries, forgetting the tag bits.

        Equations
        Instances For
          Dependency graph
          @[simp]
          theorem DescriptiveComplexity.SOBlock.dropTag_tagAssign {B : SOBlock} {T : Type} [Finite T] {A : Type} (t : T) (ρ : B.Assignment A) :
          dropTag (tagAssign t ρ) = ρ
          Dependency graph

          The exactly-one guard #

          noncomputable def DescriptiveComplexity.SOBlock.tagBitF {L : FirstOrder.Language} (B : SOBlock) (T : Type) [Finite T] (t : T) :

          The atom “the bit of the tag t is set”.

          Equations
          Instances For
            Dependency graph

            Exactly one tag bit is set: the sentence saying that an assignment of the extended block names a tag.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              Dependency graph
              Dependency graph
              theorem DescriptiveComplexity.SOBlock.realize_tagGuardF {L : FirstOrder.Language} {B : SOBlock} {T : Type} [Finite T] {A : Type} [L.Structure A] (σ : (B.withTag T).Assignment A) :
              A B.tagGuardF T ∃ (t : T) (ρ : B.Assignment A), σ = tagAssign t ρ

              The guard says the assignment is a tagged one.

              Dependency graph