Presentation is loading. Please wait.

Presentation is loading. Please wait.

Nested Quantifiers Goals: Explain how to work with nested quantifiers

Similar presentations


Presentation on theme: "Nested Quantifiers Goals: Explain how to work with nested quantifiers"— Presentation transcript:

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

2 Copyright © Peter Cappello
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? Copyright © Peter Cappello

3 Copyright © Peter Cappello
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 Copyright © Peter Cappello

4 Copyright © Peter Cappello
Multiple Quantifiers Legend: A B is valid x  y P(x, y) y  x P(x, y) y x P(x, y) x y P(x, y) x y P(x, y) y x P(x, y) y x P(x, y)  x y P(x, y) Copyright © Peter Cappello

5 Copyright © Peter Cappello
Translate to English 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 ) 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: Every TV quiz show has had a student from UCSB as a contestant. At least 2 students from UCSB have been contestants on Jeopardy. Copyright © Peter Cappello

7 Copyright © Peter Cappello
Translations 1. q s Q( s, q ) Copyright © Peter Cappello

8 Copyright © Peter Cappello
2. s1 s2 ( I( s1, s2 )  Q( s1, Jeopardy )  Q( s2 , Jeopardy ) ) Copyright © Peter Cappello

9 Negating Nested Quantifiers
Negate x y ( P( x, y )  Q( x, y ) ) so that no quantifiers are negated. x y ( P( x, y )  Q( x, y ) ). Copyright © Peter Cappello 9

10 Negating Nested Quantifiers
Negate x y ( P( x, y )  Q( x, y ) ) so that no quantifiers are negated. x y ( P( x, y )  Q( x, y ) ). x y ( P( x, y )  Q( x, y ) ). Copyright © Peter Cappello

11 Negating Nested Quantifiers
Negate x y ( P( x, y )  Q( x, y ) ) so that no quantifiers are negated. x y ( P( x, y )  Q( x, y ) ). x y ( P( x, y )  Q( x, y ) ). x y  ( P( x, y )  Q( x, y ) ). Copyright © Peter Cappello 11

12 Negating Nested Quantifiers
Negate x y ( P( x, y )  Q( x, y ) ) so that no quantifiers are negated. x y ( P( x, y )  Q( x, y ) ). x y ( P( x, y )  Q( x, y ) ). x y  ( P( x, y )  Q( x, y ) ). x y (  P( x, y )   Q( x, y ) ). Copyright © Peter Cappello 12 12


Download ppt "Nested Quantifiers Goals: Explain how to work with nested quantifiers"

Similar presentations


Ads by Google