TouIST: a friendly language for propositional logic and more Application to planning with SAT or QBF solvers Frédéric Maris Joint work with Olivier Gasquet, Dominique Longin and Maël Valais December 18 th , 2019 IRIT – University of Toulouse (France) 1/35
TouIST
Motivation for a new tool Remark 1 : existing languages are not intuitive SAT solvers are very efficient but with a « low level » input language Formula Solver input (DIMACS) p cnf 5 4 -1 5 3 0 a → -1 -5 4 1 0 b ∨ ¬ ( a → c ) -1 -5 4 -2 0 ∨ ( c → ¬ a ) -1 -3 -2 -1 0 2/35
Motivation for a new tool Remark 2 : existing languages are not compact SMT-LIB is much more expressive than DIMACS but with a lack of compacity Formula SMT-LIB example (assert (and x1 (and x2 (and x3 � x i (and x4 i ∈ [ 1 .. 1000 ] (and x5 (and x6 ... x1000 ))))))) 3/35
Motivation for a new tool Technical goal : an intuitive language for modeling, well documented a user-friendly graphical interface Academic goal : teaching of logic research (comparison of solvers, encodings) 4/35
Motivation for a new tool History : Date Version Features 2010 SAToulouse SAT (integrated) mid 2015 TouIST 1.0 SAT end of 2016 TouIST 2.0 SAT, SMT mid 2017 TouIST 3.0 SAT, SMT, QBF 5/35
Implementation aspects TouIST (Toulouse Integrated Satisfiability Tool) Graphical interface for writing logical formulas in a compact language and using different external solvers . • under MIT license, sources : github.com/touist/touist • graphical interface ( Java ) • translation to solver languages by a compiler ( OCaml ) • compatible with SAT, SMT and QBF 6/35
Implementation aspects Choosing the solver on the fly TouIST allows one to choose the solver to target. The input language adapts to each solver. 7/35
Implementation aspects Compatible solvers : Solver Formula TouIST input language SAT a ∧ b → c a and b => c SMT (QF-LIA) ( x + y − z ≥ 4 ) ∨ b (x + y - z >= 4) or a SMT (QF-LRA) ( x + y − z > 4 . 0 ) → c (x + y - z > 4.0) => c SMT (QF-IDL) ( x − y > 2 ) ∧ c (x - y > 2) and c SMT (QF-RDL) ( x − y > 1 . 0 ) ∧ c (x - y > 1.0) and c QBF ∀ b . a ∧ b forall b: a and b QF-LIA = Quantifier-Free Linear Integer Arithmetic QF-LRA = Quantifier-Free Linear Real Arithmetic QF-IDL = Quantifier-Free Integer Difference Logic QF-RDL = Quantifier-Free Real Difference Logic 8/35
Implementation aspects TouIST input language : • variables and sets $N = 5 $Rows = [1..$N] $Countries = [France, Italy, Spain] • generalized connectors in(France) and in(Italy) and in(Spain) bigand $c in $Countries: en($c) end 9/35
Application to planning
Classical Planning Problem A planning problem is a tuple Π = � F , O , I , G � : • F is a set of fluents (atomic propositions) • O is a set of actions • I is the set of fluents in initial state • G is the set of required fluents to achieve the goal An action is a tuple a = � Cond ( a ) , Add ( a ) , Del ( a ) � : • Cond ( a ) is the set of fluents required to execute a • Add ( a ) is a set of fluents added by the execution of a • Del ( a ) is a set of fluents deleted by the execution of a 10/35
� � � � � Algorithms for plan synthesis (state-spaces) A : a → + b B : a → + c – a C : b c → + d ✄ � a ✂ ✁ A B ✞ ☎ ✄ � a b c ✝ ✆ ✂ ✁ A B ✞ ☎ ✞ ☎ a b b c ✝ ✆ ✝ ✆ C ✞ ☎ b c d ✝ ✆ 11/35
SAT Encodings for Classical Planning Several different encoding have been proposed : • State spaces encodings [Kautz and Selman, 1992], [Rintanen et al., 2006], [Rintanen, 2012] • Plan spaces encodings ([Mali and Kambhampati, 1999]) • Planning graph encodings [Kautz and Selman, 1999], [Robinson et al., 2008], [Robinson et al., 2009] In the sequel, we present the state spaces encoding with explanatory frame-axioms [Kautz and Selman, 1992]. 12/35
SAT Encodings for Classical Planning S 0 ( Init ) ◮ x 1 ≡ S 1 ◮ x 2 ≡ S 2 ◮ x 3 ≡ S 3 ◮ x 4 ≡ S 4 ◮ x 5 ≡ S 5 ◮ x 6 ≡ S 6 ◮ x 7 ≡ S 7 ◮ S 8 ( Goal ) Figure 1 – Transitions of an 8-step plan in SAT/SMT encoding Each step i is associated with : • a set of propositional variables for actions { a 1 i , a 2 i . . . , a m i } • a set of propositional variables for fluents { f 1 i , f 2 i , . . . , f n i } 13/35
SAT Encoding : Initial State and Goal Initial state : � f 0 f ∈ I � ¬ f 0 f ∈ F \ I Goal : � f length f ∈ G 14/35
SAT Encoding : Conditions and Effects of Actions � � � ∧ � ∧ � a i ⇒ f i − 1 f i ( ¬ f i ) a ∈ O i ∈ [ 1 .. length ] f ∈ Cond a f ∈ Add a f ∈ Del a 15/35
SAT Encoding : Explanatory Frame-Axioms � � � ( ¬ f i − 1 ∧ f i ) ⇒ a i f ∈ F a ∈ O i ∈ [ 1 .. length ] f ∈ Add a � � � ( f i − 1 ∧ ¬ f i ) ⇒ a i i ∈ [ 1 .. length ] f ∈ F a ∈ O f ∈ Del a 16/35
SAT Encoding : Negative Interactions (Mutex) � � � � ( ¬ a1 i ∨ ¬ a2 i ) i ∈ [ 1 .. length ] a1 ∈ O f ∈ Cond a1 a2 ∈ O ( a1 � = a2 ) ( f ∈ Del a2 ) goal ¬ r r p condition for blue goal Unexpected p behaviour! removed by red ¬ p 17/35
SAT Encodings for Classical Planning Several different encoding have been proposed : • State spaces encodings [Kautz and Selman, 1992], [Rintanen et al., 2006], [Rintanen, 2012] • Plan spaces encodings ([Mali and Kambhampati, 1999]) • Planning graph encodings [Kautz and Selman, 1999], [Robinson et al., 2008], [Robinson et al., 2009] We propose a new encoding based on open conditions . 18/35
SAT Encodings for Classical Planning S 0 ( Init ) ◮ x 1 ≡ S 1 ◮ x 2 ≡ S 2 ◮ x 3 ≡ S 3 ◮ x 4 ≡ S 4 ◮ x 5 ≡ S 5 ◮ x 6 ≡ S 6 ◮ x 7 ≡ S 7 ◮ S 8 ( Goal ) Figure 2 – Transitions of an 8-steps plan in SAT/SMT encoding Each step i is associated with : • a set of propositional variables for actions { a 1 i , a 2 i . . . , a m i } • a set of propositional variables for open conditions { open f 1 , i , open f 2 , i , . . . , open f n , i } 19/35
SAT Encoding : open conditions. . . � � � A i ⇒ open f , i i ∈ [ 1 .. length ] A ∈ O f ∈ Cond A � � open f , length ∨ A length f ∈ G A ∈ O f ∈ Add A 20/35
SAT Encoding : . . . then propagate or close � ¬ open f , 1 f ∈ F \ I � � � open f , i ⇒ open f , i − 1 ∨ A i − 1 A ∈ O i ∈ [ 2 .. length ] f ∈ F f ∈ Add A S i − k S i − 1 S i a ′ a propagate open f open f open f f ∈ Add ( a ′ ) f ∈ Cond ( a ) Figure 3 – Causal link : action a ′ produces f at step S i − k for action a which requires f at step S i . 21/35
SAT Encoding : protect open conditions and prevent negative interactions (mutex) � � � open f , i ⇒ ¬ A i − 1 i ∈ [ 2 .. length ] f ∈ F A ∈ O f ∈ Del A � � � � ( ¬ A i ∨ ¬ B i ) i ∈ [ 1 .. length ] A ∈ O f ∈ ( Add A ∪ Cond A ) B ∈ O A � = B ∧ f ∈ Del B 22/35
QBF Classical Planning Transition to QBF quantifiers over Propositional logic propositions + ¬ ∨ ∧ → ∀ ∃ QBF = Propositional logic X 0 X 1 two states = two different sets of variables QBF ∀ b two different contexts sharing the same set of variables X 0 X 0 less memory used 23/35
QBF Encodings for Classical Planning Different encodings have been proposed : • Flat Encoding [Rintanen, 2001], [Cashmore, 2013] • Compact Tree Encoding (CTE) [Cashmore et al., 2012] We propose a new CTE based on open conditions . 24/35
� � � � � � QBF Compact Tree Encoding (CTE) (a) S 0 ( Init ) ◮ x 1 ≡ S 1 ◮ x 2 ≡ S 2 ◮ x 3 ≡ S 3 ◮ x 4 ≡ S 4 ◮ x 5 ≡ S 5 ◮ x 6 ≡ S 6 ◮ x 7 ≡ S 7 ◮ S 8 ( Goal ) (b) x 2 ≡ S 4 x ′ x 1 ≡ S 2 1 ≡ S 6 x ′ x ′′ x ′′′ S 0 ( Init ) ◮ x 0 ≡ S 1 0 ≡ S 3 0 ≡ S 5 ≡ S 7 ◮ S 8 ( Goal ) 0 Figure 4 – Transitions of an 8-steps plan in (a) SAT encoding and (b) QBF compact tree encoding (CTE) 25/35
� � QBF Compact Tree Encoding (CTE) x i b i = ⊥ b i = ⊤ x i − 1 x i − 1 b i − 1 = ⊤ b i − 1 = ⊥ b i − 1 = ⊥ b i − 1 = ⊤ x i − 2 x i − 2 b i − 2 = ⊥ b i − 2 = ⊤ b { i − 2 ,..., 1 } = ⊤ b { i − 2 ,..., 1 } = ⊥ x 0 x 0 Figure 5 – Both possible transitions in a CTE following the branching structure of a QBF : X 0 → X i (from leaf to node on the left) and X i → X 0 (from node to leaf on the right). Note that i refers to any level (except for the leaf layer), not only the root. 26/35
QBF Encoding : quantifiers open f , k . ∀ b k . ∃ ∃ A k . ∃ A k − 1 . ∃ open f , k − 1 . ∀ b k − 1 . A ∈ O f ∈ F A ∈ O f ∈ F . . . ∃ open f , 1 . ∀ b 1 . ∃ A 1 . ∃ A 0 . ∃ open f , 0 . A ∈ O f ∈ F A ∈ O f ∈ F 27/35
Recommend
More recommend