Here is a question from mathematical logic:
Let $\mathcal L$ be a language with at least a constant symbol $c$, and let $\varphi$ be an existential $\mathcal L$-sentence, say $\exists x_1\cdots \exists x_n \psi(x_1,\dots,x_n)$. Show that $\vdash \varphi$ iff that there is $m > 0$ and terms $t^i_j$ for $1 \leq j \leq n$ and $i < m$ so that $\vdash \bigvee_{i<m} \psi(t^i_1,\dots,t^i_n)$.
I am given the hint to use compactness from mathematical logic, that a set of sentences $T$ has a model iff every finite usbset $T_0 \subset T$ has a model. I have proven the forward direction; it now remains to show that $\vdash \varphi$ implies that there is $m > 0$ and terms $t^i_j$ for $1 \leq j \leq n$ and $i < m$ so that $\vdash \bigvee_{i<m} \psi(t^i_1,\dots,t^i_n)$. Since $\emptyset \vdash \varphi$, it follows by Godel's completeness theorem that $\emptyset \vDash \varphi$. Let $\mathcal M$ be an $\mathcal L$ structure with universe $M$. Then $\mathcal M \vDash \phi$, so that there are $z_1,...,z_n \in M$ such that $\phi(z_1,...,z_n)$ holds true in $\mathcal M$. However, I am stuck after this. Can you help?
Given a structure $\mathcal{M}$ let us denote by $\mathcal{M}_0$ the intersection of all substructures of $\mathcal{M}$. We can construct $\mathcal{M}_0$ explicitly as follows $$ M_0 = \{ t^\mathcal{M} : t \text{ is a closed term in } \mathcal{L} \}, $$ where $t^\mathcal{M}$ denotes the interpretation of the term $t$ in $\mathcal{M}$ and a closed term is one without variables. Then we take $\mathcal{M}_0$ to be the substructure of $\mathcal{M}$ with underlying set $M_0$. Note that $\mathcal{M}_0$ is non-empty because the language has at least one constant symbol.
Note: the above is a special case of a substructure generated by a subset. In this case we take the substructure generated by the empty set.
Now let $\phi$ and $\psi$ be as in your question, with the stipulation that $\psi$ is quantifier-free (which we can assume, as $\phi$ is existential).
Claim. For any $\mathcal{L}$-structure $\mathcal{M}$ there are closed terms $t_1, \ldots, t_n$ such that $\mathcal{M} \models \psi(t^\mathcal{M}_1, \ldots, t^\mathcal{M}_n)$.
Proof. Since $\vdash \phi$, we have $\mathcal{M}_0 \models \phi$ (this is as you argued, though the correct term is "soundness" not "completeness"). So let $a_1, \ldots, a_n \in \mathcal{M}_0$ such that $\mathcal{M}_0 \models \psi(a_1, \ldots, a_n)$. Since $\psi$ is a quantifier-free formula, we have $\mathcal{M} \models \psi(a_1, \ldots, a_n)$. By construction of $\mathcal{M}_0$ there are closed terms $t_1, \ldots, t_n$ such that $a_i = t^\mathcal{M}_i$ for all $1 \leq i \leq n$. Hence $\mathcal{M} \models \psi(t^\mathcal{M}_1, \ldots, t^\mathcal{M}_n)$. This proves the claim.
Consider the set of formulas $$ \Sigma = \{\neg \psi(t_1, \ldots, t_n) : t_1, \ldots, t_n \text{ are closed } \mathcal{L}\text{-terms} \}. $$ By the claim we have that $\Sigma$ is inconsistent. So by compactness we have that there is finite $\Sigma_0 \subseteq \Sigma$, which is inconsistent. Write $$ \Sigma_0 = \{\neg \psi(t^i_1, \ldots, t^i_n) : i < m\}. $$ Then it follows that $\bigwedge_{i < m} \neg \psi(t^i_1, \ldots, t^i_n)$ does not hold in every $\mathcal{L}$-structure. Hence $\models \neg \bigwedge_{i < m} \neg \psi(t^i_1, \ldots, t^i_n)$ and so by completeness we now conclude $\vdash \neg \bigwedge_{i < m} \neg \psi(t^i_1, \ldots, t^i_n)$, as required.