您在這裡

Are we done yet?

15 六月, 2015 - 16:19
Available under Creative Commons-ShareAlike 4.0 International License. Download for free at http://cnx.org/contents/383d4b87-2d7b-454e-99fe-2eaa43eae8ff@20.20

Are we done with propositional logic, now that we can test for equivalence and tautologies, using truth tables? Possibly. Truth tables can answer any question about propositional logic, but not always conveniently.
Consider the following code:

bool do something(int value) {     bool a = ...;     bool b = ...; 
    if(a&& !b)       return true;     else if (!a && !b)       return false;     else if (a)       return a;     else if (b)       return false;     else       return true; }

Clearly, this is very ugly and should be simplifed. But to what? We could build a truth table for the corresponding WFF, but so far we don't have any better way of finding a simpler equivalent formula than testing equivalence with whatever comes to mind. We need some way to generate formulas, given either an equivalent formula or a truth table.

There is another practical difficulty with truth table: they can get unwieldy.

Exercise 2.2.2.1

How many rows are there in a truth table with 2 input variables? 3 variables? 5 variables? 10 variables? n variables?

Exercise 2.2.2.2

(Optional) Now, how many such boolean functions are possible, with 2 inputs? With? For fun, sit down and name all the possible two-input functions. You'll find that some of them are rather boring, such as the constant function true, and many are just permutations on ⇒.

When discussing a circuit with 100 wires (each corresponding to a single proposition), truth tables are clearly infeasible. Modern processors have millions of wires and transistors. It is still an area of active research to cope with such a huge number of possibilities. (The key idea is to break things down into small sections, prove things about the small sections, and hopefully have a small set of sentences formally capturing the interface between sections.)

So truth tables are intractable for analyzing circuits of more than a few wires. But will they suffice for answering WaterWorld questions? Image a (large) table with all the neighbor propositions: A − has − 0, B − has − 0, ..., A − has − 1, B − has − 1, ... Now, determine which rows which entail B − safe. To answer this, we end up looking at rows involving many clearly-irrelevant propositions such as Z − has − 2.

ASIDE: Hmm, considering every possible board and then counting what proportion of boards entail B safe hmm, this is the brute-force definition of probability Since such truth tables enumerates all possible boards, it's like looking for probability 1 the brute-force way.

Also, this method of playing WaterWorld via huge truth tables would be unsatisflying for another reason: it doesn't actually reflect our own reasoning. As a general principle of programming, your program should always reflect how you conceive of the problem. The same applies to logic.

ASIDE: Consider the difference between using truth tables and actually reasoning. The philosopher Bertrand Russell8 , trying to pin down what exactly constitutes "knowledge", suggested that he knows that the last name of Britain's prime minister begins with a 'B'. While Gordon Brown is prime minister, making Bertrand is correct, we hesitate to say he actually knows the fact he wrote his example when the prime minister was Arthur Balfour9 (1902-1905). So while he is correct in a truth-table sense, his reasoning isn't, and we tend to say that he does not actually know the prime minister's last initial.

So, no: we're not yet finished with propositional logic. We want to look for (hopefully) more feasible ways to determine whether a formula is a tautology (or, whether two formulas are equivalent). As a clue, we'll try to discover methods which are based on the way we naively approach this. We'll look first at Reasoning with equivalences, and then at Propositional inference rules.