cs 3240 – chapters. pdas with 2 stacks or 1 queue tms with 1-way infinite tape tms with n tapes...
TRANSCRIPT
![Page 1: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/1.jpg)
CS 3240 – Chapters
![Page 2: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/2.jpg)
PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move” options
Move by a number of cells (including 0), random cell access by position
Adding non-determinism to a Standard TM Church's Lambda Calculus (LISP, Haskell) Unrestricted Grammars Matrix Grammars Post Systems Markov Algorithms Structured Programming with unlimited
memory Any abstract machine yet imagined by man!
![Page 3: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/3.jpg)
Queues pop at front, push at back 2 I/O points gives more flexibility Equivalent to a TM!
Begin by pushing all initial data Can simulate “moving around” by
cycling through the data circular shift via pop and push of same
character use a delimiter character ($) to keep track
of the start of data
![Page 4: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/4.jpg)
![Page 5: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/5.jpg)
$aabbccaabbcc$abbcc$Xbbcc$Xabcc$XaYcc$XaYbc$XaYbZ$XaBbZcXaYbZc$aYbZc$XYbZc$XX
bZc$XXYZc$XXYYc$XXYYZ$XXYYZZXXYYZZ$YYZZ$XXZZ$XXYY$XXYYZZXXYYZZ$<accept>
![Page 6: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/6.jpg)
Just store the tuple (a,b,c) as the “symbol” in a single cell.Change part or all of the data as needed.
![Page 7: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/7.jpg)
Just “wrap around the fold” to simulate a 2-way tape
![Page 8: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/8.jpg)
Figure 10.04:
![Page 9: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/9.jpg)
Figure 10.05:
![Page 10: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/10.jpg)
Just place in different sections of a single tape
![Page 11: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/11.jpg)
Figure 10.11:
![Page 12: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/12.jpg)
Code the machine so it replicates and calls itself for each choice. (A form of backtracking). Do a breadth-first search for a halting configuration.
![Page 13: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/13.jpg)
The TM we’ve seen so far have been “special-purpose computers” they implement only one algorithm, or they accept only one language
But TMs can take another TM as input, and simulate (run) it “stored program computer” general purpose computer as we know it
![Page 14: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/14.jpg)
A TM that simulates other TMs. Mu takes M as input, along with data input.See page 267 for a sample encoding for TMs.
![Page 15: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/15.jpg)
The input TM must be encoded as a string States, transitions, etc.
One way: Order the tape alphabet, Γ = {a1, a2, a3…}
▪ a1 = ☐, a2 = L, a3 = R, a4 = 0, a5 = 1, …
Encode each state by its index+1▪ q0= 1, q1 = 11 …
Encode each transition in δ Use 0 as the separator everywhere
![Page 16: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/16.jpg)
δ(q0,1) = (q0,1,R)Consider it as the quintuple
(q0,1,q0,1,R)Which encodes as:
(1,5,1,5,3)= 1 11111 1 11111 111= 1011111010111110111
![Page 17: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/17.jpg)
Notation: TU = the UTM; TM = the input machine TU has a memory location for the current state of
TM
TU reserves a portion of the tape for the encoding of the TM
TU reserves an infinitely large portion of the tape for the working memory of the TM (in one direction), initialized with the input to TM
And keeps track of the read/write position TU has its own infinitely large memory area (in the
other direction)
![Page 18: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/18.jpg)
We won’t investigate the inner workings of UTMs further
We’ll just assume they exist (If they didn’t, neither would computers :-)
What we will do is examine the consequences of the existence of UTMs especially the consequences of encoding
TMs as strings
![Page 19: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/19.jpg)
http://ironphoenix.org/tril/tm/Here are the instructions for the
swap machine: 1,a,1,b,> 1,b,1,a,> 1,_,2,_,< 2,a,2,a,< 2,b,2,b,< 2,_,H,_,>
![Page 20: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/20.jpg)
Every TM can be encoded as a bitstring Not all strings represent TMs. TM form:
(11*0)50((11*0)50)*
Some TMs can have more than one string representation e.g., the name(number) of the state is
immaterial
How many strings are there? How many TMs are there?
![Page 21: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/21.jpg)
Some infinite sets are countable like the set of positive even numbers {0, 2, 4, …} = {2n | n ∈ N}; function: p(i) =
2i There is a one-to-one mapping between
the set’s elements and the Natural numbers
Others are not countable: e.g., the set of real numbers Consequence: |(0,1)| = |(-∞,∞)| !!!
![Page 22: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/22.jpg)
-2, -4, -6, … Maps to 1, 2, 3, … By the function: n(i) = -2i
![Page 23: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/23.jpg)
e(0) = 0 e(1) = 2 e(2) = -2 e(3) = 4 e(4) = -4 e(5) = 6 e(6) = -6
The “formula”:
If i is evene(i) = -i
elsee(i) = i + 1
![Page 24: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/24.jpg)
![Page 25: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/25.jpg)
Take a cue from number systems’ positional notation
123 = 1*102 + 2*10 + 3aba = v(a)*n2 + v(b)*n + v(a), where
n = |Σ|, v(a) = 1, v(b) = 2, f(λ) = 0So f(aba) = 1*22 + 2*2 + 1 = 9aba is the 9th string (0-based) in Σ*:
{λ,a,b,aa,ab,ba,bb,aaa,aab,aba,…}
![Page 26: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/26.jpg)
A Language is a subset of Σ*
We can enumerate the elements of Σ* (or any subset thereof) in proper order lexicographically in groups by increasing
length Therefore, there is a first one, a second one,
etc. So, the strings of a language are
enumerable ⇒ Every language is a countable set of
strings
![Page 27: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/27.jpg)
aka enumerable They can be arranged in a sequence
▪ TM0, TM1, TM2, etc.Why?
Because they can be encoded as strings Strings over any alphabet can be
enumerated in proper order▪ by length groups, lexicographically
So there you have it!
![Page 28: CS 3240 – Chapters. PDAs with 2 stacks or 1 queue TMs with 1-way infinite tape TMs with n tapes or n heads or n-dim tapes TMs with various “move”](https://reader036.vdocuments.net/reader036/viewer/2022062423/5697bfa71a28abf838c9908b/html5/thumbnails/28.jpg)
Some TMs only need a fixed size of working storage never grows beyond (a factor of the) input size
Example: anbncn
Doesn’t expand working storage (remember?) These are called Linear Bounded Automata
LBA; they use end-markers: [<data goes here>] Why do we care?
We don’t, much; will use briefly in Chapter 11