COGENT Online |

CONTENTS |

COGENT Version 2.3 Help |

- Introduction
- List processing
- Arithmetic
- Statistics
- Type checking
- Term comparison
- Miscellaneous
- Qualifiers

See also: Processes

Built-in conditions are accessed via a series of pull-down menus in the Rule editor and Condition Editor. They are intended to simplify programming, by predefining a wide range of primitive facilities, and by helping the user to avoid several common syntax errors.

**member**

*Term* **is a member of** *List*

Succeeds if *Term* can be matched with a member of *List*.
*List* should normally be instantiated. If *Term* matches with
more than one element of *List* (e.g. if *Term* is
uninstantiated), **member** will re-satisfy for each distinct
possibility.

**length**

*Integer* **is the length of** *List*

Succeeds if *Integer* can be matched with the
length of *List*. *List* should be instantiated.

**delete**

*List1* **results from deleting** *Term* **from** *List2*

Succeeds if *List1* is the result of deleting a term which
matches with *Term* from *List2*. If *Term* matches
more than one element of *List2* (e.g. if *Term* is
uninstantiated), **delete** will re-satisfy for each distinct
possibility.

**select**

**select** *Element* **from** *List1* leaving *List2*

Succeeds if *Element* can be matched with an element of *List1* and
*List2* results from deleting that element from *List1*.

**append**

*List1* **results from appending** *List2* **to** *List3*

Succeeds if *List1* is the result of appending *List2* to
*List3*. With *List2* and *List3* instantiated, and
*List1* uninstantiated, **append** will create a new *
List1*; however, with only *List1* instantiated, **append**
will split the list into two parts, re-satisfying once for each
possible pair of sublists.

**reverse**

*List2* **results from reversing** *List1*

Succeeds if the elements in *List2* are in the reverse order to the
elements in *List1*. *List1* should be instantiated when the
condition is called, but *List2* may be uninstantiated, in which case it
will be instantiated with the reverse of *List1* (provided *List1*
is a list).

**replace**

**replace the first** *Term1* **in** *List1* **with** *
Term2* **to give** *List2*

Succeeds if *List2* results from replacing the first instance of
*Term1* in *List1* with *Term2*. *Term1*, *
Term2* and *List1* should be instantiated.

**replace all**

**replace each** *Term1* **in** *List1* **with** *
Term2* **to give** *List2*

Succeeds if *List2* results from replacing all instances of
*Term1* in *List1* with *Term2*. *Term1*, *
Term2* and *List1* should be instantiated.

**first element**

*Term* **is the first element of** *List*

Succeeds if *Term* can be matched with the first element of
*List*. *List* should normally be instantiated.

**last element**

*Term* **is the last element of** *List*

Succeeds if *Term* can be matched with the last element of
*List*. *List* should normally be instantiated.

**sort**

*List1* **results from sorting** *List2*

Succeeds if *List1* is the result of sorting *List2*. *
List2* should be instantiated.

**rank list**

*Ranks* are the ranks of *List*

*List* must be a list. *Ranks* is a list of exactly the same length,
with elements corresponding to the ranks of elements in *List*. For
example: `rank_list([3, 8, 7, 8], [1, 3.5, 2, 3.5])`. The elements of
*List* do not need to be numbers. If they are not, then the standard
order of terms is used for ranking. In this order, numbers come before
upper-case letters which come before lower-case letters. Note that if the
elements of *List* are expressions that may evaluate to numbers, then the
expressions are ranked, *not* the numbers that they evaluate to.

**sublist**

*List1* **is a sublist of** *List2*

Succeeds if *List1* is a sublist of *List2*. *List2*
should normally be instantiated. If *List1* is uninstantiated,
**sublist** should re-satisfy for all possible sublists.

**findall**

*List* **is the list of all** *Term* **such that** `CONDITION`

Succeeds if *List* matches the list of all *Term* such that
some condition `CONDITION` holds. `CONDITION` is selected as a
subcondition using the usual pull-down condition editor
menus. Normally *Term* will contain at least one uninstantiated
variable which also occurs in `CONDITION`, so that *List* is
a list of solutions to `CONDITION`.

**is**

*Number* **is** *Expression*

Succeeds if *Number* matches the result of evaluating the
arithmetic expression *Expression*. Allowable operators in *
Expression* will depend on the underlying Prolog implementation; see
your Prolog manual for details. Note, however, that COGENT
provides built-in conditions for many arithmetic and mathematical
functions, independently of Prolog implementation --- these are listed
below.

**plus**

*Number1* **is** *Number2* **+** *Number3*

**minus**

*Number1* **is** *Number2* **-** *Number3*

**times**

*Number1* **is** *Number2* ***** *Number3*

**divide**

*Number1* **is** *Number2* **/** *Number3*

**sqrt**

*Number1* **is the square root of** *Number2*

**abs**

*Number1* **is the absolute value of** *Number2*

**log**

*Number1* **is the natural log of** *Number2*

**exp**

*Number1* **is e to the power** *Number2*

**power**

*Number1* **is** *Number2* **to the power** *Integer*

**sigmoid**

*Number1* **is sigmoid(** *Number2* **)**

**factorial**

*Integer1* **is** *Integer2* **factorial**

**random number: uniform**

*Number* **is randomly drawn from U(** *LowerBound* **,** *UpperBound* **)**

Succeeds if *Number* matches a random number drawn from the
uniformly distributed interval [*LowerBound*,*
Upperbound*). Unlikely to succeed if *Number* is instantiated.

**random number: normal**

*Number* **is randomly drawn from N(** *Mean* **,** *Variance* **)**

Succeeds if *Number* matches a random number drawn from the
normal distribution with the specified *Mean* and *
Variance* (=S.D.^2). Unlikely to succeed if *Number* is
instantiated.

**random number: poisson**

*Number* **is randomly drawn from P(** *Mean* **)**

Succeeds if *Number* matches a random integer drawn from a Poisson
distribution with mean *Mean*. Unlikely to succeed if *Number* is
instantiated.

**random number: integer**

*Number* **is a random integer drawn from ** *LowerBound* **to** *UpperBound* **inclusive**

Succeeds if *Number* matches a random integer drawn from the interval
from *LowerBound* to * Upperbound* inclusive. Unlikely to succeed if
*Number* is instantiated.

**trig function: sin**

*Number1* **is sin(** *Number2* **)**

Succeeds if *Number1* is the sine of *Number2* (expressed
in radians). Same for the other trig functions below.

**trig function: cos**

*Number1* **is cos(** *Number2* **)**

**trig function: tan**

*Number1* **is tan(** *Number2* **)**

**trig function: asin**

*Number1* **is asin(** *Number2* **)**
Succeeds if *Number1* is the inverse sine of *Number2*.
*Number1* is expressed in radians. Same for the other inverse trig
functions below.

**trig function: acos**

*Number1* **is acos(** *Number2* **)**

**trig function: atan**

*Number1* **is atan(** *Number2* **)**

**List Arithmetic: minimum value**

*Number* **is the smallest numeric element in** *List*

**List Arithmetic: maximum value**

*Number* **is the largest numeric element in** *List*

**List Arithmetic: sum**

*Number* **is the sum of the elements of** *List*

**List Arithmetic: product**

*Number* **is the product of the elements of** *List*

**List Arithmetic: arithmetic mean**

*Number* **is the average of the elements of** *List*

**List Arithmetic: geometric mean**

*Number* **is the geometric mean of the elements of** *List*

**List Arithmetic: standard deviation**

*Number* **is the s.d of the elements of** *List*

**Vector Arithmetic: add vectors**

*List3* **is vector** *List1* **+ vector** *List2*

**Vector Arithmetic: subtract vectors**

*List3* **is vector** *List1* **- vector** *List2*

**Vector Arithmetic: scale vector**

*List2* **is scalar** *Number* *** vector** *List1*

**Vector Arithmetic: dot product**

*Number* **is the dot product of vector** *List1* **and vector** *List2*

**Vector Arithmetic: length of vector**

*Number* **is the Cartesian length of vector** *List*

*z*: the standard normal distribution;*t(DF)*, where*DF*is a positive integer: the student's t distribution with*DF*degrees of freedom;*r(DF)*, where*DF*is a positive integer and (-1 =<*X*=< 1): Pearson's r distribution (defined in terms of t);*chi_sq(DF)*, where*DF*is a positive integer: the chi^{2}distribution with*DF*degrees of freedom;*f(N, D)*, where*N*and*D*are positive integers: the F distribution with*N*and*D*degrees of freedom;*beta(A, B)*, where*A*and*B*are multiples of exactly 0.5: the beta distribution with parameters*A*and*B*; or*gamma(A, B)*, where*A*and*B*are multiples of exactly 0.5: the gamma distribution with parameters*A*and*B*.

**probability**

**probability( Distribution, X, Alpha)**

Returns

Tip: if you want to calculate significance levels for *z*,
*t* or *r*, note that *Alpha* returns the probability
associated with the positive tail of the distribution. If you predict
negative values, use *-X* instead of *X* as an argument. For
2-tailed significance values, use *abs(X)* and multiply
*Alpha* by 2.

**correlation**

*Coefficient* is the *Type* correlation coefficient of *List*

*List* must be a list of pairs of numbers (e.g., `[(2.3, 4.2), (2.1,
5.1)]`). *Type* must be `pearson`, `spearman` or
`kendall`. The condition returns *Coefficient*, the Pearson's,
Spearman's or Kendall's correlation co-efficient of the list of numbers.

**related t**

**related_t( List, T)**

**unrelated t**

**unrelated_t( List1, List2, T)**

**chi squared**

*Num1* **is chi^2 of** *List1* **(with expected values** *List2***)**

*Num1* is the chi-squared statistic calculated from the numbers in
*List1*. If the elements of *List1* are numbers, it is assumed they
represent elements in a 1-dimensional table, and chi-squared is calculated as
such. If the elements are list of numbers, where each list is of the same
length, it is assumed they represent a 2-dimensional table, and chi-squared is
calculated as such. *List2* is an optional argument. If instantiated, it
must match the structure of *List1*, and elements are interpreted as
representing the expected values of the corresponding values in
*List1*.

**atom**

*Term* **is an atom**

Succeeds if *Term* is an atom.

**integer**

*Term* **is an integer**

Succeeds if *Term* is an integer.

**number**

*Term* **is a number**

Succeeds if *Term* is a (possibly floating-point) number.

**variable**

*Term* **is a variable**

Succeeds if *Term* is an uninstantiated variable.

**is identical to**

*Term1* **==** *Term2*

Succeeds if *Term1* is strictly equal to *Term2*. That is,
uninstantiated variables must occur in the same places in both terms,
as well as all other elements being equal.

**is distinct from**

*Term1* **\==** *Term2*

Succeeds if *Term1* is not strictly equal to *Term2*. See
**is identical to** for a definition of strict equality.

**unifies with**

*Term1* **=** *Term2*

Succeeds if *Term1* unifies with (matches) *Term2*. May
result in instantiation of uninstantiated variables in either term.

**arithmetic: is equal to**

*Number* **=:=** *Expression*

Succeeds if *Number* is equal to the evaluation of *Expression*. Use
in preference to **is** for equality checking, since **is** doesn't
force types.

**arithmetic: is not equal to**

*Number* **=\=** *Expression*

**arithmetic: is less than**

*Number1* **<** *Number2*

**arithmetic: is not less than**

*Number1* **>=** *Number2*

**arithmetic: is greater than**

*Number1* **>** *Number2*

**arithmetic: is not greater than**

*Number1* **=<** *Number2*

**alphanumeric: is before**

*Atom1* **@<** *Atom2*

Succeeds if *Atom1* is before *Atom2* in alphanumeric
comparison (similar to alphabetic order). Similarly for the other
alphanumeric comparisons.

**alphanumeric: is not before**

*Atom1* **@>=** *Atom2*

**alphanumeric: is after**

*Atom1* **@>** *Atom2*

**alphanumeric: is not after**

*Atom1* **@=<** *Atom2*

**match**

*Term* is in `BUFFER`

Succeeds if *Term* can be matched with an item in the selected
`BUFFER`. `BUFFER` is selected from a pull-down menu listing
all accessible buffers.

**call in module**

**call** *Term* **in** `BUFFER`

Succeeds if *Term* matches a condition defined within the selected
`BUFFER`. This is used for calling procedures/methods defined within
buffers. Such definitions are appropriate when the procedures depend upon the
the buffer's properties or the buffer's contents.

**get value of property**

**the value of the** `PROPERTY` **property is** *Term*

Succeeds if `PROPERTY` (which is selected from a pull-down menu) is a
property of the current box, and the value of that property within the current
box unifies with *Term*. This is used for retrieving the values of
properties of modules.

**get value of inherited property**

**the value of the** `PROPERTY` **property of** `BOX` **is** *Term*

Succeeds if `PROPERTY` (which is selected from a pull-down menu) is a
property of the specified box, and the value of that property within the
specified box unifies with *Term*. This is used for retrieving the values
of properties of super-ordinate compound boxes. `Box` may be any
compound box that (recursively) contains the box containing the condition.

**current cycle**

**the current cycle is** *Integer*

Succeeds if *Integer* matches an integer specifying the
current COGENT cycle number.

**current trial**

**Trial** *Integer1* **of** *Integer2*

Succeeds if *Integer1* matches an integer specifying the
current COGENT trial number and *Integer2* matches the total
number of trials in the current block.

**current block**

**the current block is** *Integer*

Succeeds if *Integer* matches an integer specifying the
current COGENT block number.

**current subject**

**the current subject is** *Integer*

Succeeds if *Integer* matches an integer specifying the
current COGENT subject number.

**current experiment**

**the current experiment is** *Integer*

Succeeds if *Integer* matches an integer specifying the
current COGENT experiment number.

**is composed of**

*List* **is composed of** *Term*

Succeeds if *List* corresponds to the subcomponents of of *Term*.
(Equivalent to the Prolog "univ" operation.)

**generate symbol**

*Term1* **is a new symbol with base** *Term2*

Succeeds if *Term1* is a "new" atom in the sequence defined by
*Term2*. Equivalent to the Lisp "gensym" function.

**call Prolog**

**call** *Term*

Succeeds if *Term* succeeds as a Prolog goal. This is used
for calling built-in Prolog predicates.

**!**

**!**

The prolog cut (only available in the condition editor).

**not**

**not** `CONDITION`

Succeeds if `CONDITION` fails.

**exists**

**exists** `CONDITION`

Succeeds if `CONDITION` succeeds, but without instantiating any
variables in `CONDITION`. Equivalent to **not not**
`condition`.

**once**

**once** `CONDITION`

Permits `CONDITION` to succeed only once, without re-satisfying.

**unique**

**unique** `CONDITION`

Succeeds if `CONDITION` has a unique solution, i.e. if `CONDITION` succeeds only once.

**trace**

**trace** `CONDITION`

Succeeds if the `CONDITION` succeeds, with the side-effect of
printing the condition on the process box's Messages window, for debugging purposes.

COGENT Online |

CONTENTS |

COGENT Version 2.3 Help |