Copyright | (c) 2020-2021 Emily Pillmore Koji Miyazato <viercc@gmail.com> |
---|---|

License | BSD-style |

Maintainer | Emily Pillmore <emilypi@cohomolo.gy>, Reed Mullanix <reedmullanix@gmail.com> |

Stability | stable |

Portability | non-portable |

Safe Haskell | Safe |

Language | Haskell2010 |

This module contains definitions for `GroupOrder`

.

## Synopsis

- class (Eq g, Group g) => GroupOrder g where
- data Order
- pattern Infinitary :: GroupOrder g => g
- pattern Finitary :: GroupOrder g => Natural -> g
- orderForBits :: (Integral a, FiniteBits a) => Sum a -> Order
- lcmOrder :: Order -> Order -> Order
- class (Group g, Bounded g) => FiniteGroup g
- finiteOrder :: (Eq g, FiniteGroup g) => g -> Natural

# Group order

class (Eq g, Group g) => GroupOrder g where Source #

The typeclass of groups, equipped with the function computing the order of a specific element of a group.

The order of `x`

is the smallest positive integer `k`

such that

. If there are no such
integers, the order of `gtimes`

k x == `mempty`

`x`

is defined to be infinity.

*Note:* For any valid instances of `GroupOrder`

,
`order x == Finite 1`

holds if and only if `x == mempty`

.

**Examples**:

`>>>`

Finite 256`order (3 :: Sum Word8)`

`>>>`

Finite 16`order (16 :: Sum Word8)`

`>>>`

Finite 1`order (0 :: Sum Integer)`

`>>>`

Infinite`order (1 :: Sum Integer)`

The order of an element of a group.

`order x`

must be `Finite k`

if the order of `x`

is
finite `k`

, and must be `Infinite`

otherwise.

For a type which is also `FiniteGroup`

,

is a valid implementation of `Finite`

. `finiteOrder`

`order`

,
if not efficient.

#### Instances

## Order

The order of a group element.

The order of a group element can either be infinite,
as in the case of `Sum Integer`

, or finite, as in the
case of `Sum Word8`

.

pattern Infinitary :: GroupOrder g => g Source #

Unidirectional pattern synonym for the infinite order of a group element.

pattern Finitary :: GroupOrder g => Natural -> g Source #

Unidirectional pattern synonym for the finite order of a group element.

orderForBits :: (Integral a, FiniteBits a) => Sum a -> Order Source #

lcmOrder :: Order -> Order -> Order Source #

`lcmOrder x y`

calculates the least common multiple of two `Order`

s.

If both `x`

and `y`

are finite, it returns

where `Finite`

r`r`

is the least common multiple of them. Otherwise, it returns `Infinite`

.

**Examples**:

`>>>`

Finite 10`lcmOrder (Finite 2) (Finite 5)`

`>>>`

Finite 10`lcmOrder (Finite 2) (Finite 10)`

`>>>`

Infinite`lcmOrder (Finite 1) Infinite`

class (Group g, Bounded g) => FiniteGroup g Source #

A `FiniteGroup`

is a `Group`

whose underlying set is finite.
This is equivalently a group object in \( FinSet \).

Finite groups often arise when considering symmetry of mathematical or physical objects, when those objects admit just a finite number of structure-preserving transformations. Important examples of finite groups include cyclic groups and permutation groups.

#### Instances

FiniteGroup () Source # | |

Defined in Data.Group.Finite | |

FiniteGroup a => FiniteGroup (Identity a) Source # | |

Defined in Data.Group.Finite | |

FiniteGroup a => FiniteGroup (Dual a) Source # | |

Defined in Data.Group.Finite | |

(Bounded a, Num a) => FiniteGroup (Sum a) Source # | |

Defined in Data.Group.Finite | |

(FiniteGroup a, FiniteGroup b) => FiniteGroup (a, b) Source # | |

Defined in Data.Group.Finite | |

FiniteGroup a => FiniteGroup (Proxy a) Source # | |

Defined in Data.Group.Finite | |

(FiniteGroup a, FiniteGroup b, FiniteGroup c) => FiniteGroup (a, b, c) Source # | |

Defined in Data.Group.Finite | |

FiniteGroup a => FiniteGroup (Const a b) Source # | |

Defined in Data.Group.Finite | |

(FiniteGroup a, FiniteGroup b, FiniteGroup c, FiniteGroup d) => FiniteGroup (a, b, c, d) Source # | |

Defined in Data.Group.Finite | |

(FiniteGroup a, FiniteGroup b, FiniteGroup c, FiniteGroup d, FiniteGroup e) => FiniteGroup (a, b, c, d, e) Source # | |

Defined in Data.Group.Finite |

finiteOrder :: (Eq g, FiniteGroup g) => g -> Natural Source #

Calculate the exponent of a particular element in a finite group.

**Examples**:

`>>>`

256`finiteOrder @(Sum Word8) 3`