6.042J / 18.062J Mathematics for Computer Science Spring 20 15 For - - PDF document

6 042j 18 062j mathematics for computer science
SMART_READER_LITE
LIVE PREVIEW

6.042J / 18.062J Mathematics for Computer Science Spring 20 15 For - - PDF document

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


slide-1
SLIDE 1

lec 2F.1 Albert R Meyer, February 17, 2012

Mathematics for Computer Science

MIT 6.042J/18.062J

Predicate Logic, I Quantifiers ∀,∃

lec 2F.2 Albert R Meyer, February 17, 2012

Predicates

Propositions with variables

Example:

P(x,y) ::= [x + 2 = y]

lec 2F.3 Albert R Meyer, February 17, 2012

Predicates

P(x,y) ::= [x + 2 = y]

x = 1 and y = 3: P(1,3) is true x = 1 and y = 4: P(1,4) is false

NOT(P(1,4)) is true

lec 2F.4 Albert R Meyer, February 17, 2012

Quantifiers

∀x For ALL x ∃y There EXISTS some y

lec 2F.5 Albert R Meyer, February 17, 2012

∀ is like AND

Let s range over 6.042 staff P(s) ::= [s is Pumped about 6.042]

∀s. P(s)

same as

P(Drew) AND P(Peter) AND P(Keshav) AND…AND P(Michaela)

lec 2F.6 Albert R Meyer, February 17, 2012

∃ is like OR

Let t range over 6.042 staff B(t) ::= [t took 6.042 Before]

∃t. B(t)

same as

B(Drew) OR B(Peter) OR B(Keshav) OR…OR B(Michaela)

1

slide-2
SLIDE 2

I have one defense good against every attack.

<

F

lec 2F.7 Albert R Meyer, February 17, 2012

Existential Quantifier

Let x, y range over N

Q(y) ::= ∃x. x < y Q(3) is T ([x<3] is T for x=1) Q(1) is T ([x<1] is T for x=0) Q(0) is F ([x<0] is not T for any x in N)

lec 2F.8 Albert R Meyer, February 17, 2012

Universal Quantifier

x, y range over N

R(y) ::= ∀x. x< y R(1) is F ([x<1] is F for x=5) R(8) is F ([x<8] is F for x=12) R(10100) is F ([x<10100] is F for x=10100)

lec 2F.9 Albert R Meyer, February 17, 2012

For every virus, I have a defense:

against MYDOOM, use Defender against ILOVEYOU, use Norton against BABLAS, use Zonealarm…

∀∃ is expensive!

virus attack, I: ∀∃

∀v ∈ virus . ∃d ∈ defense. d protects against v

lec 2F.10 Albert R Meyer, February 17, 2012

virus attack, II:∃∀

∃d ∈ defense .∀v ∈ virus. d protects against v

Example: d is MITviruscan, protects against all viruses

That’s what we want!

Albert R Meyer, February 17, 2012 lec 2F.15

x, y range over Domain of Discourse

Domain

T

ints < 0

F

reals < 0

T

G is:

Alternating Quantifiers

G ::= ∀x∃y. x < y

N

lec 2F.16 Albert R Meyer, February 17, 2012

Reverse the Quantifiers

H ::= ∃y∀x. x y

Domain

F Z- N

H is:

T

  • F

2

slide-3
SLIDE 3

MIT OpenCourseWare http://ocw.mit.edu

6.042J / 18.062J Mathematics for Computer Science

Spring 2015 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.