Lecture 1-4 Recursive Functions

Slides:



Advertisements
Similar presentations
1.6 Functions. Chapter 1, section 6 Functions notation: f: A B x in A, y in B, f(x) = y. concepts: –domain of f, –codomain of f, –range of f, –f maps.
Advertisements

Functions.
Lecture 15 Functions CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Lecture 3 Universal TM. Code of a DTM Consider a one-tape DTM M = (Q, Σ, Γ, δ, s). It can be encoded as follows: First, encode each state, each direction,
Lecture 7 Recursive Functions. Initial Functions Zero function ζ(n) = 0. Successor σ(n) = n+1, for n ε N. Projection π i (n 1,…,n k ) = n i. k.
1 Turing Machines and Equivalent Models Section 13.2 The Church-Turing Thesis.
Primitive Recursive Functions (Chapter 3)
Functions A function, f, is a mechanism that relates (or maps) one set of elements to another set. –More specifically, f, is a special type of relation.
(CSC 102) Lecture 21 Discrete Structures. Previous Lecture Summery  Sum/Difference of Two Functions  Equality of Two Functions  One-to-One Function.
Appendix B Solving Recurrence Equations : With Applications to Analysis of Recursive Algorithms.
Permutations and Inverses. Definition Let A be a set. If f : A  A is a 1-1 correspondence then f is called a permutation of A. Notation: S(A): the set.
Discrete Mathematics Lecture 7 Alexander Bukharovich New York University.
October 27, 2009Theory of Computation Lecture 12: A Universal Program IV 1Universality Then we append the following instruction: [C]IF K = Lt(Z) + 1 
Theory and Applications
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, …,
Recurrence Relations Reading Material –Chapter 2 as a whole, but in particular Section 2.8 –Chapter 4 from Cormen’s Book.
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) 
Lecture 18 Various TMs. Allow the head not move Theorem. If the head is allowed to stay at the cell in each move, then every function computed by the.
Math 3121 Abstract Algebra I Lecture 3 Sections 2-4: Binary Operations, Definition of Group.
4-3 Relations Objective: Students will represent relations as sets of ordered pairs, tables, mappings, and graphs. Students will find the inverse of a.
Computability Turing machines for functions. Recursive functions. Homework: Modify class example for addition to produce contiguous 1s. Construct TM for.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
Mathematical Induction
1 Section 13.2 The Church-Turing Thesis The Church-Turing Thesis: Anything that is intuitively computable can be be computed by a Turing machine. It is.
General rules: Find big-O f(n) = k = O(1) f(n) = a k n k + a k-1 n k a 1 n 1 + a 0 = O(n k ) Other functions, try to find the dominant term according.
Math 3121 Abstract Algebra I Lecture 5 Finish Sections 6 + Review: Cyclic Groups, Review.
Domain Theory and Multi-Variable Calculus Abbas Edalat Imperial College London Joint work with Andre Lieutier, Dirk Pattinson.
Unit II Discrete Structures Relations and Functions SE (Comp.Engg.)
Chapter 10 Computable Functions Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
CS 3813: Introduction to Formal Languages and Automata Chapter 13 Other Models of Computation These class notes are based on material from our textbook,
::ICS 804:: Theory of Computation - Ibrahim Otieno SCI/ICT Building Rm. G15.
FUNCTIONS COSC-1321 Discrete Structures 1. Function. Definition Let X and Y be sets. A function f from X to Y is a relation from X to Y with the property.
FUNCTIONS.
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.
Cook Theorem and NP-complete problems
Discrete Mathematics CS 2610
Theory of Computation Lecture 10: A Universal Program I
Part VI NP-Hardness.
Linear Algebra Lecture 19.
Cartesian product Given two sets A, B we define their Cartesian product is the set of all the pairs whose first element is in A and second in B. Note that.
Theory of Computation Lecture 14: A Universal Program V
Recursively Enumerable Sets
Computing with Turing Machines
Functions Section 2.3.
CS201: Data Structures and Discrete Mathematics I
Sets and Logic…. Chapters 5 and 6
Theory of Computation Lecture 6: Primitive Recursive Functions I
CS 154, Lecture 4: Limitations on DFAs (I),
ICS 353: Design and Analysis of Algorithms
Lecture 1-4 Recursive Functions
CS21 Decidability and Tractability
Proposed in Turing’s 1936 paper
Ch 5 Functions Chapter 5: Functions
Lecture 43 Section 10.1 Wed, Apr 6, 2005
Theorems about LINEAR MAPPINGS.
Chapter 2: Intro to Relational Model
Lecture 1-4 Recursive Functions
Unit 30 Functions Presentation 1 Functions, Mappings and Domains 1
3.IV. Change of Basis 3.IV.1. Changing Representations of Vectors
Theorem 9.3 A problem Π is in P if and only if there exist a polynomial p( ) and a constant c such that ICp (x|Π) ≤ c holds for all instances x of Π.
MASTER THEOREM.
Numerical Representation of Strings
Functions Section 2.3.
Theory of Computation Lecture 9: A Universal Program I
ICS 353: Design and Analysis of Algorithms
CS6382 Theory of Computation
Theory of Computation Lecture 6: Primitive Recursive Functions I
Theory of Computation Lecture 13: A Universal Program V
Recursive Functions.
Presentation transcript:

Lecture 1-4 Recursive Functions

Initial Functions Zero function ζ(n) = 0. Successor σ(n) = n+1, for n ε N. Projection πi (n1,…,nk) = ni. k

Composition Let m, k be two integers. Given functions g: N → N and hi: N → N for I = 1, 2, …, m, define f: N → by f(n1,…,nk) = g(h1(n1,…,nk),…,hm(n1,…,nk) f is called the composition of g and h1, …, hm. f = go(h1,…,hm) m k k

Primitive Recursion Let k > 0. Given g: N → N and h: N → N, (when k=0, g is a constant), define f : N → N by f(n1,…nk,0) = g(n1,…,nk) f(n1,…,nk,m+1) = h(n1,…,nk,m,f(n1,…nk,m) k+1

Primitive Recursive Functions All initial functions are primitive recursive. If g and h1, …, hm are primitive recursive, so is go(h1, …, hk). If g and h are primitive recursive, so is f obtained from g and h by primitive recursion. Nothing else is primitive recursive.

Add(m, n) = m+n Add(m,0) = π1 (m) Add(m, n+1) = σ( π3 (m,n, add(m, n))) 1 3

mult(m, n) = mn mult(m, 0) = ζ(m) Mult(m, n+1) = add(π1(m,n,mult(m,n)), π3(m, n, mult(m,n)) 1 3

minus(m,n)= m-n if m > n; 0 if m<n pred(m) = minus(m,1) pred(0) = ζ(0) pred(m+1) = m = π1 (m, pred(m)) minus(m,0) = π1 (m) minus(m, n+1) = pred(π3(m,n,minus(m, n)) 2 1 3

Pairing Function A function f: N → N is a pairing function if it satisfies the following conditions: (1) f is 1-to-1 and onto; (2) f is primitive recursive; (3) f(i, j) < f(i+1, j), f(i, j) < f(i, j+1). For example,

Two “inverse” functions i = g(f(i,j)) and 14 9 13 8 5 12 2 4 7 11 1 3 6 10 Two “inverse” functions i = g(f(i,j)) and j = h(f(i, j)) are also primitive recursive.

Bounded minimization Given g: N → N, define f by K+1 Given g: N → N, define f by f(n1, …, nk, m) = min {i | g(n1, …, nk, i)=1} if there exists i < m such that g(n1, …, nk, i) =1; = 0, otherwise. If g is primitive recursive, so is f.

Unbounded minimization K+1 Given g: N → N, define f by f(n1, …, nk) = min {i | g(n1, …, nk, i)=1} if there exists i such that g(n1, …, nk, i) =1; = ↑, otherwise. f may not be primitive recursive, even if g is.

Partial Recursive Functions All initial functions are partial recursive. If g is a total recursive function, then f obtained from g by unbounded minimization is partial recursive. If g and h1,…, hk are partial recursive, so is go(h1,…,hk). If g and h are partial recursive, so is f obtained from g and h by primitive recursion.

Over Σ* Zero function ζ(x) = ε. Successor σa(x) = xa for a in Σ. Projection (no change) Composition (no change) Primitive recursion (need a change, m+1 is replaced by ma) Unbounded minimization (need to give a linear ordering of Σ*)

From Σ* to Γ* for Σ* c Γ* Zero function ζ(x) = ε. Successor σa(x) = xa for a in Γ. N can be considered as a subset of {0, 1}* if we represent n by 1…1 n

Theorem A function is partial recursive iff it is Turing-computable.

Theorem The following are equivalent: A is r.e. A is Turing-acceptable. A is the range of a primitive recursive function. A is the domain of a partial recursive function.

Pairing function on Σ* Let π(i, j) be a pairing function on N. Let φ be a 1-to-1 onto mapping from N to Σ*. Let μ be a 1-to-1 onto mapping from Σ* to N. Then p(x, y) = φ(π(μ(x), μ(y)) is a pairing function on Σ*.