2

Let $A$ and $B$ be semi decidable languages. Moreover, $A \cup B$ and $A \cap B$ are decidable. I want to show that $B$ is decidable.

Firstly, I would like to know if the following approach works:

First, we can check if $w \in A \cup B$. Since this is decidable, we know that either $w \in A$ or $w \in B$. Now, I wanted to argue that, since $A$ is semi-decidable, so is $A^c$, where $A^c$ is the complement of $A$. Then $A^c \cap B$ is also decidable and wen can simply check if $w \in A^c \cap B$, but I am not sure if that is correct?

kklaw
  • 301
  • 1
  • 9
  • If both $A$ and $B$ are only semi-decidable, this can't be true - consider $A$ to be the language of the halting problem and $B$ its negation (i.e., $B = \overline{A}$). Since $A \cup B$ is the full set, and $A \cap B = \emptyset$, both $A \cup B$ and $A \cap B$ are trivially decidable - but neither $A$ nor $B$ is decidable! – Johannes Kloos Feb 13 '22 at 09:21
  • In your argument, if $A$ is semi-decidable, it does not follow that $A^c$ is semi-decidable - in fact, if $A$ and $A^c$ are both semi-decidable, $A$ is already decidable. – Johannes Kloos Feb 13 '22 at 09:23
  • Well, in general, your proof does not seem to work because you are not really using decidability anywhere. – Manatee Pink Feb 13 '22 at 09:24
  • @JohannesKloos I do not understand your example with $A$ being the language of the halting problem. I do not get why if $B$ is the complement of $A$, then we have that $A \cup B$ is trivially decidable? The machine can still never halt, even in the full set, can't it? – kklaw Feb 13 '22 at 09:44
  • Deciding $A \cup B$ is nevertheless trivial - note that to decide whether $x \in A \cup B$, there is no need at all to run any of the machines! You know that $x \in A \cup B$ holds for all $x$, so you can always simply output "true" immediately. – Johannes Kloos Feb 13 '22 at 10:50
  • Is this true for any language and its complement? So for any Language $L$, it holds that $L \cup L^c$ is decidable? – kklaw Feb 13 '22 at 10:52
  • Yes, this follows easily from the definition of decidable: Pick your favourite model of computation (e.g., Turing machines). A set $X$ is decidable if there is a Turing machine (or program, or algorithm, or whatever your model of computation gives you) that outputs "true" if $x \in X$, and "false" otherwise (other, more convient, return values may be substituted, or you can encode this via reaching a state of the Turing machine - all of these are equivalent). Now, suppose we have some set $X$ such that $x \in X$ for all $X$ - can you give a Turing machine that outputs "true" iff $x \in X$? – Johannes Kloos Feb 13 '22 at 16:04
  • I mean if $x \in X$ for all $X$, we can just return true without even checking or I missunderstood your question. Referring back to the Halting Problem, so we can say that checking if $w \in H \cup H^c$ is like asking: Does the $TM$ halt or not halt on $w$? Where obviously one must be the case. – kklaw Feb 13 '22 at 16:58
  • Precisely - that's why $L \cup L^c$ is (trivially) decidable for any language. Similarily, $L \cap L^c$ is also decidable for any language, since $L \cap L^c = \emptyset$. Thus, if you choose $B = A^c$ in your claim, it reduces to: "If $A$ is semi-decidable, $A^c$ is decidable", and that's clearly too good to be true. – Johannes Kloos Feb 13 '22 at 20:28
  • @JohannesKloos, "but neither $A$ nor $B$ is decidable!". Were you saying the proposition in the question is not correct? Please note that $B$, which is the complement of $A$ (the language of the halting problem), is not semi-decidable. – Apass.Jack Feb 14 '22 at 01:40
  • ... you're right, @Apass.Jack. I'll cross out the incorect parts of my comments. – Johannes Kloos Feb 14 '22 at 11:59
  • 1
    Can't edit those comments anymore. As it turns out, the statement is correct (and has a rather cute proof), and in fact, it can be strengthened: $A$ and $B$ need to be semi-decidable, and both $A \cup B$ and $A \cap B$ need only be co-semi-decidable (i.e., their complement needs to be semi-decidable). – Johannes Kloos Feb 14 '22 at 12:01
  • @JohannesKloos Nice proposition. I just added it to my answer as an exercise. – Apass.Jack Feb 14 '22 at 14:32
  • @JohannesKloos One last question, as I read this solution by another student: why can't we simply check if $w \in A \cup B$, and if so, check on two tapes if $w \in A$ or $w \in B$? Since $A,B$ are semi-decidable, a $TM$ will eventually halt. – kklaw Feb 20 '22 at 12:16
  • What if $w \in A \cap B$, and the machine for $A$ halts first? Would you claim $w \not\in B$? – Johannes Kloos Feb 20 '22 at 15:58
  • No, we could still have $w \in B$, I guess? So we would hope that the $TM$ halts on the $B$ Tape which is not certain. Do you have a trick how to "visualize" such problems easier? Or do you not write down such problems – kklaw Feb 20 '22 at 19:23
  • Hm, the best I can offer is "imagine you have a bunch of machines, running at different speeds". It's the same kind of thinking you need to work with concurrent programs - basically, "these programs will do what I want, but with the worst possible timing", and then make sure you get the right result no matter what. – Johannes Kloos Feb 21 '22 at 08:06

1 Answers1

1

"First, we can check if $w \in A \cup B$. Since this is decidable, we know that either $w \in A$ or $w \in B$."

I am failing to understand your proof right here.

  • By the definition of "decidable", we know that there is a Turing machine that upon input $w$, it will always run to a halt, telling whether $w\in A\cup B$ or not. That is vastly different from "either $w\in A$ or $w\in B$".
  • It should be allowed/possible that $w\not \in A\cup B$.

Here is an approach to prove. Instead of reasoning on the level of each input to a Turing machine, let us reason on the level of semi-decidability and decidability.

The conditions are
  1. $A=(A\setminus B)\sqcup (A\cap B)$ is semi-decidable
  2. $B$ is semi-decidable
  3. $A\cap B$ is decidable
  4. $(A\cup B)^c$ is decidable

Condition 1 and condition 3 imply

  1. $A\setminus B$ is semi-decidable.

Condition 4 and condition 5 imply

  1. $B^c = (A\cup B)^c \cup (A\setminus B)$ is semi-decidable.

Condition 2 and condition 6 imply $B$ is decidable.


Exercise (provided by Johannes Kloos). Let $A$ and $B$ be semi-decidable languages such that both $A\cup B$ and $A\cap B$ are co-semi-decidable languages. Show that $B$ is decidable.

Apass.Jack
  • 13,396
  • 1
  • 20
  • 33
  • Sorry to bother again, but I came across this problem again ( spaced repitition :D) and start to finally get it. However, how do we know that $A \setminus B$ is semi-decidable? Is it, because if it was decidable, then A was decidable? Could it also be undecidable? – kklaw Feb 22 '22 at 11:42
  • 1
    Given two languages $X$ and $Y$, if $X$ is semi-decidable and $Y$ is decidable, then $X\setminus Y$ is semi-decidable. Why? Let us enumerate $X$. However, when a string is enumerated, we check whether it is in $Y$. if it is, we remove it from the enumeration. We get an enumeration of $X\setminus Y$. – Apass.Jack Feb 22 '22 at 17:02
  • Exercise. Given two languages $X$ and $Y$, if $X$ is semi-decidable and $Y$ is decidable, then $X\cup Y$ is semi-decidable. – Apass.Jack Feb 22 '22 at 17:05
  • 1
    we can just check alternating if $w \in X$ or $w \in Y$. If it halts, we know $x \in X \cup Y$, But it may happen it does never halt, since $X$ is only semi-decidable. This also why, we cannot be sure that if $w \in X \cup Y$ that $w \in Y$. – kklaw Feb 22 '22 at 17:12