; @author Jonas Schöpf
; Ctrl example from examples/student/fib09.ctrs
(format LCTRS :smtlib 2.6)
(theory Ints)
(sort Unit)
(fun p (-> Int Int Int Int Int Unit))
(fun return (-> Int Unit))
(fun w (-> Int Int Int Int Int Unit))
(fun v (-> Int Int Int Int Int Unit))
(fun u (-> Int Int Int Int Int Unit))
(fun fastfib (-> Int Unit))

(rule (p n x y z i) (return x) :guard (not (< i n)) :var ((n Int) (x Int) (y Int) (z Int) (i Int)))
(rule (p n x y z i) (p n (+ x y) x x (+ i 1)) :guard (< i n) :var ((n Int) (x Int) (y Int) (z Int) (i Int)))
(rule (w n x y z i) (p n x y z 1) :guard (not (> n 46)) :var ((n Int) (x Int) (y Int) (z Int) (i Int)))
(rule (w n x y z i) (return -1) :guard (> n 46) :var ((n Int) (x Int) (y Int) (z Int) (i Int)))
(rule (v n x y z i) (return n) :guard (not (< n 0)) :var ((n Int) (x Int) (y Int) (z Int) (i Int)))
(rule (v n x y z i) (return 0) :guard (< n 0) :var ((n Int) (x Int) (y Int) (z Int) (i Int)))
(rule (u n x y z i) (w n x y z i) :guard (not (<= n 1)) :var ((n Int) (x Int) (y Int) (z Int) (i Int)))
(rule (u n x y z i) (v n x y z i) :guard (<= n 1) :var ((n Int) (x Int) (y Int) (z Int) (i Int)))
(rule (fastfib n) (u n 1 0 rnd3 rnd4) :var ((n Int) (rnd3 Int) (rnd4 Int)))
