Mathematics for Computer Science Predicates MIT 6.042J/18.062J Propositions with variables Predicate Logic, I Example: P(x,y) ::= [x + 2 = y] Quantifiers ∀ , ∃ Albert R Meyer, February 17, 2012 Albert R Meyer, February 17, 2012 lec 2F.1 lec 2F.2 Predicates Quantifiers P(x,y) ::= [x + 2 = y] ∀ x For ALL x x = 1 and y = 3: P(1,3) is true ∃ y There EXISTS some y x = 1 and y = 4: P(1,4) is false NOT (P(1,4)) is true Albert R Meyer, February 17, 2012 lec 2F.3 Albert R Meyer, February 17, 2012 lec 2F.4 ∀ is like AND ∃ is like OR Let s range over 6.042 staff Let t range over 6.042 staff P(s) ::= [s is Pumped about 6.042] B(t) ::= [t took 6.042 Before] ∀ s. P(s) ∃ t. B(t) same as same as B(Drew) OR B(Peter) OR P(Drew) AND P(Peter) AND P(Keshav) AND … AND P(Michaela) B(Keshav) OR…OR B(Michaela) Albert R Meyer, February 17, 2012 lec 2F.5 Albert R Meyer, February 17, 2012 lec 2F.6 1
Existential Quantifier Universal Quantifier Let x, y range over N x, y range over N R(y) ::= ∀ x. x < y Q(y) ::= ∃ x. x < y R(1) is F ([x < 1] is F for x=5) Q(3) is T ([x < 3] is T for x=1) R(8) is F ([x < 8] is F for x=12) Q(1) is T ([x < 1] is T for x=0) R(10 100 ) is F Q(0) is F ([x < 0] is not T ([x < 10 100 ] is F for x=10 100 ) for any x in N ) Albert R Meyer, February 17, 2012 Albert R Meyer, February 17, 2012 lec 2F.7 lec 2F.8 virus attack, I: ∀∃ virus attack, II: ∃∀ ∀ v ∈ virus . ∃ d ∈ defense. ∃ d ∈ defense . ∀ v ∈ virus. d protects against v d protects against v For every virus, I have a defense: I have one defense good That’s what we want! against MYDOOM , use Defender against every attack. against ILOVEYOU , use Norton against BABLAS , use Zonealarm… Example: d is MITviruscan, protects against all viruses ∀∃ is expensive! Albert R Meyer, February 17, 2012 lec 2F.9 Albert R Meyer, February 17, 2012 lec 2F.10 Alternating Quantifiers Reverse the Quantifiers G ::= ∀ x ∃ y. x < y H ::= ∃ y ∀ x. x y < ≤ x, y range over Domain of Discourse H is: Domain Domain G is: F N T N T F Z - ints < 0 F F � - reals < 0 T Albert R Meyer, February 17, 2012 lec 2F.15 Albert R Meyer, February 17, 2012 lec 2F.16 2
MIT OpenCourseWare http://ocw.mit.edu 6.042J / 18.062J Mathematics for Computer Science Spring 20 15 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Recommend
More recommend