acts-0.1.0.0: Semigroup actions, groups, and torsors.
Safe HaskellNone
LanguageHaskell2010

Data.Group.Cyclic

Description

Cyclic groups: integers modulo n (clock arithmetic).

Synopsis

Documentation

data Cyclic n where Source #

Cyclic group of order n: integers with addition modulo n.

Bundled Patterns

pattern Cyclic :: forall n. KnownNat n => Int -> Cyclic n

Smart pattern and constructor for elements of cyclic groups.

Instances

Instances details
Generic1 Cyclic Source # 
Instance details

Defined in Data.Group.Cyclic

Associated Types

type Rep1 Cyclic :: k -> Type #

Methods

from1 :: forall (a :: k). Cyclic a -> Rep1 Cyclic a #

to1 :: forall (a :: k). Rep1 Cyclic a -> Cyclic a #

KnownNat n => Bounded (Cyclic n) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

minBound :: Cyclic n #

maxBound :: Cyclic n #

KnownNat n => Enum (Cyclic n) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

succ :: Cyclic n -> Cyclic n #

pred :: Cyclic n -> Cyclic n #

toEnum :: Int -> Cyclic n #

fromEnum :: Cyclic n -> Int #

enumFrom :: Cyclic n -> [Cyclic n] #

enumFromThen :: Cyclic n -> Cyclic n -> [Cyclic n] #

enumFromTo :: Cyclic n -> Cyclic n -> [Cyclic n] #

enumFromThenTo :: Cyclic n -> Cyclic n -> Cyclic n -> [Cyclic n] #

Eq (Cyclic n) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

(==) :: Cyclic n -> Cyclic n -> Bool #

(/=) :: Cyclic n -> Cyclic n -> Bool #

Ord (Cyclic n) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

compare :: Cyclic n -> Cyclic n -> Ordering #

(<) :: Cyclic n -> Cyclic n -> Bool #

(<=) :: Cyclic n -> Cyclic n -> Bool #

(>) :: Cyclic n -> Cyclic n -> Bool #

(>=) :: Cyclic n -> Cyclic n -> Bool #

max :: Cyclic n -> Cyclic n -> Cyclic n #

min :: Cyclic n -> Cyclic n -> Cyclic n #

Show (Cyclic n) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

showsPrec :: Int -> Cyclic n -> ShowS #

show :: Cyclic n -> String #

showList :: [Cyclic n] -> ShowS #

Generic (Cyclic n) Source # 
Instance details

Defined in Data.Group.Cyclic

Associated Types

type Rep (Cyclic n) :: Type -> Type #

Methods

from :: Cyclic n -> Rep (Cyclic n) x #

to :: Rep (Cyclic n) x -> Cyclic n #

KnownNat n => Semigroup (Cyclic n) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

(<>) :: Cyclic n -> Cyclic n -> Cyclic n #

sconcat :: NonEmpty (Cyclic n) -> Cyclic n #

stimes :: Integral b => b -> Cyclic n -> Cyclic n #

(KnownNat n, 1 <= n) => Monoid (Cyclic n) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

mempty :: Cyclic n #

mappend :: Cyclic n -> Cyclic n -> Cyclic n #

mconcat :: [Cyclic n] -> Cyclic n #

NFData (Cyclic n) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

rnf :: Cyclic n -> () #

(KnownNat n, 1 <= n) => Group (Cyclic n) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

inverse :: Cyclic n -> Cyclic n Source #

gtimes :: Integral n0 => n0 -> Cyclic n -> Cyclic n Source #

KnownNat n => Act (Cyclic n) Int Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

(•) :: Cyclic n -> Int -> Int Source #

act :: Cyclic n -> Int -> Int Source #

Act (Cyclic 2) Bool Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

(•) :: Cyclic 2 -> Bool -> Bool Source #

act :: Cyclic 2 -> Bool -> Bool Source #

(Enum a, Bounded a, KnownNat n, 1 <= n) => Torsor (Cyclic n) (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

(Enum a, Bounded a, KnownNat n) => Act (Cyclic n) (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

Num a => Act (Cyclic 2) (Complex a) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

(•) :: Cyclic 2 -> Complex a -> Complex a Source #

act :: Cyclic 2 -> Complex a -> Complex a Source #

Num i => Act (Cyclic 2) (Sum i) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

(•) :: Cyclic 2 -> Sum i -> Sum i Source #

act :: Cyclic 2 -> Sum i -> Sum i Source #

Fractional i => Act (Cyclic 2) (Product i) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

(•) :: Cyclic 2 -> Product i -> Product i Source #

act :: Cyclic 2 -> Product i -> Product i Source #

type Rep1 Cyclic Source # 
Instance details

Defined in Data.Group.Cyclic

type Rep1 Cyclic = D1 ('MetaData "Cyclic" "Data.Group.Cyclic" "acts-0.1.0.0-inplace" 'True) (C1 ('MetaCons "MkCyclic" 'PrefixI 'True) (S1 ('MetaSel ('Just "runCyclic") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 Finite)))
type Rep (Cyclic n) Source # 
Instance details

Defined in Data.Group.Cyclic

type Rep (Cyclic n) = D1 ('MetaData "Cyclic" "Data.Group.Cyclic" "acts-0.1.0.0-inplace" 'True) (C1 ('MetaCons "MkCyclic" 'PrefixI 'True) (S1 ('MetaSel ('Just "runCyclic") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Finite n))))

getCyclic :: forall n. KnownNat n => Cyclic n -> Int Source #

Obtain a representative in the range \( [0, n[ \).

type C (n :: Nat) = Cyclic n Source #

Synonym for finite cyclic group.

type Z = Sum Int Source #

Synonym for infinite cyclic group.

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.

Constructors

CyclicEnum 

Fields

Instances

Instances details
Bounded a => Bounded (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

Enum a => Enum (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

Eq a => Eq (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

(==) :: CyclicEnum a -> CyclicEnum a -> Bool #

(/=) :: CyclicEnum a -> CyclicEnum a -> Bool #

Data a => Data (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CyclicEnum a -> c (CyclicEnum a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (CyclicEnum a) #

toConstr :: CyclicEnum a -> Constr #

dataTypeOf :: CyclicEnum a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (CyclicEnum a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (CyclicEnum a)) #

gmapT :: (forall b. Data b => b -> b) -> CyclicEnum a -> CyclicEnum a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CyclicEnum a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CyclicEnum a -> r #

gmapQ :: (forall d. Data d => d -> u) -> CyclicEnum a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CyclicEnum a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CyclicEnum a -> m (CyclicEnum a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CyclicEnum a -> m (CyclicEnum a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CyclicEnum a -> m (CyclicEnum a) #

Ord a => Ord (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

Show a => Show (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

Generic (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

Associated Types

type Rep (CyclicEnum a) :: Type -> Type #

Methods

from :: CyclicEnum a -> Rep (CyclicEnum a) x #

to :: Rep (CyclicEnum a) x -> CyclicEnum a #

NFData a => NFData (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

Methods

rnf :: CyclicEnum a -> () #

Generic1 CyclicEnum Source # 
Instance details

Defined in Data.Group.Cyclic

Associated Types

type Rep1 CyclicEnum :: k -> Type #

Methods

from1 :: forall (a :: k). CyclicEnum a -> Rep1 CyclicEnum a #

to1 :: forall (a :: k). Rep1 CyclicEnum a -> CyclicEnum a #

(Enum a, Bounded a, KnownNat n, 1 <= n) => Torsor (Cyclic n) (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

(Enum a, Bounded a, KnownNat n) => Act (Cyclic n) (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

type Rep (CyclicEnum a) Source # 
Instance details

Defined in Data.Group.Cyclic

type Rep (CyclicEnum a) = D1 ('MetaData "CyclicEnum" "Data.Group.Cyclic" "acts-0.1.0.0-inplace" 'True) (C1 ('MetaCons "CyclicEnum" 'PrefixI 'True) (S1 ('MetaSel ('Just "getCyclicEnum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type Rep1 CyclicEnum Source # 
Instance details

Defined in Data.Group.Cyclic

type Rep1 CyclicEnum = D1 ('MetaData "CyclicEnum" "Data.Group.Cyclic" "acts-0.1.0.0-inplace" 'True) (C1 ('MetaCons "CyclicEnum" 'PrefixI 'True) (S1 ('MetaSel ('Just "getCyclicEnum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))

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.

rootOfUnity :: forall a n. (KnownNat n, Floating a) => Cyclic n -> Complex a Source #

Natural complex representations of finite cyclic groups as roots of unity.