예제 #1
0
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)
                     , Equal(y, z, e) ],
        consequent = Equal(x, z, e)))

A = common_vars.A()
claim = constructors.Forall([constructors.OrdinaryVariableBinding(A)],
    constructors.Iff(
      right = constructors.And(
        [ reflexive(A)
        , symmetric(A)
예제 #2
0
def ExpandTimes(a, b, c):
    base = And([Equal(natural.zero, a), Equal(natural.zero, c)])
    z = common_vars.z()
    step = ExistsNatural([z], And([Equal(S(z), a), Equal(Plus(b, Times(z, b)), c)]))
    return Or([base, step])