numhask
Safe HaskellNone
LanguageGHC2024

NumHask.Algebra.Quantale

Description

Synopsis

Documentation

class (CompleteJoinSemiLattice a, Multiplicative a) => Quantale a Source #

A quantale is a monoid in complete join-semilattices: a complete join-semilattice equipped with an associative multiplication (*) and unit (one) that distributes over arbitrary joins.

a * joins xs == joins (fmap (a *) xs)
joins xs * a == joins (fmap (* a) xs)
a * bottom == bottom
bottom * a == bottom

Instances

Instances details
Quantale Warshall Source #

Boolean quantale: join is disjunction, multiplication is conjunction.

Instance details

Defined in NumHask.Algebra.Quantale

Quantale Bool Source #

Boolean quantale: join is disjunction, multiplication is conjunction.

Instance details

Defined in NumHask.Algebra.Quantale

(Ord a, Multiplicative a) => Quantale (Set a) Source # 
Instance details

Defined in NumHask.Algebra.Quantale

Quantale (MinPlus Double) Source #

Tropical (min-plus) quantale: join is minimum, bottom is positive infinity, multiplication is addition.

Instance details

Defined in NumHask.Algebra.Quantale

class Quantale a => Residuated a where Source #

If a quantale is also a StarSemiring, then star is the least fixed point, equivalently the join of the geometric series:

star a == joins (iterate (a *) one)

A KleeneAlgebra is therefore the fragment of a (commutative) quantale that only needs these iterative joins, while a quantale admits arbitrary joins.

A residuated quantale: a quantale equipped with the left and right residuals of multiplication.

In any quantale, multiplication by a fixed element preserves joins, so it has both left and right adjoints. These adjoints are the residuals:

a * lres a b <= b
lres a b == joins [ x | a * x <= b ]
rres a b * a <= b
rres a b == joins [ x | x * a <= b ]

The order <= is the one induced by the join-semilattice: x <= y iff x / y == y.

For commutative quantales the two residuals coincide: lres = rres.

Methods

lres :: a -> a -> a Source #

Left residual of multiplication: the greatest x with a * x <= b.

rres :: a -> a -> a Source #

Right residual of multiplication: the greatest x with x * a <= b.

Instances

Instances details
Residuated Warshall Source #

Boolean implication as the residual of conjunction.

>>> lres (Warshall True) (Warshall False)
Warshall False
>>> lres (Warshall False) (Warshall True)
Warshall True
Instance details

Defined in NumHask.Algebra.Quantale

Residuated Bool Source #

Boolean implication as the residual of conjunction.

Instance details

Defined in NumHask.Algebra.Quantale

Methods

lres :: Bool -> Bool -> Bool Source #

rres :: Bool -> Bool -> Bool Source #

Residuated (MinPlus Double) Source #

Tropical residual is truncated subtraction.

>>> getMinPlus (lres (MinPlus 2) (MinPlus 5) :: MinPlus Double)
3.0
>>> getMinPlus (lres (MinPlus 5) (MinPlus 2) :: MinPlus Double)
-3.0
Instance details

Defined in NumHask.Algebra.Quantale

class Quantale a => StarAutonomous a where Source #

A star-autonomous quantale: a quantale with an involutive, order-reversing linear negation.

The negation is an anti-automorphism of the underlying quantale:

neg (neg a) == a
joinLeq a b == joinLeq (neg b) (neg a)
neg (a * b) == neg b * neg a

Multiplicative disjunction (par) and its unit (bot) are the duals of (*) and one:

par a b == neg (neg a * neg b)
bot == neg one

This is the missing connective that turns a quantale into a model of classical linear logic.

Minimal complete definition

neg

Methods

neg :: a -> a Source #

Linear negation.

par :: a -> a -> a Source #

Multiplicative disjunction (par), dual to multiplication.

bot :: a Source #

Unit of par, dual to one.

Instances

Instances details
StarAutonomous Warshall Source #

Boolean negation as complement; par is disjunction and bot is 'Warshall False'.

Instance details

Defined in NumHask.Algebra.Quantale

StarAutonomous Bool Source #

Boolean negation is complement; par is disjunction and bot is False.

Instance details

Defined in NumHask.Algebra.Quantale

Methods

neg :: Bool -> Bool Source #

par :: Bool -> Bool -> Bool Source #

bot :: Bool Source #

StarAutonomous (MinPlus Double) Source #

Tropical linear negation is additive inverse; par is addition and bot is the multiplicative unit 0.

Instance details

Defined in NumHask.Algebra.Quantale

Orphan instances

(Ord a, Multiplicative a) => Multiplicative (Set a) Source #

Power-set quantale of a monoid: join is union, bottom is the empty set, multiplication is pointwise product of subsets, and the unit is the singleton set containing one.

This is the language quantale when the underlying monoid is the free monoid over an alphabet.

Instance details

Methods

(*) :: Set a -> Set a -> Set a Source #

one :: Set a Source #