Propositions for recursive functions

  • MHB
  • Thread starter evinda
  • Start date
  • Tags
    Functions
In summary: I don't remember seeing anything other than a function after the phrase "a Turing machine computes". And I don't really care about what you write with words. You can give whatever definitions you see fit. The important thing is that you can formulate precise statements and write them using...words.
  • #1
evinda
Gold Member
MHB
3,836
0
Hello! (Wave)

I want to show the following two propositions:

  • The domain of a recursive function is recursively enumerable.
  • The range of a recursive function is recursively enumerable.

I have thought the following in order to prove the first proposition.

Suppose that we have a recursive function $f$. Then we know that there is an algorithm $A$ that computes $f$.
So if $m \in dom(f)$ then we know that the algorithm $A$ with input $m$ terminates, giving output "yes".
Since $m$ is arbitrary, we deduce that the domain of a recursive function is recursively enumerable.

Is my idea right? If so, can't we also deduce from that that the domain of a recursive function is recursive since the algorithm always terminates for the elements of the domain? (Thinking)
 
Physics news on Phys.org
  • #2
evinda said:
  • The domain of a recursive function is recursively enumerable.
  • The range of a recursive function is recursively enumerable.
By "recursive function" do you mean partial recursive function?

evinda said:
Suppose that we have a recursive function $f$. Then we know that there is an algorithm $A$ that computes $f$.
So if $m \in dom(f)$ then we know that the algorithm $A$ with input $m$ terminates, giving output "yes".
Since $A$ computes $f$, it outputs whatever $f$ outputs and not necessarily "yes".

evinda said:
Since $m$ is arbitrary, we deduce that the domain of a recursive function is recursively enumerable.
I don't see how it follows, but it may depend on the definition you are using. Please remind the definition of a recursively enumerable set. Also please write the facts (similar to the statements from this problem) that you may use.
 
  • #3
Evgeny.Makarov said:
By "recursive function" do you mean partial recursive function?

I mean a total recursive function.

Evgeny.Makarov said:
Since $A$ computes $f$, it outputs whatever $f$ outputs and not necessarily "yes".

I don't see how it follows, but it may depend on the definition you are using. Please remind the definition of a recursively enumerable set. Also please write the facts (similar to the statements from this problem) that you may use.

Yes, now I think so too that I am wrong.A subset $A$ of $\mathbb{N}^k$ is recursively enumerable iff there is a Turing machine $T$, such that $\forall x \in A$, $T$ with input $x$ halts , giving output $1$ and $\forall x \notin A$, $T$ does not halt, i.e. $T$ computes the function

$\phi(x)=\left\{\begin{matrix}
1 & \text{ if } x \in A \\
\infty & \text{ if } x \notin A
\end{matrix}\right.$

A subset $A$ of $\mathbb{N}^k$ is recursive iff $A$ and $A^c$ are recursively enumerable.
 
  • #4
evinda said:
I mean a total recursive function.
So you are not sure how to show that $\mathbb{N}^k$ is r.e.? Since the domain of a total function is $\mathbb{N}^k$.
 
  • #5
Evgeny.Makarov said:
So you are not sure how to show that $\mathbb{N}^k$ is r.e.? Since the domain of a total function is $\mathbb{N}^k$.

Oh yes, that's true. Maybe we have to show the statement for both total and partial recursive functions. (Thinking)

Having $\mathbb{N}^k$ as the domain , we can write a program that checks if a vector contains only natural numbers and so $\mathbb{N}^k$ is recursively enumerable. Right?
 
  • #6
evinda said:
Maybe we have to show the statement for both total and partial recursive functions.
The domain of a partial recursive function is indeed r.e.

evinda said:
Having $\mathbb{N}^k$ as the domain , we can write a program that checks if a vector contains only natural numbers and so $\mathbb{N}^k$ is recursively enumerable. Right?
Yes.
 
  • #7
Evgeny.Makarov said:
The domain of a partial recursive function is indeed r.e.

Suppose that we have a partial recursive function $f$. Then there is a Turing machine $A$ that computes $f$.
We construct a Turing machine $M$ such that if $A(m)$ terminates for some $m \in \mathbb{N}$ then $M$ terminates giving output $1$ and otherwise $M$ does not terminate. Then $M$ computes the domain of $f$ and thus the domain of $f$ is recursively enumerable.

Is my idea right?
 
  • #8
I would not say "$M$ computes the domain of $f$". Usually one says "computes a function". Otherwise I agree.
 
  • #9
Evgeny.Makarov said:
I would not say "$M$ computes the domain of $f$". Usually one says "computes a function". Otherwise I agree.

Then $M$ computes the characteristic function of the domain of $f$ and thus the latter is recursively enumerable. Right?
 
  • #10
evinda said:
Then $M$ computes the characteristic function of the domain of $f$
No, a characteristic function is total.
 
  • #11
Evgeny.Makarov said:
No, a characteristic function is total.

A Turing machine can also compute a statement, right? So can we say that then $M$ computes the statement "is the element an element of the domain of $f$", deducing in this way that the domain of $f$ is recursively enumerable?
 
  • #12
evinda said:
A Turing machine can also compute a statement, right?
I don't remember seeing anything other than a function after the phrase "a Turing machine computes". And I don't really care about what you write with words. You can give whatever definitions you see fit. The important thing is that you can formulate precise statements and write them using formulas.
 
  • #13
Writing this I was thinking about an answer of yours, at an other post of me, namely this one:

It is important that "$A(m)$ terminates within $n$ steps" is a decidable statement. That is, there is a Turing machine $M$ (or a Java method, C function, etc.) that for given $m$ and $n$ will always terminate and return "yes" or "no" depending on whether this statement is true or false.

So I think that I didn't formulate it correctly. Is it more clear as follows?

We construct a Turing machine $M$ such that if $A(m)$ terminates for some $m \in \mathbb{N}$ then $M$ halts giving output $1$, otherwise $M$ does not halt. So we see that the statement "$x$ is an element of the domain of $f$" is recursively enumerable and so the domain of $f$ is recursively enumerable.
 
  • #14
This is OK. Usually the term "r.e." is applied to sets, but it can be applied to predicates (as you are writing) if you explicitly define what it means. I would simply say after defining $M$ that the domain of $f$ is r.e. by definition.
 
  • #15
Ok.

For the second proposition I have thought the following:
Suppose that $f$ is a recursive function. Let $y \in image (f)$. We construct $M$ like that:
We run $f$ on $0,1,2, \dots$ and if $f(n)=y$ for some $n \in \mathbb{N}$ then $M$ terminates giving input $1$, otherwise $M$ loops forever. So the range of a recursive function is recursively enumerable.

Am I right?

Does it also hold that if $A$ is recursively enumerable then $A$ is the range of some recursive function?
If so, how can we find a function whose range is $A$?
 
  • #16
evinda said:
Suppose that $f$ is a recursive function. Let $y \in image (f)$. We construct $M$ like that:
We run $f$ on $0,1,2, \dots$ and if $f(n)=y$ for some $n \in \mathbb{N}$ then $M$ terminates giving input $1$, otherwise $M$ loops forever.
If $y \in image (f)$, then the second option is impossible.

evinda said:
Does it also hold that if $A$ is recursively enumerable then $A$ is the range of some recursive function?
Or $A=\emptyset$.

evinda said:
If so, how can we find a function whose range is $A$?
It was discussed in https://driven2services.com/staging/mh/index.php?threads/19389/.
 
  • #17
Evgeny.Makarov said:
If $y \in image (f)$, then the second option is impossible.

Oh yes, that's right... It should be as follows, right?

Suppose that $f$ is a recursive function. We construct $M$ like that:
We run $f$ on $0,1,2, \dots$ and if $f(n)=y$ for some $n \in \mathbb{N}$ then $M$ terminates giving input $1$, otherwise $M$ loops forever. So the range of a recursive function is recursively enumerable.
Evgeny.Makarov said:
Or $A=\emptyset$.

It was discussed in https://driven2services.com/staging/mh/index.php?threads/19389/.

I see.
 
  • #18
evinda said:
Suppose that $f$ is a recursive function. We construct $M$ like that:
Given input $y$, $M$ runs
evinda said:
$f$ on $0,1,2, \dots$ and if $f(n)=y$ for some $n \in \mathbb{N}$ then $M$ terminates giving input $1$, otherwise $M$ loops forever.
Thus, $M$ terminates on elements of the image of $f$ and only on them, i.e., the image of $f$ is r.e.
 
  • #19
Evgeny.Makarov said:
Given input $y$, $M$ runs
Thus, $M$ terminates on elements of the image of $f$ and only on them, i.e., the image of $f$ is r.e.

I see... Thanks a lot! (Smile)
 

FAQ: Propositions for recursive functions

What is a recursive function?

A recursive function is a function that calls itself within its own definition. This allows for the function to repeat a specific set of steps or calculations until a base case is reached.

What is a base case in a recursive function?

A base case is a condition that, when met, signals the end of the recursive function. It is necessary to prevent the function from infinitely calling itself and causing a stack overflow.

How do recursive functions differ from iterative functions?

Recursive functions differ from iterative functions in that they repeatedly call themselves, while iterative functions use looping structures to repeat a set of steps a certain number of times. Recursive functions are often more elegant and concise, but may also be less efficient for certain problems.

What are some examples of problems that can be solved using recursive functions?

Some examples of problems that can be solved using recursive functions include calculating the factorial of a number, finding the nth term in a Fibonacci sequence, and traversing a binary tree data structure.

Are there any limitations to using recursive functions?

Yes, there are some limitations to using recursive functions. One limitation is that they may require more memory and time to execute compared to iterative functions. Additionally, if the base case is not reached, the function will continue to call itself indefinitely, leading to a stack overflow error.

Similar threads

Replies
13
Views
4K
Replies
5
Views
3K
Replies
1
Views
2K
Replies
1
Views
5K
Replies
1
Views
1K
Replies
11
Views
4K
Replies
6
Views
2K
Back
Top