Prime Compilation of Non-Clausal Formulae Alessandro Previti 1 , - - PowerPoint PPT Presentation

prime compilation of non clausal formulae
SMART_READER_LITE
LIVE PREVIEW

Prime Compilation of Non-Clausal Formulae Alessandro Previti 1 , - - PowerPoint PPT Presentation

Prime Compilation of Non-Clausal Formulae Alessandro Previti 1 , Alexey Ignatiev 2 , Antonio Morgado 2 , Joao Marques-Silva 2 1 HIIT, Department of Computer Science, University of Helsinki 2 IST/INESC-ID, Portugal CL Day 2016 1 / 23 Motivation


slide-1
SLIDE 1

Prime Compilation of Non-Clausal Formulae

Alessandro Previti1, Alexey Ignatiev2, Antonio Morgado2, Joao Marques-Silva2

1HIIT, Department of Computer Science, University of Helsinki 2IST/INESC-ID, Portugal

CL Day 2016

1 / 23

slide-2
SLIDE 2

Motivation

  • Knowledge Compilation

[DM2002,CD1997] 2 / 23

slide-3
SLIDE 3

Motivation

  • Knowledge Compilation

[DM2002,CD1997]

  • Formula Minimization

[Q1952,Q1959,M1956] 2 / 23

slide-4
SLIDE 4

Motivation

  • Knowledge Compilation

[DM2002,CD1997]

  • Formula Minimization

[Q1952,Q1959,M1956]

  • Model-based diagnosis

[dK1992] 2 / 23

slide-5
SLIDE 5

Motivation

  • Knowledge Compilation

[DM2002,CD1997]

  • Formula Minimization

[Q1952,Q1959,M1956]

  • Model-based diagnosis

[dK1992]

  • Inductive generalization in model checking

[BM2007]

  • Modal logic

[B2009]

  • ...

2 / 23

slide-6
SLIDE 6

Contributions

  • A new approach that can compile non-clausal formulae
  • Can compile formulae with thousands of variables
  • It’s completely based on SAT technology

3 / 23

slide-7
SLIDE 7

Basic Definitions

A literal is a variable or its negation

  • Clause: A disjunction of literals

(c ∨ ¬a)

Satisfied clause: at least one literal is true under the given assignment to variables

  • Term: A conjunction of literals

(c ∧ ¬a)

Satisfied term: all of its literals are true under the given assignment to variables

4 / 23

slide-8
SLIDE 8

Propositional formulae

  • Clausal:
  • ◦ CNF: conjunction of clauses

(c ∨ a) ∧ (c ∨ ¬a)

  • ◦ DNF: disjunction of terms

(c ∧ a) ∨ (c ∧ ¬a)

  • Non-clausal:
  • ◦ Non-CNF and Non-DNF
  • ◦ Propositional formulae: well-formed formulae built with standard

connectives ¬, ∧, ∨ ((c ∧ a) ∨ (c ∧ ¬a)) ∧ d

5 / 23

slide-9
SLIDE 9

Prime Implicants and Prime Implicates

  • A term In is called an implicant of F if In F.
  • ◦ An implicant In of F is called prime if any subset I ′

n In is not an

implicant of F.

7 / 23

slide-10
SLIDE 10

Prime Implicants and Prime Implicates

  • A term In is called an implicant of F if In F.
  • ◦ An implicant In of F is called prime if any subset I ′

n In is not an

implicant of F.

  • ◦◦ A satisfying assignment (model) expressed as a conjunction of literals is

an implicant (i.e if p = 1, s = 0, t = 1 is a satisfying assignment then p ∧ ¬s ∧ t is an implicant)

7 / 23

slide-11
SLIDE 11

Prime Implicants and Prime Implicates

  • A term In is called an implicant of F if In F.
  • ◦ An implicant In of F is called prime if any subset I ′

n In is not an

implicant of F.

  • ◦◦ A satisfying assignment (model) expressed as a conjunction of literals is

an implicant (i.e if p = 1, s = 0, t = 1 is a satisfying assignment then p ∧ ¬s ∧ t is an implicant)

  • A clause Ie is called an implicate of F if F Ie.
  • ◦ An implicate Ie of F is called prime if any subset I ′

e Ie is not an

implicate of F.

7 / 23

slide-12
SLIDE 12

Example Prime Implicants/Implicates

F =

C1

(p ∨ s) ∧

C2

(r ∨ t ∨ ¬s) ∧

C3

(r ∨ ¬t)

8 / 23

slide-13
SLIDE 13

Example Prime Implicants/Implicates

F =

C1

(p ∨ s) ∧

C2

(r ∨ t ∨ ¬s) ∧

C3

(r ∨ ¬t)

  • Implicate:

C4

p ∨ r ∨ t ⇒ obtained by resolution of C1 and C2

8 / 23

slide-14
SLIDE 14

Example Prime Implicants/Implicates

F =

C1

(p ∨ s) ∧

C2

(r ∨ t ∨ ¬s) ∧

C3

(r ∨ ¬t)

  • Implicate:

C4

p ∨ r ∨ t ⇒ obtained by resolution of C1 and C2

  • ◦ Prime implicate: p ∨ r ⇒ obtained by resolution of C3 and C4

8 / 23

slide-15
SLIDE 15

Example Prime Implicants/Implicates

F =

C1

(p ∨ s) ∧

C2

(r ∨ t ∨ ¬s) ∧

C3

(r ∨ ¬t)

  • Implicate:

C4

p ∨ r ∨ t ⇒ obtained by resolution of C1 and C2

  • ◦ Prime implicate: p ∨ r ⇒ obtained by resolution of C3 and C4
  • Implicant: p ∧ ¬s ∧ r ∧ ¬t (p = 1, s = 0, r = 1, t = 0)

8 / 23

slide-16
SLIDE 16

Example Prime Implicants/Implicates

F =

C1

(p ∨ s) ∧

C2

(r ∨ t ∨ ¬s) ∧

C3

(r ∨ ¬t)

  • Implicate:

C4

p ∨ r ∨ t ⇒ obtained by resolution of C1 and C2

  • ◦ Prime implicate: p ∨ r ⇒ obtained by resolution of C3 and C4
  • Implicant: p ∧ ¬s ∧ r ∧ ¬t (p = 1, s = 0, r = 1, t = 0)
  • ◦ Prime implicant: p ∧ r (p = 1, r = 1)

8 / 23

slide-17
SLIDE 17

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = ¬a ∧ b ∧ c ∧ d ∧ e ∧ ¬f

9 / 23

slide-18
SLIDE 18

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = ¬a ∧ b ∧ c ∧ d ∧ e ∧ ¬f

9 / 23

slide-19
SLIDE 19

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = b ∧ c ∧ d ∧ e ∧ ¬f

9 / 23

slide-20
SLIDE 20

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = b ∧ c ∧ d ∧ e ∧ ¬f

9 / 23

slide-21
SLIDE 21

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = c ∧ d ∧ e ∧ ¬f

9 / 23

slide-22
SLIDE 22

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = c ∧ d ∧ e ∧ ¬f

9 / 23

slide-23
SLIDE 23

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = c ∧ d ∧ e ∧ ¬f

9 / 23

slide-24
SLIDE 24

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = c ∧ d ∧ e ∧ ¬f

9 / 23

slide-25
SLIDE 25

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = c ∧ d ∧ e ∧ ¬f

9 / 23

slide-26
SLIDE 26

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = c ∧ d ∧ e ∧ ¬f

9 / 23

slide-27
SLIDE 27

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = c ∧ d ∧ e ∧ ¬f

9 / 23

slide-28
SLIDE 28

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = c ∧ d ∧ e ∧ ¬f

9 / 23

slide-29
SLIDE 29

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = c ∧ d ∧ e

9 / 23

slide-30
SLIDE 30

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = c ∧ d ∧ e

  • Propositional formulae:
  • 1. Shannon expansion: Worst-case exponential grow of the formula

9 / 23

slide-31
SLIDE 31

Reduction of Implicants/Implicates

  • CNF formulae:
  • ◦ Polynomial time procedure

F =

C1

(¬a ∨ b ∨ c) ∧

C2

(a ∨ d) ∧

C3

(¬d ∨ e ∨ f ) In = c ∧ d ∧ e

  • Propositional formulae:
  • 1. Shannon expansion: Worst-case exponential grow of the formula

OR

  • 1. Convert F to FCNF using a Tseitin encoding
  • 2. Reduce an implicant In using the following procedure:

input : Formula FCNF , In and Var(F)

  • utput: Prime Implicant in In

1 foreach l ∈ In and var(l) ∈ Var(F) do 2

I ′

n = In \ {l} 3

if I ′

n ∧ ¬F unsat then 4

In = I ′

n 5

else

6

continue

7 return In 8 end 9 / 23

slide-32
SLIDE 32

Related work and drawback

  • Iterated consensus or resolution

[Q1952,Q1959,T1967]

  • Unionist product

[C1996]

  • Based on dual rail encoding

[P1999,J2014]

  • Semantic resolution

[S1970]

  • SE-trees

[R1994]

  • BDD-based (i.e ZRes)

[SD2001] 10 / 23

slide-33
SLIDE 33

Related work and drawback

  • Iterated consensus or resolution

[Q1952,Q1959,T1967]

  • Unionist product

[C1996]

  • Based on dual rail encoding

[P1999,J2014]

  • Semantic resolution

[S1970]

  • SE-trees

[R1994]

  • BDD-based (i.e ZRes)

[SD2001]

They all assume the formula in CNF (DNF) or they are limited to formulae with few variables

10 / 23

slide-34
SLIDE 34

Hitting Set Duality (1)

  • Minimal Hitting Set (MHS):

Given a collection Γ of sets, a hitting set H for Γ is a set such that ∀S ∈ Γ, H ∩ S = ∅.

  • ◦ A hitting set H is minimal if none of its subsets is a hitting set.

11 / 23

slide-35
SLIDE 35

Hitting Set Duality (1)

  • Minimal Hitting Set (MHS):

Given a collection Γ of sets, a hitting set H for Γ is a set such that ∀S ∈ Γ, H ∩ S = ∅.

  • ◦ A hitting set H is minimal if none of its subsets is a hitting set.
  • Example Minimal Hitting Set:

Γ =   {a, b, c} {b, d} {e} H1 = {b, e}, H2 = {a, d, e}, H3 = {c, d, e}. Note that instead {a, b, e} is not a Minimal Hitting Set.

11 / 23

slide-36
SLIDE 36

Hitting Set Duality (2)

  • Prime Implicants and Implicates are related by a hitting set duality
  • ◦ PIn(F): set of all prime implicants of F
  • ◦ PIe(F): set of all prime implicates of F

A term (clause) I is a prime implicant (implicate) of F if and

  • nly if I is a minimal hitting set of PIe(F) (PIn(F))

This remains true for any subset of PIe(F)(PIn(F)) that is equivalent to F (cover)

12 / 23

slide-37
SLIDE 37

MHS on subsets of PIe(F)(PIn(F))

  • Suppose PI

e(F) ⊂ PIe(F) and PI

e(F) not equivalent to F

  • ◦ A MHS p of PI

e(F) does not necessarily corresponds to a prime

implicant

A term p is a prime implicant of F if

  • 1. p is a MHS of PI

e(F)

  • 2. p ∧ ¬F is unsatisfiable
  • When sets are represented as clauses with positive literals, minimal

models correspond to MHS

  • ◦ A minimal model is a model containing a minimal number of variables

assigned to true

13 / 23

slide-38
SLIDE 38

Prime Compilation of Non-Clausal Formulae

  • An approach completely based on SAT technology

14 / 23

slide-39
SLIDE 39

Prime Compilation of Non-Clausal Formulae

  • An approach completely based on SAT technology
  • Exploits the existing duality between prime implicants and prime

implicates in order to find new prime implicants/implicates

14 / 23

slide-40
SLIDE 40

Prime Compilation of Non-Clausal Formulae

  • An approach completely based on SAT technology
  • Exploits the existing duality between prime implicants and prime

implicates in order to find new prime implicants/implicates

  • Complements existing approaches (i.e ZRes)

[SD’01] 14 / 23

slide-41
SLIDE 41

H formula

  • We use a CNF formula H to keep track of the already computed

prime implicants/implicates Unexplored assignment prime implicants & prime implicates to block H formula (dual rail encoding) F formula

15 / 23

slide-42
SLIDE 42

H formula

  • We use a CNF formula H to keep track of the already computed

prime implicants/implicates Unexplored assignment prime implicants & prime implicates to block H formula (dual rail encoding) F formula When H is unsatisfiable either all the PIn(F) or all the PIe(F) have been computed

15 / 23

slide-43
SLIDE 43

Dual Rail Encoding (1)

  • Prime implicants/implicates can be more than 2n
  • Example without dual rail encoding:

F = d ∧ (a ∨ ¬b ∨ ¬d) ∧ (c ∨ b) PIn(F) PIe(F) ¬b ∧ c ∧ d b ∨ c a ∧ c ∧ d d a ∧ b ∧ d a ∨ c a ∨ ¬b

H = (b ∨ ¬c ∨ ¬d) ∧ (¬a ∨ ¬b ∨ ¬d) ∧ (b ∨ c) ∧ d ∧ (a ∨ ¬b)

16 / 23

slide-44
SLIDE 44

Dual Rail Encoding (1)

  • Prime implicants/implicates can be more than 2n
  • Example without dual rail encoding:

F = d ∧ (a ∨ ¬b ∨ ¬d) ∧ (c ∨ b) PIn(F) PIe(F) ¬b ∧ c ∧ d b ∨ c a ∧ c ∧ d d a ∧ b ∧ d a ∨ c a ∨ ¬b

H = (b ∨ ¬c ∨ ¬d) ∧ (¬a ∨ ¬b ∨ ¬d) ∧ (b ∨ c) ∧ d ∧ (a ∨ ¬b) (b ∨ ¬c)

16 / 23

slide-45
SLIDE 45

Dual Rail Encoding (1)

  • Prime implicants/implicates can be more than 2n
  • Example without dual rail encoding:

F = d ∧ (a ∨ ¬b ∨ ¬d) ∧ (c ∨ b) PIn(F) PIe(F) ¬b ∧ c ∧ d b ∨ c a ∧ c ∧ d d a ∧ b ∧ d a ∨ c a ∨ ¬b

H = (b ∨ ¬c ∨ ¬d) ∧ (¬a ∨ ¬b ∨ ¬d) ∧ (b ∨ c) ∧ d ∧ (a ∨ ¬b) (b ∨ ¬c) (¬a ∨ ¬b)

16 / 23

slide-46
SLIDE 46

Dual Rail Encoding (1)

  • Prime implicants/implicates can be more than 2n
  • Example without dual rail encoding:

F = d ∧ (a ∨ ¬b ∨ ¬d) ∧ (c ∨ b) PIn(F) PIe(F) ¬b ∧ c ∧ d b ∨ c a ∧ c ∧ d d a ∧ b ∧ d a ∨ c a ∨ ¬b

H = (b ∨ ¬c ∨ ¬d) ∧ (¬a ∨ ¬b ∨ ¬d) ∧ (b ∨ c) ∧ d ∧ (a ∨ ¬b) (b ∨ ¬c) (¬a ∨ ¬b) ¬b

16 / 23

slide-47
SLIDE 47

Dual Rail Encoding (1)

  • Prime implicants/implicates can be more than 2n
  • Example without dual rail encoding:

F = d ∧ (a ∨ ¬b ∨ ¬d) ∧ (c ∨ b) PIn(F) PIe(F) ¬b ∧ c ∧ d b ∨ c a ∧ c ∧ d d a ∧ b ∧ d a ∨ c a ∨ ¬b

H = (b ∨ ¬c ∨ ¬d) ∧ (¬a ∨ ¬b ∨ ¬d) ∧ (b ∨ c) ∧ d ∧ (a ∨ ¬b) (b ∨ ¬c) (¬a ∨ ¬b) ¬b ¬c

16 / 23

slide-48
SLIDE 48

Dual Rail Encoding (1)

  • Prime implicants/implicates can be more than 2n
  • Example without dual rail encoding:

F = d ∧ (a ∨ ¬b ∨ ¬d) ∧ (c ∨ b) PIn(F) PIe(F) ¬b ∧ c ∧ d b ∨ c a ∧ c ∧ d d a ∧ b ∧ d a ∨ c a ∨ ¬b

H = (b ∨ ¬c ∨ ¬d) ∧ (¬a ∨ ¬b ∨ ¬d) ∧ (b ∨ c) ∧ d ∧ (a ∨ ¬b) (b ∨ ¬c) (¬a ∨ ¬b) ¬b ¬c c

16 / 23

slide-49
SLIDE 49

Dual Rail Encoding (1)

  • Prime implicants/implicates can be more than 2n
  • Example without dual rail encoding:

F = d ∧ (a ∨ ¬b ∨ ¬d) ∧ (c ∨ b) PIn(F) PIe(F) ¬b ∧ c ∧ d b ∨ c a ∧ c ∧ d d a ∧ b ∧ d a ∨ c a ∨ ¬b

H = (b ∨ ¬c ∨ ¬d) ∧ (¬a ∨ ¬b ∨ ¬d) ∧ (b ∨ c) ∧ d ∧ (a ∨ ¬b) (b ∨ ¬c) (¬a ∨ ¬b) ¬b ¬c c ⊥

16 / 23

slide-50
SLIDE 50

Dual Rail Encoding (2)

  • For each variable v in var(F) create two variables xv and x¬v:
  • 1. (xv = 1 and x¬v = 0) ⇒ v = 1
  • 2. (xv = 0 and x¬v = 1) ⇒ v = 0
  • 3. (xv = 0 and x¬v = 0) ⇒ v is a don’t care
  • 4. (xv = 1 and x¬v = 1) ⇒ forbidden

In order to achieve the requirement of point 4 add the clause {(¬xv ∨ ¬x¬v) | v ∈ var(F)}

17 / 23

slide-51
SLIDE 51

Algorithm primer-b

input : Formula F

  • utput: PIn(F) and prime implicate cover of F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F) ← SAT(AF ∧ ¬F)

7

if st then # F ¬M¬F; i.e. ¬M¬F is an implicate

8

Ie ← ReduceImplicate(M¬F, F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else # AF F; i.e. AF is an implicant

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end 18 / 23

slide-52
SLIDE 52

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end 19 / 23

slide-53
SLIDE 53

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end

B = {(¬xv ∨ ¬x¬v) | v ∈ var(F)}

19 / 23

slide-54
SLIDE 54

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end 19 / 23

slide-55
SLIDE 55

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end

H = B ∧ (xb ∨ xc) ∧ xd ∧ (xa ∨ xc) ∧ (xa ∨ x¬b) xa x¬a xb x¬b xc x¬c xd x¬d AH = 10 00 10 10

19 / 23

slide-56
SLIDE 56

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end

If unsatisfiable then all the prime impli- cants have been computed!!

19 / 23

slide-57
SLIDE 57

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end (xa x¬a) (xb x¬b) (xc x¬c ) (xd x¬d ) AH = 10 00 10 10

AF = 1 D 1 1 (a) (b) (c) (d)

Assignment to test: a ∧ c ∧ d

19 / 23

slide-58
SLIDE 58

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end

(st, M¬F) ← SAT(a ∧ c ∧ d ∧ ¬F)

19 / 23

slide-59
SLIDE 59

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end

a ∧ c ∧ d ∧ ¬F unsatisfiable

19 / 23

slide-60
SLIDE 60

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end

input : Formula FCNF , Ie and Var(F)

  • utput: Prime Implicate in Ie

1 foreach l ∈ Ie and var(l) ∈ Var(F) do 2

I ′

e = Ie \ {l} 3

if I ′

e ∧ F unsat then 4

Ie = I ′

e 5

else

6

continue

7 return Ie 8 end 19 / 23

slide-61
SLIDE 61

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end 19 / 23

slide-62
SLIDE 62

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end 19 / 23

slide-63
SLIDE 63

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end 19 / 23

slide-64
SLIDE 64

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end

In ← a ∧ c ∧ d

19 / 23

slide-65
SLIDE 65

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end 19 / 23

slide-66
SLIDE 66

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end

b ← (¬xa ∨ ¬xc ∨ ¬xd)

19 / 23

slide-67
SLIDE 67

Algorithm

input : Formula F

  • utput: PIn(F) and prime implicate cover
  • f F

1 H ← {(¬xv ∨ ¬x¬v) | v ∈ var(F)} 2 while true do 3

(st, AH) ← MinModel(H)

4

if not st then return

5

AF ← Map(AH)

6

(st, M¬F ) ← SAT(AF ∧ ¬F)

7

if st then

8

Ie ← ReduceImplicate(M¬F , F)

9

ReportImplicate(Ie)

10

b ← {xl | l ∈ Ie}

11

else

12

In ← AF

13

ReportImplicant(In)

14

b ← {¬xl | l ∈ In}

15

H ← H ∪ {b}

16 end 19 / 23

slide-68
SLIDE 68

Example using dual rail encoding and minimal models

H = B∧(¬x¬b∨¬xc∨¬xd)∧(¬xa∨¬xb∨¬xd)∧(xb∨xc)∧xd∧(xa∨xc)∧(xa∨x¬b)

(xa x¬a) (xb x¬b) (xc x¬c) (xd x¬d) AH = 10 00 10 10

AF = 1 D 1 1 (a) (b) (c) (d) a ∧ c ∧ d is the last remaining prime implicant and is returned as a model!

20 / 23

slide-69
SLIDE 69

Results

QG6 Geffe gen. F+PHP F+GT Total ZRes-tison 11 11 primer-a (PIn) 53 596 30 26 705 primer-a (PIe) 28 588 30 27 673 primer-b (PIn) 64 595 30 30 719 primer-b (PIe) 30 577 30 27 664

10−2 10−1 100 101 102 103 104 primer-b (PIe computation) 10−2 10−1 100 101 102 103 104 ZRes-tison

3600 sec. timeout 3600 sec. timeout

primer-b vs Zres

  • n

F+PHP family

21 / 23

slide-70
SLIDE 70

Conclusion & Future Work

  • Presented a new approach that can compile non-clausal formulae
  • Can compile formulae with thousands of variables
  • It’s completely based on SAT technology
  • Complements existing approaches
  • Future work
  • ◦ Applications of prime enumeration
  • ◦◦ SAT-Based Formula Simplification

[IPM15]

  • ◦ Preferred prime implicants/implicates
  • ◦◦ Horn LUB

[MPM15] 22 / 23

slide-71
SLIDE 71

Thank You

23 / 23