November 17, 2009Theory of Computation Lecture 18: Calculations on Strings III 1 Numerical Representation of Strings We will now look at several primitive.

Slides:



Advertisements
Similar presentations
November 19, 2009Theory of Computation Lecture 19: Calculations on Strings IV 1 Numerical Representation of Strings Correspondingly, we define the following:
Advertisements

1 Turing Machines and Equivalent Models Section 13.2 The Church-Turing Thesis.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
CS5371 Theory of Computation
Mu-Recursive Functions
CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)
October 27, 2009Theory of Computation Lecture 12: A Universal Program IV 1Universality Then we append the following instruction: [C]IF K = Lt(Z) + 1 
November 10, 2009Theory of Computation Lecture 16: Computation on Strings I 1Diagonalization Another example: Let TOT be the set of all numbers p such.
October 8, 2009Theory of Computation Lecture 10: A Universal Program II 1 Pairing Functions and Gödel Numbers This way the equation  x, y  = z defines.
Normal forms for Context-Free Grammars
September 24, 2009Theory of Computation Lecture 6: Primitive Recursive Functions II 1 Homework Questions Question 1: Write a program P that computes 
September 17, 2009Theory of Computation Lecture 4: Programs and Computable Functions III 1 Macros Now we want to use macros of the form: W  f(V 1, …,
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 1 Primitive Recursive Predicates Theorem 6.1: Let C be a PRC class. If.
November 3, 2009Theory of Computation Lecture 14: A Universal Program VI 1 Recursively Enumerable Sets Definition: We write: W n = {x  N |  (x, n) 
Binary Numbers.
Applied Discrete Mathematics Week 9: Relations
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 7 Mälardalen University 2010.
MTH 104 Calculus and Analytical Geometry Lecture No. 2.
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
Multiway Trees. Trees with possibly more than two branches at each node are know as Multiway trees. 1. Orchards, Trees, and Binary Trees 2. Lexicographic.
Chapter 5: Sequences, Mathematical Induction, and Recursion 5.9 General Recursive Definitions and Structural Induction 1 Erickson.
4.3 Recursive Definitions and Structural Induction Sometimes it is difficult to define an object explicitly. However, it may be easy to define this object.
December 1, 2009Theory of Computation Lecture 21: Turing Machines II 1 Simulation of L n in T We will now construct a Post-Turing program Q that simulates.
Specifying Languages Our aim is to be able to specify languages for use in the computer. The sketch of an FSA is easy for us to understand, but difficult.
CSCI 2670 Introduction to Theory of Computing September 13.
September 29, 2009Theory of Computation Lecture 7: Primitive Recursive Functions III 1 Some Primitive Recursive Functions Example 3: h(x) = x! Here are.
Theory of Computation Lecture 5: Primitive Recursive Functions I
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
November 12, 2009Theory of Computation Lecture 17: Calculations on Strings II 1 Numerical Representation of Strings First, we define two primitive recursive.
Transparency No. 1 Formal Language and Automata Theory Homework 1.
Lecture 16b Turing Machines Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE 355 Foundations.
December 3, 2009Theory of Computation Lecture 21: Turing Machines III 1 Simulation of T in L Now the MIDDLE section of Q can be generated by replacing.
Functional Programming Lecture 3 - Lists Muffy Calder.
Recursively Defined Sequences Lecture 40 Section 8.1 Wed, Apr 11, 2007.
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
Introduction to Automata Theory Theory of Computation Lecture 6 Tasneem Ghnaimat.
October 4, 2016Theory of Computation Lecture 9: A Universal Program I 1Minimalization Example 15: R(x, y) R(x, y) is the remainder when x is divided by.
Another Word on PRC Classes
Context-Free Grammars: an overview
CIS Automata and Formal Languages – Pei Wang
Diagonalization and Reducibility
Theory of Computation Lecture 14: A Universal Program V
Lecture 9 Theory of AUTOMATA
Recursively Enumerable Sets
Numerical Representation of Strings
Theory of Computation Lecture 22: Turing Machines III
Turing Machines 2nd 2017 Lecture 9.
Theory of Computation Lecture 6: Primitive Recursive Functions I
Theory Of Computer Science
The Programming Language L
Pairing Functions and Gödel Numbers
Numerical Representation of Strings
Diagonalization and Reducibility
Primitive Recursive Predicates
The Programming Language L
Numerical Representation of Strings
Numerical Representation of Strings
Numerical Representation of Strings
Pairing Functions and Gödel Numbers
Theory of Computation Lecture 6: Primitive Recursive Functions I
Some Primitive Recursive Functions
Theory of Computation Lecture 13: A Universal Program V
Numerical Representation of Strings
Lecture 3 Strings and Things (Section 1.1)
Theory of Computation Lecture 17: Calculations on Strings II
Theory of Computation Lecture 23: Turing Machines III
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

November 17, 2009Theory of Computation Lecture 18: Calculations on Strings III 1 Numerical Representation of Strings We will now look at several primitive recursive functions on strings. These functions will be useful for our further discussion of calculation on strings. It will be helpful to remember the functions g and h: g(0, n, x) = x g(m + 1, n, x) = Q + (g(m, n, x), n), then g(m, n, x) = u m. h(m, n, x) = R + (g(m, n, x), n), then i m = h(m, n, x), m = 0, …, k.

November 17, 2009Theory of Computation Lecture 18: Calculations on Strings III 2 Numerical Representation of Strings 1.) f(u) = |u| This “length” function is defined on A* and yields a natural number. How can we compute f on the number associated with A*? For each t, the number  t j=0 n j has the base n representation s 1 [t+1]. (The expression s [m] stands for the string that consists of m times the symbol s.)

November 17, 2009Theory of Computation Lecture 18: Calculations on Strings III 3 Numerical Representation of Strings For example, given the alphabet A = {s 1, s 2,s 3 } and t = 2: The string representation of  t j=0 3 j = s 1 s 1 s 1. This number is the smallest number whose base 3 representation contains t + 1 symbols. If we subtract 1 from the string s 1 s 1 s 1, it becomes s 3 s 3. So the length |u| can be defined as follows: |u| = min t≤u (  t j=0 n j > u). Obviously, this function is primitive recursive.

November 17, 2009Theory of Computation Lecture 18: Calculations on Strings III 4 Numerical Representation of Strings 2.) g(u, v) = CONCAT n (u, v) This function is primitive recursive because it is defined by the following equation: CONCAT n (u, v) = u  n |v| + v Example: Alphabet A = {1, 2, 3, 4, 5, 6, 7, 8, 9, X}: CONCAT 10 (13, 478) = 13  = 13478

November 17, 2009Theory of Computation Lecture 18: Calculations on Strings III 5 Numerical Representation of Strings 3.) CONCAT n (m) (u 1, …, u m ) This function is primitive recursive for each m, n  1. It follows at once from the previous example using composition. Example: Alphabet A = {1, 2, 3, 4, 5, 6, 7, 8, 9, X}, m = 3: CONCAT n (u, v, w) = u  n |v| + |w| + v  n |w| + w CONCAT 10 (13, 478, 9) = 13   =

November 17, 2009Theory of Computation Lecture 18: Calculations on Strings III 6 Numerical Representation of Strings 4.) RTEND n (w) = h(0, n, w) Remember: i m = h(m, n, x), m = 0, …, k. RTEND n gives the rightmost symbol of a given word. We know that h is primitive recursive, so RTEND n is also primitive recursive.

November 17, 2009Theory of Computation Lecture 18: Calculations on Strings III 7 Numerical Representation of Strings 5.) LTEND n (w) = h(|w| -  1, n, w) Corresponding to RTEND n, LTEND n gives the leftmost symbol of a given word.

November 17, 2009Theory of Computation Lecture 18: Calculations on Strings III 8 Numerical Representation of Strings 6.) RTRUNC n (w) = g(1, n, w) Remember: g(m, n, x) = u m u 0 = i k  n k + i k-1  n k-1 + … + i 1  n 1 + i 0 u 1 = i k  n k-1 + i k-1  n k-2 + … + i 1 RTRUNC n gives the result of removing the rightmost symbol from a given nonempty string. When we can omit the reference to the base n, we often write w - for RTRUNC n (w). Note that 0 - = 0.

November 17, 2009Theory of Computation Lecture 18: Calculations on Strings III 9 Numerical Representation of Strings 7.) LTRUNC n (w) = w -  (LTEND n (w)  n |w| -  1 ) LTRUNC n gives the result of removing the leftmost symbol from a given nonempty string. Example: Alphabet A = {1, 2, 3, 4, 5, 6, 7, 8, 9, X}: LTRUNC 10 (3478) =  1000 = 478.

November 17, 2009Theory of Computation Lecture 18: Calculations on Strings III 10 Numerical Representation of Strings We will use these newly introduced primitive recursive functions to prove the computability of a pair of functions that can be used in changing base. Let 1  n < l. Let A  Ã, where A is an alphabet of n symbols and à is an alphabet of l symbols. So whenever a string belongs to A*, it also belongs to Ã*.

November 17, 2009Theory of Computation Lecture 18: Calculations on Strings III 11 Numerical Representation of Strings For any x  N, let w be the word in A* that represents x in base n. Then we write UPCHANGE n,l (x) for the number which w represents in base l. Examples: UPCHANGE 2,6 (5) = 13 The representation of 5 in base 2 is s 2 s 1. In base 6, s 2 s 1 represents the number 13. UPCHANGE 1,5 (3) = 31 The representation of 3 in base 1 is s 1 s 1 s 1. In base 5, s 1 s 1 s 1 represents the number 31.