# Chaitin's construction

### From HaskellWiki

EndreyMark (Talk | contribs) (Not so important details come to a new Chaitin's construction/Parser page. Parsers are not necessary here, a good generator is enough) |
EndreyMark (Talk | contribs) (Also other details go to the separate Chaitin's construction/Parser page) |
||

Line 27: | Line 27: | ||

[[/Parser|Here is a parser]] for illustration, but it serves only didactical purposes: it will not be used in the final implementation, because a good term geerator makes parsing superfluous at this task. |
[[/Parser|Here is a parser]] for illustration, but it serves only didactical purposes: it will not be used in the final implementation, because a good term geerator makes parsing superfluous at this task. |
||

− | === Approach based on decoding with partial function === |
+ | === Chaitin's construction === |

Now, Chaitin's construction will be here |
Now, Chaitin's construction will be here |
||

Line 42: | Line 42: | ||

;“Absolute value” |
;“Absolute value” |
||

:should mean the length of a bit sequence (not [[combinatory logic]] term evaluation!) |
:should mean the length of a bit sequence (not [[combinatory logic]] term evaluation!) |
||

− | |||

− | === Approach based on decoding with total function === |
||

− | |||

− | Seen above, <math>\mathrm{dc}</math> was a partial function (from finite bit sequences). We can implement it e.g. as |
||

− | <haskell> |
||

− | dc :: [Bit] -> CL |
||

− | dc = fst . head . runParser clP |
||

− | </haskell> |
||

− | where the use of <hask>head</hask> reveals that it is a partial function (of course, because not every bit sequence is a correct coding of a CL-term). |
||

− | |||

− | If this is confusing or annoying, then we can choose a more Haskell-like approach, making <math>\mathrm{dc}</math> a total function: |
||

− | <haskell> |
||

− | dc :: [Bit] -> Maybe CL |
||

− | dc = fst . head . runParser (neverfailing clP) |
||

− | </haskell> |
||

− | where |
||

− | <haskell> |
||

− | neverfailing :: MonadPlus m => m a -> m (Maybe a) |
||

− | neverfailing p = liftM Just p `mplus` return Nothing |
||

− | </haskell> |
||

− | then, Chaitin's construction will be |
||

− | :<math>\sum_{p\in 2^*,\;\mathrm{maybe}\;\downarrow\;\mathrm{hnf}\;\left(\mathrm{dc}\;p\right)} 2^{-\left|p\right|}</math> |
||

− | where <math>\downarrow</math> should denote false truth value. |
||

== Related concepts == |
== Related concepts == |

## Revision as of 12:47, 4 August 2006

## Contents |

## 1 Introduction

Are there any real numbers which are defined exactly, but cannot be computed? This question leads us to exact real arithmetic, foundations of mathematics and computer science.

See Wikipedia article on Chaitin's construction, referring to e.g.

- Computing a Glimpse of Randomness (written by Cristian S. Calude, Michael J. Dinneen, and Chi-Kou Shu)
- Omega and why math has no TOEs (Gregory Chaitin).

## 2 Basing it on combinatory logic

Some more direct relatedness to functional programming: we can base Ω on combinatory logic (instead of a Turing machine).

### 2.1 Coding

See the prefix coding system described in Binary Lambda Calculus and Combinatory Logic (page 20) written by John Tromp:

of course, *c*, *d* are meta-variables, and also some other notations are changed slightly.

### 2.2 Decoding

Having seen this, decoding is rather straightforward. Here is a parser for illustration, but it serves only didactical purposes: it will not be used in the final implementation, because a good term geerator makes parsing superfluous at this task.

### 2.3 Chaitin's construction

Now, Chaitin's construction will be here

where

- hnf
- should denote an unary predicate “has normal form” (“terminates”)
- dc
- should mean an operator “decode” (a function from finite bit sequences to combinatory logic terms)
- should denote the set of all finite bit sequences
- Dom
_{dc} - should denote the set of syntactically correct bit sequences (semantically, they may either terminate or diverge), i.e. the domain of the decoding function, i.e. the range of the coding function. Thus,
- “Absolute value”
- should mean the length of a bit sequence (not combinatory logic term evaluation!)

## 3 Related concepts

## 4 To do

Writing a program in Haskell -- or in combinatory logic:-) -- which could help in making conjectures on combinatory logic-based Chaitin's constructions. It would make only approximations, in a similar way that most Mandelbrot plotting softwares work: it would ask for a maximum limit of iterations.

chaitin --computation=cl --coding=tromp --limit-of-iterations=5000 --digits=10 --decimal