Calculemus


partition<'a> Type

Union-Find datatype to represent equivalence relations (partitions) on finite sets.

Example

The following creates two disjoint sets (or partitions, or equivalence classes):

  • \((1,2,3,4)\) with \(1\) as its representative;
  • \((5,6)\) with \(5\) as its representative.
 let (Partition f as ptn) = 
   unequal
   |> equate (2,1) 
   |> equate (3,1)
   |> equate (4,1) 
   |> equate (6,5) 
   
 f |> graph
val f: obj
val ptn: obj
Evaluates to
 val it: (int * pnode<int>) list =
   [(1, Terminal (1, 4)); (2, Nonterminal 1); (3, Nonterminal 1);
    (4, Nonterminal 1); (5, Terminal (5, 2)); (6, Nonterminal 5)]
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
type 'T list = List<'T>

Union cases

Union case Description

Partition func<'a, pnode<'a>>

Full Usage: Partition func<'a, pnode<'a>>

Parameters:
    Item : func<'a, pnode<'a>> - The fpf that defines the equivalence classes in the domain of the partition. It maps each element of the domain to the representative of the equivalence class the element belongs to.

Represents the partitions (or equivalence classes) of the domain through an fpf (see func) that maps an element of the domain to a pnode.

Item : func<'a, pnode<'a>>

The fpf that defines the equivalence classes in the domain of the partition. It maps each element of the domain to the representative of the equivalence class the element belongs to.