Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
ManifoldSubset.open_covers: Add option supersets; use it to fix is_empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Apr 26, 2021
1 parent 4ad562d commit cec7fa2
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/sage/manifolds/subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ def is_open(self):
"""
return False

def open_covers(self, trivial=True):
def open_covers(self, trivial=True, supersets=False):
r"""
Generate the open covers of the current subset.
Expand Down Expand Up @@ -558,6 +558,8 @@ def open_covers(self, trivial=True):
- ``trivial`` -- (default: ``True``) if ``self`` is open, include the trivial
open cover of ``self`` by itself
- ``supersets`` -- (default: ``False``) if ``True``, include open covers of
all the supersets; it can also be an iterable of supersets to include
EXAMPLES::
Expand Down Expand Up @@ -585,11 +587,16 @@ def open_covers(self, trivial=True):
Set {A, B, V} of open subsets of the 2-dimensional topological manifold M]
"""
for oc in self._open_covers:
if not trivial:
if len(oc) == 1 and next(iter(oc)) is self:
continue
yield ManifoldSubsetFiniteFamily(oc)
if supersets is False:
supersets = [self]
elif supersets is True:
supersets = self._supersets
for superset in supersets:
for oc in superset._open_covers:
if not trivial:
if any(x in supersets for x in oc):
continue
yield ManifoldSubsetFiniteFamily(oc)

def open_cover_family(self, trivial=True):
r"""
Expand Down Expand Up @@ -1139,7 +1146,7 @@ def is_empty(self):
if self._has_defined_points:
return False
return any(not cover
for cover in self.open_covers(trivial=False))
for cover in self.open_covers(trivial=False, supersets=True))

def declare_nonempty(self):
if not self.has_defined_points():
Expand Down

0 comments on commit cec7fa2

Please sign in to comment.