Professional Documents
Culture Documents
DS 1 Introduction
DS 1 Introduction
CC1311w
Discrete Structures
INTRODUCTION
2
►
3
► Program correctness
► Probability and gambling (or taking risks)
Not propositions:
“Who is Bob?”
“How many persons are there in this group?”
“X + 1 = 7.”
7
Propositional (or Boolean) variables
► A proposition can be
► A single variable p
► A formula of multiple variables
► E.g. p ∧ q, s ∨¬r
8
Propositional (or Boolean) operators
9
Logical operator: NOT
10
Logical operator: AND
11
Logical operator: OR
12
Logical operator: EXCLUSIVE OR
13
(Inclusive) OR or EXCLUSIVE OR?
14
Logical Operator NAND and NOR
15
Conditional Operator
16
Conditional operators
17
Conditional operators
18
Set representations
p
p
pp p∧q
q
q
¬ p∨q
p
Venn diagram
19
Bi-conditional Statements
20
Translating into English
21
Translating into English
Example
“You cannot ride the roller coaster if you are under 4 feet tall
unless you are older than 16 years old.”
(R ∧ ¬S) → ¬Q
22
Precedence of Operators
23
Boolean operators in search
► Boolean search
► Note that
► The symbol ≡ is not a logical connective
► p ≡ q is not a compound proposition but rather is the statement that p ↔ q
is a tautology
► The symbol ⇔ is sometimes used instead of ≡ to denote logical
equivalence
26
Example
►Two methods
►Using truth tables
►Not good for long formulae (e.g. involving more than 5
variables)
Solution.