# Logic formula for exactly n unique objects (no more, no less)

I have a question in Logic:

If I am asked to construct a formula, using the '=' predicate, that shows that there are exactly n objects, I need to show that there are no n+1 objects, right?

For example, to show that there are exactly 3 objects, I will show that there are no 4 objects.

Also, I need to show that there exist n objects.

My question is, do I need to show that there is no case where only n-1 objects exist?

For example, to show that there are exactly 3 objects, do I need to show that there is no case in which there are only 2 objects?

If so, is that the correct form to do so? :

1) Showing that there is no case of 4 elements:

${\lnot}{\exists}x{\exists}y{\exists}z{\exists}w(x{\neq}y{\land}x{\neq}z{\land}x{\neq}w{\land}y{\neq}z{\land}y{\neq}w{\land}z{\neq}w)$

2) Showing that there are 3 elements:

${\exists}x{\exists}y{\exists}z(x{\neq}y{\land}x{\neq}z{\land}y{\neq}z)$

3) Showing that there is no case of only 2 elements:

${\lnot}{\exists}x{\exists}y{\lnot}{\exists}z(x{\neq}y{\land}x{\neq}z{\land}y{\neq}z)$

And finally, combining the three:

$(1){\land}(2){\land}(3)$

I am really not sure.

EDIT:

Actually, assuming that I do need to show that there is no case of less than 3 elements (n elements), I would probably need to show that there is no case where there is just one element as well (from 1 until n-1), am I correct?

• Where's the predicate? – Luke Mathieson Jan 17 '16 at 5:45
• Work through some examples. Can you find an example where (2) is true but (3) is false? – D.W. Jan 17 '16 at 6:53
• What is the question now? Should we just check your answer and confirm? That does not make for a good SE question. – Raphael Jan 17 '16 at 10:37
• Well, that is what I need to know. I searched online and in my course materials. Our course materials are fairly poor.. and online I found this question math.stackexchange.com/questions/139378/… From which I understood (once again, please correct me if I'm wrong) that I can just write the (1) and (2) parts, meaning I do not need to do the part where I check if there are less than 3 objects – eevee25 Jan 17 '16 at 10:50
• If you found the answer below solved your problem, you can mark it as the accepted answer by ticking the "checkmark" on the left of the answer. – D.W. Jan 18 '16 at 21:58

You need to say that (a) there are at least $n$ elements, and (b) there are at most $n$ elements. To express (a), $$L_n := \exists x_1\dotsc \exists x_n\, \left( \bigwedge_{1\le i < j \le n} x_i\ne x_j \right).$$ To express (b), $$M_n := \forall x_1\dotsc \forall x_{n+1}\, \left( \bigvee_{1\le i < j \le n+1}x_i = x_j\right).$$ So the sentence $L_n \land M_n$ holds iff there are exactly $n$ elements.