curry.backends.py.eval.rts_fingerprint module

Implements RuntimeState methods related to the fingerprint. This module is not intended to be imported except by rts.py.

curry.backends.py.eval.rts_fingerprint.equate_fp(rts, arg0, arg1, config=None)[source]

Equate two IDs in a fingerprint. Set both to the same value and return True, if that is consistent, or return False otherwise.

curry.backends.py.eval.rts_fingerprint.grp_id(rts, arg=None, config=None)[source]

Returns the group ID. The argument must be a choice or variable node, or ID.

Every distinct group of free variables constrained equal with (=:=) belong to a group with a unique group ID. The group ID is the object ID of one arbitrary, distinguished member, called the representative.

Two variables are constrained equal if and only if they share the same group ID (reflexivity permitted).

curry.backends.py.eval.rts_fingerprint.obj_id(rts, arg=None, config=None)[source]

Returns the choice or variable ID of a node. The node argument must be a choice or free variable node. For convenience, arg may be an ID, in which case it is simply returned.

curry.backends.py.eval.rts_fingerprint.read_fp(rts, arg=None, config=None)[source]

Read the fingerprint for the given argument. The argument must be a choice or variable node, ID, or ChoiceState. The group ID is always used to read a fingerprint. For convenience, if a ChoiceState is provided, it is simply returned.

curry.backends.py.eval.rts_fingerprint.update_fp(rts, choicestate, arg=None, config=None)[source]

Update the fingerprint to reflect the ID associated with arg` being set to choicestate.

If choicestate is UNDETERMINED, this does nothing. Otherwise, the current value of arg is determined, consulting the fingerprint, if necessary. If it is consistent with choicestate then it is updated and True is returned. Otherwise, False is returned.

Parameters:
  • choicestate – The choice state to set. Must be a ChoiceState, choice or free variable node, or ID.

  • arg – The ID to update in the fingerprint. Must be a choice or free variable node, or ID.

  • config – The Configuration to use as context.

Returns:

A Boolean indicating whether the change is consistent.