Learn

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Lesson 2 of 3

Construct formulas from complete truth tables

Supporting depth: build canonical DNF and CNF, prove their meaning row by row, and separate finite decidability from efficient representation.

Loading your saved responses…

Try the optional starting-point checks and targeted refreshers. You can continue directly into this lesson.

Try

A small access rule has two inputs: p means “the pass is present” and q means “the supervisor approves.” In this synthetic example, access is granted when the two inputs agree. The table, rather than a remembered formula, is the specification. Can you construct a formula that accepts exactly its two permitted rows?

Boolean values are 0 for false and 1 for true. The symbol ¬ means NOT, ∧ means AND, and ∨ means OR. An assignment of values to all inputs is called a valuation. A formula represents a specification when it produces the specified result at every valuation, not merely at the cases tried so far.

pqGrant accessRow-specific construction
001True-row term: ¬p ∧ ¬q
010False-row clause: p ∨ ¬q
100False-row clause: ¬p ∨ q
111True-row term: p ∧ q

Predict

The term ¬p ∧ ¬q is true only at row 00. Predict what happens if we OR it with p ∧ q. Then predict whether changing that OR to AND preserves the rule. It does not: no valuation makes both complete terms true, so the AND would reject every row.

There is a second route. Instead of collecting permitted rows, exclude each forbidden row. To exclude 01, use p ∨ ¬q: both literals are false at 01, while at least one is true at every other row. A clause for excluding a row uses the opposite literal polarity to a term for accepting that row. Merely copying the row’s bits is not enough.

Experiment

On paper, write the two formulas

D = (¬p ∧ ¬q) ∨ (p ∧ q) and C = (p ∨ ¬q) ∧ (¬p ∨ q).

Add two columns to the supplied table and evaluate D and C at every row. For each accepted row of D, underline the term that accepts it. For each rejected row of C, circle the clause that rejects it. This supplies a visible witness for each output instead of an unexplained final column.

Now change the specification at row 01 to grant access. Predict the edit before calculating: D gains the term ¬p ∧ q, while C loses the clause p ∨ ¬q. Verify all four rows again. Removing a rejection clause weakens a conjunction; adding an acceptance term enlarges a disjunction. Explain why neither edit changes the other three rows.

These are complete finite checks for this two-input specification. They are not empirical tests of how an actual security system behaves, nor evidence that the chosen access policy is appropriate.

Understand

A literal is a variable or its negation. Disjunctive normal form, DNF, is an OR of AND terms of literals. Conjunctive normal form, CNF, is an AND of OR clauses of literals. Single literals are allowed as terms or clauses. General normal forms need not mention every variable in every term or clause and need not be unique.

For a finite variable set V, a complete minterm Mₐ describes one valuation a: for each variable v, use v if a assigns 1 and ¬v if a assigns 0, then AND all these literals. At any valuation b, every literal is true exactly when b agrees with a on every variable. Thus Mₐ is true exactly at a.

A complete maxterm Cₐ excludes a: use ¬v when a assigns 1 and v when a assigns 0, then OR the literals. All its literals are false exactly at a. If b differs from a, the literal for a differing variable is true, so the clause accepts b.

Let f be any Boolean specification on these valuations. OR together Mₐ for every a with f(a)=1. At an arbitrary b, a term succeeds exactly when its row equals b; therefore the formula outputs f(b). Alternatively, AND together Cₐ for every a with f(a)=0. This fails exactly when b is one of the forbidden rows, so it also outputs f(b). These arguments prove equivalence for every finite V, rather than extrapolating from our four-row example.

The empty OR is false: with no terms, no term succeeds. The empty AND is true: with no clauses, no clause fails. Consequently an always-false function has an empty canonical DNF, and an always-true function has an empty canonical CNF. If V itself is empty, there is still one valuation, the empty assignment. Its minterm is an empty AND and its maxterm an empty OR; the same construction works for both possible specifications.

For a fixed V, the true-row set determines the canonical complete DNF terms uniquely, ignoring ordering and redundant repeats. That does not make every equivalent DNF identical. For example, p and (p ∧ q) ∨ (p ∧ ¬q) represent the same function, but only the latter lists complete minterms on V consisting of p and q.

Apply

Create an unfamiliar three-input specification that grants access exactly when one input is 1. List all eight valuations, construct its three-term canonical DNF and five-clause canonical CNF, and explain why a valuation with two 1s is rejected by both. Exchange formulas with another learner or check independently by truth table. A useful review identifies the accepting term or rejecting clause, not only agreement totals.

Then audit the cost of the method. With n variables there are 2ⁿ valuations. For the specification f = x₁, half of them are true. Its complete DNF uses 2ⁿ⁻¹ terms, each with n literals, even though the single literal x₁ already represents the function. Canonical construction guarantees existence, not economical representation. Exhaustive comparison of formulas terminates on finitely many rows, but this procedure can take exponentially many row evaluations. That is not a proof that every conceivable equivalence algorithm must take exponential time.

Continue

Use the practice below to repair polarity errors, handle constant specifications, prove the general construction and separate uniqueness of a canonical row set from uniqueness of syntax. In later circuit work, a truth-table equivalence proof checks logical behavior; operation count and circuit depth require separate arguments about the implementation.

This lesson is supporting depth. The inspected MIT Spring 2015 problem set 1 made textbook section 3.4 optional. These independently authored tasks teach a useful representation mechanism; they do not turn an optional source section into a requirement for every learning path or certify performance on MIT’s assessments.

Apply · explain · revise

Practice and reasoning

Drafts save locally as you type. Reveal worked solutions when useful; the site remembers that exposure. Automatic matches check the requested answer, while written arguments require review against the rubric.

In variable order p,q,r, a specification is true exactly on rows 001, 011 and 110. Construct its canonical DNF and CNF. Prove that your DNF accepts exactly those rows and that each CNF clause excludes exactly one of the other five rows.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

A two-variable table is false only on (u,v)=(1,0). A learner chooses the clause u∨¬v, saying it “describes that row.” Find the actual formula, exhibit two rows exposing the proposed error, and explain the difference between describing a true row and excluding a false row.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Let V be any finite set of variables and f assign a truth value to every valuation on V. Define a minterm M_a and maxterm C_a for a valuation a, and prove that OR of M_a over f(a)=1 and AND of C_a over f(a)=0 both represent f. Include V empty rather than assuming at least one variable.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

For variables a,b,c, construct canonical DNF/CNF for the always-false and always-true functions using indexed row notation instead of writing all eight rows. Explain why an empty conjunction cannot be assigned false, using the identity needed when adding an AND factor. Does a contradictory specification have no CNF representation?

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Compare p, p∨(p∧q), and (p∧q)∨(p∧¬q) as functions on variables p,q. Prove equivalence, identify which is canonical complete DNF on that variable set, and explain precisely what “unique canonical DNF” can mean despite reordered terms or repeated syntax.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

For n≥1 variables, let f be true exactly when the first variable is true. Count the rows, canonical DNF terms and literal occurrences. Compare with a general DNF. Explain how exhaustive truth-table comparison decides equivalence of two supplied formulas, and why this is not a polynomial-time guarantee in their written lengths.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Reflect and continue

Before marking this lesson complete, explain one key idea without the worked solution and identify a condition that matters. Marking complete records participation, not independent mastery.