def is_sigma_algebra__brute(F, X=None):
    """Returns True if F is a sigma algebra on X.

    Parameters
    ----------
    F : set of frozensets
        The candidate sigma algebra.
    X : frozenset, None
        The universal set. If None, then X is taken to be the union of the
        sets in F.

    Returns
    -------
    issa : bool
        True if F is a sigma algebra and False if not.

    Notes
    -----
    This is a brute force check against the definition of a sigma algebra
    on a finite set. Its time complexity is O( len(F)**2 ).

    """
    # This works because its not necessary to test countable unions if the
    # base set X is finite.  One need only consider pairwise unions.
    if X is None:
        X = frozenset().union(*F)
    else:
        X = frozenset(X)

    for subset1 in F:
        if X.difference(subset1) not in F:
            return False
        for subset2 in F:
            if subset1.union(subset2) not in F:
                return False
    else:
        return True