Congruence Closure with Free Variables Haniel Pascal Andrew Barbosa 1 Fontaine 1 Reynolds 2 1 University of Lorraine, CNRS, Inria, LORIA, Nancy, France 2 University of Iowa, Iowa City, U.S.A. SMT 2017 2017–07–22, Heidelberg, Germany Congruence Closure with Free Variables (CCFV) 1 / 18
SMT solvers are successfully used in a variety of applications, including many verification tools Program Formal Analysis Methods Logics Automatic Program Testing Synthesis Picture credit: Vijay Ganesh Congruence Closure with Free Variables (CCFV) 2 / 18
SMT solvers are successfully used in a variety of applications, including many verification tools Program Formal Analysis Methods SAT Solvers Automatic Program Testing Synthesis Picture credit: Vijay Ganesh Congruence Closure with Free Variables (CCFV) 2 / 18
SMT solvers are successfully used in a variety of applications, including many verification tools Program Formal Analysis Methods SMT Solvers Automatic Program Testing Synthesis Picture credit: Vijay Ganesh Congruence Closure with Free Variables (CCFV) 2 / 18
SMT solvers are successfully used in a variety of applications, including many verification tools Program Formal Analysis Methods SMT Solvers with Quantifjers Automatic Program Testing Synthesis Picture credit: Vijay Ganesh Congruence Closure with Free Variables (CCFV) 2 / 18
Quantifiers in SMT solvers Quantifiers primarily handled with heuristic instantiation Congruence Closure with Free Variables (CCFV) 3 / 18
Quantifiers in SMT solvers Quantifiers primarily handled with heuristic instantiation ⊖ Too many instances swamp solver Congruence Closure with Free Variables (CCFV) 3 / 18
Quantifiers in SMT solvers Quantifiers primarily handled with heuristic instantiation ⊖ Too many instances swamp solver Ex.: ∀ xyz. f ( x ) ≃ f ( z ) → h ( y ) ≃ g ( z ) ◮ Select patterns { f ( x ) , h ( y ) , f ( z ) } or { f ( x ) , h ( y ) , g ( z ) } Congruence Closure with Free Variables (CCFV) 3 / 18
Quantifiers in SMT solvers Quantifiers primarily handled with heuristic instantiation ⊖ Too many instances swamp solver Ex.: ∀ xyz. f ( x ) ≃ f ( z ) → h ( y ) ≃ g ( z ) ◮ Select patterns { f ( x ) , h ( y ) , f ( z ) } or { f ( x ) , h ( y ) , g ( z ) } ◮ A ground model with 10 2 ground each applications for f, g, h leads to up to 10 6 instantiations Congruence Closure with Free Variables (CCFV) 3 / 18
Quantifiers in SMT solvers Quantifiers primarily handled with heuristic instantiation ⊖ Too many instances swamp solver ⊖ Butterfly effect Ex.: ∀ xyz. f ( x ) ≃ f ( z ) → h ( y ) ≃ g ( z ) ◮ Select patterns { f ( x ) , h ( y ) , f ( z ) } or { f ( x ) , h ( y ) , g ( z ) } ◮ A ground model with 10 2 ground each applications for f, g, h leads to up to 10 6 instantiations Congruence Closure with Free Variables (CCFV) 3 / 18
Quantifiers in SMT solvers Quantifiers primarily handled with heuristic instantiation Fast semantically guided instantiation techniques ⊖ Too many instances swamp solver Fewer, necessary instances ⊖ Butterfly effect Reduce dependency on heuristics Ex.: ∀ xyz. f ( x ) ≃ f ( z ) → h ( y ) ≃ g ( z ) ◮ Select patterns { f ( x ) , h ( y ) , f ( z ) } or { f ( x ) , h ( y ) , g ( z ) } ◮ A ground model with 10 2 ground each applications for f, g, h leads to up to 10 6 instantiations ◮ Derive instantiations that refute ground model Congruence Closure with Free Variables (CCFV) 3 / 18
Problem statement SMT formula SMT solver Quanti fi er-free SMT solver Con fl ict clause Theory SAT solver reasoner Boolean Model ⊲ Quantifier-free solver enumerates models E ∪ Q ◮ E is a conjunctive set of ground literals ◮ Q is a conjunctive set of quantified clauses Congruence Closure with Free Variables (CCFV) 4 / 18
Problem statement SMT formula SMT solver Quanti fi er-free SMT solver Instance Con fl ict clause Instantiation Theory module SAT solver reasoner Model Boolean Model UNSAT (proof/core) Model ⊲ Quantifier-free solver enumerates models E ∪ Q ◮ E is a conjunctive set of ground literals ◮ Q is a conjunctive set of quantified clauses ⊲ Instantiation module generates instances from Q and adds them to E Congruence Closure with Free Variables (CCFV) 4 / 18
Heuristic instantiation Pattern-matching of terms from Q into terms of E No consistency check of E ∪ Q ⊖ Fast, but too many instances Congruence Closure with Free Variables (CCFV) 5 / 18
Heuristic instantiation Pattern-matching of terms from Q into terms of E No consistency check of E ∪ Q ⊖ Fast, but too many instances Easily gets out of hand! Instantiation module E Congruence Closure with Free Variables (CCFV) 5 / 18
Heuristic instantiation Pattern-matching of terms from Q into terms of E No consistency check of E ∪ Q ⊖ Fast, but too many instances Easily gets out of hand! Instantiation module E Congruence Closure with Free Variables (CCFV) 5 / 18
Heuristic instantiation Pattern-matching of terms from Q into terms of E No consistency check of E ∪ Q ⊖ Fast, but too many instances Easily gets out of hand! Instantiation module E Congruence Closure with Free Variables (CCFV) 5 / 18
Heuristic instantiation Pattern-matching of terms from Q into terms of E No consistency check of E ∪ Q ⊖ Fast, but too many instances Easily gets out of hand! Instantiation module E Congruence Closure with Free Variables (CCFV) 5 / 18
Heuristic instantiation Pattern-matching of terms from Q into terms of E No consistency check of E ∪ Q ⊖ Fast, but too many instances Easily gets out of hand! Instantiation module E Congruence Closure with Free Variables (CCFV) 5 / 18
Heuristic instantiation Pattern-matching of terms from Q into terms of E No consistency check of E ∪ Q ⊖ Fast, but too many instances Easily gets out of hand! Instantiation module E Congruence Closure with Free Variables (CCFV) 5 / 18
Goal-oriented instantiation Check consistency of E ∪ Q ⊕ Only instances refuting the current model are generated Congruence Closure with Free Variables (CCFV) 6 / 18
Goal-oriented instantiation Check consistency of E ∪ Q ⊕ Only instances refuting the current model are generated ∀ ¯ ∀ ¯ x.ψ → ψσ x.ψ → ψσ E ∧ ψσ | = ⊥ UNSAT! Goal-oriented instantiation module E Congruence Closure with Free Variables (CCFV) 6 / 18
Goal-oriented instantiation Check consistency of E ∪ Q ⊕ Only instances refuting the current model are generated ∀ ¯ ∀ ¯ x.ψ → ψσ x.ψ → ψσ E ∧ ψσ | = ⊥ UNSAT! Goal-oriented instantiation module E Congruence Closure with Free Variables (CCFV) 6 / 18
Goal-oriented instantiation Check consistency of E ∪ Q ⊕ Only instances refuting the current model are generated ∀ ¯ ∀ ¯ x.ψ → ψσ x.ψ → ψσ E ∧ ψσ | = ⊥ UNSAT! Goal-oriented instantiation module E Congruence Closure with Free Variables (CCFV) 6 / 18
Goal-oriented instantiation Check consistency of E ∪ Q ⊕ Only instances refuting the current model are generated ∀ ¯ ∀ ¯ x.ψ → ψσ x.ψ → ψσ E ∧ ψσ | = ⊥ UNSAT! Goal-oriented instantiation module E Congruence Closure with Free Variables (CCFV) 6 / 18
Previous work Conflict-based instantiation [RTM14] ⊲ Given a model E ∪ Q , for some ∀ ¯ x. ψ ∈ Q find σ s.t. E ∧ ψσ | = ⊥ ⊲ Add instance ∀ ¯ x. ψ → ψσ to quantifier-free solver Finding conflicting instances requires deriving σ s.t. E | = ¬ ψσ ⊕ Goal-oriented ⊕ Efficient ⊖ Ad-hoc ⊖ Incomplete Congruence Closure with Free Variables (CCFV) 7 / 18
Let’s look deeper into the problem E | = ¬ ψσ , for some ∀ ¯ x. ψ ∈ Q Congruence Closure with Free Variables (CCFV) 8 / 18
Let’s look deeper into the problem E | = ¬ ψσ , for some ∀ ¯ x. ψ ∈ Q E = { f ( a ) ≃ f ( b ) , g ( b ) �≃ h ( c ) } , Q = {∀ xyz. f ( x ) ≃ f ( z ) → h ( y ) ≃ g ( z ) } Congruence Closure with Free Variables (CCFV) 8 / 18
Let’s look deeper into the problem E | = ¬ ψσ , for some ∀ ¯ x. ψ ∈ Q E = { f ( a ) ≃ f ( b ) , g ( b ) �≃ h ( c ) } , Q = {∀ xyz. f ( x ) ≃ f ( z ) → h ( y ) ≃ g ( z ) } f ( a ) ≃ f ( b ) ∧ g ( b ) �≃ h ( c ) | = ( f ( x ) ≃ f ( z ) ∧ h ( y ) �≃ g ( z )) σ Congruence Closure with Free Variables (CCFV) 8 / 18
Let’s look deeper into the problem E | = ¬ ψσ , for some ∀ ¯ x. ψ ∈ Q E = { f ( a ) ≃ f ( b ) , g ( b ) �≃ h ( c ) } , Q = {∀ xyz. f ( x ) ≃ f ( z ) → h ( y ) ≃ g ( z ) } f ( a ) ≃ f ( b ) ∧ g ( b ) �≃ h ( c ) | = ( f ( x ) ≃ f ( z ) ∧ h ( y ) �≃ g ( z )) σ ⊲ Each literal in the right hand side delimits possible σ Congruence Closure with Free Variables (CCFV) 8 / 18
Let’s look deeper into the problem E | = ¬ ψσ , for some ∀ ¯ x. ψ ∈ Q E = { f ( a ) ≃ f ( b ) , g ( b ) �≃ h ( c ) } , Q = {∀ xyz. f ( x ) ≃ f ( z ) → h ( y ) ≃ g ( z ) } f ( a ) ≃ f ( b ) ∧ g ( b ) �≃ h ( c ) | = ( f ( x ) ≃ f ( z ) ∧ h ( y ) �≃ g ( z )) σ ⊲ Each literal in the right hand side delimits possible σ ◮ f ( x ) ≃ f ( z ) : either x ≃ z or x ≃ a ∧ z ≃ b or x ≃ b ∧ z ≃ a Congruence Closure with Free Variables (CCFV) 8 / 18
Recommend
More recommend