# Logic – 1

Algebra of Statements and Connectives

Amber Habib Department of Mathematics Shiv Nadar University

Abstract Notes for the Precalculus course taught to 1st year students of the B.S. Mathematics program.

In these notes, we will sketch parts of deductive logic – the rules we use to see if we are justiﬁed in reaching certain conclusions from our starting assumptions.

1

Statements

An assumption, or a conclusion, has the form of an assertion. We require that it have a form so that it can be either true or false but not both. Assertions that satisfy this condition are called statements and are the basic building block of logic. Deﬁnition 1.1 A statement is a declarative statement that is either true or false (but not both). Example 1.2 These sentences are not statements: 1. Are apples red? 2. I may eat an apple. 3. Listen to me! Example 1.3 These are statements: 1. Two plus two equals four. 2. Two plus two equals ﬁve. 3. All apples are red. 1 2

4. Today is Monday.

2

If a statement is true, we will say its truth value is true and abbreviate this as “the statement has value T ”. If a statement is false, we will say its truth value is false and abbreviate this as “the statement has value F ”. The value of a statement can vary. For example, “Today is Monday” will have value F on most days and value T one day a week. Even “All apples are red” could conceivably have diﬀerent values, depending on circumstances. The statements we have considered so far are simple in that only one assertion was involved in each of them. We also have compound statements which feature combinations of two or more statements. Example 1.4 These are compound statements: 1. You must get 60% in this exam or you will fail the course. 2. All dragons are red and all unicorns have wings. 3. If Amita is our leader we will win the election. 4. It is not true that two plus two equals ﬁve. 2

The last of these examples is a little diﬀerent from the others. It doesn’t combine two statements, but it does take a simple statement (“two plus two equals ﬁve”) and modify it. We will now take up the rules regarding combining simple statements into compound ones. The key is to understand and ﬁx the usage of the words and, or, and not; as well as the If. . . then. . . construction.

2

Connectives

A statement variable is a symbol which stands for a statement. The use of statement variables helps us to set up a convenient algebra for logic. For example, consider the compound statement “All dragons are red and all unicorns have wings.” If we let p stand for the statement “All dragons are red” and q for the statement “All unicorns have wings” then this compound statement can be expressed simply as “p and q.”

Conjunction (And)
Let p, q be statements. Then the statement “p and q”, denoted by p ∧ q, is deﬁned to have value T iﬀ both p and q have value T . 2

Example 2.1 Two is an integer and a prime number – This has p = “Two is an integer”, q = “Two is a prime number”. Both p and q are true, so the conjunction p ∧ q has value T . Two is both even and odd – This has p = “Two is even”, q = “Two is odd”. Now p is true but q is false. Since one of the statements is false, p ∧ q has value F . The real number x is negative and a square – This has p = “The real number x is negative”, q = “The real number x is a square”. While the truth values of p, q individually depend on x it is not possible for them to be simultaneously T . Therefore p ∧ q has value F regardless of what x is. 2 The working principles of the ∧ operator are most clearly expressed through a truth table: p T T F F q T F T F p∧q T F F F

The ﬁrst two entries of each row of this table give the various possible combinations of the truth values of p and q. The third entry gives the corresponding value of p ∧ q.

Disjunction (Or)
Let p, q be statements. Then the statement “p or q”, denoted by p ∨ q, is deﬁned to have value T iﬀ atleast one of p and q has value T . It is worth noting that in everyday English the word ‘or’ can be used in diﬀerent ways as illustrated below: Every student in this class has taken algebra or analysis. The usage of ‘or’ is inclusive: it allows for the possibility that a student may have taken both analysis and algebra. You must get 60% in this exam or you will fail the course. The usage of ‘or’ is exclusive: the possibility of getting 60% and failing is excluded.

3

The kind of usage is sensed from one’s experience with the language and from the context – it is not detected from the structure of the sentence. In logic, we always use ‘or’ in the inclusive sense, allowing both options to be simultaneously true. Thus the truth table for the ∨ operator is:

p T T F F

q T F T F

p∨q T T T F

Negation (Not)
Let p be a statement. Then the statement “Not p”, denoted by ∼ p or ¬p, is deﬁned to have value T iﬀ p has value F . The statement ¬p is called the negation of p. The truth table for the ¬ operator is:

p T F

¬p F T

3

Algebra of Logic

To develop an algebra of logic we ﬁrst need a notion of ‘equality’ of statements. Deﬁnition 3.1 Statements p and q are equivalent if p has value T exactly when q has value T – i.e., under all circumstances either both p and q are true or both are false. If p and q are equivalent, then we write p = q. Example 3.2 Consider the truth table for the double negation ¬(¬p): p T F ¬p F T ¬(¬p) T F

The table shows that ¬(¬p) is true when p is true, and false when p is false. Therefore ¬(¬p) = p. 2

4

Example 3.3 Consider the statements p ∧ (q ∨ r) and (p ∧ q) ∨ (p ∧ r). Let us create a combined truth table: p T T T F F F T F q T T F T F T F F r T F T T T F F F q∨r T T T T T T F F p ∧ (q ∨ r) T T T F F F F F p∧q T T F F F F F F p∧r T F T F F F F F (p ∧ q) ∨ (p ∧ r) T T T F F F F F 2

The table shows that p ∧ (q ∨ r) = (p ∧ q) ∨ (p ∧ r).

Example 3.4 Consider the statements (¬p) ∨ q and ¬(p ∨ q). The combined truth table is: p T T F F q T F T F (¬p) ∨ q T F T T ¬(p ∨ q) F F F T

The second and third rows show these two statements are not equivalent. This example shows the importance of correctly using brackets to describe the sequence in which the operations are to be carried out. 2 As these examples illustrate, we can check for the equivalence of two compound statements by comparing their truth tables. But they also show that this process can be quite cumbersome. We need to develop an algebra – a set of rules for manipulating statements into equivalent ones. We have the following basic rules, which can be checked using truth tables:

Idempotent Laws. p∧p=p p∨p=p Commutative Laws. p∧q =q∧p p∨q =q∨p

5

Associative Laws. p ∧ (q ∧ r) = (p ∧ q) ∧ r p ∨ (q ∨ r) = (p ∨ q) ∨ r Distributive Laws. p ∧ (q ∨ r) = (p ∧ q) ∨ (p ∧ r) p ∨ (q ∧ r) = (p ∨ q) ∧ (p ∨ r) Absorption Laws. p ∧ (p ∨ q) = p p ∨ (p ∧ q) = p Double Negation. ¬(¬p) = p de Morgan’s Laws. ¬(p ∧ q) = (¬p) ∨ (¬q) ¬(p ∨ q) = (¬p) ∧ (¬q)

We have exactly the same laws in the theory of sets, with set union replacing disjunction, set intersection replacing conjunction, and complement replacing negation. Now in set theory we have two special sets: the empty set and the universal set, which serve as identities for the union and intersection operations, respectively. We’ll ﬁnd it convenient to create their equivalents in logic. Deﬁnition 3.5 A tautology is a statement which is always true. A contradiction is a statement which is always false. A simple example of a tautology is p ∨ (¬p) where p is any statement. We observe that all tautologies are equivalent, and hence can be denoted by the single symbol T . The negation of a tautology is a contradiction, for example p ∧ (¬p). All contradictions are also equivalent and we will denote them by F . Exercise 3.6 Let p be a statement. Show that T ∧p=p F ∧p=F T ∨p=T F ∨p=p

We will adopt two conventions that will simplify our formulas by reducing the number of brackets in them: 1. Negation is applied before other operators. Consider ¬p ∨ q. Applying ¬ ﬁrst means that we ﬁrst get ¬p, and then we get (¬p) ∨ q. Similarly, ¬p ∧ ¬q = (¬p) ∧ (¬q). 6

2. Commutativity and associativity imply that in an expression with only one of the ∧, ∨ operators present, we can rearrange the terms in any way we like. In particular, brackets can be dropped. For example the following are all equal and so can be replaced by p ∨ q ∨ r: p ∨ (q ∨ r), (p ∨ q) ∨ r, (p ∨ r) ∨ q.

4

Logical Implication

What do we mean by a statement of the form “If p then q”? When will we judge it to be true? One interpretation is that it asserts the impossibility of p being true and q being false simultaneously. We therefore deﬁne a new connective, called implication and denoted →, by the following truth table:

p T T F F

q T F T F

p→q T F T T

Exercise 4.1 Show that p → q = (¬p) ∨ q. Exercise 4.2 Prove the following identities by using the previous exercise together with the earlier rules for the algebra of logic: 1. p → (q ∧ r) = (p → q) ∧ (p → r) 2. p → (q ∨ r) = (p → q) ∨ (p → r) 3. (p ∧ q) → r = (p → r) ∨ (q → r) 4. (p ∨ q) → r = (p → r) ∧ (q → r) Exercise 4.3 Show that p → (p → q) = p. Exercise 4.4 Prove Peirce’s Law: ((p → q) → p) → p = T . Deﬁnition 4.5 The converse of p → q is q → p. The contrapositive of p → q is (¬q) → (¬p). Exercise 4.6 (p → q) ∨ (q → p) is a tautology. Thus, under any circumstances, either an implication or its converse will be true. Exercise 4.7 p → q = (¬q) → (¬p). An implication is equivalent to its contrapositive.

7

5

Validity of Arguments

Deﬁnition 5.1 An argument consists of statements A1 , . . . , An called assumptions and a statement C called a conclusion, written in the format A1 , . . . , A n ; ∴C

We will call an argument valid if the truth of the assumptions implies the truth of the conclusion, i.e. if the statement (A1 ∧ · · · ∧ An ) → C is a tautology. Example 5.2 Consider the following argument: p → q, p; We calculate ((p → q) ∧ p) → q = ((¬p ∨ q) ∧ p) → q = ((¬p ∧ p) ∨ (q ∧ p)) → p = (F ∨ (q ∧ p)) → p = (q ∧ p) → p = ¬(q ∧ p) ∨ p = (¬q ∨ ¬p) ∨ p = ¬q ∨ (¬p ∨ p) = ¬q ∨ T = T So this is a valid argument. Example 5.3 Consider the argument: p → q, q → r, r; We calculate: ((p → q) ∧ (q → r) ∧ r) → p = ((p → q) ∧ (¬q ∨ r) ∧ r) → p = ((p → q) ∧ r) → p = ((p → q) → p) ∨ (r → p) = ((¬p ∨ q) → p) ∨ (r → p) = ((p ∧ ¬q) ∨ p) ∨ (r → p) = p ∨ (r → p) = p ∨ ¬r This is not a tautology and so the argument is invalid. 2 ∴p 2 ∴q

8

Sign up to vote on this title