on the quest for an acyclic graph
play

On the Quest for an Acyclic Graph s Janota 1 Radu Grigore 2 Vasco - PowerPoint PPT Presentation

On the Quest for an Acyclic Graph s Janota 1 Radu Grigore 2 Vasco Manquinho 1 Mikol a RCRA 2017, Bari 1 INESC-ID/IST, University of Lisbon, Portugal 2 School of Computing, University of Kent, UK Janota et al On the Quest for an Acyclic


  1. On the Quest for an Acyclic Graph s Janota 1 Radu Grigore 2 Vasco Manquinho 1 Mikol´ aˇ RCRA 2017, Bari 1 INESC-ID/IST, University of Lisbon, Portugal 2 School of Computing, University of Kent, UK Janota et al On the Quest for an Acyclic Graph 1 / 16

  2. Introduction • We wish to reason over directed graphs in SAT/QBF/SMT. Janota et al On the Quest for an Acyclic Graph 2 / 16

  3. Introduction • We wish to reason over directed graphs in SAT/QBF/SMT. • Each graph corresponds to a binary relation. Janota et al On the Quest for an Acyclic Graph 2 / 16

  4. Introduction • We wish to reason over directed graphs in SAT/QBF/SMT. • Each graph corresponds to a binary relation. • Graphs are model with Boolean variables representing edges. Janota et al On the Quest for an Acyclic Graph 2 / 16

  5. Introduction • We wish to reason over directed graphs in SAT/QBF/SMT. • Each graph corresponds to a binary relation. • Graphs are model with Boolean variables representing edges. • A variable e ij is true iff there is an edge from i to j in the considered graph. Janota et al On the Quest for an Acyclic Graph 2 / 16

  6. Introduction • We wish to reason over directed graphs in SAT/QBF/SMT. • Each graph corresponds to a binary relation. • Graphs are model with Boolean variables representing edges. • A variable e ij is true iff there is an edge from i to j in the considered graph. Example ( e 12 ∨ e 13 ) ∧ ( ¬ e 12 ∨ ¬ e 13 ) ∧ e 23 ∧ ¬ e 32 ∧ ¬ e 21 2 3 2 3 2 3 2 3 1 1 1 1 Janota et al On the Quest for an Acyclic Graph 2 / 16

  7. Objective: Avoid Cycles • Given a formula ϕ determining a set of graphs generate a formula ϕ ′ that only considers those of in ϕ but with no cycles. Janota et al On the Quest for an Acyclic Graph 3 / 16

  8. Objective: Avoid Cycles • Given a formula ϕ determining a set of graphs generate a formula ϕ ′ that only considers those of in ϕ but with no cycles. • Modular approach: devise a checker formula ψ s.t. ϕ ′ = ϕ ∧ ψ . Janota et al On the Quest for an Acyclic Graph 3 / 16

  9. Example: Memory Models s t a r t s t a t e : r1=r2=x=y=0 thread 1: x := 1 r1 := y thread 2: y := 1 r0 := x • Question: Is state r1=r2=0 possible at the end? Janota et al On the Quest for an Acyclic Graph 4 / 16

  10. Example: Memory Models s t a r t s t a t e : r1=r2=x=y=0 thread 1: x := 1 r1 := y thread 2: y := 1 r0 := x • Question: Is state r1=r2=0 possible at the end? • Answer: NO with interleavings, but YES with many relaxed/weak memory models. Janota et al On the Quest for an Acyclic Graph 4 / 16

  11. Example: Memory Models s t a r t s t a t e : r1=r2=x=y=0 thread 1: x := 1 r1 := y thread 2: y := 1 r0 := x • Question: Is state r1=r2=0 possible at the end? • Answer: NO with interleavings, but YES with many relaxed/weak memory models. • We are using a QBF solver in this application, acyclic relations are required. Janota et al On the Quest for an Acyclic Graph 4 / 16

  12. Example: No-Sink Family • A well-ordered set must have a greatest element. Janota et al On the Quest for an Acyclic Graph 5 / 16

  13. Example: No-Sink Family • A well-ordered set must have a greatest element. • If each node as at least one outgoing edge, there must be a cycle. Janota et al On the Quest for an Acyclic Graph 5 / 16

  14. Example: No-Sink Family • A well-ordered set must have a greatest element. • If each node as at least one outgoing edge, there must be a cycle. • Together with acyclicity, the following is UNSAT: � � e ij i ∈ [ n ] j ∈ [ n ] Janota et al On the Quest for an Acyclic Graph 5 / 16

  15. Example: The Supervisor Problem • Consider n employees; Janota et al On the Quest for an Acyclic Graph 6 / 16

  16. Example: The Supervisor Problem • Consider n employees; • . . . employee i can supervise at most u i other employees; Janota et al On the Quest for an Acyclic Graph 6 / 16

  17. Example: The Supervisor Problem • Consider n employees; • . . . employee i can supervise at most u i other employees; • . . . employee i is supervised by at least l i other employees; Janota et al On the Quest for an Acyclic Graph 6 / 16

  18. Example: The Supervisor Problem • Consider n employees; • . . . employee i can supervise at most u i other employees; • . . . employee i is supervised by at least l i other employees; • . . . there may be no cycles in the supervision relation. Janota et al On the Quest for an Acyclic Graph 6 / 16

  19. Example: The Supervisor Problem • Consider n employees; • . . . employee i can supervise at most u i other employees; • . . . employee i is supervised by at least l i other employees; • . . . there may be no cycles in the supervision relation. • NP-complete [Hartung and Nichterlein, 2015] Janota et al On the Quest for an Acyclic Graph 6 / 16

  20. Example: The Supervisor Problem • Consider n employees; • . . . employee i can supervise at most u i other employees; • . . . employee i is supervised by at least l i other employees; • . . . there may be no cycles in the supervision relation. • NP-complete [Hartung and Nichterlein, 2015] • Note: no-sink is special case. There is no solution if everyone is to have at least one supervisor. Janota et al On the Quest for an Acyclic Graph 6 / 16

  21. Encoding: Transitive Closure • Idea: Generate a transitive closure of the edge relation and disable self-loops. Janota et al On the Quest for an Acyclic Graph 7 / 16

  22. Encoding: Transitive Closure • Idea: Generate a transitive closure of the edge relation and disable self-loops. • Transitive closure I � � � ψ n ( � e , � y ) := ¬ y ii ∧ ( y ij ∧ y jk ⇒ y ik ) ∧ ( e ij ⇒ y ij ) i ∈ [ n ] i , j , k ∈ [ n ] i , j ∈ [ n ] Janota et al On the Quest for an Acyclic Graph 7 / 16

  23. Encoding: Transitive Closure • Idea: Generate a transitive closure of the edge relation and disable self-loops. • Transitive closure I � � � ψ n ( � e , � y ) := ¬ y ii ∧ ( y ij ∧ y jk ⇒ y ik ) ∧ ( e ij ⇒ y ij ) i ∈ [ n ] i , j , k ∈ [ n ] i , j ∈ [ n ] • Transitive closure II � � � ψ n ( � e , � y ) := ¬ y ii ∧ ( y ij ∧ e jk ⇒ y ik ) ∧ ( e ij ⇒ y ij ) i ∈ [ n ] i , j , k ∈ [ n ] i , j ∈ [ n ] Janota et al On the Quest for an Acyclic Graph 7 / 16

  24. Encoding: Unary/Binary labeling • Idea: Any DAG can be topologically sorted. Janota et al On the Quest for an Acyclic Graph 8 / 16

  25. Encoding: Unary/Binary labeling • Idea: Any DAG can be topologically sorted. • Label each node with a number l ∈ 1 .. | V | such that it is connected only to nodes with a greater label. � � � ψ n ( � e , � y 1 , . . . , � y n ) := e ij ⇒ less( � y i , � y j ) i , j ∈ [ n ] Janota et al On the Quest for an Acyclic Graph 8 / 16

  26. Encoding: Unary/Binary labeling (Cont.) • Comparison for binary encoding ( n ⌈ log 2 n ⌉ variables). lex 0 () := 0 � � lex b ( � zz ) := ( ¬ y ∧ z ) ∨ ( ¬ y ∨ z ) ∧ lex b − 1 ( � z ) yy , � y , � Janota et al On the Quest for an Acyclic Graph 9 / 16

  27. Encoding: Unary/Binary labeling (Cont.) • Comparison for binary encoding ( n ⌈ log 2 n ⌉ variables). lex 0 () := 0 � � lex b ( � zz ) := ( ¬ y ∧ z ) ∨ ( ¬ y ∨ z ) ∧ lex b − 1 ( � z ) yy , � y , � • Comparison for unary encoding ( n 2 variables): n − 1 n − 1 � � � � lessunr( � y , � z , � u ) := ( ¬ y i ∨ ¬ u i ) ∧ ( z i ∨ ¬ u i ) ∧ u i i =1 i =1 n − 1 � unary( � y ) := ( y i − 1 ⇒ y i ) i =2 Janota et al On the Quest for an Acyclic Graph 9 / 16

  28. Encoding: Warshall algorithm Based Idea: Perform an “unrolling” of the Floyd-Warshall. Warshall 1 for k ∈ [ n ] 2 for i ∈ [ n ] 3 for j ∈ [ n ] 4 a ij := Or( a ij , And( a ik , a kj )) Janota et al On the Quest for an Acyclic Graph 10 / 16

  29. Encoding: Warshall algorithm Based Idea: Perform an “unrolling” of the Floyd-Warshall. Warshall 1 for k ∈ [ n ] 2 for i ∈ [ n ] 3 for j ∈ [ n ] 4 a ij := Or( a ij , And( a ik , a kj )) � � � ψ n ( � y ) := ¬ y iin ∧ ( x ij ⇒ y ij 0 ) ∧ ( y ij ( k − 1) ⇒ y ijk ) x , � i ∈ [ n ] i , j ∈ [ n ] i , j , k ∈ [ n ] � ∧ ( y ik ( k − 1) ∧ y kj ( k − 1) ⇒ y ijk ) i , j , k ∈ [ n ] Janota et al On the Quest for an Acyclic Graph 10 / 16

  30. Encoding: Matrix Multiplication • Idea: Simulate matrix multiplication Janota et al On the Quest for an Acyclic Graph 11 / 16

  31. Encoding: Matrix Multiplication • Idea: Simulate matrix multiplication • Strassen algorithm permits less than cubic multiplication Janota et al On the Quest for an Acyclic Graph 11 / 16

  32. Encoding: Matrix Multiplication • Idea: Simulate matrix multiplication • Strassen algorithm permits less than cubic multiplication • Hard to efficiently encode into circuits. Janota et al On the Quest for an Acyclic Graph 11 / 16

  33. Sizes of Encodings 10 9 acyclicity checker formula size tc1 10 8 tc2 bin 10 7 unr 10 6 fw mm 10 5 ss 10 4 10 3 10 2 10 1 10 0 1 10 100 graph vertex count Janota et al On the Quest for an Acyclic Graph 12 / 16

Recommend


More recommend