Programming Language Theory: Difference between revisions

Line 66: Line 66:
====Numerics====
====Numerics====
The integers (or any countably infinite set) can be represented via the [http://en.wikipedia.org/wiki/Church_encoding Church encoding] (or [http://en.wikipedia.org/wiki/Mogensen-Scott_encoding Mogensen-Scott], or others):
The integers (or any countably infinite set) can be represented via the [http://en.wikipedia.org/wiki/Church_encoding Church encoding] (or [http://en.wikipedia.org/wiki/Mogensen-Scott_encoding Mogensen-Scott], or others):
* <tt>0 ≡ λf. λx. x</tt> (referred to as <tt>c<sub>0</sub></tt>)
* <tt>0 ≡ λf. λx. x</tt> (referred to as <tt>c<sub>0</sub></tt>, and ɑ-equivalent to <tt>false</tt> [[Programming_Language_Theory#Logic|below]])
* <tt>1 ≡ λf. λx. f x</tt>
* <tt>1 ≡ λf. λx. f x</tt>
* <tt>2 ≡ λf. λx. f (f x)</tt>
* <tt>2 ≡ λf. λx. f (f x)</tt>