Skip to content Skip to navigation

Connexions

You are here: Home » Content » Propositional Logic: limitations of truth tables

Navigation

Recently Viewed

This feature requires Javascript to be enabled.

Propositional Logic: limitations of truth tables

Module by: Ian Barland, John Greiner, Phokion Kolaitis, Moshe Vardi, Matthias Felleisen. E-mail the authors

User rating (How does the rating system work?)
Ratings

Ratings allow you to judge the quality of modules. If other users have ranked the module then its average rating is displayed below. Ratings are calculated on a scale from one star (Poor) to five stars (Excellent).

How to rate a module

Hover over the star that corresponds to the rating you wish to assign. Click on the star to add your rating. Your rating should be based on the quality of the content. You must have an account and be logged in to rate content.

:
(0 ratings)

Note: Your browser may not currently support MathML. See our browser support page for additional details. You can always view the correct math in the PDF version.

Are we done yet?

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 simplified. 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 1

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

Solution

  • 2 variables: As we're seen, 4 rows.
  • 3 variables: 8 rows.
  • 5 variables: 32 rows.
  • 10 variables: 1024 rows.
  • nn variables: 2n 2 n rows.

Exercise 2

(Optional) Now, how many such boolean functions are possible, with 2 inputs? With 3? 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 .

Solution

  • With 2 variables, we have 4 rows. How many different ways can we assign true and false to those 4 positions? If you write them all out, you should get 16 combinations.
  • With 3 variables, we have 8 rows and a total of 256 different functions.
  • With nn variables, we have 2n 2 n rows and a total of 22n 2 2 n different functions. That's a lot!

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-0A-has-0, B-has-0B-has-0, …, A-has-1A-has-1, B-has-1B-has-1, … Now, determine which rows which entail B-safeB-safe. To answer this, we end up looking at rows involving many clearly-irrelevant propositions such as Z-has-2Z-has-2.

Aside:

Hmm, considering every possible board and then counting what proportion of boards entail B-safeB-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 unsatisfying 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 Russell, 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 Balfour (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 equivalences, and then at inference rules.

Content actions

Give Feedback:

E-mail the module authors | Rate module ( How does the rating system work?)

Rating system

Ratings

Ratings allow you to judge the quality of modules. If other users have ranked the module then its average rating is displayed below. Ratings are calculated on a scale from one star (Poor) to five stars (Excellent).

How to rate a module

Hover over the star that corresponds to the rating you wish to assign. Click on the star to add your rating. Your rating should be based on the quality of the content. You must have an account and be logged in to rate content.

(0 ratings)

Download:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections directly in Connexions. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need a Connexions account to use 'My Favorites'.

| A lens (?)

Definition of a lens

Lenses

A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual Connexions member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks