In The logic of provability, by G. Boolos, we are asked to ponder about this statement:
If this statement is consistent, then you will have an exam tomorrow, but you cannot deduce from this statement that you will have an exam tomorrow.
I tried formalizing it the following way:
Let $p$ stand for the whole statement, and $q$ is going to be true iff I have an exam tomorrow.
Then the paragraph is stating that: $$ p\leftrightarrow \diamond (p\rightarrow q)\wedge \neg\square(p\rightarrow q) $$
Solving the fixed point using any of the usual methods will give us that: $$ GL\vdash \boxdot [p\leftrightarrow A(p,q)]\implies \boxdot[p\leftrightarrow \bot] $$ Where $A(p,q)$ stands for the right hand side of the first formula.
Therefore, we can conclude by neccesitation and modus ponens that if $p$ and $q$ are suitable chosen statements of $PA$ satisfying the first formula then: $$ PA\vdash \neg p $$ Therefore we conclude that the statement is false under every interpretation of $PA$, and therefore it gives no information about $q$.
Is my reasoning correct? Is my conclusion pertinent?
Take any consistent theory $T$ satisfying the provability conditions and the fixed point lemma.
Take any sentence $q$ over $T$. $\def\imp{\rightarrow}$ $\def\eq{\leftrightarrow}$ $\def\box{\square}$ $\def\diam{\lozenge}$
Your equation
By the fixed point lemma there is a sentence $p$ over $T$ such that $T \vdash p \eq \diam( p \imp q ) \land \neg \box( p \imp q )$.
Equivalently $T \vdash p \eq \neg \box( p \land \neg q ) \land \neg \box( \neg p \lor q )$.
Note that $T \vdash \box \neg p \imp \box( p \imp q )$ by (D1) and (D2).
Thus $T \vdash p \imp \neg \box \neg p$ and hence $T \vdash \box \neg p \imp \neg p$.
Therefore by Lob's theorem $T \vdash \neg p$.
Anyway...
Literal question
You translated the sentence wrongly. Literally, $T \vdash p \eq ( \diam p \imp q ) \land \neg \box( p \imp q )$. [$\diam$ before $\imp$!]
Equivalently $T \vdash p \eq ( \box \neg p \lor q ) \land \neg \box( p \imp q )$.
It so happens that the above reasoning works here too, giving $T \vdash \neg p$.
So your first claim is correct though I have no idea whether your reasoning is valid.
But I don't get your reasoning about $q$; how does $T \vdash \neg p$ imply anything about $q$? If you're just saying that the teacher is a liar, then I agree with you.
Probable intended question
The original sentence is ambiguous, and I first interpreted it with "but" binding first before "then".
In this case you want $T \vdash p \eq ( \diam p \imp q \land \neg \box( p \imp q ) )$. [$\diam$ first!]
Equivalently $T \vdash p \eq \box \neg p \lor q \land \neg \box( p \imp q )$.
If $T \vdash \neg p$, then $T \vdash \box \neg p$ by (D1) and hence $T \vdash p$, which is impossible.
Thus the teacher is making a consistent statement over $T$.
At this point it would be erroneous to reason as follows:
$p$ is consistent. Thus $q$ is true and hence $p \imp q$. So we have deduced from $p$ that $q$ is true.
So this is probably the intended interpretation so that there is this 'paradox'. Once you write in terms of $\box$ it is clear that the error is right at the start, because $T$ is unable to prove $\neg \box \neg p$.