Documentation

Complexity.Computability.WordRAM.Multiword.BankOps

Checked operations on multiword register banks #

The constants are installed as explicit half-word digits. Boolean operations execute one standard instruction per digit. Scalar arithmetic is provided separately in BankScalar.

Main definitions #

Main results #

References #

Canonical fixed-length digits; no computation depending on the run-time input is performed by the constant installer.

Instances For

    Install an eighteen-digit constant, charging all eighteen constants and the final copy.

    Instances For
      theorem Cslib.WordRAM.Multiword.Bank.size_constant {n : ℕ} (w z : ℕ) (d : Fin n) :
      (constant w z d).size = 19
      theorem Cslib.WordRAM.Multiword.Bank.exec_constant {n w : ℕ} (hw : 2 ≤ w) (d : Fin n) (z : ℕ) (hz : z < 2 ^ (6 * w)) (x : Data (capacity n + 4)) {v : Fin n → ℕ} (hx : Encodes w x v) :
      ∃ (y : Data (capacity n + 4)), Exec w (constant w z d) x y 19 ∧ Encodes w y (Function.update v d z) ∧ y.mem = x.mem ∧ ∀ i ∉ regs d, y.regs i = x.regs i

      A Boolean operation on two bank entries with a fresh destination.

      Instances For
        theorem Cslib.WordRAM.Multiword.Bank.size_boolean {n : ℕ} (f : BinOp) (a b d : Fin n) :
        (boolean f a b d).size = 19
        theorem Cslib.WordRAM.Multiword.Bank.exec_boolean {n w : ℕ} (hw : 2 ≤ w) {f : BinOp} (hf : Bitwise.Supported f) (a b d : Fin n) (hda : d ≠ a) (hdb : d ≠ b) (x : Data (capacity n + 4)) {v : Fin n → ℕ} (hx : Encodes w x v) :
        ∃ (y : Data (capacity n + 4)), Exec w (boolean f a b d) x y 19 ∧ Encodes w y (Function.update v d (f.eval (v a) (v b))) ∧ y.mem = x.mem
        @[reducible, inline]

        Physical register receiving the ordinary one-word input.

        Instances For

          All bank digits, excluding the forty-four physical workspace registers.

          Instances For

            Initialize every bank digit, charging one constant instruction per digit.

            Instances For
              theorem Cslib.WordRAM.Multiword.Bank.exec_clear {n w : ℕ} (hw : 2 ≤ w) (x : Data (capacity n + 4)) :
              ∃ (y : Data (capacity n + 4)), Exec w (clear n) x y (18 * n + 1) ∧ (Encodes w y fun (x : Fin n) => 0) ∧ y.mem = x.mem ∧ y.regs inputReg = x.regs inputReg

              Clearing starts from arbitrary registers and memory, and preserves the physical input.

              Load the sole input from the usual RAM input memory, then split it into a bank entry. The input memory contains its length at address zero and its value at address one.

              Instances For
                theorem Cslib.WordRAM.Multiword.Bank.exec_input {n w z : ℕ} (hw : 2 ≤ w) (hz : Fits w z) (d : Fin n) :
                ∃ (y : Data (capacity n + 4)), Exec w (input d) (Data.init [z]) y 46 ∧ Encodes w y (Function.update (fun (x : Fin n) => 0) d z) ∧ y.mem = (Data.init [z]).mem ∧ y.regs inputReg = z

                Input delivery and conversion are charged: two input instructions and forty-four digit-conversion instructions. All remaining bank entries start at zero.