I'm suspicious of the theorem proving example. I thought Z3 could fail to return sat or unsat, but he is assuming that if it's not sat the theorem must be proven
No I think it's fine. On another note, I have proven Fermat's Last Theorem with z3 using this setup :) and it goes faster if you reduce a variable called "timeout" for some reason!
from z3 import *
s = Solver()
s.set("timeout", 600)
a = Int('a')
b = Int('b')
c = Int('c')
s.add(a > 0)
s.add(b > 0)
s.add(c > 0)
theorem = a ** 3 + b ** 3 != c ** 3
if s.check(Not(theorem)) == sat:
print(f"Counterexample: {s.model()}")
else:
print("Theorem true")
For the curious, solvers like z3 are used in programming languages to verify logic and constraints. Basically it can help find logic issues and bugs during compile time itself, instead of waiting for it to show up in runtime.
jeremysalwen|4 days ago
ymherklotz|4 days ago
hwayne|4 days ago
potato-peeler|4 days ago
https://en.wikipedia.org/wiki/Satisfiability_modulo_theories...
bjornsing|4 days ago
lkuty|3 days ago
mathisfun123|4 days ago
iberator|4 days ago