1. propositional logic
TRANSCRIPT
-
7/23/2019 1. Propositional Logic
1/38
1
Propositional Logic
Rosen 5Rosen 5ththed., 1.1-1.2ed., 1.1-1.2
-
7/23/2019 1. Propositional Logic
2/38
2
Foundations of Logic: Overview
Proositiona! !ogic:Proositiona! !ogic:
"#asic definitions.#asic definitions.
"$%uiva!ence ru!es & derivations.$%uiva!ence ru!es & derivations.
Predicate !ogicPredicate !ogic
"Predicates.Predicates.
"'uantified redicate e(ressions.'uantified redicate e(ressions.
"$%uiva!ences & derivations.$%uiva!ences & derivations.
-
7/23/2019 1. Propositional Logic
3/38
)
Proositiona! Logic
Propositional LogicPropositional Logicis the !ogic of co*oundis the !ogic of co*ound
state*ents +ui!t fro* si*!er state*entsstate*ents +ui!t fro* si*!er state*ents
usingusingBooleanBooleanconnectives.connectives.
!ications:!ications:
esign of digita! e!ectronic circuits.esign of digita! e!ectronic circuits.
$(ressing conditions in rogra*s.$(ressing conditions in rogra*s.
'ueries to data+ases & search engines.'ueries to data+ases & search engines.
-
7/23/2019 1. Propositional Logic
4/38
efinition of aProposition
propositionproposition//pp,, qq,, rr, 0 is si*! a, 0 is si*! a
statementstatement //i.e.i.e., a dec!arative sentence, a dec!arative sentencewithwith
a definite meaninga definite meaning, having a, having a truth valuetruth valuethat3s eitherthat3s either truetrue/4 or/4 orfalsefalse/F //F /nevernever
+oth, neither, or so*ewhere in +etween.+oth, neither, or so*ewhere in +etween.
6n6nprobability theory,probability theory,we assignwe assign degrees of certaintydegrees of certaintyto roositions. For now: 4rue7Fa!se on!89to roositions. For now: 4rue7Fa!se on!89
-
7/23/2019 1. Propositional Logic
5/38
5
$(a*!es of Proositions
6t is raining.; /hina.;
1 ? 2 @ );1 ? 2 @ );
4he fo!!owing are4he fo!!owing are NOTNOTroositions:roositions:
Aho3s thereB; /interrogative, %uestionAho3s thereB; /interrogative, %uestion
La !a !a !a !a.; /*eaning!ess inter=ectionLa !a !a !a !a.; /*eaning!ess inter=ection Cust do it8; /i*erative, co**andCust do it8; /i*erative, co**and
Deah, 6 sorta dunno, whatever...; /vagueDeah, 6 sorta dunno, whatever...; /vague
1 ? 2; /e(ression with a non-true7fa!se va!ue1 ? 2; /e(ression with a non-true7fa!se va!ue
-
7/23/2019 1. Propositional Logic
6/38
E
nn operatoroperatororor connectiveconnectiveco*+ines one orco*+ines one or
*ore*ore operandoperand e(ressions into a !argere(ressions into a !arger
e(ression. /e(ression. /E.g.E.g., ?; in nu*eric e(rs., ?; in nu*eric e(rs.
UnaryUnaryoerators tae 1 oerand /oerators tae 1 oerand /e.g.,e.g.,-)G-)G
binarybinary oerators tae 2 oerands /oerators tae 2 oerands /egeg)) ..
PropositionalPropositionalororBooleanBooleanoerators oerate onoerators oerate on
roositions or truth va!ues instead of onroositions or truth va!ues instead of on
nu*+ers.nu*+ers.
Oerators 7 >onnectives
-
7/23/2019 1. Propositional Logic
7/38
H
4he Iegation Oerator
4he unar4he unar negation operatornegation operatorJ; /J; /N!N!
transfor*s a ro. into its !ogica!transfor*s a ro. into its !ogica!negationnegation..
E.g.E.g.6f6fpp@ 6 have +rown hair.;@ 6 have +rown hair.;
then Jthen Jpp@ 6 do@ 6 do notnothave +rown hair.;have +rown hair.;
!ruth table!ruth tablefor IO4:for IO4: p p
4 F
F 4
-
7/23/2019 1. Propositional Logic
8/38
K
4he >on=unction Oerator
4he +inar4he +inar con"unction operatorcon"unction operator; /; /#N$#N$
co*+ines two roositions to for* theirco*+ines two roositions to for* their
!ogica!!ogica! con"unctioncon"unction..
E.g.E.g.6f6fpp@6 wi!! have sa!ad for !unch.; and@6 wi!! have sa!ad for !unch.; and
q%q%6 wi!! have stea for dinner.;, then6 wi!! have stea for dinner.;, then
ppqq@6 wi!! have sa!ad for !unch@6 wi!! have sa!ad for !unch andand
6 wi!! have stea for dinner.;6 wi!! have stea for dinner.;
-
7/23/2019 1. Propositional Logic
9/38
Iote that aIote that a
con=unctioncon=unction
pp11pp22 00 ppnn
ofof nnroositionsroositions
wi!! have 2wi!! have 2nnrowsrows
in its truth ta+!e.in its truth ta+!e. J andJ and oerations together are universa!,oerations together are universa!,
i.e., sufficient to e(ressi.e., sufficient to e(ress anyanytruth ta+!e8truth ta+!e8
>on=unction 4ruth 4a+!e
p q pq
F F F
F 4 F
4 F F
4 4 4
-
7/23/2019 1. Propositional Logic
10/38
1M
4he is=unction Oerator
4he +inar4he +inar dis"unction operatordis"unction operator; /; /&&
co*+ines two roositions to for* theirco*+ines two roositions to for* their
!ogica!!ogica! dis"unctiondis"unction..
pp@4hat car has a +ad engine.;@4hat car has a +ad engine.;
q%q%4hat car has a +ad car+uretor.;4hat car has a +ad car+uretor.;
ppqq@$ither that car has a +ad engine,@$ither that car has a +ad engine, oror
that car has a +ad car+uretor.;that car has a +ad car+uretor.;
-
7/23/2019 1. Propositional Logic
11/38
11
Iote thatIote thatppqq *eans*eans
thatthatppis true, oris true, or qqisis
true,true, or bothor bothare true8are true8
No this oeration isNo this oeration is
a!so ca!!eda!so ca!!ed inclusive or,inclusive or,
+ecause it+ecause it includesincludesthetheossi+i!it that +othossi+i!it that +othppandand qqare true.are true.
J; and J; and ; together are a!so universa!.; together are a!so universa!.
is=unction 4ruth 4a+!e
p q pq
F F F
F 4 T
4 F T
4 4 4
-
7/23/2019 1. Propositional Logic
12/38
12
Ni*!e $(ercise
LetLetpp@6t rained !ast night;,@6t rained !ast night;,
qq@4he srin!ers ca*e on !ast night,;@4he srin!ers ca*e on !ast night,;
rr@4he !awn was wet this *orning.;@4he !awn was wet this *orning.;
4rans!ate each of the fo!!owing into $ng!ish:4rans!ate each of the fo!!owing into $ng!ish:
JJpp @@
rrJJpp @@
JJ rr ppq %q %
6t didn3t rain !ast night.;4he !awn was wet this *orning, andit didn3t rain !ast night.;$ither the !awn wasn3t wet this
*orning, or it rained !ast night, or
the srin!ers ca*e on !ast night.;
-
7/23/2019 1. Propositional Logic
13/38
1)
4heE'clusive rOerator
4he +inar4he +inar e'clusive(or operatore'clusive(or operator; /; /)&)&
co*+ines two roositions to for* theirco*+ines two roositions to for* their
!ogica! e(c!usive or; /e(=unctionB.!ogica! e(c!usive or; /e(=unctionB.
pp@ 6 wi!! earn an in this course,;@ 6 wi!! earn an in this course,;
qq@@6 wi!! dro this course,;6 wi!! dro this course,;
ppqq @ 6 wi!! either earn an for this@ 6 wi!! either earn an for this
course, or 6 wi!! dro it /+ut not +oth8;course, or 6 wi!! dro it /+ut not +oth8;
-
7/23/2019 1. Propositional Logic
14/38
1
Iote thatIote thatppqq *eans*eans
thatthatppis true, oris true, or qqisis
true, +uttrue, +ut not bothnot both88
4his oeration is4his oeration is
ca!!edca!!ed e'clusive or,e'clusive or,
+ecause it+ecause it excludesexcludesthetheossi+i!it that +othossi+i!it that +othppandand qqare true.are true.
J; and J; and ; together are; together are notnotuniversa!.universa!.
$(c!usive-Or 4ruth 4a+!e
p q pq
F F F
F 4 4
4 F 4
4 4 F
-
7/23/2019 1. Propositional Logic
15/38
15
Iote thatIote that $ng!ish$ng!ishor; isor; is by itselfby itself a*+iguousa*+iguous
regarding the +oth; case8regarding the +oth; case8
Pat is a singer orPat is a singer or
Pat is a writer.; -Pat is a writer.; -
Pat is a *an orPat is a *an or
Pat is a wo*an.; -Pat is a wo*an.; -
Ieed conte(t to disa*+iguate the *eaning8Ieed conte(t to disa*+iguate the *eaning8
For this c!ass, assu*e or; *eansFor this c!ass, assu*e or; *eans inc!usiveinc!usive..
Iatura! Language is *+iguous
p q por q
F F FF 4 4
4 F 4
4 4undef.
-
7/23/2019 1. Propositional Logic
16/38
1E
4he*mplicationOerator
4he4he implicationimplicationpp qqstates thatstates thatppi*!iesi*!ies q.q.
6t is FLN$6t is FLN$ on!on!in the case that is 4R$in the case that is 4R$
+ut % is FLN$.+ut % is FLN$.
E.g.E.g.,,pp@6 a* e!ected.;@6 a* e!ected.;
qq@6 wi!! !ower ta(es.;@6 wi!! !ower ta(es.;
pp q %q % 6f 6 a* e!ected, then 6 wi!! !ower6f 6 a* e!ected, then 6 wi!! !ower
ta(es;ta(es; /e!se it cou!d go either wa/e!se it cou!d go either wa
-
7/23/2019 1. Propositional Logic
17/38
1H
6*!ication 4ruth 4a+!e
pp qq isis falsefalseon! whenon! when
ppis true +utis true +ut qqisis notnottrue.true.
pp qq doesdoes notnot i*!i*!
thatthatppcausescausesqq88
pp qq doesdoes notnot i*!i*!
thatthatpporor qqare ever trueare ever true88
E.g.E.g./1@M/1@M igs can f!; is 4R$8igs can f!; is 4R$8
p q pq
F F 4
F 4 44 F F
4 4 4
-
7/23/2019 1. Propositional Logic
18/38
1K
$(a*!es of 6*!ications
6f this !ecture ends, then the sun wi!! rise6f this !ecture ends, then the sun wi!! rise
to*orrow.;to*orrow.; !rue!rueoror+alse+alseBB
6f 4uesda is a da of the wee, then 6 a* a6f 4uesda is a da of the wee, then 6 a* a
enguin.;enguin.; !rue!rueoror+alse+alseBB
6f 1?1@E, then
-
7/23/2019 1. Propositional Logic
19/38
1
6nverse, >onverse, >ontraositive
No*e ter*ino!og:No*e ter*ino!og:
4he4he inverseinverse ofofpp qq is: Jis: Jpp JJqq
4he4he converseconverseofofpp qq is:is: qq pp..
4he4he contrapositivecontrapositiveofofpp qq is: Jis: Jqq JJp.p.
One of these has theOne of these has thesame meaningsame meaning/sa*e/sa*etruth ta+!e astruth ta+!e asppqq. >an ou figure out. >an ou figure out
whichBwhichB
-
7/23/2019 1. Propositional Logic
20/38
2M
ow do we now for sureB
Proving theProving the e%uiva!encee%uiva!enceofofpp qq and itsand its
contraositive using truth ta+!es:contraositive using truth ta+!es:
p q q p pq qp
F F 4 4 4 4F 4 F 4 4 4
4 F 4 F F F4 4 F F 4 4
-
7/23/2019 1. Propositional Logic
21/38
21
4he biconditionaloerator
4he4he biconditionalbiconditionalpp qq states thatstates thatppis trueis true ififand only ifand only if*++- q*++- qis true.is true.
6t is 4R$ when +oth6t is 4R$ when +othpp qq andand qq pp areare4R$.4R$.
pp @ 6t is raining.;@ 6t is raining.;
qq@@4he ho*e tea* wins.;4he ho*e tea* wins.;pp q %q % 6f and on! if it is raining, the ho*e6f and on! if it is raining, the ho*e
tea* wins.;tea* wins.;
-
7/23/2019 1. Propositional Logic
22/38
22
#iconditiona! 4ruth 4a+!e
pp qq *eans that*eans thatppandand qq
have thehave the samesametruth va!ue.truth va!ue.
Iote this truth ta+!e is theIote this truth ta+!e is the
e(acte(act oppositeoppositeofof 3s83s8
pp qq *eans J/*eans J/pp qq
pp qq doesdoes notnot i*!i*!
ppandand qqare true, or cause each other.are true, or cause each other.
p q pq
F F 4
F 4 F
4 F F
4 4 4
-
7/23/2019 1. Propositional Logic
23/38
2)
#oo!ean Oerations Nu**ar
Ae have seen 1 unar oerator / ossi+!eAe have seen 1 unar oerator / ossi+!e
and 5 +inar oerators /1E ossi+!e.and 5 +inar oerators /1E ossi+!e.
p q p pq pq pq pq pqF F 4 F F F 4 4F 4 4 F 4 4 4 F
4 F F F 4 4 F F4 4 F 4 4 F 4 4
-
7/23/2019 1. Propositional Logic
24/38
2
Precedence of Logica! Oerators
JJ 11
22
))
55
Oerator Precedence
-
7/23/2019 1. Propositional Logic
25/38
25
Iested Proositiona! $(ressions
se arentheses tose arentheses togroup sub(e'pressionsgroup sub(e'pressions::
6 =ust saw * o!d6=ust saw * o!dffriendriend, and either, and either he3she3s
ggrownrownoror 63ve63vesshrunhrun.; @.; @ff//ggss" //ffgg ss wou!d *ean so*ething different wou!d *ean so*ething different
" ffggss wou!d +e a*+iguous wou!d +e a*+iguous
# convention, J; taes# convention, J; taesprecedenceprecedenceoverover+oth +oth ; and ; and ;.;.
" JJss ff *eans /J *eans /Jssff ,, notnot J /J /ss ff
-
7/23/2019 1. Propositional Logic
26/38
2E
No*e !ternative Iotations
Ia*e: not and or (or i*!ies iff
Proositiona! !ogic:
#oo!ean a!ge+ra: p pq ?
>7>??7Cava /wordwise: ! && || != ==
>7>??7Cava /+itwise: ~ & | ^
Logic gates:
-
7/23/2019 1. Propositional Logic
27/38
)M
4auto!ogies and >ontradictions
tautologytautologyis a co*ound roosition that isis a co*ound roosition that is
truetrueno matter whatno matter whatthe truth va!ues of itsthe truth va!ues of its
ato*ic roositions are8ato*ic roositions are8
E'.E'.pp pp Ahat is its truth ta+!eB9 Ahat is its truth ta+!eB9
contradictioncontradiction is a co*. ro. that isis a co*. ro. that is falsefalse
no *atter what8no *atter what8 E'.E'.pp pp 4ruth ta+!eB94ruth ta+!eB9
Other co*. ros. areOther co*. ros. are contingenciescontingencies..
-
7/23/2019 1. Propositional Logic
28/38
)1
Proositiona! $%uiva!ence
4wo4wosyntacticallysyntactically//i.e.,i.e., te(tua!! differentte(tua!! different
co*ound roositions *a +eco*ound roositions *a +e
semanticallysemantically identica! /identica! /i.e.,i.e., have the sa*ehave the sa*e*eaning. Ae ca!! the**eaning. Ae ca!! the* equivalentequivalent. Learn:. Learn:
QariousQarious equivalence rulesequivalence rules ororlawslaws..
ow toow toproveprovee%uiva!ences usinge%uiva!ences usingsymbolicsymbolicderivationsderivations..
-
7/23/2019 1. Propositional Logic
29/38
)2
Proving $%uiva!ences
>o*ound roositions>o*ound roositionsppandand qq are !ogica!!are !ogica!!
e%uiva!ent to each othere%uiva!ent to each other IFFIFFppandand qq containcontain
the sa*e truth va!ues as each other inthe sa*e truth va!ues as each other in a!!a!!rows of their truth ta+!es.rows of their truth ta+!es.
>o*ound roosition>o*ound roositionppisis logicallylogically
equivalentequivalent to co*ound roositionto co*ound roosition qq,,writtenwrittenppqq,, IFFIFFthe co*oundthe co*ound
roositionroositionppqq is a tauto!og.is a tauto!og.
-
7/23/2019 1. Propositional Logic
30/38
))
E'.E'.Prove thatProve thatppqq//pp qq..
p q ppqq pp qq ppqq ppqq
F F
F 4
4 F
4 4
Proving $%uiva!ence
via 4ruth 4a+!es
F4
44
4
4
4
44
4
FF F
F
FF
FF
44
-
7/23/2019 1. Propositional Logic
31/38
)
$%uiva!ence Laws
4hese are si*i!ar to the4hese are si*i!ar to the arith*etic identitiesarith*etic identities
ou *a have !earned in a!ge+ra, +ut forou *a have !earned in a!ge+ra, +ut for
roositiona! e%uiva!ences instead.roositiona! e%uiva!ences instead. 4he rovide a4he rovide aattern or te*!ateattern or te*!atethat canthat can
+e used to *atch *uch *ore co*!icated+e used to *atch *uch *ore co*!icated
roositions and to find e%uiva!ences forroositions and to find e%uiva!ences forthe*.the*.
-
7/23/2019 1. Propositional Logic
32/38
)5
$%uiva!ence Laws - $(a*!es
*dentity*dentity:: ppTT p pp pFF pp
$omination$omination:: ppTT TT ppFF FF
*dempotent*dempotent:: pppp p pp ppp pp
$ouble negation$ouble negation pp pp
/ommutative p/ommutative p
qq
qq
p pp p
qq
qq
pp
#ssociative#ssociative //ppqqrrpp//qqrr
/ /ppqqrrpp//qqrr
-
7/23/2019 1. Propositional Logic
33/38
)E
ore $%uiva!ence Laws
$istributive$istributive:: pp//qqrr //ppqq//pprr
pp//qqrr //ppqq//pprr
$e 0organ1s$e 0organ1s::
//ppqq pp qq
//ppqq pp qq
-
7/23/2019 1. Propositional Logic
34/38
)H
ore $%uiva!ence Laws
#bsorption#bsorption::
pp//ppqq pp
pp //pp qq pp
!rivial tautology2contradiction!rivial tautology2contradiction::
ppppTT ppppFF
-
7/23/2019 1. Propositional Logic
35/38
)K
efining Oerators via $%uiva!ences
sing e%uiva!ences, we cansing e%uiva!ences, we can definedefineoeratorsoerators
in ter*s of other oerators.in ter*s of other oerators.
6*!ication:6*!ication: ppqq pp qq
#iconditiona!:#iconditiona!:ppqq //ppqq//qqpp
ppqq //ppqq
$(c!usive or:$(c!usive or: ppqq//ppqq//ppqq
ppqq//ppqq//qqpp
-
7/23/2019 1. Propositional Logic
36/38
)
n $(a*!e Pro+!e*
>hec using a s*+o!ic derivation whether>hec using a s*+o!ic derivation whether//pp qq //pprr pp qqrr..
//pp qq //pprr$(and definition of$(and definition of 99 //pp qq //pprr
efn. ofefn. of 99 //pp qq ////pprr //pprr
eorgan3s Law9eorgan3s Law9
//ppqq////pprr //pprr
-
7/23/2019 1. Propositional Logic
37/38
M
$(a*!e >ontinued...
//pp qq ////pprr //pprrco**utes9co**utes9
//qqpp////pprr //pprrassociative9associative9
qq//pp////pprr //pprr distri+. distri+. overover 99qq//////pp//pprr //pp//pprr
assoc.9assoc.9 qq//////pppp rr //pp//pprr
trivia! taut.9trivia! taut.9 qq////TTrr //pp//pprr
do*ination9do*ination9qq//TT//pp//pprr
identit9identit9 qq//pp//pprrcont.cont.
-
7/23/2019 1. Propositional Logic
38/38
1
$nd of Long $(a*!e
qq//pp//pprr
eorgan3s9eorgan3s9 qq//pp//pprr
ssoc.9ssoc.9 qq////pppp rr
6de*otent96de*otent9 qq//pprr
ssoc.9ssoc.9 //qqpp rr
>o**ut.9>o**ut.9 pp qqrr
3.E.$. quod erat demonstrandum-3.E.$. quod erat demonstrandum-