CpSc 513: OBDD Examples Mark Greenstreet February 4, 2020 Outline: - - PowerPoint PPT Presentation

cpsc 513 obdd examples
SMART_READER_LITE
LIVE PREVIEW

CpSc 513: OBDD Examples Mark Greenstreet February 4, 2020 Outline: - - PowerPoint PPT Presentation

CpSc 513: OBDD Examples Mark Greenstreet February 4, 2020 Outline: OBDD examples: majority gates A simple model checking example Mark Greenstreet CpSc 513: OBDD Examples Feb. 4, 2020 1 / 7 OBDD example: majority gates maj1 ( x , y , z ) =


slide-1
SLIDE 1

CpSc 513: OBDD Examples

Mark Greenstreet February 4, 2020 Outline: OBDD examples: majority gates A simple model checking example

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

1 / 7

slide-2
SLIDE 2

OBDD example: majority gates

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x)

x y z 1

y x

OBDDs for x and y are simple. To get the OBDD for x ∧ y we use Apply

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

2 / 7

slide-3
SLIDE 3

OBDD example: majority gates

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x)

1 z x y Apply(And,x,y)

x y x ∧ y

OBDDs for x and y are simple. To get the OBDD for x ∧ y we use Apply ◮ x is first variable in the order

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

2 / 7

slide-4
SLIDE 4

OBDD example: majority gates

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x)

1 x y z Apply(And,0,y) Apply(And,1,y)

x y x ∧ y

OBDDs for x and y are simple. To get the OBDD for x ∧ y we use Apply ◮ x is first variable in the order ◮ false branch at x for Apply(AND, x, y) is Apply(Andx|x←0, y|x←0) which simplifies to Apply(And, 0, y). Likewise, the true branch is Apply(And, 1, y).

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

2 / 7

slide-5
SLIDE 5

OBDD example: majority gates

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x)

x y z 1

y x x ∧ y

OBDDs for x and y are simple. To get the OBDD for x ∧ y we use Apply ◮ x is first variable in the order ◮ false branch at x for Apply(AND, x, y) is Apply(Andx|x←0, y|x←0) which simplifies to Apply(And, 0, y). Likewise, the true branch is Apply(And, 1, y). ◮ Apply(And, 0, y) simplies to 0, and Apply(And, 1, y) simplifies to y.

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

2 / 7

slide-6
SLIDE 6

OBDD example: majority gates

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x)

1 x y z 1

y x ∧ y z ∧ x y ∧ z

OBDDs for x and y are simple. To get the OBDD for x ∧ y we use Apply The OBDDs for y ∧ z and z ∧ x are similar. To avoid lots of crossing edges; I’ll use multiple 0 and 1 leaves. To keep the OBDD canonical, all 0 leaves are actually the same node, and likewise for the 1 leaves.

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

2 / 7

slide-7
SLIDE 7

OBDD example: majority gates

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x)

1 1 x y z

y ∧ z (x ∧ y) ∨ (y ∧ z) x ∧ y Apply(Or,x ∧ y,y ∧ z)

Use apply to get OBDD for (x ∧ y) ∨ (y ∧ z).

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

2 / 7

slide-8
SLIDE 8

OBDD example: majority gates

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x)

1 1 y z x

y ∧ z (x ∧ y) ∨ (y ∧ z) x ∧ y Apply(Or,0,y ∧ z) Apply(Or,y,y ∧ z)

Use apply to get OBDD for (x ∧ y) ∨ (y ∧ z). ◮ ((x ∧ y) ∨ (y ∧ z))|x←0 = 0 ∨ (y ∧ z), ((x ∧ y) ∨ (y ∧ z))|x←1 = y ∨ (y ∧ z).

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

2 / 7

slide-9
SLIDE 9

OBDD example: majority gates

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x)

1 1 y z x

y ∧ z (x ∧ y) ∨ (y ∧ z) x ∧ y Apply(Or,0,0) Apply(Or,1,z)

Use apply to get OBDD for (x ∧ y) ∨ (y ∧ z). ◮ ((x ∧ y) ∨ (y ∧ z))|x←0 = 0 ∨ (y ∧ z), ((x ∧ y) ∨ (y ∧ z))|x←1 = y ∨ (y ∧ z). ◮ 0 ∨ (y ∧ z) = y ∧ z, (y ∨ (y ∧ z))|y←0 = 0 ∨ (0 ∧ z) = 0, (y ∨ (y ∧ z))|y←1 = 1 ∨ (1 ∧ z) = 1.

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

2 / 7

slide-10
SLIDE 10

OBDD example: majority gates

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x)

1 x y z 1

y ∧ z x ∧ y (x ∧ y) ∨ (y ∧ z)

Use apply to get OBDD for (x ∧ y) ∨ (y ∧ z). ◮ ((x ∧ y) ∨ (y ∧ z))|x←0 = 0 ∨ (y ∧ z), ((x ∧ y) ∨ (y ∧ z))|x←1 = y ∨ (y ∧ z). ◮ 0 ∨ (y ∧ z) = y ∧ z, (y ∨ (y ∧ z))|y←0 = 0 ∨ (0 ∧ z) = 0, (y ∨ (y ∧ z))|y←1 = 1 ∨ (1 ∧ z) = 1. ◮ ∴ ((x ∧ y) ∨ (y ∧ z))|x←1 = y ∨ (y ∧ z) = y

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

2 / 7

slide-11
SLIDE 11

OBDD example: majority gates

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x)

1 z y x

(x ∧ y) ∨ (y ∧ z) y ∧ z (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x) z ∧ x Apply(Or,(x ∧ y) ∨ (y ∧ z),z ∧ x)

Use apply to get OBDD for (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x).

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

2 / 7

slide-12
SLIDE 12

OBDD example: majority gates

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x)

1 1 x y z

y ∨ z (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x) (x ∧ y) ∨ (y ∧ z) y ∧ z z ∧ x

Use apply to get OBDD for (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x).

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

2 / 7

slide-13
SLIDE 13

OBDD example: majority gates

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x)

x y z 1

y ∨ z (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x) z y ∧ z

I’ll reduced the clutter and only showed the subgraph for (x ∧ y) ∨ (y ∧ z)0zx.

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

2 / 7

slide-14
SLIDE 14

OBDD example: majority gate – the product-of-sums version

maj2(x, y, z) = (x ∨ y) ∧ (y ∨ z) ∧ (z ∨ x)

1 y z 1 1 x

y z y ∧ z (x ∨ y) ∧ (y ∨ z) ∧ (z ∨ x) z ∨ x x ∨ y y ∨ z (x ∨ y) ∧ (y ∨ z)

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

3 / 7

slide-15
SLIDE 15

OBDD example: majority gates – are they the same?

maj1(x, y, z) = (x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x) maj2(x, y, z) = (x ∨ y) ∧ (y ∨ z) ∧ (z ∨ x)

1 x y z 1

(x ∧ y) ∨ (y ∧ z) ∨ (z ∧ x) (x ∨ y) ∧ (y ∨ z) ∧ (z ∨ x)

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

4 / 7

slide-16
SLIDE 16

Now I C

unchanged 1 1 1 1 a b c a b c maj C−element a b c 1 unchanged

A C-element is a state-holding circuit – kind of like a flip-flop The value of c is the value that a and b had the last time they agreed. Originally described in: D.E. Muller and W.S. Bartky, “A Theory of Asynchronous Circuits”, Proceedings of the International Symposium on Switching Theory,

  • pp. 204–243, 1959.

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

5 / 7

slide-17
SLIDE 17

Fun with C-elements

x3 x2 x0 x1

C C C C

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

6 / 7

slide-18
SLIDE 18

Temporal Logic

LTL: Linear time logic: properties that hold for all traces ◮ p: The property p holds in the current state. ◮ p: Always – the property p holds in this state and all subsequent states. ◮ ⋄p: Eventually – The property p in this state or some future state. ◮ Example: (req → ⋄ack) – From all states in which req holds, ack will eventually hold. CTL: Computational Tree Logic – traces are viewed as branching trees of all possible behaviours.

Mark Greenstreet CpSc 513: OBDD Examples

  • Feb. 4, 2020

7 / 7