Workshop Logic in Language

advertisement
The Computing Professional
Workshop Logic in Language
[CBPrice. 10-04-15]
Color Coding for this Worksheet
Information
Guided Enquiry
Details for the Portfolio
Extension Material
Purpose
(a) To learn how logic is used in language.
(b) To explore the similarities between digital logic and logic in languages.
(c) To gain experience with Boolean notation
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 two compound sentences
A. Holmes and Watson were on the case.
B. Either Holmes was not on the case or Watson was.
(a) Write down a Boolean expression for sentence A.
(b) Write down a Boolean Expression for sentence B.
(c) Look at the truth table below. In the third column write 0s and 1s for the expression you found in (a)
(d) Now in the fourth column write 0s and 1s for the expression you found in (b)
(e) We are interested in the cases where both sentences A and B are true together (ie have 1’s in any row).
Look at the third and fourth columns and if both contain a 1 then write a 1 in the 5 th column to show where
A and B are true together
P
0
0
1
1
Q
0
1
0
1
(f) You should find only one row in the fifth column which contains a 1. Look at the values of P and Q for
this row, and therefore write down in simple English who was on the case.
Now let’s build a digital electronic circuit to solve this problem:
(g) Using Logisim make a circuit using a single gate which corresponds to the Boolean expression for
sentence A you found in (a).
(h) Add to this circuit, some gates to represent the expression for sentence B you found in (b).
(i) Finally add a gate which takes the output of your circuits in (g) and (h) and gives an output 1 if both
inputs are 1. Connect the output of this gate to a light.
(j) Now run a simulation of your circuit, and complete the truth table for the entire circuit. This should agree
with the fifth column in the table you worked out above.
P
0
0
1
1
Q
0
1
0
1
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) Create a circuit which is equivalent to the Boolean expression in (a) and find its truth table. This should
agree with your truth table obtained by thinking in (b).
3
The Conditional IF. First Investigation.
The Philonian Conditional; “If P then Q” can be represented by the expression
“(Not P) or Q”
“If P then Q” is equivalent to 𝑷 + 𝑸 in logic
Let’s consider the two atomic sentences
P = <The switch is pressed>
Q = < The Light is on>
and consider the two sentences
A. If the switch is pressed the light is on
B. The light is on
(a) Write down a Boolean expression for sentence A.
(b) Write down a Boolean Expression for sentence B.
(c) Look at the truth table below. In the third column write 0s and 1s for the expression you found in (a)
(d) Now in the fourth column write 0s and 1s for the expression you found in (b)
(e) We are interested in the cases where both sentences A and B are true together (ie have 1’s in any row).
Look at the third and fourth columns and if both contain a 1 then write a 1 in the 5 th column to show where
A and B are true together
P
0
0
1
1
Q
0
1
0
1
(f) You should find two rows in the fifth column which contain a 1. Look at the values of P and Q for these
rows, and therefore write down in simple English the state of the switch and light for each case.
(g) Think about your answers to (f) and convince yourself that they agree with the sentences A and B taken
together
Now let’s build a digital electronic circuit to solve this problem:
(h) Using Logisim make a circuit using a single gate which corresponds to the Boolean expression for
sentence A you found in (a).
(i) Add to this circuit, a gate (or perhaps just a wire) to represent the expression for sentence B you found in
(b).
(j) Finally add a gate which takes the output of your circuits in (h) and (i) and gives an output 1 if both
inputs are 1. Connect the output of this gate to a light.
(k) Now run a simulation of your circuit, and complete the truth table for the entire circuit. This should agree
with the fifth column in the table you worked out above.
P
0
0
1
1
4.
Q
0
1
0
1
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, but 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 the next three blank 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
(c) Now, taking each term in turn, fill in the columns with 1s or 0s as directed by the Boolean term.
(d) Finally, look for any rows where all columns have a value of 1. This corresponds to cases where
all three sentences are consistent when taken together. For each of these rows add a 1 in the next
column. You should find just one such row.
(e) Write down in simple English the situation (involving Holmes, Watson and Lestrade)
corresponding to this row.
(f) Now build a digital logic circuit to solve this problem. Remember how to proceed (i) create a
sub-circuit for each term, (ii) and all three outputs of the sub-circuits and drive the output light.
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 notation
a)
b)
(c) 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
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 – God, Matter and Homer Simpson.
Take the following atomic sentences
P = < Matter always existed>
Q = < God Exists >
R = < Homer Simpson created the Universe >
and consider the text
Premise 1: Matter always existed
Premise 2: If God exists then Homer Simpson created the Universe
Premise 3: If Homer Simpson created the Universe then Matter did not always exist
Conclusion: Therefore there is no God
(a) Transcribe the three premises of the argument into individual 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 digital electronic circuit corresponding to the above scenario, and verify the truth
table you constructed above.
8.
Argument Validity
Take the atomic sentences
P = <Ruth is on the horse>
Q = <Viv is on the horse>
Use the above procedure to establish the validity (or not) of the following argument
Ruth is on the horse and Viv is on the horse
If Ruth is not on the horse then Viv is not on the horse
Therefore Ruth is on the horse
9.
Argument Validity
Use the above procedure to prove that the following argument is valid:
Ruth is on the horse and Viv is not on the horse
If Ruth is not on the horse then Viv is on the horse
Therefore Ruth is on the horse
10.
Argument Validity – A valid but unsound proof
Consider the following argument
Ruth is on the horse and Viv is on the horse
If Ruth is on the horse then Viv is not on the horse
Therefore Ruth is on the horse
(a) First prove that the argument is valid, in other words the final column of the truth table consists
of all 0s, in other words there are no counter-examples.
(b) But there’s a problem. Look at the two premises. Do you see the problem?
(c) Explore this further by looking at columns 2 and 3 of your truth table. Are there any rows where
both columns have 1’s? If there aren’t any such rows, then whatever is in column 4 does not matter
ie any conclusion will be valid!
11.
Argument Validity
Now consider the following argument
Viv is on the horse but Ruth is not on the horse
If Ruth is not on the horse then Viv is on the horse
Therefore Ruth is on the horse
Show that this argument is invalid and write down in simple English the meaning of the counterexample you have found.
12.
Argument Validity
Consider the following argument
Viv is on the horse
If Ruth is on the horse then Viv is on the horse
Therefore Ruth is on the horse
Find out whether or not this argument is valid. If you find it is not then think about the counterexample and what this tells you about the argument.
13.
Consequentia Mirabilis (Really weird stuff)
(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. 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
Download