Logic and Sets: Coursework 1
Transcription
Logic and Sets: Coursework 1
124MS Logic and Sets Logic and Sets: Coursework 1 Question One: Find the truth value of X ∧ ((Y ⇒ W) ⇔ Z) if X is true, Y is true, and W is false and Z is false. What is the truth value of this expression if the brackets are removed? Answer: X = T, Y = T, W = F, Z = F T ∧ (( T ⇒ F ) ⇔ F ) T ∧ (( F ) ⇔ F ) T ∧ (( T )) T∧T≡T The truth value of the statement X ∧ ((Y ⇒ W) ⇔ Z) is true, as shown by my above workings. Now I will attempt to work out the truth value of X ∧ Y ⇒ W ⇔ Z. X ∧Y ⇒ W ⇔Z T∧T⇒F⇔F T⇒F⇔F F⇔F≡T The statement X ∧ Y ⇒ W ⇔ Z is also true. Question Two: Consider the following proposition:A ∧ (A ⇒ B) ∧ (B ⇒ ¬C) ⇒ B ∧ ¬C (a) Interpreting these symbols as the atomic sentences A : Logic is part of mathematics. B : Mathematics is hard. C : I enjoy logic. Interpret the above proposition as an argument in natural English: Answer: Logic is part of mathematics and if logic is part of mathematics then mathematics is hard. Also, if mathematics is hard then I do not enjoy logic, therefore mathematics is hard and I do not enjoy logic. 124MS Logic and Sets (b) By means of a truth table, find out whether the argument is valid. Answer: A ∧ (A ⇒ B) ∧ (B ⇒ ¬C) ⇒ B ∧ ¬C A t t t t f f f f 1 ∧ t t f f f f f f 10 (A t t t t f f f f 2 ⇒ t t f f t t t t 8 B) t t f f t t f f 3 ∧ f t f f f f f f 11 (B t t f f t t f f 4 ⇒ f t t t f t t t 9 ¬C) f t f t f t f t 5 ⇒ t t t t t t t t 13 B t t f f t t f f 6 ∧ f t f f f t f f 12 ¬C f t f t f t f t 7 The statement given, A ∧ (A ⇒ B) ∧ (B ⇒ ¬C) ⇒ B ∧ ¬C is a tautology because column 13 only reveals true values, thus making the statement that is given valid. Question Three: Consider the following collection of statements:I slept in this morning. If I slept in this morning, and I walk to work, I will be late today. If the buses are not running, I walk to work. (a) Choose symbols to represent the atomic sentences in the above argument, and hence express the statements in terms of propositional calculus. Answer: S : I slept in this morning W : I walk to work L : I will be late today B : The buses are running S ∧ ( S ∧ W ⇒ L ) ∧ ( ¬B ⇒ W ) 124MS Logic and Sets (b) Construct a formal proof (table of assertions and justifications) showing that the statement If I will not be late this morning, the buses are running follows from these hypotheses. Answer: Statement: S ∧ ( S ∧ W ⇒ L ) ∧ ( ¬B ⇒ W ) H1: S, H2: S ∧ W ⇒ L, H3: ¬B ⇒ W, H4: ¬L ⇒ B Here I will construct a tableau of assertions and justifications. Number 1 2 3 4 5 6 7 8 9 Assertion ¬L ⇒ B ¬L S S∧W⇒L ¬B ⇒ W (S∧W) ¬S ∧ ¬W ¬W B Justification H4 Deduction H4 H1 H2 H3 Modus Tolens, 2, 4 De Morgan’s, 4 Disjunctive Syllogism, 6, 7 Modus Tolens, 7, 8 So we see that B follows from H1, H2, H3, H4 and so from this, ¬L ⇒ B follows from H1, H2, H3, H4 by the deduction theorem. (c) How many rows would be required by a truth table to show this? Answer: As there are 4 different symbols representing atomic sentences it would mean that 2 4, or 16, rows will be required in the truth table to show the statements expressed in propositional calculus. 124MS Logic and Sets Question Four: I am cataloguing my collection of 25 toy cars. 12 of them are big, 9 are red, and 13 are scratched. 3 are big and red, 5 are big and scratched, and 3 are red and scratched. How many are red, but not big or scratched? Answer: The universe is T; which represents Toy Cars. B represents Big toy cars. R represents Red toy cars and S represents Scratched toy cars. T 2 B 5 3 2 1 R 3 S 3 |R ∪ B ∪ S| = |R| + |B| + |S| - |R ∩ B| - |R ∩ S| - |B ∩ S| + |R ∩ B ∩ S| 25 = 9 + 12 + 13 – 3 – 3 – 5 + 2 R= 9–3 –3 –2 R= 1 Out of 25 toy cars, only 1 red car is not big or scratched. 124MS Logic and Sets Question Five: (a) Use a hybrid truth/membership table to show that if A ⊆ B, then A ∪ C ⊆ B ∪ C. Answer: A 1 1 1 1 0 0 0 0 1 ⊆ t t f f t t t t 7 B 1 1 0 0 1 1 0 0 2 ⇒ t t t t t t t t 11 A 1 1 1 1 0 0 0 0 3 ∪ t t t t t f t f 8 C 1 0 1 0 1 0 1 0 4 ⊆ t t t f t t t t 10 B 1 1 0 0 1 1 0 0 5 ∪ t t t f t t t f 9 C 1 0 1 0 1 0 1 0 6 From column 11 being a tautology, we are shown that if A ⊆ B, then A ∪ C ⊆ B ∪ C. (b) Give an example of a situation where the relationship A ∪ C ⊆ B ∪ C holds, even though A is not a subset of B, where A, B and C are subsets of the universal set {1, 2, 3, 4}. Answer: A= {1 , 3} B={2 ,3} C= {1,2 } Question Six: a[1 . . . n] is an array of integers, and N is the set {1, 2, . . . , n − 1}. (a) Express the statement ∀i ∈ N|a[i] < a[i + 1] in normal English. Answer: Everything in the array is increasing. (b) Give the negation of this statement in formal language. Answer: ¬∀i ∈ N|a[i] < a[i + 1]