-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | common properties -- -- Library of predicates for property testing. @package property @version 0.0.1 module Test.Property.Util type Rel r = r -> r -> Bool xor :: Bool -> Bool -> Bool xor3 :: Bool -> Bool -> Bool -> Bool (==>) :: Bool -> Bool -> Bool infixr 0 ==> iff :: Bool -> Bool -> Bool (<==>) :: Bool -> Bool -> Bool infixr 1 <==> module Test.Property.Relation.Transitive -- | <math> -- -- For example, "is ancestor of" is a transitive relation, while "is -- parent of" is not. transitive :: (r -> r -> Bool) -> r -> r -> r -> Bool -- | <math> -- -- For example, = is an right Euclidean relation because if x = -- y and x = z then y = z. euclidean :: (r -> r -> Bool) -> r -> r -> r -> Bool -- | <math> -- -- For example, = is a left Euclidean relation because if x = -- y and x = z then y = z. euclidean' :: (r -> r -> Bool) -> r -> r -> r -> Bool -- | See https://en.wikipedia.org/wiki/Binary_relation#Properties. -- -- Note that these properties do not exhaust all of the possibilities. -- -- As an example over the natural numbers, the relation <math> -- defined by <math> is neither symmetric nor antisymmetric, let -- alone asymmetric. module Test.Property.Relation.Symmetric -- | <math> -- -- For example, "is a blood relative of" is a symmetric relation, because -- A is a blood relative of B if and only if B is a blood relative of A. symmetric :: (r -> r -> Bool) -> r -> r -> Bool -- | <math> -- -- For example, > is an asymmetric relation, but ≥ is not. -- -- A relation is asymmetric if and only if it is both antisymmetric and -- irreflexive. asymmetric :: (r -> r -> Bool) -> r -> r -> Bool -- | <math> -- -- For example, ≥ is an antisymmetric relation; so is >, but vacuously -- (the condition in the definition is always false). antisymmetric :: Eq r => (r -> r -> Bool) -> r -> r -> Bool -- | <math> antisymmetric_on :: (r -> r -> Bool) -> (r -> r -> Bool) -> r -> r -> Bool -- | See https://en.wikipedia.org/wiki/Binary_relation#Properties. -- -- Note that these properties do not exhaust all of the possibilities. -- -- For example, the relation <math> is neither irreflexive, nor -- coreflexive, nor reflexive, since it contains the pairs <math> -- and <math>, but not <math>. -- -- The latter two facts also rule out quasi-reflexivity. module Test.Property.Relation.Reflexive -- | <math> -- -- For example, ≥ is a reflexive relation but > is not. reflexive :: (r -> r -> Bool) -> r -> Bool -- | <math> -- -- For example, > is an irreflexive relation, but ≥ is not. irreflexive :: (r -> r -> Bool) -> r -> Bool -- | <math> -- -- For example, the relation over the integers in which each odd number -- is related to itself is a coreflexive relation. The equality relation -- is the only example of a relation that is both reflexive and -- coreflexive, and any coreflexive relation is a subset of the equality -- relation. coreflexive :: Eq r => (r -> r -> Bool) -> r -> r -> Bool -- | <math> coreflexive_on :: (r -> r -> Bool) -> (r -> r -> Bool) -> r -> r -> Bool -- | <math> quasireflexive :: (r -> r -> Bool) -> r -> r -> Bool -- | See https://en.wikipedia.org/wiki/Connex_relation. module Test.Property.Relation.Connex -- | <math> -- -- For example, ≥ is a connex relation, while 'divides evenly' is not. -- -- A connex relation cannot be symmetric, except for the universal -- relation. connex :: (r -> r -> Bool) -> r -> r -> Bool -- | <math> -- -- A binary relation is semiconnex if it relates all pairs of _distinct_ -- elements in some way. -- -- A relation is connex if and only if it is semiconnex and reflexive. semiconnex :: Eq r => (r -> r -> Bool) -> r -> r -> Bool -- | <math> semiconnex_on :: (r -> r -> Bool) -> (r -> r -> Bool) -> r -> r -> Bool -- | <math> -- -- Note that trichotomous (>) should hold for any -- Ord instance. trichotomous :: Eq r => (r -> r -> Bool) -> r -> r -> Bool -- | <math> -- -- In other words, exactly one of <math>, <math>, or -- <math> holds. -- -- For example, > is a trichotomous relation, while ≥ is not. trichotomous_on :: (r -> r -> Bool) -> (r -> r -> Bool) -> r -> r -> Bool module Test.Property.Relation module Test.Property.Operation.Neutral -- | <math> -- -- Right neutrality of a unit u with respect to an operator -- #. -- -- For example, an implementation of Monoid must satisfy -- neutral (<>) mempty neutral :: Eq r => (r -> r -> r) -> r -> r -> Bool -- | <math> -- -- Left neutrality of a unit u with respect to an operator -- #. -- -- For example, an implementation of Monoid must satisfy -- neutral (<>) mempty neutral' :: Eq r => (r -> r -> r) -> r -> r -> Bool neutral_on :: Rel r -> (r -> r -> r) -> r -> r -> Bool neutral_on' :: Rel r -> (r -> r -> r) -> r -> r -> Bool module Test.Property.Operation.Distributive -- | <math> distributive :: Eq r => (r -> r -> r) -> (r -> r -> r) -> r -> r -> r -> Bool -- | <math> distributive' :: Eq r => (r -> r -> r) -> (r -> r -> r) -> r -> r -> r -> Bool distributive_on :: Rel r -> (r -> r -> r) -> (r -> r -> r) -> r -> r -> r -> Bool distributive_on' :: Rel r -> (r -> r -> r) -> (r -> r -> r) -> r -> r -> r -> Bool module Test.Property.Operation.Commutative -- | <math> commutative :: Eq r => (r -> r -> r) -> r -> r -> Bool -- | <math> commutative_on :: Rel r -> (r -> r -> r) -> r -> r -> Bool module Test.Property.Operation.Associative -- | <math> associative :: Eq r => (r -> r -> r) -> r -> r -> r -> Bool -- | <math> associative_on :: Rel r -> (r -> r -> r) -> r -> r -> r -> Bool module Test.Property.Operation.Annihilative -- | <math> -- -- Right annihilativity of an element u with respect to an -- operator #. -- -- For example, False is a right annihilative element of -- ||. annihilative :: Eq r => (r -> r -> r) -> r -> r -> Bool -- | <math> -- -- Left annihilativity of an element u with respect to an operator -- #. -- -- For example, Nothing is a right annihilative element of -- *>. annihilative' :: Eq r => (r -> r -> r) -> r -> r -> Bool annihilative_on :: Rel r -> (r -> r -> r) -> r -> r -> Bool annihilative_on' :: Rel r -> (r -> r -> r) -> r -> r -> Bool module Test.Property.Operation module Test.Property.Function.Monotone monotone :: Ord r => (r -> r) -> r -> r -> Bool -- | <math> monotone_on :: Rel r -> Rel s -> (r -> s) -> r -> r -> Bool antitone :: Ord r => (r -> r) -> r -> r -> Bool -- | <math> antitone_on :: Rel r -> Rel s -> (r -> s) -> r -> r -> Bool module Test.Property.Function.Invertible -- | <math> -- -- For example, a Galois connection is defined by adjoint_on -- (<=). adjoint_on :: Rel r -> Rel s -> (s -> r) -> (r -> s) -> s -> r -> Bool -- | <math> invertible :: Eq r => (r -> s) -> (s -> r) -> r -> Bool -- | <math> invertible_on :: Rel s -> (s -> r) -> (r -> s) -> s -> Bool module Test.Property.Function.Injective -- | <math> injective :: Eq r => (r -> r) -> r -> r -> Bool -- | <math> injective_on :: Rel r -> (r -> r) -> r -> r -> Bool module Test.Property.Function.Idempotent -- | <math> projective :: Eq r => (r -> r) -> (r -> r) -> r -> Bool -- | <math> projective_on :: Rel s -> (r -> s) -> (s -> s) -> r -> Bool -- | <math> idempotent :: Eq r => (r -> r) -> r -> Bool -- | <math> idempotent_on :: Rel r -> (r -> r) -> r -> Bool idempotent_k :: Eq r => Natural -> (r -> r) -> r -> Bool module Test.Property.Function.Equivalent -- | <math> equivalent :: Eq r => (r -> r) -> (r -> r) -> r -> Bool -- | <math> equivalent_on :: Rel r -> (r -> r) -> (r -> r) -> r -> Bool module Test.Property.Function module Test.Property