Skip to content Skip to navigation Skip to collection information

Connexions

You are here: Home » Content » Fundamentals of Computer Engineering » Propositional Logic: normal forms

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

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

What is in a lens?

Lens makers point to 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 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.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • Rice Digital Scholarship

    This module is included in aLens by: Digital Scholarship at Rice UniversityAs a part of collection: "Intro to Logic"

    Click the "Rice Digital Scholarship" link to see all content affiliated with them.

Recently Viewed

This feature requires Javascript to be enabled.
 

Propositional Logic: normal forms

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

Summary: Representing Boolean functions in CNF and DNF.

CNF, DNF, … (ENufF already!)

In high school algebra, you saw that while x34x x 3 4 x and x(x2)(x+2) x x 2 x 2 are equivalent, the second form is particularly useful in letting you quickly know the roots of the equation. Similarly, in Boolean algebra there are certain canonical — “normal” — forms which have nice properties.

A formula in Conjunctive Normal Form, or CNF, is the conjunction of CNF clauses. Each clause is a formula of a simple form: a disjunction of possibly-negated propositions.

Example 1

cab c a b is equivalent to (a¬c)(b¬c) a c b c . This latter formula is in CNF, since it is the conjunction of disjunctions, and each disjunction consists only of propositions and negated propositions.

Example 2

The conjunctions and disjunctions need not be binary. The following formula is also is CNF.

¬a(ab¬c)(b¬def) a a b c b d e f

Note that its first clause is just one negated proposition. It is still appropriate to think of this as a disjunction, since φφφ φ φ φ .

Another format, Disjunctive Normal Form, or DNF is the dual of conjunctive normal form. A DNF formula is the disjunction of DNF clauses, each a conjunction of possibly-negated propositions.

Example 3

abc a b c is equivalent to ¬a¬bc a b c which is in DNF: three disjunctions, each being a clause with only one term. (It also happens to be in CNF — a single clause with three terms!) It is also equivalent to the more fleshed out DNF formula where we insist that each clause include all three variables. We end up with a formula that includes each possible clause except ab¬ca b c: That is, the formula abc a¬bc a¬b¬c ¬abc ¬ab¬c ¬a¬bc ¬a¬b¬c a b c a b c a b c a b c a b c a b c a b c .

Aside:

Electrical Engineering courses, coming from more of a circuit perspective, sometimes call CNF product-of-sums, and call DNF sum-of-products, based on , being analogous to +,*.

Any Boolean function can be represented in CNF and in DNF. One way to obtain CNF and DNF formulas is based upon the truth table for the function.

  • A DNF formula results from looking at a truth table, and focusing on the rows where the function is true: As if saying “I'm in this row, or in this row, or …”: For each row where the function is true, form a conjunction of the propositions. (E.g., for the row where aa is false, and bb is true, form ¬aba b.) Now, form the disjunction of all those conjunctions.
  • A CNF formula is the pessimistic approach, focusing on the rows where the function is false: “I'm not in this row, and not in this row, and …”. For each row where the function is false, create a formula for “not in this row”: (E.g., if in this row aa is false and bb is true form ¬(¬ab)a b; then notice that by DeMorgan's law, this is a¬ba b — a disjunct. Now, form the conjunction of all those disjunctions.

Example 4

Table 1: Truth table example
aabbccUnknown function
falsefalsefalsefalse
falsefalsetruefalse
falsetruefalsetrue
falsetruetruetrue
truefalsefalsefalse
truefalsetruetrue
truetruefalsefalse
truetruetruefalse

For CNF, the false rows give us the following five clauses:

  • abca b c
  • ab¬ca b c
  • ¬abca b c
  • ¬a¬bca b c
  • ¬a¬b¬ca b c
and the full formula is the conjunction of these. Essentially, each clause rules out one row as being true.

For DNF, the true rows give us the following three clauses:

  • ¬ab¬ca b c
  • ¬abca b c
  • a¬bca b c
and the full formula is the disjunction of these. Essentially, each clause allows one row to be true.

This shows that, for any arbitrarily complicated WFF, we can find an equivalent WFF in CNF or DNF. These provide us with two very regular and relatively uncomplicated forms to use.

Exercise 1

The above example produced CNF and DNF formulas for a Boolean function, but they are not the simplest such formulas. For fun, can you find simpler ones?

Solution

  • CNF: (ab)(¬abc)(¬a¬b) a b a b c a b
  • DNF: ¬ab a¬bc a b a b c

Aside:
Karnaugh maps are a general technique for finding minimal CNF and DNF formulas. They are most easily used when only a small number of variables are involved. We won't worry about minimizing formulas ourselves, though.

Notation for DNF, CNF

Sometimes you'll see the form of CNF and DNF expressed in a notation with subscripts.

  • DNF is i ψi iψi, where each clause φi φi is j λj jλj, where each λλ is a propositional variable (PropProp), or a negation of one (¬PropProp).
  • CNF is i ψi iψi, where each clause ψiψi is j λj jλj , where each λλ is again a propositional variable (PropProp), or a negation of one (¬PropProp).
For example, in the CNF formula (ab)(¬abc)(¬a¬b) a b a b c a b we have φ2=¬abc φ2 a b c within that clause we have λ1=¬a λ1 a .

One question this notation brings up:

  • What is the disjunction of a single clause? Well, it's reasonable to say that ψψ ψ ψ . Note that this is also equivalent to ψfalseψ .
  • What is the disjunction of zero clauses? Well, if we start with ψψfalse ψ ψ and remove the ψψ, that leaves us with false! Alternately, imagine writing a function which takes a list of booleans, and returns the of all of them — the natural base case for this recursive list-processing program turns out to be false. Indeed, this is the accepted definition of the empty disjunction. It follows from false being the identity element for . Correspondingly, a conjunction of zero clauses is true.
Actually, that subscript notation above isn't quite correct: it forces each clause to be the same length, which isn't actually required for CNF or DNF. For fun, you can think about how to patch it up. (Hint: double-subscripting.)

Note that often one of these forms might be more concise than the other. Here are two equivalently verbose ways of encoding true, in CNF and DNF respectively: (a¬a)(b¬b)(z¬z) a a b b z z is equivalent to abcyz abcy¬z abc¬yz ¬a¬b¬y¬z a b c y z a b c y z a b c y z a b y z . The first version corresponds to enumerating the choices for each location of a WaterWorld board; it has 26 two-variable clauses. This may seem like a lot, but compare it to the second version, which corresponds to enumerating all possible WaterWorld boards explicitly: it has all possible 26-variable clauses; there are 226 2 26 ≈ 64 billion of them!

Collection Navigation

Content actions

Download:

Collection as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add:

Collection to:

My Favorites (?)

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

| A lens I own (?)

Definition of a lens

Lenses

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

What is in a lens?

Lens makers point to 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 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

Module to:

My Favorites (?)

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

| A lens I own (?)

Definition of a lens

Lenses

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

What is in a lens?

Lens makers point to 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 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