-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemp5.py
43 lines (40 loc) · 1018 Bytes
/
temp5.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import re
from z3 import *
if __name__ == '__main__':
for i in range(5):
print(i)
pass
# # 创建一个Z3求解器实例
# solver = Solver()
#
# # 定义两个BitVec变量
# a = BitVec('a', 256) # 32位的位向量
# b = BitVec('b', 256) # 32位的位向量
# r = BitVec('r', 256) # 32位的位向量
# p = 11
#
# # setting
# Setting = And {0 <= f_a < p, 0 <= f_b < p, a,b}
#
# # FF
# FF_constranits = r_1 == (f_a + f_b) % p
#
# # property
# Fr_constraints = And{
# (a + b >= p) => r_2 == (a + b) - p,
# (a + b) => r_2 == a + b
# }
#
# # 目标
# target = And(a % p == f_a, b % p == f_b, (r_1 == r_2 % p))
#
# term = Setting and FF_constraints and Fr_constraints and Not(target)
# unsat
#
# FF_a + FF_b
# # 检查约束的可满足性
# if solver.check() == sat:
# model = solver.model()
# print(model)
# else:
# print("约束不可满足")