L5-Logic and Propositional Calculus
L5-Logic and Propositional Calculus
Calculus
Logic and Propositions play an important role in computer science as well as in a person’s
daily life.
In the computer science field, propositional logic has a wide variety of applications and
hence is very important.
2) System Specifications
When developing/manufacturing a system(Software or Hardware), the
developers/manufacturers have to meet certain needs and specifications, which are
usually stated in English. But as English sentences can be ambiguous,
developers/engineers translate these system specifications into logical expressions to
state specifications rigorously and unambiguously.
3) Logical Puzzles
Puzzles that are solved using reasoning and logic are called logical puzzles. They can be used for
brain exercises, recreational purposes, and for testing a person’s reasoning capabilities. Solving
such puzzles is generally tricky, but it can be done easily using propositional logic. Some of the
famous logic puzzles are the muddy children puzzle, Smullyan’s puzzles about knights and
knaves, etc.
4) Boolean Searches
Another important application of propositional logic is Boolean searches. These searches use
techniques from propositional logic. Logical connectives are used extensively in searches of large
collections of information, such as indexes of Web Pages. In Boolean searches, the connective
AND is used to find records that contain both of the two terms, the connective OR is used to find
records that have either one or both of the terms, and the connective NOT, also written as AND
NOT, is used when we need to exclude a particular search term.
5) Logic/Computer Circuits
Logic gates or circuits are electronic devices that implement Boolean functions, i.e. it does a
logic operation on one or more bits of input and gives a bit as an output. They are the basic
building blocks of any digital system. The relationship between the input and output is based on
a certain propositional logic.
6) Inference and Decision Making
Propositional Logic is widely used in the making rules of inference and decision making. These
rules of inferences can then be used to build arguments. When several premises are given, it is
hard to tell if a given argument is valid. Thus, we use these rules of inference to validate an
argument and make a decision.
Let us identify which of the following are propositions and which are not.
(i) PDEU is in Rajkot
(ii) Where are you going?
(iii) Arunachal Pradesh is a part of China.
(iv) 2 + 2 = 4
(v) Do your homework.
Compound Propositions
Many propositions are composite, that is, composed of subpropositions and various
connectives discussed subsequently. Such composite propositions are called compound
propositions.
A proposition is said to be primitive if it cannot be broken down into simpler propositions,
that is, if it is not composite.
For example, the above propositions (i), (iii) and (iv) are primitive propositions.
On the other hand, the following two propositions are composite:
a) 2+2=4 and Surat city is in Maharashtra.
b) John is smart or he studies every night
The fundamental property of a compound proposition is that its truth value is completely
determined by the truth values of its subpropositions together with the way in which they
are connected to form the compound propositions.
Let us study some of these connectives from next slides.
BASIC LOGICAL OPERATIONS
Conjunction, p ∧ q
Any two propositions can be combined by the word “and” to form a compound
proposition called the conjunction of the original propositions.
Symbolically, p ∧ q read “p and q,” denotes the conjunction of p and q.
Since p ∧ q is a proposition it has a truth value, and this truth value depends only on the
truth values of p and q.
Specifically:
Definition: If p and q are true, then p ∧ q is true; otherwise p ∧ q is false.
Consider the following four statements:
(i) Ice floats in water and 2 + 2 = 4. (iii) China is in Europe and 2 + 2 = 4.
(ii) Ice floats in water and 2 + 2 = 5. (iv) China is in Europe and 2 + 2 = 5.
Only the first statement is true. Each of the others is false since at least one of its
substatements is false.
Disjunction, p ∨ q
Any two propositions can be combined by the word “or” to form a compound
proposition called the disjunction of the original propositions.
Symbolically, p ∨ q read “p or q,” denotes the disjunction of p and q.
The truth value of p ∨ q depends only on the truth values of p and q as follows.
Definition: If p and q are false, then p ∨ q is false; otherwise p ∨ q is true.
Consider the following four statements:
(i) Ice floats in water or 2 + 2 = 4. (iii) China is in Europe or 2 + 2 = 4.
(ii) Ice floats in water or 2 + 2 = 5. (iv) China is in Europe or 2 + 2 = 5.
Only the last statement (iv) is false. Each of the others is true since at least one of its
sub-statements is true.
Negation, ¬ p
Given any proposition p, another proposition, called the negation of p, can be formed
by writing “It is not true that . . .” or “It is false that . . .” before p or, if possible, by
inserting in p the word “not.”
Symbolically, the negation of p, read “not p,” is denoted by ¬ p
The truth value of ¬ p depends on the truth value of p as follows:
Then (a2) and (a3) are each the negation of (a1); and (b2) and (b3) are each the
negation of (b1).
Since (a1) is true, (a2) and (a3) are false; and since (b1) is false, (b2) and (b3) are true.
PROPOSITIONS AND TRUTH TABLES
Let P(p, q, . . .) denote an expression constructed from logical variables p, q, . . ., which
take on the value
TRUE (T) or FALSE (F), and the logical connectives ∧, ∨, and ¬ (and others discussed
subsequently). Such an expression P(p, q, . . .) will be called a proposition.
For example, the proposition ¬ (p∧ ¬ q).
Table indicates how the truth table of ¬ (p∧ ¬ q) is constructed. Observe that the first
columns of the table are for the variables p, q, . . . and that there are enough rows in
the table, to allow for all possible combinations of T and F for these variables.
Remark: 1) In order to avoid an excessive number of parentheses, we sometimes adopt
an order of precedence for the logical connectives.
Specifically, ¬ has precedence over ∧ which has precedence over ∨
For example, ¬ p ∧ q means ( ¬ p) ∧ q and not ¬ (p ∧ q).
2) For 2 variables, as above, 4 rows are necessary; for 3 variables, 8 rows are necessary;
and, in general, for n variables, rows are required
TAUTOLOGIES AND CONTRADICTIONS
Some propositions P(p, q, . . .) contain only T in the last column of their truth tables or, in
other words, they are true for any truth values of their variables. Such propositions are called
tautologies.
Analogously, a proposition P(p, q, . . .) is called a contradiction if it contains only F in the last
column of its truth table or, in other words, if it is false for any truth values of its variables.
For example: the proposition “p or not p,” that is, p ∨ ¬ p, is a tautology,
and the proposition “p and not p,” that is, p∧ ¬ p, is a contradiction
Note that the negation of a tautology is a contradiction since it is always false, and the
negation of a contradiction is a tautology since it is always true.
LOGICAL EQUIVALENCE
Two propositions P(p, q, . . .) and Q(p, q, . . .) are said to be logically equivalent, or simply
equivalent or equal, denoted by P(p, q, . . .) ≡ Q(p, q, . . .), if they have identical truth
tables.
Consider, for example, the truth tables of ¬ (p ∧ q) and ¬ p∨ ¬ q.
Observe that both truth tables are the same, that is, both propositions are false in the first
case and true in the other three cases. Accordingly, we can write ¬ (p ∧ q) ≡ ¬ p ∨ ¬ q
In other words, the propositions are logically equivalent.
Remark: Let p be “Roses are red” and q be “Violets are blue.” Let S be the statement:
“It is not true that roses are red and violets are blue.”
Then S can be written in the form ¬ (p ∧ q). However, as noted above, ¬ (p ∧ q) ≡ ¬ p ∨
¬ q. Accordingly, S has the same meaning as the statement: “Roses are not red, or violets
are not blue.”
ALGEBRA OF PROPOSITIONS
CONDITIONAL AND BICONDITIONAL STATEMENTS
Many statements, are of the form “If p then q.” Such statements are called conditional
statements and are denoted by p → q
The conditional p → q is frequently read “p implies q” or “p only if q.”
The conditional p → q is false only when the first part p is true and the second part q
is false. Accordingly, when p is false, the conditional p → q is true regardless of the
truth value of q.
Another common statement is of the form “p if and only if q.” Such statements are
called biconditional statements and are denoted by p ↔ q
The biconditional p ↔ q is true whenever p and q have the same truth values and
false otherwise.
Note that the truth table of ¬ p ∨q and p → q are identical, that is, they are both
false only in the second case. Accordingly, p → q is logically equivalent to ¬ p ∨ q;
that is,
p→q≡ ¬p∨q
In other words, the conditional statement “If p then q” is logically equivalent to the
statement “Not p or q” which only involves the connectives ∨ and ¬ and thus was
already a part of our language
ARGUMENTS
An argument is an assertion that a given set of propositions , called premises, yields (has
a consequence) another proposition Q, called the conclusion. Such an argument is
denoted by Ͱ Q
Definition: An argument Ͱ Q is said to be valid if Q is true whenever all the premises are
true.
An argument which is not valid is called fallacy.
EXAMPLE:
(a) The following argument is valid:
p, p → q Ͱ q (Law of Detachment)
The proof of this rule follows from the truth table on slide 15.
Specifically, p and p → q are true simultaneously only in Case (row) 1, and in this case q is
true.
(b) The following argument is a fallacy:
p → q, q Ͱ p
For p → q and q are both true in Case (row) 3 in the truth table on slide 15 but in this case p
is false.
Theorem 4.3: The argument P1, P2, . . . , Pn Ͱ Q is valid if and only if the proposition () →
Q is a tautology.
EXAMPLE: A fundamental principle of logical reasoning states:
“If p implies q and q implies r, then p implies r”