Top Banner
Knuth V4: BDD + BW Equality: Satisfiability: Tautolog : () () ( ) () ( ) ) y ( : n n n x x f g x f x gx SAT f f x TAUT f f x = ⇔∀ ∈ = = = Used in: Hardware/Software Verification/Certification/Synthesis/Optimization Mathematical Enumeration/Optimization/Analysis Fault Analysis/Detection/Tolerance Protection against side-channel attacks Techniques: Critical assertions: “All doors are closed when train moves”! Computing NP complete functions: may & will blow up! Strong Normal Forms: MDA, BDD, BMD, IDD … Partial Normal Form: SAT 1 Boolean Normal Forms Jean Vuillemin École Normale Supérieure, Paris
36

Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

Sep 12, 2018

Download

Documents

hoangthien
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

Knuth V4: BDD + BW

Equality: Satisfiability:

Tautolog

: ( ) ( )( ) ( )

( ) )y (:

n

n

n

x

x

f g x f x g xSAT f f x

TAUT f f x∈

= ⇔ ∀ ∈ =

=

=

Used in: • Hardware/Software Verification/Certification/Synthesis/Optimization • Mathematical Enumeration/Optimization/Analysis • Fault Analysis/Detection/Tolerance • Protection against side-channel attacks

Techniques: • Critical assertions: “All doors are closed when train moves”! • Computing NP complete functions: may & will blow up! • Strong Normal Forms: MDA, BDD, BMD, IDD … • Partial Normal Form: SAT

1 Boolean Normal Forms

Jean Vuillemin École Normale Supérieure, Paris

Page 2: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

Efficient Algorithms on Sparse Structures

• Universal Data Structure – Boolean Function - BMD – Finite Integer, Set, Language, Polynomial … – Sparse & Dense Numbers

• Store Once – Space Efficient Shared DAG – Unit Time n=m 22n … – Fast n<m -n ~n 1+n n-1 2n << >> …

• Compute Once

– Memo 2x + - x / & | …

[email protected] 2

Page 3: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

Broad Word

3

{ }0 0,1= =

{ }*: | | 2 pp w w= ∈ =

Catenate two words of equal length 2p

Broad Words of length 2p

1 0 1

0 1

0 1

! , :

w=1

q qw w ww w

q w w w

+∀ ∈ ∃ ∈

= = = −

Unique decomposition

1p p p+ =

Bits as letters

0,1,pp

= =

Generated from 3 Symbols

Page 4: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 4

Integers as Binary Trees

0 1

2

2 2

Dichotomy

Base

Dept

+

2

( ) log log 1 min{ 1: }

h

p

p

p

p

n n n x

x

ll n np n x

=

=

= + = − <

0 1

2

Binary decomposition Leng

+2 . ( ) log 1th

n n nl n n

=

= +

2007 = 21 1 1 0 1 0 1 1 1 1 1 = 11101011+x3 111 x3 = 256 = (1110+x2 1011)+x3 111) x2 = 16 = ((11+x1 10)+x2 (10+x1 11))+x3 (11+x1 10) x1 = 4 = 1+x0 +x1+x2 (1+x1 (1+x0 ))+x3 (1+x0 +x1 ) x0 = 2

Page 5: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 5

Decision Tree 2007

2007 =21 1 1 0 1 0 1 1 1 1 1 (0)

l(2007)=11 < x2 =222= 16

ll (2007)=4

2007

215

13 3 3

7

7

7 0

2007 =21 1 1 0 1 0 1 1 1 1 1 0 0 0 0 0 (0)

3

x3 =223= 256 x4 =224= 65536

=215+7x3

Page 6: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

Language 2007

[email protected] 6

215 7.

2007

1 1 1 0 1 0 1 1 1 1 1 0 0 0 0 0

2 2

0

{ :1 }

n k kkB

k k nn

n k

n

S k B≥ ∈

= =

= =

∑ ∑

0 1 2{ : }p

k k

p

n B BL k n−= ∈ ∈

Ln

0− Ln 1− Ln

0 { : 0 }1 { :1 }

L w w LL w w L

= ⋅ ∈

= ⋅ ∈

L2007 = {0000, 0001, 0010, 0100, 0110, 0111, 1000, 1001, 1010 }

L215= 0− L2007 = {000, 001, 010, 100, 110, 111} L7= 1− L2007 = {000, 001, 010 }

S2007 = {0, 1, 2, 4, 6, 7, 8, 9,10}

S215= {0, 1, 2, 4, 6, 7} S7 = {0, 1, 2}

n

n mod xp n div xp

Page 7: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

MDA 2007

[email protected] 7

2007

1 1 1 0 1 0 1 1 1 1 1 0 0 0 0 0

1 0

{0000, 0001, 0010, 0100, 0110, 0111, 1000, 1001, 1010 }

{000, 001, 010, 100, 110, 111} {000, 001, 010 }

Page 8: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

MDA 2007

[email protected] 8

2007

215 7.

1 1 1 0 1 0 1 1 1 1 1 0 0 0 0 0

2007

215 7.

1 0

Page 9: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

MDA 2007

[email protected] 9

2007

215

13 7

7.

7 0.

1 1 1 0 1 0 1 1 1 1 1 0 0 0 0 0

2007

215 7.

7 13 0..

Page 10: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

MDA 2007

[email protected] 10

2007

215

13

3 3

7

7.

7 0.

1 1 1 0 1 0 1 1 1 1 1 0 0 0 0 0

3

2007

215 7.

7

1.

0..

3

1 0

13

0.

Share equal structured nodes

( ) { } (0 ) (1 )m L L Lda md La mda− −= ∪ ∪

Page 11: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

IDD 2007

[email protected] 11

2007

215 7.

7

1.

0..

3

1 0

13

0.

2007

215

7

3

1

13

2007

215

7

3

1

13

Share equal value nodes

Page 12: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 12

Primitive IDD Operations Depth np=ll(n)-1 Division by xp=22p Equality test n=m nh= mh

all in 1 machine operation.

( , , )[ ]

( , , ), : , [ ]

h h h

T

h f g p dh n hh n g p d h h n

=∈ ⇒ =∉ ⇒ = = ∪ =H H

H H H H

Constructor n=T(g, p, d) = g+dxp with g<xp and 0<d<xp

Store once: (in a single global) hash-table

Page 13: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 13

IDD 2007 2007 = 215+ 7 x3

215 = 7 + 13 x2

7 = 3 + x1 13 = 1 + 3 x1

2 = x0 3 = 1 + x0

2007 =21 1 1 0 1 0 1 1 1 1 1 0 0 0 0 0 (0)

6 straight lines of code 6 nodes in DAG

2007

215

13 3 3

7

7

7 0 3

1 1 1 0

2007

215

7

1

13

3

2

1

3 0

1

1 2 0

1. Recursively decompose n = n0+ n1xp = T(n0, p, n1) 2. Share equal nodes.

Page 14: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 14

Size of Numbers

0=zero 0 1=un 0 2=t(0,0,1) 1 3=t(1,0,1) 1 4=t(0,1,1) 1 5=t(1,1,1) 1 6=t(2,1,1) 2 7=t(3,1,1) 2 8=t(0,1,2) 2 9=t(1,1,2) 2

10=t(2,1,2) 2 11=t(3,1,2) 3 12=t(0,1,3) 2 13=t(1,1,3) 2 14=t(2,1,3) 3 15=t(3,1,3) 2 16=t(0,2,1) 2 17=t(1,2,1) 2 18=t(2,2,1) 2 19=t(3,2,1) 3

2

( ) ( )( ) log ( 1)

s n l nl n n

= +

(1 )s n n=

2 ( )( )( ) ( )

l ns nll n lll n

<−

Page 15: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

15

Equality Test

1 0 1p

aa a a a+

∈∈ =

Depth ( )d p p=

0 1 0 1

( )( )

isn0isn0 isn0 isn) 0( ( )

a aa a a a

∈ == ∪

• Circuit isn0(a:Net3)

Gates ( ) 2 1pg p = − Area ( ) 2 pa p p=

2 isn00 ( ) : ,p

pa b a b a b a b= ⇔ ⊕ = ⇔ ¬ ⊕ ∈

Zero Test

• Single BW operation on 2p parallel bits. • Single SW op on MDA: a bu v u u= ⇔ =

Page 16: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 16

Compare

1 1 1 1

0 0

0( )

( )( )( )

p p p p

n mn m sign n m

sign n mn m sign n m

sign n m

= ⇒ ≠ ⇒ −− = ≠ ⇒ − ⇒ −

DAG at worst ll(n) operations:

Array at worst l(n) operations.

1( ) 0

1

n msign n m n m

n m

⇔ >− = ⇔ =− ⇔ <

Page 17: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 17

Decrement n-1 in ll(n) operations:

0 ( , , 1)0 ( 1, , )

T

T

g m p p dg m g p d

µ= ⇒ = −≠ ⇒ = −

s(n,n-1)<s(n)+ll(n)

22 1 1p

pp xµ = − = −Table:

( , , )1

Tn g p dm n

== −

1 1

2007

215

7

1

13

3

2

1

3 0

1

1

6

1 0

2 0

2006 3

1

Page 18: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 18

Increment

Increment n in p(n) operations.

1 ( , , ) (1 , , );

1 ( , , )) (0, ,1 );

1 ( , , )) (0,1 ,1)

T Tp

T Tp

T Tp

g n g p d g p dd n g p d p dd n g p d p

µ

µ

µ

< ⇒ + = +

< ⇒ + = +

= ⇒ + = +

s(n,n+1)<s(n)+ll(n).

22 1p

pµ = −Table:

Page 19: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 19

Twice This version of doubling may require up to l(n) operations.

2 0 02 1 22 ( , , ) (2 , , 2 )T Cg p d g p d

× =× =× = × ×

For sparse Trees, time can be exponential in size!

Implement 2x as a memo function: computed values are always stored. They get retrieved whenever possible; otherwise, the computation is performed exactly once.

Time & space for twice 2x with memo is linear in s(2n). Hence s(2n)<2s(n).

Over 106 numbers in the expression-neighborhood of F1024 are very sparse: s(n)<p(n).

Page 20: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 20

Compute Once

(0) 0, (1) 1( ( , , )) ( ) ( )T g p d g d

ν νν ν ν

= == +

Number of 1 in the binary representation

Linear time s(n) through memo function.

Naive version of population count may require up to l(n) operations.

Page 21: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 21

Logic Operations : 0: ( 0 0, , 1 1): 0

p q a ba b p q C a b p a b

p q a b

< ∩∩ = = ∩ ∩ > ∩

0 1 0 1p qa a x a b b x b= + = +

: ( 0, , 1): ( 0 0, , 1 1): ( 0 , , 1)

p q a b q ba b p q C a b p a b

p q a b p a

τ

τ

< ∪∪ = = ∪ ∪ > ∪

: ( 0, , 1): ( 0 0, , 1 1): ( 0 , , 1)

p q a b q ba b p q C a b p a b

p q a b p a

τ

τ

< ⊕⊕ = = ⊕ ⊕ > ⊕

Memo function size: s(a)s(b).

Quadratic time & space

( ) ( ) ( )( ) ( ) ( )( ) ( ) ( )

s a b s a s bs a b s a s bs a b s a s b

∩ <⊕ <∪ <

Page 22: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

Full Adder Netlist

s a b cr ab bc ca

= ⊕ ⊕= ⊕ ⊕

2a b c s r+ + = +Invariant

DSC © Vuillemin 22

a c

x

b

p

s

r

IDD

s r

Page 23: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

8 Transistors cMOS Full Adder

Vuillemin © 2014-18

8 transistors

a

c

b

x s

r

c

1

0

3 gates

cMOS Layout

XOR

Page 24: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

Representing Circuit Functions

b3 b3

a3

Cout

b3

b2 b2

a2

b2 b2

a2

b3

a3

S3

b2

b1 b1

a1

b1 b1

a1

b2

a2

S2

b1

a0 a0

b1

a1

S1

b0

10

b0

a0

S0

• Functions – All outputs of 4-bit adder – Functions of data inputs

A

B

Cout

SADD

Shared Representation Graph with multiple roots 31 nodes for 4-bit adder 571 nodes for 64-bit adder Linear growth

Page 25: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 25

Huge

0

n+1

1 b ( , , )n n n

bt b b b

==

5 b2 = 5 (1+232 )= 21474836485

1

1 b1 =5

1

( )(1 ) 2( 1) 2 1

(2 ) 2( ( )) 2

n

n

n

nb n

nn

s b ns b ns b n

ss l b +

=+ =

− = −

=

=

bigDemo

1

1

2 2( )

( ) 2

( ) 2

n

n

n nb

nn

n

b nll b b

l bbν

+

+

> ↑=

=

=

>2 2 2 2 2 b3

b2 b3 =b2 (1+22 b2 )

b4 = b3 (1+22 b3 )

2

Page 26: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 26

Time O(ll(n)) Operations • Compare: sign(n-m) • Increment: s(n-1)<s(n)+ll(n) • Decrement: s(n+1)<s(n)+ll(n) • Add/remove bit i<l(n): s(n+2i,n-2i)<s(n)+4ll(n) • 2-power: s(2n)=ν (n)<ll(2n) • Binary length: l(n) • 2-2-power: s(22n)= s(n)+1 • …

Example:

Page 27: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 27

Versatile Data Structure

n n

n -

-

-

2 - mod

< -n ~n s+n l(n) 2 min max insert d sort median

elete

z z e

= ll(n) 2 (l,p,h) =

0 1 0 1

NumberSetSerie

t

sLanguage

+ × ÷∪ ∩ ⊂

⊕ ⊗

+

↑ ↓

¬

Integer, Dictionary, h-Table, Boolean Function, Polynomial… - same same package

Page 28: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 28

Dictionary 1. Code set s={n1 … nk } by number Ns=Σ 2 nk . 2. Map dictionary operations to Boolean algebra over integers.

Supports Search/Insert/Delete/Min/Max/Complement in p(Ns)<l(k)+p(nk) operations.

Supports Merge/Intersect/XOR/Shift & more. • Linear time/space with respect to un-shared size for dense numbers. • Quadratic time/space with respect to shared size for sparse numbers.

Can be used to efficiently implement the hash-table required to maintain unique numbers nh.

Page 29: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 29

Conclusion Sparse Numbers (low entropy)

DAG size << binary length. DAG time at worst quadratic in size.

Research: Achieve small c. Hash-table bootstrap. Tie in efficient storage de/allocation. Polynomials, Matrices & Quad Trees. Entropy Compression. Quantify sparseness.

Dense Numbers (high entropy) DAG size < binary length. DAG time < c x bit-array.

Page 30: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

end

[email protected] 30

Page 31: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 31

Sparse Product

Time for memo sparse product nm is at most s(n)s(m).

0 1 1 2

6

6 246

1782

15

17822 = 2462 +2x3(6x246)+x462

2462 = 62 +2x2(6x15)+x3152

62 = 4+2x2

152 x3-2x2+1

6x246 = 62 +x2(6x15)

6x15 = 6x2-6

Page 32: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

Full Adder MDA

p a bq b ch p qs c pr b h

= ⊕= ⊕= ∩= ⊕= ⊕

(01)a = (0011)b = 00001111c = p=(0110) q=00111100

h=00100100 s=01101001 r=00011011

t u v w t u t u v

t v t v w t v w u

x

x

32

Page 33: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

33

Boolean Operations on MDA

0 1 0 1

( ) 1( ) ( ) ( )

a aa a a a

¬¬ ¬

= −¬=

0 1 0 1 0 1 0 1( ) ( ) ( ) ( )a b a b a b

a a a a a a a a= + −

=∪

∪×

∪ ∪

0 1 0 1 0 1 0 1( ) ( ) ( ) ( )a b a b

a a a a a a a a∩

∩=

∩×

= ∩

0 1 0 1 0 1 0 1

2( ) ( ) ( ) ( )

a b a b aba a a a a a a a

⊕⊕

= + −= ⊕ ⊕

• At worst quadratic space

• Time is linear in space thanks to memo functions.

{ }op

op

( ) ( ) ( ), ,

a b bs s sa<

∈ ∩ ∪ ⊕

( ) ( )a as s=¬

Page 34: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

34

MDA w = 0100110011000000∈𝕎4

0 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0

w10•w11=w1 w0 = w00•w01

w = w0•w1

w10=w01

00 01 11 0000

0100 1100

01001100 11000000

01001100 11000000

0100110011000000

MDA(w)

Many variants: BDD, ZDD, IDD… cf. Knuth v4

ops(w)?

lang(w)?

s=|MDA(w) | 00 01 11

Page 35: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

35

Compute Once Naive rev takes 2p operations.

Time to traverse a DAG can be exponential in size

Implement rev as memo function: Computed values temporarily stored & retrieved when possible; Compute all exactly once!

rev space (& time): ( ( )) ( )s rev n s n=

1

revrev rev r

( )( 0 1) ( 1) ( 0v )ep

a a aa a a a a+

∈ =∈ =

Page 36: Jean Vuillemin - WebHomepouzet/cours/mpri/cours-jv-2/IntegerDecisionDiagram.pdf · Jean Vuillemin . École Normale Supérieure, Paris. Efficient Algorithms on Sparse Structures ...

[email protected] 36

Shared Tries

22 2 (0, , 2 )kn m m

T k+= =Power 2:

( ( , , )) ( ) 2 pTl g p d l d= +Binary length:

(2 ) ( ) ( )k kBnn

s k l kν< = ≤∑

Search/Insert/Remove bit k of n: