Maintainer bastiaan.heeren@ou.nl provisional portable (depends on ghc) None Haskell98

Recognize.Expr.Normalform

Description

In this module we have defined several functions that produce some kind of normal form for an expression Not all functions are used and they also often do not normalize as far as we would like. Note that not all normalization functions defined in this project are defined in this module. Sometimes specific normalizing functions are defined for a tool.

Synopsis

# Documentation

Note that the Ord instance for Expr is derived. Because of this: 1:+:1 < 1:-:1 Therefore, comparison of Expr is not reliable when performed after nf. since 3/2 cannot be normalized any further (but is bigger then 2)

nf4 :: Int -> Expr -> Expr Source #

Simplified with a certain precision if no variable present otherwise calls nf

Normalform for associativity

normal form for commutativity +/*

Round a double with a specified precision

Unlike the round function in prelude, this function will round up if the decimal is >=5 and otherwise down