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
Elements of Computer Science Workshop7. Logic in Language [CBPrice. 10-03-16] Color Coding for this Worksheet Information Guided Enquiry Additional (very optional) Details for the Portfolio Purpose (a) To learn how digital logic, Boolean Algebra and Logic in Language are all connected, (b) to understand logically consistent utterances, (c) to prove the validity of a logical argument. Portfolio This session addresses ILO1 Activities 1 Logic Connectives : The AND, OR connectives and the NOT Let us take the two atomic sentences P = <Holmes was on the case> Q = <Watson was on the case> and consider the compound sentence Either Holmes was on the case, or both Holmes and Watson were on the case. (a) Work from this compound sentence to fill in the final column in the truth table below which gives the truth of the compound sentence for the various values of P and Q P 0 0 1 1 Q 0 1 0 1 mini-terms (b) Now write down the min-terms (using Boolean algebra) for both rows in the table which have a 1 in the final column. (c) The Boolean expression for the compound sentence is the conjunction of your mini-terms (๐. ๐ฬ + ๐. ๐) Complete the truth table below for both mini-terms and for the conjunction. You may omit the Os to make it more readable. Check it agrees with your answer to (a) P 0 0 1 1 Q 0 1 0 1 ๐. ๐ฬ ๐. ๐ (๐. ๐ฬ + ๐. ๐) (d) For the rows where the conjunction of the mini-terms is 1, write down the meaning of the mini-term in simple English using the atomic sentences P and Q. (e) Use Boolean Algebra to simplify your expression in (c). You should find it becomes P. 2. A Simple Logic Problem Consider the sentence P = <Cows can fly>. (a) Write down, in English, the meaning of the sentence ๐ท. ๐ท (b) Now work out the truth table for it, by thinking P ๐ท. ๐ท 0 1 (c) Find a rule from Boolean algebra which will prove the result. 3 The Conditional IF. First Investigation. The Philonian Conditional; โIf P then Qโ can be represented by the truth functor โ(Not P) or Qโ, โIf P then Qโ is represented by P ๏ฎ Q and is equivalent to ๐ท + ๐ธ in logic Letโs consider the two atomic sentences P = <The switch is pressed> Q = < The Light is on> (a) Now consider the compound sentence If the switch is pressed the light is on Write down the Boolean expression for this sentence. (b) Now consider a second compound sentence If the light is on the switch is pressed Write down the Boolean expression for this sentence (c) In the truth table below write your Boolean expression from (a) at the top of the third column and fill in the rows where the expression is true. (d) Repeat this for your second expression using the fourth column (e) Now look at each row, and in the fifth column write a 1 where both terms are true together, ie where columns 3 and 4 both contain 1s. (f) Now in the sixth column write the mini-terms corresponding to these rows P 0 0 1 1 Q 0 1 0 1 (g) Finally in the seventh column write down in simple English the state of the switch and light where both the following sentences are true at the same time. If the switch is pressed the light is on. If the light is on the switch is pressed (h) Now letโs apply some Boolean algebra. Take your expressions corresponding to each individual sentence, and AND them together and you should obtain (๐ฬ + ๐). (๐ฬ + ๐) (i) Letโs simplify this. Proceed as follows * First use the distributive rule to expand the above expression. You will get 4 terms * Simplify the expression you have obtained. You should get it reduced down to two terms. (j) Check that this expression is the or of the miniterms you found in (f). 4. The Conditional IF. Second Investigation Repeat 3. for the compound sentence If the switch is pressed the light is on AND If the light is on the switch is not pressed. 5. Consistency โ Holmes, Watson and Lestrade. Letโs use the following atomic sentences P = <Holmes solved the crime> Q = <Lestrade took the criminal> R = <The criminal escaped> Consider the following text "If Holmes. solved the crime, then Lestrade took the criminal. Of course, if the criminal escaped, then Lestrade did not take him. On this particular day, Holmes did not solve the crime, and the criminal escaped" (a) Convert each of the sentences in the above text into Boolean terms involving combinations of P,Q,R (b) Add your terms at the top of each column in the truth table below P 0 0 0 0 1 1 1 1 Q 0 0 1 1 0 0 1 1 R 0 1 0 1 0 1 0 1 (c) You should find that there is only one row where all terms are true together. This identifies the consistent set of atomic sentences. Write the corresponding mini-term down and the associated sentence in the row. Does the sentence make sense? Now you should attempt either (d) or (e) (d) Construct a Boolean expression by AND-ing your three expressions for the sentences in (a). (e) Now letโs simplify this expression. Proceed as follows: (i) Use the distributive rule to expand the product of the first two terms. (ii) Use the distributive rule to expand the resulting expression with the third term. (iii) Simplify the resulting expression. You should end up with a single term which corresponds to the mini-term you found in (c). 6. Consistency โ Watson and Holmes in Confusion. Test the consistency of this set of sentences using the method above. a) Holmes and Watson were on the case. b) If Holmes was on the case, then Watson was not. (a) First find the atomic sentences P and Q; P = Q = (b) Now transcribe the set of sentences a) and b) in terms of P and Q using Boolean Algebra a) b) (c) Now AND these sentences using Boolean algebra (d) Now complete the truth table as above and look for any consistent solutions. Did you expect this result? Look at the starting sentences and think out the answer. P 0 0 1 1 Q 0 1 0 1 (e) Use Boolean Algebra to simplify the expression you found in (c) and check it agrees with the mini-terms you found in (d). The Method of testing Validity of Arguments An argument will have several premises and one conclusion. Testing the validity of an argument is done by constructing a Boolean expression for each premise. To this is added the Boolean expression for the inverse of the conclusion, ie the conclusion is taken to be false. All expressions are then tested for consistency. If a consistent solution (a true solution) is found then this is an example of where the conclusion is false. Hence the argument is proved to be invalid. If there are no consistent solutions then the conclusion cannot be false for the premises, in other words the argument is true. This approach is called reductio ad absurdum. 7. Argument Validity โ From Monty Python Take the three atomic sentences P = < sheโs made of wood> Q = < she weighs the same as a duck > R = < sheโs a witch > and the following argument whose validity you must investigate If sheโs made of wood sheโs a witch If she weighs the same as a duck sheโs made of wood She weighs the same as a duck Therefore sheโs a witch (a) Transcribe the premises of the argument into Boolean expressions (b) Now transcribe the conclusion and negate this (Reductio ad Absurdum) (c) Add your four expressions to the headings of columns in the truth table below P 0 0 0 0 1 1 1 1 Q 0 0 1 1 0 0 1 1 R 0 1 0 1 0 1 0 1 (d) For each expression insert a 1 into any row where the expression is true. (e) Look for any row where all expressions are true. If you find one then this is a counter example and the argument is invalidated. (f) Construct a Boolean expression for the whole passage using your results from (a) and (b). Simplify this expression and check it agrees with your truth table. 8. Argument Validity โ Fallacy of Denying the Antecedent Take the atomic sentences P = <There is a fault> Q = <It will blow up> Prove that the following argument is invalid If there is a fault, it will blow up. There is no fault. Therefore it will not blow up. Proceed as follows: (i) Write down a Boolean expression for each of the sentences (there are 3) and negate the expression which corresponds to the conclusion. (ii) Combine each expression (using the AND operator) into a single expression (iii) Expand the terms in the resulting expression using the distributive rule, and simplify the result. Think about your result and explain how this invalidates the argument. 9. Argument Validity โ Fallacy of Affirming the Consequent Take the atomic sentences P = <There is a fault> Q = <It will blow up> and working as above (activity 9) prove that the following argument is invalid If there is a fault, it will blow up. It will blow up, therefore there is a fault 10. Argument Validity โ Fallacy of Conversion Take the atomic sentences P = <There is a fault> Q = <It will blow up> and working as above prove that the following argument is invalid If there is a fault then it will blow up.Therefore if it blows up, then there is a fault! 11. Argument Validity โ Modus Tollens Take the atomic sentences P = <There is a fault> Q = <It will blow up> and working as above test the validity of the following argument If there is a fault it will blow up. It will not blow up, therefore there is no fault 12. Consequentia Mirabilis (a) Here a proof which is true and a little challenging to understand. Prove the validity of the following argument using either the truth-table approach or Boolean algebra. Try to understand why the proof is so strange. If there is proof, then there is proof If there is no proof, then there is proof Therefore there is proof (b) Now letโs drop the first line. Again prove the validity of the argument and try to understand If there is no proof, then there is proof Therefore there is proof 13. Aristotelian Syllogism Prove that the following argument is correct. It is presented in a general form then an example. If P then Q and If Q then R Therefore P then R All men are mortals Socrates is a man Therefore Socrates is mortal