| 
1 | 1 | from __future__ import print_function, division  | 
2 | 2 | 
 
  | 
3 |  | -from sympy.core import Basic, Dict, Symbol, Tuple  | 
 | 3 | +from sympy.core import S, Basic, Dict, Symbol, Tuple  | 
4 | 4 | from sympy.core.compatibility import xrange, iterable  | 
5 | 5 | from sympy.sets import Set, FiniteSet, EmptySet  | 
6 | 6 | 
 
  | 
@@ -722,8 +722,8 @@ def __new__(cls, *args):  | 
722 | 722 | 
 
  | 
723 | 723 |                 for morphism in conclusions_arg:  | 
724 | 724 |                     # Check that no new objects appear in conclusions.  | 
725 |  | -                    if (morphism.domain in objects) and \  | 
726 |  | -                       (morphism.codomain in objects):  | 
 | 725 | +                    if ((objects.contains(morphism.domain) == S.true) and  | 
 | 726 | +                        (objects.contains(morphism.codomain) == S.true)):  | 
727 | 727 |                         # No need to add identities and recurse  | 
728 | 728 |                         # composites this time.  | 
729 | 729 |                         Diagram._add_morphism_closure(  | 
@@ -920,12 +920,14 @@ def subdiagram_from_objects(self, objects):  | 
920 | 920 | 
 
  | 
921 | 921 |         new_premises = {}  | 
922 | 922 |         for morphism, props in self.premises.items():  | 
923 |  | -            if (morphism.domain in objects) and (morphism.codomain in objects):  | 
 | 923 | +            if ((objects.contains(morphism.domain) == S.true) and  | 
 | 924 | +                (objects.contains(morphism.codomain) == S.true)):  | 
924 | 925 |                 new_premises[morphism] = props  | 
925 | 926 | 
 
  | 
926 | 927 |         new_conclusions = {}  | 
927 | 928 |         for morphism, props in self.conclusions.items():  | 
928 |  | -            if (morphism.domain in objects) and (morphism.codomain in objects):  | 
 | 929 | +            if ((objects.contains(morphism.domain) == S.true) and  | 
 | 930 | +                (objects.contains(morphism.codomain) == S.true)):  | 
929 | 931 |                 new_conclusions[morphism] = props  | 
930 | 932 | 
 
  | 
931 | 933 |         return Diagram(new_premises, new_conclusions)  | 
0 commit comments