tcalculus-1.0.0: A DSL prototype for structured realtime/reactive functional programing

Copyright(c) David Janin, 2016
Licensesee the LICENSE file in the distribution
Maintainerjanin@labri.fr
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Duration.MinMax

Contents

Description

Embbeds Num data types into a complete lattice.

Synopsis

The Min and Max completions

data Min a Source #

Min l represents the least upper bound of elements of l henceforth with Min[] as top element.

The mapping 'a -> Min [a]' is an embedding of a into Min a

Constructors

Min [a] 

Instances

POrd a => Eq (Min a) Source #

Equality instance derived from the partial order

Methods

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

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

(Fractional a, POrd a) => Fractional (MinMax a) Source #

Derived Fractional instance (to be checked)

Methods

(/) :: MinMax a -> MinMax a -> MinMax a #

recip :: MinMax a -> MinMax a #

fromRational :: Rational -> MinMax a #

(Num a, POrd a) => Num (MinMax a) Source #

Derived Num instance (to be checked)

Methods

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

(-) :: MinMax a -> MinMax a -> MinMax a #

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

negate :: MinMax a -> MinMax a #

abs :: MinMax a -> MinMax a #

signum :: MinMax a -> MinMax a #

fromInteger :: Integer -> MinMax a #

POrd d => Ord (Min (Max d)) Source #

Derived total order with possible errors; to be used either with care, or as syntactic sugar..

Methods

compare :: Min (Max d) -> Min (Max d) -> Ordering #

(<) :: Min (Max d) -> Min (Max d) -> Bool #

(<=) :: Min (Max d) -> Min (Max d) -> Bool #

(>) :: Min (Max d) -> Min (Max d) -> Bool #

(>=) :: Min (Max d) -> Min (Max d) -> Bool #

max :: Min (Max d) -> Min (Max d) -> Min (Max d) #

min :: Min (Max d) -> Min (Max d) -> Min (Max d) #

Show a => Show (Min a) Source # 

Methods

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

show :: Min a -> String #

showList :: [Min a] -> ShowS #

POrd a => POrd (Min a) Source #

Min completion as a pOrd.

Methods

partialCompare :: Min a -> Min a -> Maybe Ordering Source #

pLeq :: Min a -> Min a -> Bool Source #

pOrdEq :: Min a -> Min a -> Bool Source #

pOrdMin :: [Min a] -> Maybe (Min a) Source #

pOrdMax :: [Min a] -> Maybe (Min a) Source #

pOrdReduceMin :: [Min a] -> [Min a] Source #

pOrdReduceMax :: [Min a] -> [Min a] Source #

(POrd a, Num a) => Lattice (MinMax a) Source #

Derived Lattice instance

Methods

meet :: [MinMax a] -> MinMax a Source #

join :: [MinMax a] -> MinMax a Source #

compl :: MinMax a -> MinMax a Source #

top :: MinMax a Source #

bot :: MinMax a Source #

data Max a Source #

Min l represents the greates lower bound of elements of l henceforth with Max[] as bottom.

The mapping 'a -> Max [a]' is an embedding of a into Max a

Constructors

Max [a] 

Instances

POrd a => Eq (Max a) Source #

Derived equality instance

Methods

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

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

(Fractional a, POrd a) => Fractional (MinMax a) Source #

Derived Fractional instance (to be checked)

Methods

(/) :: MinMax a -> MinMax a -> MinMax a #

recip :: MinMax a -> MinMax a #

fromRational :: Rational -> MinMax a #

(Num a, POrd a) => Num (MinMax a) Source #

Derived Num instance (to be checked)

Methods

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

(-) :: MinMax a -> MinMax a -> MinMax a #

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

negate :: MinMax a -> MinMax a #

abs :: MinMax a -> MinMax a #

signum :: MinMax a -> MinMax a #

fromInteger :: Integer -> MinMax a #

POrd d => Ord (Min (Max d)) Source #

Derived total order with possible errors; to be used either with care, or as syntactic sugar..

Methods

compare :: Min (Max d) -> Min (Max d) -> Ordering #

(<) :: Min (Max d) -> Min (Max d) -> Bool #

(<=) :: Min (Max d) -> Min (Max d) -> Bool #

(>) :: Min (Max d) -> Min (Max d) -> Bool #

(>=) :: Min (Max d) -> Min (Max d) -> Bool #

max :: Min (Max d) -> Min (Max d) -> Min (Max d) #

min :: Min (Max d) -> Min (Max d) -> Min (Max d) #

Show a => Show (Max a) Source # 

Methods

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

show :: Max a -> String #

showList :: [Max a] -> ShowS #

POrd a => POrd (Max a) Source #

Derived partial order

Methods

partialCompare :: Max a -> Max a -> Maybe Ordering Source #

pLeq :: Max a -> Max a -> Bool Source #

pOrdEq :: Max a -> Max a -> Bool Source #

pOrdMin :: [Max a] -> Maybe (Max a) Source #

pOrdMax :: [Max a] -> Maybe (Max a) Source #

pOrdReduceMin :: [Max a] -> [Max a] Source #

pOrdReduceMax :: [Max a] -> [Max a] Source #

(POrd a, Num a) => Lattice (MinMax a) Source #

Derived Lattice instance

Methods

meet :: [MinMax a] -> MinMax a Source #

join :: [MinMax a] -> MinMax a Source #

compl :: MinMax a -> MinMax a Source #

top :: MinMax a Source #

bot :: MinMax a Source #

The Min completion

insertMin :: POrd a => a -> Min a -> Min a Source #

Inserts an element x into a list l of minimal elements if l is an antichain then so is insertMin x l

reduceMin :: POrd a => Min a -> Min a Source #

Reduces a Min list by removing greater comparable elements. The resulting list is an antichain.

minCovered :: POrd a => Min a -> a -> Bool Source #

Equals True when one element of its first arguement is smaller than or equal to its second arguement. False otherwise

pMinLeq :: POrd a => Min a -> Min a -> Bool Source #

Induced partial order. The boolean pMinLeq m1 m2 is True when every element of m2 is greater than or equal to an element of m1, it is False otherwise

compareMin :: POrd a => Min a -> Min a -> Maybe Ordering Source #

For internal use (needed ?)

toMin :: a -> Min a Source #

Natural embedding with the property that under (POrd a) hypothesis,

partialCompare a b == partialCompare (toMin a) (toMin b)

that is to say, toMin is a partial order embeding of a into Min a

The Max completion

insertMax :: POrd a => a -> Max a -> Max a Source #

Inserts an element x into a list l of maximal elements; if l is an antichain then so is insertMax x l.

reduceMax :: POrd a => Max a -> Max a Source #

Reduces a Max list by removing smaller comparable elements. The resulting list is an antichain.

maxCovered :: POrd a => Max a -> a -> Bool Source #

Equals True when one element of its first arguement is greater than or equal to its second arguement. False otherwise

pMaxLeq :: POrd a => Max a -> Max a -> Bool Source #

Induced partial order. The boolean pMaxLeq m1 m2 is True when every element of m1 is smaller than or equal to an element of m1, it is False otherwise

compareMax :: POrd a => Max a -> Max a -> Maybe Ordering Source #

For internal use (needed ?)

toMax :: a -> Max a Source #

Natural embedding with the property that under (POrd a) hypothesis,

partialCompare a b == partialCompare (toMax a) (toMax b)

that is to say, toMax is a partial order embeding of a into Max a

The MinMax and MaxMin completion -

type MinMax a = Min (Max a) Source #

MinMax completion

type MaxMin a = Max (Min a) Source #

MaxMin completion

MaxMin a and MinMax a are both equiped with a derived order relation such that : * both MinMax and MaxMin are (isomorphic) lattices * both a -> Min [Max a] and a -> Max [Min a] are partial order embeddings

Incidentaly: Max[] and Max [Min []] are the least and the greatest element of MaxMin, and Min[] and Min [Max []] are the least and the greatest element in MinMax

meetMin :: POrd a => Min a -> Min a -> Min a Source #

The meet in Min completion

joinMin :: POrd a => MinMax a -> MinMax a -> MinMax a Source #

The join in MinMax completion (with exponential blow up)

meetMinL :: POrd a => [Min a] -> Min a Source #

Corresponding list meet

joinMinL :: POrd a => [MinMax a] -> Min (Max a) Source #

Corresponding list join

joinMax :: POrd a => Max a -> Max a -> Max a Source #

The join in Max completion

meetMax :: POrd a => MaxMin a -> MaxMin a -> MaxMin a Source #

The meet in MaxMin completion (with exponential blow up)

meetMaxL :: POrd a => [MaxMin a] -> Max (Min a) Source #

Corresponding list meet

joinMaxL :: POrd a => [Max a] -> Max a Source #

Corresponding list join

maxMin2MinMax :: POrd a => MaxMin a -> MinMax a Source #

Emebedding of MaxMin into MinMax (warning : exponential blow up)

minMax2MaxMin :: POrd a => MinMax a -> MaxMin a Source #

Emebedding of MinMax into MaxMin (warning : exponential blow up)

Functor like functions

fmap1Min :: POrd a => (a -> a) -> Min a -> Min a Source #

Unary (covariant) lift for Min

fmap1Max :: POrd a => (a -> a) -> Max a -> Max a Source #

Unary (covariant) lift for Max

fmap1MinMax :: POrd a => (a -> a) -> MinMax a -> MinMax a Source #

Unary (covariant) lift for MinMax

fmap1MaxMin :: POrd a => (a -> a) -> MaxMin a -> MaxMin a Source #

Unary (covariant) lift for MaxMin

fmap2Min :: POrd a => (a -> a -> a) -> Min a -> Min a -> Min a Source #

Binary lift for Min

fmap2Max :: POrd a => (a -> a -> a) -> Max a -> Max a -> Max a Source #

Binary lift for Max

fmap2MinMax :: POrd a => (a -> a -> a) -> MinMax a -> MinMax a -> MinMax a Source #

Binary lift for MinMax

fmap2MaxMin :: POrd a => (a -> a -> a) -> MaxMin a -> MaxMin a -> MaxMin a Source #

Binary lift for MaxMin

fmapRMin :: POrd a => (a -> b) -> Min a -> Max b Source #

Unary contravariant lift for Min

fmapRMax :: POrd a => (a -> b) -> Max a -> Min b Source #

Unary contravariant lift for Max

fmapRMinMax :: POrd a => (a -> a) -> MinMax a -> MaxMin a Source #

Unary contravariant lift for MinMax

fmapRMaxMin :: POrd a => (a -> a) -> MaxMin a -> MinMax a Source #

Unary contravariant lift for MaxMin

meetM :: POrd a => [MinMax a] -> MinMax a Source #

for exports (to be cleaned)

joinM :: POrd a => [MinMax a] -> MinMax a Source #

for exports (to be cleaned)

justMM :: a -> Min (Max a) Source #