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.MinMaxAffine

Contents

Description

Lattice complemention of the affine type with explicit min and max when non reducible.

Synopsis

type MinMaxAffine d i = MinMax (Affine d i) Source #

Duration over a numeric type d and unknown indices i

Primitive setters

varDur :: Num d => i -> MinMaxAffine d i Source #

Creates a duration from variable index i

constDur :: d -> MinMaxAffine d i Source #

Creates a duration from a duration constant d

Partial order

compareMinMaxAffine :: (Ord d, Num d, Ord i) => MinMaxAffine d i -> MinMaxAffine d i -> Maybe Ordering Source #

Compares two durations

meetD :: (Num d, Ord d, Ord i) => [MinMaxAffine d i] -> MinMaxAffine d i Source #

Takes the min of two durations

joinD :: (Num d, Ord d, Ord i) => [MinMaxAffine d i] -> MinMaxAffine d i Source #

Takes the max of two durations

Checks constant value and extracts if possible.

getConstDurMaybe :: (Num d, Ord d, Ord i) => MinMaxAffine d i -> Maybe d Source #

Checks if the arguement is actually a defined constant of type d, and send it back if true.

getMaybeMin :: Ord e => (d -> Maybe e) -> MinMax d -> Maybe e Source #

getMaybeMax :: Ord e => (d -> Maybe e) -> Max d -> Maybe e Source #

Related boolean queries

isPosDur :: (Num d, Ord d, Ord i) => MinMaxAffine d i -> Bool Source #

True when provably positive or null

isNegDur :: (Num d, Ord d, Ord i) => MinMaxAffine d i -> Bool Source #

True when provably negative or null

isZeroDur :: (Eq d, Num d, Ord d, Ord i) => MinMaxAffine d i -> Bool Source #

True when provably zero

Update queries

updateMinMaxOnDelay :: (Num d, Ord d, Ord i) => d -> MinMax (Affine d i) -> MinMax (Affine d i) Source #

Replaces every unknown X by X + d

updateMinMaxOnVariable :: (Num d, Ord i, Ord d) => [i] -> MinMax (Affine d i) -> MinMax (Affine d i) Source #

Replaces every unknown Xi by 0 for specified indices.

Basic functions for tests

d :: MinMax (Affine Integer Integer) Source #

An inspiring examples. Observe that 0 == d - d will fail unless some more (LP based) advanced polytopes comparison are put in practice.

d = meetM [varDur 1, varDur 2]

evalMinMaxAffine :: (Ord d, Num d, Ord i) => d -> MinMax (Affine d i) -> MinMax (Affine d i) Source #

evalMaxAffine :: (Ord d, Num d, Ord i) => d -> Max (Affine d i) -> Max (Affine d i) Source #