Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Further Exercises for the tutorials on logic in CS 3511 1. Find a counterexample, if possible, to these statements, where the u.d. consists of all (negative and non-negative) integers: a. ∀x∀y(x2 = y 2 → x = y) Answer: x = 3, y = −3 b. ∀x∃y(y 2 = x) Answer: x = −3; also, x=5 c. ∀x∀y(xy ≥ x) Let x be any integer and y any negative integer 2. An advert in an Aberdeen supermarket says: ”All frozen foods reduced by up to 70%”. a) Is the sentence false if all frozen foods have been reduced by 1%? On my readings (see below), it is true. This indicates that there is something about the sentence that is not captured by these formulas – Perhaps the suggestion that ‘quite a few’ frozen foods are reduced by something ‘close to’ 70%. b) Propose one or more logical translations of this sentence Answer: Sentences like this are quite unclear, so it’s not as if there is exactly one correct answer. One possibility is ∀x(F (x) → ¬(RM (x)), where RM (x) stands for ‘x is reduced by more than 70%’. A perhaps more plausible option is the conjunction of the above with ∀x(F (x) → ¬(RE(x)), where RE(x) stands for ‘x is reduced (by some percentage)’. A disadvantage of this answer is that it doesn’t use logic to formalise the relation between RE and RM . A better answer might make use of the predicate R(x, y) meaning ‘x is reduced by a percentage of y’. In this case the answer suggested above becomes (1)&(2), where (1) = ∀x(F (x) → ¬∃y(y > 70&R(x, y))), and (2) = ∀x(F (x) → ∃y(y > 0&R(x, y))). One might also want to add that some articles must be reduced by as much as 70%: ∃x(F (x) ∧ R(x, 70)). 3. Use quantifiers to express the associative law for multiplication of real numbers. Answer: ∀xyz((x.y).z) = (x.(y.z)) 4. Show, using a sequence of equivalences, that the following two statements must have the same truth value: a) ¬∃x∀yP (x, y) b) ∀x∃y¬P (x, y) Answer: ¬∃x∀yP (x, y) ⇔ ∀x¬∀yP (x, y) ⇔ ∀x∃y¬P (x, y) 5. A number is called an upperbound (UB) of a set S of numbers iff it is greater than or equal to every member of S. The number x is called the least upper bound (LUB) of a set S of real numbers iff x is an upper bound of S and x is less than or equal to every upper bound of S. a.) Using quantifiers, say that x is an upper bound of S. Answer: ∀y ∈ S(x ≥ y) b.) Using quantifiers, say that x is a LUB of S. Answer: U B(x) ∧ ∀y(U B(y) → x ≤ y) c.) Prove that a set of real numbers can have at most one LUB. Answer: Suppose x1 and x2 both are LUBs of S. Then one must be bigger than the other, for example x1 > x2 . In this case, x1 is not the lowest UB of S. (This is a proof by contradiction.) d.) Give an example of a set of real numbers that has a LUB. Answer: the set {1, 2, 3} (or any other enumerated set, for that matter) e.) Give an example of a set of real numbers that does not have a LUB. Answer: The set of all real numbers. Also, the set of all real numbers greater than some value x. It’s not the case that all infinite sets qualify, witness for example the set of all (negative or non-negative) numbers smaller than 5. f.) Give an example of a set of rational numbers that has a LUB and contains it (i.e., the LUB is a member of the set) Answer: the set {1, 2, 3} again g.) Give an example of a set of rational numbers that has a LUB but does not contain it. Answer: The set of all rational numbers smaller than 5. (5 itself is the LUB of this set, but it is not an element of the set.) h.) The notion of an LUB is based on the relation ‘greater than’. Can you propose an analogous notion based on the relation ‘smaller than’ ? Answer: One can define the Lower Bound (LB) and Greatest Lower Bound (GLB) analogously, starting with LB(x) is ∀y(x ≤ y) 6. Show that the following two statements are not logically equivalent. Do this by describing (e.g., drawing) a model in which one of the two is true and the other false. (Say also which of the two formulas is true and which is false in the model.) I.a ∃xF (x) ∧ ∃xG(x) I.b ∃x(F (x) ∧ G(x)) Draw a model with just two elements a and b, where a has the properties F and ¬G, while b has the properties G and ¬F . (In addition to a and b, you can add as many objects to the model as you like, with any properties that you like.) In this model, a is true and b false. To say the same thing, we can also say that the model verifies a and falsifies b. If you prefer something more concrete (but bigger), you can also use a model consisting of all natural numbers, where F means odd and G even, for example. II.a ∀x∃y(R(x, y)) II.b ∃y∀x(R(x, y)) Hint: when drawing the model, draw an arrow going from a to b to say that R(a, b). Draw a model containing two objects, say a and b. There are only two arrows in the model: one pointing from a to b, and one from b to a. This verifies a but not b. (Think of a marriage where the man loves the husband and the husband loves the man, but neither loves him/herself.) Many other models will do, including the empty model, which also verifies a while falsifying b. III.a ∀zF (z) III.b ∀zF (z) ∧ ∃zF (z) The empty model verifies a but falsifies b. (The empty model has an empty universe of discourse, so there’s not much to draw here.) IV.a ∃x∃y∃z(x 6= y ∧ y 6= z) IV.b ∃x∃y∃z(x 6= y ∧ y 6= z ∧ x 6= z) b says there are at least three elements in the model, in the usual way. a is quite similar but because only two inequalities are written, we can’t be sure that x 6= z; as a result, a only says there are at least two elements. Therefore, any model with exactly 2 elements in it will verify a but not b. V.a ∃x∃y(x 6= y ∧ ∀z(z = x ∨ z = y)) V.b ∃x∃y(x 6= y ∧ (∀z(z = x) ∨ ∀z(z = y))) The point here is that b is contradictory (whereas a only says that there exist exactly two elements in the domain). Any model that has exactly two elements in it will verify a, but not b. (Because b is contradictory, no model can verify b.) VI.a ∀x∃y(R(x, y)) VI.b ∀x∃y(R(x, y) ∧ x 6= y) Draw a model containing exactly one element, let’s call it a, which stands in the relation R to itself (as indicated by an arrow going from a to a). VII.a ∀x∀y((P (x) ∧ P (y)) → x = y) VII.b ∃xy(P (y) ∧ P (x) ∧ ∀z(z = x ∨ z = y)) Formula a says there is at most one object with property P. Formula b says there are either one or two such objects. A model containing exactly two objects with the property P verifies b but not a, showing the two formulas to be non-equivalent. VIII.a ∃xP (x) ∧ ∃x¬P (x) VIII.b ∃x(P (x) ∧ ¬P (x)). 7. Show that the following two statements are logically equivalent. Use an informal proof style, based on the meaning of quantified and disjoined formulas. a) ∀xP (x) ∨ ∀xQ(x) b) ∀x∀y(P (x) ∨ Q(y)). Why does (b) involve two variables? c) Construct a model showing that (a) is not logically equivalent to ∀x(P (x) ∨ Q(x)) 8. You will have noticed that it often does not make a difference which variables you choose in your formulas. a) Give an example of two formulas that differ only in their use of variables, and which are logically equivalent. Answer: 1c is an example. b) Give a few examples of two formulas that differ only in their use of variables, and which are not logically equivalent. What different reasons can you see why such pairs of formulas may have different meanings? Answer: One kind of situation is where replacement is not consistent, e.g. ∀xR(x, x) is changed into ∀xR(x, y). Another kind of situation is where two different variables collaps into one, as when ∀y∀xR(y, x) is changed into ∀y∀yR(y, y) (which is equivalent to ∀yR(y, y)). c) Formulate a rule that says how any given formula may be transformed into another formula that differs from it in the choice of variables only, such that the result is always logically equivalent to the original. Answer: Replace variables in such a way that any two variable occurrences that were the same remain the same, and any two variable occurrences that were different remain different. 9. Write formal proofs (using Natural Deduction- style inference rules) for the valid arguments among the following: Answer: All three arguments are valid. a.) p → r and r → s, and ¬s therefore ¬p Answer sketch: Use two applications of Modus Tollens, or use Transitivity once, followed by one application of Modus Tollens. b.) ((p ∨ q) ∨ r) and ¬q and ¬r therefore p Answer sketch: Use disjunctive syllogism twice. c.) ∀x∀yR(x, y), therefore ∀y∀xR(y, x) Answer sketch: start by using Universal Instantiation twice, leading to R(a, b) for arb. a and b. Then use Universal Generalisation twice, leading first to ∀xR(a, x), then to ∀y∀xR(y, x) 10. How would you express 10a) in a domain with 5 objects: “Most things have the property P ”. (This time it’s ok to use the usual abbreviations for things like “exactly 2”.) Answer: You could say ”either 5 things have P or 4 things have P or 3 things have P”, using a disjunction of three expressions of the form “exactly n things have P”. You can also say much more simply that “at least three things have P”: ∃xyz(x 6= y ∧ y 6= z ∧ x 6= z ∧ P (x) ∧ P (y) ∧ P (z)). 10b) “There are exactly three things that have the property P or the property Q (or both)”. (In this exercise no abbreviations are allowed.) Answer: The structure of this formula is basically the same as when you want to say that there are exactly 3 things that have S, except that S now is a disjunctive property (so you get P (x) ∨ Q(x) instead of just S(x)). For example as follows: ∃xyz(((P (x)∨Q(x))∧(P (y)∨Q(y)∧(P (z)∨Q(z))∧x 6= y ∧y 6= z ∧x 6= z ∧∀u((P (u)∨Q(u)) → (u = x ∨ u = y ∨ u = z))).