::ICS 804::
This presentation is the property of its rightful owner.
Sponsored Links
1 / 35

::ICS 804:: Theory of Computation - Ibrahim Otieno - [email protected] +254-0722-429297 PowerPoint PPT Presentation


  • 56 Views
  • Uploaded on
  • Presentation posted in: General

::ICS 804:: Theory of Computation - Ibrahim Otieno - [email protected] +254-0722-429297 SCI/ICT Building Rm. G15. Course Outline. Mathematical Preliminaries Turing Machines Recursion Theory Markov Algorithms Register Machines Regular Languages and finite-state automata

Download Presentation

::ICS 804:: Theory of Computation - Ibrahim Otieno - [email protected] +254-0722-429297

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Ics 804 theory of computation ibrahim otieno iotieno uonbi ac ke 254 0722 429297

::ICS 804::

Theory of Computation

- Ibrahim Otieno -

[email protected]

+254-0722-429297

SCI/ICT Building Rm. G15


Course outline

Course Outline

  • Mathematical Preliminaries

  • Turing Machines

  • Recursion Theory

  • Markov Algorithms

  • Register Machines

  • Regular Languages and finite-state automata

  • Aspects of Computability


Last week markov algorithms

Last Week: Markov Algorithms

  • Sequential computation and Markov Algorithms

  • Language Acceptors/Recognizers

  • Number-theoretic functions

  • Labeled Markov algorithms

  • Markov-Computable functions and partial recursive functions

  • Efficiency


Course outline1

Course Outline

  • Mathematical Preliminaries

  • Turing Machines

    • Additional Varieties of Turing Machines

  • Recursion Theory

  • Markov Algorithms

  • Register Machines

  • Regular Languages and finite-state automata

  • Aspects of Computability


Register machines

Register Machines

  • Register machines

  • Register machines and formal languages

  • Model-independent characterization of computational feasibility


Ics 804 theory of computation ibrahim otieno iotieno uonbi ac ke 254 0722 429297

Register Machines


Register machines1

Register Machines

  • More up-to-date way of thinking about computation

  • A register machine (RM) consists of a finite number of registers, instruction set and a CU.

  • We write R0, R1, . . . for the registers.

  • Each register contains a natural number: [Ri] denotes the content of the ith register.

  • Note: there is no bound on the size of numbers stored in our registers

  • The CU capable of executing certain instructions that manipulate register contents.


Example

Example

  • Register machine M with two registers: R1 and R2

  • Register: variable storage

  • Initial: R1 contains natural number n


Example1

Example

  • R2 initializes to 0


Example2

Example

  • M checks whether R1=R2

  • If yes, then M halts. If no, R2’s value is incremented


Some pseudocode

Some Pseudocode

Input R1 = n

OutputR2 = n

Algorithm

Start;

R2:=0;

Loop:R1=R2? goto end;

R2++;

goto loop;

End: Halt


Example3

Example


Exercise

Exercise

  • What does this register machine compute?

  • Try starting with R1 and R2 both containing 10


Exercise1

Exercise

  • What does this register machine compute?

  • successor function


Example 5 1 3 binary addition function

Example 5.1.3 (Binary Addition Function)


Additional instructions

Additional Instructions

  • *Ri++: increments register Rj where j is the natural number currently stored in register Ri

  • Ri = *Rj? goto L: branch to instruction labeled L if the value in Ri is the same as the value in Rk, where k is the value currently stored in register Rj

  • Also: *Ri =Rj?goto L

    *Ri = *Rj?goto L

    *Ri := 0

  • This is called indirect addressing (cf. Assembler)


Formal definition

Formal Definition

  • A register machine M is any pair <,>

    •  = {R1, R2, …, Rm} with m1 is a possibly infinite set of registers

    • =<t1,t2,…,tt> with t2 is a finite, nonempty sequence of instructions such that:

      • Instruction t1 is the start instruction

      • Each of t2,…,tt is either the halt instruction or an instruction of the form:

        (a) Ri:=0 or *Ri:=0

        (b) Ri++or *Ri++

        (c) Ri=Rj? goto L or *Ri=Rj? goto L or

        Ri=*Rj? goto L or *Ri=*Rj? goto L

        whereRi and Rj are members of  while L is an identifier with exactly one of instructions t1,t2,…,tt

      • tt is the Halt instruction


M computes k ary f

M computes k-aryf

  • M’s registers R1,R2,…,Rk contain arguments of f

  • Ultimately, register Rk+1 contains f(n1,n2,…,nk)

  • If f(n1,n2,…,nk) is undefined, then M’s computation never terminates


Register machine computability

Register-Machine-Computability

  • f is said to be register-machine-computable if there exists a register machine that computes f


An equivalence result

An Equivalence Result

  • Let h be Turing-computable number-theoretic function.

  • Then h is register-machine-computable.

  • Then h is a partial recursive function as well.

  • If f is register-machine-computable, then f is Turing-computable.


Ics 804 theory of computation ibrahim otieno iotieno uonbi ac ke 254 0722 429297

Register machines and formal languages


Language acceptance recognition

Language Acceptance/recognition

  • Adds

    • Input tape and output tape

    • read(Ri) and write(Ri) instructions

  • Initially, “input word” w on tape followed by terminating 0 (sentinel)

  • If w L, then 1 written to output tape

  • If w  L, then 0 written to output tape (recogn)


Example4

Example

  • L = {w*|na(w) = nb(w)}

  • 1s represent as and 2s represent bs

  • Register-machine-acceptable language

    also: palindromes


Example5

Example

R1 – Input

R2 – No of a’s

R3 – No of b’s

R4 = 0

R5 = 1 – rep a


Ics 804 theory of computation ibrahim otieno iotieno uonbi ac ke 254 0722 429297

Model-independent characterization of computational feasibility


Time analysis

Time Analysis

  • Time analysis of register-machine M: count each primitive operation

  • Uniform Cost Assumption: size of register contents make no difference

  • M in previous example carries out 4 steps for each symbol in word w

  • Before loop, there are 2 steps, after end-of-input sentinel 0 is encountered, five steps are executed

  • With |w| = n, then there are 4n+5 execution steps

  • M computes in linear time


Feasibility recap

Feasibility (recap)

  • Cobham–Edmonds thesis regarding computational feasibility: the problem of determining whether a given string is a member of a given language L is feasible if and only if L is in P

Complexity class P: class of all languages accepted in polynomial time by some (single-tape) Turing Machine


Problems with the thesis

Problems with the Thesis

  • Computable by what? Focus on single-tape Turing machine

  • Which model of computation is the favored one?

  • Does it make a difference?


Problems with the thesis1

Problems with the Thesis

e.g. L = {w*|na(w) = nb(w)}

  • Register machine: O(n) steps

  • Single Tape Turing Machine: O(n2) steps

  • Multi-Tape Turing Machine: O(n) steps

  • Markov Machine: O(n2) steps


Polynomial relatedness

Polynomial Relatedness

  • Suppose that multitape MTM accepts language L in O(n) steps. Then there exists MRM that accepts L in time O([timeTM(n)]2) under the uniform cost assumption.

  • Suppose that MRM accepts language L in O(n) steps under the assumption of uniform cost. Then there exists multitape MTM that accepts L in time O([timeTM(n)]3).


Complexity recap ma

Complexity (recap: MA)

  • Given Turing machine M accepting L, there exists a Markov algorithm AS that accepts L in O(timeM(n)) steps

  • Given Markov algorithm AS accepting L, there exists a Turing machine M that accepts L in O([timeAS(n)]4) steps


Time and space recap tm

Time and Space (recap: TM)

  • Corollary Suppose that language L is accepted by k-tape Turing machine M. Then L is accepted by a single-tape Turing machine M1 such that timeM1(n) is O([timeM(n)]2)

  • Corollary Suppose that language L is accepted by k-tape Turing machine M. Then L is accepted by a single-tape Turing machine M´ such that spaceM´(n) is O(spaceM(n)).


Results regarding polynomial relatedness of models

Results Regarding Polynomial Relatedness of Models

Markov

Algorithm

Model

Theorem 4.3

Multitape

Turing Machine model

Corollary 2.1

Theorem 5.3

Register Machine

Model

Single-tape Turing Machine model


Reformulation

Reformulation

  • In invoking the Cobham-Edmonds thesis, it seems to make no difference which model we take

    Reformulation:

  • A language-acceptance problem is feasible provided that the language in question is accepted in polynomially bounded time


More generally

More generally

Invariance principle for models of sequential Computation

Let Model be some machine model of sequential computation. Then Model will be said to be a reasonable model of sequential computation if it is polynomially related to the multitape Turing machine model


  • Login