coya-0.1.0.1: Coya monoids

Coya

Description

Consider some log-semiring R. Then, for any two x,y :: R, the following holds:

x ^ log y == y ^ log x == e ^ (log x * log y)

Coya is a commutative monoid (R, y = x ^ log y.

The following laws hold:

Left Identity
e # x == x
Right Identity
x # e == x
Associativity
(x # y) # z == x # (y # z)
Commutativity
x # y == y # x

If R is a poset where all elements in R are greater than one, then R also forms a group:

x # (exp (1 / log x)) = x
Synopsis

Documentation

newtype Coya a Source #

The Coya monoid. Its semigroup instance is a binary operation that distributes over multiplication, i.e:

Coya x <> (Coya y * Coya z) == (Coya x <> Coya y) * (Coya x <> Coya z)

The Semiring and Num instances simply lift the underlying type's.

Constructors

 Coya FieldsgetCoya :: a
Instances

newtype CoyaGroup a Source #

The Coya monoid constrained to numbers which are greater than 1. This ensures that the group property of inversion holds:

x <> (exp (1 / log x)) == x

Constructors

 CoyaGroup FieldsgetCoyaGroup :: Refined (From 1) (Coya a)
Instances
 (Floating a, Ord a) => Semigroup (CoyaGroup a) Source # Equivalent to the Semigroup instance for Coya. Instance detailsDefined in Coya Methods(<>) :: CoyaGroup a -> CoyaGroup a -> CoyaGroup a #sconcat :: NonEmpty (CoyaGroup a) -> CoyaGroup a #stimes :: Integral b => b -> CoyaGroup a -> CoyaGroup a # (Floating a, Ord a) => Monoid (CoyaGroup a) Source # Equivalent to the Monoid instance for Coya. Instance detailsDefined in Coya Methodsmappend :: CoyaGroup a -> CoyaGroup a -> CoyaGroup a #mconcat :: [CoyaGroup a] -> CoyaGroup a # (Floating a, Ord a) => Group (CoyaGroup a) Source # x <> (exp (1 / log x)) == x Instance detailsDefined in Coya Methodsinvert :: CoyaGroup a -> CoyaGroup a #pow :: Integral x => CoyaGroup a -> x -> CoyaGroup a #

coyaGroup :: forall a. (Ord a, Num a) => a -> Maybe (CoyaGroup a) Source #

A smart constructor for CoyaGroup.