Does equality of sets follow not only from what they contain but also from what they are contained by?

The Axiom of extensionality states that two sets are equal if they contain the same elements:

$\forall A \forall B [\forall x (x \in A \Leftrightarrow x \in B) \Rightarrow A = B]$

Can it be replaced by the statement that two sets are equal if they are contained by the same elements?

$\forall A \forall B [\forall x (A \in x \Leftrightarrow B \in x) \Rightarrow A = B]$


The Axiom of Extensionality cannot be replaced by the statement that two sets are equal if they are contained by the same sets (this latter principle is a form of Leibniz's law, and I will refer to it by that name).

First, let me prove that, unlike Extensionality, $\forall A,B. (\forall x. A \in x \leftrightarrow B \in x) \rightarrow B = A$ follows from the other axioms of set theory, without invoking either Extensionality or Leibniz's law in the proof.

Take any two sets $A,B$, and assume that $\forall x. A \in x \leftrightarrow B \in x$. Define the set $\overline{A} = \{ y \in \mathcal{P}(A) \:|\: y = A \}$ using the Powerset axiom and the Separation schema. Clearly $A \in \overline{A}$, hence by our assumption $B \in \overline{A}$ as well. But by the defining property of $\overline{A}$, the following holds: $\forall y. y \in \overline{A} \leftrightarrow y \in \mathcal{P}(A) \wedge y = A$. In particular, since $B \in \overline{A}$, we can conclude $B = A$.

This proves Leibniz's law in set theory, and since the proof never invokes Extensionality, this implication holds even in set theory without Extensionality.

So all that remains to be shown is that the axiom of Extensionality is not a redudant axiom, i.e. that Extensionality, unlike Leibniz's law, does not follow from the other axioms of set theory. So we have successfully reduced your question to a previous Math.SE question.