A logic riddle from "The Lady or the Tiger?" by Raymond Smullyan Just to clarify, Case 3 and Case 4 must have flawed reasoning in order to reconcile my proof with the author's.
I have been having a problem with a particular riddle from Raymond Smullyan and I can't seem to reconcile my proof with his solution. I am more inclined to think I am wrong, but to myself my proof looks quite convincing. Maybe you'll be able to point out the flaw in my logic.
Background: There are natives on the Isle of Questioners that are either of Type A or Type B. People of Type A may only ask questions to which the correct answer is "Yes" such as "Does 2 + 2 = 4?". People of Type B may only ask questions to which the correct answer is "No" such as "Does 2 + 2 = 5?". Furthermore there are people who have wandered onto the island who are either sane or insane. People who are sane are completely sane and believe all true things, they will always answer honestly and accurately. People who are insane are completely insane and believe all untrue things, they will always answer honestly and inaccurately. And all parties involved have perfect knowledge of the universe, but whether they are correct or incorrect about it depends on their sanity.
Problem: You meet a native and a sane or insane person named Thomas. The native asks Thomas, "Do you believe I am the type who could ask you whether you are insane?" What can be deduced about the native, and what can be deduced about Thomas?
My (failed?) attempt at a solution: There are four cases: the native is Type A and Thomas is sane, the native is Type A and Thomas is insane, the native is Type B and Thomas is sane, and the native is Type B and Thomas is sane. (In Case 1 and 2 my proof follows the author's almost exactly. Smullyan simply says of Case 3 and 4, "The only way out of the contradiction is that the native must be of Type B rather than Type A" but I still reach a contradiction.)
Case 1: Suppose that the native is Type A. Then the answer to the question is "Yes" and Thomas must believe that the native can ask whether he is insane. Now suppose that Thomas is sane, which means that Thomas must be correct in his belief. So the correct answer to the question "Are you insane?" when posed to Thomas must be "Yes" since the native could ask the question. Thus Thomas is insane as well as sane and this is a contradiction. The first case is impossible.
Case 2: Suppose that the native is Type A. Then the answer to the question is "Yes" and Thomas must believe that the native can ask whether he is insane. Now suppose Thomas is insane, which means that Thomas must be incorrect in his belief. So the correct answer to the question "Are you insane?" when posed to Thomas must be "No" since the native could not ask the question. (Thomas would indeed say "No" but be incorrect because he is insane and believes he is sane.) Thus Thomas is sane as well as insane and this is a contradiction. The second case is impossible.
Case 3: Suppose that the native is Type B. Then the answer to the question is "No" and Thomas must believe that the native can not ask whether he is insane. Now suppose Thomas is sane, which means that Thomas must be correct in his belief. So the correct answer to the question "Are you insane?" when posed to Thomas must be "Yes" since the native could not ask the question. Thus Thomas is insane as well as sane and this is a contradiction. The third case is impossible.
Case 4: Suppose that the native is Type B. Then then answer to the question is "No" and Thomas must believe that the native can not ask whether he is insane. Now suppose Thomas is insane, which means that Thomas must be incorrect in his belief. So the correct answer to the question "Are you insane?" when posed to Thomas must be "No" since the native could ask the question. Thus Thomas is sane as well as insane and this is a contradiction. The fourth case is impossible.
Can you see a flaw in my logic? I've tried to re-approach this problem and poke holes in my own proof, but I can't reach any other conclusion other than this encounter between the native and Thomas must have been impossible.
 A: Oops: my previous analysis was wrong.  A type A native asks a question for which the correct answer, not necessarily the answer that will be returned, is Yes.  
If  a proposition $Q$ is true, a sane Thomas believes it, and an insane Thomas does not.   If $Q$ is false, a sane Thomas does not believe it, and
an insane Thomas does.
So: a type A native can ask Thomas "do you believe $Q$?" if and only 
Thomas believes $Q$, i.e. either $Q$ is true and Thomas is sane or $Q$ is false and Thomas is insane.  A type B native can ask "do you believe $Q$?" if
$Q$ is true and Thomas is insane or $Q$ is false and Thomas is sane.
There are four possibilities, which I'll denote $(A,Q,S)$, $(A,\neg {Q},\neg{S})$, $(\neg A,  Q, \neg S)$, $(\neg A, \neg Q, S)$. 
In this case $Q$ is "I am the type who could ask you "are you insane".
$Q$ is true iff the native is type A and Thomas is insane or the native is type B and Thomas is sane.   In the same notation as above, the possibilities are $(A, Q, \neg S)$, $(\neg A, Q, S)$, $(A, \neg Q, S)$, $(\neg A, \neg Q, \neg S)$.  
The intersection of these two sets is empty.
Thus there is no case where the native could ask "Do you believe I am the type who could ask you "are you insane?"?".
A: We can analyze this question using boolean algebra. Let $p$ represent whether the native is type A (true) or type B (false), and let $q$ represent whether Thomas is sane (true) or insane (false).
The statement "Can the native ask the question 'Is Thomas insane?'" is logically equivalent to $p\oplus q$, where $\oplus$ is XOR or exclusive or. 
The statement "Does Thomas believe that the native can ask the question 'Is Thomas insane?'" is logically equivalent to $(p\oplus q)\Leftrightarrow q$, which is equivalent to $\neg p$. Here, $\Leftrightarrow$ represents "if and only if". 
The statement "Can the native ask 'Do you believe I am the type who could ask you whether you are insane?'" is logically equivalent to $\neg p\Leftrightarrow p$, which is always false. 
A: Your reasoning for Case 4 might be flawed: If Thomas is insane, then his answer to the question "Are you insane" must be "No". For this reason you could consider this the correct answer to the question, in which case there is no contradiction.
A: The answer to "Are you insane?" will be "No" from anybody who is sane or insane
The type who asks questions with the answer "No" is type B, so the original question is equivalent to "Do you believe I am type B?"
This can be asked by a Type B native to an insane person, who will give the answer "No", and a Type B person can also ask "Are you insane?"
A: I don't follow your argument for case 3. The question as posed must be answered "No" if the native is type B; and if Thomas is sane, he will answer "No" truthfully. For if the native asks a sane Thomas, "Are you insane?", then he will answer "No." This will only work if the native is Type B.
A: New answer.  I think Smullyan is wrong.  If the types can ask based on the correct answer and not and the responder answer than:
Type A => Thomas believes.
Thomas sane => native is type.  => type a => Thomas insane.  Contradiction.
Thomas insane=> native not type.  Native A => Thomas not insane. Contradiction.
So native type B.
So Thomas Does not believe.
Thomas sane=> Thomas correct and native not type.  Type B => Thomas is insane.  Contradiction.  
Thomas insane=> Thomas is wrong =I native is type=> Thomas not sane.  Incorrect.
===
Other option.  Type A can ask if answer is answered yes/no whether or not it is actually correct.
Case 1.  Type A.  Sane.
Then answer is yes=>Thomas believes he believes =>Thomas believes => native is type=>Thomas believes he is insane=>Thomas is insane. Contradiction.
Case 2 type A. Insane.
Answer yes => Thomas believes he believes => Thomas doesn't believe native is type=> native is  type=>answer "are you insane" is yes=> Thomas believes he is insane=> Thomas is sane. 
contradiction
Case 3 Type B. Sane
Answer is no=>Thomas believes he does not believes native is type=>Thomas does not believe native is type=>native is not type=>answer to are you insane is yes=> Thomas believes he is insane=> Thomas is insane. Contradiction.
Case 4. B. Insane
Answer no=>Thomas believes Thomas does not believe native is type=>Thomas does believe native is type=>native is not type=>answers were to are you insane is yes=>Thomas believes he is insane=> Thomas is sane.  Contradiction.
Impossible
Either way Smullyan is wrong.case is never possible.
==e=e
Ignore rest.  It is wrong.
1, type A.  Thomas is sane.
Are you insane? No.  Thomas answer no
Can I ask you if are insane? No. Thomas answer no.
I'm I the type who can ask? No.  Thomas answer no.  
Do you think I am the type? No.  Thomas answer. No.
Can it be asked. No.
2) native type B.  Thomas sane.
Are you insane.  Answer no.
Am I the type who can ask? Yes.
Do you believe I am the type? Yes.
Can the native ask? No.
3) Native type A. Thomas insane.
Are you insane? Answer yes.  Thomas answers No.
Am I the type who can ask? Answer no.  Thomas answer yes.
Do you believe I am the type? Answer yes.  Thomas answer no.
Can native ask? No.
4)type b. Thomas insane.
Are you insane? A: yes. T: no
Am I the type? A yes.  T no.
Do you believe I am the type? A no. A yes.
Can native ask? No.
This situation can not
