For a fixed countably infinite structure $\Gamma$ with finite relational signature $\tau$, we study the following computational problem: input are quantifier-free $\tau$-formulas $\phi_0,\phi_1,\dots,\phi_n$ that define relations $R_0,R_1,\dots,R_n$ over $\Gamma$. The question is whether the relation $R_0$ is primitive positive definable from $R_1,\dots,R_n$, i.e., definable by a first-order formula that uses only relation symbols for $R_1, \dots, R_n$, equality, conjunctions, and existential quantification (disjunction, negation, and universal quantification are forbidden).
We show decidability of this problem for all structures $\Gamma$ that have a first-order definition in an ordered homogeneous structure $\Delta$ with a finite relational signature whose age is a Ramsey class and determined by finitely many forbidden substructures. Examples of structures $\Gamma$ with this property are the order of the rationals, the random graph, the homogeneous universal poset, the random tournament, all homogeneous universal $C$-relations, and many more. We also obtain decidability of the problem when we replace primitive positive definability by existential positive, or existential definability. Our proof makes use of universal algebraic and model theoretic concepts, Ramsey theory, and a recent characterization of Ramsey classes in topological dynamics.
"Decidability of definability." J. Symbolic Logic 78 (4) 1036 - 1054, December 2013. https://doi.org/10.2178/jsl.7804020