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

(theory Ints)

(sort Unit)

(fun v (-> Int Int Int Int Unit))
(fun return (-> Int Unit))
(fun u (-> Int Int Int Int Unit))
(fun sum2 (-> Int Int Unit))

(rule (v m n s i) (return s) :guard (not (<= i n)))
(rule (v m n s i) (v m n (+ s i) (+ i 1)) :guard (<= i n))
(rule (u m n s i) (v m n s i) :guard (not (> m n)))
(rule (u m n s i) (return 0) :guard (> m n))
(rule (sum2 m n) (u m n 0 m))
