Theory of Computation: Lecture 09: Primitive Recursively Closed Classes, Primitive Recursive Functions
CS 5000: Theory of Computation Lecture 09 Vladimir Kulyukin Department of Computer Science Utah State University
Outline● Review● Primitive Recursively Closed Function Classes● Computable Functions are a Primitive Recursively Closed Function Class● Primitive Recursive Functions● Showing a Function to be Primitive Recursive
Review: CompositionLet f be a function of k variables.Let g1 ,..., g k be functions of n variables.Leth( x1 ,..., xn ) = f ( g1 ( x1 ,..., xn ) ,..., g k ( x1 ,..., xn ) ) ,Then h is obtained from f and g1 ,..., g k bycomposition.
Review: Theorem 1.1 (Ch. 3)If h is obtained from the (partially) computable functions f,g1, …, gk by composition, then h is (partially) computable.
Review: Recursion (Definition 1)Suppose k is some fixed number. Let g ( x, y ) be a total function.Let h be obtained from g as follows :h(0) = kh(t + 1) = g (t , h(t ))Then h is obtained from g by primitive recursion (recursion).
Review: Theorem 2.1 (Ch. 3)Let h be obtained from g by primitive recursionaccording to Recursion Definition 1. Let g becomputable. Then h is computable.
Review: Recursion (Definition 2)Suppose that f and g are total functions of n and n + 2 variables,respectively. Let h be a function of n + 1 variables obtained fromf and g as follows :h( x1 ,..., xn ,0) = f ( x1 ,..., xn )h( x1 ,..., xn , t + 1) = g (t , h( x1 ,..., xn , t ), x1 ,..., xn ).Then h is said to be obtained from f and g by primitive recursion.
Review: Theorem 2.2 (Ch. 3)Let h be obtained from f and g by primitive recursionand let f and g be computable. Then h is computable.
A Perspective on Primitive Recursion● Primitive recursion is another method that, like composition, allows us to construct new functions from existing functions● Does it capture the notion of computability completely?● The answer is – no, because there are computable functions that cannot be defined via composition or primitive recursion
Primitives in Formal Systems● Any formal system (e.g. Euclidian geometry, number theory, etc.) must state its primitives, i.e. elements that cannot be decomposed any further.● Examples: – Points in Euclidean geometry; – Numbers in mathematics; – Assembly operations in compilers; – Primitive instructions in L.
Primitive Recursively Closed Classes of Functions
Theory of Primitive Recursive Functions● Theory of primitive recursive functions also has its primitives: they are called initial functions● They are called primitives because they are undefinable (unbreakable into further primitives)● It is of these primitives that we can effectively construct more complicated functions through composition and primitive recursion
Initial Functions1. The successor function : s( x) = x + 12. The null function : n( x) = 03. The projection function : u ( x1 ,..., xn ) = xi ,1 ≤ i ≤ n n i
Primitive Recursively Closed● We can now apply the notion of mathematical closure to classes of functions● A class of total functions C is a primitive recursively closed (PRC) class if – The initial functions are in C – Any function obtained from the functions already in C by composition or primitive recursion is also in C
Theorem 3.1 (Ch. 3)The class of computable functions is PRC
Proof 3.1• There are two parts to this proof: 1. The initial functions are computable so they satisfy the first condition of the PRC definition 2. We can use theorems 1.1 (Ch. 3), 2.1 (Ch. 3), and 2.2 (Ch. 3) to show that any function that is obtained from the initial functions through composition, primitive recursion, or any combination thereof also computable: in other words, composition, primitive recursion, and any combination thereof preserves computability
Proof 3.1: Part 1Initial Function : s ( x) = x + 1L - Program : Y ← X 1 + 1Initial Function : n( x) = 0L - Program : ∅Initial Function : uin ( x1 ,..., xn )L - Program : Y ← X i
Proof 3.1: Part 2● Theorem 1.1 (Ch. 3) ensures that any function obtained by composition of computable functions is computable● Theorems 2.1 (Ch. 3) and 2.2 (Ch. 3) ensure that any function obtained by recursion from another computable function is also computable● Therefore, any finite sequence of compositions and recursions applied to computable functions leads to a computable function (this can be formalized with an inductive proof)
Definition: Primitive Recursive FunctionA function is called primitive recursive if it can be obtainedfrom the initial functions (successor, null constant, andprojection) by a finite number of applications of compositionor recursion
Terminology Caveat 1● We should distinguish the definitions of primitive recursion and primitive recursive function● Primitive Recursion defines a method through which functions are constructed from existing functions● Primitive Recursive Function defines function that has a specific property (it can be constructed by a finite number of applications of composition and primitive recursion to the three initial functions)
Terminology Caveat 2● We should also distinguish the definitions of primitive recursively closed and primitive recursive● Primitive recursive closed applies to classes of functions that satisfy two properties in the definition of the PRC class● Primitive recursive applies to individual functions that have a specific property in the definition of primitive recursive function
Simple Insight● The definition of primitive recursive function has a constructive interpretation● If f is a primitive recursive function, there is a list of functions f1, …, fn, where fn = f and every function fi in the list is either an initial function or is obtained from the preceding functions in the list by composition or recursion
QuestionHow can we show that a function is primitive recursive?
An Answer There are two strategies:1. Obtain the function from the initial functions through composition or primitive recursion (first principles reasoning that works on fairly simple functions)2. Use the knowledge that some functions are already primitive recursive in combination with composition or primitive recursion (this is a more generic method)
Example 1Show that f(x,y) = x + y is primitive recursive
Example 1● Here are the recurrences from Definition 2 of primitive recursion: – f(x, 0) = x – f(x, t+1) = f(x, t) + 1● Let us play with these recurrences: – f(2, 0) = 2. Works! – f(2, 1) = f(2, 0) + 1 = 2 + 1 = 3. Works! – f(3, 2) = f(3, 1) + 1 = f(3, 0) + 1 + 1 = 3 + 1 + 1 = 5. Works!
Example 1: Using Formal DefinitionBase Case :f ( x,0 ) = x becomes h( x,0 ) = u ( x,0 ) 2 1
Example 1: Using Formal DefinitionRecursive Case :f ( x, t + 1) = f ( x, t ) + 1 becomes ( )h( x, t + 1) = s u ( t , h( x, t ) , x ) . 3 2Or, more formally,h( x, t + 1) = g ( t , h( x, t ) , x ) , where (g ( x1 , x 2 , x3 ) = s u ( x1 , x 2 , x3 ) 3 2 )
Example 1: Using Formal DefinitionCombining the base and recursive cases, we get :h ( x ,0 ) = u ( x ,0 ) 2 1h( x, t + 1) = g ( t , h( x, t ) , x ) , where (g ( x1 , x 2 , x3 ) = s u ( x1 , x 2 , x3 ) 3 2 )
Reading Suggestions nd● Ch. 3, Computability, Complexity, and Languages, 2 Edition, by Davis, Weyuker, Sigal
FeedbackErrors, comments to firstname.lastname@example.org