Consider the following exercise, taken from my course book on model and proof theory:
Let L be the empty language, so an L-structure is “just” a nonempty set M. Express by means of an L-sentence that M has exactly 4 elements.
I'm not entirely sure how to approach this; somehow, I have to use only variables and the standard logical symbols to "force" the underlying set to be of size four. It seems like it shouldn't be too hard, but I still lack intuition on how to construct such sentences. Any help is appreciated!
Perhaps the simplest way of expressing that $M$ has exactly four elements is $$\exists a\exists b\exists c\exists d[\neg(a=b\lor a=c\lor a=d\lor b=c\lor b=d\lor c=d)\land\forall x[x=a\lor x=b\lor x=c\lor x=d]]$$ The first set of equalities, wrapped under the negation, means that $a,b,c,d$ are different, so $M$ has at least four elements. The second set of equalities, in the universal quantifier's scope, means that all elements are equal to one of these four, so $M$ has at most four elements. The two combine and force $M$ to have exactly four elements.