Mathematical properties of executable slice sums #
After proving the value equation for sumSlice, clients can use ordinary list
identities to reason about the executable function. These results specialize it
to empty and whole slices, and split a sum into two adjacent slices. The proofs
use neither an execution relation nor the implementation of the summation loop.
All applications still require represented memory, legal slice ranges and enough stack space. The partition theorem compares returned values; it does not compile the two host-level applications into a single function or assign them a cost.
The executable function returns zero on a zero-length slice at any legal offset, including the end of the represented array.
Slicing the whole array agrees with the existing executable sum function. Each implementation has its own sufficient stack-capacity premise.
Two adjacent slices covering the array reproduce its sum modulo the word range. This is a list decomposition theorem about the actual returned values.