| Overall Reading | |
|---|---|
| Brookshear: | pp. 18-20 |
| Decker/Hirshfield: | Mod. 7.1-7.2 |
Outline:
When representing numerical information, we used a binary system, and thus abstracted these two states into numerals, {0,1}, even though the underlying physical mechanism is not inherently numerical.
Today, we will draw a parallel between the two-states of a bit and representing logical information with the two states, {true, false}.
We can imagine applications where a computer uses various bits of memory to represent the truth of various statements:
Computer scientist still tend to like to use numerals, so by convention, we equate 0=false and 1=true.
In some settings, we feel that we can apply logic to relate the state of various statements (ahh...is that why we use the word 'statement')
In English, we start to build compound statements using conjunctions
such as: AND, OR, NOT.
What is the semantics of the conjunction 'AND'?
| A | B | (A AND B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
What about semantics of 'OR'?
| A | B | (A OR B) |
|---|---|---|
| 0 | 0 | |
| 0 | 1 | |
| 1 | 0 | |
| 1 | 1 |
Once you start playing with compound statements, you will start to
find some interesting theorems, for example the statement:
| A | B | (A OR B) | NOT(A OR B) | NOT(A) | NOT(B) | NOT(A) AND NOT(B) |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 |
There is an underlying algebra system which relates how truth values and these logical operators interact. One of the early names in studying these properties was a mathematician named George Boole (1815-1864). For this reason, we refer to this system as Boolean algebra, and to logical operations as Boolean operations. In fact many modern programming languages refer to variables which can only take two values, true or false, as Boolean variables.
Sometimes, Boolean expresions are written using the syntax of arithmetic (though the semantics of boolean algebra):
(Discuss Figure 7.2 of [DH])
Common gates: AND, OR, NOT
[demo Logg-O file]
Additional gates: NAND, NOR, XOR
[demo Logg-O file]
We will soon see that individual gates can be combined in many ways to build more complex circuits.
In fact, the choice of gates above is somewhat redundant. For example, if you have NOT gates and AND gates, you do not really need a NAND gate - you could build an equivalent circuit.
Quite interestingly, all possible circuits can be constructed entirely of NAND gates.
Yet having all the choices is convenient.