When we upgrade from propositional logic to firstorder logic, what changes do we need to make to the laws of boolean algebra? Well first of, we can keep all the existing propositional equivalences (Propositional equivalences). For example, ∀x :(¬ (φ ∧ ψ)) ≡∀x :(¬φ ∨¬ψ). (Technically, we're even making those equivalences stronger, since those metavariables φ, ψ, θ can now stand for any firstorder formula, rather than merely propositional formulas.)
But, we also need additional identities to deal with our newfangled quantifiers. What should these be? The most interesting are those that relate the two kinds of quantifiers. Universal quantifcation (∀) says that something holds for all members of the domain, and existential quantifcation (∃) says that something holds for at least one member. Clearly, ∀x :(φ) implies ∃x :(φ), but the other direction doesn't hold, so that is not an equivalence.
ASIDE: Wait just a minutel That implication holds only if the domain is nonempty, so that there is at least one member in it. We'll see this restriction appear a few times.
What about ∀x :(¬φ)? In English, "for all items x, φ(x) does not hold". A more natural way to say this is that there is no item x such that φ(x) does hold that is, ¬∃x :(φ). Indeed, this will be one of our new boolean algebra rules.
See a list of equivalences with quantifiers (Firstorder equivalences). As before, we can use these to show other pairs of formulas equivalent, as in the following examples.
Example 4.11
Using these identities, we can simplify formulas such as the following: ∀y : (∀x :(R (x) ∧ Q (x, y))) ∧ ¬∃z :(¬R (z)).
1 
∀y: (∀x : (R (x) ∧ Q (x, y))) ∧ ¬∃z : (¬R (z)) 

2 
≡ ∀y : (∀x : (R (x) ∧ Q (x, y))) ∧ ∀z : (¬¬R (z)) 
Complementation of ∃ 
3 
≡ ∀y : (∀x: (R (x) ∧ Q (x, y))) ∧ ∀z : (R (z)) 
Double Complementation 
4 
≡ ∀x : (∀y : (R (x) ∧ Q (x, y))) ∧ ∀z : (R (z)) 
Reordering ∀s 
5 
≡ ∀x : (∀y: (R (x)) ∧ ∀y : (Q (x, y))) ∧ ∀z : (R (z)) 
Distribution of ∀ over ∧ 
6 
≡ ∀x : (R (x) ∧ ∀y: (Q (x, y))) ∧ ∀z : (R (z)) 
Simplification of ∀ (y not free in R (x)) 
7 
≡ ∀x : (R (x) ∧ ∀y: (Q (x, y))) ∧ ∀x : (R (x)) 
renaming 
8 
≡ ∀x : (R (x) ∧ ∀y : (Q (x, y)) ∧ R (x)) 
Distribution of ∀ over ∧ 
9 
≡ ∀x : (∀y: (Q (x, y)) ∧ R (x) ∧ R (x)) 
Commutativity of ∧ 
10 
≡ ∀x : (∀y : (Q (x, y)) ∧ R (x) ∧ R (x)) 
Associativity of ∧ 
11 
≡ ∀x : (∀y: (Q (x, y)) ∧ R (x)) 
Idempotency of ∧ 
Admittedly, some of these steps are rather small and obvious (e.g., our use of commutativity and associativity); we include them to illustrate how the identities of propositional logic are also used in firstorder logic.
Example 4.12
An example of ∀x :(ψ) ≡ ψ where ψ doesn't contain x occurring free: Let ψ be the formula we've seen before
(Exercise 4.1.1.3), asserting that a positive integer n was noncomposite: ∀j : (∀k
: ((jk = n) ⇒ (j = 1) ∨ (k = 1))). Since n occurs free, the truth
of this formula depends on the value of n. The formula ∀x :(ψ) really is equivalent to ψ: It's true for exactly the same values of n.
The use of x is essentially a bit of a rus, since x plays no part of the meat of the ψ.
However, the following formula is certainly not equivalent: ∀n :(ψ). This formula asserts that all elements of the domain
are noncomposite (and it doesn't depend on choosing a particular interpretation for n). Because n occurred free,
we can't use the "simplification of quantifiers" identity on it.
Finally, one more variant: ∀j :(ψ). This is equivalent to the original, just like ∀x :(ψ) was. Why? The j that occurs inside ψ is a local variable, and is
different from any enclosing bindings’ j. As we saw, local variables shadow lesslocal ones, just as in most programming languages.
Exercise 4.2.1.1
The equivalences for distributing implication over equivalences seem counterintuitive at first glance. Show that the following one holds, given all the identities which don't involve both
implication and quantifiers.
Assuming that ψ does not have any free occurrences of variable x, ∀x :(φ ⇒ ψ) ≡∃x :(φ) ⇒ ψ.
Are the following two sentences true?
 "All flying pigs wear top hats." ∀p : (wears top hat (p)) (over the domain of flying pigs).
 "All numbers in the empty set are even." ∀x : (even (x)) (over the empty domain).
 "Every Pulitzer prize winner I've met thinks I'm smart, and cute, tool" ∀x : (thinksImSmartAndCute (x)) (over the empty, since I haven't met any Pulitzer prize winners).
Each sentence states that some property holds for every member of some set (flying pigs or the empty set), but there are no such members. Such sentences are considered vacuously true.
Okay, maybe you believe that the sentences aren't false, but you still want some reason to consider them true. Well, think of their negations:
 "There exists a flying pig not wearing a top hat." ∃p :(¬wears top hat), over the (empty) domain of flying pigs. You can't go of and find a flying pig which contradicts this, since you can't find any flying pig at all. (Note that the negation isn't "No flying pigs wear top hats.")
 "There exists a number in the empty set that is even." ∃x :(¬even), over the empty domain. (The negation isn't "No numbers in the empty set are even.")
Since these negations are false, the original sentences must be true. This is also similar to the fact that a simple propositional implication,a⇒bis true, if a is in fact false, regardless of the truth of b; in this crude analogy, a corresponds to "in the domain".
ASIDE: In boolean algebra, we only allow the values false and true, with no third option. This is sometimes called the law of the excluded middle. Philosophers have developed "trimodal" logics which have a third option, but everything in those logics can be translated into something in traditional logic; such logics might be more convenient in some cases, but they aren't more expressive. Fuzzy Logic, on the other hand, is a variant where every proposition has a degree of truth (from zero to one). While this is different than propositional logic (and, it is the right way to model many realworld problems), as a logic it hasn't yielded interesting new mathematical results.
Even more silliness can ensue when the domain is empty: For example, not only is every member of the empty set even, but every member is simultaneously odd! That is, ∀x :(R (x) ∧¬R (x)) is true (only) when the domain is the empty set. Even more degenerately, ∀x : (false) is a true (only) on the empty domain.
 2279 reads