150 likes | 522 Views
More on Composite of Existential and Universal Quantifiers. (x) (y) <=> (y) (x) ? Let’s look at this with an example: Let x be father and y be children (x) (y) : There exists a father for all children (y) (x) : For all the children there is a father
E N D
More on Composite of Existential and Universal Quantifiers • (x) (y) <=> (y) (x) ? • Let’s look at this with an example: • Let x be father and y be children • (x) (y) : There exists a father for all children • (y) (x) : For all the children there is a father • These are clearly different sentences in that: • There is one father for all the children --- very unlikely • For all the children, there is a father. (Every child has a father. ---- much more reasonable! )
View the two cases in tabular form Let F( x, y ) be the predicate that states x is the father of y. Note x is the bound variable and y is free; as you change y, the expression still holds true. X1 X2 X3 (x)F( x, y) T T y1 F F T F T y2 F V (y) Ξ(x)F( x, y) F T y3 F T Yes F F T T y4 V (y) F(x,y) F F F Ξ (x) V (y) F(x,y) No y is the bound and x is free; as you Iterate through the x’s, the expression Is never true
Existential and Universal Quantifiers Basics • Note that (x) P(x) is the equivalent to saying: P(a1), P(a2), - - - - , P(an) is true for all the n instances of a’s. or (x) P(x) P(a1) /\ P(a2)/\ - - - - /\ P(an) • Note that (x) P(x) is the same as saying: at least one of the following P(a1); P(a2); - - - -; P(an) is true or (x) P(x) P(a1) \/ P(a2) \/ - - - - \/ P(an)
Relationships Between Existential and Universal Quantifiers • From previous slide, we can have: ~ (x) P(x) = ~ ( P(a1) /\ P(a2) /\ - - - /\ P(an) ) = ~P(a1) \/ ~P(a2) \/ - - - \/ ~P(an) = (x) ~P(x) Thus we have the following: ~ (x) P(x) (x)~P(x) Your try the: ~ (x) P(x) (x) ~P(x)
More Than One Predicate • Consider the following: (x) ( P(x) /\ Q(x) ) = [ (P(a1)/\Q(a1)) \/ (P(a2)/\Q(a2)) \/ - - - ] ~ (x)(P(x) /\ Q(x)) = ~ [ (P(a1)/\Q(a1)) \/ (P(a2)/\Q(a2)) \/ - - - ] = ~(P(a1)/\Q(a1)) /\ ~(P(a2)/\Q(a2)) /\ - - - - ] = (x) [ ~ ( P(x) /\ Q(x) ) ] = (x) (~P(x) \/ ~Q(x) ) So we have : ~ (x) (P(x)/\Q(x)) (x) (~P(x) \/ ~Q(x) )
Relationship Between Existential and Universal Quantifiers • ~ (x) p(x) <=> (x) ~p(x) • ~ (x) p(x) <=> (x) ~p(x) • ~ (x) (p(x) /\ q(x)) <=> (x) (~p(x) \/ ~q(x) )
More Relationships in Predicate Calculus • (x) P(x) -> (x) P(x) • (x) P(x) <-> ~ (x) ~P(x) • (x) P(x) <-> ~ (x) ~P(x) • (x) (y) P(x,y) <-> (y) (x) P(x,y) • (x) (y) P(x,y) <-> (y) (x) P(x,y) • (x) (y) P(x,y) -> (y) (x) P(x,y) Note: the one way arrow versus the two way arrow
Sample Proof • V(x) P(x) -> Ξ (x) P(x) • P(x1) ------ P(xn) -> P(x1) V ------ V P(xn) • ~ [ P(x1) ----- P(xn)] V P(x1) V ------ V P(xn) • ~ P(x1) V ------V ~P(xn) V P(x1) V ----- VP(xn) • ~P(x1) V P(x1) V ---------------------V ~P(xn) V P(xn) • T V -------------------V T • True • A tautology
Does “Spot” have a tail? • Now that we have gone through the fundamentals of predicate calculus, let’s try the earlier reasoning process: • Let p(x) indicate that x is a dog • Let q(y) indicate that y has a tail • Let spot be the specific dog in question. • (x) (p(x) -> q(x)) : every dog has a tail (premise 1) • p(spot) : spot is a dog (premise 2) • p(spot) -> q(spot) : universal instantiation with “spot”& premise 1 • p(spot), p(spot) -> q(spot) => q(spot) : using modus ponens rule • therefore q(spot) : spot has a tail !
Additional Concepts • Singular existential quantifier • There exists only one object that has the desired characteristic • We represent that by placing a 1 subscript to the existential quantifier (x) P(x) • Counting quantifiers • Represents the number of objects in a group that has the specific characteristic • We will use Ω to represent counting quantifiers. • Example 1: Ω(x): 1,2, - - - ,10 x>6 will yield 4 • Example 2: Ω(x) : programs has_bug(x) stands for the number of programs that are defective 1
Additional Concepts • Pre-condition and Post-condition • These were used when we covered code correctness • How should we articulate and what should we use to articulate the pre-condition and post-conditions of computing systems. • Variables • Global • Local • In the case of a variable, x, we may differentiate the post-condition by using an apostrophe,’, • X for the variable for pre-condition • X’ for the same variable for post-condition
Converting English Phrases to Pre/Post Conditions in Predicate Calculus • Example from page 86 of your text: “ The procedure SunUpPost has two parameters. The first parameter is an integer array, Vals, which has a range of 1, - - -,10. The second parameter is a boolean variable, Outrange. This is set to true if any value of the Vals is less than or greater than 2000.” • Let the counting quantifier, omega, be represented by Ω, • Pre-conditions: • [Ω par: variables param_of(par, SunUpPost) ] = 2 • param_of(Vals, SunUpPost) /\ param_of( OutRange, SunupPost) • i: 1, - - -,10 Integer( Vals(i) ) • boolean(Outrange) • Post-conditions: • i : 1, - - - , 10 Vals’(i) = Vals(i) • ( i: 1, - - -, 10 Vals(i) ~= 2000 ) -> ( Outrange’ = True )