|
14 | 14 | @bvslt @bvsle @bvult @bvule
|
15 | 15 | @bvnot @bvor @bvand @bvxor @bvshl @bvlshr @bvashr
|
16 | 16 | @bvneg @bvadd @bvmul @bvudiv @bvsdiv @bvurem @bvsrem @bvsmod
|
17 |
| - @concat @extract)) |
| 17 | + @concat @extract @sign-extend @zero-extend @integer->bitvector)) |
18 | 18 |
|
19 | 19 |
|
20 | 20 | (provide decode-model)
|
|
23 | 23 | ; their values, as given by sol. The env argument is assumed to be a
|
24 | 24 | ; dictionary from constant? to symbol?.
|
25 | 25 | (define (decode-model env sol)
|
26 |
| - (let ([i-sol (inline (α-rename sol) env)]) |
| 26 | + (let ([i-sol (inline (α-rename (prune-model sol)) env)]) |
27 | 27 | (for/hash ([(decl id) (in-dict env)]
|
28 | 28 | #:when (and (constant? decl) (hash-has-key? i-sol id)))
|
29 | 29 | (values decl (interpret (hash-ref i-sol id) (term-type decl))))))
|
|
72 | 72 | ,(substitute body (for/hash ([p params] [α α-params])
|
73 | 73 | (values (car p) α)))))]))))
|
74 | 74 |
|
| 75 | +; Given a map M from symbols to SMTLib function definitions of the form |
| 76 | +; (define-fun id ((param type) ...) ret body), |
| 77 | +; this procedure eliminate bindings for intermediate expressions, |
| 78 | +; which are ids that start with "e" (e.g. "e20"), |
| 79 | +; originally defined with define-fun (as opposed to declare-fun) in the query. |
| 80 | +; In particular, old versions of Z3 did this pruning automatically, |
| 81 | +; and Rosette had been working under this assumption. |
| 82 | +; Newer versions of Z3 however included extra bindings, |
| 83 | +; so we are pruning them away. |
| 84 | +(define (prune-model sol) |
| 85 | + (for/hash ([(k v) (in-immutable-hash sol)] |
| 86 | + #:unless (match v |
| 87 | + [`(define-fun ,(app symbol->string id) ,_ ,_ ,_) |
| 88 | + #:when (string-prefix? id "e") |
| 89 | + #t] |
| 90 | + [_ #f])) |
| 91 | + (values k v))) |
| 92 | + |
75 | 93 | ; Given an s-expression B and a map M from symbols to values,
|
76 | 94 | ; returns a B' that replaces each occurrence of a key K in M with M[K].
|
77 | 95 | (define (substitute body env)
|
|
0 commit comments