Let $A \subset M \vDash T$ and let $\Phi$ be a set of formulas in n variables with parameters in $A$. Suppose that for $p \neq q$ in $S_{n}(A)$ there is $\phi(\overline{x})$ such that $p \vdash \phi$ iff $q \vdash \neg \phi$. Then every formula $\psi$ over $A$ in $x_{1}, \ldots, x_{n}$ is equivalent to a Boolean combination of formulas in $\Phi$.
I know I have to solve this with compactness and it really should not be that hard, but I struggle to compose a satisfying solution. My ansatz was to use that the $\phi$ isolate the corresponding type, because elsewise the solution of $\phi$ that is not a solution of the type would give us a different type that implies $\phi$, which contradicts the assumption. Then I just wanted to look at all the types $q \in S_{n}(A)$ with $\psi \in q$, which are all implied by some formula in $\Phi$ and conclude with compactness, but I am not quite satisfied with the last step. Do you have any suggestions?
Let $\Phi'=\Phi\cup\{\neg\phi\colon\phi\in\Phi\}$. For $p\in[\psi]$ and $q\in[\neg \psi]$, by the assumption we can find $\phi_{p,q}\in\Phi'$ such that $\phi_{p,q}\in p\smallsetminus q$. For fixed $p\in[\psi]$, $\neg\psi\vdash\bigvee_{q\in[\neg\psi]}\neg\phi_{p,q}$, so by compactness among $\{\phi_{p,q}\colon q\in[\neg \psi]\}$ you can find finitely many $\{\phi_{p,i}\colon 1\leq i\leq n_p\}$ such that $\neg\psi\vdash\bigvee_{i=1}^{n_p}\neg\phi_{p,i}$. By contraposition, $\bigwedge_{i=1}^{n_p}\phi_{p,i}\vdash \psi$ and note that $\bigwedge_{i=1}^{n_p}\phi_{p,i}\in p$. Denote $\theta_p:=\bigwedge_{i=1}^{n_p}\phi_{p,i}$.
Now $\psi\vdash\bigvee_{p\in[\psi]}\theta_p$. Again by compactness we can find $p_1,\ldots,p_k\in[\psi]$ such that $\psi\vdash\bigvee_{j=1}^k\theta_{p_j}$. On the other hand, as we have seen, each $\theta_{p_j}$ implies $\psi$, hence their disjunction implies $\psi$ as well, so $\psi$ is actually equivalent to $\bigvee_{j=1}^k\theta_{p_j}$. Now recall that each $\theta_{p_j}$ is a conjunction of elements of $\Phi'$, and each element from $\Phi'$ is either itself from $\Phi$ or it is negation of an element from $\Phi$.