forall - Maple Programming Help

Home : Support : Online Help : Programming : Logic : Quantifiers : quantifiers

forall

universal quantifier function

exists

existential quantifier function

 Calling Sequence forall( bvar, pred ) exists( bvar, pred )

Parameters

 bvar - name or list of names; bound variable pred - any expression, except for constants not of type boolean nor of the form f(..); predicate

Description

 • The quantifier functions represent logical assertions.  They always return in unevaluated form, subject to basic type checks, variable-binding checks, and some canonicalization.
 • The quantifier functions do not attempt to evaluate truth values of given assertions, nor do they mandate any assumptions or constraints on any "variables" in the Maple session; rather, they act as placeholders to represent assertions for interpretation by other applications.
 • The arguments to a quantifier call are subject to the usual Maple evaluation of function arguments.
 • The predicate need not be of Maple type boolean, which allows the use of expressions such as P(x), P(true), P, or another quantifier.  Symbolic constants are not allowed with the exception of 'true' or 'false'.
 • Quantifiers can be nested by using a quantifier as (or as part of) the predicate of an enclosing quantifier.  The bound variable of the enclosing quantifier will often be the same as a parameter (or free variable) of an inner quantifier.  Thus, the formerly free variable of the inner quantifier has been bound at an outer level.
 • If in a quantifier call, the bound variable is already bound in another quantifier enclosed in the predicate, an error is returned.
 • A normalized quantifier always has the bound variable(s) in a single argument (a name or list of names) and the predicate as the second argument.
 • If a quantifier function is called with more than two arguments (such as quant( arg1, arg2, arg3, ... )), a quantifier function with bound variable arg1 and predicate as another quantifier of the same kind of the remaining arguments (such as quant( arg1, quant( arg2, arg3, ...) )) is returned. In other words, a recursive nesting of quantifiers is attempted, with an innermost quantifier of the last two original arguments.  This will return an error if the resulting $n-1$ bound variables are not distinct.
 • A quantifier function can be called with a list of bound variables, which will be preserved as such in the returned object.  Maple considers this form to be logically equivalent to a recursively nested form (see above), where the first element of the bound variable list is bound at the outermost level, and the last element is bound at the innermost level.  An error is returned if the bound variables in the list are not distinct.  If an empty list is specified, the predicate is simply returned (if valid).
 • No further simplifications are performed based on any interpretation of the quantifier, regardless of the state of the rest of the Maple session.  For example, even with the case of a trivial predicate as in forall(x,true), the quantifier is not "simplified" to 'true'.
 • Although a quantifier can formally be interpreted as having a Boolean value, it is not of Maple type boolean.
 • If, in the predicate of a quantifier, the bound variable were replaced with any particular value from its anticipated universe (which is not explicitly specified), the predicate should either evaluate to a Boolean constant or have the potential to do so, or at least be formally interpreted as Boolean.

Examples

 > $\mathrm{forall}\left(x,P\right)$
 ${\mathrm{forall}}{}\left({x}{,}{P}\right)$ (1)
 > $\mathrm{forall}\left(x,P\left(x\right)\right)$
 ${\mathrm{forall}}{}\left({x}{,}{P}{}\left({x}\right)\right)$ (2)
 > $\mathrm{exists}\left(x,x<0\right)$
 ${\mathrm{exists}}{}\left({x}{,}{x}{<}{0}\right)$ (3)
 > $\mathrm{forall}\left(x,y,Q\right)$
 ${\mathrm{forall}}{}\left({x}{,}{\mathrm{forall}}{}\left({y}{,}{Q}\right)\right)$ (4)

The following quantifier call returns an error.

 > $\mathrm{exists}\left(y,\mathrm{forall}\left(y,Q\right)\right)$
 > $\mathrm{exists}\left(z,\mathrm{forall}\left(y,Q\right)\right)$
 ${\mathrm{exists}}{}\left({z}{,}{\mathrm{forall}}{}\left({y}{,}{Q}\right)\right)$ (5)
 > $\mathrm{forall}\left(\left[x,y\right],Q\right)$
 ${\mathrm{forall}}{}\left(\left[{x}{,}{y}\right]{,}{Q}\right)$ (6)