Complexity of Abduction in SL
The Complexity of Abduction for Separated Heap Abstractions Nikos - - PowerPoint PPT Presentation
The Complexity of Abduction for Separated Heap Abstractions Nikos - - PowerPoint PPT Presentation
Complexity of Abduction in SL The Complexity of Abduction for Separated Heap Abstractions Nikos Gorogiannis Max Kanovich Peter OHearn Queen Mary University of London July 13th, 2011 Complexity of Abduction in SL Motivation Complexity of
Complexity of Abduction in SL
Motivation
Complexity of Abduction in SL
Motivation
◮ Calcagno, Distefano, O’Hearn, Yang propose (POPL’09)
Compositional shape analysis by means of bi-abduction.
Complexity of Abduction in SL
Motivation
◮ Calcagno, Distefano, O’Hearn, Yang propose (POPL’09)
Compositional shape analysis by means of bi-abduction.
◮ Further papers extend the analysis, apply it to other domains.
Complexity of Abduction in SL
Motivation
◮ Calcagno, Distefano, O’Hearn, Yang propose (POPL’09)
Compositional shape analysis by means of bi-abduction.
◮ Further papers extend the analysis, apply it to other domains. ◮ The published algorithms for abduction are incomplete.
Complexity of Abduction in SL
Motivation
◮ Calcagno, Distefano, O’Hearn, Yang propose (POPL’09)
Compositional shape analysis by means of bi-abduction.
◮ Further papers extend the analysis, apply it to other domains. ◮ The published algorithms for abduction are incomplete. ◮ Is there a complete algorithm? (is the problem decidable?).
Complexity of Abduction in SL
Motivation
◮ Calcagno, Distefano, O’Hearn, Yang propose (POPL’09)
Compositional shape analysis by means of bi-abduction.
◮ Further papers extend the analysis, apply it to other domains. ◮ The published algorithms for abduction are incomplete. ◮ Is there a complete algorithm? (is the problem decidable?). ◮ If yes, what is the complexity for a common abstract domain?
Complexity of Abduction in SL Outline
Separation Logic Abduction Results & Conclusions
Complexity of Abduction in SL Separation Logic
A Heap of Problems
Complexity of Abduction in SL Separation Logic
A Heap of Problems
{ ls(x, 0) ∧ ls(y, 0) } append(x,y) { ls(x, 0) }
Complexity of Abduction in SL Separation Logic
A Heap of Problems
{ ls(x, 0) ∧ ls(y, 0) } append(x,y) { ls(x, 0) } How do we prevent sharing in the precondition?
Complexity of Abduction in SL Separation Logic
A Heap of Problems
{ ls(x, 0) ∧ ls(y, 0) } append(x,y) { ls(x, 0) } How do we prevent sharing in the precondition?
◮ Reachability?
∀z.reach(x, z) ⇒ ¬reach(y, z)∧ ∀w.reach(y, w) ⇒ ¬reach(x, w)∧ ls(x, 0) ∧ ls(y, 0)
Complexity of Abduction in SL Separation Logic
A Heap of Problems
{ ls(x, 0) ∧ ls(y, 0) } append(x,y) { ls(x, 0) } How do we prevent sharing in the precondition?
◮ Reachability?
∀z.reach(x, z) ⇒ ¬reach(y, z)∧ ∀w.reach(y, w) ⇒ ¬reach(x, w)∧ ls(x, 0) ∧ ls(y, 0)
◮ Separation Logic?
{ ls(x, 0) ∗ ls(y, 0) } append(x,y) { ls(x, 0) }
Complexity of Abduction in SL Separation Logic
Heaps and Stars
Complexity of Abduction in SL Separation Logic
Heaps and Stars
{ ls(x, 0) ∗ ls(y, 0) } append(x,y) { ls(x, 0) }
Complexity of Abduction in SL Separation Logic
Heaps and Stars
{ ls(x, 0) ∗ ls(y, 0) } append(x,y) { ls(x, 0) } Suppose for a model, x = 1 and y = 4.
Complexity of Abduction in SL Separation Logic
Heaps and Stars
{ ls(x, 0) ∗ ls(y, 0) } append(x,y) { ls(x, 0) } Suppose for a model, x = 1 and y = 4. h 1 2 3 4 5
Complexity of Abduction in SL Separation Logic
Heaps and Stars
{ ls(x, 0) ∗ ls(y, 0) } append(x,y) { ls(x, 0) } Suppose for a model, x = 1 and y = 4. h 1 2 3 4 5 − → h1 1 2 3 h2 4 5
Complexity of Abduction in SL Separation Logic
Heaps and Stars
{ ls(x, 0) ∗ ls(y, 0) } append(x,y) { ls(x, 0) } Suppose for a model, x = 1 and y = 4. h 1 2 3 4 5 − → h1 1 2 3 h2 4 5 satisfies ls(x, 0) satisfies ls(y, 0)
Complexity of Abduction in SL Separation Logic
Semantics
Complexity of Abduction in SL Separation Logic
Semantics
◮ Stack s : Var → Values.
Complexity of Abduction in SL Separation Logic
Semantics
◮ Stack s : Var → Values. ◮ Heap h : Addresses →f Values.
Complexity of Abduction in SL Separation Logic
Semantics
◮ Stack s : Var → Values. ◮ Heap h : Addresses →f Values. ◮ (s, h) |
= true always.
Complexity of Abduction in SL Separation Logic
Semantics
◮ Stack s : Var → Values. ◮ Heap h : Addresses →f Values. ◮ (s, h) |
= true always.
◮ (s, h) |
= x = y iff s(x) = s(y) (same for =).
Complexity of Abduction in SL Separation Logic
Semantics
◮ Stack s : Var → Values. ◮ Heap h : Addresses →f Values. ◮ (s, h) |
= true always.
◮ (s, h) |
= x = y iff s(x) = s(y) (same for =).
◮ (s, h) |
= A ∧ B as usual.
Complexity of Abduction in SL Separation Logic
Semantics
◮ Stack s : Var → Values. ◮ Heap h : Addresses →f Values. ◮ (s, h) |
= true always.
◮ (s, h) |
= x = y iff s(x) = s(y) (same for =).
◮ (s, h) |
= A ∧ B as usual.
◮ (s, h) |
= emp iff h = ∅.
Complexity of Abduction in SL Separation Logic
Semantics
◮ Stack s : Var → Values. ◮ Heap h : Addresses →f Values. ◮ (s, h) |
= true always.
◮ (s, h) |
= x = y iff s(x) = s(y) (same for =).
◮ (s, h) |
= A ∧ B as usual.
◮ (s, h) |
= emp iff h = ∅.
◮ (s, h) |
= x →y iff
Complexity of Abduction in SL Separation Logic
Semantics
◮ Stack s : Var → Values. ◮ Heap h : Addresses →f Values. ◮ (s, h) |
= true always.
◮ (s, h) |
= x = y iff s(x) = s(y) (same for =).
◮ (s, h) |
= A ∧ B as usual.
◮ (s, h) |
= emp iff h = ∅.
◮ (s, h) |
= x →y iff
◮ s(x) = u, s(y) = v
Complexity of Abduction in SL Separation Logic
Semantics
◮ Stack s : Var → Values. ◮ Heap h : Addresses →f Values. ◮ (s, h) |
= true always.
◮ (s, h) |
= x = y iff s(x) = s(y) (same for =).
◮ (s, h) |
= A ∧ B as usual.
◮ (s, h) |
= emp iff h = ∅.
◮ (s, h) |
= x →y iff
◮ s(x) = u, s(y) = v ◮ h = {(u, v)}.
Complexity of Abduction in SL Separation Logic
More semantics
Complexity of Abduction in SL Separation Logic
More semantics
◮ (s, h) |
= A ∗ B iff there are hA, hB such that
Complexity of Abduction in SL Separation Logic
More semantics
◮ (s, h) |
= A ∗ B iff there are hA, hB such that
◮ (s, hA) |
= A
Complexity of Abduction in SL Separation Logic
More semantics
◮ (s, h) |
= A ∗ B iff there are hA, hB such that
◮ (s, hA) |
= A
◮ (s, hB) |
= B
Complexity of Abduction in SL Separation Logic
More semantics
◮ (s, h) |
= A ∗ B iff there are hA, hB such that
◮ (s, hA) |
= A
◮ (s, hB) |
= B
◮ hA and hB are domain-disjoint and h = hA ∪ hB.
Complexity of Abduction in SL Separation Logic
More semantics
◮ (s, h) |
= A ∗ B iff there are hA, hB such that
◮ (s, hA) |
= A
◮ (s, hB) |
= B
◮ hA and hB are domain-disjoint and h = hA ∪ hB.
◮ (s, h) |
= ls(x, y) iff
Complexity of Abduction in SL Separation Logic
More semantics
◮ (s, h) |
= A ∗ B iff there are hA, hB such that
◮ (s, hA) |
= A
◮ (s, hB) |
= B
◮ hA and hB are domain-disjoint and h = hA ∪ hB.
◮ (s, h) |
= ls(x, y) iff
◮ (s, h) |
= x = y ∧ x →y, or,
Complexity of Abduction in SL Separation Logic
More semantics
◮ (s, h) |
= A ∗ B iff there are hA, hB such that
◮ (s, hA) |
= A
◮ (s, hB) |
= B
◮ hA and hB are domain-disjoint and h = hA ∪ hB.
◮ (s, h) |
= ls(x, y) iff
◮ (s, h) |
= x = y ∧ x →y, or,
◮ (s, h) |
= x = y ∧ ∃z. (x →z ∗ ls(z, y)).
Complexity of Abduction in SL Separation Logic
More semantics
◮ (s, h) |
= A ∗ B iff there are hA, hB such that
◮ (s, hA) |
= A
◮ (s, hB) |
= B
◮ hA and hB are domain-disjoint and h = hA ∪ hB.
◮ (s, h) |
= ls(x, y) iff
◮ (s, h) |
= x = y ∧ x →y, or,
◮ (s, h) |
= x = y ∧ ∃z. (x →z ∗ ls(z, y)).
I.e., non-empty, acyclic list segments.
Complexity of Abduction in SL Separation Logic
A Bit More on the Semantics
What does it mean for (s, h) | = A ∗ true to be true?
Complexity of Abduction in SL Separation Logic
A Bit More on the Semantics
What does it mean for (s, h) | = A ∗ true to be true? That there is a heap hA ⊆ h such that (s, hA) | = A.
Complexity of Abduction in SL Separation Logic
A Bit More on the Semantics
What does it mean for (s, h) | = A ∗ true to be true? That there is a heap hA ⊆ h such that (s, hA) | = A. We work with symbolic heaps, e.g.,
Complexity of Abduction in SL Separation Logic
A Bit More on the Semantics
What does it mean for (s, h) | = A ∗ true to be true? That there is a heap hA ⊆ h such that (s, hA) | = A. We work with symbolic heaps, e.g., x = y ∧ w = z ∧ x →y ∗ ls(y, x)
Complexity of Abduction in SL Abduction
Extracting Preconditions from Code
{emp } *x = 0;
Complexity of Abduction in SL Abduction
Extracting Preconditions from Code
{emp } *x = 0;
◮ Suppose the current state is emp.
Complexity of Abduction in SL Abduction
Extracting Preconditions from Code
{emp } *x = 0;
◮ Suppose the current state is emp. ◮ The next command is
*x = 0 .
Complexity of Abduction in SL Abduction
Extracting Preconditions from Code
{emp } *x = 0;
◮ Suppose the current state is emp. ◮ The next command is
*x = 0 .
◮ Its precondition is x →x′ ∗ true.
Complexity of Abduction in SL Abduction
Extracting Preconditions from Code
{emp } *x = 0;
◮ Suppose the current state is emp. ◮ The next command is
*x = 0 .
◮ Its precondition is x →x′ ∗ true. ◮ Is it true that emp x →x′ ∗ true?
Complexity of Abduction in SL Abduction
Extracting Preconditions from Code
{emp } *x = 0;
◮ Suppose the current state is emp. ◮ The next command is
*x = 0 .
◮ Its precondition is x →x′ ∗ true. ◮ Is it true that emp x →x′ ∗ true? ◮ No, but emp ∗ x →x′ x →x′ ∗ true.
Complexity of Abduction in SL Abduction
Extracting Preconditions from Code
{emp ∗ x →x′} *x = 0;
◮ Suppose the current state is emp. ◮ The next command is
*x = 0 .
◮ Its precondition is x →x′ ∗ true. ◮ Is it true that emp x →x′ ∗ true? ◮ No, but emp ∗ x →x′ x →x′ ∗ true.
Complexity of Abduction in SL Abduction
Abduction
What is abduction in AI?
Complexity of Abduction in SL Abduction
Abduction
What is abduction in AI?
◮ Given A, B such that A B,
Complexity of Abduction in SL Abduction
Abduction
What is abduction in AI?
◮ Given A, B such that A B, ◮ find X such that A, X B.
Complexity of Abduction in SL Abduction
Abduction
What is abduction in AI?
◮ Given A, B such that A B, ◮ find X such that A, X B. ◮ But, ignore trivial solutions such as ⊥ or A → B.
Complexity of Abduction in SL Abduction
Abduction
What is abduction in AI?
◮ Given A, B such that A B, ◮ find X such that A, X B. ◮ But, ignore trivial solutions such as ⊥ or A → B.
What is Abduction in Separation Logic?
Complexity of Abduction in SL Abduction
Abduction
What is abduction in AI?
◮ Given A, B such that A B, ◮ find X such that A, X B. ◮ But, ignore trivial solutions such as ⊥ or A → B.
What is Abduction in Separation Logic?
◮ Given formulae A, B such that A B.
Complexity of Abduction in SL Abduction
Abduction
What is abduction in AI?
◮ Given A, B such that A B, ◮ find X such that A, X B. ◮ But, ignore trivial solutions such as ⊥ or A → B.
What is Abduction in Separation Logic?
◮ Given formulae A, B such that A B. ◮ Find symbolic heap X such that
Complexity of Abduction in SL Abduction
Abduction
What is abduction in AI?
◮ Given A, B such that A B, ◮ find X such that A, X B. ◮ But, ignore trivial solutions such as ⊥ or A → B.
What is Abduction in Separation Logic?
◮ Given formulae A, B such that A B. ◮ Find symbolic heap X such that
◮ A ∗ X B,
Complexity of Abduction in SL Abduction
Abduction
What is abduction in AI?
◮ Given A, B such that A B, ◮ find X such that A, X B. ◮ But, ignore trivial solutions such as ⊥ or A → B.
What is Abduction in Separation Logic?
◮ Given formulae A, B such that A B. ◮ Find symbolic heap X such that
◮ A ∗ X B, ◮ and A ∗ X is consistent.
Complexity of Abduction in SL Abduction
Examples of Abduction
Complexity of Abduction in SL Abduction
Examples of Abduction
emp ∗
- x →0
Complexity of Abduction in SL Abduction
Examples of Abduction
emp ∗ x →0
- x →0
Complexity of Abduction in SL Abduction
Examples of Abduction
emp ∗ x →0
- x →0
y →0 ∗
- x →0
Complexity of Abduction in SL Abduction
Examples of Abduction
emp ∗ x →0
- x →0
y →0 ∗ x = y
- x →0
Complexity of Abduction in SL Abduction
Examples of Abduction
emp ∗ x →0
- x →0
y →0 ∗ x = y
- x →0
y →0 ∗
- x →0 ∗ true
Complexity of Abduction in SL Abduction
Examples of Abduction
emp ∗ x →0
- x →0
y →0 ∗ x = y
- x →0
y →0 ∗ x →0
- x →0 ∗ true
Complexity of Abduction in SL Abduction
Examples of Abduction
emp ∗ x →0
- x →0
y →0 ∗ x = y
- x →0
y →0 ∗ x →0
- x →0 ∗ true
x →y ∗
- ls(x, z)
Complexity of Abduction in SL Abduction
Examples of Abduction
emp ∗ x →0
- x →0
y →0 ∗ x = y
- x →0
y →0 ∗ x →0
- x →0 ∗ true
x →y ∗ y = z ∧ z = x
- ls(x, z)
Complexity of Abduction in SL Abduction
Examples of Abduction
emp ∗ x →0
- x →0
y →0 ∗ x = y
- x →0
y →0 ∗ x →0
- x →0 ∗ true
x →y ∗ y = z ∧ z = x
- ls(x, z)
x →y ∗
- ls(x, z)
Complexity of Abduction in SL Abduction
Examples of Abduction
emp ∗ x →0
- x →0
y →0 ∗ x = y
- x →0
y →0 ∗ x →0
- x →0 ∗ true
x →y ∗ y = z ∧ z = x
- ls(x, z)
x →y ∗ (z = x ∧ ls(y, z))
- ls(x, z)
Complexity of Abduction in SL Abduction
Examples of Abduction
emp ∗ x →0
- x →0
y →0 ∗ x = y
- x →0
y →0 ∗ x →0
- x →0 ∗ true
x →y ∗ y = z ∧ z = x
- ls(x, z)
x →y ∗ (z = x ∧ ls(y, z))
- ls(x, z)
ls(x, z) ∗ ls(y, z) ∗
- ls(x, w) ∗ ls(y, w)
Complexity of Abduction in SL Abduction
Examples of Abduction
emp ∗ x →0
- x →0
y →0 ∗ x = y
- x →0
y →0 ∗ x →0
- x →0 ∗ true
x →y ∗ y = z ∧ z = x
- ls(x, z)
x →y ∗ (z = x ∧ ls(y, z))
- ls(x, z)
ls(x, z) ∗ ls(y, z) ∗ z = w
- ls(x, w) ∗ ls(y, w)
Complexity of Abduction in SL Results & Conclusions
Results
Complexity of Abduction in SL Results & Conclusions
Results
Abduction is decidable (interpolation-like result).
Complexity of Abduction in SL Results & Conclusions
Results
Abduction is decidable (interpolation-like result). Domain “∗true” / ∈ RHS “∗true” ∈ RHS → →, ls
Complexity of Abduction in SL Results & Conclusions
Results
Abduction is decidable (interpolation-like result). Domain “∗true” / ∈ RHS “∗true” ∈ RHS → NP-complete →, ls
Complexity of Abduction in SL Results & Conclusions
Results
Abduction is decidable (interpolation-like result). Domain “∗true” / ∈ RHS “∗true” ∈ RHS → NP-complete PTIME →, ls
Complexity of Abduction in SL Results & Conclusions
Results
Abduction is decidable (interpolation-like result). Domain “∗true” / ∈ RHS “∗true” ∈ RHS → NP-complete PTIME →, ls NP-complete
Complexity of Abduction in SL Results & Conclusions
Results
Abduction is decidable (interpolation-like result). Domain “∗true” / ∈ RHS “∗true” ∈ RHS → NP-complete PTIME →, ls NP-complete NP-complete
Complexity of Abduction in SL Results & Conclusions
Conclusions
◮ The abduction problem is NP-complete.
Complexity of Abduction in SL Results & Conclusions
Conclusions
◮ The abduction problem is NP-complete. ◮ Lower bounds should carry over to other heap abstractions.
Complexity of Abduction in SL Results & Conclusions
Conclusions
◮ The abduction problem is NP-complete. ◮ Lower bounds should carry over to other heap abstractions. ◮ Cases occuring in practice can be usually treated in polytime.
Complexity of Abduction in SL Results & Conclusions