Machine Learning and Logic: Fast and Slow Thinking

Similar documents
The SAT Revolution: Solving, Sampling, and Counting

The Automated-Reasoning Revolution: from Theory to Practice and Back

Constrained Sampling and Counting

Constrained Counting and Sampling Bridging Theory and Practice

Approximating Probabilistic Inference

Efficient Sampling of SAT Solutions for Testing

Formal Verification Methods 1: Propositional Logic

Propositional Logic. Methods & Tools for Software Engineering (MTSE) Fall Prof. Arie Gurfinkel

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

Foundations of Artificial Intelligence

Lecture Notes on SAT Solvers & DPLL

From SAT To SMT: Part 1. Vijay Ganesh MIT

Introduction to SAT (constraint) solving. Justyna Petke

LOGIC PROPOSITIONAL REASONING

Foundations of Artificial Intelligence

Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011

A Logical Revolution. Moshe Y. Vardi. Rice University

Linear Algebra, Boolean Rings and Resolution? Armin Biere. Institute for Formal Models and Verification Johannes Kepler University Linz, Austria

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 3: Practical SAT Solving

Satisifiability and Probabilistic Satisifiability

Introduction to Artificial Intelligence Propositional Logic & SAT Solving. UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010

Topics in Model-Based Reasoning

Propositional Logic: Evaluating the Formulas

Price: $25 (incl. T-Shirt, morning tea and lunch) Visit:

Logical Agents. Chapter 7

SAT, NP, NP-Completeness

VLSI CAD: Lecture 4.1. Logic to Layout. Computational Boolean Algebra Representations: Satisfiability (SAT), Part 1

Solving SAT Modulo Theories

CS 4700: Foundations of Artificial Intelligence

CSE507. Introduction. Computer-Aided Reasoning for Software. Emina Torlak courses.cs.washington.edu/courses/cse507/17wi/

SAT-Solvers: propositional logic in action

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Tutorial 1: Modern SMT Solvers and Verification

An instance of SAT is defined as (X, S)

Verification using Satisfiability Checking, Predicate Abstraction, and Craig Interpolation. Himanshu Jain THESIS ORAL TALK

Intelligent Agents. Pınar Yolum Utrecht University

Satisfiability Modulo Theories

SMT BASICS WS 2017/2018 ( ) LOGIC SATISFIABILITY MODULO THEORIES. Institute for Formal Models and Verification Johannes Kepler Universität Linz

Pythagorean Triples and SAT Solving

Heuristics for Efficient SAT Solving. As implemented in GRASP, Chaff and GSAT.

Model Counting for Probabilistic Reasoning

Lecture 2 Propositional Logic & SAT

Propositional and Predicate Logic. jean/gbooks/logic.html

Lecture 9: The Splitting Method for SAT

SAT, CSP, and proofs. Ofer Strichman Technion, Haifa. Tutorial HVC 13

NP Completeness and Approximation Algorithms

Logical agents. Chapter 7. Chapter 7 1

Satisfiability Modulo Theories

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

Class Assignment Strategies

SAT-based Combinational Equivalence Checking

Part 1: Propositional Logic

SAT Solvers: Theory and Practice

The Eager Approach to SMT. Eager Approach to SMT

Deliberative Agents Knowledge Representation I. Deliberative Agents

Introduction to Computational Complexity

Logic and Inferences

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

CS:4420 Artificial Intelligence

CSC 5170: Theory of Computational Complexity Lecture 9 The Chinese University of Hong Kong 15 March 2010

Logical Agents. Outline

Bounded Model Checking with SAT/SMT. Edmund M. Clarke School of Computer Science Carnegie Mellon University 1/39

Propositional Logic: Methods of Proof (Part II)

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

Artificial Intelligence

A Scalable and Nearly Uniform Generator of SAT Witnesses

Chapter 7 Propositional Satisfiability Techniques

Introduction Algorithms Applications MINISAT. Niklas Sörensson Chalmers University of Technology and Göteborg University

Introduction to Artificial Intelligence. Logical Agents

Unprovability of circuit upper bounds in Cook s theory PV

NP-Completeness Part II

Propositional Calculus

Logical Agents. Chapter 7

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

WHAT IS AN SMT SOLVER? Jaeheon Yi - April 17, 2008

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

A Scalable Approximate Model Counter

Kecerdasan Buatan M. Ali Fauzi

The Wumpus Game. Stench Gold. Start. Cao Hoang Tru CSE Faculty - HCMUT

CS 771 Artificial Intelligence. Propositional Logic

Classical Propositional Logic

Propositional Logic: Methods of Proof. Chapter 7, Part II

Lecture 2: Symbolic Model Checking With SAT

Foundations of Lazy SMT and DPLL(T)

Artificial Intelligence

CS 188: Artificial Intelligence Spring 2007

TDT4136 Logic and Reasoning Systems

SAT-Solving: From Davis- Putnam to Zchaff and Beyond Day 3: Recent Developments. Lintao Zhang

Propositional Reasoning

Lecture 1: Logical Foundations

1 Algebraic Methods. 1.1 Gröbner Bases Applied to SAT

Sums of Products. Pasi Rastas November 15, 2005

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

CS 380: ARTIFICIAL INTELLIGENCE PREDICATE LOGICS. Santiago Ontañón

SAT-Based Explicit LTL Reasoning

Lecture 23: Alternation vs. Counting

Logical agents. Chapter 7. Chapter 7 1

Theory of Computer Science

Transcription:

Machine Learning and Logic: Fast and Slow Thinking Moshe Y. Vardi Rice University

Is Computer Science Fundamentally Changing? Formal Science vs Data Science We are at peak hype about machine learning and big data! Common perception: A Kuhnian paradigm shift! Throw out the old, bring in the new! In reality: new scientific theories refine old ones. After all, we went to the moon with Newtonian Mechanics! My Thesis: Data science refines formal science! 1

Logic vs. Machine Learning Daniel Kahneman, Thinking, Fast and Slow, 2011: Machine Learning: fast thinking, e.g., Is this a stop sign? Logic: slow thinking, e.g., Do you stop at a stop sign? Example Autonomous Vehicles: how to establish safety? [Shashua, 17] Data Driven: Drive 1B miles! Data+Model Driven: Combine data (1M miles) with reasoning. Grand Challenge: Combine logic with machine learning! 2

Boolean Satisfiability Boolean Satisfiability (SAT); Given a Boolean expression, using and ( ) or, ( ) and not ( ), is there a satisfying solution (an assignment of 0 s and 1 s to the variables that makes the expression equal 1)? Example: ( x 1 x 2 x 3 ) ( x 2 x 3 x 4 ) (x 3 x 1 x 4 ) Solution: x 1 = 0, x 2 = 0, x 3 = 1, x 4 = 1 Boolean Logic Today: assembly language for reasoning! 3

Algorithmic Boolean Reasoning: Early History Newell, Shaw, and Simon, 1955: Logic Theorist Davis and Putnam, 1958: Computational Methods in The Propositional calculus, unpublished report to the NSA Davis and Putnam, JACM 1960: A Computing procedure for quantification theory Davis, Logemman, and Loveland, CACM 1962: A machine program for theorem proving Cook, 1971, Levin, 1973: Boolean Satisfiability is NP-complete. DPLL Method: Propositional Satisfiability Test Convert formula to conjunctive normal form (CNF) Backtracking search for satisfying truth assignment Unit-clause preference 4

Modern SAT Solving CDCL = conflict-driven clause learning Backjumping Smart unit-clause preference Conflict-driven clause learning Smart choice heuristic (brainiac vs speed demon) Restarts Key Tools: GRASP, 1996; Chaff, 2001 Current capacity: millions of variables 5

Speed-up (log scale) Some Experience with SAT Solving Sanjit A. Seshia Speed-up of 2012 solver over other solvers 1,000 100 10 1 S. A. Seshia Solver 1 6

Applications of SAT Solving in SW Engineering Leonardo De Moura+Nikolaj Björner, 2012: applications of Z3 at Microsoft Symbolic execution Model checking Static analysis Model-based design... 7

Verification of HW/SW systems HW/SW Industry: $0.75T per year! Major Industrial Problem: Functional Verification ensuring that computing systems satisfy their intended functionality Verification consumes the majority of the development effort! Two Major Approaches: Formal Verification: Constructing mathematical models of systems under verification and analzying them mathematically: 10% of verification effort Dynamic Verification: simulating systems under different testing scenarios and checking the results: 90% of verification effort 8

Dynamic Verification Dominant approach! Design is simulated with input test vectors. Test vectors represent different verification scenarios. Results compared to intended results. Challenge: Exceedingly large test space! 9

Motivating Example: HW FP Divider z = x/y: x, y, z are 128-bit floating-point numbers Question How do we verify that circuit works correctly? Try for all values of x and y? 2 256 possibilities Sun will go nova before done! Not scalable! 10

Test Generation Classical Approach: manual test generation - capture intuition about problematic input areas Verifier can write about 20 test cases per day: not scalable! Modern Approach: random-constrained test generation Verifier writes constraints describing problematic inputs areas (based on designer intuition, past bug reports, etc.) Uses constraint solver to solve constraints, and uses solutions as test inputs rely on industrial-strength constraint solvers! Proposed by Lichtenstein+Malka+Aharon, 1994: de-facto industry standard today! 11

Random Solutions Major Question: How do we generate solutions randomly and uniformly? Randomly: We should not rely on solver internals to chose input vectors; we do not know where the errors are! Uniformly: We should not prefer one area of the solution space to another; we do not know where the errors are! Uniform Generation of SAT Solutions: Given a SAT formula, generate solutions uniformly at random, while scaling to industrial-size problems. 12

Constrained Sampling: Applications Many Applications: Constrained-random Test Generation: discussed above Personalized Learning: automated problem generation Search-Based Optimization: generate random points of the candidate space Probabilistic Inference: Sample after conditioning... 13

Constrained Sampling Prior Approaches, I Theory: Jerrum+Valiant+Vazirani: Random generation of combinatorial structures from a uniform distribution, TCS 1986 uniform generation in BP P Σp 2 Bellare+Goldreich+Petrank: Uniform generation of N P -witnesses using an NP -oracle, 2000 uniform generation in BP P NP. But: We implemented the BPG Algorithm: did not scale above 16 variables! 14

Constrained Sampling Prior Work, II Practice: BDD-based: Yuan, Aziz, Pixley, Albin: Simplifying Boolean constraint solving for random simulation-vector generation, 2004 poor scalability Heuristics approaches: MCMC-based, randomized solvers, etc. good scalability, poor uniformity 15

Almost Uniform Generation of Solutions New Algorithm UniGen: Chakraborty, Fremont, Meel, Seshia, V, 2013-15: almost uniform generation in BP P NP algorithms with a SAT oracle) (randomized polynomial time Based on universal hashing. Uses an SMT solver. Scales to 100,000s of variables. 16

Uniformity vs Almost-Uniformity Input formula: ϕ; Solution space: Sol(ϕ) Solution-space size: κ = Sol(ϕ) Uniform generation: for every assignment y: Prob[Output = y]=1/κ Almost-Uniform Generation: for every assignment y: P rob[output = y] (1/κ) (1 + ε) (1/κ) (1+ε) 17

The Basic Idea 1. Partition Sol(ϕ) into roughly equal small cells of appropriate size. 2. Choose a random cell. 3. Choose at random a solution in that cell. You got random solution almost uniformly! Question: How can we partition Sol(ϕ) into roughly equal small cells without knowing the distribution of solutions? Answer: Universal Hashing [Carter-Wegman 1979, Sipser 1983] 18

Universal Hashing Hash function: maps {0, 1} n to {0, 1} m Random inputs: All cells are roughly equal (in expectation) Universal family of hash functions: Choose hash function randomly from family For arbitrary distribution on inputs: All cells are roughly equal (in expectation) 19

XOR-Based Universal Hashing Partition {0, 1} n into 2 m cells. Variables: X 1, X 2,... X n Pick every variable with probability 1/2, XOR them, and equate to 0/1 with probability 1/2. E.g.: X 1 + X 7 +... + X 117 = 0 (splits solution space in half) m XOR equations 2 m cells Cell constraint: a conjunction of CNF and XOR clauses 20

SMT: Satisfiability Modulo Theory SMT Solving: Solve Boolean combinations of constraints in an underlying theory, e.g., linear constraints, combining SAT techniques and domainspecific techniques. Tremendous progress since 2000! CryptoMiniSAT: M. Soos, 2009 Specialized for combinations of CNF and XORs Combine SAT solving with Gaussian elimination 21

UniGen Performance: Uniformity 500 450 US UniGen 400 350 # of Solutions 300 250 200 150 100 50 0 160 180 200 220 240 260 280 300 320 Count Uniformity Comparison: UniGen vs Uniform Sampler 22

UniGen Performance: Runtime 100000 10000 1000 Time(s) 100 10 1 0.1 case47 case_3_b14_3 case105 case8 case203 case145 case61 case9 case15 case140 case_2_b14_1 case_3_b14_1 squaring14 squaring7 case_2_ptb_1 case_1_ptb_1 case_2_b14_2 case_3_b14_2 Benchmarks UniGen XORSample' Runtime Comparison: UniGen vs XORSample 23

Are NP-Complete Problems Really Hard? When I was a graduate student, SAT was a scary problem, not to be touched with a 10-foot pole. Indeed, there are SAT instances with a few hundred variables that cannot be solved by any extant SAT solver. But today s SAT solvers, which enjoy wide industrial usage, routinely solve real-life SAT instances with millions of variables! Conclusion We need a richer and broader complexity theory, a theory that would explain both the difficulty and the easiness of problems like SAT. Question: Now that SAT is easy in practice, how can we leverage that? If not worst-case complexity, then what? 24

From Model-Driven Computer Science to Data-Driven Computer Science and Back In Summary: It is a paradigm glide, not paradigm shift. Data-driven CS refines model-driven CS, it does not replace it. Physicists still teach Mechanics, Electromagnetism, and Optics. We should still teach Algorithms, Logic, and Formal Languages. But we must marry logic and probability. 25