NLA-lib Explorer

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