コード例 #1
0
 def setUp(self):
     self.p = UnnamedOpetopicSet.Typing(
         UnnamedOpetopicSet.Variable("p", UnnamedOpetope.Point()),
         UnnamedOpetopicSet.Type(UnnamedOpetopicSet.PastingDiagram.point(),
                                 None))
     self.a = UnnamedOpetopicSet.Typing(
         UnnamedOpetopicSet.Variable("a",
                                     UnnamedOpetope.OpetopicInteger(0)),
         UnnamedOpetopicSet.Type(
             UnnamedOpetopicSet.PastingDiagram.degeneratePastingDiagram(
                 UnnamedOpetope.OpetopicInteger(0), "p"),
             UnnamedOpetopicSet.Variable("p", UnnamedOpetope.Arrow())))
     self.b = UnnamedOpetopicSet.Typing(
         UnnamedOpetopicSet.Variable("b",
                                     UnnamedOpetope.OpetopicInteger(0)),
         UnnamedOpetopicSet.Type(
             UnnamedOpetopicSet.PastingDiagram.degeneratePastingDiagram(
                 UnnamedOpetope.OpetopicInteger(0), "p"),
             UnnamedOpetopicSet.Variable("p", UnnamedOpetope.Arrow())))
     self.c = UnnamedOpetopicSet.Typing(
         UnnamedOpetopicSet.Variable("c",
                                     UnnamedOpetope.OpetopicInteger(2)),
         UnnamedOpetopicSet.Type(
             UnnamedOpetopicSet.PastingDiagram.nonDegeneratePastingDiagram(
                 UnnamedOpetope.OpetopicInteger(2), {
                     UnnamedOpetope.Address.epsilon(1): "x",
                     UnnamedOpetope.Address.epsilon(0).shift(): "y"
                 }), UnnamedOpetopicSet.Variable("z",
                                                 UnnamedOpetope.Arrow())))
     self.ctx = UnnamedOpetopicSet.Context() + self.p + self.a + self.c
コード例 #2
0
 def test___init__(self):
     UnnamedOpetopicSet.Type(
         self.s, UnnamedOpetopicSet.Variable("t", UnnamedOpetope.Arrow()))
     with self.assertRaises(DerivationError):
         UnnamedOpetopicSet.Type(
             self.s, UnnamedOpetopicSet.Variable("t",
                                                 UnnamedOpetope.Point()))
     UnnamedOpetopicSet.Type(UnnamedOpetopicSet.PastingDiagram.point(),
                             None)
     with self.assertRaises(DerivationError):
         UnnamedOpetopicSet.Type(self.s, None)
コード例 #3
0
 def setUp(self):
     self.type_point = UnnamedOpetopicSet.Type(
         UnnamedOpetopicSet.PastingDiagram.point(), None)
     self.a = UnnamedOpetopicSet.Variable("a", UnnamedOpetope.Point())
     self.b = UnnamedOpetopicSet.Variable("b", UnnamedOpetope.Point())
     self.c = UnnamedOpetopicSet.Variable("c", UnnamedOpetope.Point())
     self.d = UnnamedOpetopicSet.Variable("d", UnnamedOpetope.Point())
     self.ab = UnnamedOpetopicSet.Variable("ab", UnnamedOpetope.Arrow())
     self.ac = UnnamedOpetopicSet.Variable("ac", UnnamedOpetope.Arrow())
     self.bc = UnnamedOpetopicSet.Variable("bc", UnnamedOpetope.Arrow())
     self.cd = UnnamedOpetopicSet.Variable("cd", UnnamedOpetope.Arrow())
     self.seq = UnnamedOpetopicSet.Sequent()
     self.seq.context = UnnamedOpetopicSet.Context() + \
         UnnamedOpetopicSet.Typing(self.a, self.type_point) + \
         UnnamedOpetopicSet.Typing(self.b, self.type_point) + \
         UnnamedOpetopicSet.Typing(self.c, self.type_point) + \
         UnnamedOpetopicSet.Typing(self.d, self.type_point) + \
         UnnamedOpetopicSet.Typing(
             self.ab, self.type_arrow("a", self.b)) + \
         UnnamedOpetopicSet.Typing(
             self.ac, self.type_arrow("a", self.c)) + \
         UnnamedOpetopicSet.Typing(
             self.bc, self.type_arrow("b", self.c)) + \
         UnnamedOpetopicSet.Typing(
             self.cd, self.type_arrow("c", self.d))
コード例 #4
0
 def setUp(self):
     self.t = UnnamedOpetopicSet.Type(
         UnnamedOpetopicSet.PastingDiagram.nonDegeneratePastingDiagram(
             UnnamedOpetope.OpetopicInteger(2), {
                 UnnamedOpetope.Address.epsilon(1): "a",
                 UnnamedOpetope.Address.epsilon(0).shift(): "b"
             }), UnnamedOpetopicSet.Variable("t", UnnamedOpetope.Arrow()))
コード例 #5
0
 def type_arrow(
         self, src: str,
         tgt: UnnamedOpetopicSet.Variable) -> UnnamedOpetopicSet.Type:
     """
     Convenient function to define the type of an arrow shaped cell
     """
     return UnnamedOpetopicSet.Type(
         UnnamedOpetopicSet.PastingDiagram.nonDegeneratePastingDiagram(
             UnnamedOpetope.Arrow(),
             {UnnamedOpetope.Address.epsilon(0): src}), tgt)