What are the laws and issues surrounding *quantifying over sentences?* What are the laws and issues surrounding quantifying over sentences?
Intuition tells me that if we wish to show that $X$ is unprovable in some system say $ZFC$ we might wish under certain circumstances to state that there does not exist a sentence $S$ within the set of all sentences provable in $ZFC$, such that $S$ proves $X$.
Somebody once exclaimed to me "You're quantifying over sentences" as if this was sacrilege.  Is it? If so, why?
 A: Quantifying over sentences of a logic within that logic is (normally) sacrilege. However, quantifying over sentences in some meta-mathematics is (normally) fine.
So, for instance, it makes sense to say "there is no sentence $\phi$ such that $\mathrm{ZFC} \vdash \phi \land \neg \phi$". However, it is not correct to write something like "$\forall \phi(\neg(\phi \land \neg \phi))$" as a sentence in a logical language.
Of course, in a theory as strong as ZFC, we can formalize logic itself. That is, you choose an enconding of strings of characters like $v,0,1,(,),\neg,\forall,\land,\in$ into natural numbers within ZFC, and you write a definition for when such a string represents a well formed formula, and you these elements of $\mathbb N$ into a subset $\mathrm{Form}$. Then, you can write $\mathrm{ZFC} \vdash \forall \phi \in \mathrm{Form}(...)$ -- however, what happens at the $...$ cannot be $\neg(\phi \land \neg \phi)$, because now the letter $\phi$ is a variable in the theory, and you cannot apply logical connectives to variables.
In fact, you might wonder if you could define a formula $\psi$ in the language of ZFC so that $\psi(\phi)$ corresponds to what we usually think of as "the truth of $\phi$" -- then you could cheat the above in by letting ... be $\neg(\psi(\phi) \land \neg\psi(\phi))$. As it turns out, this is impossible, for reasons closely related to the incompleteness theorem.
A: Quantifying over variables that represent predicates of first-order logic is called second-order logic. Quantifying over variables that represent predicates of second-order logic is called third-order logic. Iterating this gives higher-order logic.
Kinds of logic are susceptible to the same sorts of paradoxes that kinds of set theory are susceptible to; e.g. unary predicates really are allowed to have themselves in their domain, you could define $Q(P) :\equiv \neg P(P)$ and then $Q(Q)$ is the Liar's paradox.
The formulation of higher-order logic is the main way people deal deal with this, and is very reminiscent of how ZFC avoids the paradoxes of naive set theory.
If you fix the details right, second-order logic is nothing more than the first-order theory of first-order logic.
However, when using higher-order logic with set theory, people often1 like to restrict the kinds of semantics allowed. In particular, if $X$ is a type, and $\mathcal{P}(X)$ is the type of all unary predicates on $X$, then in an interpretation where the type $X$ is mapped to a set $S$, they insist that the type $\mathcal{P}(X)$ is mapped to the power set $\mathcal{P}(S)$.
This is the so-called full semantics for higher-order logic. It does not have the familiar nice logical properties; for example, the analog of Gödel's completeness theorem does not hold.  For this reason, second-order logic tends to be avoided when doing formal logic.
1: By "often" I mean to the point where people find it weird if you don't do so, and instead just use what you would normally use for the semantics of a first-order theory. Or in the case of second-order logic, an intermediary called Henkin semantics is more commonly used, where the interpretation of $\mathcal{P}(X)$ is required to be a subset of $\mathcal{P}(S)$.
A: Not sacrilege so much as "changing the conversation". In and of itself, there's nothing wrong with quantifying over sentences - it's something we do all the time in plain English. The problem is that none of our mathematical tools are applicable to problems involving sentence quantifiers. Even truth is a sticky concept when you allow sentence quantifiers - usually, you determine whether a sentence is true or false by building it up inductively and evaluating the components. But if we can quantify over sentences, one of those components can be the sentence itself - how can I evaluate the truth of the sentence $\forall\varphi P(\varphi)$ when this sentence might be the counterexample?
In fact, most of our most important tools for analyzing formal languages fall apart when sentence quantifiers are permitted. We no longer have completeness (there can be sentences that are always true, but can't be proven within the system) or compactness (an infinite set of sentences might be inconsistent even if every finite subset is consistent). In a sense, bringing in sentence quantification in a conversation about logic is like bringing up woodcarving in a metalworking class - it's technically legal, and certainly related, but you're moving the conversation into an area no one involved knows much about.
