Satisfiability Modulo Theories

Slides:



Advertisements
Similar presentations
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Advertisements

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Identity Management - Login © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Satisfiability Modulo Theories and Network Verification Nikolaj Bjørner Microsoft Research Formal Methods and Networks Summer School Ithaca, June
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Feature: Reprint Outstanding Transactions Report © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Feature: Purchase Requisitions - Requester © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
demo Default WANGPSLookup Default WANGPS.
Co- location Mass Market Managed Hosting ISV Hosting.
Windows 7 Training Microsoft Confidential. Windows ® 7 Compatibility Version Checking.
Multitenant Model Request/Response General Model.
Feature: Purchase Order Prepayments II © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Announcing Demo Announcing.
Feature: OLE Notes Migration Utility
Feature: Web Client Keyboard Shortcuts © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: SmartList Usability Enhancements © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Session 1.
Built by Developers for Developers…. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
 Rico Mariani Architect Microsoft Corporation.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Assign an Item to Multiple Sites © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Print Remaining Documents © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
Connect with life Connect with life
NEXT: Overview – Sharing skills & code.
demo Receive Inventory Export Parse and Normalize.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Document Attachment –Replace OLE Notes © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Feature: Suggested Item Enhancements – Sales Script and Additional Information © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows.
Feature: Customer Combiner and Modifier © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: Employee Self Service Timecard Entry © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Ian Ellison-Taylor General Manager Microsoft Corporation PC27.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
demo Instance AInstance B Read “7” Write “8”

customer.
demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
demo Demo.
demo QueryForeign KeyInstance /sm:body()/x:Order/x:Delivery/y:TrackingId1Z
Feature: Suggested Item Enhancements – Analysis and Assignment © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and.
projekt202 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
The CLR CoreCLRCoreCLR © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

IoCompleteRequest (Irp);... p = NULL; …f(p);
Ctrl-K, X Ctrl-K, S
MIX 09 4/17/2018 4:41 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Возможности Excel 2010, о которых следует знать
Title of Presentation 11/22/2018 3:34 PM
Baseline: How Are We Doing Now?
Title of Presentation 12/2/2018 3:48 PM
1/3/2019 1:21 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
28 days.
8/04/2019 9:13 PM © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
4/27/17, Bell #8 What amount of net pay has been earned this period?
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
WINDOWS AZURE A LAP AROUND PLATFORM THE Steve Marx
PENSACOLA ENERGY WORK PLAN OCTOBER 10, 2016
Title of Presentation 5/12/ :53 PM
Шитманов Дархан Қаражанұлы Тарих пәнінің
Title of Presentation 5/24/2019 1:26 PM
5/24/2019 6:44 PM 1/8/18 Bell #10 In a world governed by the gods, is there any room for human will? Do human choices make a difference? EXPLAIN © 2007.
日本初公開!? Vista の新機能を実演 とっちゃん わんくま同盟 7/23/2019 9:09 AM
Title of Presentation 7/24/2019 8:53 PM
5/6/19, Bell #6 12/11/2019 8:26 PM Explain the relationship between this picture and the events that took place in Chapter 7 in Animal Farm. © 2007 Microsoft.
Presentation transcript:

Satisfiability Modulo Theories 9/12/2018 8:37 PM Satisfiability Modulo Theories Nikolaj Bjørner Microsoft Research Marktoberdorf Summer School August 10 - 2015 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Lectures Mon: An Introduction to SMT with Z3 Wed: Algorithmic underpinnings of SAT/SMT Thu: Theories, Solvers and Applications Fri: Topics: Horn Clauses, Quantifiers, Optimization

Plan Satisfiability Modulo Theories in a nutshell SMT solving in a nutshell SMT by example

Takeaways: Modern SMT solvers are a often good fit for program analysis tools. Handle domains found in programs directly. The selected examples are intended to show instances where sub-tasks are reduced to SMT/Z3.

If you use Z3, This could be you

– Backed by Proof Plumbers Handbook of Satisfiability Not all is hopeless Leonardo de Moura, Nikolaj Bjørner, Christoph Wintersteiger

Background Reading: SAT

Background Reading: SMT September 2011

Background Reading Tractability and Modern Satisfiability Modulo Theories Solver Bjørner and de Moura, Handbook of Tractability 2013. Applications of SMT solvers Bjørner and de Moura, Notes 2013. Horn Clause Solvers for Program Verification Bjørner, Gurfinkel, McMillan, Rybalchenko YuriFest 2015.

SAT in a nutshell

SAT in a nutshell (Tie  Shirt)  (Tie  Shirt)  (Tie  Shirt)

SMT in a nutshell

Is formula  satisfiable modulo theory T ? Satisfiability Modulo Theories (SMT) Is formula  satisfiable modulo theory T ? SMT solvers have specialized algorithms for T

Satisfiability Modulo Theories (SMT) 𝑥+2=𝑦⇒𝑓 𝑠𝑒𝑙𝑒𝑐𝑡 𝑠𝑡𝑜𝑟𝑒 𝑎,𝑥,3 ,𝑦−2 =𝑓(𝑦−𝑥+1) Array Theory Arithmetic Uninterpreted Functions 𝑠𝑒𝑙𝑒𝑐𝑡(𝑠𝑡𝑜𝑟𝑒 𝑎,𝑖,𝑣 ,𝑖)=𝑣 𝑖≠𝑗⇒𝑠𝑒𝑙𝑒𝑐𝑡(𝑠𝑡𝑜𝑟𝑒 𝑎,𝑖,𝑣 ,𝑗)=𝑠𝑒𝑙𝑒𝑐𝑡(𝑎,𝑗)

SMT Solving in a nutshell Job Shop Scheduling SMT Solving in a nutshell

Job Shop Scheduling Machines Tasks Jobs P = NP? Laundry 𝜁 𝑠 =0⇒𝑠= 1 2 +𝑖𝑟

Job Shop Scheduling Constraints: Precedence: between two tasks of the same job Resource: Machines execute at most one job at a time 3 1 2 4 𝑠𝑡𝑎𝑟 𝑡 2,2 ..𝑒𝑛 𝑑 2,2 ∩ 𝑠𝑡𝑎𝑟 𝑡 4,2 ..𝑒𝑛 𝑑 4,2 =∅

Job Shop Scheduling Constraints: Encoding: Precedence: 𝑡 2,3 - start time of job 2 on mach 3 𝑑 2,3 - duration of job 2 on mach 3 𝑡 2,3 + 𝑑 2,3 ≤ 𝑡 2,4 Resource: 3 1 2 4 Not convex 𝑡 2,2 + 𝑑 2,2 ≤ 𝑡 4,2 ∨ 𝑡 4,2 + d 4,2 ≤ 𝑡 2,2 𝑠𝑡𝑎𝑟 𝑡 2,2 ..𝑒𝑛 𝑑 2,2 ∩ 𝑠𝑡𝑎𝑟 𝑡 4,2 ..𝑒𝑛 𝑑 4,2 =∅

Job Shop Scheduling

Job Shop Scheduling Efficient solvers: - Floyd-Warshal algorithm - Ford-Fulkerson algorithm case split case split 𝑧 −𝑧= 5 – 2 – 3 – 2 = −2 < 0

Theories

Theories Uninterpreted functions

Theories Uninterpreted functions Arithmetic (linear)

Theories Uninterpreted functions Arithmetic (linear) Bit-vectors

Theories Uninterpreted functions Arithmetic (linear) Bit-vectors Algebraic data-types

Theories Uninterpreted functions Arithmetic (linear) Bit-vectors Algebraic data-types Arrays

Theories Uninterpreted functions Arithmetic (linear) Bit-vectors Algebraic data-types Arrays Polynomial Arithmetic

QUANTIFIERS

Equality-Matching 𝑔 𝑐,𝑥 matches 𝑔 𝑏,𝑏 with substitution 𝑥↦𝑏 modulo 𝑏=𝑐 𝑝 (∀…) ∧ 𝑎=𝑔 𝑏,𝑏 ∧ 𝑏=𝑐 ∧ 𝑓 𝑎 ≠𝑐 ∧ 𝑝 (∀𝑥 ...) →𝑓 𝑔 𝑐,𝑏 =𝑏 (∀𝑥 𝑓 𝑔 𝑐,𝑥 =𝑥) ∧ 𝑎=𝑔 𝑏,𝑏 ∧ 𝑏=𝑐 ∧ 𝑓 𝑎 ≠𝑐 ∧ ∀𝑥 𝑓 𝑔 𝑐,𝑥 =𝑥 →𝑓 𝑔 𝑐,𝑏 =𝑏 𝑔 𝑐,𝑥 matches 𝑔 𝑏,𝑏 with substitution 𝑥↦𝑏 modulo 𝑏=𝑐 [de Moura, B. CADE 2007]

Quantifier Elimination Presburger Arithmetic, Algebraic Data-types, Quadratic polynomials SMT integration to prune branches [B. IJCAR 2010]

MBQI: Model based Quantifier Instantiation [de Moura, Ge. CAV 2008] [Bonachnia, Lynch, de Moura CADE 2009] [de Moura, B. IJCAR 2010]

Horn Clauses mc(x) = x-10 if x > 100 mc(x) = mc(mc(x+11)) if x  100 assert (mc(x)  91) ∀𝑿. 𝑿 > 𝟏𝟎𝟎  mc(𝑿,𝑿−𝟏𝟎) ∀𝑿,𝒀,𝑹. 𝑿≤ 𝟏𝟎𝟎  mc(𝑿+𝟏𝟏,𝒀)  mc(𝒀,𝑹)  mc(𝑿,𝑹) ∀𝑿,𝑹. mc(𝑿,𝑹) ∧𝑿≤𝟏𝟎𝟏→𝑹= 𝟗𝟏 Solver finds solution for mc [Hoder, B. SAT 2012]

MODELS, Proofs, Cores & Simplification

Models Logical Formula Sat/Model

Cores Logical Formula Unsat. Core

APIs C C++ python OCaml .NET Java

Summary Z3 supports several theories Z3 is more than sat/unsat Using a default combination Providing custom tactics for special combinations Z3 is more than sat/unsat Models, proofs, unsat cores, simplification, quantifier elimination are tactics Prototype with python/smt-lib2 Implement using smt-lib2/programmatic API