Faster Extraction of High-Level Minimal Unsatisfiable Cores 1 Agenda Introduction and motivation Optimizations ◦ A. Partial Resolution ◦ B. Selective clause minimization ◦ C . Postponed IC-propagation ◦ E. Selective learning of IC-clauses ◦ G. Removal Strategy Experimental results Resolution vs. Selector variables 2 High-Level UC Given: 1. 2. A set of interesting constraints (IC) = { IC1, IC2 , …, ICm }, and The remainder The set is a high-level UC (HLUC) if is unsatisfiable HLUC is minimal (HLMUC) if removal of any IC makes satisfiable 3 Examples Abstraction-refinement in model checking [MA’03] ◦ Latches in core define the next abstraction. Compositional Formal Equivalence Checking (FEC) [CGLNR’10] ◦ Decompose the compared circuits to blocks. ◦ Assume inputs to blocks are the same ◦ Assumptions in the core need to be proved. 4 Traditional UC Extraction: Stage 1: Translate to Clauses An interesting constraint The remainder (the rest of the formula) Each small square is a propositional clause, e.g. (a + b’) 7 Traditional UC Extraction: Stage 2: Extract a Clause-Level UC An interesting constraint The remainder (the rest of the formula) Colored squares belong to the clause-level UC 8 Traditional UC Extraction: Stage 3: Map UC back to ICs An interesting constraint The remainder (the rest of the formula) The UC contains three interesting constraints! 9 A Mismatch between Mainstream Research and the Needs of Real-World Applications Real-world applications: reduce # interesting constraints in the core ◦ Latches/gates for abstraction refinement ◦ Assumptions for compositional FEC Vast majority of existing algorithms: reduce # of clauses in the core ◦ 19/21 papers on UC extraction only consider clause-level UC extraction 10 Small/Minimal Clause-Level UC Small/Minimal High-Level UC A small clause-level UC, but the high-level UC is the largest possible: A large clause-level UC, but the high-level UC is empty: 11 Resolution Refutation C22 C17 Legend: C2 C19 C18 C11 C10 C1 C23=() C3 Input clauses C4 C21 C5 C16 C15 C14 C13 C12 C20 C6 C7 C8 C9 Derived clauses 12 Resolution Refutation C22 C17 Legend: C2 C19 C18 C11 C10 C1 C23=() C3 Input clauses C4 C21 C5 C16 C15 C14 C13 C12 C20 C6 C7 C8 C9 Derived clauses Empty clause cone: { C4 C5 C6 C7 C13 C14 C19 C20 C23 } Unsat Core: { C4 C5 C6 C7 } 13 Resolution Refutation C22 C17 Legend: C19 C18 C11 C10 C1 C23=() C2 C3 C4 Empty Clause Cone C21 C5 C16 C15 C14 C13 C12 C20 C6 C7 C8 C9 Unsat Core Empty clause cone: { C4 C5 C6 C7 C13 C14 C19 C20 C23 } Unsat Core: { C4 C5 C6 C7 } 14 Resolution with ICs C22 C17 C23=() C11 C10 C19 C18 C1 C2 C3 Legend: Input Clauses Derived Clauses C4 IC1 C21 C5 IC2 C16 C15 C14 C13 C12 C20 C6 C7 C8 C9 Remainder Derived clauses 15 Resolution with ICs C22 C17 C23=() C11 C10 C19 C18 C3 C4 C5 C16 C15 C14 C13 C12 C21 C20 C1 C2 Legend: Input Clauses IC1 IC2 Remainder Derived Clauses IC1 IC2 Remainder C6 C7 C8 C9 16 HLUC C22 C17 C2 Legend: C19 C18 C11 C10 C1 C23=() C3 IC1 IC2 C4 C21 C5 C16 C15 C14 C13 C12 C20 C6 C7 C8 C9 Remainder HLUC: { IC2 } 17 HLMUC Algorithm [N’10] - remainder, - ICs Solve Æ UNSAT Initialization: ’ = = ’ = HLUC SAT Assumption: Æ is UNSAT = ’ = \ ICi No unchecked ICs Remove one ICi ϵ that wasn’t already removed 18 Contribution of this Work Seven optimizations for single HLMUC. ◦ improved run time and smaller HLMUC Comparison between resolution and selector variables solvers. 19 A. Partial Resolution Observations: ◦ IC-clauses usually between 5-15% of the problem clauses ◦ We do not need the whole resolution table Suggestion: ◦ Keep only clauses relevant to IC resolutions Result: ◦ The size of the resolution graph reduced ◦ Very effective on large CNFs 20 A. Partial Resolution C22 C17 Legend: C19 C18 C11 C10 C1 C23=() C2 C3 IC1 IC2 C4 C21 C5 C16 C15 C14 C13 C12 C20 C6 C7 C8 C9 Remainder 21 A. Partial Resolution C22 C17 Legend: C19 C18 C11 C10 C1 C23=() C2 C3 IC1 IC2 C4 C21 C5 C16 C15 C14 C13 C12 C20 C6 C7 C8 C9 Not Needed 22 A. Partial Resolution C22 C23=() C17 C20 C21 C1 Legend: C16 C15 C10 C7 IC1 C8 IC2 23 A. Partial Resolution - Summary C22 C23=() C17 C20 C21 C1 Legend: C16 C15 C10 C7 IC1 C8 IC2 Keep only the needed resolutions 24 B. Selective clause minimization Technique for shrinking conflict clauses The algorithm is based on traversing the resolution DAG backward from each literal in the learned clause The problem: ◦ May turn a non-IC-clause into a shorter IC-clause 25 B. Selective clause minimization v c = (¬v c = (¬v c = (¬v c = (¬v c1= (¬ 1 2 2 3 4 4 5 5 1 v) Çv ) Çv ) Çv ) Ç ¬v Ç ¬v Ç 2 3 5 6 3 4Ç v ¬ 6) 26 B. Selective clause minimization v c = (¬v c = (¬v c = (¬v c = (¬v c1= (¬ 1 2 2 3 4 4 5 5 1 v) Çv ) Çv ) Çv ) Ç ¬v Ç ¬v Ç 2 v1 c1 v2 c2 v3 3 5 6 3 4Ç v ¬ 6) 27 B. Selective clause minimization v c = (¬v c = (¬v c = (¬v c = (¬v c1= (¬ 1 2 2 3 4 4 5 5 1 v) Çv ) Çv ) Çv ) Ç ¬v Ç ¬v Ç 2 c1 v1 v2 3 5 v4 6 3 4Ç v c2 v3 c5 c5 c5 ¬v6 c3 v5 c4 v6 ¬ 6) 28 B. Selective clause minimization v c = (¬v c = (¬v c = (¬v c = (¬v c1= (¬ 1 2 2 3 4 4 5 5 1 v) Çv ) Çv ) Çv ) Ç ¬v Ç ¬v Ç 2 c1 v1 v2 3 5 v4 6 3 4Ç v c2 v3 c5 c5 c5 ¬v6 c3 v5 c4 v6 ¬ 6) 29 B. Selective clause minimization v c = (¬v c = (¬v c = (¬v c = (¬v c1= (¬ 1 2 2 3 4 4 5 5 1 v) Çv ) Çv ) Çv ) Ç ¬v Ç ¬v Ç 2 c1 v1 v2 3 5 v4 6 3 4Ç v c2 v3 c5 c5 c5 ¬v6 c3 v5 c4 v6 ¬ 6) 1-UIP based conflict analysis: c6= (¬ v 1 Ǭ v Ç ¬v ) 3 4 30 B. Selective clause minimization v Çv ) c = (¬v Ç v ) c1= (¬ 2 1 2 2 v v 1 3 ¬v 3 ¬v 1 3 31 B. Selective clause minimization v Çv ) c = (¬v Ç v ) c1= (¬ 1 2 c6= (¬ 2 2 v 1 v v 1 ¬v 3 3 ¬v 1 3 Ǭ v Ç ¬v ) 3 4 c6= (¬ v 1 v Ç ¬ 4) 32 B. Selective clause minimization v c = (¬v c = (¬v c = (¬v c = (¬v c = (¬v c1= (¬ 1 2 2 3 4 4 5 5 1 6 1 v) Çv ) Çv ) Çv ) Ç ¬v Ç ¬v Ç ¬v ) Ç 2 c1 v1 v2 3 5 v4 6 3 4Ç v c2 v3 c5 c5 c5 ¬v6 c3 v5 c4 v6 ¬ 6) 4 33 B. Selective clause minimization v c = (¬v c = (¬v c = (¬v c = (¬v c1= (¬ 1 2 2 3 4 4 5 5 1 v) Ç v ) (IC) Çv ) Çv ) Ç ¬v Ç ¬v Ç 2 c1 v1 v2 3 5 v4 6 3 4Ç v c2 v3 c5 c5 c5 ¬v6 c3 v5 c4 v6 ¬ 6) 34 B. Selective clause minimization v Çv ) c = (¬v Ç v ) (IC) c1= (¬ 2 1 2 2 3 With minimization using c2: c6= (¬ v 1 v Ç ¬ 4) (IC) Without minimization: c6= (¬ v 1 Ǭ v Ç ¬v ) (remainder) 3 4 35 B. Selective clause minimization Suggested solution: ◦ Disable minimization if it adds dependency on IC-clause. v v Ç ¬v ) instead of c = (¬v c6= (¬ Disabling minimization reduces #derived IC-clauses reduces #IC-clauses in UC and finds HLMUC faster 1 Ǭ 3 4 6 1 v Ç ¬ 4) 36 C. Postpone IC-propagations Change BCP order Run BCP Conflict Analyze Conflict no implications Next Operations 37 C. Postpone IC-propagations Change BCP order Run BCP over non ICclause found implication Conflict no implications Propagate a single ICclause Analyze Conflict Conflict no implications Next Operations 38 C. Postpone IC-propagations Increase chances to get conflicts in remainder Decreases number of derived IC-clauses Decreases number of IC-clauses in UC. 39 E. Selective Learning implication IC-clause implication @2 @2 @5 @5 @5 @5 @5 @5 @5 @5 @5 @3 @5 X @3 40 E. Selective Learning implication IC-clause implication @2 @2 @5 @5 @5 @5 @5 @5 @5 @5 @5 @3 @5 X @3 41 E. Selective Learning implication IC-clause implication @2 @2 @5 @5 @5 @5 @5 @5 @5 @5 @5 @3 @5 X @3 Learnt clause should be marked “IC-clause” 42 E. Selective Learning We refrain from learning IC-clauses Instead, ◦ do not learn it ◦ learn a (non-asserting) remainder clause ◦ make a decision How ? 43 E. Selective Learning How ? ◦ Treat the last IC-clause implication as decision ◦ Perform new 1-UIP conflict analysis ◦ The learnt clause is ‘remainder’ 44 E. Selective Learning implication IC-clause implication @2 @2 @5 @5 @5 @5 @5 @5 @5 @5 @5 @3 @5 X @3 45 E. Selective Learning implication IC-clause implication @2 @2 @5 @5 @5 @6 @5 @5 @5 @6 @5 @3 @6 X @3 46 E. Selective Learning implication IC-clause implication @2 @2 @5 @5 @5 @6 @5 @5 @5 @6 @5 @3 @6 X @3 47 E. Selective Learning implication IC-clause implication @2 @2 @5 @5 @5 @6 @5 @5 @5 @6 @5 @3 @6 X @3 48 G. Removal Strategy Recall: In each iteration one IC is chosen to be removed. Solve Æ UNSAT ’ = HLUC SAT = ’ = \ ICi No unchecked ICs Remove one ICi ϵ that wasn’t already removed G. Removal Strategy What is the effect of the removal order? Which IC should we remove first? 50 G. Removal Strategy Criterion: #clauses in UC Choose the one ◦ that contains least clauses in UC If UNSAT (not necessary), will converge faster If UNSAT (not necessary), will likely allow further removals ◦ that contains most clauses in UC If SAT (necessary), clauses are added as ‘remainder’ fast 51 Experimental Results Benchmark Set: ◦ ◦ ◦ ◦ Industrial set of problems from Intel Average #clauses = 2,572,270 Average #ICs = 3804 Average #IC-clauses = 96568 (6% of #clauses) Machines: ◦ Intel® Xeon® 4Ghz 32Gb of memory 52 Experimental Results 3600 3000 Picomus 2400 N'10 A AB 1800 ABC ABCE ABCDE 1200 ABCDEF ABCDEFG 600 0 1 11 21 31 41 51 61 71 81 91 53 Experimental Results (zoom) 3600 3000 2400 N'10 A AB ABC 1800 ABCE ABCDE ABCDEF 1200 ABCDEFG 600 0 60 65 70 75 80 85 90 95 100 54 Experimental Results N'10 vs. Optimized 3600 3000 A-F 2400 1800 1200 600 0 0 600 1200 1800 2400 3000 3600 Nadel'10 Improves N’10: ◦ Time: 44913 sec vs. 20453 sec (x2.19 speedup) ◦ HLMUC size: 18995 vs. 5090 (73.2% reduction) 55 Resolution vs. Selector variables Main cause for performance gap: clause minimization. ◦ When clause minimization is off: similar results (time + size of HLMUC). Selector variables: minimization does not turn non-ICclause into IC-clause Selector variable prevents the minimization 56 Resolution vs. Selector variables v c = (¬v c = (¬v c = (¬v c = (¬v c1= (¬ 1 2 2 3 4 4 5 5 1 v) Ç v ) (IC) Çv ) Çv ) Ç ¬v Ç ¬v Ç 2 c1 v1 v2 3 5 v4 6 3 4Ç v c2 v3 c5 c5 c5 ¬v6 c3 v5 c4 v6 ¬ 6) 57 Resolution vs. Selector variables s v c = (¬v c = (¬v c = (¬v c = (¬v c1= (¬ 1 2 2 3 4 4 5 5 1 v) Ç v Ç ¬s) (IC) Çv ) Çv ) Ç ¬v Ç ¬v Ç ¬v ) Ç 2 c1 v1 v2 3 5 6 3 4 v4 c2 v3 c5 c5 c5 ¬v6 c3 v5 c4 v6 6 Selector variables are pure cannot be removed every IC-clause have at least one 58 Resolution vs. Selector variables Resolution-based: v Çv ) c = (¬v Ç v ) (IC) c1= (¬ 2 1 2 2 v v 1 v Çv ) c = (¬v Ç v Ç ¬s) (IC) 2 ¬v 3 ¬v 1 3 Cannot be resolved away Selector-variables-based: c1= (¬ 3 1 2 2 3 v v 1 3 59 Resolution vs. Selector variables 3600 3000 2400 Selector-based N'10 1800 A AB ABCDEF 1200 600 0 1 11 21 31 41 51 61 71 81 91 60 Resolution vs. Selector variables 3600 3000 2400 Selector-based N'10 1800 A AB ABCDEF 1200 600 0 60 70 80 90 61 Resolution vs. Selector variables Selector-variables vs. Resolution A-F 3600 3000 A-F 2400 1800 1200 600 0 0 600 1200 1800 2400 3000 3600 Selector-variables Comparison to selector-variables: ◦ Time: 28032 sec vs. 20453 sec (x1.37 speedup) ◦ HLMUC size: 12090 vs. 5090 (57.8% reduction) 62 Thank You! 63