Logic Stuff & FV Basics Erik Seligman CS 510, Lecture 2, January 2009.

Slides:



Advertisements
Similar presentations
Model Checking Lecture 4. Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking.
Advertisements

Exploiting SAT solvers in unbounded model checking
Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
Modeling issues Book: chapters 4.12, 5.4, 8.4, 10.1.
Artificial Intelligence Chapter 13 The Propositional Calculus Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Inference Rules Universal Instantiation Existential Generalization
Representing Boolean Functions for Symbolic Model Checking Supratik Chakraborty IIT Bombay.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
ECE Synthesis & Verification - L271 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Model Checking basics.
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Propositional and First Order Reasoning. Terminology Propositional variable: boolean variable (p) Literal: propositional variable or its negation p 
CS357 Lecture: BDD basics David Dill 1. 2 BDDs (Boolean/binary decision diagrams) BDDs are a very successful representation for Boolean functions. A BDD.
Model Checking I What are LTL and CTL?. and or dreq q0 dack q0bar.
Disjunctive Normal Form CS 680: Formal Methods Jeremy Johnson.
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
For Friday No reading Homework: –Chapter 9, exercise 4 (This is VERY short – do it while you’re running your tests) Make sure you keep variables and constants.
Logic Use mathematical deduction to derive new knowledge.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic.
SAT and Model Checking. Bounded Model Checking (BMC) A.I. Planning problems: can we reach a desired state in k steps? Verification of safety properties:
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Computability and Complexity 9-1 Computability and Complexity Andrei Bulatov Logic Reminder (Cnt’d)
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Discrete Mathematics Lecture 4 Harper Langston New York University.
Methods of Proof Chapter 7, second half.
Analysis of Algorithms CS 477/677
 2001 CiesielskiBDD Tutorial1 Decision Diagrams Maciej Ciesielski Electrical & Computer Engineering University of Massachusetts, Amherst, USA
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
ENGG3190 Logic Synthesis “Boolean Satisfiability” Winter 2014 S. Areibi School of Engineering University of Guelph.
IT University of Copenhagen Lecture 8: Binary Decision Diagrams 1. Classical Boolean expression representations 2. If-then-else Normal Form (INF) 3. Binary.
Formal Theories SIE 550 Lecture Matt Dube Doctoral Student - Spatial.
Binary Decision Diagrams (BDDs)
MATH 224 – Discrete Mathematics
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
1 Inference Rules and Proofs (Z); Program Specification and Verification Inference Rules and Proofs (Z); Program Specification and Verification.
INTRODUCTION TO ARTIFICIAL INTELLIGENCE COS302 MICHAEL L. LITTMAN FALL 2001 Satisfiability.
Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011 TexPoint fonts used in EMF. Read the TexPoint manual before you.
CS 267: Automated Verification Lecture 6: Binary Decision Diagrams Instructor: Tevfik Bultan.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
CS201: Data Structures and Discrete Mathematics I
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
CS6133 Software Specification and Verification
Disjunctive Normal Form CS 270: Math Foundation of CS Jeremy Johnson.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
Verification & Validation By: Amir Masoud Gharehbaghi
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Presented by: Belgi Amir Seminar in Distributed Algorithms Designing correct concurrent algorithms Spring 2013.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
The Propositional Calculus
Disjunctive Normal Form
Propositional Calculus: Boolean Algebra and Simplification
Elementary Metamathematics
Binary Decision Diagrams
ECE 667 Synthesis and Verification of Digital Circuits
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Artificial Intelligence: Agents and Propositional Logic.
Methods of Proof Chapter 7, second half.
Presentation transcript:

Logic Stuff & FV Basics Erik Seligman CS 510, Lecture 2, January 2009

Goals of This Session  Review basics of boolean logic, and some fundamental FV algorithms Logic should just be a review for people in this class!  Establish common symbols & terms Variety of ways to express common ops  Have basic foundation for discussing FV Getting a flavor for contents of tools NOT describing full internal algorithms NOT full mathematical rigor –If you want screenfuls of symbols, take Xie or Song class!

Basic Boolean Logic

Fundamental operations  For consistency, will use Verilog-like notation: AND: a & b OR: a | b NOT: ~a  Sometimes AND represented as multiplication, and OR as addition Like arithmetic, except 1+1 == 1  Implication: a -> b Same as: ~a | b Terms: a is the antecedent, b is the consequent

Basic Boolean Identities  Commutative, Associative  Distributive both ways a & (b|c) == (a&b) | (a&c) a | (b&c) == (a|b) & (a|c)  Idempotence: a&a == a, a|a == a  DeMorgan ~(a&b) = ~a | ~b ~(a|b) = ~a & ~b

Implication relationships a -> b  Converse: b -> a  Inverse: ~a -> ~b  Contrapositive: ~b -> ~a Which pairs are identical in truth value?  Can be useful when restating for FV  Use |= (“logically entails”) symbol as distinct from implication when appropriate (a -> b) |= (~b -> ~a)

Inference Rules  Rules to derive new statements  Some basic rules (a -> b), (a) (modus ponens) b (a | b), (~a) b a -> F (contradiction) ~a

What is a Proof?  Apply sequence of inference rules  Example: Known: S1: a, S2: (a -> b), S3: (d -> ~b)) Prove: ~d –C1: S1, S2 |= b –C2: S3 |= (~d | ~b) –C3: C1, D3 |= ~d

Predicate Logic  Add predicates, or functions, and quantifiers: For All (A), Exists (E)  Examples: A(x) Cat(x) -> Mammal(x) E(x) Cat(x) & ~Black(x)

Linear Temporal Logic (LTL)

What Is Linear Temporal Logic?  Add notion of time to predicate logic X = Next time G = Globally / always F = Future / eventually U = Until  Statements evaluated at points in time Discrete, “clocked” machine model  Lots of power for stating properties Useful in real-life designs In upcoming 2009 SVA standard

Equivalent operations in LTL  Ga == ~(F(~a))  Fa == ~(G(~a))  Fa == T U a  Distributive laws G(a &b) = Ga & Gb F(a | b) = Fa | Fb But be careful… –can G(a|b) be distributed? –How about F(a&b)?

LTL examples  Eventually bus grant will occur F(grant)  Requests will be held until there is a grant or a power down req -> (req U (grant | power_down))  Deadlock free Ai. req[i] -> F(grant[i])  At some point after reset, the reset signal will stay low forever reset -> F(G(~reset))

LTL: Strong and Weak Statements  If the machine may exit/terminate, and an “until” is waiting, did it pass? Example: (a -> b U c)  Strong property: must finish  Weak property: considered true if evaluation may never complete Usually the default

Types of Properties  Safety: “Something bad won’t happen.” G(~ (grant & busy))  Liveness: “Something good will happen.” F(grant) Be careful: weak or strong?  Fairness: “Something happens infinitely often.” G(F(!busy)) Usually considered subset of liveness Often required as assumption on design inputs

Binary Decision Diagrams (BDDs)

BDD Example  (a & c) | (~a & b & ~c) a b cc

BDD Reduction & Ordering  Always specify an order for the variables  Reduction: merge identical nodes a b cc a b c

Why are BDDs useful?  Canonical: unique for given var ordering Assuming they are reduced Two formulas equivalent iff same BDD!  Easy to define operations Complement Substitute constant (“Restrict”) Apply any boolean operator (&, |, etc)  Many cases proven efficient in practice But danger of exponential blowup

Complement A BDD  Replace f with ~f: just reverse terminals a b cc

Substitute Constant in BDD  Just eliminate irrelevant subtrees, connect correct nodes  Example: c = 1 a b cc

Substitute Constant in BDD  Just eliminate irrelevant subtrees, connect correct nodes  Example: c = 1 a b

Substitute Constant in BDD  Just eliminate irrelevant subtrees, connect correct nodes  Example: c = 1 a Don’t forget to reduce

Apply Operation to BDDs (AND, OR, etc)  Basic idea: recursively examine, with one var restricted to constant Each recursive call reduced #vars by 1 At terminal apply obvious function  APPLY(f1,f2,AND) = v1 0 1 APPLY(f1,f2,AND)| v1=0 APPLY(f1,f2,AND)| v1=1

APPLY example  Goal: BDD1(a,b) AND BDD2(a,b) a b 10 0 a BDD1 = a&b BDD2 = !a

APPLY example: Step 1 a b 10 0 a Use restrictions for a=0, a=1 a 10 APPLY| a=0 APPLY| a=1

APPLY example: Step 2 a b 10 0 a Use restrictions for a=0, a=1 a 10 0 AND 1 BDD1.b AND 0

APPLY example: Step 3 a b 10 0 a Compute results using constants if available a 10 00

APPLY example: Result 0 2 recursive calls per variable But always reduces size of problem So eventual constants guaranteed

BDDs: Exponential Blowup  (a&b) | (c&d) a b c 10 d

BDDs: Exponential Blowup  (a&b) | (c&d) a c 10 c bb d d

SAT Algorithms

What is SAT?  SAT= general problem: can boolean statement be satisfied? Known NP-complete But good heuristics known  FV Focus was on BDDs in 1990s Now seen as too restrictive Modern tools have BDD + SAT engines

SAT Example: DPLL Algorithms  Algorithms first proposed in 1960’s But renewed interest due to FV application  Start by converting formula to CNF form: product-of-sums (clauses) (a+b+c)(a+~d+e)(~b+~c)… Reminder: multiplication=AND, addition=OR Target: assignment satisfying every term If some clause is 0, assignment fails

Outline of DPLL algs (from Zhang/Malik paper, see ref slide)

Sub-functions  Deduction: find what must be true Example: (a+b)(~c+d) If c was assigned 1, then d must be 1 Can spend compute cycles to be more aggressive  Choose_free_variable: tricky part! Look for var that affects most clauses? Weight clauses strategically? Learn from conflicts/backtracks?

Other DPLL SAT Aspects  Capacity: How to store set of clauses? Direct: sparse matrix representation BDDs, tries, other options  Preprocessing First pass: gather high-level data hints  Randomization Random restart if seem to be dying?  Other approaches: SAT is still an active research area!

References   and-Computer-Science/6-042JFall- 2005/LectureNotes/index.htm and-Computer-Science/6-042JFall- 2005/LectureNotes/index.htm     ec11-BDD.pdf ec11-BDD.pdf   pdf pdf