Nested Quantifiers Nested Iteration Let the domain be
Nested Quantifiers
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 2013 2
boolean ax. Ey. P() // 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; } Copyright © Peter Cappello 2011 Computational Interpretation 3
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) Copyright © Peter Cappello 2011 4
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 2011 5
Translate to a Logical Expression • Let Q( s, q ) denote “s has been a contestant on quiz show q” • I( s 1, s 2 ) denote “student s 1 is student s 2” • The domain for s, s 1, s 2 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. Copyright © Peter Cappello 2011 6
Translations 1. q s Q( s, q ) Copyright © Peter Cappello 2011 7
2. s 1 s 2 ( I( s 1, s 2 ) Q( s 1, Jeopardy ) Q( s 2 , Jeopardy ) ) Copyright © Peter Cappello 2011 8
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 ) ). Copyright © Peter Cappello 2011 9
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 ) ). Copyright © Peter Cappello 2011 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 ) ). 3. x y ( P( x, y ) Q( x, y ) ). Copyright © Peter Cappello 2011 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 ) ). 4. x y ( P( x, y ) Q( x, y ) ). Copyright © Peter Cappello 2011 12
- Slides: 12