Last active
November 8, 2018 08:13
-
-
Save ajalab/98706e47ddc52c7043ded268b9f72193 to your computer and use it in GitHub Desktop.
Z3 issue #1922
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
;; ex1.smt2 | |
(get-info :version) | |
; A tuple of two booleans | |
; data Tuple = tuple { first :: Bool, second :: Bool } | |
(declare-datatypes | |
((Tuple 0)) | |
((Tuple (tuple | |
(first Bool) | |
(second Bool) | |
)))) | |
; Option type of a tuple | |
; data Option = none | some { value :: Tuple }} | |
(declare-datatypes ((Option 0)) ((Option (none) (some (value Tuple))))) | |
; x :: Option is a constant | |
(declare-fun x () Option) | |
; Assertion 1. x has some value | |
(assert ((_ is (some (Tuple) Option)) x)) | |
; Assertion 2. first (value x) == true | |
(assert (first (value x))) | |
(check-sat) | |
(get-model) | |
(echo "(first (value x)) = ") | |
(eval (first (value x))) |
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
;; ex2.smt2 | |
(get-info :version) | |
; A tuple of two booleans and one integer | |
; data Tuple = tuple { first :: Bool, second :: Bool, third :: Int } | |
(declare-datatypes | |
((Tuple 0)) | |
((Tuple (tuple | |
(first Bool) | |
(second Bool) | |
(third Int) ; new field | |
)))) | |
; same as ex1.smt2 ... | |
; Option type of a tuple | |
; data Option = none | some { value :: Tuple }} | |
(declare-datatypes ((Option 0)) ((Option (none) (some (value Tuple))))) | |
; x :: Option is a constant | |
(declare-fun x () Option) | |
; Assertion 1. x has some value | |
(assert ((_ is (some (Tuple) Option)) x)) | |
; Assertion 2. first (value x) == b10 | |
(assert (first (value x))) | |
(check-sat) | |
(get-model) | |
(echo "(first (value x)) = ") | |
(eval (first (value x))) |
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
;; ex3.smt2 | |
(get-info :version) | |
; A tuple of two booleans | |
; data Tuple = tuple { first :: Bool, second :: Bool } | |
(declare-datatypes | |
() ; ((Tuple 0)) | |
((Tuple (tuple | |
(first Bool) | |
(second Bool) | |
)))) | |
; same as ex1.smt2 ... | |
; Option type of a tuple | |
; data Option = none | some { value :: Tuple }} | |
(declare-datatypes ((Option 0)) ((Option (none) (some (value Tuple))))) | |
; x :: Option is a constant | |
(declare-fun x () Option) | |
; Assertion 1. x has some value | |
(assert ((_ is (some (Tuple) Option)) x)) | |
; Assertion 2. first (value x) == true | |
(assert (first (value x))) | |
(check-sat) | |
(get-model) | |
(echo "(first (value x)) = ") | |
(eval (first (value x))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment