Lecture 07 - University of Washington Computer Science and Engineering
Lecture 07 - University of Washington Computer Science and Engineering
announcements
Reading assignment Logical inference
1.6-1.7 7th Edition 1.5-1.7 6th Edition
Logic also +as met+ods t+at let us infer implied properties from ones t+at e !no
E$ui)alence is a small part of t+is
proofs
Start it+ +#pot+eses and facts 1se rules of inference to e0tend set of facts Result is pro)ed +en it is included in t+e set
State ent
p, p $ $
proofs
S+o t+at r follo s from p7 p $7 and $ r 15 25 35 95 :5 p p$ $r $ r gi)en gi)en gi)en modus ponens from 1 and 2 modus ponens from 3 and 9
inference rules
Eac+ inference rule is ritten as: 555 +ic+ means t+at if *ot+ ; and are true t+en #ou can infer C and #ou can infer %5
For rule to *e correct .; -/ C and .; -/ % must *e a tautologies
p$ p, $ p $ , p $ p, p $ $
p, $ p$ p p $, $ p p$ p$
(i)ect P)oo* !"#e
+ot #i,e othe) )"#es
Sometimes rules don't need an#t+ing to start it+5 6+ese rules are called a0ioms:
e5g5 Excluded Middle Axiom
p p
inference rules for $uantifiers P(c) for some c x P(x) Let a *e an#t+ing*...P(a) x P(x) x P(x) P(a) for an# a x P(x) P(c) for some special c
. in the do ain o* P
Pro)e: 6+e s$uare of e)er# e)en num*er is e)en5 Formal proof of: x (E3en(x) E3en(x2))
Pro)e: 6+e s$uare of e)er# odd num*er is odd Englis+ proof of: x (5dd(x)5dd(x2)) 8et x -e an odd n" -e). 9hen x42,61 *o) so e inte0e) , (dependin0 on x) 9he)e*o)e x24(2,61)24 :,26:,6142(2,262,)61. Since 2,262, is an inte0e), x2 is odd.
rational num*ers
; real num*er 0 is rational iff t+ere e0ist integers p and $ it+ $0 suc+ t+at 0=p@$5
!ationa#(x) p $ ((x4p<$) 7nte0e)(p) 7nte0e)($) $=)
Pro)e: ?o num*er is *ot+ e)en and odd Englis+ proof: x (E3en(x)5dd(x)) x (E3en(x)5dd(x)) 8et x -e any inte0e) and s"ppose that it is -oth e3en and odd. 9hen x42, *o) so e inte0e) , and x42n61 *o) so e inte0e) n. 9he)e*o)e 2,42n61 and hence ,4n6;. &"t t2o inte0e)s cannot di**e) -y ; so this is a cont)adiction.
rational num*ers
; real num*er 0 is rational iff t+ere e0ist integers p and $ it+ $0 suc+ t+at 0=p@$5
!ationa#(x) p $ ((x4p<$) 7nte0e)(p) 7nte0e)($) $=)
rational num*ers
; real num*er 0 is rational iff t+ere e0ist integers p and $ it+ $0 suc+ t+at 0=p@$5
!ationa#(x) p $ ((x4p<$) 7nte0e)(p) 7nte0e)($) $=)
Pro)e: ,f 0 and # are rational t+en 0# is rational ,f 0 and # are rational t+en 0A# is rational
Pro)e: ,f 0 and # are rational t+en 0# is rational ,f 0 and # are rational t+en 0A# is rational ,f 0 and # are rational t+en 0@# is rational
countere0amples
6o disprove x P(x) find a countere0ample:
so e c s"ch that P(c) 2o),s -eca"se this i p#ies x P(x) 2hich is e$"i3a#ent to x P(x)
proofs
Formal proofs follo simple ell2defined rules and s+ould *e eas# to c+ec!
,n t+e same a# t+at code s+ould *e eas# to e0ecute
Englis+ proofs correspond to t+ose rules *ut are designed to *e easier for +umans to read
Easil# c+ec!a*le in principle