Cognitive Computing 2012 Consciousness and Computation computing machinery

  • Slides: 8
Download presentation
Cognitive Computing: 2012 Consciousness and Computation: computing machinery and intelligence 4. NORMA PROGRAM SPEEDUP

Cognitive Computing: 2012 Consciousness and Computation: computing machinery and intelligence 4. NORMA PROGRAM SPEEDUP Mark Bishop

Theorem l Let l l l fp (x) = tp (x) = Function computed

Theorem l Let l l l fp (x) = tp (x) = Function computed by NORMA program P on input X Number of non X|Y instructions executed by P on X Theorem: l For all NORMA programs P, there is a NORMA program Q such that: l fq (x) = fp (x) tq (x) = 1/2 tp (x) l Now, let P = Q l l 12/12/2021 ie. The number of non I/O instructions in NORMA programs can be reduced by an arbitrary linear factor! (c) Bishop: Consciousness and Computations 2

Method l l Elimination on α l For each non X|Y register {A} define

Method l l Elimination on α l For each non X|Y register {A} define an extra register α. l Store only {A DIV 2} in A’ and the modulus in α. l Hence α can only takes on the values {0 or 1}. l And α {0 | 1} can be eliminated by coding its state into the program structure. Limitations: l Only non input/output, {X|Y}, instructions are eligible for elimination. 12/12/2021 (c) Bishop: Consciousness and Computations 3

Elimination of a binary flowchart variable l Suppose a NORMA variable S takes on

Elimination of a binary flowchart variable l Suppose a NORMA variable S takes on values of {0, 1}, in a program P with labels [1. . n]. l We can make two copies of P, P 0 & P 1 and eliminate S. Label J Program P S goes to zero J S goes to one J IF (S = 0) THEN k J Non S instruction 12/12/2021 Label j 0 j 1 (c) Bishop: Consciousness and Computations Program P 0 or P 1 GOTO (j+1) 0 GOTO (j+1) 1 GOTO k 0 GOTO (j+1) 1 Instruction 4

An example l Consider the following NORMA program to evaluate Y = X 2

An example l Consider the following NORMA program to evaluate Y = X 2 l l l 12/12/2021 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. IF (X = 0) THEN GOTO 0 X=X-1 A=A+1 B=B+1 IF (A = 0) THEN GOTO 9 A=A-1 B=B+1 Y = Y + 1; GOTO 5 IF (B = 0) THEN GOTO 1 A=A+1 B = B – 1; GOTO 9 (c) Bishop: Consciousness and Computations 5

Tabulate [β = 0; α = 0] [β = 0; α = 1] [β

Tabulate [β = 0; α = 0] [β = 0; α = 1] [β = 1; α = 0] 100 ? (X=0) GO 0 101 110 200 DEC X 201 210 300 GO 401 310 401 GO 511 410 500 ? (A’=0) 900 501 510 600 DEC A’; GO 701 610 701 GO 811 710 INC B’; GO 800 INC Y; GO 500 801 810 900 ? (B’=0) GO 100 901 910 1000 GO 1101 1010 1101 DEC B’; GO 9111110 GO 900 12/12/2021 (c) Bishop: Consciousness and Computations [β = 1; α = 1] 111 211 311 411 511 GO 611 GO 710 711 811 INC Y; GO 511 911 GO 1011 INCA’; GO 1110 1111 6

Renumbering l In the above table all line numbers are coded as lβα. l

Renumbering l In the above table all line numbers are coded as lβα. l The next step is to list the above four segments of code consecutively and eliminate unnecessary GOTO instructions. l This produces the following code: l l l l l 12/12/2021 100 200 710 800 500 600 811 900 1101 1011 ? (X=0) X=X-1 B’=B’+1 Y=Y+1 ? (A’=0) A’=A’-1 Y=Y+1; ? (B’=0) B’=B’-1 A’=A’+1; THEN GOTO 0 THEN GOTO 900 GOTO 710 THEN GOTO 100 GOTO 900 (c) Bishop: Consciousness and Computations 7

The final program l Which can then be renumbered to produce the final program:

The final program l Which can then be renumbered to produce the final program: 1 ? (X=0) 2 X=X-1 3 B=B+1 4 Y=Y+1 5 ? (A=0) 6 A=A-1 7 Y=Y+1; 8 ? (B=0) 9 B=B-1 10 A=A+1; l THEN GOTO 0 THEN GOTO 8 GOTO 3 THEN GOTO 1 GOTO 8 Now compare with original 12/12/2021 (c) Bishop: Consciousness and Computations 8