-
-
Couldn't load subscription status.
- Fork 680
Open
Description
(for the visualization of the posets, use #31680 and install the dot2tex package - without that package, the layout is quite misleading)
sage: M = Manifold(3, 'M')
sage: U = M.open_subset('U'); V = M.open_subset('V'); W = M.open_subset('W')
sage: M.declare_union(U, V, W)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-c7f527dcc1ea> in <module>()
----> 1 M.declare_union(U, V, W)
TypeError: declare_union() takes 3 positional arguments but 4 were given
sage: def label(element):
....: try:
....: return element._name
....: except AttributeError:
....: return '[' + ', '.join(sorted(x._name for x in element)) + ']'
sage: P = M.subset_poset(open_covers=True); P.plot(element_labels={element: label(element) for element in P})
sage: M.declare_union(U, V.union(W))
sage: P = M.subset_poset(open_covers=True); P.plot(element_labels={element: label(element) for element in P})
sage: U.union(V).union(W)
Open subset U_union_V_union_W of the 3-dimensional differentiable manifold M
sage: P = M.subset_poset(open_covers=True); P.plot(element_labels={element: label(element) for element in P})
sage: U.union(V.union(W))
3-dimensional differentiable manifold M
sage: P = M.subset_poset(open_covers=True); P.plot(element_labels={element: label(element) for element in P}) # same
sage: M.is_subset(U.union(V).union(W))
False
#31764 adds support for arbitrary unions. But the main issue here is the failing associativity of the union.
We fix it as follows.
When creating a union, we update the open covers of the supersets of the members, replacing the union members by the union.
Depends on #31764
CC: @egourgoulhon @tscrim
Component: manifolds
Keywords: sets, union
Author: Matthias Koeppe
Branch/Commit: u/mkoeppe/declare_union_yields_wrong_results @ 743f114
Issue created by migration from https://trac.sagemath.org/ticket/30263