10.31 Rem’s Algorithm—library(rem)

This library module maintains equivalence classes using Rem’s algorithm. Exported predicates:

rem_create(+Size, -REM)

creates an equivalence representation function REM which maps each of the nodes 1..Size to itself.

rem_head(?Node, +REM, -Head)

is true when Head is the representative of the equivalence class that Node belongs to in the given REM.

rem_equivalent(?Node1, ?Node2, +REM)

is true when Node1 and Node2 belong to the same equivalence class in the given REM.

rem_add_link(?Node1, ?Node2, +OldREM, -NewREM)

is true when adding the equivalence Node1===Node2 to the partition represented by OldREM yields a partition which is represented by NewREM. If Node1 or Node2 is uninstantiated, it will backtrack over all the nodes. It’s not clear how useful this is.

Send feedback on this subject.