; @author Jonas Schöpf
; Ctrl example from examples/student/sum08.ctrs
(format LCTRS :smtlib 2.6)

(theory Ints)

(sort Result)

(fun v (-> Int Int Int Result))
(fun return (-> Int Result))
(fun u (-> Int Int Int Result))
(fun sum1 (-> Int Result))

(rule (v n i s) (return s) :guard (not (<= i n)))
(rule (v n i s) (v n (+ i 1) (+ s i)) :guard (<= i n))
(rule (u n i s) (v n 1 s) :guard (not (< n 0)))
(rule (u n i s) (return 0) :guard (< n 0))
(rule (sum1 n) (u n rnd 0))
