This module implements normalization of FlatCurry programs and expressions. This includes
Furthermore, a compression of expressions is implemented which simplifies expressions by
Author: Björn Peemöller
Version: April 2015
eqNorm
:: Expr -> Expr -> Bool
|
normalizeExpr
:: Expr -> Expr
Normalization of an expression which may contain free variables. |
normalizeFreeExpr
:: Expr -> Expr
Like normalizeExpr , but unbound variables in the expression
retain their indizes.
|
renameFreeExpr
:: Expr -> Expr
Renaming of an expression such that afterwards the variables defined in the expression are numbered from max(1, maxFreeVar + 1) upwards and the variables free in the expression retain their indizes. |
renameExprSubst
:: Expr -> (Expr,[(Int,Int)])
Renaming of an expression such that the variables defined in the expression are numbered from max(1, maxFreeVar + 1) upwards and the variables free in the expression from -1 downwards. |
freshResultant
:: Int -> (((String,String),[Int]),Expr) -> (((String,String),[Int]),Expr)
Create a fresh variant of a resultant by numbering all variables from i
onwards.
|
freshRule
:: Int -> Rule -> Rule
Create a fresh variant of a rule by numbering all variables from i
onwards.
|
renameResultant
:: (((String,String),[Int]),Expr) -> (((String,String),[Int]),Expr)
Renaming of a resultant such that the variables are numbered from 1 onwards, starting with the function's parameters. |
renameFuncDecl
:: FuncDecl -> FuncDecl
Renaming of a function declaration such that the variables are numbered from 1 onwards, starting with the function's parameters. |
eqRen
:: Expr -> Expr -> Bool
Are two expression equal up to a renaming of local variables? |
renameExpr
:: Expr -> Expr
Renaming of an expression such that afterwards the variables defined in the expression are numbered from 1 upwards and the variables free in the expression are numbered from -1 downwards. |
simplifyExpr
:: Expr -> Expr
Simplification of FlatCurry expressions. |
Normalization of an expression which may contain free variables. This includes: 1) Compression of the expression (see below). 1) The order of let-bound variables and free variables is changed to the order of the occurences of the bindings in the expression. 1) Unbound variables are renumbered from -1 downwards, bound variables from 1 upwards in the order of their occurence. |
Like |
Renaming of an expression such that afterwards the variables defined in the expression are numbered from max(1, maxFreeVar + 1) upwards and the variables free in the expression retain their indizes. |
Renaming of an expression such that the variables defined in the expression are numbered from max(1, maxFreeVar + 1) upwards and the variables free in the expression from -1 downwards. The resulting substitution contains the mapping from the former unbound variables to the latter unbound variables. |
Create a fresh variant of a resultant by numbering all variables
from |
Create a fresh variant of a rule by numbering all variables
from |
Renaming of a resultant such that the variables are numbered from 1 onwards, starting with the function's parameters. |
Renaming of a function declaration such that the variables are numbered from 1 onwards, starting with the function's parameters. |
Renaming of an expression such that afterwards the variables defined in the expression are numbered from 1 upwards and the variables free in the expression are numbered from -1 downwards. |
Simplification of FlatCurry expressions. This consists of the following steps:
|