100 likes | 255 Views
Cognitive Computing 2012. Consciousness and Computation: computing machinery and intelligence 2. ON NORMA AND nCODING Mark Bishop. The register machine NORMA: - definition -. Registers: Norma has 25 registers [A..Y]. Each register can store an arbitrary length cardinal value.
E N D
Cognitive Computing 2012 Consciousness and Computation: computing machinery and intelligence 2. ON NORMA AND nCODING Mark Bishop
The register machine NORMA:- definition - • Registers: • Norma has 25 registers [A..Y]. • Each register can store an arbitrary length cardinal value. • Operations: • INC (reg); A := A + 1; for any register (A..Y) ... • DEC (reg); B := B - 1; there are no addressing modes. • Unconditional Branching: • GOTO n; ‘n’ is a program label • Conditional Branching: • IF (A=0) THEN GOTO n; for any register (A..Y). (c) Bishop: Consciousness and Computations
NORMA startup and termination • The NORMA startup procedure: • A NORMA program starts with the register X initialised to contain all input data. • All other registers are cleared to zero. • NORMA program execution starts at label 1 and continues sequentially and implicitly. • The NORMA termination procedure: • A NORMA program terminates with a jump to label 0, whereupon the Y register contains the result of the computation. (c) Bishop: Consciousness and Computations
On the coding of Norma programs • In the theory of computation we need to have programs that can operate on programs. • eg. Q ( f (p)) • The program Q performs the function, f, upon the program, p. • However Norma programs can only accept input as an integer in the X register, hence we need to be able to code any possible program as a unique integer. • But how to code a NORMA program as a unique integer? • Recall, NORMA programs can be of any size. • Hence GOTO can be to an integer value of arbitrary length … (c) Bishop: Consciousness and Computations
Godel numbering • In formal number theory a Gödel numbering is a function which assigns to each symbol and formula of some formal language a unique natural number called a Gödel number (GN). • The concept was first used by Kurt Gödel for the proof of his incompleteness theorem. (c) Bishop: Consciousness and Computations
On coding mathematical functions • Hence a Gödel numbering can be interpreted as an encoding where a number is assigned to each symbol of a mathematical notation. • In this way a stream of natural [Gödel] numbers can represent any mathematical statement, form or function. • Thus any ‘effective procedure’ [computable function] can be represented by a ‘stream of natural numbers’ … • ... and a numbering of the set of all computable functions can be represented by a ‘stream of streams-of Gödel numbers; enumerating a stream of ‘effective numbers’. (c) Bishop: Consciousness and Computations
On Prime Decomposition • Theorem: Every positive integer is uniquely decomposable into a product of primes. • Consider the integer 45. 45 is uniquely decomposable as the product of: • 45 = 20 x 32 x 51 • ie. 45 is not divisible by 2; divisible by 3 twice; divisible by 5 once. • Converse: The product of any set of primes (raised to cardinal powers) is a unique integer. • Hence we can code the n-tuple {a, b, c, ... n} as the unique integer: • 2a x 3b x 5c x Pnn • ... where Pn is the nth prime. (c) Bishop: Consciousness and Computations
The Standard coding of Norma programs • Code Operation Variable Label • 0. Jump on zero No var No label/terminating • 1. Increment Register X n = Label number n • 2. Decrement Register Y • 3. Jump always Register A • 4. n/a Register B • Hence the statement: • 1: X = X – 1 => 22 x 31 x 50 = 12 = l1 • Given all NORMA programs have instructions labelled [1..n], then the above shows how the jth statement can be represented by a unique integer (lj). (c) Bishop: Consciousness and Computations
An example • 1: X := X - 1; => (2, 1, 0) = 12 • 2: Y := Y + 1; => (1, 2, 0) = 18 • 3: IF (X = 0) THEN GOTO 5; => (0, 1, 5) = 3125 • 4: GOTO 1; => (3, 0, 1) = 40 • Now we code the above NORMA program (P) as: • 2l1 x 3l2 x 5l3 … • So the above program would be coded as: • 212 x 318 x 53125 x 740 (c) Bishop: Consciousness and Computations
nCoding • Standard coding is not enough, as it does not guarantee that every integer represents a correct NORMA program. • Hence need to use nCoding: • Consider the set of integers: {P0, P1, P2 ... PN }, formed by arranging the set of coded programs in order of magnitude. • If the code of Program, P, appears as the cardinal PM on the list, then we define the nCode (P) = M. • Henceforth Code (P) means nCode (P). (c) Bishop: Consciousness and Computations