type ApplicationExpression
source code
object --+
|
SubstituteBindingsI --+
|
Expression --+
|
ApplicationExpression
- Known Subclasses:
-
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 LogicParser 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)".
|
|
|
|
|
|
|
|
free(self,
indvar_only=True)
Return a set of all the free (non-bound) variables in self. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
visit(self,
function,
combinator,
default)
Recursively visit sub expressions |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
| str(self,
syntax=Tokens.NLTK) |
|
|
|
Inherited from Expression:
__and__,
__call__,
__gt__,
__hash__,
__lt__,
__neg__,
__neq__,
__or__,
__repr__,
applyto,
equiv,
make_VariableExpression,
negate,
normalize,
replace,
substitute_bindings,
tp_equals,
typecheck,
variables
|
__init__(self,
function,
argument)
(Constructor)
| source code
|
- Parameters:
function - Expression, for the function expression
argument - Expression, for the argument
- Overrides:
object.__init__
|
- Returns:
- beta-converted version of this expression
- Overrides:
Expression.simplify
- (inherited documentation)
|
|
Return a set of all the free (non-bound) variables in self. Variables
serving as predicates are not included.
- Parameters:
indvar_only - boolean only return individual variables?
- Returns:
set of Variables
- Overrides:
Expression.free
See Also:
Expression.free()
|
_set_type(self,
other_type=?,
signature=None)
| source code
|
@see Expression._set_type()
- Parameters:
other_type - Type to set
signature - dict<str,
list<AbstractVariableExpression>> store all
variable expressions with a given name
- Overrides:
Expression._set_type
|
|
Recursively visit sub expressions
- Parameters:
function - Function to call on each sub expression
combinator - Function to combine the results of the function
calls
- Returns:
- result of combination
- Overrides:
Expression.visit
See Also:
Expression.visit()
|
|
Uncurry this application expression
return: A tuple (base-function, arg-list)
|