Documentation

Complexity.Computability.PolyTime.LinearAlgebra.BooleanMeasurements

Integer measurements of Boolean words #

Rows and matrices use the existing integer-list/table representations. Evaluation is total: missing bits are false, extra bits are ignored, and each row uses its own stored length. Matrix equality compares the complete output list, so a target with the wrong length cannot match. On rectangular inputs this agrees with the ordinary integer matrix/Boolean-vector product.

The unrestricted representative scan in [OAI26c], Lemma 3.2, printed pp. 22–23, searches for a word having the requested measurements. Fixed-bit restrictions belong to the later scan. This module supplies evaluation and that representative search, not the full counting identity.

Main definitions #

Main results #

References #

Evaluate one integer row. Missing bits are false; bits beyond the row are ignored.

Instances For

    Evaluate every stored row, including ragged inputs, in the original row order.

    Instances For

      Row evaluation is the integer dot product with the padded Boolean word.

      @[simp]

      Evaluation preserves the number of rows, also for malformed/ragged tables.

      Total lookup of an evaluated row agrees with evaluating the total row lookup.

      A target of the wrong length cannot be the matrix's complete measurement vector.

      theorem Cslib.LinearAlgebra.BooleanMeasurements.evalBoolMatrix_getD_eq_sum {M : List (List ℤ)} {r d : ℕ} (hM : IsTableShape r d M) (y : List Bool) (i : Fin r) :
      (evalBoolMatrix M y).getD (↑i) 0 = ∑ j : Fin d, rowEntry M ↑i ↑j * BitString.bitVal ℤ (y.getD (↑j) false)

      On an (r,d) table, measurement i < r is the finite integer dot product. The word is still padded/truncated by the total convention; an exactly d-bit word needs no padding.

      def Cslib.LinearAlgebra.BooleanMeasurements.test {C : Type} (matOf : C → List (List ℤ)) (targetOf : C → List ℤ) (p : C × List Bool) :

      Compare the complete measurement list to the target retained in the runtime context.

      Instances For
        def Cslib.LinearAlgebra.BooleanMeasurements.search {C : Type} (matOf : C → List (List ℤ)) (targetOf : C → List ℤ) (p : C × ℕ) :

        Search the unrestricted measurement fiber with the existing streaming first-match loop.

        Instances For
          theorem Cslib.LinearAlgebra.BooleanMeasurements.search_some {C : Type} (matOf : C → List (List ℤ)) (targetOf : C → List ℤ) (p : C × ℕ) {y : List Bool} (h : search matOf targetOf p = some y) :
          y.length = p.2 ∧ evalBoolMatrix (matOf p.1) y = targetOf p.1

          A returned representative has the requested width and exactly the requested measurements.

          theorem Cslib.LinearAlgebra.BooleanMeasurements.length_search_le {C : Type} (matOf : C → List (List ℤ)) (targetOf : C → List ℤ) (p : C × ℕ) :

          The raw-bit optional representative has at most the declared width plus its option tag.

          theorem Cslib.LinearAlgebra.BooleanMeasurements.search_eq_none_iff {C : Type} (matOf : C → List (List ℤ)) (targetOf : C → List ℤ) (p : C × ℕ) :
          search matOf targetOf p = none ↔ ∀ (y : List Bool), y.length = p.2 → evalBoolMatrix (matOf p.1) y ≠ targetOf p.1

          Failure is equivalent to the unrestricted fiber being empty. This uses the total padding convention even for ragged matrices, rather than silently assuming rectangular input.

          The equality test is uniformly polynomial in the complete retained context and candidate word encodings, using the supplied polynomial matrix/target projections.

          theorem Cslib.LinearAlgebra.BooleanMeasurements.search_eq_none_iff_cube {C : Type} (matOf : C → List (List ℤ)) (targetOf : C → List ℤ) (p : C × ℕ) :
          search matOf targetOf p = none ↔ ∀ (y : BitString p.2), evalBoolMatrix (matOf p.1) (List.ofFn y) ≠ targetOf p.1

          Empty-fiber completeness stated on the ordinary finite Boolean cube.

          Native representative search with the consumer's raw-bit option encoding, selecting the independent resource bounds above once, before any runtime context/width input. Both codec boundaries are included.

          Instances For

            The exported certificate's actual time has a fixed polynomial factor times the traversal count. Its encoded output is charged to its separate polynomial workspace bound.