Prime-selector register frames #
The entire counting program runs below register 128. The selector preserves its original dimensions, original matrix pointers and workspace pointer, as well as the upper caller bank, regardless of the counting program's internal register usage. This is a syntactic register frame; memory preservation additionally requires the concrete counter's memory contract.
theorem Cslib.Algorithms.WordRAM.ExactTriangle.PrimeSelection.count_preserves (counter : WordRAM.Code WordRAM.Basis.standard 128) (i : Fin 160) (hi : 128 ≤ ↑i) :
WordRAM.Code.Preserves i (count counter)
Argument delivery and the entire counting call preserve every selector metadata register.
theorem Cslib.Algorithms.WordRAM.ExactTriangle.PrimeSelection.preserves_input (counter : WordRAM.Code WordRAM.Basis.standard 128) (i : Fin 160) (hi : 131 ≤ ↑i ∧ ↑i ≤ 136 ∨ 143 ≤ ↑i) :
WordRAM.Code.Preserves i (program counter)
The actual selector preserves the original parameters/pointers and the upper caller bank.