# Creating expressions

For each output variable, the Combinational Analysis window maintains two structures - the relevant column of the truth table, and a Boolean expression - specifying how each output relates to its input. You can edit either the truth table or the expression; the other will automatically change as necessary to keep them consistent.

As we will see on the next page, the Boolean expressions are particularly useful because the Combinational Analysis window will use these when told to build a circuit corresponding to the current state.

You can view and edit the expressions using the window's last two tabs, the tab and the tab.

## The Expression tab

The tab allows you to view and edit the current expression associated with each output variable. It presents a "Notation: " selector and a list of the mathematical expressions of the circuit.

The selector: changes the notation mode of the output expressions. It allows you to choose from five types of notation:

:
The bar above represents the negation, Le - the AND function and the + the OR function.
:
The ¬ represents the negation, the ˄ the AND function and the ˅ the OR function.
:
The ~ represents the negation, the ˄ the AND function and the ˅ the OR function.
:
The ! represents the negation, the && the AND function and the || the OR function.
:
The ~ represents the negation, the & represents the AND function and the | represents the OR function.

Just below the selector, the expressions are displayed in a list. You can edit the expression in the text panel by double-clicking on the line of the expression.

Note that your truth table will be irretrievably altered if you edit the expressions and vice versa.

The text pane below this displays the same information in ASCII form. Here, a NOT is represented with a tilde ('~').

You can edit the expression in the text pane and click the button to make it take effect; doing this will also update the truth table to make it correspond. The button clears the text pane, and the button changes the pane back to representing the current expression.

Note that your edited expression will be lost if you edit the truth table.

In addition to multiplication and addition standing for AND and OR, an expression you type may contain any of C/Java logical operators, as well as simply the words themselves.

 highest precedence ~ ! ' (none) & && ^ + | ||

The following examples are all valid representations of the same expression. You could also mix the operators.

 a' (b + c) !a && (b || c) NOT a AND (b OR c)

In general, parentheses within a sequence of ANDs (or ORs or XORs) do not matter. (In particular, when Logisim creates a corresponding circuit, it will ignore such parentheses.)

## The Minimized tab

The last tab displays the minimum expression of one of the columns of the truth table. On this panel there are four selectors, the karnaught table and the minimal expression.

With the top selector , you can select the minimized output of a column of the table you want to display.

The following selector allows you to indicate whether you want to produce a sum of products or a sum of sums.

the selector modulates the presentation of variables on the table edges. Either with binary values or with lines on the true values.

 Numbered
 Lined

The selector has the same properties as the panel Expression selector (see above)

A Karnaugh map corresponding to the variable will appear below the selector. You can click the Karnaugh map to change the corresponding truth table values. The Karnaugh map will also display the currently selected terms for the minimized expression as solid semitransparent rounded rectangles.

Below this is the minimized expression itself, formatted as in the Expression tab's display. Logisim uses the Quine-McCluskey algorithm to compute the minimized expression. This is equivalent to a Karnaugh map, but it applies to any number of input variables.

The button allows you to select the minimized expression as the expression corresponding to the variable. This will generally not be necessary, as edits to the truth table result in using the minimized expression for the changed column; but if you enter an expression through the Expression tab, this can be a convenient way to switch to the corresponding minimized expression.

Next: Generating a circuit.