Documentation

DescriptiveComplexity.Computability.REPred

RE is recursively enumerable #

DescriptiveComplexity.RE_subset_rePred: a problem in the logically defined class DescriptiveComplexity.RE denotes, through the encoding of FirstOrder.Language.FinStruct, an REPred in the sense of Mathlib's computability layer. It is what makes the name of the class a theorem rather than a convention, and it needs no machine model at all.

The argument #

∃SO[new]-definability says

P A ↔ ∃ m : ℕ, ∃ ρ : B.Assignment (A ⊕ Fin m), φ holds in the extended structure

with φ a fixed first-order sentence. Both existentials are absorbed into a single unbounded search over a Primcodable witness: the number m of invented values, and a list of Boolean tables standing for the assignment ρ. Given the witness, the extended structure is built as data (DescriptiveComplexity.extStruct) and φ is evaluated on it by the primitive recursive evaluator of DescriptiveComplexity.Computability.Eval. Unbounded search over a decidable test is exactly REPred.

Two facts carry the proof:

The converse #

That every REPred is in RE is proved one layer up, in DescriptiveComplexity.Computability.CodeHaltComplete (DescriptiveComplexity.mem_RE_iff_rePred). It needs a target whose programs already exist, so that the reduction can draw a semi-decision procedure inside the instance rather than build one.

Unbounded search over a coded witness #

theorem DescriptiveComplexity.rePred_of_exists {α β : Type} [Primcodable α] [Primcodable β] {p : αProp} {f : αβBool} (hf : Primrec₂ f) (h : ∀ (a : α), p a ∃ (b : β), f a b = true) :

A predicate found by unbounded search over a coded witness is recursively enumerable. The witness type is any Primcodable type; the search is Mathlib's Nat.rfind over its codes.

Dependency graph

The vocabularies of the second-order machinery #

The one-symbol vocabulary marking the original elements, presented.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    Dependency graph
    noncomputable def DescriptiveComplexity.blockNum (B : SOBlock) :

    The number of relation variables of a block.

    Equations
    Instances For
      Dependency graph
      noncomputable def DescriptiveComplexity.blockEq (B : SOBlock) :

      A numbering of the relation variables of a block.

      Equations
      Instances For
        Dependency graph

        The vocabulary of a second-order quantifier block, presented: one symbol per relation variable.

        Equations
        Instances For
          Dependency graph
          Dependency graph

          The vocabulary an ∃SO[new] kernel is read over: the instance's, the mark of the original elements, and the block's.

          Equations
          Instances For
            Dependency graph

            The extended structure, as data #

            The numbering of the extended universe: the instance first, the invented values after it.

            Equations
            Instances For
              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph
              noncomputable def DescriptiveComplexity.extRel {L : FirstOrder.Language} (V : L.FinVocab) (B : SOBlock) (s : FirstOrder.Language.FinStruct V) (m : ) (tab : List (List Bool)) {n : } :
              ((newLang L).sum B.lang).Relations n(Fin nFin (s.univSize + m + 1))Bool

              The relations of the extended structure, read off the instance and the guessed table: an original symbol holds of a tuple of original elements exactly where it holds in the instance, the mark holds of the original elements, and a relation variable reads its guessed table.

              Equations
              Instances For
                Dependency graph
                @[simp]
                theorem DescriptiveComplexity.extRel_inl_inl {L : FirstOrder.Language} (V : L.FinVocab) (B : SOBlock) (s : FirstOrder.Language.FinStruct V) (m : ) (tab : List (List Bool)) {n : } (r : L.Relations n) (x : Fin nFin (s.univSize + m + 1)) :
                extRel V B s m tab (Sum.inl (Sum.inl r)) x = (FirstOrder.Language.andAll (List.ofFn fun (j : Fin n) => decide ((x j) < s.card)) && (s.table.getD (V.index r) []).getD (FirstOrder.Language.tupleIdx s.card (List.ofFn fun (j : Fin n) => (x j))) false)
                Dependency graph

                The only symbol of the marking vocabulary has arity one.

                Dependency graph
                @[simp]
                theorem DescriptiveComplexity.extRel_old {L : FirstOrder.Language} (V : L.FinVocab) (B : SOBlock) (s : FirstOrder.Language.FinStruct V) (m : ) (tab : List (List Bool)) (x : Fin 1Fin (s.univSize + m + 1)) :
                Dependency graph
                @[simp]
                theorem DescriptiveComplexity.extRel_inr {L : FirstOrder.Language} (V : L.FinVocab) (B : SOBlock) (s : FirstOrder.Language.FinStruct V) (m : ) (tab : List (List Bool)) {n : } (br : B.lang.Relations n) (x : Fin nFin (s.univSize + m + 1)) :
                extRel V B s m tab (Sum.inr br) x = (tab.getD ((blockVocab B).index br) []).getD (FirstOrder.Language.tupleIdx (s.univSize + m + 1) (List.ofFn fun (j : Fin n) => (x j))) false
                Dependency graph
                theorem DescriptiveComplexity.extRel_old_eq {L : FirstOrder.Language} (V : L.FinVocab) (B : SOBlock) (s : FirstOrder.Language.FinStruct V) (m : ) (tab : List (List Bool)) {n : } (o : FirstOrder.Language.oldMark.Relations n) (x : Fin nFin (s.univSize + m + 1)) :
                extRel V B s m tab (Sum.inl (Sum.inr o)) x = decide ((x (Fin.cast 0)) < s.card)
                Dependency graph

                The extended structure as data: the instance, m invented values, and the guessed relations, encoded as one concrete finite structure over the vocabulary the ∃SO[new] kernel is read in.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  Dependency graph
                  @[simp]
                  theorem DescriptiveComplexity.relMapBool_extStruct {L : FirstOrder.Language} (V : L.FinVocab) (B : SOBlock) (s : FirstOrder.Language.FinStruct V) (m : ) (tab : List (List Bool)) {n : } (R : ((newLang L).sum B.lang).Relations n) (x : Fin n(extStruct V B s m tab).Univ) :
                  (extStruct V B s m tab).relMapBool R x = extRel V B s m tab R x
                  Dependency graph

                  The assignment of the relation variables a guessed table denotes.

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

                    The data is the extended structure of the logic #

                    theorem DescriptiveComplexity.ofFn_extEquivFin {L : FirstOrder.Language} {V : L.FinVocab} {n : } (s : FirstOrder.Language.FinStruct V) (m : ) {x : Fin ns.Univ Fin m} {y : Fin ns.Univ} (hy : ∀ (j : Fin n), x j = Sum.inl (y j)) :
                    (List.ofFn fun (j : Fin n) => ((extEquivFin s m) (x j))) = List.ofFn fun (j : Fin n) => (y j)

                    The tuple of values of an original tuple.

                    Dependency graph
                    theorem DescriptiveComplexity.extRel_inl_inl_iff {L : FirstOrder.Language} [L.IsRelational] {n : } (V : L.FinVocab) (B : SOBlock) (s : FirstOrder.Language.FinStruct V) (m : ) (tab : List (List Bool)) (r : L.Relations n) (x : Fin ns.Univ Fin m) :
                    (extRel V B s m tab (Sum.inl (Sum.inl r)) fun (j : Fin n) => (extEquivFin s m) (x j)) = true ∃ (y : Fin ns.Univ), (∀ (j : Fin n), x j = Sum.inl (y j)) FirstOrder.Language.Structure.RelMap r y

                    The original symbols of the extended structure read the instance, on original elements only.

                    Dependency graph
                    noncomputable def DescriptiveComplexity.extIso {L : FirstOrder.Language} [L.IsRelational] (V : L.FinVocab) (B : SOBlock) (s : FirstOrder.Language.FinStruct V) (m : ) (tab : List (List Bool)) :
                    ((newLang L).sum B.lang).Equiv (s.Univ Fin m) (extStruct V B s m tab).Univ

                    The extended structure as data is the extended structure of the logic: the numbering of DescriptiveComplexity.extEquivFin is an isomorphism, for the assignment the guessed table denotes.

                    Equations
                    Instances For
                      Dependency graph

                      Every assignment is denoted by a table #

                      The extended universe is finite, so an assignment of the relation variables is a finite object: it is the reading of some list of Boolean tables. This is the step that turns the second-order existential of ∃SO[new] into a search over a Primcodable witness.

                      theorem DescriptiveComplexity.exists_tab {L : FirstOrder.Language} (V : L.FinVocab) (B : SOBlock) (s : FirstOrder.Language.FinStruct V) (m : ) (ρ : B.Assignment (s.Univ Fin m)) :
                      ∃ (tab : List (List Bool)), tabAssign B s m tab = ρ
                      Dependency graph

                      The witness is read primitive recursively #

                      Dependency graph

                      The theorem #

                      A recursively enumerable problem denotes a recursively enumerable set of concrete instances. The class DescriptiveComplexity.RE is defined by a logic – definability in ∃SO[new] – and this is the statement that the name is honest: through the encoding of FirstOrder.Language.FinStruct, its problems are exactly semi-decidable in Mathlib's sense.

                      No machine model is involved. The ∃SO[new] witness – a number of invented values and an assignment of the relation variables – is a finite object, so it is searched for; the first-order kernel is checked on it by the primitive recursive evaluator of DescriptiveComplexity.Computability.Eval.

                      Dependency graph