NLA-lib Explorer

Clamping a stored word before index conversion

Library · Source module

Clamping a stored word before index conversion

The clamp compares the actual decoded input with two stored endpoint words and copies the selected word. No arithmetic or conversion is hidden in the comparisons. With endpoints exactly decoding to zero and a natural bound, the subsequent toNat query always succeeds within the bound, even when the original word decodes to a negative value.

Main results

* NLAlib.Ops.clampRoutine: the clamp in place, [] (lo : 1, hi : 1, x : 1) → (x), on the tree NLAlib.Ops.clamp. * NLAlib.Ops.clampRoutine_meets: its judgment. * NLAlib.Ops.toNatFn_clampWord gives the bounded natural floor of the selected word.

Declarations