# Why "to every set and to every statement p(x), there exists {$x\in A | p(x)$}?

As a rule, to every set A and to every statement p(x) about $x\in A$, there exists a set {$x\in A | p(x)$} whose elements are precisely those elements x of $A$ for which the statement $p(x)$ is true. In an axiomatic approach to set theory, this rule is usually postulated as an axiom, called $\color{blue}{\text{the Axiom of Specification}}$
The symbol {$x\in A | p(x)$} reads: the set of all x in A such that p(x) is true. The notation of the form {$x\in A | p(x)$} which describes a set is called the $\color{blue}{\text{set builder notation}}$.
Source: Set Theory by You-Feng-Lin and Shwu-Yeng T.Lin

I don't understand "to every set A and to every statement p(x) about $x\in A$, there exists a set {$x\in A | p(x)$} whose elements are precisely those elements x of $A$ for which the statement $p(x)$ is true." because if $A$ is emptyset $\{\}=\emptyset$, then in {$x\in \emptyset | p(x)$}, $x\in \emptyset$ is a contradiction. Am I mistaken? Or can you give a further explanation?

[EDIT: I now understand the contradiction part leads to the conclusion of emptyset] If $A=\emptyset$, then there exists a set {$x\in \emptyset | p(x) \}$. And {$x\in \emptyset | p(x) \} =\emptyset$

[proof of {$x\in \emptyset | p(x) \} = \emptyset$]
$\{x\in \emptyset| x=3k \space \text{for some}\space k\in Z \} \neq \emptyset$
$\Leftrightarrow x\in \{x \in \emptyset| x=3k \space \text{for some} \space k\in Z\}$
$\Leftrightarrow \exists x\in \emptyset$, x = 3k for some k
$\Leftrightarrow c$

Q.E.D

You are mistaken. $\{x \in \emptyset \mid p(x) \}$ is still a set; it's just empty. It has no elements, because as you point out, if it had an element then that element would lie in the empty set (a contradiction).

Just because $x \in \emptyset$ entails contradiction, doesn't mean the existence of $\emptyset$ entails a contradiction.

The set-builder notation has the fundamental property that:

$y∈ \{x \mid p(x) \}$ iff $p(y)$.

The $\text{Axiom schema of specification}$ asserts that:

$\forall A \ \exists B \ \forall x \ (x \in B \leftrightarrow x \in A \land p(x))$.

In set-builder notation, we can rewrite it as:

for every set $A$, there exists the set $B= \{x \mid x \in A \land p(x) \}$,

that of course is a subset of $A$.

With $\emptyset$ as $A$ we get:

$\exists B \ \forall x \ (x \in B \leftrightarrow x \in \emptyset \land p(x))$,

or equivalently:

there exists the set $B= \{x \mid x \in \emptyset \land p(x) \}$.

By the property of the set-builder notation, we have that:

$y \in B \leftrightarrow y \in \{x \mid x \in \emptyset \land p(x) \} \leftrightarrow (y \in \emptyset \land p(y))$.

But for no $y: y \in \emptyset$, and thus, the "condition": $y \in \emptyset \land p(y)$ is false for every $y$.

This implies that also $y \in B$ is false for every $y$, which amounts to saying that $B$ has no elements at all.

Having proved, by the $\text{Axiom of extensionality}$, that the emptyset is unique, we conclude that B is the emptyset.

This is consistent with the fact that the $\text{Axiom schema of specification}$ licenses us to "carve out" a subset from an already existing set $A$. If $A$ is the emptyset, the only subset we can "carve out" from it is again the emptyset.