Knowledge Repn. & Reasoning Lec. #3: Consequence Finding & Prime Implicates/Implicants UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.

Slides:



Advertisements
Similar presentations
Exploiting SAT solvers in unbounded model checking
Advertisements

CSEE 4823 Advanced Logic Design Handout: Lecture #2 1/22/15
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 
Proofs from SAT Solvers Yeting Ge ACSys NYU Nov
Automated Reasoning Systems For first order Predicate Logic.
First Order Logic Resolution
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Mar, 4, 2015 Slide credit: some slides adapted from Stuart.
Logic Concepts Lecture Module 11.
Simplifying CFGs There are several ways in which context-free grammars can be simplified. One natural way is to eliminate useless symbols those that cannot.
Properties of SLUR Formulae Ondřej Čepek, Petr Kučera, Václav Vlček Charles University in Prague SOFSEM 2012 January 23, 2012.
ELEC Digital Logic Circuits Fall 2008 Logic Minimization (Chapter 3) Vishwani D. Agrawal James J. Danaher Professor Department of Electrical and.
1 Applied Computer Science II Resolution in FOL Luc De Raedt.
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Consensus Definition Let w, x, y, z be cubes, and a be a variable such that w = ax and y = a’z w = ax and y = a’z Then the cube xz is called the consensus.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
Existential Graphs and Davis-Putnam April 3, 2002 Bram van Heuveln Department of Cognitive Science.
Knoweldge Representation & Reasoning
Give qualifications of instructors: DAP
ECE 667 Synthesis and Verification of Digital Systems
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
Courtesy RK Brayton (UCB) and A Kuehlmann (Cadence) 1 Logic Synthesis Two-Level Minimization II.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
Boolean Satisfiability and SAT Solvers
Context-Free Grammars Normal Forms Chapter 11. Normal Forms A normal form F for a set C of data objects is a form, i.e., a set of syntactically valid.
Conjunctive normal form: any formula of the predicate calculus can be transformed into a conjunctive normal form. Def. A formula is said to be in conjunctive.
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.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Quine-McCluskey (Tabular) Minimization Two step process utilizing tabular listings to: Identify prime implicants (implicant tables) Identify minimal PI.
Two-Level Simplification Approaches Algebraic Simplification: - algorithm/systematic procedure is not always possible - No method for knowing when the.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
Logical Agents Logic Propositional Logic Summary
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
Two Level Networks. Two-Level Networks Slide 2 SOPs A function has, in general many SOPs Functions can be simplified using Boolean algebra Compare the.
Chapter 6 Quine-McCluskey Method Mei Yang ECG Logic Design 1.
CMPUT Computer Organization and Architecture II1 CMPUT329 - Fall 2003 Topic 5: Quine-McCluskey Method José Nelson Amaral.
1 Quine-McCluskey Method. 2 Motivation Karnaugh maps are very effective for the minimization of expressions with up to 5 or 6 inputs. However they are.
07 KM Page 1 ECEn/CS 224 Karnaugh Maps. 07 KM Page 2 ECEn/CS 224 What are Karnaugh Maps? A simpler way to handle most (but not all) jobs of manipulating.
Automated Theorem Proving: Resolution and Davis-Putnam Intermediate Logic.
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Closure Properties Lemma: Let A 1 and A 2 be two CF languages, then the union A 1  A 2 is context free as well. Proof: Assume that the two grammars are.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Oct, 30, 2015 Slide credit: some slides adapted from Stuart.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Knowledge Repn. & Reasoning Lec. #5: First-Order Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
Digital Logic (Karnaugh Map). Karnaugh Maps Karnaugh maps (K-maps) are graphical representations of boolean functions. One map cell corresponds to a row.
Boolean Functions 1 ECE 667 ECE 667 Synthesis and Verification of Digital Circuits Boolean Functions Basics Maciej Ciesielski Univ.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
©2010 Cengage Learning SLIDES FOR CHAPTER 6 QUINE-McCLUSKEY METHOD Click the mouse to move to the next page. Use the ESC key to exit this chapter. This.
©2010 Cengage Learning SLIDES FOR CHAPTER 3 BOOLEAN ALGEBRA (continued) Click the mouse to move to the next page. Use the ESC key to exit this chapter.
CHAPTER 6 Quine-McCluskey Method
ELEC Digital Logic Circuits Fall 2014 Logic Minimization (Chapter 3)
Knowledge Representation and Reasoning
CS 352 Introduction to Logic Design
Logics for Data and Knowledge Representation
Propositional Calculus: Boolean Algebra and Simplification
Chapter 6 Quine-McCluskey Method
Optimized Implementation of Logic Function
CS 416 Artificial Intelligence
PROPOSITIONAL LOGIC - SYNTAX-
Instructor: Aaron Roth
Presentation transcript:

Knowledge Repn. & Reasoning Lec. #3: Consequence Finding & Prime Implicates/Implicants UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004 Adapted from slides by Alexandre Klementiev

Prime implicants, prime implicates and consequence finding. Material from: A new algorithm for generating prime implicants [J.Slagle et al.]. An improved incremental algorithm for generating prime implicates [J. de Kleer]. A new method for consequence finding and compilation in restricted languages [del Val].

So Far & Today So far: resolution theorem proving Today: –Prime implicates, prime implicants –Consequence finding –Slagle’s algorithm (semantic tree) –de Kleer/Tison’s algorithm (resolution variant) –del Val’s algorithm (kernel resolution)

Prime Implicants and Implicates Prime implicant α of a formula φ is a conjunction of literals s.t. α |= φ, but deprived of a literal α |≠ φ. – Prime implicate β of a formula φ is a clause s.t. φ |= β and there is no other implicate β’ s.t. β’ |= β. – Thm: Prop. formulae are equivalent iff they have the same set of prime implicates/implicants.

Prime Implicants and Implicates: Motivation Represent φ by disjunction of all its prime implicants (or conjunction of all prime implicates) –Define simplifying φ as finding the simplest equivalent in some unique normal form. Inference from primes is simple Reduce prop. formula φ to simplest equivalent. –Many applications: digital circuits, knowledge state However, we may not need all prime implicants. –

Prime Implicants and Implicates: Computational Objective Generate the set of all prime implicates/implicants of φ. –Known to be NP-complete, but we can do much better than brute force. If φ if redundant - get rid of unnecessary prime implicates/implicants.

Consequence Finding: Motivation and Objective Given a knowledge base Δ, derive a set of formulas logically implied by Δ. May want to derive some subset of the set of all implicates of Δ. –Provide restrictions to guide the search. Such task is called consequence finding.

Outline of the rest of the talk Slagle et. al. (1970) –Generating prime implicants and implicates. –Finding minimal sum. de Kleer (1992) –Generating prime implicates. del Val (1999) –Consequence finding.

Approach I: Prime Implicants (Slagle et. al. 1970) 1.Start with φ in CNF. – 2.Remove tautologies. Call new set S. – 3.Choose literal ordering O S for S –

4. Build a “semantic tree”. Start with S as a root node. S For each literal in O S, sprout a node from S.... abcd For x i, create a set S i by deleting all clauses in S containing x i. S1S1 S = S 1 = –If S i = Ø – create terminal success node. –Else, delete x i from clauses in S i and all literals preceding x i in O S. –If S i contains an empty clause – create terminal failure node. –Else – create non-terminal node S i.

4. Build a “semantic tree”. S... abcd S1S1 S 11 S 12 S 13 bcd S 21 S 22 cd S 31 S 32 S 33 dad S 1 = S2S2 S 2 = S3S3 S 3 = S4S4 S 4 = S 311 d S 31 = x vvvvv xx v Start with S as a root node. For each literal in O S, sprout a node from S. For x i, create a set S i by deleting all clauses in S containing x i. –If S i = Ø – create terminal success node. –Else, delete x i from clauses in S i and all literals preceding x i in O S. –If S i contains an empty clause – create terminal failure node. –Else – create non-terminal node S i. S =

4. Build a “semantic tree”. S... abcd S1S1 S 11 S 12 S 13 bcd S 21 S 22 cd S 31 S 32 S 33 dad S2S2 S3S3 S4S4 S 311 d x vvvvv xx v W(S) = Start with S as a root node. For each literal in O S, sprout a node from S. For x i, create a set S i by deleting all clauses in S containing x i. –If S i = Ø – create terminal success node. –Else, delete from clauses in S i x i and all literals preceding x i in O S. –If S i contains an empty clause – create terminal failure node. –Else – create non-terminal node S i.

Theoretical Properties Thm (why?): –W(S) is the set of prime implicants of S A symmetric algorithm can be used to obtain prime implicates if φ is in DNF (A)A –We don’t need that, though… (why?) May still be interested in finding the minimal sum. –Can use the algorithm again…

Approach II: Prime Implicates via Resolution Some resolution strategies are refutation complete, others in consequence finding. Deduction complete resolution strategies will find all prime implicates of formula φ in CNF. –[Tison, de Kleer, etc.]: use deduction complete resolution to generate prime implicates of φ.

Approach II: Prime Implicates via Resolution Brute force attempt: Start with Δ in clausal form. Repeatedly resolve pairs of clauses of Δ. –Add the result of resolution back to Δ, while removing all subsumed clauses.

Improving Efficiency: Tison’s Method (order propositions) Many redundant resolutions. –E.g. for 3 resolvable clauses α, β, γ there are 3 ways to resolve r(α, r(β, γ)), r(r(α, β), γ), and r(r(α, γ), β). –Number of ways to derive result grows quickly. Key idea [Tison]: place ordering on symbols, and iterate over these symbols in order. –Once all resolutions for a symbol are done, it is never necessary to resolve with respect to that symbol even for new resolution results produced later.

Improving Efficiency : Tison’s Method (order propositions) Consider 3 clauses: and order literals: a, b, c.

Algorithm Details S is the current set of clauses, and N is the current set of prime implicates. Gist: Pick one clause (C) at a time from S, and for every literal in C (in order) resolve with N. Add new clauses to N. S N

Algorithm Details: Iteration 2 S N Remove the next C = from S, add to N, and let Σ = {C}. For each literal x in C, create N x = clauses in N which resolve with x. Σ

Algorithm Details: Iteration 2 S N Σ For each literal x in C: Resolve each clause in Σ (which is still in N) with each clause in N x (which is still in N). For every new clause, discard it if it is subsumed by N U S, or remove any clauses it subsumes from N U S. Add it to N and Σ.

Algorithm Details: Iteration 3 S N Σ For each literal x in C: Resolve each clause in Σ (which is still in N) with each clause in N x (which is still in N). For every new clause, discard it if it is subsumed by N U S, or remove any clauses it subsumes from N U S. Add it to N and Σ. Considers literals in order avoiding many redundant resolution steps

Subsumption This algorithm (and many others) uses subsumption checking heavily. For clauses subsumption check is a subset check. –e.g. a+b subsumes a+b+c However, de Kleer can do better.

Subsumption For our algorithm, we are interested in three operations: 1.Check if clause x is subsumed by some clause in the Δ. 2.Add clause x to the Δ. 3.Remove all clauses from Δ which are subsumed by x.

Subsumption: Representation Order literals, turn clauses into lists of literals according to the chosen order. c+b+a d+b a+d Choose order : a,b,c,d dbdc ab Build a discrimination tree (trie). abaaba [[[[[[ bddbdd c ]]]] ] b+d a+d a+b+c

Subsumption: Checking dbd c ab Checking if clause x is subsumed by some clause in Δ can be done in one go. x = c + b + d [ b c d ] v b+d a+d a+b+c subsumed by b + d

Subsumption: Addition dbd c ab Adding a new (not subsumed) clause x to the knowledge base is easy. x = a + b + d [ a b d ] b+d a+d d a+b+d a+b+c

Subsumption: Deletion b c a b To remove clauses subsumed by clause x - search trie in left-to-right depth-first fashion removing all clauses containing x. x = b+d [ d ] d a+b+d a+b+c a+d d b+d b d

Summary So Far: Prime Implicates via Resolution (de Kleer’s + Tison) Part 1: Existing [Tison] idea for reducing unnecessary resolutions. Part 2: New idea: more efficient subsumption using the trie representation.

Improvement III: Kernel Resolution (del Val 1999) Recall Tison’s approach: ordered literals – fewer resolutions. and order: a, b, c. Idea: any clause C can be resolved only upon literals (kernel of C) appearing later in the ordering then literal used to obtain C. (a + c) ac skip or s(a+c) kernel or k(a+c) Write (a+c) as a[c] bd

Kernel Resolution In kernel resolution deductions every literal resolved upon is in its clause’s kernel.

Kernel Resolution: Example After C 10 clauses containing d are deleted (subsumed).

Limited Languages (del Val 1999) A clausal knowledge base Δ is written over some clausal language L. We may be interested in all implicates of Δ or only those that belong to some L T  L (L T implicates). Consequence finding is the task of finding L T implicates.

Skip-filtered Kernel Resolution What about consequence finding ( finding implicates or restricted language L T ) ? Extension of kernel resolution. –Produce resolvent C only if skip(C)  L T. C is called L T – acceptable. –For any implicate of Δ in L T, we produce a logically stronger implicate. Need a strategy to find all deductions for L T.

Search Strategy: Bucket Elimination Associate buckets with each variable x i : b[x i ]. Each bucket contains clauses C k containing x i only if resolving C k upon x i can generate L T – acceptable clause. Process buckets in order x 1 … x n. –Compute all resolvents on x i for i th bucket. –L T – acceptable resolvents are added in corresponding buckets.

Search Strategy: Incremental Saturation Idea: take one clause at a time, process it until no more unsubsumed L T – acceptable resolvents can be generated. Two sets of buckets: active and passive. –Put Δ into passive buckets. –For each clause of Δ Put in active buckets, use BE (over active/passive) When done, dump active buckets into passive.

del Val: Summary Extended the Tison’s approach to consequence finding. Approach is agnostic to search strategy of of L T - acceptable deductions. –Two search strategies (BE and IS) suggested. –IS may be preferred if Δ grows.

END

Minimal sum How do we find the minimum sum? Back to example: W(S) = Put it in a table [McCluskey, 1956]…

dcba→ bdP1P1 XXXX adP2P2 XXXX bcP3P3 XXXX abP4P4 XXXX acP5P5 XXXX acdP6P6 XX abdP7P7 XX bcdP8P8 XX McCluskey: Select the fewest rows such that each column has at least one cross in each selected row. Slagle: Use the “semantic tree” algorithm again. First, represent table as a product of factors: –R = (P 7 +P 8 )(P 5 +P 8 )(P 4 +P 5 )(P 6 +P 7 )(P 3 +P 6 )(P 3 +P 4 )(P 2 +P 5 )P 1 (P 1 +P 2 +P 4 +P 5 )P 2 (P 1 +P 3 )(P 1 +P 2 +P 3 +P 4 )

Minimal sum 1.Represent table as a product of factors. (P 7 +P 8 )(P 5 +P 8 )(P 4 +P 5 )(P 6 +P 7 )(P 3 +P 6 )(P 3 +P 4 )(P 2 +P 5 ) P 1 (P 1 +P 2 +P 4 +P 5 )P 2 (P 1 +P 3 )(P 1 +P 2 +P 3 +P 4 ) 2.Come up with ordering O R using heuristic. –E.g. lower weight (e.g. fewer literals) – earlier. 3.Use algorithm again to construct tree. –Each element of W(S R ) is a consistent table row set. –One of the elements corresponds to the minimal sum. –(P 1, P 2, P 3, P 5, P 7 ) or SRSR v vvvv v P1P1 P2P2 P3P3 P4P4 P5P5 P7P7 P8P8 P7P7 P6P6 P8P8 P4P4 P4P4 P8P8 P6P6 P6P6 P5P5 P8P8 P7P7 only success nodes shown

Slagle: Summary / Remarks An algorithm to compute all prime + some non-prime implicates. Use subsumption to get rid of non-primes. A heuristic attempt to find minimal sum. Any ordering O S works, practically frequency ordering generates fewer non-primes.

Appendix A: Slagle for prime implicate generation back S... ab beeac a x vv x x v dc a x x x a