Académique Documents
Professionnel Documents
Culture Documents
Dr Ovidiu Bagdasar
1 / 18
Lecture Outline
Boolean datatype
I
I
I
boolean set
boolean functions
equivalence with sets
Truth tables
Logical sentences
2 / 18
Boolean types
Boolean datatype: the set B, and the operations on B.
Boolean types: The set of Boolean values B has the definition:
B = {true, false }
Boolean Operations:
:BB
: BB B
: BB B
: B B B
: B B B
3 / 18
4 / 18
4 / 18
p
F
T
5 / 18
Truth tables: OR
Function: OR ( binary)
OR :B B B
(p, q ) 7 r .
where
(true, true ) 7 true
(true, false ) 7 true
(false, true ) 7 true
(false, false ) 7 false
Truth table: OR
pq
T
T
F
F
T
F
T
F
T
T
T
F
6 / 18
(p, q ) 7 r .
where
(true, true ) 7 true
(true, false ) 7 false
(false, true ) 7 false
(false, false ) 7 false
Truth table: AND
pq
T
T
F
F
T
F
T
F
T
F
F
F
7 / 18
(p, q ) 7 r .
where
(true, true ) 7 true
(true, false ) 7 false
(false, true ) 7 true
(false, false ) 7 true
Truth table: IMPLIES
pq
T
T
F
F
T
F
T
F
T
F
T
T
8 / 18
(p, q ) 7 r .
where
(true, true ) 7 true
(true, false ) 7 false
(false, true ) 7 false
(false, false ) 7 true
Truth table: EQUIVALENT (pq AND qp)
pq
qp
pq
T
T
F
F
T
F
T
F
T
F
T
T
T
T
F
T
T
F
F
T
9 / 18
Logical equivalence
Remark: Logical variables can be connected by , , , ...
(i ) p q p q
(ii )(p q ) = p q
(iii )(p q ) = p q
Last two equivalences are known as De Morgans Laws.
Exercise 2 Prove the following results for sets )(using Venn diagrams)
10 / 18
Venn diagram
p
F
T
11 / 18
Venn diagram
pq
T
T
F
F
T
F
T
F
T
T
T
F
12 / 18
Venn diagram
pq
T
T
F
F
T
F
T
F
T
F
F
F
13 / 18
Sentences
Definition (Sentence)
A sentence is a statement that takes a value true or false.
Examples:
Alan Turing was a great computer scientist is a true sentence
Alan Turing could not add 2 + 2 is a false sentence
Note: Two or more sentences may be combined by NOT, AND and OR!
Examples: For sentences p, q
pq is the sentence p AND q
pq is the sentence p OR q
14 / 18
Examples
Let us consider the propositions:
p stand for x 0
q stand for y = 16
r stand for x is prime
Then
pq stands for x 0 and y = 16 ;
qr stands for y = 16 or x is prime ;
pq is false
q is false
qr is false
r is false
r is true
15 / 18
16 / 18
Maths Jokes
17 / 18
Maths Jokes
17 / 18
To do
Assessed work:
Take CM Test 1 before the deadline!
Get the best mark you can!
Weekly Homework: First problems in the tutorial sheet for Lecture 4.
Next week:
Logical formulae and operations
Quantifiers and their negation
Useful reading:
Truth tables - digital logic
BBC Bitesize - Logic Gates
Khan Academy - Logic Gate puzzler
18 / 18