Role-passing extensions
The role-passing extensions implement circuit-semantics for a subset of modal logic in
which quantification is limited to a finite domain consisting of linguistic roles.
Roles are represented as bit-masks in which each role is reserved one position.
This allows logical operations on sets of roles to be performed with single machine
instructions.
Roles
The set of roles is determined in advance and is exported by the role-passing package. The current set of roles is: agent, patient, object, instrument, cause, origin, destination, trajectory, and trajector. This set will grow, although there are
implementation reasons to want to limit it to 32 roles. Internally, roles are
defined as an enumeration type, however, this is not exposed in the API. Instead,
programmers should use the following macros:
- (role role-name)
- Macro. Returns the bit-mask representing the role.
- (roleset role-name ...)
- Macro. Returns the bit-mask for all the roles.
- (role-index role-name)
- Macro. Returns the bit-number corresponding to the role at compile time.
- role-count
- The total number of roles.
- (name->role-index symbol)
- Procedure. Returns the role index corresponding to a role name represented as a symbol
at run-time.
- (name->roleset symbol)
- Procedure. Returns the bitmask of symbol at run-time.
- (role-list->roleset list)
- Procedure. Returns the roleset corresponding to a list of role names represented
as symbols.
- (roleset->role-list roleset)
- Procedure. Returns a list of symbols corresponding to the roles in the roleset.
Modalities
In the following, a logic-expression is a signal that carries the
true-value(s) of a proposition or a unary predicate. Unary predicates are
represented as bit-vectors.
- (know logic-expression)
- True when logic-expression's value is known.
- (know-that logic-expression)
- True when logic-expression's value is known and its true.
- (goal logic-expression)
- True when logic-expression is a goal.
- (unsatisfied-goal logic-expression)
- True when logic-expression is a goal, but it's know to be false.
- (satisfied-goal logic-expression)
- True when logic-expression is a goal and it's know to be true.
- (know-goal logic-expression)
- True when determining logic-expression's value is a goal.
Goal reduction
Goal reduction allows you to specify that a given signal or signals should be activated
when a given modality of a given signal is active.
- (define-reduction (modality signal) serial)
- Declares goal reduction should be performed serially, left-to-right along signal's
inputs. That is, (goal (and a b)) will first assert (goal a), then when a is
satisfied, assert (goal b).
- (define-reduction (modality signal) parallel)
- Declares goal reduction should be performed in parallel for all of signal's
inputs. That is, (goal (and a b)) will
simultaneously assert (goal a) and(goal
b).
- (define-reduction (modality signal) subgoal-signal)
- Declares that (modality signal) should be reduced to subgoal-signalI.
That is, that (modality signal) should drive subgoal-signal.
Pools and binding
Binding is the process of tracking the relationships between roles and objects in the
world. To represent a sentence like "take the green ball", we have to be
able to represent the fact that the patient of the
sentence is the green ball. This is done initially by tagging (binding) the
representation of green in the lexicon, and eventually a
visual tracker tracking the green ball, with the role tag patient.
- (make-pool size)
- Creates a binding pool with the specified number of elements.
- (pool-bound-roles pool)
- Returns a roleset of all roles bound in pool.
- (pool-predicate pool predicate-vector)
- Returns a roleset of the roles for all items in pool whose respective entries
in predicate-vector are true.
- (pool-function pool function-vector)
- Function-vector should have one element for each item in pool.
Returns a new vector, indexed by role number, in which the value for element i is
the value of function-vector for whichever item is bound to role number i.
If no item is bound to that role, then the value of that element is
non-deterministic.
- (pool-lookup pool role)
- Returns the item number from the pool of the object that is bound to role, or
-1, if none exists. If an item is found, its last access time is reset.
- (pool-allocate! pool doit! role)
- When doit! is true, allocates the least recently used item from pool
to role and returns its index.
- (pool-deallocate! pool doit! roleset)
- When doit! is true, deallocates any items from pool that are bound to
any of the roles in roleset.
- (pool-clear! pool doit!)
- When doit! is true, deallocates all items in pool.