-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not evaluate programs on stuck terms (#110)
Modifies our definition so that unapplied literal operators, programs and oracles are considered "evaluatable". Modifies the evaluator to not execute programs that have stuck terms. This leads to better error messages, in particular for users passing evaluatable functions as higher-order arguments, which is not currently supported. After my latest commit on this PR (to undo an oversimplification to the code), I have verified that the current signature in cvc5 is not impacted by this change.
- Loading branch information
Showing
10 changed files
with
128 additions
and
60 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
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
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,34 @@ | ||
(declare-type Int ()) | ||
(declare-consts <numeral> Int) | ||
|
||
(declare-const g (-> Int Int Int)) | ||
|
||
(program dummy ((f (-> Int Int Int)) (n1 Int) (n2 Int)) | ||
(Int Int (-> Int Int Int)) Int | ||
|
||
(((dummy n1 n2 f) (f n1 n2))) | ||
) | ||
|
||
; this should work | ||
(define tmp1 () (dummy 1 1 g)) | ||
(declare-const c1 (eo::requires tmp1 (g 1 1) Int)) | ||
(define test1 () c1 :type Int) | ||
|
||
|
||
(program foo ((n1 Int) (n2 Int)) | ||
(Int Int) Int | ||
|
||
(((foo n1 n2) n1)) | ||
) | ||
|
||
|
||
; this should not work | ||
;(define tmp2 () (dummy 1 1 foo)) | ||
;(declare-const c2 (eo::requires tmp2 1 Int)) | ||
;(define test1 () c2 :type Int) | ||
|
||
|
||
; this should not work | ||
;(define tmp3 () (dummy 1 1 eo::add)) | ||
;(declare-const c3 (eo::requires tmp3 2 Int)) | ||
;(define test2 () c3 :type Int) |
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,52 @@ | ||
; ethos gave a spurious error on this example in cvc5 regressions when the | ||
; definition of evaluatable was oversimplified to not check literalOp kinds. | ||
|
||
(declare-type Int ()) | ||
(declare-consts <numeral> Int) | ||
|
||
(declare-const = (-> (! Type :var A :implicit) A A Bool)) | ||
(declare-const < (-> Int Int Bool)) | ||
(declare-const - (-> Int Int Int)) | ||
|
||
; note: We do not currently check that the index of this sort is positive. | ||
(declare-const BitVec (-> Int Type)) | ||
(declare-consts <binary> (BitVec (eo::len eo::self))) | ||
|
||
; bvsize | ||
(declare-const @bvsize (-> (! Int :var m :implicit) (BitVec m) Int)) | ||
|
||
; define: @bv_empty | ||
; return: The empty bitvector. | ||
(define @bv_empty () (eo::to_bin 0 0)) | ||
|
||
(declare-const concat (-> | ||
(! Int :var n :implicit) | ||
(! Int :var m :implicit) | ||
(BitVec n) | ||
(BitVec m) | ||
(BitVec (eo::add n m))) :right-assoc-nil @bv_empty | ||
) | ||
|
||
(declare-const extract (-> | ||
(! Int :var n :implicit) | ||
(! Int :var h) | ||
(! Int :var l) | ||
(BitVec n) | ||
(BitVec (eo::add h (eo::neg l) 1)) | ||
) | ||
) | ||
(declare-rule bv-extract-concat-4 ((@n0 Int) (@n1 Int) (@n2 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (xs1 (BitVec @n2) :list) (i1 Int) (j1 Int)) | ||
:premises ((= (< j1 (- (@bvsize (concat x1 xs1 y1)) (@bvsize x1))) true)) | ||
:args (x1 y1 xs1 i1 j1) | ||
:conclusion (= (extract j1 i1 (concat x1 xs1 y1)) (extract j1 i1 (concat xs1 y1))) | ||
) | ||
|
||
(declare-const a (_ BitVec 4)) | ||
(declare-const b (_ BitVec 4)) | ||
(declare-const c (_ BitVec 4)) | ||
(declare-const d (_ BitVec 4)) | ||
|
||
(assume @p30210 (= (< 2 (- (@bvsize (concat a b c d)) (@bvsize a))) true)) | ||
(step @p30211 :rule bv-extract-concat-4 :premises (@p30210) :args (a d (concat b c) 0 2)) | ||
|
||
|
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