Debian Codegraph @

test/regress/cli/regress1/sygus/rec-fun-while-infinite.sy

raw
1 ; EXPECT: fail
2 ; COMMAND-LINE: --sygus-out=status --lang=sygus2 --no-check-synth-sol -q
3
4 (set-logic ALL)
5
6 ; The environment datatypes
7 (declare-datatype NVars ((x) (y)))
8
9 (declare-datatype Pair ((build (first NVars) (second Int))))
10
11 (declare-datatype Env ((cons (head Pair) (tail Env)) (nil)))
12
13 (define-fun-rec envStore ((var NVars) (value Int) (env Env)) Env
14 (ite (is-nil env)
15 (cons (build var value) env)
16 (ite (= var (first (head env)))
17 (cons (build var value) (tail env))
18 (cons (head env) (envStore var value (tail env)))
19 )
20 )
21 )
22
23 (define-fun-rec envSelect ((var NVars) (env Env)) Int
24 (ite (is-nil env)
25 0
26 (ite (= var (first (head env)))
27 (second (head env))
28 (envSelect var (tail env))
29 )
30 )
31 )
32
33 ; Syntax for arithmetic expressions
34 (declare-datatype Aexp
35 (
36 (Val (val Int))
37 (Var (name NVars))
38 (Add (addL Aexp) (addR Aexp))
39 )
40 )
41
42 ; Function to evaluate arithmetic expressions
43 (define-fun-rec evalA ((env Env) (a Aexp)) Int
44 (ite (is-Val a)
45 (val a)
46 (ite (is-Var a)
47 (envSelect (name a) env)
48 ; (is-Add a)
49 (+ (evalA env (addL a)) (evalA env (addR a)))
50 )))
51
52 ; Syntax for boolean expressions
53 (declare-datatype Bexp
54 (
55 (TRUE)
56 ))
57
58 ; Function to evaluate boolean expressions
59 (define-fun-rec evalB ((env Env) (b Bexp)) Bool
60 (is-TRUE b)
61 )
62
63 ; Syntax for commands
64 (declare-datatype Com
65 (
66 (Assign (lhs NVars) (rhs Aexp))
67 (While (wCond Bexp) (wCom Com))
68 )
69 )
70
71 ; Function to evaluate statements
72 (define-fun-rec evalC ((env Env) (c Com)) Env
73 (ite (is-Assign c)
74 (envStore (lhs c) (evalA env (rhs c)) env)
75 ; (is-While c)
76 (ite (evalB env (wCond c)) (evalC (evalC env (wCom c)) c) env)
77 )
78 )
79
80
81 (synth-fun prog () Com
82 ((C1 Com) (C2 Com) (V NVars) (A1 Aexp) (A2 Aexp) (A3 Aexp) (B Bexp) (I Int))
83 (
84 (C1 Com ((While B C2)))
85 (C2 Com ((Assign V A1)))
86 (V NVars (x))
87 (A1 Aexp ((Var V)))
88 (A2 Aexp ((Val I)))
89 (A3 Aexp ((Add A1 A2)))
90 (B Bexp (TRUE))
91 (I Int (1))
92 )
93 )
94
95 (constraint (= (evalC (cons (build x 1) nil) prog) (cons (build x 1) nil)))
96
97 (check-synth)