(VAR IL L M N X X1 X2 ) (RULES active(zeros) -> mark(cons(0, zeros)) active(and(tt, X)) -> mark(X) active(length(nil)) -> mark(0) active(length(cons(N, L))) -> mark(s(length(L))) active(take(0, IL)) -> mark(nil) active(take(s(M), cons(N, IL))) -> mark(cons(N, take(M, IL))) active(cons(X1, X2)) -> cons(active(X1), X2) active(and(X1, X2)) -> and(active(X1), X2) active(length(X)) -> length(active(X)) active(s(X)) -> s(active(X)) active(take(X1, X2)) -> take(active(X1), X2) active(take(X1, X2)) -> take(X1, active(X2)) cons(mark(X1), X2) -> mark(cons(X1, X2)) and(mark(X1), X2) -> mark(and(X1, X2)) length(mark(X)) -> mark(length(X)) s(mark(X)) -> mark(s(X)) take(mark(X1), X2) -> mark(take(X1, X2)) take(X1, mark(X2)) -> mark(take(X1, X2)) proper(zeros) -> ok(zeros) proper(cons(X1, X2)) -> cons(proper(X1), proper(X2)) proper(0) -> ok(0) proper(and(X1, X2)) -> and(proper(X1), proper(X2)) proper(tt) -> ok(tt) proper(length(X)) -> length(proper(X)) proper(nil) -> ok(nil) proper(s(X)) -> s(proper(X)) proper(take(X1, X2)) -> take(proper(X1), proper(X2)) cons(ok(X1), ok(X2)) -> ok(cons(X1, X2)) and(ok(X1), ok(X2)) -> ok(and(X1, X2)) length(ok(X)) -> ok(length(X)) s(ok(X)) -> ok(s(X)) take(ok(X1), ok(X2)) -> ok(take(X1, X2)) top(mark(X)) -> top(proper(X)) top(ok(X)) -> top(active(X)) )