speculate-0.2.0: discovery of properties about Haskell functions

Safe HaskellNone
LanguageHaskell2010

Test.Speculate.Engine

Synopsis

Documentation

vassignments :: Expr -> [Expr] Source #

List all relevant variable assignments in an expresssion. In pseudo-Haskell:

vassignments (0 + x) == [0 + x]
vassignments (0 + 0) == [0 + 0]
vassignments (0 + _) == [0 + x]
vassignments (_ + _) == [x + x, x + y]
vassignments (_ + (_ + ord _)) == [x + (x + ord c), x + (y + ord c)]

You should not use this on expression with already assinged variables (undefined, but currently defined behavior):

vassignments (ii -+- i_) == [ii -+- ii]

mostGeneral :: Expr -> Expr Source #

List the most general assignment of holes in an expression

mostSpecific :: Expr -> Expr Source #

List the most specific assignment of holes in an expression

theoryAndRepresentativesFromAtoms :: Int -> (Expr -> Expr -> Ordering) -> (Expr -> Bool) -> (Expr -> Expr -> Bool) -> [Expr] -> (Thy, [Expr]) Source #

theoryFromAtoms :: Int -> (Expr -> Expr -> Ordering) -> (Expr -> Bool) -> (Expr -> Expr -> Bool) -> [Expr] -> Thy Source #

consider :: (Expr -> Expr -> Bool) -> Expr -> (Thy, [Expr]) -> (Thy, [Expr]) Source #

classesFromSchemas :: Instances -> Int -> Int -> Thy -> [Expr] -> [Class Expr] Source #

conditionalEquivalences :: (Expr -> Expr -> Ordering) -> ((Expr, Expr, Expr) -> Bool) -> (Expr -> Expr -> Expr -> Bool) -> (Expr -> Expr -> Bool) -> Int -> Thy -> [Class Expr] -> [Class Expr] -> Chy Source #

subConsequence :: Thy -> [Class Expr] -> Expr -> Expr -> Expr -> Bool Source #

Is the equation a consequence of substitution? > subConsequence (x == y) (x + y) (x + x) == True > subConsequence (x <= y) (x + y) (x + x) == False -- not sub > subConsequence (abs x == abs y) (abs x) (abs y) == True > subConsequence (abs x == 1) (x + abs x) (20) == False (artificial)

psortBy :: (a -> a -> Bool) -> [a] -> [(a, a)] Source #