views:

363

answers:

4

What s the difference between a recursive set and recursive function?

+3  A: 

Perhaps the question should have been "Why is the word 'recursive' used to describe both sets and functions?"

As Greg Hewgill pointed out in his comment, the word 'green' can be applied to apples and cars, but this does not imply a relationship between apples and cars.

I think the quote from Wikipedia uses the term 'recursive' as a synonym for 'computable' — which we, as programmers, would cautiously agree with, but only in certain contexts.

pavium
NO. I dont aggree. -1 . I m reading Computability, Complexity and Languages by David and Weyuker, along with Theory of Computation by Sipser. I know the reasons they they are called like that.
That's your prerogative. Was my mistake to describe us as 'programmers'? I'm sorry, but most SO users are proud of that title.
pavium
+7  A: 

Recursive functions and recursive sets are terms used in computability theory. Wikipedia defines them as follows:

A set of natural numbers is said to be a computable set (also called a decidable, recursive, or Turing computable set) if there is a Turing machine that, given a number n, halts with output 1 if n is in the set and halts with output 0 if n is not in the set. A function f from the natural numbers to themselves is a recursive or (Turing) computable function if there is a Turing machine that, on input n, halts and returns output f(n).

In this context, a recursive function does not mean a function in a programming language that calls itself. Any mathematical function that meets the requirements of the definition above is a recursive function, including trivial ones such as the identity function or the function mapping all numbers to 1 (i.e. returns the number 1 regardless of input).

Josef Grahn
At least it's in the grey area. It's definitely computer science, but possibly not programming, depending on where the line is drawn.
Josef Grahn
"Programmer" ? are you kidding me? You should take Theoretical Computer Science class before claiming to be a programmer. print "hello world"; and i m a programmer.
+3  A: 

The meaning of these terms varies depending upon your context. If we were discussing them purely from the standpoint of writing programs then recursive sets don't make much sense; however, it might just be that I have encountered it yet. That said, recursive functions are functions that call themselves in their execution. The calculation of a nth Fibonacci number is the classic example that is commonly presented:

/// <summary>A C# implementation of a function to return the nth Fibonacci number.</summary>
private static int Fibonacci(int n) {
 if (n <= 2) {
  return 1;
 } else {
  return Fibonacci(n - 1) + Fibonacci(n - 2);
 }
}

That said, the other context for these terms in the context of computer science and specifically the theory of computation is when discussing of formal languages. In this context, a recursive set is defined to be a set for which there is a solvable membership problem. For example, we know that the set of all natural numbers ℕ is a recursive set because we can define a recursive function as follows:

Let f be defined as a function where f(x) = 1 if x ∈ ℕ and f(x) = 0 if x ∉ ℕ

The concept of a recursive set is important for the concept of computability because it leads to the recursively enumerable set which is a language that can be recognized by a Turing machine (i.e. Turing-recognizable). These are languages for which a Turing machine may or may not be able to determine if a given string is a member of a language, or in other words, the machine may either accept, reject, or loop. This is in contrast to a Turing-decidable language for which a the machine will enter into either the accept or reject state for a given input string.

This where the concept of a recursive function comes in play, as a recursive function (or total recursive function) can be computed by a Turing machine and halts for every input. Where as a partial recursive function can only be computed for a Turing machine with no guarantee in regard to halting behavior. Or in essence the recursive function is the counterpart to the recursive set.

So to bring things back around to your original question, in the context of the theory of computation, a recursive set is what can be generated (i.e. enumerated) or have membership tested by a recursive function on a Turing machine.

Further Reading:

Rob
What's with the down vote?
Rob
Definitely not down-vote-worthy. Upvoted.
McPherrinM
A: 

A primitive recursive set is a subset of N whose characteristic function (that tells when something is in

it and when it is not) is a primitive recursive function from N to {0,1}.

Your answer is the best? No. Good grief - whoring points at every chance I guess.
Paul
Agreed; tempted to delete, but I'll settle for a downvote (with reason)
Marc Gravell
This is the answer Professor gave. it s not all about the points dudes. you can vote it all the way down, this is the precise definition. You can delete it too. Wouldnt care less.
Sorry, I have down vote as well due to the answer having an incomplete feel to it. If you go back and expand upon the context and define such things as what N represents odds are I would actually up vote.
Rob
Which part should i expand? it s clear isnt it? Rob, i dont care about the points etc. I m here to ask questions. these votes doesnt mean anything at all for me. This is what the professor said as the answer, the whole sentence contains only primitive recursive set and characteristic function which is explained in paranthesis. sorry if u still didnt get.
It's not a matter of me getting the material or not, I just got done taking the graduate level version of formal systems and computation; it's more a matter of what may be a high ranking hit for Google having accurate and clear information. As noted in my previous comment, N is undefined in your response and you also aren't defining what you mean by primitive as well. For a topic such as this it should be quite easy to write at least a paragraph on something. :)
Rob
N is natural numbers, and primitive recursive function (According to Davis and Weyuker) are the functions that can be obtained by initial functions namely, successor , null and projection function, by finite number of applications of recursion and composition.
If you are referring to the Natural Numbers you should use the ℕ symbol or spell them out as it make it much clearer, even more so on a site like this where viewers default to thinking of a variable when something is undefined. Likewise, you should still go back and edit your post with the additional information and perhaps expand on what you are saying in your post. If you are referring to the "Computability, Complexity, and Languages" text then you should expand your definitions a bit as most schools use Sipser and people might be unfamiliar with the terminology.
Rob
I have read Sipser too, Sipser defines Computation in terms of TM with languages. Davis and Weyuker defines Computation in terms of a Programming Language. Melvin Fitting defines the computation via some sort of abacus. Church defines Computation with Lambda Calculus. Godel defines it with Recursion Theory and so on.
Then you should see my point, depending upon what text you are using the definitions are slightly different even though we are talking about the same thing.
Rob
Definition of Computation has been tried to be precisely defined by the above structures. They are all equivalent. However there is no Formal definition of Algorithm whereas Church Turing Thesis gives a mostly acceptable definition for algorithm, still there is no precise definition, all globally accepted definition. Look at CLRS, or Sipser you ll see "Informally algorithm is ....". I like the way Davis and Weyuker defines computation.