Debian Codegraph @

test/regress/cli/regress1/sygus/issue3109-share-sel.sy

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