| 1 |
; EXPECT: feasible |
| 2 |
; COMMAND-LINE: --lang=sygus2 --sygus-out=status --sygus-si=none --sygus-enum=fast |
| 3 |
|
| 4 |
(set-logic ALL) |
| 5 |
|
| 6 |
(declare-datatypes ((IntRange 0)) |
| 7 |
(((IntRangec (lower Int) (upper Int))))) |
| 8 |
|
| 9 |
(declare-datatypes ((Loc 0)) |
| 10 |
(((Locc (x Int) (y Int))))) |
| 11 |
|
| 12 |
(declare-datatypes ((LocRange 0)) |
| 13 |
(((LocRangec (xD IntRange) (yD IntRange))))) |
| 14 |
|
| 15 |
(declare-datatypes ((Ship 0)) |
| 16 |
(((Shipc (shipCapacity Int) (shipLoc Loc))))) |
| 17 |
|
| 18 |
(declare-datatypes ((ShipRange 0)) |
| 19 |
(((ShipRangec (shipCapacityD IntRange) (shipLocD LocRange))))) |
| 20 |
|
| 21 |
(define-fun betweenInt ((x Int) (r IntRange)) Bool |
| 22 |
(and (< (lower r) x) (< x (upper r))) |
| 23 |
) |
| 24 |
|
| 25 |
(define-fun betweenLoc ((l Loc) (lr LocRange)) Bool |
| 26 |
(and (betweenInt (x l) (xD lr)) (betweenInt (y l) (yD lr))) |
| 27 |
) |
| 28 |
|
| 29 |
(define-fun subsetInt ((r1 IntRange) (r2 IntRange)) Bool |
| 30 |
(and (>= (lower r1) (lower r2)) (<= (upper r1) (upper r2))) |
| 31 |
) |
| 32 |
|
| 33 |
(define-fun betweenShip ((s Ship) (sr ShipRange)) Bool |
| 34 |
(and (betweenInt (shipCapacity s) (shipCapacityD sr)) (betweenLoc (shipLoc s) (shipLocD sr))) |
| 35 |
) |
| 36 |
|
| 37 |
(define-fun atLeast ((s Ship)) Bool |
| 38 |
(> (shipCapacity s) 50) |
| 39 |
) |
| 40 |
|
| 41 |
(define-fun subsetLoc ((s1 LocRange) (s2 LocRange)) Bool |
| 42 |
(and (subsetInt (xD s1) (xD s2)) (subsetInt (yD s1) (yD s2))) |
| 43 |
) |
| 44 |
|
| 45 |
(define-fun subsetShip ((s1 ShipRange) (s2 ShipRange)) Bool |
| 46 |
(and (subsetInt (shipCapacityD s1) (shipCapacityD s2)) (subsetLoc (shipLocD s1) (shipLocD s2))) |
| 47 |
) |
| 48 |
|
| 49 |
(define-fun max ((x Int) (y Int)) Int |
| 50 |
(ite (>= x y) x y) |
| 51 |
) |
| 52 |
|
| 53 |
(define-fun min ((x Int) (y Int)) Int |
| 54 |
(ite (<= x y) x y) |
| 55 |
) |
| 56 |
|
| 57 |
|
| 58 |
(synth-fun f ((secret Ship) (prior ShipRange) (response Bool)) ShipRange) |
| 59 |
|
| 60 |
(declare-var secret Ship) |
| 61 |
(declare-var prior ShipRange) |
| 62 |
(declare-var response Bool) |
| 63 |
|
| 64 |
(constraint |
| 65 |
(=> (betweenShip secret (f secret prior response)) |
| 66 |
(= response |
| 67 |
(and (atLeast secret) |
| 68 |
(subsetShip (f secret prior response) prior)))) |
| 69 |
) |
| 70 |
|
| 71 |
(check-synth) |