Documentation

DescriptiveComplexity.Computability.CodeHalt

Drawing a partial recursive code as a concrete instance #

The computable half of the undecidability bridge: a primitive recursive map

Nat.Partrec.CodeFirstOrder.Language.FinStruct codeVocab

whose image is a yes-instance of DescriptiveComplexity.CODEHALT exactly when the code halts on 0 (DescriptiveComplexity.codehalt_toPred_codeStruct).

Nothing here simulates anything: the code is the instance, so the map is a plain tree flattening. DescriptiveComplexity.codeNodes lists the nodes of a code in preorder, each node carrying its constructor tag and the relative offsets of its children – relative, so that the flattening of a subterm is literally a segment of the flattening of the whole (DescriptiveComplexity.Seg), which is what makes the correctness proof an induction on the code and nothing more.

This is exactly what the machine route could not deliver. Mathlib's universal machine Turing.PartrecToTM2.tr is not finite-state, so code ↦ machine instance is not available; code ↦ syntax tree is trivially primitive recursive, and pushes the whole difficulty into CODEHALT ∈ RE, an ordinary membership proof of the catalog (DescriptiveComplexity.Problems.CodeHalt.Membership).

Whence the two results the layer exists for: DescriptiveComplexity.not_computablePred_of_RE_hard, every RE-hard problem is undecidable, and its first instance DescriptiveComplexity.finsat_not_computable, Trakhtenbrot's theorem.

Dependency graph

The vocabulary of code instances, presented: eleven symbols, nine unary and two binary.

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

    Flattening a code into a list of nodes #

    The reading of an index outside the flattening: a tag no constructor carries, and no children.

    Equations
    Instances For
      Dependency graph
      Dependency graph
      Dependency graph
      Dependency graph

      Segments #

      Seg L M i: the list M sits inside L starting at index i.

      Equations
      Instances For
        Dependency graph
        Dependency graph
        theorem DescriptiveComplexity.Seg.head {L M : List ( × × )} {i : } (h : Seg L M i) (hM : M []) :
        Dependency graph
        theorem DescriptiveComplexity.Seg.tail {L : List ( × × )} {a : × × } {M : List ( × × )} {i : } (h : Seg L (a :: M) i) :
        Seg L M (i + 1)
        Dependency graph
        theorem DescriptiveComplexity.Seg.appendLeft {L M N : List ( × × )} {i : } (h : Seg L (M ++ N) i) :
        Seg L M i
        Dependency graph
        theorem DescriptiveComplexity.Seg.appendRight {L M N : List ( × × )} {i : } (h : Seg L (M ++ N) i) :
        Seg L N (i + M.length)
        Dependency graph

        The instance a code draws #

        The constructor tag of the node at index i.

        Equations
        Instances For
          Dependency graph

          The offset of the first child of the node at index i, 0 for none.

          Equations
          Instances For
            Dependency graph

            The offset of the second child of the node at index i, 0 for none.

            Equations
            Instances For
              Dependency graph

              The relations a list of nodes denotes.

              Equations
              Instances For
                Dependency graph

                The instance a list of nodes draws. One element per node, and one spare element at the end which carries no mark – out-of-range readings return DescriptiveComplexity.nodeNone, whose tag is no constructor's.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  theorem DescriptiveComplexity.cArg1_iff (L : List ( × × )) (i j : (listStruct L).Univ) :
                  CArg1 i j off1At L i 0 j = i + off1At L i
                  Dependency graph
                  theorem DescriptiveComplexity.cArg2_iff (L : List ( × × )) (i j : (listStruct L).Univ) :
                  CArg2 i j off2At L i 0 j = i + off2At L i
                  Dependency graph
                  Dependency graph

                  The instance a code draws does draw it #

                  theorem DescriptiveComplexity.decodesTo_of_seg (L : List ( × × )) (c : Nat.Partrec.Code) (i : ) (hi : i < L.length + 1) :
                  Seg L (codeNodes c) iDecodesTo i, hi c

                  Every subterm is drawn at its segment.

                  Dependency graph

                  The root of the instance a code draws does draw that code.

                  Dependency graph

                  The instance a code draws is well formed #

                  Dependency graph
                  Dependency graph
                  Dependency graph

                  The instance draws the code, and nothing else #

                  The instance a code draws is a yes-instance exactly when the code halts on 0.

                  Dependency graph
                  Dependency graph

                  The map is primitive recursive #

                  Dependency graph
                  Dependency graph

                  Undecidability #

                  CODEHALT is undecidable. Mathlib's halting problem maps into it by the tree encoding, which is primitive recursive, so a decision procedure for the concrete instances would decide whether a partial recursive code halts.

                  Dependency graph

                  An RE-hard problem is undecidable. Hardness in this library is cofinal, so an RE-hard problem is in particular a target of CODEHALT, which is undecidable; and a first-order reduction is a computable many-one reduction of the induced sets (DescriptiveComplexity.not_computablePred_of_relOrderedReduction).

                  This is the leverage the whole DescriptiveComplexity.Computability layer exists for: every completeness theorem for RE now yields undecidability with no computability work of its own.

                  Dependency graph

                  Trakhtenbrot's theorem: whether a first-order sentence has a finite model is undecidable.

                  Dependency graph