Download presentation

Presentation is loading. Please wait.

Published byRosaline Sanders Modified about 1 year ago

1
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

2
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].

3
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)

4
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.

5
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. –

6
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.

7
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.

8
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.

9
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 –

10
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.

11
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 =

12
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.

13
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…

14
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 φ.

15
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.

16
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.

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

18
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

19
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. Σ

20
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 Σ.

21
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

22
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.

23
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.

24
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

25
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

26
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

27
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

28
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.

29
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

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

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

32
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.

33
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.

34
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.

35
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.

36
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.

37
END

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

39
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 )

40
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

41
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.

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

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google