> The conclusion that I am drawing is that set theory and category theory are different ways of thinking. In set theory, we can appeal to the axiom of extensionality, which says that singletons {a} and {b} are the same iff a=b. But in the category Set, there is no concept of element.

I don't think this is entirely accurate.

A popular formulation of the category of sets is the [_Elementary Theory of The Category of Sets_, Lawvere (1964)](https://artscimedia.case.edu/wp-content/uploads/2013/07/14182623/Lawvere-ETCS.pdf). Lawvere defines the element relation \$$\in\$$ in **Definition 1** of this paper:

> (From Lawvere) Definition 1. \$$x\$$ is an element of \$$A\$$, denoted \$$x \in A\$$, iff \$$\mathbf{1} \overset{x}{\to} A\$$

Here \$$\mathbf{1}\$$ denotes an initial object.

> When are two objects the same? When they have the same identity morphism.

Well... I can think of at least two formulations of category theory which contradict this claim.

For instance, in the Coq Implementation of Homotopy Type Theory (HoTT), an equality primitive is defined [here](https://github.com/HoTT/HoTT/blob/master/theories/Basics/Overture.v#L212-L214). I have seen this called _path equality_. HoTT stipulates an axiom over path equality, called [univalence](https://github.com/HoTT/HoTT/blob/master/theories/Types/Universe.v#L34-L38). After that category theory is then built on top of this ([here](https://github.com/HoTT/HoTT/blob/master/theories/Categories/Category/Core.v) is the source code).

In John Weigley's Coq formulation of Category Theory, on the other hand, introduces _class_ based equality similar to Haskell (see the source code [here](https://github.com/jwiegley/category-theory/blob/master/Lib/Equality.v#L202-L213)). Again, he builds category theory on top of this primitive notion.

> So I'm inclined to select the answer that says to look at the identity morphism. But I may be in error.

Well, I think we are coming from very different backgrounds. Homotopy Type Theory has some things to say about what you are asking. But it may present a very different foundation of mathematics than you are used to.

I should say though that I am just a student, so please take everything I say with a grain of salt.

[EDIT: formatting]