コード例 #1
0
 def transitive(self, other=None):
     r"""
     TBD
     """
     if other is None:
         raise ValueError, "Enter a reduction map as a parameter"
     elif self.get_B() != other.get_A():
         raise ValueError, "These are not good candidate sets for reduction mapping"
     else:
         dic_h = dict()
         dic_h0 = dict()
         A = self.get_A()
         B = self.get_B()
         C = other.get_B()
         f = self.get_SRWP()
         f0 = self.get_SPWP()
         g = other.get_SRWP()
         g0 = other.get_SPWP()
         for elm in A:
             if elm in fixed_points(f):
                 if f0(elm) in fixed_points(g):
                     dic_h0[elm] = g0(f0(elm))
                     dic_h[elm] = elm
                 else:
                     dic_h[elm] = inverse(f0)(g(f0(elm)))
             else:
                 dic_h[elm] = f(elm)
         h = FiniteSetMaps(A, A).from_dict(dic_h)
         h0 = FiniteSetMaps(CombinatorialScalarWrapper(dic_h0.keys()),
                            C).from_dict(dic_h0)
         return ReductionMaps(A, C, h, h0)
コード例 #2
0
 def transitive(self,other=None):
     r"""
     TBD
     """
     if other is None:
         raise ValueError, "Enter a reduction map as a parameter"
     elif self.get_B() != other.get_A():
         raise ValueError, "These are not good candidate sets for reduction mapping"
     else:
         dic_h = dict()
         dic_h0 = dict()
         A = self.get_A()
         B = self.get_B()
         C = other.get_B()
         f = self.get_SRWP()
         f0 = self.get_SPWP()
         g = other.get_SRWP()
         g0 = other.get_SPWP()
         for elm in A:
             if elm in fixed_points(f):
                 if f0(elm) in fixed_points(g):
                     dic_h0[elm] = g0(f0(elm))
                     dic_h[elm] = elm
                 else:
                     dic_h[elm] = inverse(f0)(g(f0(elm)))
             else:
                 dic_h[elm] = f(elm)
         h = FiniteSetMaps(A,A).from_dict(dic_h)
         h0 = FiniteSetMaps(CombinatorialScalarWrapper(dic_h0.keys()),C).from_dict(dic_h0)
         return ReductionMaps(A,C,h,h0)
コード例 #3
0
 def reverse(self):
     if self.get_A().get_size() != self.get_B().get_size():
         raise ValueError, "Reduction direction cannot be reversed unless scalars are equivalent"
     else:
         A = self.get_B()
         B = self.get_A()
         f0 = inverse(self.get_SPWP())
         dic_f = dict()
         for elm in A:
             dic_f[elm] = elm
         f = FiniteSetMaps(A, A).from_dict(dic_f)
         return ReductionMaps(A, B, f, f0)
コード例 #4
0
 def reverse(self):
     if self.get_A().get_size() != self.get_B().get_size():
         raise ValueError, "Reduction direction cannot be reversed unless scalars are equivalent"
     else:
         A = self.get_B()
         B = self.get_A()
         f0 = inverse(self.get_SPWP())
         dic_f = dict()
         for elm in A:
             dic_f[elm] = elm
         f = FiniteSetMaps(A,A).from_dict(dic_f)
         return ReductionMaps(A,B,f,f0)
コード例 #5
0
 def confluence(self, other=None):
     r"""
     Returns the reduction of C to B, where the usage is:
     r1.confluence(r2), and r1 maps A to B, B fully cancelled,
     and r2 maps A to C.
     """
     if other is None:
         raise ValueError, "Enter a redution map as a parameter"
     elif self.get_A() != other.get_A():
         raise ValueError, """ "A" """ " sets have to match"
     elif not (self.get_B().is_fully_cancelled()):
         raise ValueError, """ "B" """ " on the left is not fully cancelled"
     else:
         dic_h = dict()
         dic_h0 = dict()
         A = self.get_A()
         B = self.get_B()
         C = other.get_B()
         f = self.get_SRWP()
         f0 = self.get_SPWP()
         g = other.get_SRWP()
         g0 = other.get_SPWP()
         fxd_f = fixed_points(self.get_SRWP())
         fxd_g = fixed_points(other.get_SRWP())
         for c in C:
             x = inverse(g0)(c)
             while True:
                 if x in fxd_f:  #a fixed point of h
                     dic_h[c] = c
                     dic_h0[c] = f0(x)
                     break
                 else:
                     x = f(x)
                 if x in fxd_g:  #not a fixed point of h
                     dic_h[c] = g0(x)
                     break
                 else:
                     x = g(x)
         h = FiniteSetMaps(C, C).from_dict(dic_h)
         h0 = FiniteSetMaps(CombinatorialScalarWrapper(dic_h0.keys()),
                            B).from_dict(dic_h0)
         return ReductionMaps(C, B, h, h0)
コード例 #6
0
 def confluence(self,other=None):
     r"""
     Returns the reduction of C to B, where the usage is:
     r1.confluence(r2), and r1 maps A to B, B fully cancelled,
     and r2 maps A to C.
     """
     if other is None:
         raise ValueError, "Enter a redution map as a parameter"
     elif self.get_A() != other.get_A():
         raise ValueError, """ "A" """ " sets have to match"
     elif not(self.get_B().is_fully_cancelled()):
         raise ValueError, """ "B" """ " on the left is not fully cancelled"
     else:
         dic_h = dict()
         dic_h0 = dict()
         A = self.get_A()
         B = self.get_B()
         C = other.get_B()
         f = self.get_SRWP()
         f0 = self.get_SPWP()
         g = other.get_SRWP()
         g0 = other.get_SPWP()
         fxd_f = fixed_points(self.get_SRWP())
         fxd_g = fixed_points(other.get_SRWP())
         for c in C:
             x = inverse(g0)(c)
             while True:
                 if x in fxd_f: #a fixed point of h
                     dic_h[c] = c
                     dic_h0[c] = f0(x)
                     break
                 else:
                     x = f(x)
                 if x in fxd_g: #not a fixed point of h
                     dic_h[c]=g0(x)
                     break
                 else:
                     x = g(x)
         h = FiniteSetMaps(C,C).from_dict(dic_h)
         h0 = FiniteSetMaps(CombinatorialScalarWrapper(dic_h0.keys()),B).from_dict(dic_h0)
         return ReductionMaps(C,B,h,h0)