TITLE: Does mathematics become circular at the bottom? What is at the bottom of mathematics?
QUESTION [86 upvotes]: I am trying to understand what mathematics is really built up of. I thought mathematical logic was the foundation of everything. But from reading a book in mathematical logic, they use "="(equals-sign), functions and relations.
Now is the "=" taken as undefined? I have seen it been defined in terms of the identity relation.
But in order to talk about functions and relations you need set theory. 
However, set theory seems to be a part of mathematical logic.
Does this mean that (naive) set theory comes before sentential and predicate logic? Is (naive)set-theory at the absolute bottom, where we can define relations and functions and the eqality relation. And then comes sentential logic, and then predicate logic?
I am a little confused because when I took an introductory course, we had a little logic before set-theory. But now I see in another book on introduction to proofs that set-theory is in a chapter before logic. So what is at the bottom/start of mathematics, logic or set theory?, or is it circular at the bottom?
Can this be how it is at the bottom?
naive set-theory $\rightarrow$ sentential logic $\rightarrow $ predicate logic $\rightarrow$ axiomatic set-theory(ZFC) $\rightarrow$ mathematics
(But the problem with this explanation is that it seems that some naive-set theory proofs use logic...)
(The arrows are of course not "logical" arrows.)
simple explanation of the problem:
a book on logic uses at the start: functions, relations, sets, ordered pairs, "="
a book on set theory uses at the start: logical deductions like this: "$B \subseteq A$", means every element in B is in A, so if $C \subseteq B, B \subseteq A$, a proof can be "since every element in C is in B, and every element in B is in A, every element of C is in A: $C \subseteq A$". But this is first order logic? ($(c \rightarrow b \wedge b \rightarrow a)\rightarrow (c\rightarrow a)$).
Hence, both started from each other?

REPLY [3 votes]: It's turtles all the way down.*
In other words: there is nothing at the bottom of mathematics but philosophy. It's a set of rules we came up with because it seemed useful, but it has no absolute grounding in reality or the universe. It functions well in the "shared delusion" that is our understanding of the universe, but there is no way we could tell whether it actually connects to reality.