TITLE: Is there a consistent arithmetically definable extension of PA that proves its own consistency?
QUESTION [15 upvotes]: I asked this on stackexchange with no answer.
The negation would be the obvious generalization of Gödel's second incompleteness from r.e. extensions of PA to any arithmetically definable extension of PA.
I see that there is a complete consistent $\Sigma^0_2$ extension of PA. Said theory therefore contains either the sentence "I am consistent" or "I am inconsistent". However, just because it's consistent and complete doesn't mean it contains the sentence "I am consistent" — it could contain the sentence "I am inconsistent", and remain consistent by being such that any model is a nonstandard model in which there exists a strictly nonstandard proof of its inconsistency

REPLY [8 votes]: I add some history to the Joel's answer and also some generalizations.
A similar example can be found in this article by R. Jeroslow. It is also possible to construct a complete and $\Sigma_2$(in fact $\Delta_2$) definable theory which proves its own consistency, see this aricle of M. Kasa. I have presented another method for constructing such a theory 
in this paper which also proves this generalization :
For every $n>1$ there is a complete $\Delta_n$-definable
theory $T$ which contains PA, "T contains PA" is PA-provable and $T$ proves its own $\Sigma_{n-2}$-soundness.
(note that for $\Sigma_1$-complete theories, $\Sigma_0$-soundness is equivalent to simple consistency). 
It is also proved that if the theory $T$ is $\Sigma_n$-definable, $\Sigma_{n-1}$-sound and "T contains PA" is PA-provable, then $T$ can not prove its own $\Sigma_{n-1}$-soundness and it can be seen as a generalization of the second incompleteness theorem.