Documentation

Complexity.Algorithms.MatrixMultiplication.Schonhage.MaskTable

Deterministic mask tables for matrix bands #

Size-m level sets are ordered by their binary masks. The first K0² masks are assigned in row-major order to block pairs. This specifies a deterministic instance of the existing Layout; a native scan can compute the table without receiving indexing data as an input.

Main definitions #

Main results #

The set of levels whose binary digit is one.

Instances For

    The integer mask of a finite level set, with level zero least significant.

    Instances For

      Decoding the explicitly numbered mask recovers the original set.

      Encoding a decoded bounded mask recovers the original integer.

      Binary-mask numbering is an explicit bijection, not a chosen enumeration.

      Instances For

        Number of one digits among exactly the first L binary digits.

        Instances For

          A zero-depth scan has population zero.

          One native remainder/division step removes the lowest digit.

          There are at most L one digits, even for an unbounded natural argument.

          The loop's digit sum is the cardinality of the represented level set.

          All valid masks, in the ordinary linear order on bounded naturals.

          Instances For

            Every size-m subset occurs once in the bounded mask scan.

            Number of valid masks strictly below the scan counter.

            Instances For

              The scan begins without any accepted mask.

              A scan accepts at most one mask in each iteration.

              The actual scalar counter update for one mask.

              Extending a scan cannot decrease the accepted-mask counter.

              Earlier valid masks have strictly smaller accepted-mask ranks.

              The finite complete scan has exactly the binomial count.

              The scalar scan count equals the rank among the bounded valid masks.

              Row-major block-pair rank in the full list of size-m masks.

              Instances For

                The selected mask at a block pair is the corresponding mask in increasing order.

                Instances For

                  The computed prefix counter at a selected mask is its row-major block-pair rank.

                  The dense inverse-table word: zero for an unselected mask, otherwise rank plus one.

                  Instances For

                    Exactly the selected valid masks have nonzero inverse-table words.

                    Every inverse-table word is bounded by its original mask plus one.

                    The inverse-table word at every selected block pair has the promised rank.

                    A nonzero inverse-table word belongs to one of the selected block pairs.

                    theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.MaskTable.lookup_blockPair {L m : ℕ} (gh : Fin (K0 L m) × Fin (K0 L m)) :
                    (lookup L m ↑(selectedMask gh) - 1) / K0 L m = ↑gh.1 ∧ (lookup L m ↑(selectedMask gh) - 1) % K0 L m = ↑gh.2

                    Inverse-table division and remainder recover exactly the two block indices.

                    theorem Cslib.Algorithms.MatrixMultiplication.Schonhage.MaskTable.lookup_block_lt {L m a : ℕ} (h : lookup L m a ≠ 0) (rightSide : Bool) :
                    (if rightSide = true then (lookup L m a - 1) % K0 L m else (lookup L m a - 1) / K0 L m) < K0 L m

                    Both decoded block indices are in range whenever the inverse-table word is nonzero.

                    Selected masks always have exactly the required cardinality.

                    Distinct block pairs receive distinct level sets.

                    The thin-dimension pair digit uses row-major order, as do the encoder's inner variables.

                    Instances For

                      Explicit base-three outer strings and base-four strings of index pairs, with the first K0² binary masks in increasing order as the shared block table.

                      Instances For