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

(theory Ints)

(sort Unit)

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

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