Documentation

Complexity.Algorithms.WordRAM.ThreeSum.Cell

One cell of the three Convolution-3SUM matrices #

This directly adapts fillCells of Anthropic's pinned graph builder at 16a5ce41304fcdaea4e0be7c132e1c361dc26da5, using native unsigned word-RAM instructions. The row and column, all three input indices, and the three destination addresses are computed by the program. A negative BC index is replaced with the negative sentinel -1: both select the filler. Registers 22 through 25 are additional scratch; registers 14 through 21 belong to the caller. The AB and BC destinations follow the input, preserving it for subsequent reads. The final AC write may alias the input; the complete matrix loop uses disjoint blocks.

Main definitions #

Main results #

References #

@[reducible, inline]

Current row-major cell.

Instances For
    @[reducible, inline]

    Number of vertices per part.

    Instances For
      @[reducible, inline]

      Instance number.

      Instances For
        @[reducible, inline]

        Base address of matrix AB.

        Instances For
          @[reducible, inline]

          Base address of matrix BC.

          Instances For
            @[reducible, inline]

            Base address of matrix AC.

            Instances For
              @[reducible, inline]

              Input length.

              Instances For
                @[reducible, inline]

                Input base address.

                Instances For
                  @[reducible, inline]

                  Signed encoded filler.

                  Instances For
                    @[reducible, inline]

                    Encoded source index.

                    Instances For
                      @[reducible, inline]

                      Current destination address.

                      Instances For
                        @[reducible, inline]

                        Saved encoded filler.

                        Instances For
                          @[reducible, inline]

                          Encoded negation of the filler.

                          Instances For
                            @[reducible, inline]

                            Computed row of the current cell.

                            Instances For
                              @[reducible, inline]

                              Computed column of the current cell.

                              Instances For

                                Place the fourteen weight registers at the start of the cell register file.

                                Instances For

                                  The existing weight kernel embedded in the larger register file.

                                  Instances For

                                    Save the filler, compute the coordinates and prepare its negation operands.

                                    Instances For

                                      Compute the row and column, save the filler, and form its signed negation.

                                      Instances For

                                        Write the AB cell, including encoding its index and calculating its address.

                                        Instances For

                                          Write the AB cell after computing its index and destination.

                                          Instances For

                                            Write BC, testing for a negative index before unsigned subtraction.

                                            Instances For

                                              Write BC after computing its guarded signed index and destination.

                                              Instances For

                                                Write AC with negated filler before negating the selected value, then restore the filler.

                                                Instances For

                                                  Write AC and restore the caller's positive filler.

                                                  Instances For

                                                    Compute and write all three entries at the current row-major cell.

                                                    Instances For
                                                      theorem Cslib.Algorithms.WordRAM.ThreeSum.Cell.exec_step {w N b ab bc ac q t s : ℕ} {μ : ℕ → ℤ} {F : ℤ} (x : WordRAM.Data 28) (hcell : x.regs cell = q) (ht : x.regs side = t) (hs : x.regs inst = s) (hab : x.regs matAB = ab) (hbc : x.regs matBC = bc) (hac : x.regs matAC = ac) (hlen : x.regs len = N) (hbase : x.regs base = b) (hf : x.regs filler = WordRAM.Signed.encode F) (hmem : ∀ i < N, x.mem (b + i) = WordRAM.Signed.encode (μ i)) (hq : q < t * t) (hidx : GenericRAM.Signed.Fits w ↑(2 * (t * t) + s + 1)) (hF : GenericRAM.Signed.Fits w F) (hnF : GenericRAM.Signed.Fits w (-F)) (hμ : ∀ i < N, GenericRAM.Signed.Fits w (μ i)) (haddr : WordRAM.Fits (w + 2) (b + N)) (habfit : WordRAM.Fits (w + 2) (ab + q)) (hbcfit : WordRAM.Fits (w + 2) (bc + q)) (hacfit : WordRAM.Fits (w + 2) (ac + q)) (hbelowAB : b + N ≤ ab) (hbelowBC : b + N ≤ bc) :
                                                      ∃ (y : WordRAM.Data 28), WordRAM.ExecWithin (w + 2) step x y 128 ∧ y.mem = Function.update (Function.update (Function.update x.mem (ab + q) (WordRAM.Signed.encode (ThreeSum.pick N μ F ↑q))) (bc + q) (WordRAM.Signed.encode (ThreeSum.pick N μ F (↑(q % t * t + s) - ↑(q / t))))) (ac + q) (WordRAM.Signed.encode (-ThreeSum.pick N μ (-F) ↑((q / t + q % t) * t + s))) ∧ y.regs filler = x.regs filler ∧ ∀ (i : Fin 28), ↑i = 10 ∨ ↑i = 11 ∨ 14 ≤ ↑i ∧ ↑i ≤ 21 ∨ 26 ≤ ↑i → y.regs i = x.regs i

                                                      All index computations, three guarded loads, optional signed negation, stores and argument preparation take at most 128 native instructions. The final halt is excluded. Input cells precede all destinations; the three writes occur in AB, BC, AC order.