detecting recursive definitions