0% found this document useful (0 votes)
41 views

Reduced Orered Binary Decision Diagrams

This document introduces Reduced Ordered Binary Decision Diagrams (ROBDDs) as a way to represent boolean functions more compactly than truth tables. It describes how ROBDDs are constructed from the constants True and False and the IfThenElse connective, with the requirement that they be reduced and ordered. The document then provides instructions for writing ML functions to combine, evaluate, and manipulate ROBDDs, including functions for conjunction, disjunction, negation, implication, conditional, and evaluating variables to true or false.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Reduced Orered Binary Decision Diagrams

This document introduces Reduced Ordered Binary Decision Diagrams (ROBDDs) as a way to represent boolean functions more compactly than truth tables. It describes how ROBDDs are constructed from the constants True and False and the IfThenElse connective, with the requirement that they be reduced and ordered. The document then provides instructions for writing ML functions to combine, evaluate, and manipulate ROBDDs, including functions for conjunction, disjunction, negation, implication, conditional, and evaluating variables to true or false.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Reduced Orered Binary Decision Diagrams

There are various ways of representing boolean functions. Perhaps the most obvious is
simply to give a truth table but we often like more language-like or shorter representations.
The most common use the (propositional) connectives (read and C++s &&), (or
C++s ||), and (read not C++s !). The common Conjunctive Normal Form (CNF)
specifies:
A term is a proposition letter (i.e., boolean variable) or its negation.
A clause is a disjunction () of terms.
A CNF formula is a conjunction () of clauses.
It is provable that every boolean function is representable by a CNF formula. That is, every
boolean formula is logically equivalent to a CNF formuls.
A bit of history: Professor Henry Sheffer showed that one connective suffices. The Sheffer
stroke of propositions p and q written p|q evaluates to False if p ane q are both true, and
to True otherwise. It is sometimes called NAND.
One important form for some computer applications uses constants True and False plus
connective IfThenElse. This last has the (fairly obvious) truth table:
if p is
of q
else

True
True

True
True

True

Fals
e
Fals
e
True

True
Fals
e
True

True
Fals
e
A Binary
Fals
from
e
Fals
e
for
Fals
e

True
Fals
e
Fals
e

IfThenElse(p,q,r)
true then return the value
.
True
True
False

Fals
e
True

False

Fals
e
True

False

Fals
e

False

return the
value of r

True

True

Decision Diagram (BDD) is a formula built


True, False, and IfThenElse where the first
argument of IfThenElse is always a
proposition letter (i.e., boolean variable). So,
example

IfThenElse(p,IfThenElse(q,r,True),IfThenEl
se(r,False,w))

is a BDD.1 For some fixed ordering of the proposition letters, a BDD is said to be ordered if, in
each occurrence IfThenElse(p,,) of IfThenElse, variable p is less than every variable
occurring in and less than every variable in . A BDD is reduced if, in each occurrence
IfThenElse(p,,), formulas and are not the same. An ROBDD is a reduced, ordered, BDD.
It is provable that, given any ordered set of proposition letters, each boolean function is
represented by a unique ROBDD.

Well build BDDs with strings for proposition letters and our ordering on strings will be
MLs built in <:
datatype ROBDD = True
| False
| IfThenElse of string * ROBDD * ROBDD;

Your task is to write ML functions that combine and evaluate reduced ordered BDDs
(ROBDDs).
Just copy the first one into your file:
fun bddAssert propLetter = IfThenElse (propLetter, True, False);
It represents the assertion that propLetter is true.
infix function bddAnd: given 2 ROBDDs, it returns the ROBDD for their conjunction.
Look up how to declare an infix function, e.g., look in Paulsons ML for the Working
Programmer, on reserve in the CEAS library, or Google SML infix declaration.
Hint: Part of the difficulty, of course, is to get the conjunction of the 2 ROBDDs reduced
and ordered. Of course,
True bddAnd anyROBDD will be just anyROBDD To get the ordering: If youre asked to
compute
(IfThenElse(p,,)bddAndIfThenElse(q,,))
the proposition letter at the root of the resultant ROBDD will be either p or q whichever
is less. So youll need 3 cases: p < q, p = q, and p > q. Having determined the root, you
recurse down the branches. Its a bit tricker to make sure the result is reduced; you might
even want a separate function to reduce OBDDs.
infix function bddOR: given 2 ROBDDs, it returns the ROBDD for their disjunction.
fun bddNot bdd that, given a ROBDD, returns the ROBDD for the negation of that boolean
function.
fun bddImplies (ROBDD hypo, ROBDD conc), where bddImplies(,) returns the ROBDD
representing ( ).
fun bddIfThenElse (ROBDD test, ROBDD trueCase, ROBDD falseCase) that, given 3 ROBDDs, returns the ROBDD representing the if-then-else function of the 3 arguments.
Note: This is not just the IfThenElse constructor: the constructor requires that test must
be a string, not an ROBDD, and you must also make sure the result of this operation is
both reduced and ordered.
fun bddEvalToTrue((bdd: ROBDD), (propLetter: string)) that gives the ROBDD where variable
propLetter is removed, and it is assumed that propLetter is true (True).
(So if I did this for every propLetter occurring in bdd, the result would be either True or
False, depending upon what the ROBDD says is the case.)

(You probably wont need to speicify the types of the paramters ROBDD and propLetter I
expect that ML will figure that out from your program. I put those type restrictions there
to help you understand what the function does.)
fun bddEvalToFalse((bdd: ROBDD), (propLetter: string)) that gives the ROBDD where variable
propLetter is removed, and it is assumed that propLetter is false.
Hint: Some of these functions can merely call some of the others.
Caution: Dont delay starting. I was going to give you only 1 week to do this assignment, but I
decided some people might need help understanding ROBDDs.
Email your function definitions to me. Ill provide test data.
When you use your own test data, I suggest put your ROBDD function definitions int a file
(say, in file asst2-yourName.txt) and then use that file (say, use "asst2yourName.txt";).
Remember to put standard ID information in a comment at the top of the file: the
programmers name, the date the program was completed, a brief description of the purpose
of the file, and that its programming assignment #2 for CS 4003 section 2.

You might also like