lr-acts-0.0.1: Left and right actions, semidirect products and torsors
Copyright(c) Alice Rixte 2025
LicenseBSD 3
Maintaineralice.rixte@u-bordeaux.fr
Stabilityunstable
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Data.Act.Torsor

Description

Presentation

Torsors are sets for which the differences between elements form a group. One good example is time : it does not make sense to add two dates together so we should model these dates as a set (we keep this simple by using only days):

>>> newtype Days = Days Int
        deriving Show

But subtracting two dates together does makes sense. This is where LTorsor can become useful :

newtype Duration = Duration Days
  deriving Show
  deriving (Semigroup, Monoid, Group) via Sum Int
  deriving (LAct Days, LActSg Days, LActMn Days, LTorsor Days)
           via (ActSelf' (Sum Int))

Now only Duration can be added or subtracted together and not dates.

>>> (Days 5 .-. Days 3 :: Duration) + (Days 7 .-. Days 5)
Duration (Days 4)

For a more details and examples see this article

Synopsis

Documentation

class LActGp x g => LTorsor x g where Source #

A left group torsor.

The most well known example of a torsor is the particular case of an affine space where the group is the additive group of the vector space and the set is a set of points. Torsors are more general than affine spaces since they don't enforce linearity. Notice that LActDistrib may correspond to a linearity condition if you need one.

See this nLab article for more information : https://ncatlab.org/nlab/show/torsor

In algebraic terms :

A left group action is a torsor if and only if for every pair (x,y) :: (x, x), there exists a unique group element g :: g such that g <>$ x = y.

In Haskell terms :

Instances must satisfy the following law :

  • y .-. x <>$ x == y
  • if g <>$ x == y then g == y .-. x

Minimal complete definition

ldiff | (.-.)

Methods

ldiff :: x -> x -> g infix 6 Source #

ldiff y x is the only group element such that ldiff y x <>$ x = y.

(.-.) :: x -> x -> g infix 6 Source #

Infix synonym for ldiff.

This represents a point minus a point.

Instances

Instances details
LTorsor x () Source # 
Instance details

Defined in Data.Act.Torsor

Methods

ldiff :: x -> x -> () Source #

(.-.) :: x -> x -> () Source #

Group g => LTorsor g (ActSelf g) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

ldiff :: g -> g -> ActSelf g Source #

(.-.) :: g -> g -> ActSelf g Source #

LTorsor x g => LTorsor x (Identity g) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

ldiff :: x -> x -> Identity g Source #

(.-.) :: x -> x -> Identity g Source #

RTorsor x g => LTorsor x (Dual g) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

ldiff :: x -> x -> Dual g Source #

(.-.) :: x -> x -> Dual g Source #

Fractional x => LTorsor x (Product x) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

ldiff :: x -> x -> Product x Source #

(.-.) :: x -> x -> Product x Source #

Num x => LTorsor x (Sum x) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

ldiff :: x -> x -> Sum x Source #

(.-.) :: x -> x -> Sum x Source #

(Group g, Coercible x g) => LTorsor x (ActSelf' g) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

ldiff :: x -> x -> ActSelf' g Source #

(.-.) :: x -> x -> ActSelf' g Source #

LTorsor x g => LTorsor (Identity x) (Identity g) Source # 
Instance details

Defined in Data.Act.Torsor

(LTorsor x g, LTorsor y h) => LTorsor (x, y) (g, h) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

ldiff :: (x, y) -> (x, y) -> (g, h) Source #

(.-.) :: (x, y) -> (x, y) -> (g, h) Source #

class RActGp x g => RTorsor x g where Source #

A right group torsor.

In algebraic terms :

A left group action is a torsor if and only if for every pair (x,y) :: (x, x), there exists a unique group element g :: g such that g <>$ x = y.

In Haskell terms :

Instances must satisfy the following law :

  • x $<> y .~. x == y
  • if x $<> g == y then g == y .~. x

Minimal complete definition

rdiff | (.~.)

Methods

rdiff :: x -> x -> g infix 6 Source #

rdiff y x is the only group element such that rdiff y x $<> x = y.

(.~.) :: x -> x -> g infix 6 Source #

Infix synonym for rdiff.

This represents a point minus a point.

Instances

Instances details
RTorsor x () Source # 
Instance details

Defined in Data.Act.Torsor

Methods

rdiff :: x -> x -> () Source #

(.~.) :: x -> x -> () Source #

Group g => RTorsor g (ActSelf g) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

rdiff :: g -> g -> ActSelf g Source #

(.~.) :: g -> g -> ActSelf g Source #

RTorsor x g => RTorsor x (Identity g) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

rdiff :: x -> x -> Identity g Source #

(.~.) :: x -> x -> Identity g Source #

LTorsor x g => RTorsor x (Dual g) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

rdiff :: x -> x -> Dual g Source #

(.~.) :: x -> x -> Dual g Source #

Fractional x => RTorsor x (Product x) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

rdiff :: x -> x -> Product x Source #

(.~.) :: x -> x -> Product x Source #

Num x => RTorsor x (Sum x) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

rdiff :: x -> x -> Sum x Source #

(.~.) :: x -> x -> Sum x Source #

(Group g, Coercible x g) => RTorsor x (ActSelf' g) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

rdiff :: x -> x -> ActSelf' g Source #

(.~.) :: x -> x -> ActSelf' g Source #

RTorsor x g => RTorsor (Identity x) (Identity g) Source # 
Instance details

Defined in Data.Act.Torsor

(RTorsor x g, RTorsor y h) => RTorsor (x, y) (g, h) Source # 
Instance details

Defined in Data.Act.Torsor

Methods

rdiff :: (x, y) -> (x, y) -> (g, h) Source #

(.~.) :: (x, y) -> (x, y) -> (g, h) Source #