Explain a data structure you designed and how you proved its correctness, including what each function should do.
Implement a dynamic half-open interval structure through process_operations(operations). Each operation is ['add', start, end], ['remove', start, end], ['max_overlap'], or ['covered_length']. Return query results in order. Intervals use [start, end), and removals are guaranteed to match an existing interval. Explain the invariants that establish correctness for every public operation.
def process_operations(operations):