Skip to content

Instantly share code, notes, and snippets.

@regehr
Created November 11, 2018 22:58
Show Gist options
  • Save regehr/9b00856ff3fe1c0f4716c04c61047a9b to your computer and use it in GitHub Desktop.
Save regehr/9b00856ff3fe1c0f4716c04c61047a9b to your computer and use it in GitHub Desktop.
from z3 import *
def make_lhs(x):
lhs = UDiv(x, BitVecVal(4532, 32))
return lhs
def make_rhs(x, c):
t1 = ZeroExt(32, x)
tc = ZeroExt(32, c)
t2 = t1 * tc
t3 = LShR(t2, 42)
rhs = Extract(31, 0, t3)
return rhs
x = BitVec('x', 32)
q = make_lhs(x) == make_rhs(x, BitVecVal(970442743, 32))
prove(q)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment