(x + y) >> 1The average that lost a bit
One concrete input is enough to disprove equivalence. The values below were replayed independently of the solver.
(x & y) + ((x ^ y) >> 1)The declared domain
65536 possible assignments · 8-bit unsigned · nonempty domain
Same inputs. Different bits.
0xd40x4c0x100x90Highlighted cells differ. Bit positions are zero-based; bit 0 is the least significant bit.
Inspect the left evaluation trace
| Step | Expression | Unsigned value |
|---|---|---|
| 1 | x | 212 |
| 2 | y | 76 |
| 3 | x + y | 32 |
| 4 | 1 | 1 |
| 5 | (x + y) >> 1 | 16 |
Inspect the right evaluation trace
| Step | Expression | Unsigned value |
|---|---|---|
| 1 | x | 212 |
| 2 | y | 76 |
| 3 | x & y | 68 |
| 4 | x | 212 |
| 5 | y | 76 |
| 6 | x ^ y | 152 |
| 7 | 1 | 1 |
| 8 | (x ^ y) >> 1 | 76 |
| 9 | (x & y) + ((x ^ y) >> 1) | 144 |
What this establishes — and what it does not
Uniform-width unsigned bitvectors; wrapping arithmetic; logical right shift; overshift yields zero. Not C/LLVM semantics.
Only these expressions and declared input ranges; not the generating program. The solver and translation are trusted; no independently checkable proof certificate is emitted. A counterexample is not necessarily the smallest one. This report contains input expressions and witness values.
Reproduce this result
Save the JSON below as case.json, then run:
python -m bitequiv check case.json --json result.json --html result.html
{
"width": 8,
"variables": [
"x",
"y"
],
"left": "(x + y) >> 1",
"right": "(x & y) + ((x ^ y) >> 1)",
"ranges": {
"x": [
0,
255
],
"y": [
0,
255
]
},
"title": "The average that lost a bit"
}Use new output names; existing files are never overwritten. Solver limits constrain the query, not whole-process memory or runtime.