nested quantifiers goals: 1.explain how to work with nested quantifiers 2.show that the order of...

12
Nested Quantifiers Goals: 1. Explain how to work with nested quanti ers 2. Show that the order of quanti cation matters. 3. Work with logical expressions involving multiple quanti ers.

Upload: shanna-morton

Post on 21-Dec-2015

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Nested Quantifiers Goals: 1.Explain how to work with nested quantifiers 2.Show that the order of quantification matters. 3.Work with logical expressions

Nested Quantifiers

Goals:

1. Explain how to work with nested quantifiers

2. Show that the order of quantification matters.

3. Work with logical expressions involving multiple quantifiers.

Page 2: Nested Quantifiers Goals: 1.Explain how to work with nested quantifiers 2.Show that the order of quantification matters. 3.Work with logical expressions

Copyright © Peter Cappello 2

Nested Iteration

• Let the domain be { 1, 2, …, 10 }.

• Let P( x, y ) denote x > y.

• x y P( x, y ) means x ( y P( x, y ) )

Is the above statement true?

Page 3: Nested Quantifiers Goals: 1.Explain how to work with nested quantifiers 2.Show that the order of quantification matters. 3.Work with logical expressions

Copyright © Peter Cappello 3

boolean axEyP() // x y P( x, y ) { for ( int x = 1; x <= 10; x++ ) { boolean b = false; for ( int y = 1; y <= 10; y++ ) { if ( x > y ) { b = true; break; // finding 1 y value is enough } } if ( ! b ) return false; } return true;}

Computational

Interpretation

Page 4: Nested Quantifiers Goals: 1.Explain how to work with nested quantifiers 2.Show that the order of quantification matters. 3.Work with logical expressions

Copyright © Peter Cappello 4

Multiple Quantifiers

x y P(x, y)

y x P(x, y)

x y P(x, y)

y x P(x, y)

y x P(x, y)

x y P(x, y)

y x P(x, y)

x y P(x, y)

Legend: A B is valid

Page 5: Nested Quantifiers Goals: 1.Explain how to work with nested quantifiers 2.Show that the order of quantification matters. 3.Work with logical expressions

Copyright © Peter Cappello 5

• Let the domain be the real numbers.

x y ( ( x ≥ 0 y < 0 ) x – y > 0 )

• Is there something wrong with

x ( ( x ≥ 0 y ( y < 0 ) ) x – y > 0 )

Translate to English

Page 6: Nested Quantifiers Goals: 1.Explain how to work with nested quantifiers 2.Show that the order of quantification matters. 3.Work with logical expressions

Copyright © Peter Cappello 6

Translate to a Logical Expression

• Let Q( s, q ) denote “s has been a contestant on quiz show q”

• I( s1, s2 ) denote “student s1 is student s2”

• The domain for s, s1, s2 is students at UCSB.

• The domain for q is quiz shows on TV.• Give a logical expression for:

1. Every TV quiz show has had a student from UCSB as a contestant.

2. At least 2 students from UCSB have been contestants on Jeopardy.

Page 7: Nested Quantifiers Goals: 1.Explain how to work with nested quantifiers 2.Show that the order of quantification matters. 3.Work with logical expressions

Copyright © Peter Cappello 7

Translations

1. q s Q( s, q )

Page 8: Nested Quantifiers Goals: 1.Explain how to work with nested quantifiers 2.Show that the order of quantification matters. 3.Work with logical expressions

Copyright © Peter Cappello 8

2. s1 s2 ( I( s1, s2 )

Q( s1, Jeopardy ) Q( s2 , Jeopardy )

)

Page 9: Nested Quantifiers Goals: 1.Explain how to work with nested quantifiers 2.Show that the order of quantification matters. 3.Work with logical expressions

Copyright © Peter Cappello 99

Negating Nested Quantifiers

Negate x y ( P( x, y ) Q( x, y ) ) so that no

quantifiers are negated.

1. x y ( P( x, y ) Q( x, y ) ).

Page 10: Nested Quantifiers Goals: 1.Explain how to work with nested quantifiers 2.Show that the order of quantification matters. 3.Work with logical expressions

Copyright © Peter Cappello 10

Negating Nested Quantifiers

Negate x y ( P( x, y ) Q( x, y ) ) so that no

quantifiers are negated.

1. x y ( P( x, y ) Q( x, y ) ).

2. x y ( P( x, y ) Q( x, y ) ).

Page 11: Nested Quantifiers Goals: 1.Explain how to work with nested quantifiers 2.Show that the order of quantification matters. 3.Work with logical expressions

11Copyright © Peter Cappello 11

Negating Nested Quantifiers

Negate x y ( P( x, y ) Q( x, y ) ) so that no

quantifiers are negated.

1. x y ( P( x, y ) Q( x, y ) ).

2. x y ( P( x, y ) Q( x, y ) ).

3. x y ( P( x, y ) Q( x, y ) ).

Page 12: Nested Quantifiers Goals: 1.Explain how to work with nested quantifiers 2.Show that the order of quantification matters. 3.Work with logical expressions

Copyright © Peter Cappello 121212

Negating Nested Quantifiers

Negate x y ( P( x, y ) Q( x, y ) ) so that no

quantifiers are negated.

1. x y ( P( x, y ) Q( x, y ) ).

2. x y ( P( x, y ) Q( x, y ) ).

3. x y ( P( x, y ) Q( x, y ) ).

4. x y ( P( x, y ) Q( x, y ) ).