def generate_to_cover(q, covered_intervals):
    """
    Returns a sorted list {k | 0 <=k < q, [k, (k+1)] is uncovered}
    from coverd_intervals which is a list of componenents.

    EXAMPLES::

        sage: from cutgeneratingfunctionology.igp import *
        sage: covered_intervals = [set([0,2]), set([3,4])]
        sage: generate_to_cover(5, covered_intervals)
        [1]
    """
    to_cover = set(range(q))
    for component in covered_intervals:
        to_cover -= component
    return sorted(list(to_cover))
