Predicates: quantifiers and implication (CSCI 2824 Spring 2015)Today's lecture:
QuantifiersWe have already seen two types of quantifiers in the previous lecture:
Truth and QuantifiersThe rule for determining the truth of a quantified statement is really simple.
Pseudo Code For Checking Exists-Formulae
/* Checking (Exists x IN S) P */ for each x IN set S, { result := CHECK P[x]; if ( result is TRUE) then return TRUE; } /* We have gone through all values in S and they all do not satisfy P */ return FALSE;
Pseudo Code For Checking Forall-Formulae
/* Checking (Forall x IN S) P */ for each x IN set S, { result := CHECK P[x]; if ( result is FALSE) then return FALSE; } /* We have gone through all values in S and all satisfy P */ return TRUE; Caution! These two pseudocodes are only meant to illustrate the idea of checking - and - formulae. In practice we would try our best avoiding using pseudocodes like these for checking, because (1) it may be that the set has infinitely many elements (e.g. when ) and (2) even if has only finitely many element, the checking by going through everything in can still be very expensive! Formulas with Multiple QuantifiersFormulas with multiple quantifiers can be often tricky and the order of quantification matters . Let be a fixed set. We ask whether the following formula is true: Let us run our checking algorithm. The outermost quantifier is a forall. Therefore, we plugin each value of and check the inner formula:
Has the inner formula been verified for all ? Now let us try this formula: This is the same formula but with the quantifiers reversed. Does it mean the same as ? Perhaps, if you paraphrase these formulae in plain language, the difference should be clear. Once again, we run our checking algorithm. The outermost quantifier is an .
Is there indeed a value of that makes the formula true? Negating FormulasLet us start by negating formulas without quantifiers. ExampleWhat is the negation of ()? Answer: We start by writing . The idea is to get rid of the sign as much as we can. First apply De Morgan's law: Therefore, we get The answer is therefore . Note the following table of negations for arithmetic predicates:
Negation with QuantifiersNow we consider negation with quantifier. Proposition 1 in Page 45 of the book is the key rule here.
Let us try some examples. ExampleNegate the formula: . Let us do it step by step: Is the negation true for the set ? Yes, there is indeed that satisifies the formula . Now let us try a formula with existential quantifier: . ImplicationsImplications are a very important concept that needs to be understood thoroughly to move forward in this course. What is an implication? Simply answer is any if.. then.. statement.
We write implications as is called the premise, hypothesis or the antecedent of the implication. is called the conclusion. Example
Practice Problem 1 in page 54 talks about writing down statements as implications. ExampleIf a triangle has three sides then it has three equal angles. We recast it as: for all triangles , if has three equal sides then has three angles. ExampleIf an integer is its own square then it is either or . Recast it as: For all integers , If then or . Logic of ImplicationsTruth Table for Implication: We noted earlier that was a place holder for . But that barely begins to address the entire story!
Note: An implication is false (or fails to hold true) only in one scenario: , the hypothesis is true but the conclusion is false. ExampleThe law says: If you are drinking alcoholic beverages, then you must be over 21 years of age. Let us analyze the various scenarios:
In other words, the implication is true no matter what if (over years of age?) is true OR (drinking alcoholic beverates) is false. ExampleConsider the statement: For every integer , if is odd then is divisible by . Is it true? The statement is of the form .
As you try a lot of choices, you see that it is NEVER the case where is true and is false. Of course, there are infinitely many cases to try so this will never convince us of the truth of the statement, since we will never have checked all this way. |