leveraging structural analysis for quanti ed boolean...

Post on 07-Jul-2020

12 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Leveraging Structural Analysis

for Quantified Boolean Formulae

Reduced Block Triangular Form (RBTF)

Joan Thibault, Khalil Ghorbal

INRIA, Rennes, France

Representing and Manipulating Symbolic Expression : Boolean

Function

Applications

• Model Checking

• (Computer Assisted) Hardware/Software Verification/Synthesis

• Other Applications : Mathematics, Physic, Biology, . . . .

Problems

• SAT/QBF

• (Integer) Linear Programming

• Polynomials

• Constraint Programming

Solvers vs Compilers

1

Satisfiability : Solver vs Compiler

CNF1-DPLL2-CDCL3-based SAT-solvers

• Efficient

• Proof Size Exponential in the number of ‘xor’

Binary Decision Diagrams

• Compilation =⇒ Canonicity and Polynomial Queries.

• Memory Expensive

1Conjunctive Normal Form2Davis–Putnam–Logemann–Loveland : algorithm based on case analysis and constant

propagation3Conflict-Driven Clause Learning

2

Satisfiability on Quantified Formulae: Solver vs Compiler

CNF-based QBF-solvers (Quantified Boolean Formula)

• Bad support of quantifier alternation

Binary Decision Diagrams

• Native support of quantifier elimination

• Memory Expensive

3

Binary Decision Diagram : A Versatile Data Structure

Model Checking / Reactive Synthesis

• Reachability

• Transitive Closure

Combinatoric

• Model Counting

• Parameterized Optimization

• Parameterized Graph Problem (related to HYCOMES’ problematic)

Areas outside Computer Science

• Biology

• Physics

• · · ·

4

Quantified Boolean Formulae

• A set of Variables (Xi )i

• A set of local4 Constraints (Cj)j on these variable

• Formula : φ = C1 ∧ · · · ∧ Ck .

• Quantified Formula : Φ = ∃Ek′+1∀Uk′ . . . ∀U1∃E1. φ.

4We assume that usually constraints only depends on a small number of variables.

5

Quantified Boolean Formulae

• A set of Variables (Xi )i

• A set of local4 Constraints (Cj)j on these variable

• Formula : φ = C1 ∧ · · · ∧ Ck .

• Quantified Formula : Φ = ∃Ek′+1∀Uk′ . . . ∀U1∃E1. φ.

4We assume that usually constraints only depends on a small number of variables.

5

Quantified Boolean Formulae

• A set of Variables (Xi )i

• A set of local4 Constraints (Cj)j on these variable

• Formula : φ = C1 ∧ · · · ∧ Ck .

• Quantified Formula : Φ = ∃Ek′+1∀Uk′ . . . ∀U1∃E1. φ.

4We assume that usually constraints only depends on a small number of variables.

5

Compilation Of Quantified Formula

Quantifier Elimination

• φ = φ1 ∧ · · · ∧ φk∀U−−→ φ((∀U)) = (∀U. φ1) ∧ · · · ∧ (∀U. φk)

• φ ∃E−−→ φ((∃E)) using RBTF.

∃Ek+1∀Uk . . . ∀U1 ∃E1. φ︸ ︷︷ ︸φ((∃E1))︸ ︷︷ ︸

φ((∃E1))((∀U1))

.

6

Compilation Of Quantified Formula

Quantifier Elimination

• φ = φ1 ∧ · · · ∧ φk∀U−−→ φ((∀U)) = (∀U. φ1) ∧ · · · ∧ (∀U. φk)

• φ ∃E−−→ φ((∃E)) using RBTF.

∃Ek+1∀Uk . . . ∀U1 ∃E1. φ︸ ︷︷ ︸φ((∃E1))︸ ︷︷ ︸

φ((∃E1))((∀U1))

.

6

Application : Boolean Existential Closure

• Variables : X ,Y ,Z ,T ,U.

• Constraints : C1(X ,Y ,Z ), C2(X ,Z ,T ), C3(X ,T ,U).

• Formula :

φ(X ,Y ,Z ,T ,U) := C1(X ,Y ,Z ) ∧ C2(X ,Z ,T ) ∧ C3(X ,T ,U).

• Primal Graph :

U

X

Y

T

Z

7

RBTF : Hand Waving Version

ϕ(X ,Y )

8

RBTF : Hand Waving Version

ϕ(X ,Y )

ϕX (X ,Y ) ϕX (Y )

8

RBTF : Hand Waving Version

ϕ(X ,Y )

ϕX (X ,Y ) ϕX (Y )

ϕX (X ,Y )

∃X .ϕX⏟condensed constraint

8

RBTF : Hand Waving Version

ϕ(X ,Y )

ϕX (X ,Y ) ϕX (Y )

ϕX (X ,Y ) ϕ(X )

(Y )

∃X .ϕX⏟condensed constraint

8

Eliminating A Variable : Y

• Formula :

φ(X ,Y ,Z ,T ,U) := C1(X ,Y ,Z ) ∧ C2(X ,Z ,T ) ∧ C3(X ,T ,U).

• Projection : C ′1(X ,Z ) := ∃Y , φY = ∃Y ,C1(X ,Y ,Z ).

• WCET : 2|φY | = 23

• Condensation :

φ(Y )(X ,Z ,T ,U) = C ′1(X ,Z ) ∧ C2(X ,Z ,T ) ∧ C3(X ,T ,U).

• Primal Graph :

U

X

Y

T

Z

9

Eliminating A Variable : T

• Formula :

φ(X ,Y ,Z ,T ,U) := C1(X ,Y ,Z ) ∧ C2(X ,Z ,T ) ∧ C3(X ,T ,U).

• Projection : C ′2(X ,Z ,U) := ∃T , φT = ∃T ,C2 ∧ C3.

• WCET : 2|φT | = 24

• Condensation : φ(T )(X ,Y ,Z ,U) = C1(X ,Y ,Z ) ∧ C ′2(X ,Z ,U).

• Primal Graph :

U

X

Y

T

Z

10

Eliminating Several Variables : {Y ,T}

• Formula :

φ(X ,Y ,Z ,T ,U) := C1(X ,Y ,Z ) ∧ C2(X ,Z ,T ) ∧ C3(X ,T ,U).

• Projection :

C ′1(X ,Z ,U) := ∃(Y ,T ), φ{Y ,T} = ∃(Y ,T ),C1 ∧ C2 ∧ C3.

• WCET : 2|φ{Y ,T}| = 25

• Condensation : φ({Y ,T})(X ,Z ,U) = C ′1(X ,Z ,U).

• Primal Graph :

U

X

Y

T

Z

11

Bad Selection of Variable : X

• Formula :

φ(X ,Y ,Z ,T ,U) := C1(X ,Y ,Z ) ∧ C2(X ,Z ,T ) ∧ C3(X ,T ,U).

• Projection : C ′1(Y ,Z ,T ,U) := ∃X , φX = ∃X ,C1 ∧ C3 ∧ C3.

• WCET : 2|φX | = 25

• Condensation : φ(X )(X ,Z ,T ,U) = C ′1(Y ,Z ,T ,U).

• Primal Graph :

U

X

Y

T

Z

12

Constraint Propagation : Eliminating All Variables

• Basic Operation : S(φ(X,Y),X) := φX(X,Y) ∧ φ(X)(Y)

• Basic Operation Cost : Sc(φ,X) := 2|φX|

• For any formula φ, we denote supp(φ) the set of variables appearing

in φ, we denote |φ| := |supp(φ)| its cardinal, i.e., the number of

variables in φ.

• φ(X1, · · · ,Xk) ≡ φX1∧φ(X1)X2∧φ(X1,X2)

X3∧· · ·∧φ(X1,··· ,Xk−1)

Xk∧φ(X1,··· ,Xk)︸ ︷︷ ︸

constant

.

• We call this process : Forward Reduction Process (FRP).

• We term this representation the weakly Reduced Block Triangular

Form (weak-RBTF)

13

Constraint Propagation : Eliminating All Variables

• Basic Operation : S(φ(X,Y),X) := φX(X,Y) ∧ φ(X)(Y)

• Basic Operation Cost : Sc(φ,X) := 2|φX|

• For any formula φ, we denote supp(φ) the set of variables appearing

in φ, we denote |φ| := |supp(φ)| its cardinal, i.e., the number of

variables in φ.

• φ(X1, · · · ,Xk) ≡ φX1∧φ(X1)X2∧φ(X1,X2)

X3∧· · ·∧φ(X1,··· ,Xk−1)

Xk∧φ(X1,··· ,Xk)︸ ︷︷ ︸

constant

.

• We call this process : Forward Reduction Process (FRP).

• We term this representation the weakly Reduced Block Triangular

Form (weak-RBTF)

13

Constraint Propagation : Eliminating All Variables

• Basic Operation : S(φ(X,Y),X) := φX(X,Y) ∧ φ(X)(Y)

• Basic Operation Cost : Sc(φ,X) := 2|φX|

• For any formula φ, we denote supp(φ) the set of variables appearing

in φ, we denote |φ| := |supp(φ)| its cardinal, i.e., the number of

variables in φ.

• φ(X1, · · · ,Xk) ≡ φX1∧φ(X1)X2∧φ(X1,X2)

X3∧· · ·∧φ(X1,··· ,Xk−1)

Xk∧φ(X1,··· ,Xk)︸ ︷︷ ︸

constant

.

• We call this process : Forward Reduction Process (FRP).

• We term this representation the weakly Reduced Block Triangular

Form (weak-RBTF)

13

Constraint Propagation : Eliminating All Variables

• Basic Operation : S(φ(X,Y),X) := φX(X,Y) ∧ φ(X)(Y)

• Basic Operation Cost : Sc(φ,X) := 2|φX|

• For any formula φ, we denote supp(φ) the set of variables appearing

in φ, we denote |φ| := |supp(φ)| its cardinal, i.e., the number of

variables in φ.

• φ(X1, · · · ,Xk) ≡ φX1∧φ(X1)X2∧φ(X1,X2)

X3∧· · ·∧φ(X1,··· ,Xk−1)

Xk∧φ(X1,··· ,Xk)︸ ︷︷ ︸

constant

.

• We call this process : Forward Reduction Process (FRP).

• We term this representation the weakly Reduced Block Triangular

Form (weak-RBTF)

13

Constraint Saturation : Reduced Block Triangular Form

• φ ≡ φX1︸︷︷︸=φ′0

∧φ(X1)X2︸︷︷︸

=φ′1

∧φ(X1,X2)X3︸ ︷︷ ︸=φ′2

∧ · · · ∧ φ(X1,··· ,Xk−1)Xk︸ ︷︷ ︸

=φ′k−1

∧φ(X1,··· ,Xk)︸ ︷︷ ︸=φ′k

.

• One may show that, using a similar process, the final constraint may

be propagated back into the structure leading to canonical

representation (up to an ordered partition of the variables).

• φ ≡ φ′′ =∧

0≤i≤k φ′′i

• with φ′′i ≡ φ|supp(φ′i )

• with, for any formula ψ(X,Y), ψ|X(X) := ∃Y, ψ(X,Y).

• We term this process the Backward Propagation Process (BPP)

• We term this representation Reduced Block Triangular Form (RBTF)

14

Weighted Adjacency Propagation (WAP) problem

Models FRP on the formula’s Primal Graph

• project variables ⇒ remove vertices : X

• add back a new constraint ⇒ add a clique on these vertices’

neighborhood : NG (X ).

• time/memory ⇒ cost function 2|NG (X )|.

WAP is strongly related to tree-decomposition, tree-width and chordal

completion.

Heuristic

• Quotient the graph by true-twins

• vertices are weighted

• single vertex selection

• Select a vertex with lightest neighborhood.

15

Weighted Adjacency Propagation (WAP) problem

Models FRP on the formula’s Primal Graph

• project variables ⇒ remove vertices : X

• add back a new constraint ⇒ add a clique on these vertices’

neighborhood : NG (X ).

• time/memory ⇒ cost function 2|NG (X )|.

WAP is strongly related to tree-decomposition, tree-width and chordal

completion.

Heuristic

• Quotient the graph by true-twins

• vertices are weighted

• single vertex selection

• Select a vertex with lightest neighborhood.

15

Weighted Adjacency Propagation (WAP) problem

Models FRP on the formula’s Primal Graph

• project variables ⇒ remove vertices : X

• add back a new constraint ⇒ add a clique on these vertices’

neighborhood : NG (X ).

• time/memory ⇒ cost function 2|NG (X )|.

WAP is strongly related to tree-decomposition, tree-width and chordal

completion.

Heuristic

• Quotient the graph by true-twins

• vertices are weighted

• single vertex selection

• Select a vertex with lightest neighborhood.

15

Preliminary Experimental Results : SAT competition 2018

mchess n : UNSAT

n |X | |C | BLOCK CADICAL RBTF

15 420 1391 31 140s 4s

16 480 1596 32 2m24s 4s

17 544 1815 34 67m34s 21s

18 612 2048 39 10m28s 26s

19 684 2295 41 8h43m 36s

20 760 2556 47 8h31m 2m30s

where BLOCK : number of variable in the biggest sub-problem.

otherwise : timeout or memout for RBTF.

conclusion : failure if BLOCK > 40-50 variables

future work : structural analysis and underlying representation

16

Preliminary Experimental Results : SAT competition 2018

mchess n : UNSAT

n |X | |C | BLOCK CADICAL RBTF

15 420 1391 31 140s 4s

16 480 1596 32 2m24s 4s

17 544 1815 34 67m34s 21s

18 612 2048 39 10m28s 26s

19 684 2295 41 8h43m 36s

20 760 2556 47 8h31m 2m30s

where BLOCK : number of variable in the biggest sub-problem.

otherwise : timeout or memout for RBTF.

conclusion : failure if BLOCK > 40-50 variables

future work : structural analysis and underlying representation

16

Conclusion on RBTF

Reduction Process : φFRP−−→ weak-RBTF

BPP−−−→ RBTF

• generic

• compatible with symbolic representation

• preserves and exploit tree-like structures

• encouraging preliminary experimental results

Limitations (Orthogonal Future Work)

• structural analysis : WAP

• underlying representation : λDD5

Future Work

• implement cascading RBTF (compilation of Quantified Formulae)

• unit propagation, reset, multi-layer analysis, parallelism

• co-design with a solver5J. Thibault and K. Ghorbal, Functional Decision Diagrams: A Unifying Data

Structure For Binary Decision Diagrams17

Contraint Propagation

Basic PropertiesFor any formula φ(X,Y) where X and Y are disjoint sets of variables.

• φ(X,Y) ⇐⇒ ∃X, φ(X,Y)

• φ(X,Y) ≡ φ(X,Y) ∧ ∃X, φ(X,Y)

• φ(X,Y) = C1(X,Y) ∧ · · · ∧ Ck(X,Y)︸ ︷︷ ︸=φX(X,Y)

∧D1(Y) ∧ · · · ∧ Dk′(Y)︸ ︷︷ ︸=φ\X(Y)

.

Variable Set Elimination

• φ(X,Y) = φX(X,Y)︸ ︷︷ ︸≡φX(X,Y)∧∃X,φX(X,Y)

∧φ\X(Y)

• φ(X,Y) ≡ φX(X,Y) ∧ (

=D0(Y)︷ ︸︸ ︷(∃X, φX(X,Y))∧φ\X(Y))︸ ︷︷ ︸

= φ(X)(Y)

≡ ∃X, φ(X,Y)

18

Contraint Propagation

Basic PropertiesFor any formula φ(X,Y) where X and Y are disjoint sets of variables.

• φ(X,Y) ⇐⇒ ∃X, φ(X,Y)

• φ(X,Y) ≡ φ(X,Y) ∧ ∃X, φ(X,Y)

• φ(X,Y) = C1(X,Y) ∧ · · · ∧ Ck(X,Y)︸ ︷︷ ︸=φX(X,Y)

∧D1(Y) ∧ · · · ∧ Dk′(Y)︸ ︷︷ ︸=φ\X(Y)

.

Variable Set Elimination

• φ(X,Y) = φX(X,Y)︸ ︷︷ ︸≡φX(X,Y)∧∃X,φX(X,Y)

∧φ\X(Y)

• φ(X,Y) ≡ φX(X,Y) ∧ (

=D0(Y)︷ ︸︸ ︷(∃X, φX(X,Y))∧φ\X(Y))︸ ︷︷ ︸

= φ(X)(Y)

≡ ∃X, φ(X,Y)

18

Contraint Propagation

Basic PropertiesFor any formula φ(X,Y) where X and Y are disjoint sets of variables.

• φ(X,Y) ⇐⇒ ∃X, φ(X,Y)

• φ(X,Y) ≡ φ(X,Y) ∧ ∃X, φ(X,Y)

• φ(X,Y) = C1(X,Y) ∧ · · · ∧ Ck(X,Y)︸ ︷︷ ︸=φX(X,Y)

∧D1(Y) ∧ · · · ∧ Dk′(Y)︸ ︷︷ ︸=φ\X(Y)

.

Variable Set Elimination

• φ(X,Y) = φX(X,Y)︸ ︷︷ ︸≡φX(X,Y)∧∃X,φX(X,Y)

∧φ\X(Y)

• φ(X,Y) ≡ φX(X,Y) ∧ (

=D0(Y)︷ ︸︸ ︷(∃X, φX(X,Y))∧φ\X(Y))︸ ︷︷ ︸

= φ(X)(Y)

≡ ∃X, φ(X,Y)

18

Contraint Propagation

Basic PropertiesFor any formula φ(X,Y) where X and Y are disjoint sets of variables.

• φ(X,Y) ⇐⇒ ∃X, φ(X,Y)

• φ(X,Y) ≡ φ(X,Y) ∧ ∃X, φ(X,Y)

• φ(X,Y) = C1(X,Y) ∧ · · · ∧ Ck(X,Y)︸ ︷︷ ︸=φX(X,Y)

∧D1(Y) ∧ · · · ∧ Dk′(Y)︸ ︷︷ ︸=φ\X(Y)

.

Variable Set Elimination

• φ(X,Y) = φX(X,Y)︸ ︷︷ ︸≡φX(X,Y)∧∃X,φX(X,Y)

∧φ\X(Y)

• φ(X,Y) ≡ φX(X,Y) ∧ (

=D0(Y)︷ ︸︸ ︷(∃X, φX(X,Y))∧φ\X(Y))︸ ︷︷ ︸

= φ(X)(Y)

≡ ∃X, φ(X,Y)

18

Contraint Propagation

Basic PropertiesFor any formula φ(X,Y) where X and Y are disjoint sets of variables.

• φ(X,Y) ⇐⇒ ∃X, φ(X,Y)

• φ(X,Y) ≡ φ(X,Y) ∧ ∃X, φ(X,Y)

• φ(X,Y) = C1(X,Y) ∧ · · · ∧ Ck(X,Y)︸ ︷︷ ︸=φX(X,Y)

∧D1(Y) ∧ · · · ∧ Dk′(Y)︸ ︷︷ ︸=φ\X(Y)

.

Variable Set Elimination

• φ(X,Y) = φX(X,Y)︸ ︷︷ ︸≡φX(X,Y)∧∃X,φX(X,Y)

∧φ\X(Y)

• φ(X,Y) ≡ φX(X,Y) ∧ (

=D0(Y)︷ ︸︸ ︷(∃X, φX(X,Y))∧φ\X(Y))︸ ︷︷ ︸

= φ(X)(Y)

≡ ∃X, φ(X,Y)18

Weighted Adjacency Propagation (WAP) : Definition

• S(G ,X) := (V ′,E ′) with :

• V ′ := V \X• E ′ :=

(E⋃

NG (X)2)⋂

V ′2

• Sc(G ,X) := 2|NG (X)|

• S(G ,X0, . . . ,Xk) = S(S(G ,X0),X1, . . . ,Xk)

• Sc(G ,X0, . . . ,Xk) = Sc(G ,X0) + Sc(S(G ,X0),X1, . . . ,Xk)

• Goal : find a partition (Xi )i of G .V such that Sc(G , (Xi)i ) is

minimal.

19

Weighted Adjacency Propagation (WAP) : Definition

• S(G ,X) := (V ′,E ′) with :

• V ′ := V \X• E ′ :=

(E⋃

NG (X)2)⋂

V ′2

• Sc(G ,X) := 2|NG (X)|

• S(G ,X0, . . . ,Xk) = S(S(G ,X0),X1, . . . ,Xk)

• Sc(G ,X0, . . . ,Xk) = Sc(G ,X0) + Sc(S(G ,X0),X1, . . . ,Xk)

• Goal : find a partition (Xi )i of G .V such that Sc(G , (Xi)i ) is

minimal.

19

Weighted Adjacency Propagation (WAP) : Definition

• S(G ,X) := (V ′,E ′) with :

• V ′ := V \X• E ′ :=

(E⋃

NG (X)2)⋂

V ′2

• Sc(G ,X) := 2|NG (X)|

• S(G ,X0, . . . ,Xk) = S(S(G ,X0),X1, . . . ,Xk)

• Sc(G ,X0, . . . ,Xk) = Sc(G ,X0) + Sc(S(G ,X0),X1, . . . ,Xk)

• Goal : find a partition (Xi )i of G .V such that Sc(G , (Xi)i ) is

minimal.

19

Weighted Adjacency Propagation (WAP) : Definition

• S(G ,X) := (V ′,E ′) with :

• V ′ := V \X• E ′ :=

(E⋃

NG (X)2)⋂

V ′2

• Sc(G ,X) := 2|NG (X)|

• S(G ,X0, . . . ,Xk) = S(S(G ,X0),X1, . . . ,Xk)

• Sc(G ,X0, . . . ,Xk) = Sc(G ,X0) + Sc(S(G ,X0),X1, . . . ,Xk)

• Goal : find a partition (Xi )i of G .V such that Sc(G , (Xi)i ) is

minimal.

19

Weighted Adjacency Propagation (WAP) : Definition

• S(G ,X) := (V ′,E ′) with :

• V ′ := V \X• E ′ :=

(E⋃

NG (X)2)⋂

V ′2

• Sc(G ,X) := 2|NG (X)|

• S(G ,X0, . . . ,Xk) = S(S(G ,X0),X1, . . . ,Xk)

• Sc(G ,X0, . . . ,Xk) = Sc(G ,X0) + Sc(S(G ,X0),X1, . . . ,Xk)

• Goal : find a partition (Xi )i of G .V such that Sc(G , (Xi)i ) is

minimal.

19

Known Properties

• Adding unerasable vertices allows to solve parametrized problem

(e.g., QBF and parametrized argmax).

• WAP to H-WAP reduction

• vertices are weighted (1 by default).

• ω(X) :=∑x∈X

ω(x)

• Sc(G ,X) := 2ω(NG (X)).

• true-twins vertices are merged.

• two vertices x and y are said true-twins iff NG (x) = NG (y)

• only one vertex is erased at a time

• optimal elimination of pendant H-vertices

• optimal elimination of H-trees

• H-Simplicial Elimination

• Similarity with treewidth (TW)

• Clique Seperators are WAP-Separators

20

top related