File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed
Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 11#lang racket
22
33(require racket/syntax
4- (only-in "smtlib2.rkt " cmd assert check-sat get-model read-solution true false )
4+ (only-in "smtlib2.rkt " cmd assert check-sat get-model reset read-solution true false )
55 "../../base/term.rkt " "../../base/bool.rkt " "../../base/num.rkt " "../solution.rkt " "../../base/enum.rkt "
66 "env.rkt " "enc.rkt " )
77
8- (provide encode decode)
8+ (provide encode decode clear-solver )
99
1010; Given an encoding environment, a list of asserts, and
1111; a solver output port, the encode procedure prints an SMT
3939 (default-binding const)))))]
4040 [#f (unsat)]))
4141
42+ ; Given a solver input port, the reset procedure prints
43+ ; commands necessary to clear the solver's state to the
44+ ; given port.
45+ (define (clear-solver port)
46+ (cmd [port]
47+ (reset)))
48+
4249(define (default-binding const)
4350 (match (type-of const)
4451 [(== @boolean?) #f ]
Original file line number Diff line number Diff line change 2727 (define/public assert
2828 (lambda in (set! asserts (append asserts (filter-asserts in)))))
2929
30- (define/public (clear)
31- (send server shutdown )
30+ (define/public (clear)
31+ (send server write clear-solver )
3232 (set!-values (asserts env) (values '() (make-env))))
3333
34- (define/public (shutdown) (clear))
34+ (define/public (shutdown)
35+ (clear)
36+ (send server shutdown))
3537
3638 (define/public (debug) (error 'debug "not supported by ~a " this ))
3739 (define/public (solve-all) (error 'solve-all "not supported by ~a " this ))
Original file line number Diff line number Diff line change 5656(define (get-model) (print-cmd "(get-model)\n " ))
5757(define (get-info kw) (print-cmd "(get-info ~a)\n " kw))
5858
59+ (define (reset) (print-cmd "(reset)\n " ))
60+
5961(define (push n) (print-cmd "(push ~a)\n " n))
6062(define (pop n) (print-cmd "(pop ~a)\n " n))
6163(define (assert expr) (print-cmd "(assert ~a) " expr))
You can’t perform that action at this time.
0 commit comments