Add a utility function that detects whether a loop is guaranteed to be finite.