«
class documentation

This class is used to represent two related types of logical expressions.

The first is a Predicate Expression, such as "P(x,y)". A predicate expression is comprised of a FunctionVariableExpression or ConstantExpression as the predicate and a list of Expressions as the arguments.

The second is a an application of one expression to another, such as "(x.dog(x))(fido)".

The reason Predicate Expressions are treated as Application Expressions is that the Variable Expression predicate of the expression may be replaced with another Expression, such as a LambdaExpression, which would mean that the Predicate should be thought of as being applied to the arguments.

The logical expression reader will always curry arguments in a application expression. So, "x y.see(x,y)(john,mary)" will be represented internally as "((x y.(see(x))(y))(john))(mary)". This simplifies the internals since there will always be exactly one argument in an application.

The str() method will usually print the curried forms of application expressions. The one exception is when the the application expression is really a predicate expression (ie, underlying function is an AbstractVariableExpression). This means that the example from above will be returned as "(x y.see(x,y)(john))(mary)".

Method __eq__ Undocumented
Method __init__ No summary
Method __ne__ Undocumented
Method __str__ Undocumented
Method constants No summary
Method findtype :see Expression.findtype()
Method is_atom Is this expression an atom (as opposed to a lambda expression applied to a term)?
Method predicates No summary
Method simplify No summary
Method uncurry Uncurry this application expression
Method visit No summary
Instance Variable argument Undocumented
Instance Variable function Undocumented
Property args Return uncurried arg-list
Property pred Return uncurried base-function. If this is an atom, then the result will be a variable expression. Otherwise, it will be a lambda expression.
Property type Undocumented
Method _set_type :see Expression._set_type()

Inherited from Expression:

Class Method fromstring Undocumented
Method __and__ Undocumented
Method __call__ Undocumented
Method __gt__ Undocumented
Method __hash__ Undocumented
Method __lt__ Undocumented
Method __neg__ Undocumented
Method __or__ Undocumented
Method __repr__ Undocumented
Method applyto Undocumented
Method equiv Check for logical equivalence. Pass the expression (self <-> other) to the theorem prover. If the prover says it is valid, then the self and other are equal.
Method free Return a set of all the free (non-bound) variables. This includes both individual and predicate variables, but not constants. :return: set of Variable objects
Method make_VariableExpression Undocumented
Method negate If this is a negated expression, remove the negation. Otherwise add a negation.
Method normalize Rename auto-generated unique variables
Method replace Replace every instance of 'variable' with 'expression' :param variable: Variable The variable to replace :param expression: Expression The expression with which to replace it :param replace_bound: bool Should bound variables be replaced...
Method substitute_bindings No summary
Method typecheck Infer and check types. Raise exceptions if necessary.
Method variables Return a set of all the variables for binding substitution. The variables returned include all free (non-bound) individual variables and any variable starting with '?' or '@'. :return: set of Variable objects...
Method visit_structured Recursively visit subexpressions. Apply 'function' to each subexpression and pass the result of each function application to the 'combinator' for aggregation. The combinator must have the same signature as the constructor...
Class Variable _logic_parser Undocumented
Class Variable _type_checking_logic_parser Undocumented
def __eq__(self, other): (source)

Undocumented

def __init__(self, function, argument): (source)
Parameters
functionExpression, for the function expression
argumentExpression, for the argument
def __ne__(self, other): (source)

Undocumented

def __str__(self): (source)

Undocumented

def constants(self): (source)
See Also
Expression.constants()
def findtype(self, variable): (source)

:see Expression.findtype()

def is_atom(self): (source)

Is this expression an atom (as opposed to a lambda expression applied to a term)?

def predicates(self): (source)
See Also
Expression.predicates()
def simplify(self): (source)
Returns
beta-converted version of this expression
def uncurry(self): (source)

Uncurry this application expression

return: A tuple (base-function, arg-list)

def visit(self, function, combinator): (source)
See Also
Expression.visit()
argument = (source)

Undocumented

function = (source)

Undocumented

@property
args = (source)

Return uncurried arg-list

@property
pred = (source)

Return uncurried base-function. If this is an atom, then the result will be a variable expression. Otherwise, it will be a lambda expression.

@property
type = (source)

Undocumented

def _set_type(self, other_type=ANY_TYPE, signature=None): (source)

:see Expression._set_type()