The Complexity of Abduction for Separated Heap Abstractions Nikos - - PowerPoint PPT Presentation

the complexity of abduction for separated heap
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Complexity of Abduction in SL

The Complexity of Abduction for Separated Heap Abstractions

Nikos Gorogiannis Max Kanovich Peter O’Hearn

Queen Mary University of London

July 13th, 2011

slide-2
SLIDE 2

Complexity of Abduction in SL

Motivation

slide-3
SLIDE 3

Complexity of Abduction in SL

Motivation

◮ Calcagno, Distefano, O’Hearn, Yang propose (POPL’09)

Compositional shape analysis by means of bi-abduction.

slide-4
SLIDE 4

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.

slide-5
SLIDE 5

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.

slide-6
SLIDE 6

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

slide-7
SLIDE 7

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?

slide-8
SLIDE 8

Complexity of Abduction in SL Outline

Separation Logic Abduction Results & Conclusions

slide-9
SLIDE 9

Complexity of Abduction in SL Separation Logic

A Heap of Problems

slide-10
SLIDE 10

Complexity of Abduction in SL Separation Logic

A Heap of Problems

{ ls(x, 0) ∧ ls(y, 0) } append(x,y) { ls(x, 0) }

slide-11
SLIDE 11

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?

slide-12
SLIDE 12

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)   

slide-13
SLIDE 13

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

slide-14
SLIDE 14

Complexity of Abduction in SL Separation Logic

Heaps and Stars

slide-15
SLIDE 15

Complexity of Abduction in SL Separation Logic

Heaps and Stars

{ ls(x, 0) ∗ ls(y, 0) } append(x,y) { ls(x, 0) }

slide-16
SLIDE 16

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.

slide-17
SLIDE 17

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

slide-18
SLIDE 18

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

slide-19
SLIDE 19

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)

slide-20
SLIDE 20

Complexity of Abduction in SL Separation Logic

Semantics

slide-21
SLIDE 21

Complexity of Abduction in SL Separation Logic

Semantics

◮ Stack s : Var → Values.

slide-22
SLIDE 22

Complexity of Abduction in SL Separation Logic

Semantics

◮ Stack s : Var → Values. ◮ Heap h : Addresses →f Values.

slide-23
SLIDE 23

Complexity of Abduction in SL Separation Logic

Semantics

◮ Stack s : Var → Values. ◮ Heap h : Addresses →f Values. ◮ (s, h) |

= true always.

slide-24
SLIDE 24

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

slide-25
SLIDE 25

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.

slide-26
SLIDE 26

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

slide-27
SLIDE 27

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

slide-28
SLIDE 28

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

slide-29
SLIDE 29

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

slide-30
SLIDE 30

Complexity of Abduction in SL Separation Logic

More semantics

slide-31
SLIDE 31

Complexity of Abduction in SL Separation Logic

More semantics

◮ (s, h) |

= A ∗ B iff there are hA, hB such that

slide-32
SLIDE 32

Complexity of Abduction in SL Separation Logic

More semantics

◮ (s, h) |

= A ∗ B iff there are hA, hB such that

◮ (s, hA) |

= A

slide-33
SLIDE 33

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

slide-34
SLIDE 34

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.

slide-35
SLIDE 35

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

slide-36
SLIDE 36

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,

slide-37
SLIDE 37

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

slide-38
SLIDE 38

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.

slide-39
SLIDE 39

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?

slide-40
SLIDE 40

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.

slide-41
SLIDE 41

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

slide-42
SLIDE 42

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)

slide-43
SLIDE 43

Complexity of Abduction in SL Abduction

Extracting Preconditions from Code

{emp } *x = 0;

slide-44
SLIDE 44

Complexity of Abduction in SL Abduction

Extracting Preconditions from Code

{emp } *x = 0;

◮ Suppose the current state is emp.

slide-45
SLIDE 45

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 .

slide-46
SLIDE 46

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.

slide-47
SLIDE 47

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?

slide-48
SLIDE 48

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.

slide-49
SLIDE 49

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.

slide-50
SLIDE 50

Complexity of Abduction in SL Abduction

Abduction

What is abduction in AI?

slide-51
SLIDE 51

Complexity of Abduction in SL Abduction

Abduction

What is abduction in AI?

◮ Given A, B such that A B,

slide-52
SLIDE 52

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.

slide-53
SLIDE 53

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.

slide-54
SLIDE 54

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?

slide-55
SLIDE 55

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.

slide-56
SLIDE 56

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

slide-57
SLIDE 57

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,

slide-58
SLIDE 58

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.

slide-59
SLIDE 59

Complexity of Abduction in SL Abduction

Examples of Abduction

slide-60
SLIDE 60

Complexity of Abduction in SL Abduction

Examples of Abduction

emp ∗

  • x →0
slide-61
SLIDE 61

Complexity of Abduction in SL Abduction

Examples of Abduction

emp ∗ x →0

  • x →0
slide-62
SLIDE 62

Complexity of Abduction in SL Abduction

Examples of Abduction

emp ∗ x →0

  • x →0

y →0 ∗

  • x →0
slide-63
SLIDE 63

Complexity of Abduction in SL Abduction

Examples of Abduction

emp ∗ x →0

  • x →0

y →0 ∗ x = y

  • x →0
slide-64
SLIDE 64

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
slide-65
SLIDE 65

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
slide-66
SLIDE 66

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)
slide-67
SLIDE 67

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)
slide-68
SLIDE 68

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)
slide-69
SLIDE 69

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)
slide-70
SLIDE 70

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)
slide-71
SLIDE 71

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)
slide-72
SLIDE 72

Complexity of Abduction in SL Results & Conclusions

Results

slide-73
SLIDE 73

Complexity of Abduction in SL Results & Conclusions

Results

Abduction is decidable (interpolation-like result).

slide-74
SLIDE 74

Complexity of Abduction in SL Results & Conclusions

Results

Abduction is decidable (interpolation-like result). Domain “∗true” / ∈ RHS “∗true” ∈ RHS → →, ls

slide-75
SLIDE 75

Complexity of Abduction in SL Results & Conclusions

Results

Abduction is decidable (interpolation-like result). Domain “∗true” / ∈ RHS “∗true” ∈ RHS → NP-complete →, ls

slide-76
SLIDE 76

Complexity of Abduction in SL Results & Conclusions

Results

Abduction is decidable (interpolation-like result). Domain “∗true” / ∈ RHS “∗true” ∈ RHS → NP-complete PTIME →, ls

slide-77
SLIDE 77

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

slide-78
SLIDE 78

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

slide-79
SLIDE 79

Complexity of Abduction in SL Results & Conclusions

Conclusions

◮ The abduction problem is NP-complete.

slide-80
SLIDE 80

Complexity of Abduction in SL Results & Conclusions

Conclusions

◮ The abduction problem is NP-complete. ◮ Lower bounds should carry over to other heap abstractions.

slide-81
SLIDE 81

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.

slide-82
SLIDE 82

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. ◮ There is a polytime algorithm for a fixed number of lists.