Strength reduction under modular arithmeticComplete bit-vector equivalence · 16 inputs
The problem
Check the rewrite x × 2 → x + x for every unsigned four-bit x.
The checked result
Equivalent: yes.
For each possible input, the original and replacement expressions yield the same four-bit result, including values that wrap.
Why the checker accepts it
- Enumerate every value at the chosen bit width.
- Evaluate the source expression modulo 2ʷ.
- Evaluate the replacement under the same semantics.
- Compare outputs, including wraparound inputs.
Formal specification
{
"width": 4,
"source": "x * 2",
"semantics": "Pure expressions on four-bit values, with both operators modulo 16 and no observable side effects."
}Claim and evidence
{
"claim": {
"equivalent": true
},
"witness": {
"replacement": "x + x"
}
}Dataset construction
Deterministic finite fixture; full enumeration or witness replay as stated. Structured JSON; field meanings are stated in the specification. Acceptance covers 16 checker units for this record; the unit type is stated in its verification scope.
Complexity and limits
Unary width-w equivalence by enumeration checks 2ʷ inputs. This is practical for small widths, not a general large-program optimizer.
This example does not establish a rewrite for language undefined behavior, side effects, overflow flags, other widths, or floating-point arithmetic. No speedup is claimed.
A boundary to investigate
Correctness is not a speedup claim; duplicating an expression with side effects can be invalid. Add expression DAGs, observable-state semantics, and checked equivalence certificates.