| 1 |
; COMMAND-LINE: --fmf-fun |
| 2 |
; EXPECT: sat |
| 3 |
; DISABLE-TESTER: model |
| 4 |
(set-logic ALL) |
| 5 |
(set-info :status sat) |
| 6 |
|
| 7 |
(define-fun BoolToString ((b Bool)) String (ite b "true" "false") ) |
| 8 |
|
| 9 |
(declare-datatypes ((Color 0)) ( |
| 10 |
((red) (white) (blue)) |
| 11 |
)) |
| 12 |
|
| 13 |
(define-fun ColorToString ((c Color)) String (ite ((_ is red) c) "red" (ite ((_ is white) c) "white" "blue")) ) |
| 14 |
|
| 15 |
(declare-datatypes ((CP 0)) ( |
| 16 |
((cp (b Bool) (c Color))) |
| 17 |
)) |
| 18 |
|
| 19 |
(define-fun-rec CPToString ((cp CP)) String (str.++ "cp(" (BoolToString (b cp)) "," (ColorToString (c cp)) ")")) |
| 20 |
|
| 21 |
(declare-fun CPFromString (String) CP) |
| 22 |
|
| 23 |
(assert (forall ((cp1 CP)) (= cp1 (CPFromString (CPToString cp1))))) |
| 24 |
|
| 25 |
(declare-fun cpx () CP) |
| 26 |
(assert (= cpx (CPFromString "cp(true,white)"))) |
| 27 |
|
| 28 |
(check-sat) |