[ The ECLiPSe Libraries | Reference Manual | Alphabetic Index ]

# library(suspend)

Lazy-checking versions of arithmetic primitives, and the suspend-attribute

## Predicates

> ?Vars #:: ?Range
>   Range constraint combined with integrality constraint
> #::(?Vars, ?Range, ?Bool)
>   Reified range constraint combined with integrality constraint
> ?Expr1 #< ?Expr2
>   The integer value of Expr1 is less than the integer value of Expr2.
> #<(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 #= ?Expr2
>   The integer value of Expr1 is equal to the integer value of Expr2.
> #=(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 #=< ?Expr2
>   The integer value of Expr1 is less than or equal to the integer value of Expr2.
> #=<(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 #> ?Expr2
>   The integer value of Expr1 is greater than the integer value of Expr2.
> #>(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 #>= ?Expr2
>   The integer value of Expr1 is greater than or equal to the integer value of Expr2.
> #>=(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 #\= ?Expr2
>   The integer value of Expr1 is not equal to the integer value of Expr2.
> #\=(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Vars #:: ?Range
>   Pure range constraint
> $::(?Vars, ?Range, ?Bool)
>   Reified pure range constraint
> ?Expr1 $< ?Expr2
>   The value of Expr1 is less than the value of Expr2.
> $<(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 $= ?Expr2
>   The value of Expr1 is equal to the value of Expr2.
> $=(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 $=< ?Expr2
>   The value of Expr1 is less than or equal to the value of Expr2.
> $=<(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 $> ?Expr2
>   The value of Expr1 is greater than the value of Expr2.
> $>(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 $>= ?Expr2
>   The value of Expr1 is greater than or equal to the value of Expr2.
> $>=(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 $\= ?Expr2
>   The value of Expr1 is not equal to the value of Expr2.
> $\=(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Vars :: ?Range
>   Range constraint with optional integrality constraint
> ::(?Var, ?Range, ?Bool)
>   Reified range constraint with optional integrality constraint
> ?Expr1 < ?Expr2
>   The value of Expr1 is less than the value of Expr2.
> <(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 =:= ?Expr2
>   The value of Expr1 is equal to the value of Expr2.
> =:=(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 =< ?Expr2
>   The value of Expr1 is less than or equal to the value of Expr2.
> =<(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 => ?Expr2
>   If Expr1 arithmetically evaluates to 1, so does Expr2 (implication)
> =>(?Expr1, ?Expr2, ?Bool)
>   Reified boolean operation
> ?Expr1 =\= ?Expr2
>   The value of Expr1 is not equal to the value of Expr2.
> =\=(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 > ?Expr2
>   The value of Expr1 is greater than the value of Expr2.
> >(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 >= ?Expr2
>   The value of Expr1 is greater than or equal to the value of Expr2.
> >=(?Expr1, ?Expr2, ?Bool)
>   Reified arithmetic comparison
> ?Expr1 and ?Expr2
>   Both Expr1 and Expr2 arithmetically evaluate to 1
> and(?Expr1, ?Expr2, ?Bool)
>   Reified boolean operation
> compare_instances_suspend(?, ?, ?)
>   No description available
> delayed_goals_number_suspend(?, ?)
>   No description available
> integers(?Vars)
>   Constrain Vars to be integers
> neg ?Expr
>   Expr arithmetically evaluates to 0
> neg(?Expr, ?Bool)
>   Reified boolean operation
> ?Expr1 or ?Expr2
>   At least one of Expr1 or Expr2 arithmetically evaluate to 1
> or(?Expr1, ?Expr2, ?Bool)
>   Reified boolean operation
> portray_delay_reified(?, ?)
>   No description available
> portray_delayed_goals(?, ?)
>   No description available
> reals(?Vars)
>   Constrain Vars to be a number or list of numbers
> suspensions_suspend(?, ?, ?)
>   No description available
> tr_if_suspend(?, ?, ?)
>   No description available
> unify_suspend(?, ?)
>   No description available

## Other Exports

> export meta_attribute(suspend, [unify : unify_suspend / 2, compare_instances : compare_instances_suspend / 3, suspensions : suspensions_suspend / 3, delayed_goals_number : delayed_goals_number_suspend / 2])
> export macro(if / 2, suspend : tr_if_suspend / 3, [clause])
> export op(750, fx, [neg])
> export op(760, yfx, [and])
> export op(770, yfx, [or])
> export op(780, yfx, [=>])
> export op(700, xfx, [#::, $::, $=, $\=, $>=, $=<, $>, $<])
> export portray(delay_until_ground / 3, suspend : portray_delayed_goals / 2, [goal])
> export portray(delay_reified / 4, suspend : portray_delay_reified / 2, [goal])

## Description

This library provides the following:

- the suspend pseudo-solver for general arithmetic
- the suspend attribute

The suspend pseudo-solver for arithmetic comparisons simply consists of suspending (lazy-checking) versions of all arithmetic comparisons (>/2, #>/2, etc). These all suspend until all their variables have been instantiated, then they wake up and test the condition, succeeding or failing as appropriate. Together with a search routine, this provides the means to implement simple test-and-generate algorithms.

The suspend-attribute is a basis for the implementation of similar user-defined data-driven computations that react to variable instantiation, variable binding, or general variable-constraining events. The suspend- attribute defines the following three suspension lists (and thus waking conditions) for a variable:

inst
  woken when variable is instantiated.
bound
  woken when variable is bound, even to an other variable.
constrained
  woken when variable is (further) constrained. This is triggered by the notify_constrained built-in.

These three lists can be used as waking conditions in the suspend/3,4 built-in. Variables using the suspend-attribute do not have to be declared specially, the attribute is implicitly created when needed.

## About

- Author: Micha Meier, ECRC, Joachim Schimpf, ECRC and IC-Parc
- Copyright © Cisco Systems, Inc
- Date: $Date: 2006/09/23 01:55:36 $

Generated from suspend.eci on Sat Nov 8 06:56:27 2008