(VAR X Y Z X1 X2) (RULES active(first(0,X)) -> mark(nil) active(first(s(X),cons(Y,Z))) -> mark(cons(Y,first(X,Z))) active(from(X)) -> mark(cons(X,from(s(X)))) active(first(X1,X2)) -> first(active(X1),X2) active(first(X1,X2)) -> first(X1,active(X2)) active(s(X)) -> s(active(X)) active(cons(X1,X2)) -> cons(active(X1),X2) active(from(X)) -> from(active(X)) first(mark(X1),X2) -> mark(first(X1,X2)) first(X1,mark(X2)) -> mark(first(X1,X2)) s(mark(X)) -> mark(s(X)) cons(mark(X1),X2) -> mark(cons(X1,X2)) from(mark(X)) -> mark(from(X)) proper(first(X1,X2)) -> first(proper(X1),proper(X2)) proper(0) -> ok(0) proper(nil) -> ok(nil) proper(s(X)) -> s(proper(X)) proper(cons(X1,X2)) -> cons(proper(X1),proper(X2)) proper(from(X)) -> from(proper(X)) first(ok(X1),ok(X2)) -> ok(first(X1,X2)) s(ok(X)) -> ok(s(X)) cons(ok(X1),ok(X2)) -> ok(cons(X1,X2)) from(ok(X)) -> ok(from(X)) top(mark(X)) -> top(proper(X)) top(ok(X)) -> top(active(X)) )