Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 461 – Oct. 28 TM applications –Recognize a language √ –Arithmetic √ –Enumerate a set –Encode a data structure or problem to solve Two kinds of TMs –Decider:

Similar presentations


Presentation on theme: "CS 461 – Oct. 28 TM applications –Recognize a language √ –Arithmetic √ –Enumerate a set –Encode a data structure or problem to solve Two kinds of TMs –Decider:"— Presentation transcript:

1 CS 461 – Oct. 28 TM applications –Recognize a language √ –Arithmetic √ –Enumerate a set –Encode a data structure or problem to solve Two kinds of TMs –Decider: will always halt for any input This one is useful for encoding an algorithm. –Non-decider: for some input, may loop forever

2 Enumerators List all the words in the language –In order of length –Within each length, canonical order such as alphabetical Technique –Ignore input –Use multiple parallel tapes. One for output, the rest for scratch work.

3 Example Let’s enumerate { 0 n 1 n }. –One tape will hold value of n. –One tape will hold for i = 1 to n. –One tape will hold the words we write. –(need to separate words by special symbol such as #) –The machine will go on forever. Similarly, we could enumerate all positive integers, all prime numbers, etc. (They’re not algorithms.)

4 TM input encoding Often we use TMs to solve problems or answer mathematical questions. For input, we need a specific encoding or rep’n. –Ex. Given an equation, can we solve for x? –Ex. Given a graph, can we tell if it’s connected? –If “yes,” there is an algorithm… so we can design a TM (or program). We encode the input to feed to TM because it can’t see the graph like we can. TM String input Yes No

5 Encode these If an object doesn’t have a text or numerical representation, need to create one. How would you encode…? Graph Binary tree finite automaton context-free grammar Polynomial Function (or one-to-many relation)

6 Algorithm A sequence of steps that always halts ( or  ) no matter what the input is. Decider: TM will always enter or  state, even if it takes a long time. If we can create a decider (i.e. algorithm), we say the problem is “decidable”. 3 ways we specify a TM –List all transitions formally (as in a table) –Write pseudocode for each state –High-level description – making it clear algorithm will always halt, but doesn’t spell out states.

7 Examples Let’s look at informal TM descriptions. –Must clearly define the input, the overall steps, and how to accept/reject. Graph connectedness –See how book writes it on p. 158 Solving an equation for “x” –What is wrong with TM description on p. 156? Determine if a number is prime Does a given FA accept its input


Download ppt "CS 461 – Oct. 28 TM applications –Recognize a language √ –Arithmetic √ –Enumerate a set –Encode a data structure or problem to solve Two kinds of TMs –Decider:"

Similar presentations


Ads by Google