Documente Academic
Documente Profesional
Documente Cultură
Dr Ovidiu Bagdasar
1 / 13
Lecture Outline
2 / 13
Boolean types
Boolean datatype: set B = {T , F } = {0, 1}, and the operations on B.
Boolean Operations:
:BB
: BB B
: BB B
: B B B
: B B B
1
1
0
0
1
0
1
0
p
0
0
1
1
pq
pq
pq
pq
1
1
1
0
1
0
0
0
1
0
1
1
1
0
0
1
3 / 13
4 / 13
p
0
0
1
1
q
1
0
1
0
pq
0
0
1
0
H
1
1
0
1
4 / 13
5 / 13
q
1
1
0
0
1
1
0
0
r
1
0
1
0
1
0
1
0
pq
1
1
0
0
0
0
0
0
pr
1
1
1
1
1
0
1
0
qr
1
1
1
0
1
1
1
0
G
1
1
1
0
1
0
1
0
H
1
1
1
0
1
0
1
0
5 / 13
OR
AND
6 / 13
7 / 13
Logic Questions
1. Let p = she is kind Let q = she is strict
Write each of the following sentences symbolically.
a) She is kind but strict.
b) She is not both kind and strict.
c) She is neither kind nor strict.
2. Suppose x is a particular real number. Let p, q and r symbolise
0 < x , x < 3 and x = 3 respectively.
Write the following inequalities symbolically.
a) x = 3
b) 0 < x < 3
c) 0 < x 3
3. Show that (p q ) and p q are not logically equivalent.
8 / 13
(p q ) = p q
(p q ) = p q
Distributive Law
p (q r ) = (p q ) (p r )
p (q r ) = (p q ) (p r )
Associative Law
p (q r ) = (p q ) (p r )
p (q r ) = (p q ) (p r )
Observation: Applying to an expression has the following effect:
p becomes p (and of course, p becomes p)
becomes
becomes
Dr Ovidiu Bagdasar (Comp&Maths)
9 / 13
Quantifiers
for all
existential quantifier there exists
universal quantifier
Examples:
x
x
x
x
x
N
N
N
N
N
[x 0]
[even(x )]
[even(2x )]
[x > 4]
[x < 4]
10 / 13
11 / 13
11 / 13
11 / 13
12 / 13
To do
Assessed work:
CM Test 2 released today!
Get the best mark you can!
Weekly Homework: All problems in the tutorial sheet for Lecture 4.
Next week:
Disjunctive normal forms (d.n.f)
Conjunctive normal forms (c.n.f)
Useful reading:
Logical Equivalence
Dnf with Karnaugh maps
13 / 13