예제 #1
0
 def add_common_objects(self):
   self.a = common_vars.a()
   self.b = common_vars.b()
   self.c = common_vars.c()
   self.d = common_vars.d()
   self.e = common_vars.e()
   self.b_of_a = formula.Always(formula.Holds(self.a, self.b))
   self.a_of_b = formula.Always(formula.Holds(self.b, self.a))
   self.a_of_a = formula.Always(formula.Holds(self.a, self.a))
   self.b_of_c = formula.Always(formula.Holds(self.c, self.b))
   self.d_of_c = formula.Always(formula.Holds(self.c, self.d))
   self.e_of_e = formula.Always(formula.Holds(self.e, self.e))
   self.and_b_of_a_functor = endofunctor.And(side=endofunctor.left,
                                      other=self.b_of_a)
   self.b_of_a_and_functor = endofunctor.And(side=endofunctor.right,
                                      other=self.b_of_a)
   self.or_d_of_c_functor = endofunctor.Or(side=endofunctor.left,
                                    other=self.d_of_c)
   self.d_of_c_or_functor = endofunctor.Or(side=endofunctor.right,
                                    other=self.d_of_c)
   self.exists_a_functor = endofunctor.Exists(variable=self.a)
   self.exists_b_functor = endofunctor.Exists(variable=self.b)
   self.exists_c_functor = endofunctor.Exists(variable=self.c)
   self.exists_d_functor = endofunctor.Exists(variable=self.d)
   self.not_not_functor = endofunctor.not_functor.compose(endofunctor.not_functor)
   self.equivalence = variable.StringVariable('equiv')
  def add_common_objects(self):
    self.a = common_vars.a()
    self.b = common_vars.b()
    self.c = common_vars.c()
    self.d = common_vars.d()
    self.e = common_vars.e()

    self.A = constructors.Always(constructors.Holds(self.a, self.a))
    self.B = constructors.Always(constructors.Holds(self.b, self.b))

    self.W = constructors.Always(constructors.Holds(self.a, self.b))
    self.X = constructors.Always(constructors.Holds(self.a, self.c))
    self.Y = constructors.Always(constructors.Holds(self.a, self.d))
    self.Z = constructors.Always(constructors.Holds(self.a, self.e))

    self.a_in_domain_b = constructors.Always(constructors.Holds(self.a,
      variable.ApplySymbolVariable(self.b, common_symbols.domainSymbol)))

    self.and_W = endofunctor.And(values = [self.W], index = 0)
    self.W_and = endofunctor.And(values = [self.W], index = 1)
    self.X_and_and_Y = endofunctor.And(values = [self.X, self.Y], index = 1)

    self.W_and_X = constructors.And([self.W, self.X])
    self.X_and_Y_and_Z = constructors.Always(constructors.And([self.X, self.Y, self.Z]))
    self.W_AND_X_and_Y_and_Z = constructors.And([self.W, self.X_and_Y_and_Z])

    self.exists_a_in_domain_b_X_and_Y_and_Z = constructors.Exists(
        [constructors.BoundedVariableBinding(self.a, self.b)], self.X_and_Y_and_Z)

    self.exists_wd_a_in_domain_b_X_and_Y_and_Z = constructors.Exists(
        [constructors.WelldefinedVariableBinding(self.a, self.b)], self.X_and_Y_and_Z)

    self.exists_d = endofunctor.Exists([constructors.OrdinaryVariableBinding(self.d)])
    self.exists_e = endofunctor.Exists([constructors.OrdinaryVariableBinding(self.e)])
    self.exists_d_e = endofunctor.Exists([ constructors.OrdinaryVariableBinding(self.d)
                                         , constructors.OrdinaryVariableBinding(self.e)])
예제 #3
0
from calculus import symbol, variable
from calculus.enriched import constructors
from lib.common_formulas import Maps, IsEquivalence, IsFunction, Equal
from lib import common_vars

def projectSrc(f):
  return variable.ApplySymbolVariable(f, common_symbols.srcSymbol)
def projectTgt(f):
  return variable.ApplySymbolVariable(f, common_symbols.tgtSymbol)
def projectDomain(e):
  return variable.ApplySymbolVariable(e, common_symbols.domainSymbol)
def projectRelation(e):
  return variable.ApplySymbolVariable(e, common_symbols.relationSymbol)

a = common_vars.a()
b = common_vars.b()
def defined(f):
  return constructors.Forall([constructors.BoundedVariableBinding(a, projectSrc(f))],
      constructors.Exists([constructors.BoundedVariableBinding(b, projectTgt(f))],
        Maps(a, b, f)))

a = common_vars.a()
b = common_vars.b()
aprime = common_vars.aprime()
bprime = common_vars.bprime()
def wellDefined(f):
  return constructors.Forall(
      [ constructors.BoundedVariableBinding(a, projectSrc(f))
      , constructors.BoundedVariableBinding(aprime, projectSrc(f))
      , constructors.BoundedVariableBinding(b, projectTgt(f))
      , constructors.BoundedVariableBinding(bprime, projectTgt(f))],