semilattices-0.0.0.0: Semilattices

Safe HaskellNone
LanguageHaskell2010

Data.Semilattice.Tumble

Description

Inverting a Join semilattice gives rise to a Meet semilattice, and vice versa.

Synopsis

Documentation

newtype Tumble a Source #

Tumble gives a Join semilattice for any Meet semilattice and vice versa, Lower bounds for Upper bounds and vice versa, and swaps the bounds of Bounded instances.

Constructors

Tumble 

Fields

Instances

Functor Tumble Source # 

Methods

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

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

Foldable Tumble Source # 

Methods

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

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

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

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

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

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

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

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

toList :: Tumble a -> [a] #

null :: Tumble a -> Bool #

length :: Tumble a -> Int #

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

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

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

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

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

Traversable Tumble Source # 

Methods

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

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

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

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

Bounded a => Bounded (Tumble a) Source # 

Methods

minBound :: Tumble a #

maxBound :: Tumble a #

Enum a => Enum (Tumble a) Source # 

Methods

succ :: Tumble a -> Tumble a #

pred :: Tumble a -> Tumble a #

toEnum :: Int -> Tumble a #

fromEnum :: Tumble a -> Int #

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

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

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

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

Eq a => Eq (Tumble a) Source # 

Methods

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

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

Num a => Num (Tumble a) Source # 

Methods

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

(-) :: Tumble a -> Tumble a -> Tumble a #

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

negate :: Tumble a -> Tumble a #

abs :: Tumble a -> Tumble a #

signum :: Tumble a -> Tumble a #

fromInteger :: Integer -> Tumble a #

Ord a => Ord (Tumble a) Source # 

Methods

compare :: Tumble a -> Tumble a -> Ordering #

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

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

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

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

max :: Tumble a -> Tumble a -> Tumble a #

min :: Tumble a -> Tumble a -> Tumble a #

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

Methods

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

show :: Tumble a -> String #

showList :: [Tumble a] -> ShowS #

Upper a => Lower (Tumble a) Source # 
Meet a => Join (Tumble a) Source # 

Methods

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

Lower a => Upper (Tumble a) Source # 
Join a => Meet (Tumble a) Source # 

Methods

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

Idempotence:

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

Associativity:

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

Commutativity:

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

Identity:

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

Absorption:

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

Idempotence:

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

Associativity:

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

Commutativity:

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

Identity:

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

Absorption:

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

Bounded:

upperBound == (maxBound :: Tumble Bool)

Identity of /\:

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

Absorbing element of \/:

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

Ord:

compare upperBound (a :: Tumble Bool) /= LT

Bounded:

lowerBound == (minBound :: Tumble Bool)

Identity of \/:

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

Absorbing element of /\:

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

Ord:

compare lowerBound (a :: Tumble Bool) /= GT
>>> import Test.QuickCheck
>>> instance Arbitrary a => Arbitrary (Tumble a) where arbitrary = Tumble <$> arbitrary ; shrink (Tumble a) = Tumble <$> shrink a