class nltk.ApplicationExpression(function, argument)[source]

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 “(”.

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)”.


__init__(function, argument)
param function:Expression, for the function expression
equiv(other[, prover]) Check for logical equivalence.
findtype(variable) :see Expression.findtype()
free() Return a set of all the free (non-bound) variables.
fromstring(s[, type_check, signature])
is_atom() Is this expression an atom (as opposed to a lambda expression applied
negate() If this is a negated expression, remove the negation.
normalize([newvars]) Rename auto-generated unique variables
replace(variable, expression[, ...]) Replace every instance of ‘variable’ with ‘expression’
typecheck([signature]) Infer and check types.
uncurry() Uncurry this application expression
variables() Return a set of all the variables for binding substitution.
visit(function, combinator)
visit_structured(function, combinator) Recursively visit subexpressions.


args Return uncurried arg-list
pred Return uncurried base-function.