[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

List of possible algebraic transformations



Hello,
as I'm doing (part of) ooc's optimizers, I want to integrate
so called `algebraic transformations'.

In order to get a complete list of transformations, I include my
current working list for comments.

If anyone knows a transformation not in the list, or if anyone finds
a transformation which is not legal in all cases (or even errors in
the list!), please let me know.


So long
  Juergen Zimmermann




Here the list:
- integer types

  a + 0 = a
  0 + a = a
  a - 0 = a
  0 - a = a
  
  --a = a
  
  a *  1 = a
  1 * a = a
  a * (-1) = -a
  (-1) * a = -a
  
  a * 0 = 0
  0 * a = 0
  
  a DIV 1 = a
  a MOD 1 = 0;
  a DIV (-1) = -a
  a MOD (-1) = 0
  

- real types

  a + 0.0 = a
  0.0 + a = a
  a - 0.0 = a
  0.0 - a = a
  
  --a = a
  
  a * 1.0 = a
  1.0 * a = a
  a * (-1.0) = -a
  (-1.0) * a = -a
  
  a * 0.0 = 0
  0.0 * a = 0
  
  a / 1.0 = a
  a / (-1.0) = -a


- boolean types

  a & a = a
  a OR a = a
  ~~a = a
  
  a & TRUE = a
  TRUE & a = a
  FALSE & a = FALSE
  
  a OR FALSE = a
  FALSE OR a = a
  TRUE OR a = TRUE


- set types

  a - a = {}
  a + a = a
  a * a = a
  a / a = {}
  
  a - {} = a
  a + {} = a
  a * {} = a
  a / {} = ?
  
  {} - a = ?
  {} + a = a
  {} * a = {}
  {} / a = ?
  
  
-string types
  
 str = "" -> str[0] = 0X
 str # "" -> str[0] # 0X
 str >= "" -> TRUE
 str < ""  -> FALSE
 "" <= str -> TRUE
 "" > str  -> FALSE
 
 str ( < | > | # ) str -> FALSE
 str ( <= | >= | = ) str -> TRUE