This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
normalize [2017/04/19 14:14] 127.0.0.1 external edit |
normalize [2017/11/14 07:50] (current) waruna [Example] |
||
---|---|---|---|
Line 10: | Line 10: | ||
====Normalization Rules==== | ====Normalization Rules==== | ||
Normalize takes a program and applies a set of normalization rules on it. Some of the basic rules are shown below: | Normalize takes a program and applies a set of normalization rules on it. Some of the basic rules are shown below: | ||
- | - < | + | - $e.f \Rightarrow e, $ if $f(z)=z$ |
- | - < | + | - $(e_{1} \oplus e_{2}).f \Rightarrow (e_{1}.f) \oplus (e_{2}.f)$ |
- | - < | + | - $(D: |
- | - < | + | - $e_{1}\oplus (D: e_{2}) \Rightarrow D:(e_{1} \oplus e_{2})$ |
- | - < | + | - $(e. f_{1}). f_{2} \Rightarrow e . f$, where $f = f_{1} o f_{2}$ |
- | - < | + | - $D_{1}: |
- | - < | + | - $(D:e). f \Rightarrow D':e$, where $D' = f^{-1}(D)$ |
======== | ======== | ||
====Example==== | ====Example==== | ||
Line 41: | Line 41: | ||
* In the computation for C, expression A[i] is equivalent to A.(i %%->%% i), f is an identity function, rule number one is satisfied. So A.(i %%->%% i) %%=>%% A. | * In the computation for C, expression A[i] is equivalent to A.(i %%->%% i), f is an identity function, rule number one is satisfied. So A.(i %%->%% i) %%=>%% A. | ||
* In the computation for C, expression {i| 0 %%<=%% i < N}: ({i|0 %%<=%% i < 2N}:A[i]) matches rule number 6, where D1 = {i| 0 %%<=%% i < N}, D2={i|0 %%<=%% i < 2N}. D=D1 ∩ D1 ={i|0 %%<=%% i < N}, the expression is changed to {i|0 %%<=%% i < N}:A. | * In the computation for C, expression {i| 0 %%<=%% i < N}: ({i|0 %%<=%% i < 2N}:A[i]) matches rule number 6, where D1 = {i| 0 %%<=%% i < N}, D2={i|0 %%<=%% i < 2N}. D=D1 ∩ D1 ={i|0 %%<=%% i < N}, the expression is changed to {i|0 %%<=%% i < N}:A. | ||
- | * In the computation for D, expression (i, j %%->%% j, i)@({|0 %%<=%% i < N\}:A[i]) matches rule number 7, where D = {i,j |0 %%<=%% i < N }, f=(i, j %%->%% j, i). D' | + | * In the computation for D, expression (i, j %%->%% j, i)@({|0 %%<=%% i < N}:A[i]) matches rule number 7, where D = {i,j |0 %%<=%% i < N }, f=(i, j %%->%% j, i). D' |
The result for the above program after normalization is: | The result for the above program after normalization is: |