restricted Z3 by default to a fragment where proof reconstruction should not fail (for better integration with Sledgehammer) -- the full set of supported Z3 features can still be used by enabling the configuration option "z3_with_extensions"
1 (* Title: HOL/Boogie/Examples/VCC_Max.thy
2 Author: Sascha Boehme, TU Muenchen
5 header {* Boogie example from VCC: get the greatest element of a list *}
13 We prove correct the verification condition generated from the following
19 typedef unsigned char byte;
20 typedef unsigned long ulong;
22 static byte maximum(byte arr[], ulong len)
23 requires(wrapped(as_array(arr, len)))
24 requires (0 < len && len < (1UI64 << 40))
25 ensures (forall(ulong i; i<len ==> arr[i] <= result))
26 ensures (exists(ulong i; i<len && arr[i] == result))
30 spec(ulong witness = 0;)
32 for (p = 1; p < len; p++)
34 invariant(forall(ulong i; i < p ==> arr[i] <= max))
35 invariant(witness < len && arr[witness] == max)
40 speconly(witness = p;)
48 boogie_open (quiet) "VCC_Max.b2i"
50 declare [[smt_certificates = "VCC_Max.certs"]]
51 declare [[smt_read_only_certificates = true]]
52 declare [[smt_oracle = false]]
53 declare [[z3_with_extensions = true]]