Documentation

Complexity.Computability.GenericRAM.Native.MeasurementFold

Streaming signed measurement values #

The dimension is a runtime unary natural and the radius a runtime binary natural. The decoder uses the existing radix digits to produce ordinary signed integer lists. Count preparation and individual visits are polynomial in their full encoded input, even though the number of visits need not be. All coordinates remain present at radius zero; dimension zero has one empty tuple.

Only the current binary index, full parameters and captured accumulator persist. The decoder may use polynomial scratch (including a dimension-length range), but never constructs the whole measurement box. Index/box lists in the ordered-fold specification are not used by the native loop. The generic callback may grow its accumulator: polynomial whole-loop workspace requires an actual all-prefix accumulator invariant, not just a polynomial per-visit certificate.

This is the measurement-VALUE enumeration of [OAI26c], Lemma 3.2 and Proposition 3.4 (pp. 22–26). It is not formal mode-exponent enumeration, subset-pair traversal, rational coefficient accumulation or a complete runtime/ETH result.

The actual number of signed measurement tuples in dimension c and radius D.

Instances For

    An actual fixed native count-preparation machine; no unary exponential count is produced.

    Instances For

      Both preparation bounds are polynomial in the complete runtime pair encoding.

      The binary count has polynomial bit length, rather than polynomial numeric value.

      Decode the actual signed measurement values with unary dimension and binary radius/index. No fitting-index hypothesis is needed for this total polynomial-time decoder.

      The two selected decoder bounds are polynomial in its complete encoded runtime input.

      The tuple code is polynomial in dimension and binary radius length, not in radius value.

      def Cslib.GenericRAM.MeasurementFold.visit {β : Type} (body : ((ℕ × ℕ) × List ℤ) × β → β) (p : ℕ × (ℕ × ℕ) × β) :
      (ℕ × ℕ) × β

      Decode the current index while retaining the full runtime parameters outside the user body.

      Instances For
        def Cslib.GenericRAM.MeasurementFold.runPrefix {β : Type} (body : ((ℕ × ℕ) × List ℤ) × β → β) (p : ℕ × ℕ) (j : ℕ) (initial : β) :
        ℕ × (ℕ × ℕ) × β

        A streaming prefix stores only the binary index, complete parameters and captured state.

        Instances For
          def Cslib.GenericRAM.MeasurementFold.run {β : Type} (body : ((ℕ × ℕ) × List ℤ) × β → β) (p : ℕ × ℕ) (initial : β) :
          ℕ × (ℕ × ℕ) × β

          Traverse the signed measurement-value box by increasing binary index.

          Instances For
            @[simp]
            theorem Cslib.GenericRAM.MeasurementFold.prefix_parameters {β : Type} (body : ((ℕ × ℕ) × List ℤ) × β → β) (p : ℕ × ℕ) (j : ℕ) (initial : β) :
            (runPrefix body p j initial).2.1 = p

            Neither dimension nor radius can be overwritten by the callback.

            theorem Cslib.GenericRAM.MeasurementFold.prefix_accumulator {β : Type} (body : ((ℕ × ℕ) × List ℤ) × β → β) (p : ℕ × ℕ) (j : ℕ) (initial : β) :
            (runPrefix body p j initial).2.2 = List.foldl (fun (acc : β) (i : ℕ) => body ((p, Radix.measurementValues p.1 p.2 i), acc)) initial (List.range j)

            All prefixes follow the increasing-index order, with full parameters and captured state.

            theorem Cslib.GenericRAM.MeasurementFold.run_accumulator {β : Type} (body : ((ℕ × ℕ) × List ℤ) × β → β) (p : ℕ × ℕ) (initial : β) :
            (run body p initial).2.2 = List.foldl (fun (acc : β) (word : List ℤ) => body ((p, word), acc)) initial (List.map (Radix.measurementValues p.1 p.2) (List.range (count p)))

            Exact ordered-fold specification. With measurementValues_coverage, every fitting signed word is visited once. The materialized index/word lists occur only in this specification.

            theorem Cslib.GenericRAM.MeasurementFold.length_prefix_le {β : Type} {encB : β ↪ List Bool} (body : ((ℕ × ℕ) × List ℤ) × β → β) (c D j B : ℕ) (initial : β) (hj : j ≤ count (c, D)) (hB : (encB (runPrefix body (c, D) j initial).2.2).length ≤ B) :

            Full encoded persistent-state bound under the actual prefix accumulator bound. It includes both retained parameters and the final binary counter, including at base one/dimension zero.

            Preparing a callback charges both parameters, every signed coordinate and the full captured accumulator. This bound is about the encoded input, not uncharged machine scratch.

            One fixed native machine streams all measurement values. Count preparation is charged, time retains the visit-count factor, and workspace uses the existing all-prefix maxima. No whole-loop polynomial-time bound or polynomial accumulator invariant is assumed.

            Instances For