; @author Jonas Schöpf
; Ctrl example from examples/student/sum05.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 p) (return p) :guard (not (<= i n)))
(rule (v n i p) (v n (+ i 1) (+ p i)) :guard (<= i n))
(rule (u n i p) (v n 0 p) :guard (not (<= n 0)))
(rule (u n i p) (return 0) :guard (<= n 0))
(rule (sum1 n) (u n rnd 0))
