Professional Documents
Culture Documents
Propositional Logic
outline
Propositions Propositional variables Introduction to Logical Operators Not And Or Conditional (Implication) Bi-conditional (Bi-Implication)
Refreshment Questions
Alex, Bret, Chris, Derek, Eddie, Fred, Greg, Harold,
and John are nine students who live in a three storey building, with three rooms on each floor. A room in the West wing, one in the centre, and one in the East wing. If you look directly at the building, the left side is West and the right side is East. Each student is assigned exactly one room. Can you find where each of their rooms is: 1. Harold does not live on the bottom floor. 2. Fred lives directly above John and directly next to Bret (who lives in the West wing). 3. Eddie lives in the East wing and one floor higher than Fred. 4. Derek lives directly above Fred.
Refreshment Question
From the highest floor to lowest we have:
West Centre East ==== ====== ==== Harold Derek Eddie Bret Fred Greg Alex John Chris
Propositions
A proposition is a statement that can be either
true or false
Not propositions:
Are you Mbah Surip? I hope that youll success in your study
Propositional variables
We use propositional variables to refer to
propositions
Usually are lower case letters starting with p (i.e. p,
q, r, s, etc.) A propositional variable can have one of two values: true (T) or false (F)
A proposition can be
A single variable: p An operation of multiple variables: p(qr)
value
Symbol: or ~ p = Today is not Friday
p T F
p F T
true
Symbol:
Its like the A in And
p T T
q T F
pq T F
today is my birthday
F
F
T
F
F
F
Logical operators: Or
An or operation is true if one of the operand is
true
Symbol: pq = Today is Friday or
pq
T
T F F
T
F T F
T
T T F
10
p T T F F
q T F T F
pq F T T F
one of the two horses will win the race, but not both of them
11
Symbol:
pq = If today is
p q pq
T
T F F
T
F T F
T
F T T
p
T T F
q
T F T
pq
T F T
possibilities
Note that if p is false, then
13
p
T T F F
q
T F T F
pq
T F T T
if p, then q p implies q If p, q p only if q p is sufficient for q q is necessary for p q if p q when p A necessary condition for p is q A sufficient condition for q is p q unless p q whenever p q follows from p
15
pq
pq
qp
qp
T T
T F F T F F
F
F T T
F
T F T
T
F T T
T
T F T
T
T F T
T
F T T
16
Symbol:
Alternatively, it means
p T T F F
q T F T F
pq T F F T
(if p then q) and (if q then p) Note that a bi-conditional has the opposite truth values of the exclusive or
17
grade p q pq Then pq means T T T You take this class if T F F and only if you get a F T F grade F F T Alternatively, it means If you take this class, then you get a grade and if you get a grade then you take (took) this class
18
19
table
20
Precedence of operators
Just as in algebra, operators have precedence
4+3*2 = 4+(3*2), not (4+3)*2
yields: (p (q (r)) s) (t) Not is always performed before any other operation
21
pq It is below freezing and it is snowing pq It is below freezing but not snowing pq It is not below freezing and it is not snowing pq It is either snowing or below freezing (or both) pq If it is below freezing, it is also snowing It is either below freezing or it is snowing, (pq)(pq) but it is not snowing if it is below freezing That it is below freezing is necessary and p q sufficient for it to be snowing
22
Translation Example 2
Heard on the radio:
A study showed that there was a correlation
between the more children ate dinners with their families and lower rate of substance abuse by those children Announcer conclusions:
If children eat more meals with their family, they will have lower substance abuse 2. If they have a higher substance abuse rate, then they did not eat more meals with their family p = Children eat more meals with their family q = Children have higher substance abuse 1. p q 2. q p
1.
23
Translation Example 3
I have neither given nor received help on this
exam Let p = I have given help on this exam Let q = I have received help on this exam
pq
24
Boolean Searches
(KS091201 OR KS091323) AND Amalia AND Information System
Boolean operators
Google defaults to AND; many others do not
25
Bit Operations
Boolean values can be represented as 1 (true)
and 0 (false) A bit string is a series of Boolean values. Length of the string is the number of bits.
10110100 is eight Boolean values in one string
strings
Each column is its own
Boolean operation
26