NLA-lib Explorer

NLAlib.Ops.Examples.WorkedInstances.VectorSum.instance_run

Library · theorem

The instance. With exact real arithmetic, from the buffers holding (1, 2, 3), (10, 20, 30) and three blank cells, the execution rules derive one outcome of the entrywise sum: the third buffer holds [11, 22, 33], the run makes 3 additions and no other operation, 44 instructions in all, and uses no scratch.

NLAlib.Ops.Examples.WorkedInstances.VectorSum.instance_run
  (I : Ops.Interp Ops.ScalarOp Ops.CmpTst ℝ)
  (hI :
    (Ops.Examples.VectorSum.vaddModel Ops.exactMachine).contracts
      Ops.Examples.WorkedInstances.VectorSum.sizes
      (Ops.Examples.VectorSum.vaddDomain.input Ops.Examples.WorkedInstances.VectorSum.sizes
        (![1, 2, 3], ![10, 20, 30]) trivial)
      I)
  (τ : Ops.Tape ℝ) :
  ∃ st,
    Ops.Reference.Execution Ops.Examples.VectorSum.vaddProgram I
        (Ops.Examples.VectorSum.vaddModel Ops.exactMachine).resources
        Ops.Examples.VectorSum.vaddDomain.formats τ Ops.Examples.WorkedInstances.VectorSum.sizes
        (Ops.Examples.VectorSum.vaddDomain.memory Ops.Examples.WorkedInstances.VectorSum.sizes
          (![1, 2, 3], ![10, 20, 30]))
        st ∧
      st.mem.store.readBlock 2 0 3 = some [11, 22, 33] ∧
        Ops.Count.original st.cost = 3 • Ops.Count.one Ops.ScalarOp.add [] ∧
          (Ops.Examples.VectorSum.vaddModel Ops.exactMachine).resources.work st.cost = 44 ∧
            st.peak = 0

Full source on GitHub

Import NLAlib.Ops.Examples.WorkedInstances.VectorSum.