# chains -- computes all chains of a poset

## Synopsis

• Usage:
L = chains P
L = chains(P, k)
• Inputs:
• P, an instance of the type Poset,
• k, an integer, if specified length of returned chains
• Outputs:
• L, a list, containing all chains of $P$

## Description

A set of elements of $P$ is called a chain if every pair of elements in the set are comparable.

 i1 : D = divisorPoset 12; i2 : chains D o2 = {{}, {1}, {1, 2}, {1, 2, 4}, {1, 2, 4, 12}, {1, 2, 6}, {1, 2, 6, 12}, ------------------------------------------------------------------------ {1, 2, 12}, {1, 3}, {1, 3, 6}, {1, 3, 6, 12}, {1, 3, 12}, {1, 4}, {1, 4, ------------------------------------------------------------------------ 12}, {1, 6}, {1, 6, 12}, {1, 12}, {2}, {2, 4}, {2, 4, 12}, {2, 6}, {2, ------------------------------------------------------------------------ 6, 12}, {2, 12}, {3}, {3, 6}, {3, 6, 12}, {3, 12}, {4}, {4, 12}, {6}, ------------------------------------------------------------------------ {6, 12}, {12}} o2 : List

With the input k, the method restricts to only chains of that length. In a divisorPoset, all chains of length $2$ describe exactly the divisor-multiple pairs.

 i3 : chains(D, 2) o3 = {{1, 2}, {1, 3}, {1, 4}, {1, 6}, {1, 12}, {2, 4}, {2, 6}, {2, 12}, {3, ------------------------------------------------------------------------ 6}, {3, 12}, {4, 12}, {6, 12}} o3 : List