summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-10-13 23:31:57 +0200
committerEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-10-13 23:31:57 +0200
commitbe3ff7424963450c1c2dfa7ca9fbe85eaeab1162 (patch)
treec1e5a4ff82a57a8ca2bb22e132b2b7e6e71bb598
parentMinor improvements in the doc of topological manifolds (basics part) (diff)
Introduce open covers on top manifolds
-rw-r--r--src/sage/manifolds/manifold.py2
-rw-r--r--src/sage/manifolds/subset.py69
2 files changed, 70 insertions, 1 deletions
diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py
index bf5cf8c..2538ce1 100644
--- a/src/sage/manifolds/manifold.py
+++ b/src/sage/manifolds/manifold.py
@@ -460,6 +460,7 @@ class TopManifold(TopManifoldSubset):
TopManifoldSubset.__init__(self, ambient_manifold, name,
latex_name=latex_name, category=category)
self._is_open = True
+ self._open_covers = [[self]] # list of open covers of self
self._atlas = [] # list of charts defined on subsets of self
self._top_charts = [] # list of charts defined on subsets of self
# that are not subcharts of charts on larger subsets
@@ -801,7 +802,6 @@ class TopManifold(TopManifoldSubset):
yield i
i += 1
-
def index_generator(self, nb_indices):
r"""
Generator of index series.
diff --git a/src/sage/manifolds/subset.py b/src/sage/manifolds/subset.py
index b88e1e5..4fb66c8 100644
--- a/src/sage/manifolds/subset.py
+++ b/src/sage/manifolds/subset.py
@@ -201,6 +201,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
# (key: subset name)
self._unions = {} # dict. of unions with other subsets (key: subset
# name)
+ self._open_covers = [] # list of open covers of self
self._is_open = False # a priori (may be redifined by subclasses)
#### Methods required for any Parent in the category of sets:
@@ -374,6 +375,54 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
"""
return self._manifold
+ def open_covers(self):
+ r"""
+ Return the list of open covers of the current subset.
+
+ If the current subset, `A` say, is a subset of the manifold `M`, an
+ *open cover* of `A` is list (indexed set) `(U_i)_{i\in I}` of
+ open subsets of `M` such that
+
+ .. MATH::
+
+ A \subset \bigcup_{i \in I} U_i
+
+ If `A` is open, we ask that the above inclusion is actually an
+ identity:
+
+ .. MATH::
+
+ A = \bigcup_{i \in I} U_i
+
+ EXAMPLES::
+
+ sage: TopManifold._clear_cache_() # for doctests only
+ sage: M = TopManifold(2, 'M')
+ sage: M.open_covers()
+ [[2-dimensional topological manifold M]]
+ sage: U = M.open_subset('U')
+ sage: U.open_covers()
+ [[Open subset U of the 2-dimensional topological manifold M]]
+ sage: A = U.open_subset('A')
+ sage: B = U.open_subset('B')
+ sage: U.declare_union(A,B)
+ sage: U.open_covers()
+ [[Open subset U of the 2-dimensional topological manifold M],
+ [Open subset A of the 2-dimensional topological manifold M,
+ Open subset B of the 2-dimensional topological manifold M]]
+ sage: V = M.open_subset('V')
+ sage: M.declare_union(U,V)
+ sage: M.open_covers()
+ [[2-dimensional topological manifold M],
+ [Open subset U of the 2-dimensional topological manifold M,
+ Open subset V of the 2-dimensional topological manifold M],
+ [Open subset A of the 2-dimensional topological manifold M,
+ Open subset B of the 2-dimensional topological manifold M,
+ Open subset V of the 2-dimensional topological manifold M]]
+
+ """
+ return self._open_covers
+
def subsets(self):
r"""
Return the set of subsets that have been defined on the current subset.
@@ -768,6 +817,14 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
res._coord_changes.update(other._coord_changes)
self._unions[other._name] = res
other._unions[self._name] = res
+ # Open covers of the union:
+ for oc1 in self._open_covers:
+ for oc2 in other._open_covers:
+ oc = oc1[:]
+ for s in oc2:
+ if s not in oc:
+ oc.append(s)
+ res._open_covers.append(oc)
return res
def declare_union(self, dom1, dom2):
@@ -796,6 +853,11 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
2-dimensional topological manifold M
"""
+ if dom1 == dom2:
+ if dom1 != self:
+ raise ValueError("the union of two identical sets must be " +
+ "this set")
+ return
if not dom1.is_subset(self):
raise TypeError("the {} is not a subset of ".format(dom1) +
"the {}".format(self))
@@ -804,6 +866,13 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
"the {}".format(self))
dom1._unions[dom2._name] = self
dom2._unions[dom1._name] = self
+ for oc1 in dom1._open_covers:
+ for oc2 in dom2._open_covers:
+ oc = oc1[:]
+ for s in oc2:
+ if s not in oc:
+ oc.append(s)
+ self._open_covers.append(oc)
def is_subset(self, other):
r"""