Chapter 1 - Formal Logic
Chapter 1 - Formal Logic
Unit 1
FORMAL LOGIC
Propositional Logic
A proposition: is a declarative sentence that is either true or false,
but not both.
The NEGATION
Let p be a proposition.
The negation of p, denoted by ¬ p,
is the statement "It is not the case that p.“
The proposition ¬ p is read "not p." The truth value of the negation
of p, (¬ p), is the opposite of the truth value of p.
Solution:
The negation is
"It is not the case that today is Friday."
This negation can be more simply expressed by
"Today is not Friday,"
Or, "It is not Friday today."
EXAMPLE:
Find the negation of the proposition
"At least 20 mm of rain fell today in Madinah.“
and express this in simple English.
Solution:
The negation is "It is not the case that at least
20 mm of rain fell today in Madinah."
Solution:
The conjunction of these propositions, p /\ q, is the
proposition
THE DISJUNCTION
"Students who have taken calculus or physics, but not both, can
enroll in this class.“
That is, students that can take the class are those:
1) who have taken only calculus,
2) who have taken only physics
This is XOR
Conditional Statements
Note that the statement p → q is true when both p and q are true
and when p is false (no matter what truth value q has).
Solution:
p → q represents the statement
"If Ahmad learns discrete structures, then he will find a
good job."
EXAMPLE:
In which cases the following statement will be T and
when will it be F?
"If it is sunny today, then we will go to the beach.“
Solution:
The statement is true unless it is indeed sunny
today, but we do not go to the beach.
EXAMPLE:
In which cases the following statement will be T
and when it will be F
"If today is Friday, then 2 + 3 = 5 . “
Solution:
is always true from the definition of a conditional
statement, because its conclusion is true
EXAMPLE:
In which cases the following statement will be T
and when it will be F
"If today is Friday, then 2 + 3 = 6 . “
Solution:
is true every day except Friday, even though
2 + 3 = 6 is false.
CONVERSE, CONTRAPOSITIVE, AND INVERSE
EXAMPLE :
What are the contrapositive, the converse, and
the inverse of the conditional statement
"The home team wins whenever it is raining.
Solution:
Because "q whenever p" is one of the ways to
express the conditional statement p → q , the
original statement can be rewritten as
The statement is: "If it is raining, then the home team wins."
SOLUTION
The converse is
"If the home team wins, then it is raining."
the contrapositive
"If the home team does not win, then it is not raining."
The inverse is
"If it is not raining, then the home team does not win."
BICONDITIONALS:
another way to combine propositions that expresses that two propositions have
the same truth value.
DEFINITION :
Let p and q be propositions.
TRUE when p and q have the same truth values (Both TRUE or both FALSE ),
and is FALSE otherwise.
That is why we use the words "if and only if " to express this
logical connective and why it is symbolically written by
combining the symbols → and ←
EXAMPLE :
Let p be the statement "You can take the flight"
and let q be the statement "You buy a ticket.“
Find p ↔ q
SOLUTION
p ↔ q is the statement
"You can take the flight if and only if you buy a ticket."
Example
How many rows are there in a truth table with
3 propositional variables?
Solution:
2n where n is the number of propositions.
So the number of rows is 23 = 8 rows
Bits and Boolean Variables
Computers represent information using bits
A bit may have one of two values: 0, 1
There are two possible truth values: T, F. Therefore, a bit
can be used to represent a truth value as shown in this
table:
A variable is called a Boolean variable if its value can only
be either true or false.
A Boolean variable can be represented using a bit.
Bit Operations
Bit Operations correspond to Logical Connectives
After replacing true by 1 and false by 0 in the truth tables,
we can use the bit operators OR, AND, and XOR as follow:
Bit Strings and Bitwise Operations
A bit string is a sequence of zero or more bits.
The length of this string is the number of bits in the string.
101010011 is a bit string of length nine.
We can extend bit operations to bit strings.
bitwise OR, bitwise AND, and bitwise XOR
Bitwise OR of two strings of the same length is the string that have
the OR of the corresponding bits in the two strings
Similarly for bitwise AND and bitwise XOR
We use the symbols , , and to represent the bitwise
OR, bitwise AND, and bitwise XOR operations, respectively
Example
Find the bitwise OR, bitwise AND, and bitwise XOR of the bit
strings: 01 1011 0110 and
11 0001 110 1
Solution
The bitwise OR, bitwise AND, and bitwise XOR of these
strings are obtained by taking the OR, AND, and XOR of the
corresponding bits, respectively
Example
Evaluate the following expression.
11001 (11011 10010)
Solution
"You can access the internet from campus only if you are a
computer science major or you are not a freshman.”
Example 3
Propositional Equivalences
An important type of step used in a mathematical argument is the
replacement of a statement with another statement with the same
truth value.
DEFINITION :
EXAMPLE:
Example:
1) Prove that
2) Prove that
De Morgan’s Laws
¬(r s) is equivalent to ¬r ¬ s
(p r) (q r) (p q) r
( p r) ( q r) Definition of implication
prqr Associative
pqrr Commutative
( p q) (r r) Associative
(p q) r De Morgan, Idempotent
(p q) r Definition of implication
Example 2
Using logical equivalences, show that the following
proposition is a tautology
(p q) (p q)
(p q) (p q) Implication
( p q) (p q) De Morgan
( p p) ( q q) Commutative, Associative
TT Negation
T Identity
Example 3
Using logical equivalences, show that the following compound
propositions are logically equivalent