-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for STP and Yices2 (#273)
Also add documentation for Bitwuzla and cvc5 --------- Co-authored-by: Vishal Canumalla <vishalc@cs.washington.edu>
- Loading branch information
1 parent
63524aa
commit edf682d
Showing
5 changed files
with
331 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#lang racket | ||
|
||
(require racket/runtime-path | ||
"server.rkt" "env.rkt" | ||
"../solver.rkt" | ||
(prefix-in base/ "base-solver.rkt")) | ||
|
||
(provide (rename-out [make-stp stp]) stp? stp-available?) | ||
|
||
(define-runtime-path stp-path (build-path ".." ".." ".." "bin" "stp")) | ||
(define stp-opts '("--SMTLIB2")) | ||
|
||
(define (stp-available?) | ||
(not (false? (base/find-solver "stp" stp-path #f)))) | ||
|
||
(define (make-stp [solver #f] #:options [options (hash)] #:logic [logic #f] #:path [path #f]) | ||
(define config | ||
(cond | ||
[(stp? solver) | ||
(base/solver-config solver)] | ||
[else | ||
(define real-stp-path (base/find-solver "stp" stp-path path)) | ||
(when (and (false? real-stp-path) (not (getenv "PLT_PKG_BUILD_SERVICE"))) | ||
(error 'stp "stp binary is not available (expected to be at ~a); try passing the #:path argument to (stp)" (path->string (simplify-path stp-path)))) | ||
(base/config options real-stp-path logic)])) | ||
(stp (server (base/config-path config) stp-opts (base/make-send-options config)) config '() '() '() (env) '())) | ||
|
||
(struct stp base/solver () | ||
#:property prop:solver-constructor make-stp | ||
#:methods gen:custom-write | ||
[(define (write-proc self port mode) (fprintf port "#<stp>"))] | ||
#:methods gen:solver | ||
[ | ||
(define (solver-features self) | ||
'(qf_bv)) | ||
|
||
(define (solver-options self) | ||
(base/solver-options self)) | ||
|
||
(define (solver-assert self bools) | ||
(base/solver-assert self bools)) | ||
|
||
(define (solver-minimize self nums) | ||
(base/solver-minimize self nums)) | ||
|
||
(define (solver-maximize self nums) | ||
(base/solver-maximize self nums)) | ||
|
||
(define (solver-clear self) | ||
(base/solver-clear self)) | ||
|
||
(define (solver-shutdown self) | ||
(base/solver-shutdown self)) | ||
|
||
(define (solver-push self) | ||
(base/solver-push self)) | ||
|
||
(define (solver-pop self [k 1]) | ||
(base/solver-pop self k)) | ||
|
||
(define (solver-check self) | ||
(base/solver-check self)) | ||
|
||
(define (solver-debug self) | ||
(base/solver-debug self))]) | ||
|
||
(define (set-default-options server) | ||
void) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#lang racket | ||
|
||
(require racket/runtime-path | ||
"server.rkt" "env.rkt" | ||
"../solver.rkt" | ||
(prefix-in base/ "base-solver.rkt")) | ||
|
||
(provide (rename-out [make-yices yices]) yices? yices-available?) | ||
|
||
(define-runtime-path yices-path (build-path ".." ".." ".." "bin" "yices-smt2")) | ||
(define yices-opts '("--incremental")) | ||
|
||
(define (yices-available?) | ||
(not (false? (base/find-solver "yices-smt2" yices-path #f)))) | ||
(define default-logic 'QF_BV) ;; Yices2 needs a default logic set otherwise it will error | ||
(define (make-yices [solver #f] #:options [options (hash)] #:logic [logic default-logic] #:path [path #f]) | ||
(define config | ||
(cond | ||
[(yices? solver) | ||
(base/solver-config solver)] | ||
[else | ||
(define real-yices-path (base/find-solver "yices-smt2" yices-path path)) | ||
(when (and (false? real-yices-path) (not (getenv "PLT_PKG_BUILD_SERVICE"))) | ||
(error 'yices "yices-smt2 binary is not available (expected to be at ~a); try passing the #:path argument to (yices)" (path->string (simplify-path yices-path)))) | ||
(base/config options real-yices-path logic)])) | ||
(yices (server (base/config-path config) yices-opts (base/make-send-options config)) config '() '() '() (env) '())) | ||
|
||
(struct yices base/solver () | ||
#:property prop:solver-constructor make-yices | ||
#:methods gen:custom-write | ||
[(define (write-proc self port mode) (fprintf port "#<yices>"))] | ||
#:methods gen:solver | ||
[ | ||
(define (solver-features self) | ||
'(qf_bv)) | ||
|
||
(define (solver-options self) | ||
(base/solver-options self)) | ||
|
||
(define (solver-assert self bools) | ||
(base/solver-assert self bools)) | ||
|
||
(define (solver-minimize self nums) | ||
(base/solver-minimize self nums)) | ||
|
||
(define (solver-maximize self nums) | ||
(base/solver-maximize self nums)) | ||
|
||
(define (solver-clear self) | ||
(base/solver-clear self)) | ||
|
||
(define (solver-shutdown self) | ||
(base/solver-shutdown self)) | ||
|
||
(define (solver-push self) | ||
(base/solver-push self)) | ||
|
||
(define (solver-pop self [k 1]) | ||
(base/solver-pop self k)) | ||
|
||
(define (solver-check self) | ||
(base/solver-check self)) | ||
|
||
(define (solver-debug self) | ||
(base/solver-debug self))]) | ||
|
||
(define (set-default-options server) | ||
void) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters