Book on the Rigorous Foundations of Mathematics- Logic and Set Theory I am asking for a book that develops the foundations of mathematics, up to the basic analysis (functions, real numbers etc.) in a very rigorous way, similar to Hilbert's program.  Having read this question: " Where to begin with foundations of mathematics" 
I understand that this book must have:


*

*Propositional Logic

*First Order-Predicate Logic

*Set Theory 


Logic however must not depend on set theory! I have tried reading many pdf notes on the first two but have been dissapointed by the usage of notions and concepts from Set Theory.
So what do I want? A book that builds up these $3$ from ground $0$ and develops the foundations of mathematics up to the Axioms of ZFC and simple consequences like the existence of the real number field. As such, it is not neccessary for this book to contain the incompleteness theorems, cardinality etc. It must however be rigorous and formal in the sense that when I finish it, I have no doubt that the foundations are "solid". 
Final notes: It would be preferable if it were made for self study (but that's not neccessary). You can also suggest up to 3 books that discuss the topics above, beware however as circular definitions must be avoided. Rigor in other words, is the most important thing I am asking for.
PS: There have been other questions here on the foundations of logic as this one. They do not answer my question however, as rigor is not (over)emphasised. I believe this is not a duplicate and I hope you see that as well.
Thank you in advance
 A: Curry's Foundations of Mathematical Logic is very conscious of what is presupposed in terms of mathematical content in the development of logic. The writings of Paul Lorenzen might also be of some interest for you.
A: I precisely had this purpose of building the foundations of mathematics (logic and set theory) from ground 0 with absolute rigor (I mean, as much rigor as actually possible) with my site settheory.net.
There I start by building set theory and logic in parallel.
I only break the chain of maximum rigor in the developments of model theory in Part 3, where I introduce and explain things more intuitively, not so rigorously. However I also have plans to bring rigorous foundations for these things, through the part on Galois connections, that you can see done and stands as a logical continuation of Part 2. There as you can see, I reached the concept of well-founded relation. This concept can be used to rigorously define the structure of formal expressions with their interpretations.
A: Unless I've missed something, both J. Lukasiewicz's Elements of Mathematical Logic and A. N. Prior's Formal Logic, start things from logic without any set theory required.  Lukasiewicz's book takes you up to first-order predicate logic, while Prior's book takes you up to set theory, though I haven't read that far personally in the book, and will only get you started there.  You might also want to look at the metamath site.
I do want to remark here that oftentimes rigor isn't oftentimes even ("over")emphasized in books written by logicians.  Even demonstrations of something like "p implies p" given in sections on propositional logic are NOT usually formal proofs.... which might lead one to argue that p$\implies$p is true, but not provable.  Fortunately, the above references generally don't have this problem (though Prior's section on "the logic of classes" (set theory) does), and the problem isn't, in principle, all that difficult to fix.
A: Principia Mathematica was an attempt in 1910. Bourbaki was published 20 years later and has a completely different approach in terms of logic. Bourbaki does not deal with logic. The standard way this works is, you write a book on set theory, throw in one or two references about "paradoxes" and then proceed with mathematical metaphysics (Cantor's paradise if you will). If you really want to read a rigorous book, I would suggest Frege's concept script, Russell's theory of denoting phrases, Whitehead's universal algebra, Wittgenstein's tractatus from 1918. So be aware that the doctrines which are being served to you, by the standard channels, including this site and mathoverflow is only one part of the actual history. If you read people like Descartes, Leibniz, Poincare, Brouwer, Wittgenstein you will get a completely different view, which is almost a complete mirror of the tradition of Hilbert. Brouwer for example vanished from the history. "Working mathematicians" for the most part don't take intuitionism or discussions about foundations seriously.
By the way, Gödel used the aforementioned PM as the basic system, and Bourbaki is not such a system at all. Bourbaki starts with sets. Other systems are for example VonNeuman's system,  Quine's new foundation, Tarski-Grothendieck system, Lawvere's category theory system, etc.
A: Gosh. I wonder if those recommending Bourbaki have actually ploughed through the volume on set theory, for example. For a sceptical assessment, see the distinguished set theorist Adrian Mathias's very incisive talk https://www.dpmms.cam.ac.uk/~ardm/bourbaki.pdf
Bourbaki really isn't a good source on logical foundations. Indeed, elsewhere, Mathias quotes from an interview with Pierre Cartier (an associate of the Bourbaki group) which reports him as admitting 

'Bourbaki never seriously considered logic. Dieudonné himself was very vocal against logic'

-- Dieudonné being very much the main scribe for Bourbaki. And Leo Corry and others have pointed out that Bourbaki in their later volumes don't use the (in fact too weak) system they so laboriously set out in their Volume I. 
Amusingly, Mathias has computed that (in the later editions of Bourbaki) the term in the official primitive notation defining the number 1 will have 

2409875496393137472149767527877436912979508338752092897

symbols. It is indeed a nice question what possible cognitive gains in "security of foundations" in e.g. our belief that 1 + 1 = 2 can be gained by defining numbers in such a system!
A: I think the best approximation of the book you are looking for is the series of books by Nicolaus Bourbaki. In the introduction to his books you can find the following (or similar:) statement: "this series of books takes up mathematics at the beggining and gives complete proofs". You can't find anything that is closer to Hilbert's program than Bourbaki's treatise.
