Vous êtes sur la page 1sur 21

Housekeeping

Support classes (and MLC) start this week.


One of the 9am support classes today wasnt staffed (our tutor had a
family emergency). If you were in this class, then youre welcome to
attend any other support class this week.
Assignment 1 is due at your support class in week 3 (1620 March).

MAT1830

Lecture 4: Logic

Lecture 4. Logic

p
T
T
F
F

The simplest and most commonly used part of


logic is the logic of and,orand not,which
is known as propositional logic.
A proposition is any sentence which has a definite truth value (true=T or false=F), such as
1 + 1 = 2, or
11 is a prime number.
but not

which is the inclusive


written p and/or qand
p, q is true).
Finally, : (also called
the table

What is your name? or


This sentence is false.
Propositions are denoted by letters such as
p; q; r; : : :, and they are combined into compound
propositions by connectives such as ^ (and), _
(or) and : (not).

4.1

Connectives ^, _ and :

^, _ and : are called connectivesbecause they


can be used to connect two sentences p and q into
one. These particular connectives are dened so

q
T
F
T
F

p
T
F

The connectives ^, _
the propositional variab
take the two values T an
_ and : are also called t

4.2

Implication

Another important trut


which corresponds to if

Question 4.1 Which of the following are propositions?

1+1=3
1+1
3 divides 7
37

Yes
No
Yes
No

Propositions are denoted by letters such as


p; q; r; : : :, and they are combined into compound
propositions by connectives such as ^ (and), _
(or) and : (not).

4.1

The connectives ^, _
the propositional variab
take the two values T an
_ and : are also called t

Connectives ^, _ and :

4.2

^, _ and : are called connectivesbecause they


can be used to connect two sentences p and q into
one. These particular connectives are dened so
that they agree with the most common interpretations of the words and, or and not.
To dene p ^ q, for example, we only have to
say that p ^ q is true only when p is true and q is
true, hence p ^ q is dened by the following truth
table:
p
T
T
F
F

q
T
F
T
F

Implication

Another important trut


which corresponds to if
q in ordinary speech.
In ordinary speech the
only on what happens w
ple to decide whether
MCG ooded !

p^q
T
F
F
F

it is enough to see w
MCG is ooded. Thus
true when p is false.
This means that p !
p
T
T
F
F

Similarly, p_q is true when p is true or q is true,


but now we have to be more precise, because or
has at least two meanings in ordinary speech.
We dene _ by the table
1

q
T
F
T
F

p
T
T
F
F

q
T
F
T
F

p^q
T
F
F
F

it is enough to see
MCG is ooded. Thus
true when p is false.
This means that p !
p
T
T
F
F

Lecture 4. Logic
Similarly, p_q is true when p is true or q is true,

commonly used part of


orand not,which
l logic.
entence which has a defT or false=F), such as

= 2, or
me number.

r name? or
ce is false.

oted by letters such as


ombined into compound
ves such as ^ (and), _

but now we have to be more precise, because or


has at least two meanings in ordinary speech.
We dene _ by the table
p
T
T
F
F

q
T
F
T
F

p_q
T
T
T
F

which is the inclusive sense of p or q (often


written p and/or qand meaning at least one of
p, q is true).
Finally, : (also called negation) is dened by
the table
p
T
F

:p
F
T

The connectives ^, _ and : are functions of


the propositional variables p and q, which can

q
T
F
T
F

T
T
F
F

orand not,which
logic.
ntence which has a defor false=F), such as

2, or
e number.

^, _ and :

nnectivesbecause they
o sentences p and q into
nnectives are dened so
most common interpre, or and not.
ample, we only have to
when p is true and q is
d by the following truth

T
T
T
F

which is the inclusive sense of p or q (often


written p and/or qand meaning at least one of
p, q is true).
Finally, : (also called negation) is dened by
the table

name? or
ce is false.

ted by letters such as


mbined into compound
ves such as ^ (and), _

T
F
T
F

p
T
F

:p
F
T

The connectives ^, _ and : are functions of


the propositional variables p and q, which can
take the two values T and F. For this reason, ^,
_ and : are also called truth functions.

4.2

Implication

Another important truth function is p ! q,


which corresponds to if p then q or p implies
q in ordinary speech.
In ordinary speech the value of p ! q depends
only on what happens when p is true. For example to decide whether
MCG ooded ! the cricket is o,

Notation

and
or (inclusive)
not

Order of precedence
has precedence over the other connectives.
For example, p q means p (q).
For other connectives well always use brackets to make the meaning
clear.

Example Find the truth tables for p (q r ) and (p q) (p r ).

p
T
T
T
T
F
F
F
F

q
T
T
F
F
T
T
F
F

r
T
F
T
F
T
F
T
F

qr
T
T
T
F
T
T
T
F

p (q r )
T
T
T
F
F
F
F
F

pq
T
T
F
F
F
F
F
F

pr
T
F
T
F
F
F
F
F

(p q) (p r )
T
T
T
F
F
F
F
F

take the two values T and F. For this reason, ^,


_ and : are also called truth functions.

^, _ and :

4.2

nnectivesbecause they
wo sentences p and q into
nnectives are dened so
most common interpred, or and not.
ample, we only have to
when p is true and q is
d by the following truth

Implication

Another important truth function is p ! q,


which corresponds to if p then q or p implies
q in ordinary speech.
In ordinary speech the value of p ! q depends
only on what happens when p is true. For example to decide whether
MCG ooded ! the cricket is o,

p^q
T
F
F
F

it is enough to see what happens when the


MCG is ooded. Thus we agree that p ! q is
true when p is false.
This means that p ! q has the truth table
p
T
T
F
F

hen p is true or q is true,


ore precise, because or
s in ordinary speech.
ble
1

q
T
F
T
F

p!q
T
F
T
T

Notation

and
or (inclusive)
not
implies

Why do F F and F T evaluate to T?

For all integers x 3, if x is prime then x is odd.


For x = 3 we have T T
For x = 4 we have F F
For x = 9 we have F T

So if we want the above statement to be true we have to live with F F


and F T evaluating to T.

But its not a perfect representation of regular English:


If I am a woman then I am stunningly beautiful.

p
T
T
F
F

There are several ways implications are written


in English. For example we could write:
MCG ooded ! the cricket
is oas
if the MCG is ooded then
the cricket is o

p!q

p_q
F
T
T
F

if p then q

4.4

the cricket is o if the MCG


is ooded

q if p

the MCG is ooded only if


the cricket is o

p only if q

the cricket is o provided the


MCG is ooded

q provided p

the cricket is o when the


MCG is ooded

q when p (or q
whenever p)
p is su cient for q
q is necessary for p

the MCG is ooded hence the


cricket is o

p hence q

the cricket is o because the


MCG is ooded

q because p

since the MCG is ooded the


cricket is o

since p; q

4.3

q
T
F
T
F

Remarks

1. The symbols ^ and _ are intentionall


to the symbols \ and [ for set intersec
union because
x2A\B
x2A[B

, (x 2 A) ^ (x 2 B
, (x 2 A) _ (x 2 B

(We study sets later.)


2. There is no great dierence betwee
). However, it is convenient to use the
! to build formulas of propositional lo
to use ) when talking about formulas.
In particular, we shall later dene a
between formulas called logical conseque
can say that p is a logical consequence
for example, by using the ) sign:
p ^ q ) p:

Other connectives

If we wrote instead p ^ q ! p it would lo


single formula instead of a relation betw
two formulas p and p ^ q.
3. The exclusive or function _ is
XOR in some programming languages.
4. If we write 0 for F and 1 for T th
comes the function

Question 4.2
p: I carry an umbrella.
q: It is raining.

I carry an umbrella, because it is raining.


I carry an umbrella, hence it is raining.
It is raining, hence I carry an umbrella.
I dont carry an umbrella unless it is raining.
It is raining because I dont carry an umbrella.
It rains only if I dont carry an umbrella.
I carry an umbrella only if it rains.

qp
pq
qp
pq
p q
q p
pq

3. The exclusive o
XOR in some programm
4. If we write 0 for F
comes the function

cricket is o

4.3

Other connectives

p
1
1
0
0

Two important connectives related to ! are $


(if and only if) and _ (exclusive or).
p $ q is dened to be (p ! q) ^ (q ! p). It
works out to be true precisely when p, q are both
true or both false.
p
T
T
F
F

q
T
F
T
F

p!q
T
F
T
T

q!p
T
T
F
T

This is also known a


cause 1 + 1 = 2
0 (m
called the mod 2 dier
same as a b, mod 2.)
5. The mod 2 sum occ
two switches p, q cont
truth value of p_q tells
not, and the light can be
state by switching the v

p$q
T
F
F
T

The negation of this function is p_q, which is


true when exactly one of p, q is true.
p
T
T
F
F

implications are written


we could write:

cket

p!q

hen

if p then q

CG

q if p

4.4

q
T
F
T
F

p_q
F
T
T
F

Remarks

1. The symbols ^ and _ are intentionally similar

q
1
0
1
0

and
or (inclusive)
not
implies
if and only if
exclusive or

Question 4.3

Would you like coffee or tea?


Oranges or lemons are a good source of vitamin C.
He will arrive in a minute or two.

exclusive
inclusive
exclusive

hen

if p then q

CG

q if p

y if

p only if q

the

the

the

4.4

q provided p

q when p (or q
whenever p)
p is su cient for q
q is necessary for p
p hence q

Remarks

1. The symbols ^ and _ are intentionally similar


to the symbols \ and [ for set intersection and
union because
x2A\B
x2A[B

, (x 2 A) ^ (x 2 B);
, (x 2 A) _ (x 2 B):

(We study sets later.)


2. There is no great dierence between ! and
). However, it is convenient to use the symbol
! to build formulas of propositional logic, and
to use ) when talking about formulas.
In particular, we shall later dene a relation
between formulas called logical consequence. We
can say that p is a logical consequence of p ^ q,
for example, by using the ) sign:
p ^ q ) p:

the

q because p

the

since p; q

If we wrote instead p ^ q ! p it would look like a


single formula instead of a relation between the
two formulas p and p ^ q.
3. The exclusive or function _ is written
XOR in some programming languages.
4. If we write 0 for F and 1 for T then _ be-

the

q because p

the

since p; q

If we wrote instead p ^ q ! p it would look like a


single formula instead of a relation between the
two formulas p and p ^ q.
3. The exclusive or function _ is written
XOR in some programming languages.
4. If we write 0 for F and 1 for T then _ becomes the function

tives

p
1
1
0
0

ves related to ! are $


exclusive or).
(p ! q) ^ (q ! p). It
isely when p, q are both

q!p
T
T
F
T

q
1
0
1
0

p_q
0
1
1
0

This is also known as the mod 2 sum, because 1 + 1 = 2


0 (mod 2). (It could also be
called the mod 2 dierencebecause a + b is the
same as a b, mod 2.)
5. The mod 2 sum occurs in many homes where
two switches p, q control the same light. The
truth value of p_q tells whether the light is on or
not, and the light can be switched to the opposite
state by switching the value of either p or q.

p$q
T
F
F
T

nction is p_q, which is


p, q is true.
2

Vous aimerez peut-être aussi