Highly Rigorous Logic Book I am looking for a highly rigorous book on mathematical logic that goes into great detail, even at the foundations. I'm looking for something that say, develops propositional and first-order logic through discussion of free semigroups and words, rigorously proves unique readability, etc. Does such a book exist? Even some of the more rigorous books I've encountered have handwaived around alot. Thanks in advance for any response.
 A: Kleene's Introduction to Metamathematics and Kleene's Mathematical Logic are two books that are well worth looking at for what you want. They're a bit dated, but I don't think this would be much of a problem for what you want. For what it's worth, on many occasions I've seen references (in papers and books) to one or both of Kleene's books for some technical or obscure point that is often overlooked or omitted in other texts.
The following excerpt from pp. 23-24 of Introduction to Metamathematics is an example of what I mean by a "technical or obscure point that is often overlooked or omitted in other texts".

(from pp. 23-24) In mathematical formulas parentheses are introduced in pairs to show which way the parts of the formula should be associated. In complicated cases different species of parentheses such as $(\;),$ $\{\;\},$ $[\;]$ may be employed; and very complicated cases may be avoided by various abbreviations. However, the question exists in principle whether, using one species of parentheses only, the association of a formula is unambiguously fixed by its parentheses. (The question is equivalent to a geometrical one concerning nesting of intervals.) To make the question precise, suppose we have $2n$ parentheses, $n$ of them being left parentheses $(,$ and $n$ of them right parentheses $),$ and that they occur in linear order from left to right. This is the way they would occur in a mathematical formula, the other symbols of the formula which we need not notice now being interspersed among them. We say that two pairs of parentheses separate each other, if they occur in the order $(_{i}\;(_{j}\;)_{i}\;)_{j},$ where the $i$’s identify either pair and the $j$’s the other, and other parentheses may occur interspersed among the four shown. We define a $1-1$ pairing of the $n$ left parentheses with the $n$ right parentheses (briefly, a pairing of the $2n$ parentheses) to be proper, if a left parenthesis is always paired with a right parenthesis to the right of it, and if no two of the pairs separate each other. It is almost immediate that if $2n$ parentheses are properly paired, on removing any of the pairs, the remaining parentheses are properly paired. Also the parentheses included between a given pair in the proper pairing of the $2n$ parentheses are properly paired. The following three lemmas contain the answer to the proposed question about some related information.
LEMMA 1. A proper pairing of $2n$ parentheses $(n>0)$ contains an innermost pair, i.e. a pair which includes no other of the parentheses between them.

[proof omitted in this excerpt]

LEMMA 2. A set of $2n$ parentheses admits at most one proper pairing.

[proof omitted in this excerpt]

LEMMA 3. If $2n$ parentheses and a consecutive subset of $2m$ of them both admit proper pairings, then the proper pairing in the subset forms a part of the proper pairing in the whole set, i.e. each parenthesis of the subset has the same mate in both pairings.

[proof omitted in this excerpt]
A: Apparently you want a book that introduces some sort of concatenation theory in order to buttress some common syntactic claims. There aren't many books that do this (to my knowledge), though an interesting exercise is to see how much syntax you can code within a given theory (Gödel's arithmetization method).
Anyway, two books that I know which explicitly consider these syntactic matters are:
(1) René Cori and Daniel Lascar's Mathematical Logic: A Course with Exercises covers concatenation theory in their introduction (cf. pp. xviii-xix), enough so that you can (perhaps as an exercise) formulate the necessary syntactical claims and prove them to your satisfaction.
(2) More interestingly, Donald Barnes and John Mack's An Algebraic Introduction to Mathematical Logic develops the theory of free algebras in the first chapter and makes extensive use of it in introducing the syntax of both propositional and first-order logic. Since you explicitly mentioned free words, this may be of interest.
Another way of doing things might be to introduce computability theory first and then using these notions in the presentation of propositional and first-order logic. James Donald Monk's Mathematical Logic, which I think is definitely worth a look.
A: Traditional Logic II: Advanced Formal Logic - This is an excellent book, which is very rigorous. However if you want to get into the detail that you are asking, I don't think it can all be in one or even a few books. I suggest looking for a class, maybe online if you don't live near a college offering it, or find some one with a like interest who will help you. To really grasp logic, at least for me, I need to know its applications. Learning about circuitry and boolean algebra will help for a visual guide, as well as a real world application of logic and the principals you would learn about. I hope this helps!
