Documentation

Complexitylib.Models.TuringMachine.Experimental.BinaryRoutine.Control.Defs

Proof-carrying binary routine control -- definitions #

This module adds value-level zero branching and canonical binary count-up loops to BinaryRoutine.

The loop certificate here deliberately differs from TM.BinaryForLoopSpec in two ways required by the routine interface. It starts at an arbitrary value, so body obligations are restricted to the reachable segment, and it accepts bounded iteration witnesses because BinaryRoutine.Sound advertises an upper bound rather than an exact runtime. Comparisons and endpoints remain exact.

structure Complexity.TM.BinaryForSegmentSpec {n : } (body : TM n) (counterIdx limitIdx : Fin n) (bodyTime : ) (startValue limitValue : ) :

A bounded execution certificate for the reachable segment of a canonical binary count-up loop.

Unlike BinaryForLoopSpec, iterations may finish before their advertised bound and obligations below startValue are not requested.

  • counter_ne_limit : counterIdx limitIdx

    The counter and preserved-limit tapes are distinct.

  • scanCfg : Cfg n (body.binaryForTM counterIdx limitIdx).Q

    Canonical scanner configuration at each reachable counter value.

  • iterationStartCfg : Cfg n (body.binaryForTM counterIdx limitIdx).Q

    Configuration at the composite body-plus-successor entry.

  • iterationDoneCfg : Cfg n (body.binaryForTM counterIdx limitIdx).Q

    Configuration after the composite body-plus-successor iteration.

  • doneCfg : Cfg n (body.binaryForTM counterIdx limitIdx).Q

    Final halted driver configuration.

  • testRun (value : ) : startValue valuevalue < limitValue(body.binaryForTM counterIdx limitIdx).reachesIn (binaryForCompareTime limitValue) (self.scanCfg value) (self.iterationStartCfg value)

    A nonterminal comparison enters the composite iteration exactly.

  • iterationTime :

    Selected actual runtime of each reachable composite iteration.

  • iterationTime_le (value : ) : startValue valuevalue < limitValueself.iterationTime value binaryForIterationTime bodyTime value

    The selected runtime stays within the advertised iteration bound.

  • iterationRun (value : ) : startValue valuevalue < limitValue(body.binaryForTM counterIdx limitIdx).reachesIn (self.iterationTime value) (self.iterationStartCfg value) (self.iterationDoneCfg value)

    The composite iteration runs for its selected actual runtime.

  • loopbackStep (value : ) : startValue valuevalue < limitValue(body.binaryForTM counterIdx limitIdx).step (self.iterationDoneCfg value) = some (self.scanCfg (value + 1))

    The preserving loopback seam starts the next comparison.

  • doneRun : (body.binaryForTM counterIdx limitIdx).reachesIn (binaryForCompareTime limitValue) (self.scanCfg limitValue) self.doneCfg

    Equality at the limit completes the final comparison exactly.

  • doneHalted : (body.binaryForTM counterIdx limitIdx).halted self.doneCfg

    The supplied final driver configuration is genuinely halted.

Instances For
    structure Complexity.TM.BinaryForSegmentSpaceSpec {n : } {body : TM n} {counterIdx limitIdx : Fin n} {bodyTime : } {startValue limitValue : } (spec : body.BinaryForSegmentSpec counterIdx limitIdx bodyTime startValue limitValue) (inputLength spaceBound : ) :

    All-prefix auxiliary-space obligations for a bounded reachable loop segment.

    Instances For
      def Complexity.BinaryRoutine.branchZero {n : } (idx : Fin n) (onZero onPositive : BinaryRoutine n) :

      Select between two routines by whether a canonical binary work value is zero. The blank branch is the zero branch.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def Complexity.BinaryRoutine.binaryForStep {n : } (body : BinaryRoutine n) (counterIdx : Fin n) (values : BinaryValues n) :

        One pure count-up iteration: apply the body effect, then overwrite the preserved counter with its successor.

        Equations
        Instances For
          def Complexity.BinaryRoutine.binaryForValues {n : } (body : BinaryRoutine n) (counterIdx : Fin n) (initial : BinaryValues n) :

          Pure work-vector trajectory after a number of count-up iterations.

          Equations
          Instances For
            def Complexity.BinaryRoutine.binaryForEmitted {n : } (body : BinaryRoutine n) (counterIdx : Fin n) (initial : BinaryValues n) :

            Word emitted by the first count iterations of a count-up body.

            Equations
            Instances For
              def Complexity.BinaryRoutine.binaryForBodyTime {n : } (body : BinaryRoutine n) (counterIdx : Fin n) (initial : BinaryValues n) (startValue value : ) :

              Body-time bound at an absolute counter value in a pure trajectory.

              Equations
              Instances For
                def Complexity.BinaryRoutine.binaryForCount {n : } (counterIdx limitIdx : Fin n) (values : BinaryValues n) :

                Number of iterations remaining between the initial counter and limit.

                Equations
                Instances For
                  def Complexity.BinaryRoutine.binaryForTime {n : } (body : BinaryRoutine n) (counterIdx limitIdx : Fin n) (values : BinaryValues n) :

                  Advertised upper bound for a proof-carrying binary count-up loop.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    def Complexity.BinaryRoutine.binaryForIterationSpace {n : } (body : BinaryRoutine n) (counterIdx : Fin n) (initialSpace : ) (initial : BinaryValues n) (count : ) :

                    Space needed by one body-plus-successor iteration. This is a maximum, not a sum: sequential phases reuse the same work cells.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def Complexity.BinaryRoutine.binaryForIterationSpaceMax {n : } (body : BinaryRoutine n) (counterIdx : Fin n) (initialSpace : ) (initial : BinaryValues n) :

                      Maximum space of the first count iterations.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      • body.binaryForIterationSpaceMax counterIdx initialSpace initial 0 = initialSpace
                      Instances For
                        def Complexity.BinaryRoutine.binaryForSpace {n : } (body : BinaryRoutine n) (counterIdx limitIdx : Fin n) (initialSpace : ) (values : BinaryValues n) :

                        Reusable auxiliary-space bound for a binary count-up loop. Comparison width and per-iteration requirements are maximized, so the number of iterations does not itself consume space.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          def Complexity.BinaryRoutine.binaryFor {n : } (body : BinaryRoutine n) (counterIdx limitIdx : Fin n) :

                          Iterate body while a canonical binary counter is strictly below a preserved canonical limit, incrementing the counter after every body run.

                          The domain honestly requires the body at every reachable intermediate value and requires its pure effect to preserve both controller values.

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