0% found this document useful (0 votes)
5 views35 pages

HKCC SEHH2241 Lecture 1 Propositional Logic

The document introduces the course SEHH2241 Discrete Structures, focusing on Propositional Logic within Discrete Mathematics, which deals with finite or countably infinite sets. It outlines key topics to be covered, including logic, proofs, and mathematical induction, and emphasizes the importance of exercises from the textbook for effective learning. Additionally, it explains various logical operators and their applications in computer science, along with examples and truth tables.

Uploaded by

onon99derme
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views35 pages

HKCC SEHH2241 Lecture 1 Propositional Logic

The document introduces the course SEHH2241 Discrete Structures, focusing on Propositional Logic within Discrete Mathematics, which deals with finite or countably infinite sets. It outlines key topics to be covered, including logic, proofs, and mathematical induction, and emphasizes the importance of exercises from the textbook for effective learning. Additionally, it explains various logical operators and their applications in computer science, along with examples and truth tables.

Uploaded by

onon99derme
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Lecture 1

Propositional Logic

Introduction to SEHH2241 Discrete Structures


&
1.1 Propositional Logic

2020/9/4 1
Introduction to SEHH2241 Discrete Structures
What is Discrete Structures (or Discrete Mathematics)?

Discrete Mathematics is the branch of Mathematics in


which we deal with questions involving finite or
countably infinite sets (i.e., discrete).

- In particular, this means that the numbers involved are


either integers, or numbers closely related to them,
such as fractions or the ‘modular’ numbers.
- This means that in Discrete Mathematics, numerical
results can usually be given exactly : there is no need
for the approximations required when we have to deal
with real numbers.

Mathematics for computer science


2020/9/4 2
Introduction to SEHH2241 Discrete Structures
Topics we will cover:
Logic
Proofs
Sets
Mathematical Induction
Functions
Relations
Graphs
Trees, etc.

Teaching Plan

2020/9/4 3
Introduction to SEHH2241 Discrete Structures

A big hint for studying this subject well:

“Do as many as you can the exercises in our textbook.”

Our textbook:
Kenneth H. Rosen, Discrete Mathematics and Its Applications, 7e,
McGraw-Hill, 2012
CPCE Libraries http://lib.cpce-
polyu.edu.hk/search~S7?/tDiscrete+mathematics+and+its+applications+/tdiscrete+mathematics+and+its+applications/1
%2C1%2C6%2CB/frameset&FF=tdiscrete+mathematics+and+its+applications&5%2C%2C6

2020/9/4 4
Textbook
Cheap Mainland Edition (English)
https://world.tmall.com/item/1742
4287123.htm?spm=a312a.770071
4.0.0.OFy9wt

http://www.youlu.net/3055575

( You can buy via


1. TaoBao 淘寶, or YouLu.NET
2. 星際書店 in Mong Kok
Tel: 2388-7183 )

You may also find a free download


of this book from the Internet.

2020/9/4 5
There are answers to all the odd-numbered
questions at the back of the book;

This is very helpful and useful for learning.

2020/9/4 6
Introduction to SEHH2241 Discrete Structures

We use Moodle e-learning system

You need to download lecture notes and


tutorial exercise sheets from there yourself

Do the tutorial exercises before coming to class

2020/9/4 7
Logic
Mathematical Logic is a tool for working with
elaborate compound statements. It includes:
◼ A formal language for expressing them.
◼ A concise notation for writing them.
◼ A methodology for objectively reasoning about
their truth or falsity.
◼ It is the foundation for expressing formal proofs in
all branches of mathematics.

2020/9/4 8
1.1 Propositional Logic
Propositional Logic is the logic of compound
statements built from simpler statements
using so-called logical connectives.
Some applications in computer science:
◼ Design of digital electronic circuits.
◼ Expressing conditions in programs.
◼ Queries to databases & search engines.

2020/9/4 9
Definition of a Proposition
Definition: A proposition (denoted p, q, r, …)
is simply: a statement (i.e., a declarative
sentence) with some definite meaning, (not
vague or ambiguous) having a truth value
that’s either true (T) or false (F) (it is never
both, neither, or somewhere “in between!”)
However, you might not know the actual
truth value, and, the value might depend on
the situation or context.

2020/9/4 10
Examples of Propositions
Propositions
◼ “It is raining.”
◼ “Beijing is the capital of China.”
◼ “1 + 2 = 3”
NOT propositions
◼ “Who’s there?”
◼ “La la la la la”
◼ “Just do it!”
◼ “x + 2 = 3”

2020/9/4 11
Operators / Connectives
An operator or connective combines one or
more operand expressions into a larger
expression. (E.g., “+” in numeric expression)
Unary operators take 1 operand (e.g., −3);
Binary operators take 2 operands (e.g. 3  4).
Propositional operators / connectives operate
on propositions (or their truth values) instead
of on numbers.

2020/9/4 12
Some Popular Operators / Connectives

Formal Name Nickname Arity Symbol

Negation operator NOT Unary ¬


Conjunction operator AND Binary 

Disjunction operator OR Binary 


Exclusive-OR operator XOR Binary 

Implication operator IMPLIES Binary →


Biconditional operator IFF Binary ↔
2020/9/4 13
The Negation Operator
The unary negation operator “¬” (NOT)
transforms a proposition into its logical
negation.
E.g. If p = “I have brown hair.”
then ¬p = “I do not have brown hair.”
The truth table for NOT: p p
T :≡ True; F :≡ False T F
“:≡” means “is defined as” F T

2020/9/4 14
The Conjunction Operator
The binary conjunction operator “” (AND)
combines two propositions to form their
logical conjunction.
E.g. If p =“I will have salad for lunch.” and
q =“I will have steak for dinner.”,
then p  q =“I will have salad for lunch
and I will have steak for dinner.”

2020/9/4 15
Conjunction Truth Table
Note that a p q pq
conjunction
p1  p2  …  pn
T T T
of n propositions T F F
will have 2n rows F T F
in its truth table. F F F

2020/9/4 16
The Disjunction Operator
The binary disjunction operator “” (OR)
combines two propositions to form their
logical disjunction.
E.g. If p =“My car has a bad engine.” and
q =“My car has a bad carburetor.”
Then p  q =“Either my car has a bad
engine or my car has a bad carburetor.”

2020/9/4 17
Disjunction Truth Table
Note that p  q means
p q pq
that p is true, or q is T T T
true, or both are true! T F T
So, this operation is F T T
also called inclusive or, F F F
because it includes the
possibility that both p and q are true.
That means “at least one”

2020/9/4 18
Nested Propositional
Expressions
Use parentheses to group sub-expressions:
“I just saw my old friend, and either he’s
grown or I’ve shrunk.” = f  (g  s)
◼ (f  g)  s would mean something different
◼ fgs would be ambiguous
By convention, “¬” takes precedence over
both “” and “”.
◼ ¬ s  f means (¬s)  f , not ¬ (s  f )

2020/9/4 19
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.”
2020/9/4 20
The Exclusive Or Operator
The binary exclusive-or operator “” (XOR)
combines two propositions to form their
logical “exclusive or”
E.g. If p = “I will earn an A in this course,”
and q = “I will drop this course,”
Then p  q = “I will either earn an A in
this course or I will drop it (but not
both!)”

2020/9/4 21
Exclusive-Or Truth Table
Note that p  q means p q pq
that p is true, or q is T T F
true, but not both! T F T
This operation is F T T
called exclusive or,
because it excludes the
F F F
possibility that both p and q are true.
That means “exactly one”,
that is, “One True, One false”.
2020/9/4 22
Natural Language is
Ambiguous
Note that English “or” can be ambiguous
regarding the “both” case! p q p "or" q
“Pat is a singer or T T ?
Pat is a writer.” -  T F T
“Pat is a man or F T T
Pat is a woman.” -  F F F
Need context to disambiguate the meaning!

2020/9/4 23
The Implication Operator
The implication p → q states that p implies q.
i.e., If p is true, then q is true; but if p is not
true, then q could be either true or false.
E.g., let p = “You study hard.”
and q = “You will get a good grade.”
p → q = “If you study hard, then you
will get a good grade.”

2020/9/4 24
Implication Truth Table
p q p→q
p → q is false only when
p is true but q is not true. T T T
p → q does not say T F F The
that p causes q ! F T T only
False
p → q does not require F F T case!
that p or q are ever true!
Remember: “It cannot be T first and then F”

2020/9/4 25
English Phrases Meaning
p→q
“p implies q” “p only if q”
“if p, then q” “p is sufficient for q”
“if p, q” “q is necessary for p”
“when p, q” “q follows from p”
“whenever p, q” “q is implied by p”
“q if p”
“q when p”
“q whenever p”

2020/9/4 26
Converse, Inverse, Contrapositive
Some terminology, for an implication p → q :
◼ Its converse is: q→p
◼ Its inverse is: ¬p→¬q
◼ Its contrapositive is: ¬ q → ¬ p
Two compound propositions always have the
same truth value are called equivalent
◼ An implication and its contrapositive are
equivalent
◼ The converse and the inverse of an implication are
equivalent
2020/9/4 27
How do we know for sure?
Proving the equivalence of p → q and its
contrapositive using truth tables:

p q q p p→q q →p
T T F F T T
T F T F F F
F T F T T T
F F T T T T

2020/9/4 28
The biconditional operator
The biconditional p  q states that p is true
if and only if (IFF) q is true.
E.g. If p = “Bush wins the 2004 election.”
and q = “Bush will be president for all of
2005.”
Then p  q = “If, and only if, Bush wins
the 2004 election, Bush will be
president for all of 2005.”

2020/9/4 29
Biconditional Truth Table
p  q means that p and q p q pq
have the same truth value. T T T
Note this truth table is the T F F
exact opposite of ’s! F T F
◼ Thus, p  q means ¬(p  q)
F F T
p  q does not imply
that p and q are true, or cause each other.

2020/9/4 30
Precedence of Logical Operators
Operator Precedence
 1
 2
,  3
→ 4
 5

2020/9/4 31
Class Exercise
Let p = “You drive over 65 miles per hour”
q = “You get a speeding ticket”
Write these propositions using p and q and logical connectives.
a. You do not drive over 65 miles per hour p
b. You drive over 65 miles per hour, but you do not get a speeding
ticket. pq p→q
c. You will get a speeding ticket if you drive over 65 miles per hour
d. If you do not drive over 65 miles per hour, then you will not get
a speeding ticket. p→q
e. Driving over 65 miles per hour is sufficient for getting a speeding
ticket p→q
f. You get a speeding ticket, but you do not drive over 65 miles per
hour qp
g. Whenever you get a speeding ticket, you are driving over 65
miles per hour q→p
2020/9/4 32
Class Exercise
Construct a truth table for the following
compound proposition.
p  (p  q)

p q pq p  (p  q)
T T T F
T F T F
F T T T
F F F F
continue

2020/9/4 33
Computing Truth Values
Summary: (You need to memorize these tables by heart.)

p p p q pq p q pq p q pq


T F T T T T T F T T T
F T T F T T F T T F F
F T T F T T F T F
F F F F F F F F F

p q p→q p q pq
T T T T T T
T F F T F F
F T T F T F
F F T F F T

2020/9/4 34
Tutorial

Please attempt to do the tutorial exercises


before coming to class

2020/9/4 35

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy