Example: going down the hierarchy, word addition over bit operations
Library · Source module
Example: going down the hierarchy, word addition over bit operations
The words are bits. wadd [w] [x, y] [z] adds two little-endian blocks of w bits modulo 2 ^ w. Its contract is functional (NLAlib.Ops.Examples.IsWAdd): the result is f of the inputs, for some f that is addition modulo 2 ^ w on values (NLAlib.Ops.Examples.AddMod).
Main results
* Abstract theorem (NLAlib.Ops.Examples.runs_add3): two additions compute the sum of three numbers modulo 2 ^ w, with two calls at [w]. * The implementation (NLAlib.Ops.Examples.rippleImpl): a ripple-carry adder over the bit operations xor3 and maj, with a carry cell. Its exact satisfaction (NLAlib.Ops.Examples.ripple_satisfies): the run is the block function of NLAlib.Ops.Examples.rippleF. * Mathematics (NLAlib.Ops.Examples.addMod_ripple): rippleF is addition modulo 2 ^ w. * Corollary (NLAlib.Ops.Examples.runs_add3_link): the linked program, with its counts of bit operations, by the same linking step as every other level.
Declarations
- NLAlib.Ops.Examples.AddMod
- NLAlib.Ops.Examples.BitOp
- NLAlib.Ops.Examples.BitOp.ofNat
- NLAlib.Ops.Examples.BitOp.ofNat_ctorIdx
- NLAlib.Ops.Examples.IsBits
- NLAlib.Ops.Examples.IsWAdd
- NLAlib.Ops.Examples.WOp
- NLAlib.Ops.Examples.WOp.ofNat
- NLAlib.Ops.Examples.WOp.ofNat_ctorIdx
- NLAlib.Ops.Examples.add3
- NLAlib.Ops.Examples.addMod_ripple
- NLAlib.Ops.Examples.bitFns
- NLAlib.Ops.Examples.bitsVal
- NLAlib.Ops.Examples.bitsVal_lt
- NLAlib.Ops.Examples.bitsVal_sumBit_add
- NLAlib.Ops.Examples.carry
- NLAlib.Ops.Examples.exists_isWAdd
- NLAlib.Ops.Examples.isWAdd_link
- NLAlib.Ops.Examples.maj
- NLAlib.Ops.Examples.push_wordCost_wadd
- NLAlib.Ops.Examples.rippleF
- NLAlib.Ops.Examples.rippleImpl
- NLAlib.Ops.Examples.ripplePrefix
- NLAlib.Ops.Examples.ripplePrefix_succ
- NLAlib.Ops.Examples.ripple_satisfies
- NLAlib.Ops.Examples.ripple_wp_step
- NLAlib.Ops.Examples.runs_add3
- NLAlib.Ops.Examples.runs_add3_link
- NLAlib.Ops.Examples.sumBit
- NLAlib.Ops.Examples.waddFn
- NLAlib.Ops.Examples.waddFn_apply
- NLAlib.Ops.Examples.waddFn_apply_of
- NLAlib.Ops.Examples.wordCost
- NLAlib.Ops.Examples.wordTable
- NLAlib.Ops.Examples.word_accounts
- NLAlib.Ops.Examples.xor3