def is_ordered(v):
    """
    The invariant for all Vector operations.
    
    Returns `True` when the elements are correctly ordered.
    
    """
    try:
        it = v.iterkeys()
        x = next(it)
        while True:
            last, x = x, next(it)
            if x.uid < last.uid:
                return False
    except StopIteration:
        return True
