Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cyclic groups: integers modulo n
(clock arithmetic).
Synopsis
- data Cyclic n where
- getCyclic :: forall n. KnownNat n => Cyclic n -> Int
- type C (n :: Nat) = Cyclic n
- type Z = Sum Int
- newtype CyclicEnum a = CyclicEnum {
- getCyclicEnum :: a
- pattern Involution :: Cyclic 2
- involution :: Act (Cyclic 2) x => x -> x
- rootOfUnity :: forall a n. (KnownNat n, Floating a) => Cyclic n -> Complex a
Documentation
Cyclic group of order n
: integers with addition modulo n
.
pattern Cyclic :: forall n. KnownNat n => Int -> Cyclic n | Smart pattern and constructor for elements of cyclic groups. |
Instances
getCyclic :: forall n. KnownNat n => Cyclic n -> Int Source #
Obtain a representative in the range \( [0, n[ \).
newtype CyclicEnum a Source #
Newtype for cycling through elements in a finite enumeration.
data ABCD = A | B | C | D deriving stock ( Enum, Bounded ) deriving ( Act ( Cyclic 4 ), Torsor ( Cyclic 4 ) ) via CyclicEnum ABCD
> act ( Cyclic 2 ) C A
> act ( Cyclic (-1) ) A D
> ( C --> B :: Cyclic 4 ) Cyclic 3
Warning It is unfortunately not checked that the size of the group matches the size of the finite enumeration. Please manually ensure this condition.
CyclicEnum | |
|
Instances
pattern Involution :: Cyclic 2 Source #
Nontrivial element of cyclic group of order 2.
involution :: Act (Cyclic 2) x => x -> x Source #
Act by an involution.