Documentation

MIPRE.Foundations.Halting.Semidecider

The semidecider of the halting reduction (obligation O3) #

Obligation O3 of the halting reduction (Halting/Reduction.lean) asks for a closed program halting on encode (x, n) exactly when the string x lies outside the class B at level n. By Verifier.not_inClassB_iff that is a disjunction of three ฮฃโ‚ statements โ€” the verifier x denotes is not n-bounded, or its decider accepts some answer longer than the answer bound, or its n-th game has value more than 1/2 โ€” and the obligation is an equivalence, so all three have to be recognized exactly.

The second disjunct is the tabulation's, and is O2's to supply: with a computable game description whose value is that of ๐’ฑ_n, lem:value-lower-approx (MIPRE.ValueApprox.rePred_lt_quantumValue) enumerates the strategies. The first is proved here, and it is the part of O3 that O2 does not contain:

What was assumed, and what discharged it #

exists_sem_of_tab takes the tabulation and the presentation of the family as hypotheses. Both are O2's: a GameData for ๐’ฑ_n cannot be computed without the sampler's dimension and the two programs. Stating them rather than proving them keeps the mathematical content here โ€” that the violation of a โˆ€-clause over an infinite index set is enumerable โ€” independent of how the tabulation is built. Both are now supplied: Halting.computablyPresented_Vof at the end of this file, and Halting.tab_value in Halting/Instantiation.lean, so that Halting.exists_sem takes no hypotheses; halting_reduction (Halting/Reduction.lean, below this file in the import order) applies it directly, and Obligations has no O3 field.

Two things found in the writing, both recorded in planning/h4-assembly.md, and both since discharged โ€” by different repairs. The findings are kept because they say where the seams were:

  1. O3 is not "O2 plus a disjunction", as the plan and Obligations' docstring said. The hypothesis hval below asks the tabulation to have the value of ๐’ฑ_n for every n-bounded verifier, and the match as it then stood gave that only for a verifier synchronous at n โ€” because a GameData describes a synchronous game by construction (MIPRE.Verifier.isSynchronousAt_of_game_matches). Membership in B does not carry synchronicity, so the equivalence sem_spec demands was not available. Three ways out were on the record; the one taken is the doubled question set of Foundations/GameDouble.lean. MIPRE.Halting.tab_match now matches (Vof G U x).doubledGame, whose distribution puts no weight on the diagonal a GameData vetoes, and MIPRE.Halting.tab_value is hval on the nose โ€” the equality, in both directions, at every n-bounded string.
  2. Primrec fun n : โ„• => (encode n : Data) โ€” natural numbers encode in binary (Nat.bits) โ€” was missing and is a prerequisite of ComputablyPresented for the verifier a string denotes, hence of O2's tabulation too. It is now MIPRE.Cost.Data.primrec_encode_nat. The witness trick above is what kept this file from needing it in the first place.

Two closure properties of recursively enumerable predicates #

theorem MIPRE.REPred.or {ฮฑ : Type u_1} [Primcodable ฮฑ] {p q : ฮฑ โ†’ Prop} (hp : REPred p) (hq : REPred q) :
REPred fun (a : ฮฑ) => p a โˆจ q a

A union of two r.e. predicates is r.e., by dovetailing (Partrec.merge'). Mathlib has the dovetailing but not this corollary of it.

theorem MIPRE.REPred.of_computable_exists {ฮฑ : Type u_1} {ฮฒ : Type u_2} [Primcodable ฮฑ] [Primcodable ฮฒ] [Inhabited ฮฒ] {test : ฮฑ โ†’ ฮฒ โ†’ Bool} (h : Computable fun (q : ฮฑ ร— ฮฒ) => test q.1 q.2) :
REPred fun (a : ฮฑ) => โˆƒ (b : ฮฒ), test a b = true

A ฮฃโ‚ predicate is r.e.: an unbounded search for a witness passing a computable test. MIPRE.ValueApprox.REPred.of_primrecRel_exists is the same statement for a primitive recursive test; the tests here are only computable, the dimension of a compressed sampler being read off a run of its program.

The boundedness violation #

โ‰ค on naturals as a primitive recursive Bool-valued function. Primrec.nat_le is a PrimrecRel, which hides the Decidable instance behind an existential and so does not compose with Computable arguments; this is the same fact in usable form.

Equality on Option Data as a primitive recursive Bool-valued function, extracted from Primrec.eq the way primrec_natLeB extracts Primrec.nat_le.

structure MIPRE.Verifier.ComputablyPresented {ฮฑ : Type u_1} [Primcodable ฮฑ] {โ„“ : โ„•} (V : ฮฑ โ†’ Verifier โ„“) :

A family of verifiers is computably presented when the two programs of V a and the dimension of its sampler are computable in a โ€” the programs as the data that encode them, which is the form every computability statement of the ambient model takes.

This is what a computable tabulation of the games of the family needs anyway (MIPRE.Halting.tab_computable): the question weights come from running the sampler over ๐”ฝโ‚‚^{s(n)}, so s(n) has to be computed before anything else can be.

Instances For

    The budget the time bounds of def:lambda-bounded allow at index m on the input d: m ^ ฮป ยท (|d| + 1) ^ ฮป, read off the shape of Decider.TimeBoundAt.

    Equations
    Instances For
      def MIPRE.Verifier.BoundViolation {โ„“ : โ„•} (V : Verifier โ„“) (lam : โ„•) (w : Cost.Data ร— Cost.Data) :

      A witness that ฮป-boundedness fails. The index at which a clause of def:lambda-bounded breaks is carried as a datum w.1 โ€” read as the number Data.natOf w.1, so that the encoding encode (Data.natOf w.1) the two time bounds prepend to their input is Data.normBin w.1, primitive recursive in the witness โ€” and w.2 is an input of the sampler or of the decider at that index on which the time bound fails.

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

        The witness test, as a Bool: every clause of BoundViolation is decidable, the two time bounds by Machine.haltsWithinB (Halting/CostBudget.lean).

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem MIPRE.Verifier.not_isBounded_iff_exists {โ„“ : โ„•} (V : Verifier โ„“) (lam : โ„•) :

          ฮป-boundedness fails exactly when some witness works. Each clause of def:lambda-bounded is a universal statement โ€” over indices, and over the inputs of the two programs โ€” so its negation is a search, and BoundViolation is what the search looks for.

          The rejection of long answers, violated #

          A witness that the decider accepts a long answer at index n: a tuple of two questions and two answers, one of the answers longer than T, and a step budget within which the decider's run on the tuple returns true. The budget is what makes the acceptance, a ฮฃโ‚ statement, testable.

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

            The witness test, as a Bool.

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

              Rejection of long answers fails exactly when some witness works: RejectsLong is a universal statement over tuples, so its negation is a search for a tuple, and acceptance on the tuple is a search for a budget, Machine.runForD returning the result of a run within its budget (Machine.runForD_eq_some_iff).

              @[reducible, inline]
              abbrev MIPRE.Verifier.LongZ (ฮฑ : Type u_2) :
              Type u_2

              The search space of rePred_not_rejectsLong: a witness paired with the parameters.

              Equations
              Instances For
                theorem MIPRE.Verifier.computable_longInput {ฮฑ : Type u_1} [Primcodable ฮฑ] :
                Computable fun (z : LongZ ฮฑ) => Cost.encode (z.1.2, z.2.1.1, z.2.1.2.1, z.2.1.2.2.1, z.2.1.2.2.2)
                theorem MIPRE.Verifier.computable_longRun {ฮฑ : Type u_1} [Primcodable ฮฑ] {โ„“ : โ„•} {V : ฮฑ โ†’ Verifier โ„“} (hV : ComputablyPresented V) :
                Computable fun (z : LongZ ฮฑ) => Cost.Machine.runForD (Cost.encode (V z.1.1).decider.prog) (Cost.encode (z.1.2, z.2.1.1, z.2.1.2.1, z.2.1.2.2.1, z.2.1.2.2.2)) z.2.2
                theorem MIPRE.Verifier.computable_longRunB {ฮฑ : Type u_1} [Primcodable ฮฑ] {โ„“ : โ„•} {V : ฮฑ โ†’ Verifier โ„“} (hV : ComputablyPresented V) :
                Computable fun (z : LongZ ฮฑ) => decide (Cost.Machine.runForD (Cost.encode (V z.1.1).decider.prog) (Cost.encode (z.1.2, z.2.1.1, z.2.1.2.1, z.2.1.2.2.1, z.2.1.2.2.2)) z.2.2 = some (Cost.encode true))
                theorem MIPRE.Verifier.computable_longLen {ฮฑ : Type u_1} [Primcodable ฮฑ] {T : ฮฑ โ†’ โ„• โ†’ โ„•} (hT : Computable fun (q : ฮฑ ร— โ„•) => T q.1 q.2) :
                Computable fun (z : LongZ ฮฑ) => decide (T z.1.1 z.1.2 + 1 โ‰ค List.length z.2.1.2.2.1) || decide (T z.1.1 z.1.2 + 1 โ‰ค List.length z.2.1.2.2.2)
                theorem MIPRE.Verifier.computable_longAcceptanceB {ฮฑ : Type u_1} [Primcodable ฮฑ] {โ„“ : โ„•} {V : ฮฑ โ†’ Verifier โ„“} (hV : ComputablyPresented V) {T : ฮฑ โ†’ โ„• โ†’ โ„•} (hT : Computable fun (q : ฮฑ ร— โ„•) => T q.1 q.2) :
                Computable fun (z : LongZ ฮฑ) => (V z.1.1).longAcceptanceB z.1.2 (T z.1.1 z.1.2) z.2
                theorem MIPRE.Verifier.rePred_not_rejectsLong {ฮฑ : Type u_1} [Primcodable ฮฑ] {โ„“ : โ„•} {V : ฮฑ โ†’ Verifier โ„“} (hV : ComputablyPresented V) {T : ฮฑ โ†’ โ„• โ†’ โ„•} (hT : Computable fun (q : ฮฑ ร— โ„•) => T q.1 q.2) :
                REPred fun (q : ฮฑ ร— โ„•) => ยฌ(V q.1).RejectsLong q.2 (T q.1 q.2)

                The acceptance of a long answer is recursively enumerable for a computably presented family and a computable answer bound: Verifier.not_rejectsLong_iff_exists turns the failure of RejectsLong into a search, longAcceptanceB runs the test โ€” the length comparison and one budgeted run of the decider โ€” and REPred.of_computable_exists does the searching. This is the third disjunct of Verifier.not_inClassB_iff.

                theorem MIPRE.Verifier.rePred_not_isBounded {ฮฑ : Type u_1} [Primcodable ฮฑ] {โ„“ : โ„•} {V : ฮฑ โ†’ Verifier โ„“} (hV : ComputablyPresented V) :
                REPred fun (q : ฮฑ ร— โ„•) => ยฌ(V q.1).IsBounded q.2

                The boundedness violation is recursively enumerable for a computably presented family: Verifier.not_isBounded_iff_exists turns it into a search, Verifier.boundViolationB runs the test, and REPred.of_computable_exists does the searching.

                The semidecider #

                theorem MIPRE.Halting.exists_sem_of_tab {G : GapCompression} {U : Cost.UniversalMachine} (ฯ‰ : ValueModel) (hlow : ฯ‰.LowerRE) (hV : Verifier.ComputablyPresented (Vof G U)) (tab : Cost.BitStr โ†’ โ„• โ†’ HaltingGameValue.GameData) (htab : Computable fun (q : Cost.BitStr ร— โ„•) => tab q.1 q.2) (hval : โˆ€ (x : Cost.BitStr) (n : โ„•), (Vof G U x).IsBounded n โ†’ ฯ‰.val (tab x n).game = (Vof G U x).val ฯ‰ n (ansBound G x n)) :
                โˆƒ (S : Cost.Prog), Cost.Prog.WellScoped 1 S โˆง โˆ€ (x : Cost.BitStr) (n : โ„•), Cost.Halts S (Cost.encode (x, n)) โ†” x โˆ‰ classB G U ฯ‰ n

                Obligation O3 from the tabulation of O2, in a value model r.e. from below. For a computably presented family of verifiers, a computable tabulation whose game has the value of ๐’ฑ_n in the model at every n-bounded string, and a lower semidecider for the value, a closed program halts on encode (x, n) exactly off the class B of the model at level n โ€” obligation O3 of the halting reduction, applied by halting_reduction_lower through exists_sem_lower.

                The three disjuncts of Verifier.not_inClassB_iff are enumerated separately โ€” the boundedness violation by Verifier.rePred_not_isBounded, the acceptance of a long answer by Verifier.rePred_not_rejectsLong, the value by the lower semidecider on the tabulation (lem:value-lower-approx at ValueModel.tensor) โ€” and merged by dovetailing (REPred.or).

                The family Vof is computably presented. All three fields, and all three are O2's: the two programs by computable_sampData/sampData_eq and computable_decProgData/decProgData_eq, and the third โ€” the sampler's dimension, unconditionally in the string and the level โ€” by the re-budgeted dimOf read back by dimOf_eq. That dimOf_eq carries no hypothesis is the whole point: ComputablyPresented asks for the true dimension at every string and every level, including n = 0 and n = 1, and the budget IsBounded n supplies cannot reach those. What supplies it instead is GapCompression.sampler_time, which holds for every parameter and every index.

                theorem MIPRE.Halting.exists_sem_lower (G : GapCompression) (U : Cost.UniversalMachine) (ฯ‰ : ValueModel) (hlow : ฯ‰.LowerRE) :
                โˆƒ (S : Cost.Prog), Cost.Prog.WellScoped 1 S โˆง โˆ€ (x : Cost.BitStr) (n : โ„•), Cost.Halts S (Cost.encode (x, n)) โ†” x โˆ‰ classB G U ฯ‰ n

                Obligation O3, with no hypotheses left but the lower semidecider. Both arguments of exists_sem_of_tab are discharged by O2: the computable presentation by the re-budgeted sampler runs, and hval โ€” the value equality at every n-bounded string, in both directions and with no synchronicity โ€” by the doubled question set of Foundations/GameDouble.lean (tab_val).

                This is the repair blueprint lem:halting-semidecider records as the first of three, and the only one that changes nothing outside the tabulation: the two alternatives were to make Decider.wrap reject unequal answers at equal questions, which changes what a string denotes and so reopens accOf_iff, the classes and thm:compression; or to put synchronicity into classB, which moves the cost into compr_spec, a field of the one obligation still open.

                Obligation O3 for the tensor-product value, with no hypotheses.

                theorem MIPRE.Halting.exists_sem_upper (G : GapCompression) (U : Cost.UniversalMachine) (ฯ‰ : ValueModel) (hup : ฯ‰.UpperRE) :
                โˆƒ (S : Cost.Prog), Cost.Prog.WellScoped 1 S โˆง โˆ€ (x : Cost.BitStr) (n : โ„•), Cost.Halts S (Cost.encode (x, n)) โ†” x โˆ‰ classOne G U ฯ‰ n

                Obligation O3 for the coRE direction, in a value model r.e. from above: a closed program halting on encode (x, n) exactly off classOne ฯ‰ n, that is, when the tabulated game at level n has value below 1 โ€” the upper semidecider at the threshold 1/1, composed with the computable tabulation. At ValueModel.commuting this is the role Lin's proof gives to the NPA hierarchy (Lin25). No boundedness is involved: classOne is read on the tabulation.