Title: Abstract Models of Computation
1Abstract Models of Computation
- Capturing the Essence of Computation
gregory.taylor_at_trincoll.edu
2What is Computation?
- Paradigm instances of computation
- Operations on numeric data
- Operations on character data
- Function computation
3Arithmetic Operations
- 34239 23478378
- 2347 - 293874
- ?43.3421
- 3.24
- 72 of the population of Hartford
4Function Computation
- Preparatory Integers 14 and 25 are relatively
prime since gcd(14, 25) ____ - Example Eulers ? function defined as
- ?(n) def. the number of integers k lt n such
that k and n are relatively prime (k ? 1) - Thus ?(20) ______.
5String Manipulation
- Find the length of string ababababbbaba
- What is abababbabbabR?
- Is abababbbbbababa a palindrome?
- What is the longest substring common to GCATCCTAA
and ATACTAATCCTTA?
6Three Computational Paradigms
- Function computation (natural numbers only)
- Language acceptance (recognition)
- Transduction (transformation of an input into an
appropriate output) - Turing machines implement each of these paradigms
7The Turing Machine Concept (Informal Description)
8Example 1.2.1
- State diagram (transition diagram) full
description of machine Ms behavior - Machine states and instructions
- Initial state q0
- Machine instructions
9Example 1.2.1 (cont.)
- Read/write tape (tape squares)
- Read/write head scans one tape square
- Initial tape configuration
10M after One Computation Step
- Machine configuration In state q1 scanning an a
(all other squares blank). - What happens next?
11Summary of Ms Behavior
- When started scanning square on a completely
blank tape, M writes ab and halts scanning a. - We makes no claims for M if tape not initially
blank.
12Important Concepts
- Tape configuration
- Machine configuration tape configuration
current state
13Turing Machines Can Compute Forever
- Machine on left moves off to the right forever
- Machine on the right writes 1s off to the right
forever
14The Copying Machine (Icon)
- Load tape8.tt
- 11111111 on tape initially
- 11111111B11111111 on tape when M halts
- Scanning leftmost 1
15Exercise 1
- Design a Turing machine M that, starting on a
blank tape, writes a short, unbroken string of as
and bs of your choice on the tape and then halts
scanning the leftmost of these symbols. - Example Design M so that it writes aba on the
tape and then halts. - M can work from left to right or from right to
left (slightly more efficient).
16Language Acceptance
- Produces accepting 1 for word w just in case
na(w) nb(w)
17A Turing Machine May Accept Word w
- word finite string of symbols
- Word abab accepted
- Word baaa not accepted
- Same Number of as and bs
- Starts scanning leftmost symbol of input input
word w - Halts scanning a 1 on otherwise blank tape
18Another Example
- Accepted a, ab, bb, aab, abb, bbb, ...
- Not accepted a, aa, ba, aaa, aba, bba, ...
19Language Acceptance
- Both machines on previous slide accept all and
only words in language L anbmn³0,m³1 - We say that these machines accept language L
anbmn³0,m³1 - We dont care what M does for input words not in
L so long as it does not write accepting 1.
0 or more as followed by 1 or more bs
20Exercise 2
- Alphabet just a and b
- Output alphabet just 1
- Design a Turing machine that accepts the language
consisting of all words of even length. - Should write a 1 in response to aa, ab, ba, bb,
etc. - Should not write a 1 for a, aba, etc.
21Language Recognition
- M recognizes language L
- If word w ? L, then M writes accepting 1 and
halts. (M accepts w.) - If w ? L, then M writes rejecting 0 and halts.
(M rejects w.) - Note that 0, 1 ? ?.
- Special case ?
- Example under icon Recognizer.
22Exercise 3
- Input alphabet just a and b
- Output alphabet 1 and 0
- Design a Turing machine that recognizes the
language consisting of all words of even length. - Should write a 1 in response to aa, ab, ba, bb,
etc. - Should write a 0 for a, aba, etc.
23Terminology
- Language L is Turing-acceptable if some Turing
machine accepts L. - Language L is Turing-recognizable if some Turing
machine recognizes L. - If M recognizes L, then M accepts L, but not
necessarily vice versa.
24Representing Natural Numbers
- 111 represents natural number 2
- What represents 4? __________
- What represents 0? __________
25Computing the Successor Function
- If M started scanning input 1111, then halts
scanning 11111.
26Exercise 4
- Design a Turing machine that computes the
function defined by f(n) n 3 - Assumed to start scanning leftmost 1 in an
unbroken string of 1s - Should halt scanning leftmost 1 left on tape
27Computing Binary Functions
- binary functions of two arguments
- What would it be for a Turing machine to compute
addition function f(n, m) n m? - Answer If started scanning 1111B111
representing arguments 3 and 2, then halts
scanning 111111 representing argument 5.
28Exercise 5
- Design a Turing machine M that computes the
binary addition function in the sense of the
previous slide. - M should halt scanning the leftmost 1 on tape.
- Hint fill in intermediate blank and delete two
1s on the left
29Terminology
- Natural numbers
- Members of N 0, 1, 2,
- Functions from natural numbers to natural numbers
only - A function f is Turing-computable if there
exists a Turing machine M that computes f.
30Turing-Computable Functions
- Addition is Turing-computable (Exercise 5).
- Multiplication is Turing-computable (icon).
- Exponentiation is Turing-computable (icon).
- Every function youve ever heard of is
Turing-computable. - Turing computability is a powerful concept.
- Those functions that arent Turing-computable are
complicated to describe.
31Turing Machines as Transducers
- Icon Reverse Word
- Input word abbb is transformed into bbba.
- Input word ? is transformed into ? (limiting
case).
32Exercise 6
- Input alphabet just a and b
- Design a Turing machine that transposes its
input string, changing every a to b, and vice
versa - So abba is turned into baab
- Halt at far left
33Summary
- We have now seen that Turing machines implement
each of our three paradigms. - Language acceptance (recognition)
- Number-theoretic function computation
- Transduction