Copyright | (c) Maciej Bendkowski 2016 |
---|---|
License | BSD3 |
Maintainer | maciej.bendkowski@tcs.uj.edu.pl |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Lambda terms in the de Bruijn notation where instead of variables, we use natural indices encoded as a sequence of successors of zero.
Each index captures the distance to its binding lambda - Z corresponds to a variable bound by the first lambda abstraction on its way to the term root. The successor S increases the distance of its argument by one. If an index points to a lambda abstraction outside of the term, then that index represents a free variable in the term. Such a representation for lambda terms avoids using explicit variable names and hence eliminates the use of alpha-conversion.
Lambda terms
Lambda terms with de Bruijn indices.
:: Num a | |
=> Model a | Size notion used in the computations. |
-> Lambda | The considered lambda term. |
-> a | The integer size of the lambda term. |
Computes the size of the given lambda term.
:: Num a | |
=> Model a | Size notion used in the computations. |
-> Index | The considered de Bruijn index. |
-> a | The integer size of the lambda term. |
Computes the size of the given de Bruijn index.