Computing Minimal Unsat Core
How can we compute minimal unsat core of conjunctive T
formula without modifying theory solver?
Let φ be original unsatisfiable conjunct
Drop one atom from φ, call this φ
If φ is still unsat, φ := φ
Repeat this for every atom in φ
Clearly, resulting φ is minimal unsat core of original formula

I¸ıl Dillig,
s

CS780: Automated Logical Reasoning

Lecture 17: SMT Solvers and the DPPL(T ) Framework

24/44
Example
Let’s compute minimal unsat core of
φ : x = y ∧ f (x ) + z = 5 ∧ f (x ) = f (y) ∧ y ≤ 3
Drop x = y from φ. Is result unsat? no, so keep x = y
Drop f (x ) + z = 5. Is result unsat? yes, so drop f (x ) + z = 5
New formula: φ : x = y ∧ f (x ) = f (y) ∧ y ≤ 3
Drop f (x ) = f (y). Is result unsat? no, keep f (x ) = f (y)
Finally, drop y ≤ 3. Is result unsat? yes, drop y ≤ 3
What is minimal unsat core? x = y ∧ f (x ) = f (y)
I¸ıl Dillig,
s

CS780: Automated Logical Reasoning

Lecture 17: SMT Solvers and the DPPL(T ) Framework

25/44
How Many Sat Queries?

To compute minimal unsat core this way, how many
satisfiability queries do we need?
We make one sat query per literal, so if there are n literals, we
make n sat queries
However, we can do much better!
Idea: Instead of dropping one literal at a time, drop half the
literals, i.e., do binary search

I¸ıl Dillig,
s

CS780: Automated Logical Reasoning

Lecture 17: SMT Solvers and the DPPL(T ) Framework

26/44
Better Way to Find Minimal Unsat Core
Given conjunction of atoms a1 , . . . , an , partition them into
two sets of equal cardinality A and B
If conjunction of literals in A is UNSAT, recursively minimize
A and return result
Otherwise, if conjunction of literals in B is UNSAT,
recursively minimize B and return result
Interesting case: What if A and B are both sat on their own?
Idea: Minimize A assuming unsat core includes B

I¸ıl Dillig,
s

CS780: Automated Logical Reasoning

Lecture 17: SMT Solvers and the DPPL(T ) Framework

27/44
Better Way to Find Minimal Unsat Core, cont.
How do we minimize A assuming unsat core includes B ?
Every time we issue sat query for a subset of A, also conjoin
B because we assume B is part of unsat core
Let A∗ be the result of minimizing A under this assumption
Now, we know A∗ ∧ B is UNSAT, but not yet minimal. Why?
Because not everything in B is necessary to derive ⊥
Now, minimize B assuming A∗ is in unsat core
Let B ∗ be result of minimizing B
Claim: A∗ ∧ B ∗ is a minimal unsat core
I¸ıl Dillig,
s

CS780: Automated Logical Reasoning

Lecture 17: SMT Solvers and the DPPL(T ) Framework

28/44
Example
Let’s find minimal unsat core using binary search strategy:
φ : x = y ∧ f (x ) + z = 5 ∧ f (x ) = f (y) ∧ y ≤ 3
Partition into two sets:
A : x = y ∧ f (x ) + z = 5 B : f (x ) = f (y) ∧ y ≤ 3
Are A and B are satisfiable on their own? yes
Let’s minimize A assuming B is in unsat core
Partition A into sets A1 and A2 :
A1 : x = y

I¸ıl Dillig,
s

CS780: Automated Logical Reasoning

A2 : f (x ) + z = 5

Lecture 17: SMT Solvers and the DPPL(T ) Framework

29/44
Example, cont
A1 : x = y

A2 : f (x ) + z = 5 B : f (x ) = f (y) ∧ y ≤ 3

Is A1 unsat assuming B is in unsat core? Yes, A1 ∧ B unsat
Now, minimize A1 further assuming B is in unsat core
⇒ cannot be minimized further; A∗ : x = y
Next, minimize B assuming A∗ is in unsat core
Partition B into two sets:
B1 : f (x ) = f (y) B2 : y ≤ 3 A∗ : x = y
Is B1 unsat assuming A∗ is in unsat core? Yes
B1 cannot be minimized further, thus B ∗ : f (x ) = f (y)
Thus, minimal unsat core is A∗ ∧ B ∗ : x = y ∧ f (x ) = f (y)
I¸ıl Dillig,
s

CS780: Automated Logical Reasoning

Lecture 17: SMT Solvers and the DPPL(T ) Framework

30/44
Minimal Unsat Core Summary
Using binary search strategy, can find minimal unsat core with
log(n) sat queries to theory solver
Alternative approach: Rather than using theory solver as
“blackbox” augment it to provide minimal unsat core
,
Advantages of blackbox strategy:
1. Oblivious to what theory we use; works for any theory
2. Doesn’t require modifying decision procedure for theory

However, other strategy is potentially much more efficient
⇒ can take theory-specific knowledge into account

I¸ıl Dillig,
s

CS780: Automated Logical Reasoning

Lecture 17: SMT Solvers and the DPPL(T ) Framework

31/44

A Simple Algorithm for Minimal Unsatisfiable core

  • 1.
    Computing Minimal UnsatCore How can we compute minimal unsat core of conjunctive T formula without modifying theory solver? Let φ be original unsatisfiable conjunct Drop one atom from φ, call this φ If φ is still unsat, φ := φ Repeat this for every atom in φ Clearly, resulting φ is minimal unsat core of original formula I¸ıl Dillig, s CS780: Automated Logical Reasoning Lecture 17: SMT Solvers and the DPPL(T ) Framework 24/44
  • 2.
    Example Let’s compute minimalunsat core of φ : x = y ∧ f (x ) + z = 5 ∧ f (x ) = f (y) ∧ y ≤ 3 Drop x = y from φ. Is result unsat? no, so keep x = y Drop f (x ) + z = 5. Is result unsat? yes, so drop f (x ) + z = 5 New formula: φ : x = y ∧ f (x ) = f (y) ∧ y ≤ 3 Drop f (x ) = f (y). Is result unsat? no, keep f (x ) = f (y) Finally, drop y ≤ 3. Is result unsat? yes, drop y ≤ 3 What is minimal unsat core? x = y ∧ f (x ) = f (y) I¸ıl Dillig, s CS780: Automated Logical Reasoning Lecture 17: SMT Solvers and the DPPL(T ) Framework 25/44
  • 3.
    How Many SatQueries? To compute minimal unsat core this way, how many satisfiability queries do we need? We make one sat query per literal, so if there are n literals, we make n sat queries However, we can do much better! Idea: Instead of dropping one literal at a time, drop half the literals, i.e., do binary search I¸ıl Dillig, s CS780: Automated Logical Reasoning Lecture 17: SMT Solvers and the DPPL(T ) Framework 26/44
  • 4.
    Better Way toFind Minimal Unsat Core Given conjunction of atoms a1 , . . . , an , partition them into two sets of equal cardinality A and B If conjunction of literals in A is UNSAT, recursively minimize A and return result Otherwise, if conjunction of literals in B is UNSAT, recursively minimize B and return result Interesting case: What if A and B are both sat on their own? Idea: Minimize A assuming unsat core includes B I¸ıl Dillig, s CS780: Automated Logical Reasoning Lecture 17: SMT Solvers and the DPPL(T ) Framework 27/44
  • 5.
    Better Way toFind Minimal Unsat Core, cont. How do we minimize A assuming unsat core includes B ? Every time we issue sat query for a subset of A, also conjoin B because we assume B is part of unsat core Let A∗ be the result of minimizing A under this assumption Now, we know A∗ ∧ B is UNSAT, but not yet minimal. Why? Because not everything in B is necessary to derive ⊥ Now, minimize B assuming A∗ is in unsat core Let B ∗ be result of minimizing B Claim: A∗ ∧ B ∗ is a minimal unsat core I¸ıl Dillig, s CS780: Automated Logical Reasoning Lecture 17: SMT Solvers and the DPPL(T ) Framework 28/44
  • 6.
    Example Let’s find minimalunsat core using binary search strategy: φ : x = y ∧ f (x ) + z = 5 ∧ f (x ) = f (y) ∧ y ≤ 3 Partition into two sets: A : x = y ∧ f (x ) + z = 5 B : f (x ) = f (y) ∧ y ≤ 3 Are A and B are satisfiable on their own? yes Let’s minimize A assuming B is in unsat core Partition A into sets A1 and A2 : A1 : x = y I¸ıl Dillig, s CS780: Automated Logical Reasoning A2 : f (x ) + z = 5 Lecture 17: SMT Solvers and the DPPL(T ) Framework 29/44
  • 7.
    Example, cont A1 :x = y A2 : f (x ) + z = 5 B : f (x ) = f (y) ∧ y ≤ 3 Is A1 unsat assuming B is in unsat core? Yes, A1 ∧ B unsat Now, minimize A1 further assuming B is in unsat core ⇒ cannot be minimized further; A∗ : x = y Next, minimize B assuming A∗ is in unsat core Partition B into two sets: B1 : f (x ) = f (y) B2 : y ≤ 3 A∗ : x = y Is B1 unsat assuming A∗ is in unsat core? Yes B1 cannot be minimized further, thus B ∗ : f (x ) = f (y) Thus, minimal unsat core is A∗ ∧ B ∗ : x = y ∧ f (x ) = f (y) I¸ıl Dillig, s CS780: Automated Logical Reasoning Lecture 17: SMT Solvers and the DPPL(T ) Framework 30/44
  • 8.
    Minimal Unsat CoreSummary Using binary search strategy, can find minimal unsat core with log(n) sat queries to theory solver Alternative approach: Rather than using theory solver as “blackbox” augment it to provide minimal unsat core , Advantages of blackbox strategy: 1. Oblivious to what theory we use; works for any theory 2. Doesn’t require modifying decision procedure for theory However, other strategy is potentially much more efficient ⇒ can take theory-specific knowledge into account I¸ıl Dillig, s CS780: Automated Logical Reasoning Lecture 17: SMT Solvers and the DPPL(T ) Framework 31/44