Copyright | (c) David Janin, 2015 |
---|---|
License | see the LICENSE file in the distribution |
Maintainer | janin@labri.fr |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Basic (complemented complete) lattice class. This does not intend to be a clever generic class for these lattices.
Documentation
Partially ordered sets
partialCompare :: a -> a -> Maybe Ordering Source #
A partial order relation. Though we do not require Eq a, we should have:
if (Eq a) then (a1 == a2) implies partialCompare a1 a2 == Just EQ
The converse may be false especially when Eq a is a "syntactic" equality as with [a].
pLeq :: a -> a -> Bool Source #
The Boolean version of the partial order.
pOrdEq :: a -> a -> Bool Source #
Derived equality:
pOrdEq a1 a2 = case partialCompare a1 a2 of Just EQ -> True _ -> False
pOrdMin :: [a] -> Maybe a Source #
Gets just the minimum of a list if it exists, nothing otherwise
pOrdMax :: [a] -> Maybe a Source #
Gets just the minimum of a list if it exists, nothing otherwise
pOrdReduceMin :: POrd a => [a] -> [a] Source #
Reduces a list to the antichain of its minimal elements
pOrdReduceMax :: POrd a => [a] -> [a] Source #
Reduces a list to the antichain of its maximal elements
POrd Char Source # | A total order on Char is a partial order |
POrd Int Source # | A total order on Int is a partial order |
POrd Integer Source # | A total order on Integer is a partial order |
POrd Rational Source # | A total order on Rational is a partial order |
POrd () Source # | A total order on () is a partial order |
POrd Void Source # | |
POrd Midi Source # | Definition of porder in midi |
(Eq d, POrd v) => POrd [Atom d iv v] Source # | |
POrd a => POrd (Complete a) Source # | |
POrd a => POrd (Max a) Source # | Derived partial order |
POrd a => POrd (Min a) Source # | Min completion as a pOrd. |
(POrd a, POrd b) => POrd (Either a b) Source # | Derived partial order for Either |
(POrd a, POrd b) => POrd (a, b) Source # | Derived partial order for Product |
(Num d, Ord d, Ord i) => POrd (Affine d i) Source # | Semantical partial order (with positive variables) |
(Num d, Ord d, Ord i) => POrd (Duration d i) Source # | |
(Eq d, POrd v) => POrd (Atom d iv v) Source # | Derived |
(Num d, Eq d, POrd d, POrd v) => POrd (DQ d iv v) Source # | Derived |
(Num d, Eq d, POrd d, POrd v) => POrd (QList d iv v) Source # | Derived |
(Num d, Eq d, POrd d, POrd v) => POrd (Tile d iv v) Source # | Derived |
class POrd d => Lattice d where Source #
Complemented complete lattices
Least upper bound
x pLeq y if, and only if, x = meet [x,y]
We also have, thanks to the instance of POrd [a]
if l1 pLeq l2 then meet l1 pLeq l2
however, the converse may not hold.
Greatest lower bound
x pLeq y if, and only if, y = join [x,y]
Complement, should satisfy the equations
partialCompare x y == partialCompare (compl y) (compl x)
and
join [l] == compl (meet [map compl l]), meet [l] == compl (join [map compl l])
Greatest value
top == meet[]
and
top == compl bot
Least value
bot == join []
and
bot == compl top
Lattice Integer Source # | Without top and bot |
Lattice Rational Source # | Without top and bot |
(Lattice a, Lattice b) => Lattice (Complete (Either a b)) Source # | Derived lattice for Either |
(Num a, Ord a, POrd a) => Lattice (Complete a) Source # | Extending Lattice |
(POrd a, Num a) => Lattice (MinMax a) Source # | Derived Lattice instance |
(Lattice a, Lattice b) => Lattice (a, b) Source # | Derived lattice for Product |
(Num d, Ord d, Ord i) => Lattice (Duration d i) Source # | |
A rather adhoc completion of a partially ordered or an ordered type
Eq a => Eq (Complete a) Source # | |
(Ord a, Fractional a) => Fractional (Complete a) Source # | Extending Fractional (Yet all adhoc) |
(Ord a, Num a) => Num (Complete a) Source # | Extending Num (Yet all adhoc) |
Ord a => Ord (Complete a) Source # | Extending Ord |
Show a => Show (Complete a) Source # | |
POrd a => POrd (Complete a) Source # | |
(Lattice a, Lattice b) => Lattice (Complete (Either a b)) Source # | Derived lattice for Either |
(Num a, Ord a, POrd a) => Lattice (Complete a) Source # | Extending Lattice |