Add standalone logical_intervals and state_intervals functions in utils