NLA-lib Explorer

NLAlib.Ops.Examples.WorkedInstances.Strided.instance_run

Library · theorem

The instance. At length 3 and increment 2, from the factor 5 and the buffer [1, 100, 2, 200, 3], the execution rules derive one outcome of the strided scaling: the buffer holds [5, 100, 10, 200, 15], so cells 1 and 3 are untouched; the run makes 3 multiplications and no other operation, 59 instructions in all, and uses no scratch.

NLAlib.Ops.Examples.WorkedInstances.Strided.instance_run :
  ∃ st,
    Ops.Reference.Execution Ops.Examples.WorkedInstances.Strided.program
        Ops.Examples.WorkedInstances.Strided.interp Ops.Examples.WorkedInstances.Strided.resources
        (fun x ↦ Ops.StorageFormat.cell) (fun x x_1 ↦ 0) ![3, 2]
        Ops.Examples.WorkedInstances.Strided.initial st ∧
      st.mem = { store := [[some 5], [some 5, some 100, some 10, some 200, some 15]], pos := 0 } ∧
        Ops.Count.original st.cost = 3 • Ops.Count.one Ops.ScalarOp.mul [] ∧
          Ops.Examples.WorkedInstances.Strided.resources.work st.cost = 59 ∧ st.peak = 0

Full source on GitHub

Import NLAlib.Ops.Examples.WorkedInstances.Strided.