Check that there are not other solutions other than the first given

This commit is contained in:
Roland Coeurjoly 2024-07-04 12:35:00 +02:00 committed by Emily Schmidt
parent cb5f08364c
commit 73ed514623
1 changed files with 12 additions and 1 deletions

View File

@ -161,6 +161,17 @@ for step in range(num_steps):
value = hex_to_bin(value[1:])
print(f" {output_name}: {value}")
signals[output_name].append((step, value))
smt_io.write(f'(push 1)')
smt_io.write(f'(assert (not (= ({output_name} test_outputs_step_n{step}) #{value})))')
result = smt_io.check_sat(["unsat"])
if result != 'unsat':
smt_io.p_close()
sys.exit(1)
smt_io.write(f'(pop 1)')
result = smt_io.check_sat(["sat"])
if result != 'sat':
smt_io.p_close()
sys.exit(1)
smt_io.p_close()