Open DavePearce opened 7 years ago
Another example:
type nat is (int x)
where:
x >= 0
function abs(int x) -> (nat r)
assert "postcondition not satisfied":
forall(nat item):
if:
(abs(item) == item) || (abs(item) == -item)
abs(item) >= 0
then:
item == abs(item)
Z3 uses bounded unrolling of recursive functions:
http://prosecco.gforge.inria.fr/personal/hritcu/students/alejandro/report.pdf
The following goes into a loop:
With
limit=100
the proof looks like this: