Simplification rules

This page in 2003
Top  Previous  Next

OAK is able to transform long expressions into shorter ones automatically.  It does so by recognising patterns in formulas, and replacing them by equivalents according to a number of algebraic rules.

The rules are divided into ones that are conservative, that is, always safe to apply, and others that are more aggressive: they are fair substitutions in most circumstances, but can alter the meaning of a formula on other occasions.

CONSERVATIVE RULES

Original expression

Replacement

-x+y

y-x

x-y*x

x*(1-y)

y*x-x

x*(y-1)

a*x-b*x

(a-b)*x

a*x+b*x

(a+b)*x

IF(x>y,x,y)

MAX(x,y)

IF(x>=y,x,y)

MAX(x,y)

IF(x<y,y,x)

MAX(x,y)

IF(x<=y,y,x)

MAX(x,y)

IF(x<y,x,y)

MIN(x,y)

IF(x<=y,x,y)

MIN(x,y)

IF(x>y,y,x)

MIN(x,y)

IF(x>=y,y,x)

MIN(x,y)

x++y

x+y

x--y

x+y

x-+y

x-y

x+-y

x-y

(x+y)-z

x+y-z

x-(y+z)

x-y-z

x-(y-z)

x-y+z

-(x-y)

y-x

-(x+y)

-x-y

x*0

0

0*x

0

(x*y)*z

x*y*z

x*(y*z)

x*y*z

x-(y*z)

x-y*z

x+(y*z)

x+y*z

(x*y)+z

x*y+z

x+(y+z)

x+y+z

(x+y)+z

x+y+z

x+(y-z)

x+y-z

(x-y)+z

x-y+z

AND(NOT(x),NOT(y))

NOT(OR(x,y))

OR(NOT(x),NOT(y))

NOT(AND(x,y))

IF(x,TRUE,FALSE)

(x)

IF(x,1,0)

(x)

IF(x,y,0)

((x)*(y))

IF(x,FALSE,TRUE)

NOT(x)

IF(x,y,y-z)

(y-IF(x,0,z))

IF(x,y-z,y)

(y-IF(x,z,0))

((x))

(x)

aGGRESSIVE RULES

Original expression

Replacement

+x

x

--x

x

x*1

x

1*x

x

x+0

x

0+x

x

x-0

x

0-x

-x

IF(x,-y,-z)

-IF(x,y,z)

-IF(x,0,-y)

IF(x,0,y)

-IF(x,-y,0)

IF(x,y,0)

-IF(x,-y,-z)

IF(x,y,z)

x=TRUE

x

x<>FALSE

x

IF(x,y,y+z)

(y+IF(x,0,z))

IF(x,y+z,y)

(y+IF(x,z,0))

IF(x,y,y-z)

(y-IF(x,0,z))

IF(x,y-z,y)

(y-IF(x,z,0))

IF(w,x*z,y*z)

(IF(w,x,y)*z)

IF(w,z*x,z*y)

(IF(w,x,y)*z)

IF(w,x/z,y/z)

(IF(w,x,y)/z)