nested quantifiers goals: 1.explain how to work with nested quantifiers 2.show that the order of...
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](https://reader035.vdocuments.site/reader035/viewer/2022072008/56649d745503460f94a54273/html5/thumbnails/1.jpg)
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](https://reader035.vdocuments.site/reader035/viewer/2022072008/56649d745503460f94a54273/html5/thumbnails/2.jpg)
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](https://reader035.vdocuments.site/reader035/viewer/2022072008/56649d745503460f94a54273/html5/thumbnails/3.jpg)
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](https://reader035.vdocuments.site/reader035/viewer/2022072008/56649d745503460f94a54273/html5/thumbnails/4.jpg)
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](https://reader035.vdocuments.site/reader035/viewer/2022072008/56649d745503460f94a54273/html5/thumbnails/5.jpg)
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](https://reader035.vdocuments.site/reader035/viewer/2022072008/56649d745503460f94a54273/html5/thumbnails/6.jpg)
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](https://reader035.vdocuments.site/reader035/viewer/2022072008/56649d745503460f94a54273/html5/thumbnails/7.jpg)
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](https://reader035.vdocuments.site/reader035/viewer/2022072008/56649d745503460f94a54273/html5/thumbnails/8.jpg)
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](https://reader035.vdocuments.site/reader035/viewer/2022072008/56649d745503460f94a54273/html5/thumbnails/9.jpg)
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](https://reader035.vdocuments.site/reader035/viewer/2022072008/56649d745503460f94a54273/html5/thumbnails/10.jpg)
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](https://reader035.vdocuments.site/reader035/viewer/2022072008/56649d745503460f94a54273/html5/thumbnails/11.jpg)
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](https://reader035.vdocuments.site/reader035/viewer/2022072008/56649d745503460f94a54273/html5/thumbnails/12.jpg)
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 ) ).