Exemple #1
0
def point(name: str) -> NamedOpetope.OCMT:
    """
    The :math:`\\textbf{OptSet${}^!_m$}` :math:`\\texttt{point}` rule.
    Introduces a :math:`0`-variable with name ``x``.
    """
    t = NamedOpetope.Typing(NamedOpetope.Term(NamedOpetope.Variable(name, 0)),
                            NamedOpetope.Type([NamedOpetope.Term()]))
    return NamedOpetope.OCMT(NamedOpetope.EquationalTheory(),
                             NamedOpetope.Context() + t)
 def setUp(self):
     self.a1 = NamedOpetope.Variable("a1", 0)
     self.b1 = NamedOpetope.Variable("b1", 0)
     self.c1 = NamedOpetope.Variable("c1", 0)
     self.a2 = NamedOpetope.Variable("a2", 0)
     self.b2 = NamedOpetope.Variable("b2", 0)
     self.c2 = NamedOpetope.Variable("c2", 0)
     self.f = NamedOpetope.Variable("f", 1)
     self.g = NamedOpetope.Variable("g", 1)
     self.h = NamedOpetope.Variable("h", 1)
     self.i = NamedOpetope.Variable("h", 1)
     ctx = NamedOpetope.Context() + \
         NamedOpetope.Typing(
             NamedOpetope.Term(self.a1),
             NamedOpetope.Type([NamedOpetope.Term()])) + \
         NamedOpetope.Typing(
             NamedOpetope.Term(self.b1),
             NamedOpetope.Type([NamedOpetope.Term()])) + \
         NamedOpetope.Typing(
             NamedOpetope.Term(self.c1),
             NamedOpetope.Type([NamedOpetope.Term()])) + \
         NamedOpetope.Typing(
             NamedOpetope.Term(self.f),
             NamedOpetope.Type(
                 [NamedOpetope.Term(self.a2),
                  NamedOpetope.Term()])) + \
         NamedOpetope.Typing(
             NamedOpetope.Term(self.g),
             NamedOpetope.Type(
                 [NamedOpetope.Term(self.b2), NamedOpetope.Term()])) + \
         NamedOpetope.Typing(
             NamedOpetope.Term(self.h),
             NamedOpetope.Type(
                 [NamedOpetope.Term(self.c2), NamedOpetope.Term()]))
     eqth = NamedOpetope.EquationalTheory() + \
         (self.b1, self.b2) + \
         (self.c1, self.c2) + \
         (self.h, self.i)
     self.sequent = NamedOpetope.Sequent(eqth, ctx, None)
     self.fg = self.sequent.graft(NamedOpetope.Term(self.g), self.b2,
                                  NamedOpetope.Term(self.f))
     self.gh = self.sequent.graft(NamedOpetope.Term(self.h), self.c2,
                                  NamedOpetope.Term(self.g))
     self.fgh1 = self.sequent.graft(self.gh, self.b2,
                                    NamedOpetope.Term(self.f))
     self.fgh2 = self.sequent.graft(NamedOpetope.Term(self.h), self.c2,
                                    self.fg)
 def setUp(self):
     self.term1 = NamedOpetope.Term(NamedOpetope.Variable("a", 0))
     self.term2 = NamedOpetope.Term(NamedOpetope.Variable("f", 1))
     self.term3 = NamedOpetope.Term(NamedOpetope.Variable("α", 2))
     self.term4 = NamedOpetope.Term(NamedOpetope.Variable("A", 3))
     self.typing1 = NamedOpetope.Type([NamedOpetope.Term()])
     self.typing2 = NamedOpetope.Type([self.term1, NamedOpetope.Term()])
     self.typing3 = NamedOpetope.Type(
         [self.term2, self.term1,
          NamedOpetope.Term()])
     self.typing4 = NamedOpetope.Type(
         [self.term3, self.term2, self.term1,
          NamedOpetope.Term()])
     self.ctx1 = NamedOpetope.Context()
     self.ctx2 = self.ctx1 + NamedOpetope.Typing(self.term1, self.typing1)
     self.ctx3 = self.ctx2 + NamedOpetope.Typing(self.term2, self.typing2)
     self.ctx4 = self.ctx3 + NamedOpetope.Typing(self.term3, self.typing3)
     self.ctx5 = self.ctx4 + NamedOpetope.Typing(self.term4, self.typing4)
Exemple #4
0
def zero() -> NamedOpetope.OCMT:
    """
    The :math:`\\textbf{OptSet${}^!$}` :math:`\\texttt{zero}` rule.
    """
    return NamedOpetope.OCMT(NamedOpetope.EquationalTheory(),
                             NamedOpetope.Context())