7
$\begingroup$

My question is a follow-up question to this one: How to show that a function is computable?

The original question was:

Is the following function $$g(x) = \begin{cases} 1 & \mbox{if } \phi_x(x) \downarrow \mbox{or } x \geq 1 \\ 0 & \mbox{otherwise } \end{cases}$$ computable?

The accepted answer was that this function is computable because it is either the constant 1 function or the function that is 1 everywhere except on input 0.

According to my professor at university, this answer is in fact correct. But I don't understand the intuition behind it.

As far as I know, “computable” means (amongst other things) that there is an algorithm that actually can compute the function. I don't really get how such an algorithm would look in this case. Obviously, if $x\geq 1$, the algorithm can immediately return 1. But if the input is 0, the algorithm would have to simulate $\phi_0(0)$. If $\phi_0$ terminates on input 0, then the algorithm can return 1. But if $\phi_0$ doesn't terminates on input 0, the algorithm will run forever and never return 0.

So my understanding of the concept “computable” is in conflict with its actual meaning. Can someone explain where the error in my reasoning lies?

$\endgroup$
  • 14
    $\begingroup$ There exists an algorithm does not imply we know what the algorithm is. $\endgroup$ – André Nicolas Feb 7 '16 at 15:41
  • 2
    $\begingroup$ It seems you are rather interested in the following question: Is the statement "$\forall x\colon g(x)=1$" decidable? $\endgroup$ – Hagen von Eitzen Feb 7 '16 at 15:44
  • $\begingroup$ What is the connection between the concepts computable and decidable? $\endgroup$ – Xaver Feb 7 '16 at 15:55
7
$\begingroup$

What you have there is a definition of a function $g$, not an algorithm for computing it. The definition is written in the language of mathematics, where "$a$ or $b$" is equivalent to "$b$ or $a$", not in a programming language, where "$a$ or $b$" might mean "first evaluate $a$, and if it's true then the statement is true, otherwise evaluate $b$ and let that be the truth value of the statement". In particular, the first case of the definition doesn't mean "first compute $\varphi_x(x)$, and if it halts, see if $x\ge 1$; if so, return $1$".

Relative to whatever formalism we adopt — Turing machines, lambda calculus, transformational grammars, etc. — $\varphi_0(0)\!\!\downarrow$ has some truth value $tv$. We may already know what it is (it halts quickly, or provably it doesn't halt), we may not yet know (it hasn't halted yet), or we may never find out (because it really is false). In any case, $g$ is equal to one of two computable functions, each of which has a trivial algorithm that doesn't give a hoot about about $\varphi_0$ and how it behave on input $0$. Whichever function $g$ is, it's computable. Just which one it is depends upon $tv$, so we may not be able to say which function $g$ actually is.

This is reminiscent of the very nonconstructive proof that there are irrationals $x,y$ such that $x^y$ is rational: if ${\sqrt 2}^{\sqrt 2}$ is rational, let $x=y={\sqrt 2}$; otherwise, let $x={\sqrt 2}^{\sqrt 2}, y = {\sqrt 2}$. (In fact, the fun has been spoiled: someone has proved that ${\sqrt 2}^{\sqrt 2}$ is irrational. So perhaps ${\sqrt 3}^{\sqrt 2}$, going forward :) Similarly, the definition of $g$ is not constructive: it uses the law of excluded middle in an essential way. The proof that $g$ exists (i.e. that it's even well-defined) is a nonconstructive existence proof of an algorithm, not an algorithm.

$\endgroup$
  • $\begingroup$ So, to sum it up, I thought of “computable” in the way of intutionistic logic (where $a\lor b$ means that we know which of them is true), but in reality the concept of computability is more a concept of classical logic (where $a\lor b$ means that a or b is true, but we don't necessarily know which of them). So, “computable” doesn't mean that you can really compute a function, because you don't necessarily know an algorithm to do so. Would you agree to this statement? $\endgroup$ – Xaver Feb 7 '16 at 16:54
  • $\begingroup$ Yes, that is right, there exists an algorithm but we don't know which one. There are even situations where we can't possibly know, for example if $K(x)$ is the Kolmogorov complexity, there exists a $n_0$ such that for all $n \gt n_0$, no statement of the form $K(x) \gt n$ is provable. Yet there is an algorithm that outputs $1$ if $K(x) \gt n_0 + 1000000$ and outputs $0$ otherwise, because there are only a finite number of strings with Kolmogorov complexity less than any constant. $\endgroup$ – Dan Brumleve Feb 7 '16 at 17:10
  • $\begingroup$ No, I wouldn't agree to that statement, no. Intuitionistically, $a\lor b$ means you have a construction for $a$ or you have one for $b$. The definition of $g$ would be intuitionistically valid if we could prove that $g$ is constantly $1$, or we could prove that $g$ is the other function — and we can't. Computability is in fact more stringent than the construction principles that Brouwer felt were legitimate. Classically, $g$ is some function that can be computed, but we can't produce an algorithm that computes it. Classically, $g$ is some computable function, either this one or that one $\endgroup$ – BrianO Feb 7 '16 at 17:11
  • $\begingroup$ (Oops, redundant last sentence in previous comment, too late to fix) Despite my "No," and @DanBrumleve 's "Yes, ", it seems we mean the same thing. It's important to distinguish between (*) computability and (**) its classical-logic-based metatheory, which tolerates non-constructive existence proofs. $g$ is defined in the latter, it's not defined by presenting an algorithm and saying that $g$ is the function computed by the algorithm. Similarly with the irrationals $x,y$ that the proof I cited yields: can you now compute $x$ to within $0.0001$? Hardly. $\endgroup$ – BrianO Feb 7 '16 at 17:25
5
$\begingroup$

A function is not the same thing as the words used to describe it. The function is the just the mapping of inputs to outputs. That mapping can be described in infinitely many different ways. For example, the identity function could be described both as "Given $x$, output $x$", or as "Given $x$, add $5$ to $x$. Now multiply $x$ by $3$, and subtract $15$. Now divide by $3$. Output the result."

The question "is this function computable" means "does there exist an algorithm which happens to produce the same outputs as this function for all inputs", and not "does there exist an algorithm which resembles this description of the function", because you're asking about the function, not the particular description of it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.