2.2.4: 2.2.D More rules of Boolean algebra
 Page ID
 9848
It is certainly not true that all possible rules of Boolean algebra are given in Figure 2.2. For one thing, there are many rules that are easy consequences of the rules that are listed there. For example, although the table asserts only that \(\mathbb{F} \vee p\) ≡ p, it is also true that \(p \vee \mathbb{F}\) ≡ p. This can be checked directly or by a simple calculation:
\(p \vee \mathbf{F} \equiv \mathbf{F} \vee p \qquad\) Commutative Law
\(\equiv p \qquad\) Identity Law as given in the table
Additional rules can be obtained by applying the Commutative Law to other rules in the table, and we will use such rules freely in the future.
Another sort of easy extension can be applied to the Associative Law, (p ∨ q) ∨ r ≡p ∨ (q ∨ r). The law is stated for the ∨ operator applied to three terms, but it generalizes to four or more terms. For example
((p ∨ q) ∨ r) ∨ s
≡ (p ∨ q) ∨ (r ∨ s) by the Associative Law for three terms
≡ p ∨ (q ∨ (r ∨ s)) by the Associative Law for three terms
We will, of course, often write this expression as p ∨ q ∨ r ∨ s, with no parentheses at all, knowing that wherever we put the parentheses the value is the same.
One other thing that you should keep in mind is that rules can be applied in either direction. The Distributive Law, for example, allows you to distribute the p in p∨(q∧¬p) to get (p∨q)∧(p∨¬p). But it can also be used in reverse to ‘factor out’ a term, as when you start with (q ∨ (p → q)) ∧ (q ∨(q → p)) and factor out the q to get q ∨ ((p → q) ∧ (q → p)).
So far in this section, we have been working with the laws of Boolean algebra without saying much about what they mean or why they are reasonable. Of course, you can apply the laws in calculations without understanding them. But if you want to figure out which calculations to do, you need some understanding. Most of the laws are clear enough with a little thought. For example, if we already know that q is false, then p ∨ q will be true when p is true and false when p is false. That is, p ∨ F has the same logical value as p. But that’s just what the Identity Law for ∨ says. A few of the laws need more discussion.
The Law of the Excluded Middle, p ∨ ¬p ≡ T, says that given any proposition p, at least one of p or ¬p must be true. Since ¬p is true exactly when p is false, this is the same as saying that p must be either true or false. There is no middle ground. The Law of Contradiction, p ∧ ¬p ≡ F, says that it is not possible for both p and ¬p to be true. Both of these rules are obvious.
There are some who set out to question the law of there being no middle ground. Already in the 1920’s people like Tarski (who we will meet later) talked about other forms of logic where another value representing ‘unknown’ or ‘not proven’ also exists. You can also see this in some pro gramming languages where they are referred to as ‘tristate booleans’.
These socalled nonstandard logics have been de veloped and have also lead to things like ‘fuzzy logic’, which some consider quite controversial. Lotfi Zadeh is credited as the first person to refer to this type of logic as fuzzy logic in his work on ‘fuzzy sets’ in 1965. Zadeh was later quoted as saying: “Not being afraid to get em broiled in controversy. ... That’s part of my character, too. I can be very stubborn. That’s probably been beneficial for the development of Fuzzy Logic.”
Source: en.wikipedia.org/wiki/Lotfi_A._Zadeh
The Distributive Laws cannot be called obvious, but a few examples can show that they are reasonable. Consider the statement, “This card is the ace of spades or clubs.” Clearly, this is equivalent to “This card is the ace of spaces or this card is the ace of clubs.” But this is just an example of the first distributive law! For, let a represent the proposition
“This card is an ace”, let s represent “This card is a spade” and let c represent “This card is a club”. Then “This card is the ace of spades or clubs” can be translated into logic asa ∧ (s ∨ c), while “This card is the ace of spades or this card is the ace of clubs” becomes(a ∧ s) ∨ (a ∧ c). And the distributive law assures us that a ∧ (s ∨ c) ≡ (a ∧ s) ∨ (a ∧ c). The second distributive law tells us, for example, that “This card is either a joker or is the ten of diamonds” is logically equivalent to “This card is either a joker or a ten, and it is eitherajokeroradiamond”. That is, j∨(t∧d) ≡ (j∨t)∧(j∨d). The distributive laws are powerful tools and you should keep them in mind whenever you are faced with a mixture of ∧ and ∨ operators.
DeMorgan’s Laws must also be less than obvious, since people often get them wrong. Fortunately you get to practice them both in Reasoning & Logic, as well as in Computer Organisation, so you will soon get them right. More importantly perhaps they do also make sense. When considering ¬(p ∧ q), you should ask yourself, how can “p and q” failto be true. It will fail to be true if either p is false or if q is false (or both). That is, ¬(p ∧ q)is equivalent to (¬p) ∨ (¬q). Consider the sentence “A raven is large and black.” If a bird is not large and black, then it is not a raven. But what exactly does it mean to be “not (large and black)”? How can you tell whether the assertion “not (large and black)” is true of something? This will be true if it is either not large or not black. (It doesn’t have to be both—it could be large and white, it could be small and black.) Similarly, for “p or q” to fail to be true, both p and q must be false. That is, ¬(p ∨ q) is equivalent to (¬p) ∧ (¬q). This is DeMorgan’s second law.
Recalling that p → q is equivalent to (¬p) ∨ q, we can apply DeMorgan’s law to obtain a formula for the negation an implication:
¬(p → q) ≡ ¬((¬p)∨q)
≡ (¬(¬p)) ∧ (¬q)
≡ p ∧ ¬q
That is, p → q is false exactly when both p is true and q is false. For example, the negation of “If you have an ace, you win” is “You have an ace, and you don’t win”. Think of it this way: if you had an ace and you didn’t win, then the statement “If you have an ace, you win” was not true.
Exercises

Construct truth tables to demonstrate the validity of each of the distributive laws.

Construct the following truth tables:
a) Construct truth tables to demonstrate that ¬(p ∧ q) is not logically equivalent to (¬p) ∧(¬q).
b) Construct truth tables to demonstrate that ¬(p ∨ q) is not logically equivalent to (¬p) ∨(¬q).
c) Construct truth tables to demonstrate the validity of both DeMorgan’s Laws. 
Construct truth tables to demonstrate that ¬(p → q) is not logically equivalent to any of the following.
a) (¬p) → (¬q)b) (¬p) → q
c) p → (¬q)
Refer back to this section for a formula that is logically equivalent to ¬(p → q). 
Is ¬(p ↔ q) logically equivalent to (¬p) ↔ (¬q)?

In the algebra of numbers, there is a distributive law of multiplication over addition: x(y + z) =xy + xz. What would a distributive law of addition over multiplication look like? Is it a valid law in the algebra of numbers?
6. The distributive laws given in Figure 2.2 are sometimes called the left distributive laws. Theright distributive laws say that (p ∨ q) ∧ r ≡ (p ∧ r) ∨ (q ∧ r) and that (p ∧ q) ∨ r ≡ (p ∨ r) ∧(q ∨ r). Show that the right distributive laws are also valid laws of Boolean algebra. (Note: In practice, both the left and the right distributive laws are referred to simply as the distributive laws, and both can be used freely in proofs.)
7.Show that p∧(q∨r∨s)≡(p∧q)∨(p∧r)∨(p∧s) for any propositions p,q,r, and s. In words, we can say that conjunction distributes over a disjunction of three terms. (Recall that the ∧ operator is called conjunction and ∨ is called disjunction.) Translate into logic and verify the fact that conjunction distributes over a disjunction of four terms. Argue that, in fact, con junction distributes over a disjunction of any number of terms.

There are two additional basic laws of logic, involving the two expression p ∧ F and p ∨ T. What are the missing laws? Show that your answers are, in fact, laws.

For each of the following pairs of propositions, show that the two propositions are logically equivalent by finding a chain of equivalences from one to the other. State which definition or law of logic justifies each equivalence in the chain.

For each of the following compound propositions, find a simpler proposition that is logically equivalent. Try to find a proposition that is as simple as possible.
a) (p ∧ q) ∨ ¬q b) ¬(p ∨ q) ∧ p c) p → ¬p
d) ¬p ∧ (p ∨ q) e) (q ∧ p) → q f) (p → q) ∧ (¬p → q) 
Express the negation of each of the following sentences in natural English:a) It is sunny and cold.
b) I will have stroopwafel or I will have appeltaart.c) If today is Tuesday, this is Belgium.
d) If you pass the final exam, you pass the course.

Apply one of the laws of logic to each of the following sentences, and rewrite it as an equivalent sentence. State which law you are applying.
a) I will have coffee and stroopwafel or appeltaart.b) He has neither talent nor ambition.
c) You can have oliebollen, or you can have oliebollen.

Suppose it is simultaneously true that “All lemons are yellow” and “Not all lemons are yellow”. Derive the conclusion “Unicorns exist”. (If you get stuck, check out en.wikipedia.org/wiki/ Principle_of_explosion.)