semilattices-0.0.0.1: Semilattices

Safe HaskellNone
LanguageHaskell2010

Data.Semilattice.Meet

Description

Join semilattices, related to Lower and Upper.

Synopsis

Documentation

class Meet s where Source #

A meet semilattice is an idempotent commutative semigroup.

Minimal complete definition

(/\)

Methods

(/\) :: s -> s -> s infixr 7 Source #

The meet operation.

Laws:

Idempotence:

x /\ x = x

Associativity:

a /\ (b /\ c) = (a /\ b) /\ c

Commutativity:

a /\ b = b /\ a

Additionally, if s has an Upper bound, then upperBound must be its identity:

upperBound /\ a = a
a /\ upperBound = a

If s has a Lower bound, then lowerBound must be its absorbing element:

lowerBound /\ a = lowerBound
a /\ lowerBound = lowerBound

Instances

Meet Bool Source #

Boolean conjunction forms a semilattice.

Idempotence:

x /\ x == (x :: Bool)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: Bool)

Commutativity:

a /\ b == b /\ (a :: Bool)

Identity:

upperBound /\ a == (a :: Bool)

Absorption:

lowerBound /\ a == (lowerBound :: Bool)

Methods

(/\) :: Bool -> Bool -> Bool Source #

Meet Ordering Source #

Orderings form a semilattice.

Idempotence:

x /\ x == (x :: Ordering)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: Ordering)

Commutativity:

a /\ b == b /\ (a :: Ordering)

Identity:

upperBound /\ a == (a :: Ordering)

Absorption:

lowerBound /\ a == (lowerBound :: Ordering)
Meet () Source # 

Methods

(/\) :: () -> () -> () Source #

Meet IntSet Source #

IntSet intersection forms a semilattice.

Idempotence:

x /\ x == (x :: IntSet)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: IntSet)

Commutativity:

a /\ b == b /\ (a :: IntSet)

Absorption:

lowerBound /\ a == (lowerBound :: IntSet)

Methods

(/\) :: IntSet -> IntSet -> IntSet Source #

Ord a => Meet (Min a) Source #

The greatest lowerBound bound gives rise to a meet semilattice.

Idempotence:

x /\ x == (x :: Min Int)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: Min Int)

Commutativity:

a /\ b == b /\ (a :: Min Int)

Identity:

upperBound /\ a == (a :: Min Int)

Absorption:

lowerBound /\ a == (lowerBound :: Min Int)

Methods

(/\) :: Min a -> Min a -> Min a Source #

Meet a => Meet (IntMap a) Source #

IntMap union with Meetable values forms a semilattice.

Idempotence:

x /\ x == (x :: IntMap (Set Char))

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: IntMap (Set Char))

Commutativity:

a /\ b == b /\ (a :: IntMap (Set Char))

Absorption:

lowerBound /\ a == (lowerBound :: IntMap (Set Char))

Methods

(/\) :: IntMap a -> IntMap a -> IntMap a Source #

Ord a => Meet (Set a) Source #

Set intersection forms a semilattice.

Idempotence:

x /\ x == (x :: Set Char)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: Set Char)

Commutativity:

a /\ b == b /\ (a :: Set Char)

Absorption:

lowerBound /\ a == (lowerBound :: Set Char)

Methods

(/\) :: Set a -> Set a -> Set a Source #

(Eq a, Hashable a) => Meet (HashSet a) Source #

HashSet intersection forms a semilattice.

Idempotence:

x /\ x == (x :: HashSet Char)

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: HashSet Char)

Commutativity:

a /\ b == b /\ (a :: HashSet Char)

Absorption:

lowerBound /\ a == (lowerBound :: HashSet Char)

Methods

(/\) :: HashSet a -> HashSet a -> HashSet a Source #

Meet a => Meet (GreaterThan a) Source # 
Meet a => Meet (Meeting a) Source # 

Methods

(/\) :: Meeting a -> Meeting a -> Meeting a Source #

Join a => Meet (Tumble a) Source # 

Methods

(/\) :: Tumble a -> Tumble a -> Tumble a Source #

Ord a => Meet (Order a) Source #

Total Orderings give rise to a meet semilattice satisfying:

Idempotence:

Order x /\ Order x == Order x

Associativity:

Order a /\ (Order b /\ Order c) == (Order a /\ Order b) /\ Order c

Commutativity:

Order a /\ Order b == Order b /\ Order a

Identity:

upperBound /\ Order a == Order (a :: Int)

Absorption:

lowerBound /\ Order a == (lowerBound :: Order Int)

Distributivity:

Order a /\ (Order b \/ Order c) == Order a /\ Order b \/ Order a /\ Order c

Methods

(/\) :: Order a -> Order a -> Order a Source #

Meet b => Meet (a -> b) Source #

Functions with semilattice codomains form a semilattice.

Idempotence:

\ (Fn x) -> x /\ x ~= (x :: Int -> Bool)

Associativity:

\ (Fn a) (Fn b) (Fn c) -> a /\ (b /\ c) ~= (a /\ b) /\ (c :: Int -> Bool)

Commutativity:

\ (Fn a) (Fn b) -> a /\ b ~= b /\ (a :: Int -> Bool)

Identity:

\ (Fn a) -> upperBound /\ a ~= (a :: Int -> Bool)

Absorption:

\ (Fn a) -> lowerBound /\ a ~= (lowerBound :: Int -> Bool)

Methods

(/\) :: (a -> b) -> (a -> b) -> a -> b Source #

(Ord k, Meet a) => Meet (Map k a) Source #

Map union with Meetable values forms a semilattice.

Idempotence:

x /\ x == (x :: Map Char (Set Char))

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: Map Char (Set Char))

Commutativity:

a /\ b == b /\ (a :: Map Char (Set Char))

Absorption:

lowerBound /\ a == (lowerBound :: Map Char (Set Char))

Methods

(/\) :: Map k a -> Map k a -> Map k a Source #

(Eq k, Hashable k, Meet a) => Meet (HashMap k a) Source #

HashMap union with Meetable values forms a semilattice.

Idempotence:

x /\ x == (x :: HashMap Char (Set Char))

Associativity:

a /\ (b /\ c) == (a /\ b) /\ (c :: HashMap Char (Set Char))

Commutativity:

a /\ b == b /\ (a :: HashMap Char (Set Char))

Absorption:

lowerBound /\ a == (lowerBound :: HashMap Char (Set Char))

Methods

(/\) :: HashMap k a -> HashMap k a -> HashMap k a Source #

newtype Meeting a Source #

A Semigroup for any Meet semilattice.

If the semilattice has an Upper bound, there is additionally a Monoid instance.

Constructors

Meeting 

Fields

Instances

Functor Meeting Source # 

Methods

fmap :: (a -> b) -> Meeting a -> Meeting b #

(<$) :: a -> Meeting b -> Meeting a #

Foldable Meeting Source # 

Methods

fold :: Monoid m => Meeting m -> m #

foldMap :: Monoid m => (a -> m) -> Meeting a -> m #

foldr :: (a -> b -> b) -> b -> Meeting a -> b #

foldr' :: (a -> b -> b) -> b -> Meeting a -> b #

foldl :: (b -> a -> b) -> b -> Meeting a -> b #

foldl' :: (b -> a -> b) -> b -> Meeting a -> b #

foldr1 :: (a -> a -> a) -> Meeting a -> a #

foldl1 :: (a -> a -> a) -> Meeting a -> a #

toList :: Meeting a -> [a] #

null :: Meeting a -> Bool #

length :: Meeting a -> Int #

elem :: Eq a => a -> Meeting a -> Bool #

maximum :: Ord a => Meeting a -> a #

minimum :: Ord a => Meeting a -> a #

sum :: Num a => Meeting a -> a #

product :: Num a => Meeting a -> a #

Traversable Meeting Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Meeting a -> f (Meeting b) #

sequenceA :: Applicative f => Meeting (f a) -> f (Meeting a) #

mapM :: Monad m => (a -> m b) -> Meeting a -> m (Meeting b) #

sequence :: Monad m => Meeting (m a) -> m (Meeting a) #

Bounded a => Bounded (Meeting a) Source # 
Enum a => Enum (Meeting a) Source # 

Methods

succ :: Meeting a -> Meeting a #

pred :: Meeting a -> Meeting a #

toEnum :: Int -> Meeting a #

fromEnum :: Meeting a -> Int #

enumFrom :: Meeting a -> [Meeting a] #

enumFromThen :: Meeting a -> Meeting a -> [Meeting a] #

enumFromTo :: Meeting a -> Meeting a -> [Meeting a] #

enumFromThenTo :: Meeting a -> Meeting a -> Meeting a -> [Meeting a] #

Eq a => Eq (Meeting a) Source # 

Methods

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

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

Num a => Num (Meeting a) Source # 

Methods

(+) :: Meeting a -> Meeting a -> Meeting a #

(-) :: Meeting a -> Meeting a -> Meeting a #

(*) :: Meeting a -> Meeting a -> Meeting a #

negate :: Meeting a -> Meeting a #

abs :: Meeting a -> Meeting a #

signum :: Meeting a -> Meeting a #

fromInteger :: Integer -> Meeting a #

Ord a => Ord (Meeting a) Source # 

Methods

compare :: Meeting a -> Meeting a -> Ordering #

(<) :: Meeting a -> Meeting a -> Bool #

(<=) :: Meeting a -> Meeting a -> Bool #

(>) :: Meeting a -> Meeting a -> Bool #

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

max :: Meeting a -> Meeting a -> Meeting a #

min :: Meeting a -> Meeting a -> Meeting a #

Read a => Read (Meeting a) Source # 
Show a => Show (Meeting a) Source # 

Methods

showsPrec :: Int -> Meeting a -> ShowS #

show :: Meeting a -> String #

showList :: [Meeting a] -> ShowS #

Meet a => Semigroup (Meeting a) Source #

Meeting <> is associative.

Meeting a <> (Meeting b <> Meeting c) == (Meeting a <> Meeting b) <> Meeting (c :: IntSet)

Methods

(<>) :: Meeting a -> Meeting a -> Meeting a #

sconcat :: NonEmpty (Meeting a) -> Meeting a #

stimes :: Integral b => b -> Meeting a -> Meeting a #

(Upper a, Meet a) => Monoid (Meeting a) Source #

Meeting mempty is the left- and right-identity.

let (l, r) = (mappend mempty (Meeting x), mappend (Meeting x) mempty) in l == Meeting x && r == Meeting (x :: Bool)

Methods

mempty :: Meeting a #

mappend :: Meeting a -> Meeting a -> Meeting a #

mconcat :: [Meeting a] -> Meeting a #

Upper a => Upper (Meeting a) Source # 
Meet a => Meet (Meeting a) Source # 

Methods

(/\) :: Meeting a -> Meeting a -> Meeting a Source #

newtype GreaterThan a Source #

Meet semilattices give rise to a partial Ordering.

Constructors

GreaterThan 

Fields

Instances

Functor GreaterThan Source # 

Methods

fmap :: (a -> b) -> GreaterThan a -> GreaterThan b #

(<$) :: a -> GreaterThan b -> GreaterThan a #

Foldable GreaterThan Source # 

Methods

fold :: Monoid m => GreaterThan m -> m #

foldMap :: Monoid m => (a -> m) -> GreaterThan a -> m #

foldr :: (a -> b -> b) -> b -> GreaterThan a -> b #

foldr' :: (a -> b -> b) -> b -> GreaterThan a -> b #

foldl :: (b -> a -> b) -> b -> GreaterThan a -> b #

foldl' :: (b -> a -> b) -> b -> GreaterThan a -> b #

foldr1 :: (a -> a -> a) -> GreaterThan a -> a #

foldl1 :: (a -> a -> a) -> GreaterThan a -> a #

toList :: GreaterThan a -> [a] #

null :: GreaterThan a -> Bool #

length :: GreaterThan a -> Int #

elem :: Eq a => a -> GreaterThan a -> Bool #

maximum :: Ord a => GreaterThan a -> a #

minimum :: Ord a => GreaterThan a -> a #

sum :: Num a => GreaterThan a -> a #

product :: Num a => GreaterThan a -> a #

Traversable GreaterThan Source # 

Methods

traverse :: Applicative f => (a -> f b) -> GreaterThan a -> f (GreaterThan b) #

sequenceA :: Applicative f => GreaterThan (f a) -> f (GreaterThan a) #

mapM :: Monad m => (a -> m b) -> GreaterThan a -> m (GreaterThan b) #

sequence :: Monad m => GreaterThan (m a) -> m (GreaterThan a) #

Enum a => Enum (GreaterThan a) Source # 
Eq a => Eq (GreaterThan a) Source # 
Num a => Num (GreaterThan a) Source # 
(Eq a, Meet a) => Ord (GreaterThan a) Source # 
Read a => Read (GreaterThan a) Source # 
Show a => Show (GreaterThan a) Source # 
Meet a => Meet (GreaterThan a) Source #