Difference between revisions of "Alpha conversion"

From HaskellWiki
Jump to navigation Jump to search
(Can somebody word this better?)
 
(My 2 cents on wording.)
Line 1: Line 1:
An ''alpha conversion'' (also written ''α conversion'') essentially involves renaming variables.
+
An ''alpha conversion'' (also written ''α conversion'') is a renaming variables.
   
 
For example, suppose we have an expression such as
 
For example, suppose we have an expression such as
Line 11: Line 11:
 
This is clearly the same function, even though it uses different variable names. This process of renaming variables is ''alpha conversion''.
 
This is clearly the same function, even though it uses different variable names. This process of renaming variables is ''alpha conversion''.
   
(Note that alpha conversion is not as simple as it first seems. For example, if we rename <hask>x</hask> to <hask>y</hask> in <hask>\x -> x + y</hask> then we end up with <hask>\y -> y + y</hask>, which is radically different!)
+
Note that alpha conversion is not as simple as it first seems. We must be careful to avoid ''name capture''. For example, if we rename <hask>x</hask> to <hask>y</hask> in <hask>\x -> x + y</hask> then we end up with <hask>\y -> y + y</hask>, which is not the same function!
   
 
[[Category:Glossary]]
 
[[Category:Glossary]]
  +
  +
Also see [[Lambda calculus]] and the [http://en.wikipedia.org/wiki/Lambda_calculus wikipedia lambda calculus article].

Revision as of 22:15, 29 January 2007

An alpha conversion (also written α conversion) is a renaming variables.

For example, suppose we have an expression such as

\x y -> 2*x*x + y

and we change this to

\a b -> 2*a*a + b

This is clearly the same function, even though it uses different variable names. This process of renaming variables is alpha conversion.

Note that alpha conversion is not as simple as it first seems. We must be careful to avoid name capture. For example, if we rename x to y in \x -> x + y then we end up with \y -> y + y, which is not the same function!

Also see Lambda calculus and the wikipedia lambda calculus article.