Download presentation
Presentation is loading. Please wait.
Published byImogen Hunt Modified over 9 years ago
1
1 CS 1502 Formal Methods in Computer Science Lecture Notes 14 Translations Mixed Quantifiers
2
2 Informal Proof Prove that if the square of an integer is even, then so is that integer. Proving the contrapositive is easier: If an integer is not even, then its square isn’t even either. Let n be an integer. Assume ~Even(n), i.e., Odd(n). Then we can express n as 2m + 1 for some m. But we see that n*n = 2(2m*m + 2m) + 1, showing that n*n is odd. Thus, we have shown ~Even(n) ~Even(n*n)
3
3 Translations Every Steeler is taller than Jim. x (Steeler(x) Taller(x, jim)) Every Steeler is taller than anyone who is the same size as Jim. x [Steeler(x) y (SameSize(y, jim) Taller(x, y))]
4
4 Translations Some Steeler is taller than Jim. x (Steeler(x) Taller(x, jim)) Some Steeler is taller than anyone who is the same size as Jim. x [Steeler(x) y (SameSize(y, jim) Taller(x, y))]
5
5 Translations Some Steeler is not taller than Jim. x (Steeler(x) Taller(x, jim)) Some Steeler is not taller than someone who is the same size as Jim. x [Steeler(x) y (SameSize(y, jim) Taller(x, y))]
6
6 Translations No Steeler is taller than Jim. x (Steeler(x) Taller(x, jim)) No Steeler is taller than somebody who is the same size as Jim. x [Steeler(x) y(SameSize(y, jim) Taller(x, y))]
7
7 Orders of Quantifiers x y P(x,y) is logically equivalent to y x P(x,y) x y P(x,y) is logically equivalent to y x P(x,y) x y P(x,y) is not logically equivalent to y x P(x,y)
8
8 A Gotcha (before moving on) Suppose a world has 4 cubes, all in the same row (a,b,c,d) Is the following true of that world? all x all y ((Cube(x) ^ Cube(y)) (LeftOf(x,y) v RightOf(x,y))) No! Can infer: LeftOf(a,a) v RightOf(a,a) (same for b,c,d) Want: all x all y ((Cube(x) ^ Cube(y) ^ x != y) (LeftOf(x,y) v RightOf(x,y)))
9
9 Translation x y P(x,y) For each x there is a y such that P(x,y). x y
10
10 Translation x y P(x,y) There is a special x such that for all y, P(x,y).
11
11 Prenex Normal Form Sentence containing no quantifiers at all, or A sentence of the form Q 1 x 1 Q 2 x 2 … Q n x n P where Q i are either the universal or existential quantifier, x i are variables and wff P is free of quantifiers. where Q i are either the universal or existential quantifier, x i are variables and wff P is free of quantifiers.
12
12 Conversion to Prenex Normal Form 1. Replace implications (whose left- or right-hand sides include quantifiers) (A B) by A B 2. Move “inwards” until there are no quantifiers in the scope of a negation 3. Rename variables so each separate variable has its own name 4. Move quantifiers to the front of the sentence, without changing their order
13
13 Example x[(C(x) y(T(y) L(x,y))) y(D(y) B(x,y))] x[ (C(x) y(T(y) L(x,y))) y(D(y) B(x,y))] x[ y(C(x) T(y) L(x,y)) y(D(y) B(x,y))] x y[ (C(x) T(y) L(x,y)) z(D(z) B(x,z))] x y z[ (C(x) T(y) L(x,y)) (D(z) B(x,z))] If you want to restore the conditional: x y z[(C(x) T(y) L(x,y)) (D(z) B(x,z))]
14
14 Translation All cubes are to the left of something large. x [Cube(x) x is to the left of something large] x [Cube(x) y (Large(y) LeftOf(x,y))] Some cube is to the left of everything large. x [Cube(x) x is to the left of everything large] x [Cube(x) y [Large(y) LeftOf(x,y)]]
15
15 Translation Taken(x,y) means x has taken class y Domain of discourse for x is all (Pitt) students Domain of discourse for y is all (Pitt) CS classes Continued…
16
16 exist x exist y Taken(x,y) A student has taken a CS class exist x all y Taken(x,y) A student has taken all the CS classes all x exist y Taken(x,y) Each student has taken some CS class exist y all x Taken(x,y) There is a CS class that all students have taken all y exist x Taken(x,y) Each CS class has been taken by at least one student
17
17 Translation Everyone ate a sandwich Ate(x,y); DoD of x is all people; DoD of y is all sandwiches Most natural: everyone ate their own sandwich: all x exist y Ate(x,y) But perhaps it was one huge sandwich: exist y all x Ate(x,y)
18
18 What do these sentences mean? exist y (Small(y) ^ all x (Small(x) y=x)) There is exactly one small thing! all x all y ((Small(x) ^ Small(y)) y=x) There is at most one small thing T if there are 0 or 1 small things (try it in TW)
19
19 Valid Arguments? exists y (Tet(y) ^ all x (Cube(x) SameSize(y,x))) --- all x (Cube(x) exists y (Tet(y) ^ SameSize(y,x))) exists y (Girl(y) ^ all x (Boy(x) Likes(x,y))) --- all x (Boy(x) exists y (Girl(y)^ Likes(x,y))) exists y all x (x != y Adjoins(x,y)) --- all x exists y (x != y Adjoins(x,y)) YES! All Are Valid
20
20 Valid Arguments? all x (Cube(x) exists y (Tet(y) ^ SameSize(y,x))) --- exists y (Tet(y) ^ all x (Cube(x) SameSize(y,x))) all x (Boy(x) exists y (Girl(y)^ Likes(x,y))) --- exists y (Girl(y) ^ all x (Boy(x) Likes(x,y))) all x exists y (x != y Adjoins(x,y)) --- exists y all x (x != y Adjoins(x,y)) No! All Are Invalid!!
21
21 Translations with Function Symbols Domain of discourse: people Every person has exactly one mother, who is older than he or she. With a function: all x OlderThan(mother(x),x) With a predicate? all x exist y (MotherOf(y,x) ^ OlderThan(y,x) ^ all z (MotherOf(z,x) y=z)) Moral: use a function when appropriate
22
22 Proofs with Multiple Quantifiers x (P(x) y F(y,x)) x y (F(y,x) L(y,x)) x (P(x) y L(y,x))
23
23
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.