Rule-Based Out-of-Distribution Detection