def setUp(self):
    self.add_common_objects()
    self.not_not_functor = endofunctor.not_functor.compose(endofunctor.not_functor)
    self.not_andBofA_not_functor = endofunctor.not_functor.compose(
        self.and_b_of_a_functor).compose(
            endofunctor.not_functor)
    # There exists a well defined a such that....
    self.well_defined_functor = enrichedFormula.ExpandWellDefined(self.a, self.b, self.equivalence)
    self.exists_well_defined_functor = enrichedFormula.ExpandWellDefined(self.c, self.d, self.equivalence).compose(
        endofunctor.Exists(self.c))
    self.well_defined_exists_functor = endofunctor.Exists(self.e).compose(
        enrichedFormula.ExpandWellDefined(self.c, self.d, self.equivalence))

    self.B = formula.Always(formula.Holds(common_vars.x(), common_vars.y()))
    self.and_B = endofunctor.And(side = left, other = self.B)
示例#2
0
# Copyright (C) 2013 Korei Klein <*****@*****.**>

from calculus import variable
from calculus.enriched import constructors
from lib import library, common_vars
from lib.common_symbols import leftSymbol, rightSymbol, relationSymbol, domainSymbol
from lib.common_formulas import InDomain, Equal, IsEquivalence

x = common_vars.x()
def reflexive(e):
  return constructors.Forall([constructors.BoundedVariableBinding(x, e)],
      Equal(x, x, e))

x = common_vars.x()
y = common_vars.y()
def symmetric(e):
  return constructors.Forall([ constructors.BoundedVariableBinding(x, e)
                             , constructors.BoundedVariableBinding(y, e)],
      constructors.Implies(
        predicates = [Equal(x, y, e)],
        consequent = Equal(y, x, e)))

x = common_vars.x()
y = common_vars.y()
z = common_vars.z()
def transitive(e):
  return constructors.Forall([ constructors.BoundedVariableBinding(x, e)
                             , constructors.BoundedVariableBinding(y, e)
                             , constructors.BoundedVariableBinding(z, e)],
      constructors.Implies(
        predicates = [ Equal(x, y, e)
 def assert_can_import_through_covariant_functor(self, functor):
   self.assertTrue(functor.covariant())
   importedObject = formula.Always(formula.Holds(common_vars.x(), common_vars.y()))
   self.assert_exact_import_succeeds(functor, importedObject)