Documente Academic
Documente Profesional
Documente Cultură
Lecture 2
Lecture 2
CSI30
Lecture 2
CSI30
Lecture 2
CSI30
conjunction
Lecture 2
CSI30
therefore, let
p: you can go swimming
q: you know how to swim
r: the water is (too) cold another option:
conjunction
Lecture 2
CSI30
therefore, let
p: you can go swimming
q: you know how to swim
r: the water is (too) cold another option:
conjunction
Then we get: (q r) p
Lecture 2
CSI30
b) When you buy a new car from company A, you can get $2000 cash
back or a 2% car loan
Lecture 2
CSI30
Lecture 2
CSI30
Lecture 2
System Specifications
CSI30
Lecture 2
System Specifications
CSI30
11
Lecture 2
System Specifications
CSI30
12
Lecture 2
System Specifications
CSI30
13
Lecture 2
System Specifications
CSI30
14
Lecture 2
System Specifications
CSI30
15
Lecture 2
System Specifications
CSI30
same technique:
let's check if there exists an assignment of
truth values (to p, q, r, and s) that makes all of
these compound propositions true.
16
Lecture 2
System Specifications
CSI30
same technique:
let's check if there exists an assignment of
truth values (to p, q, r, and s) that makes all of
these compound propositions true.
Lecture 2
Boolean Search
CSI30
18
Lecture 2
CSI30
In computer all the information is represented with bits (binary digit). Bit is
a symbol with two possible values: 0 (zero), and 1(one)
bit can be used to represent truth values:1 for True, 0 for False
Boolean variable is a variable with two possible values (0,1)
Note: Computer operations correspond to the logical operations.
AND
OR
XOR
0
0
1
1
0
1
0
1
xy
x y
xy
19
Lecture 2
CSI30
In computer all the information is represented with bits (binary digit). Bit is
a symbol with two possible values: 0 (zero), and 1(one)
bit can be used to represent truth values:1 for True, 0 for False
Boolean variable is a variable with two possible values (0,1)
Note: Computer operations correspond to the logical operations.
AND
OR
XOR
0
0
1
1
0
1
0
1
xy
0
0
0
1
x y
xy
20
Lecture 2
CSI30
In computer all the information is represented with bits (binary digit). Bit is
a symbol with two possible values: 0 (zero), and 1(one)
bit can be used to represent truth values:1 for True, 0 for False
Boolean variable is a variable with two possible values (0,1)
Note: Computer operations correspond to the logical operations.
AND
OR
XOR
0
0
1
1
0
1
0
1
xy
0
0
0
1
x y
0
1
1
1
xy
21
Lecture 2
CSI30
In computer all the information is represented with bits (binary digit). Bit is
a symbol with two possible values: 0 (zero), and 1(one)
bit can be used to represent truth values:1 for True, 0 for False
Boolean variable is a variable with two possible values (0,1)
Note: Computer operations correspond to the logical operations.
AND
OR
XOR
0
0
1
1
0
1
0
1
xy
0
0
0
1
x y
0
1
1
1
xy
0
1
1
0
22
Lecture 2
CSI30
In computer all the information is represented with bits (binary digit). Bit is
a symbol with two possible values: 0 (zero), and 1(one)
bit can be used to represent truth values:1 for True, 0 for False
Boolean variable is a variable with two possible values (0,1)
Note: Computer operations correspond to the logical operations.
AND
OR
XOR
0
0
1
1
0
1
0
1
xy
0
0
0
1
x y
0
1
1
1
xy
0
1
1
0
23
Lecture 2
CSI30
Exercise: find the bitwise OR, AND, and XOR of the bit strings
001110101 and 110101100 (from now on we'll be splitting the bit strings
into blocks of four to make them easier to read).
0 0111 0101
1 1010 1100
----------AND
0 0111 0101
1 1010 1100
----------OR
0 0111 0101
1 1010 1100
-----------
xy
x y
xy
XOR
24
Lecture 2
CSI30
Exercise: find the bitwise OR, AND, and XOR of the bit strings
001110101 and 110101100 (from now on we'll be splitting the bit strings
into blocks of four to make them easier to read).
0 0111 0101
1 1010 1100
----------0 0010 0100 AND
0 0111 0101
1 1010 1100
----------OR
0 0111 0101
1 1010 1100
-----------
xy
x y
xy
XOR
25
Lecture 2
CSI30
Exercise: find the bitwise OR, AND, and XOR of the bit strings
001110101 and 110101100 (from now on we'll be splitting the bit strings
into blocks of four to make them easier to read).
0 0111 0101
1 1010 1100
----------0 0010 0100 AND
0 0111 0101
1 1010 1100
----------1 1111 1101 OR
0 0111 0101
1 1010 1100
----------XOR
xy
x y
xy
0
26
Lecture 2
CSI30
Exercise: find the bitwise OR, AND, and XOR of the bit strings
001110101 and 110101100 (from now on we'll be splitting the bit strings
into blocks of four to make them easier to read).
0 0111 0101
1 1010 1100
----------0 0010 0100 AND
0 0111 0101
1 1010 1100
----------1 1111 1101 OR
0 0111 0101
1 1010 1100
----------1 1101 1001 XOR
xy
x y
xy
0
27
Lecture 2
CSI30
0 1101
0 0111
-----OR
-----AND
xy
x y
xy
0
28
Lecture 2
CSI30
0 1101
0 0111
-----0 0101 AND
------
xy
x y
xy
0
29
Lecture 2
CSI30
0 1101
0 0111
-----0 0101 AND
0 1101
0 0101
-----0 1000
xy
x y
xy
0
30
Lecture 2
Logic Puzzles
CSI30
Puzzles that can be solved using logical reasoning are called logic
puzzles.
Raymond Smullyan posed lots of logic puzzles (read page 14).
Puzzle 1:
An island has two kinds of inhabitants:
knights who always tell true, and
knaves their opposites, who always lie
We encounter two people (A and B). Determine, if possible, what A
and B are, if
a) A says: at least one of us is a knave
B says nothing.
b) A says: we are both knaves
B says nothing
31
Lecture 2
Logic Puzzles
CSI30
Puzzle 1:
An island has two kinds of inhabitants:
knights who always tell true, and
knaves their opposites, who always lie
We encounter two people (A and B). Determine, if possible, what A
and B are, if
a) A says: at least one of us is a knave
B says nothing.
p: A is a knight
q: B is a knight
A says: p q. Let's assume that A is a knight, then we have
p (p q)
T (F q) - q must be T for the entire compound proposition to be
True. Therefore, when p is True and q is False, the p (p q) is
True.
A is a knight, and B is a knave.
32
Lecture 2
Logic Puzzles
CSI30
Puzzle 1:
An island has two kinds of inhabitants:
knights who always tell true, and
knaves their opposites, who always lie
We encounter two people (A and B). Determine, if possible, what A
and B are, if
b) A says: we are both knaves
B says nothing
p: A is a knight
q: B is a knight
A says: p q. Let's assume that A is a knave (this time), then we
have p (p q)
T (T q) - q must be F for the entire compound
proposition to be True. Therefore, when p is False and q is True, the
p (p q) is True.
A is a knave, and B is a knight.
33