Lecture 1, Thursday August 31

Class Overview

This class is an introduction to a collection of formal tools that we need to have in order to change "programming" into Computer Science. In particular, we study:

  1. Logic. How to make concrete, specific statements about the world, or about, say,the behavior of our programs. How to change these statements into equivalent statements.
  2. Proofs. How to demonstate if such concrete, specific statements are true.
  3. Sets. How to define and manipulate collections of objects. These may be abstract objects like "possible inputs of a program", or "easily cracked passwords".
  4. Counting. How to determine how many elements a set has. This is easy if the set is, say, "members of your dorm floor". But it is harder if it is "orders in which packets may be received in a network", or "number of possible poker hands".
  5. Graphs and Relations. Beyond describing individual objects and collections of objects, modern science has benefited more and more by formal models of relationships between objects. Google, for example, was the first search engine to look not just at the set of words that was on a page, but instead at the "link to" structures of how pages linked to each other.

Logic and Computer Science

Why is logic important for Computer Science? This class used to be "Foundations of Computer Science", and it still is, the name just changed so that if you don't know anything about Computer Science, you'll still know what is to be taught. Logic plays a role at three specific places in Computer Science.

An Introduction to Logic

We will consider classical propositional logic. Wikipedia has a fantastic page about this that is completely incomprehensible if you don't already know it. When it comes test time, see if you understand this page; if you do, you'll probably do fine on the test. Propositional logic deals with statements that have boolean values (truth values). Each statement is either true or false, or has a truth value of "T" or "F". For instance, "The Cardinals won the 2005 World Series" has a truth value (sadly) of "F". Larger statements, or forumalas, can be made by combining propositions. This allows statements such as: "The Cardinals will win the 2006 world series or the cardinals will not win the world series". Such a statement, (P or not P) is *always* true in classical logic, as a result of the "law of the excluded middle". There are several other logics that we don't consider.
Propositions

Propositions are statements that have a truth value. "Washington University is in St. Louis" and "Online lecture notes are useful" are examples of propositions. English statements like "Clean your Room", "Do your homework", "Yikes" are not. In order to avoid several paradoxes, we do not allow a proposition to refer to its own truth value or the truth value of another proposition. That is we don't allow "This sentence is false", "This sentence is true", or "The next sentence is true", "The last sentence is false".

Using logical connectives (and, or, not), we can make propositional formulas out of propositions. For exampe the combined statement "Washington University is in St. Louis and Online lecture notes are useful" has a truth value (perhaps True?).

Since we are mostly interested in "how" we can think about propositional formulas, how we can combine and manipulate them (instead of being interested in listing facts about the world), we can shorten our formulas using variables. We will use letters P, Q, R to refer to propositions. They have a truth value, it is either true or false, but we may not know what it is.

We can make logical expression from propositional variables through the use of connectives. The most common of these connectives are:

slightly less common are the following connectives

We can define the formal meaning of these connectives through the use of a truth table.

1. Truth tables.

A logical expression, such as ((p AND q) or r), has a truth value that depends on the truth values of the propositions (the p's, q's, and r's) that make up the expression. A truth table is an organized way of writing down the truth value of an expression, by exhaustively considering every possible set of truth values for the propositions that make up the expression.

Complete truth tables

in a complete truth table, every new column is made as the "and", "or", "implies", "if and only if", or "not" of earlier columns.

How many rows are there in a complete truth table?

How many columns are there in a complete truth table?

Two expressions are called logically equivalent if their truth value is the same in EVERY condition, that is, if their truth value is the same in every row.

Now that we understand how to compute the logical meaning of connectives and propositional formulas, we can thing about trying to translate English sentences into logic *in a way that preserves their truth*. Some information on translating between logic and english can be found at the following fantastic web page, although note that they use a different notation than we do (a "dot" for and, and three horizontal lines for "<--->"). Some interesting questions for translating from english to logic and back:

Chapter 1.1 of the book does a very good job of talking about translating between english and logic. Please read that and Chapter 1.2 for the next class.


Web link to todays audio-visual event: Pipe Dream