Recurrent Sets for Non-Termination and Safety of Programs