Professional Documents
Culture Documents
Course Work:
Students grades are calculated according to their
performance in the following course work:
Class Standing 50 % 50 %
50%
Academic Integrity:
--- Plagiarism, cheating, and other forms of academic
dishonesty are prohibited and may result in grade F for the
course.
--- An incomplete grade is given only for an exceptional reason
and such reason must be documented.
2021-01-17
Module #1 - Logic
Module #1:
Foundations of Logic
• Propositional logic:
– Basic definitions.
– Equivalence rules & derivations.
Propositional Logic
Propositional Logic is the logic of compound
statements built from simpler statements
using so-called Boolean connectives.
Some applications in computer science: George Boole
(1815-1864)
• Design of digital electronic circuits.
• Expressing conditions in programs.
• Queries to databases & search engines.
Chrysippus of Soli
2021-01-17 Asst Prof. Ronald F. Judan (ca. 281 B.C. – 205 B.C.)6
Module #1 - Logic Topic #1 – Propositional Logic
Definition of a Proposition
A proposition (p, q, r, …) is simply a statement (i.e.,
a declarative sentence) with a definite meaning,
having a truth value that’s either true (T) or false
(F) (never both, neither, or somewhere in
between).
(However, you might not know the actual truth
value, and it might be situation-dependent.)
(for now: think True/False only!)
Examples of Propositions
• “It is raining.” (In a given situation.)
• “Beijing is the capital of China.” • “1 + 2 = 3”
But, the following are NOT propositions:
• “Who’s there?” (interrogative, question)
• “La la la la la.” (meaningless interjection)
• “Just do it!” (imperative, command)
• “Yeah, Way nas di, whatever...” (vague)
• “1 + 2” (expression with a non-true/false value)
Consider the statement "You are either rich or happy." For this statement to be false,
you can't be rich and you can't been happy. In other words, the opposite is to be not
rich and not happy. Or if we rewrite it in terms of the original statement we get "You
are not rich and not happy."
If we let A be the statement "You are rich" and B be the statement "You are happy",
then the negation of "A or B" becomes "Not A and Not B."
In general, we have the same statement: The negation of "A or B" is the statement "Not
A and Not B."
So the negation of "if A, then B" becomes "A and not B".
Example.
• Now let's consider a statement involving some
mathematics. Take the statement "If n is even,
then n2 is an integer." For this statement to be
false, we would need to find an even integer n for
which n2 was not an integer. So the opposite of
this statement is the statement that "n is even and
n2 is not an integer."
Example.
• Consider the statement "For all integers n, either n is even or n is odd".
Although the phrasing is a bit different, this is a statement of the form "If A,
then B." We can reword this sentence as follows: "If n is any integer, then
either n is even or n is odd."
How would we negate this statement? For this statement to be false, all we
would need is to find a single integer which is not even and not odd. In other
words, the negation is the statement "There exists an integer n, so that n is not
even and n is not odd."
In general, when negating a statement involving "for all," "for every", the
phrase "for all" gets replaced with "there exists." Similarly, when negating a
statement involving "there exists", the phrase "there exists" gets replaced with
"for every" or "for all."
Example.
Negate the statement "If all rich people are happy, then all poor
people are sad."
• First, this statement has the form "If A, then B", where A is the
statement "All rich people are happy" and B is the statement "All poor
people are sad." So the negation has the form "A and not B." So we
will need to negate B. The negation of the statement B is "There exists
a poor person who is not sad."
Putting this together gives: "All rich people are happy, but there exists
a poor person who is not sad" as the negation of "If all rich people are
happy, then all poor people are sad."
Summary
Statement Negation
Operators / Connectives
An operator or connective combines one or
more operand expressions into a larger
expression. (E.g., “+” in numeric exprs.)
Unary operators take 1 operand (e.g., −3);
binary operators take 2 operands (eg 3 4).
Propositional or Boolean operators operate on
propositions or truth values instead of on
numbers.
2021-01-17 Asst Prof. Ronald F. Judan 17
Module #1 - Logic
A Simple Exercise
Let p=“It rained last night”,
q=“The sprinklers came on last night,”
r=“The lawn was wet this morning.”
Translate each of the following into English:
¬p = “It didn’t rain last night.”
r ¬p = “The lawn was wet this morning, and
it didn’t rain last night.”
¬ r p q = “Either the lawn wasn’t wet this
morning, or it rained last night, or
the sprinklers came on last night.”
2021-01-17 Asst Prof. Ronald F. Judan 25
Module #1 - Logic Topic #1.0 – Propositional Logic: Operators
Examples of Implications
• “If this lecture ends, then the sun will rise
tomorrow.” True or False?
• “If Tuesday is a day of the week, then I am
a penguin.” True or False?
• “If 1+1=6, then Bush is president.”
True or False?
• “If the moon is made of green cheese, then I
am richer than Bill Gates.” True or False?
2021-01-17 Asst Prof. Ronald F. Judan 31
Module #1 - Logic
Logical Equivalence
Compound proposition p is logically
equivalent to compound proposition q,
written pq, IFF the compound
proposition pq is a tautology.
Compound propositions p and q are logically
equivalent to each other IFF p and q
contain the same truth values as each other
in all rows of their truth tables.
2021-01-17 Asst Prof. Ronald F. Judan 41
Module #1 - Logic Topic #1.1 – Propositional Logic: Equivalences
Proving Equivalence
via Truth Tables
Ex. Prove that pq (p q).
1. You can access the internet from the campus only if you are an info tech
student or you are not a freshman.
2. You cannot access the internet if you are a sophomore unless you are an info
tech student.
3. Suppose we have the following statements for P and Q.
P: It rains ;Q: They can cancel school Write the ff forms:
a) implication
b) converse
c) Inverse
d) Contapositive
Exercises
1. Write the truth table for (PVQ)→R.
2. Show that ⌐(P V Q) is equivalent to ⌐PɅ⌐Q.
3. Construct a truth table: (⌐ P Ʌ Q) V (PɅ⌐Q)
4. Show that ⌐(P Ʌ Q) is equivalent to ⌐PV⌐Q.
5. Show that PɅ(QɅR) is equivalent to (PɅQ) ɅR.
6. Show that P→(Q→R) is equivalent to (PɅQ)→R.
7. Show that P→Q is not equivalent to the converse Q→P.
Assignment 1 whole: Nos. 4,5,6 only
Course Textbook(s)
1- Kenneth H. Rosen, "Discrete Mathematics and its
Applications", McGraw-Hill, Fifth Edition,2003.