Automatic Cyclic Termination Proofs for Recursive Procedures in - - PowerPoint PPT Presentation

automatic cyclic termination proofs for recursive
SMART_READER_LITE
LIVE PREVIEW

Automatic Cyclic Termination Proofs for Recursive Procedures in - - PowerPoint PPT Presentation

Automatic Cyclic Termination Proofs for Recursive Procedures in Separation Logic Reuben Rowe, University of Kent, Canterbury James Brotherston, University College London CPP, Paris, France Monday 16 th January 2017 Automatically Proving


slide-1
SLIDE 1

Automatic Cyclic Termination Proofs for Recursive Procedures in Separation Logic

Reuben Rowe, University of Kent, Canterbury James Brotherston, University College London CPP, Paris, France Monday 16th January 2017

slide-2
SLIDE 2

Automatically Proving Termination: Challenges

proc shuffle(x) { if x != nil { y := *x; reverse(y); shuffle(y); } } heap manipulation intermediate procedures recursion

1/12

slide-3
SLIDE 3

Automatically Proving Termination: Challenges

proc shuffle(x) { if x != nil { y := *x; reverse(y); shuffle(y); } } heap manipulation intermediate procedures recursion

1/12

slide-4
SLIDE 4

Automatically Proving Termination: Challenges

proc shuffle(x) { if x != nil { y := *x; reverse(y); shuffle(y); } } heap manipulation intermediate procedures recursion

1/12

slide-5
SLIDE 5

Automatically Proving Termination: Challenges

proc shuffle(x) { if x != nil { y := *x; reverse(y); shuffle(y); } } heap manipulation intermediate procedures recursion

1/12

slide-6
SLIDE 6

Automatically Proving Termination using Cyclic Proof

  • Following the approach of Brotherston et al. (POPL ’08)

. . . . . . . .

  • . . . . .

(Inference)

  • ·

· · φ ⊢ C

(Axiom)

  • (Axiom)
  • ·

· · ·

  • (Axiom)
  • We use the Cyclist framework for automation/certifjcation

2/12

slide-7
SLIDE 7

Automatically Proving Termination using Cyclic Proof

  • Following the approach of Brotherston et al. (POPL ’08)

. . . . . . . .

  • . . . . .

(Inference)

  • ·

· · φ ⊢ C

(Axiom)

  • (Axiom)
  • ·

· · ·

  • (Axiom)
  • total correctness

semantics

  • We use the Cyclist framework for automation/certifjcation

2/12

slide-8
SLIDE 8

Automatically Proving Termination using Cyclic Proof

  • Following the approach of Brotherston et al. (POPL ’08)

. . . . . . . .

  • . . . . .

(Inference)

  • ·

· · φ ⊢ C

(Axiom)

  • (Axiom)
  • ·

· · ·

  • (Axiom)
  • Separation Logic

total correctness semantics

  • We use the Cyclist framework for automation/certifjcation

2/12

slide-9
SLIDE 9

Automatically Proving Termination using Cyclic Proof

  • Following the approach of Brotherston et al. (POPL ’08)

. . . . . . . .

  • . . . . .

(Inference)

  • ·

· · φ ⊢ C

(Axiom)

  • ·

· · ·

  • Separation Logic

total correctness semantics

  • We use the Cyclist framework for automation/certifjcation

2/12

slide-10
SLIDE 10

Automatically Proving Termination using Cyclic Proof

  • Following the approach of Brotherston et al. (POPL ’08)

. . . . . . . .

  • . . . . .

(Inference)

  • ·

· · φ ⊢ C

(Axiom)

  • ·

· · ·

  • Separation Logic

Inductive Predicates for data total correctness semantics

  • We use the Cyclist framework for automation/certifjcation

2/12

slide-11
SLIDE 11

Automatically Proving Termination using Cyclic Proof

  • Following the approach of Brotherston et al. (POPL ’08)

. . . . . . . .

  • . . . . .

(Inference)

  • ·

· · {φ} C {ψ}

(Axiom)

  • ·

· · ·

  • Separation Logic

Inductive Predicates for data total correctness semantics

  • We use the Cyclist framework for automation/certifjcation

2/12

slide-12
SLIDE 12

Automatically Proving Termination using Cyclic Proof

  • Following the approach of Brotherston et al. (POPL ’08)

. . . . . . . .

  • . . . . .

(Inference)

  • ·

· · {φ} C {ψ}

(Axiom)

  • ·

· · ·

  • We use the Cyclist framework for automation/certifjcation

2/12

slide-13
SLIDE 13

Advantages of Using Cyclic Proof

  • Supports compositional reasoning
  • Naturally encapsulates inductive principles
  • Invariants can be discovered
  • Termination measures extracted automatically

3/12

slide-14
SLIDE 14

Advantages of Using Cyclic Proof

  • Supports compositional reasoning
  • Naturally encapsulates inductive principles
  • Invariants can be discovered
  • Termination measures extracted automatically

3/12

slide-15
SLIDE 15

Advantages of Using Cyclic Proof

  • Supports compositional reasoning
  • Naturally encapsulates inductive principles
  • Invariants can be discovered
  • Termination measures extracted automatically

3/12

slide-16
SLIDE 16

Advantages of Using Cyclic Proof

  • Supports compositional reasoning
  • Naturally encapsulates inductive principles
  • Invariants can be discovered
  • Termination measures extracted automatically

3/12

slide-17
SLIDE 17

Ingredients of Our Approach: Separation Logic

  • Formulas of SL describe portions of the program memory
  • emp is the empty piece of memory
  • x

y1 yn is a single memory cell referenced by x

  • A

B is the (separate) conjunction of two domain-disjoint pieces of memory

  • Predicates P x1

xn describe specifjc structures

e.g. lseg x y , list z

  • Symbolic heap syntax makes reasoning easier

x y z nil lseg x y list z v w

4/12

slide-18
SLIDE 18

Ingredients of Our Approach: Separation Logic

  • Formulas of SL describe portions of the program memory
  • emp is the empty piece of memory
  • x

y1 yn is a single memory cell referenced by x

  • A

B is the (separate) conjunction of two domain-disjoint pieces of memory

  • Predicates P x1

xn describe specifjc structures

e.g. lseg x y , list z

  • Symbolic heap syntax makes reasoning easier

x y z nil lseg x y list z v w

4/12

slide-19
SLIDE 19

Ingredients of Our Approach: Separation Logic

  • Formulas of SL describe portions of the program memory
  • emp is the empty piece of memory
  • x → (y1, . . . , yn) is a single memory cell referenced by x
  • A

B is the (separate) conjunction of two domain-disjoint pieces of memory

  • Predicates P x1

xn describe specifjc structures

e.g. lseg x y , list z

  • Symbolic heap syntax makes reasoning easier

x y z nil lseg x y list z v w

4/12

slide-20
SLIDE 20

Ingredients of Our Approach: Separation Logic

  • Formulas of SL describe portions of the program memory
  • emp is the empty piece of memory
  • x → (y1, . . . , yn) is a single memory cell referenced by x
  • A ∗ B is the (separate) conjunction of two domain-disjoint

pieces of memory

  • Predicates P x1

xn describe specifjc structures

e.g. lseg x y , list z

  • Symbolic heap syntax makes reasoning easier

x y z nil lseg x y list z v w

4/12

slide-21
SLIDE 21

Ingredients of Our Approach: Separation Logic

  • Formulas of SL describe portions of the program memory
  • emp is the empty piece of memory
  • x → (y1, . . . , yn) is a single memory cell referenced by x
  • A ∗ B is the (separate) conjunction of two domain-disjoint

pieces of memory

  • Predicates P(x1, . . . , xn) describe specifjc structures

e.g. lseg(x, y), list(z)

  • Symbolic heap syntax makes reasoning easier

x y z nil lseg x y list z v w

4/12

slide-22
SLIDE 22

Ingredients of Our Approach: Separation Logic

  • Formulas of SL describe portions of the program memory
  • emp is the empty piece of memory
  • x → (y1, . . . , yn) is a single memory cell referenced by x
  • A ∗ B is the (separate) conjunction of two domain-disjoint

pieces of memory

  • Predicates P(x1, . . . , xn) describe specifjc structures

e.g. lseg(x, y), list(z)

  • Symbolic heap syntax makes reasoning easier

x = y ∧ z = nil ∧ lseg(x, y) ∗ list(z) ∗ v → w

4/12

slide-23
SLIDE 23

Ingredients of our Approach: Symbolic Execution

(free) : {φ} C {ψ} {φ ∗ x → y} free(x); C {ψ} (load) x v x x y v x x C (x fresh) y v x := *y; C (proc) C (body proc C) proc(x)

5/12

slide-24
SLIDE 24

Ingredients of our Approach: Symbolic Execution

(free) : {φ} C {ψ} {φ ∗ x → y} free(x); C {ψ} (load) : {x = v[x′/x] ∧ (φ ∗ y → v)[x′/x]} C {ψ} (x′ fresh) {φ ∗ y → v} x := *y; C {ψ} (proc) C (body proc C) proc(x)

5/12

slide-25
SLIDE 25

Ingredients of our Approach: Symbolic Execution

(free) : {φ} C {ψ} {φ ∗ x → y} free(x); C {ψ} (load) : {x = v[x′/x] ∧ (φ ∗ y → v)[x′/x]} C {ψ} (x′ fresh) {φ ∗ y → v} x := *y; C {ψ} (proc) : {φ} C {ψ} (body(proc) = C) {φ} proc( x) {ψ}

5/12

slide-26
SLIDE 26

Ingredients of our Approach: Inductive Predicates

  • We support user-defjned inductive predicates, e.g.

x = nil ∧ emp list(x) x → y ∗ list(y) list(x)

  • Predicate labels identify termination measures, e.g.

list x C

  • A logical rule schema allows case split

x nil emp C x y list x C list x C

6/12

slide-27
SLIDE 27

Ingredients of our Approach: Inductive Predicates

  • We support user-defjned inductive predicates, e.g.

x = nil ∧ emp list(x) x → y ∗ list(y) list(x)

  • Predicate labels identify termination measures, e.g.

{listα(x) ∗ φ} C {ψ}

  • A logical rule schema allows case split

x nil emp C x y list x C list x C

6/12

slide-28
SLIDE 28

Ingredients of our Approach: Inductive Predicates

  • We support user-defjned inductive predicates, e.g.

x = nil ∧ emp list(x) x → y ∗ list(y) list(x)

  • Predicate labels identify termination measures, e.g.

{listα(x) ∗ φ} C {ψ}

  • A logical rule schema allows case split

{(x = nil ∧ emp) ∗ φ} C {ψ} {(β < α ∧ x → y ∗ listβ(x)) ∗ φ} C {ψ} {listα(x) ∗ φ} C {ψ}

6/12

slide-29
SLIDE 29

Ingredients of our Approach: Inductive Predicates

  • We support user-defjned inductive predicates, e.g.

x = nil ∧ emp list(x) x → y ∗ list(y) list(x)

  • Predicate labels identify termination measures, e.g.

{listα(x) ∗ φ} C {ψ}

  • A logical rule schema allows case split

{(x = nil ∧ emp) ∗ φ} C {ψ} {(β < α ∧ x → y ∗ listβ(x)) ∗ φ} C {ψ} {listα(x) ∗ φ} C {ψ}

6/12

slide-30
SLIDE 30

Implementation

  • We achieve automation by implementing the proof system

in Cyclist

  • A generic framework for cyclic proof search
  • Proof objects can be extracted for certifjcation
  • Entailment queries also handled by Cyclist
  • Procedure calls and backlinks require frame inference
  • Unfolds predicates and matches atomic spatial assertions
  • Requires deciding entailment of sets of constraints
  • Currently, we need to provide procedure summaries

7/12

slide-31
SLIDE 31

Implementation

  • We achieve automation by implementing the proof system

in Cyclist

  • A generic framework for cyclic proof search
  • Proof objects can be extracted for certifjcation
  • Entailment queries also handled by Cyclist
  • Procedure calls and backlinks require frame inference
  • Unfolds predicates and matches atomic spatial assertions
  • Requires deciding entailment of sets of constraints
  • Currently, we need to provide procedure summaries

7/12

slide-32
SLIDE 32

Implementation

  • We achieve automation by implementing the proof system

in Cyclist

  • A generic framework for cyclic proof search
  • Proof objects can be extracted for certifjcation
  • Entailment queries also handled by Cyclist
  • Procedure calls and backlinks require frame inference
  • Unfolds predicates and matches atomic spatial assertions
  • Requires deciding entailment of sets of constraints
  • Currently, we need to provide procedure summaries

7/12

slide-33
SLIDE 33

Implementation

  • We achieve automation by implementing the proof system

in Cyclist

  • A generic framework for cyclic proof search
  • Proof objects can be extracted for certifjcation
  • Entailment queries also handled by Cyclist
  • Procedure calls and backlinks require frame inference
  • Unfolds predicates and matches atomic spatial assertions
  • Requires deciding entailment of sets of constraints
  • Currently, we need to provide procedure summaries

7/12

slide-34
SLIDE 34

Implementation

  • We achieve automation by implementing the proof system

in Cyclist

  • A generic framework for cyclic proof search
  • Proof objects can be extracted for certifjcation
  • Entailment queries also handled by Cyclist
  • Procedure calls and backlinks require frame inference
  • Unfolds predicates and matches atomic spatial assertions
  • Requires deciding entailment of sets of constraints
  • Currently, we need to provide procedure summaries

7/12

slide-35
SLIDE 35

Implementation

  • We achieve automation by implementing the proof system

in Cyclist

  • A generic framework for cyclic proof search
  • Proof objects can be extracted for certifjcation
  • Entailment queries also handled by Cyclist
  • Procedure calls and backlinks require frame inference
  • Unfolds predicates and matches atomic spatial assertions
  • Requires deciding entailment of sets of constraints
  • Currently, we need to provide procedure summaries

7/12

slide-36
SLIDE 36

Implementation

  • We achieve automation by implementing the proof system

in Cyclist

  • A generic framework for cyclic proof search
  • Proof objects can be extracted for certifjcation
  • Entailment queries also handled by Cyclist
  • Procedure calls and backlinks require frame inference
  • Unfolds predicates and matches atomic spatial assertions
  • Requires deciding entailment of sets of constraints α < β
  • Currently, we need to provide procedure summaries

7/12

slide-37
SLIDE 37

Implementation

  • We achieve automation by implementing the proof system

in Cyclist

  • A generic framework for cyclic proof search
  • Proof objects can be extracted for certifjcation
  • Entailment queries also handled by Cyclist
  • Procedure calls and backlinks require frame inference
  • Unfolds predicates and matches atomic spatial assertions
  • Requires deciding entailment of sets of constraints α < β
  • Currently, we need to provide procedure summaries

7/12

slide-38
SLIDE 38

A Cyclic Termination Proof for shuffle

proc shuffle(x) { if x!=nil { y:=*x; reverse(y); shuffle(y); } } list x

list y rev(y); list y frame x y list y rev(y); x y list y list x shuf(x); list x (subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) x y list y shuf(y); list x (seq) x y list y rev(y); list x (load) x v list v y:=*x; list x (case list) x nil list x y:=*x; list x ( ) x nil list x list x (if) (proc) list x shuffle(x) list x

8/12

slide-39
SLIDE 39

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

list y rev(y); list y frame x y list y rev(y); x y list y list x shuf(x); list x (subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) x y list y shuf(y); list x (seq) x y list y rev(y); list x (load) x v list v y:=*x; list x (case list) x nil list x y:=*x; list x ( ) x nil list x list x (if) (proc) list x shuffle(x) list x

8/12

slide-40
SLIDE 40

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

list y rev(y); list y frame x y list y rev(y); x y list y list x shuf(x); list x (subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) x y list y shuf(y); list x (seq) x y list y rev(y); list x (load) x v list v y:=*x; list x (case list) x nil list x y:=*x; list x ( ) x nil list x list x (if) {listα(x)} if x!=nil { y:=*x; reverse(y); shuffle(y); *x:=y; } {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-41
SLIDE 41

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

list y rev(y); list y frame x y list y rev(y); x y list y list x shuf(x); list x (subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) x y list y shuf(y); list x (seq) x y list y rev(y); list x (load) x v list v y:=*x; list x (case list) x nil list x y:=*x; list x ( ) x nil list x list x (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-42
SLIDE 42

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

list y rev(y); list y frame x y list y rev(y); x y list y list x shuf(x); list x (subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) x y list y shuf(y); list x (seq) x y list y rev(y); list x (load) x v list v y:=*x; list x (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( ) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-43
SLIDE 43

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

list y rev(y); list y frame x y list y rev(y); x y list y list x shuf(x); list x (subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) x y list y shuf(y); list x (seq) x y list y rev(y); list x (load) x v list v y:=*x; list x (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-44
SLIDE 44

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

list y rev(y); list y frame x y list y rev(y); x y list y list x shuf(x); list x (subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) x y list y shuf(y); list x (seq) x y list y rev(y); list x (load) {β < α ∧ x → v ∗ listβ(v)} y:=*x; . . . {listα(x)} (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-45
SLIDE 45

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

list y rev(y); list y frame x y list y rev(y); x y list y list x shuf(x); list x (subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) x y list y shuf(y); list x (seq) {β < α ∧ x → y ∗ listβ(y)} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗ listβ(v)} y:=*x; . . . {listα(x)} (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-46
SLIDE 46

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

list y rev(y); list y frame

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • x

y list y

  • list

x shuf(x); list x (subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) { x y list y } shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗ listβ(y)} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗ listβ(v)} y:=*x; . . . {listα(x)} (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-47
SLIDE 47

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

{listβ(y)} rev(y); {listβ(y)} frame

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • x

y list y

  • list

x shuf(x); list x (subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) { x y list y } shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗ listβ(y)} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗ listβ(v)} y:=*x; . . . {listα(x)} (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-48
SLIDE 48

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

{listβ(y)} rev(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • β < α ∧ x → y

∗ listβ(y)

  • list

x shuf(x); list x (subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) { x y list y } shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗ listβ(y)} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗ listβ(v)} y:=*x; . . . {listα(x)} (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-49
SLIDE 49

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

{listβ(y)} rev(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • β < α ∧ x → y

∗ listβ(y)

  • list

x shuf(x); list x (subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) {β < α ∧ x → y ∗ listβ(y)} shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗ listβ(y)} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗ listβ(v)} y:=*x; . . . {listα(x)} (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-50
SLIDE 50

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

{listβ(y)} rev(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • β < α ∧ x → y

∗ listβ(y)

  • {listα(x)} shuf(x); {listα(x)}

(subst) list y shuf(y); list y (frame) x y list y shuf(y); x y list y (conseq) {β < α ∧ x → y ∗ listβ(y)} shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗ listβ(y)} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗ listβ(v)} y:=*x; . . . {listα(x)} (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-51
SLIDE 51

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

{listβ(y)} rev(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • β < α ∧ x → y

∗ listβ(y)

  • {listα(x)} shuf(x); {listα(x)}

(subst) {list (y)} shuf(y); {list (y)} (frame) x y list y shuf(y); x y list y (conseq) {β < α ∧ x → y ∗ listβ(y)} shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗ listβ(y)} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗ listβ(v)} y:=*x; . . . {listα(x)} (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-52
SLIDE 52

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

{listβ(y)} rev(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • β < α ∧ x → y

∗ listβ(y)

  • {listα(x)} shuf(x); {listα(x)}

(subst) {listβ(y)} shuf(y); {listβ(y)} (frame) x y list y shuf(y); x y list y (conseq) {β < α ∧ x → y ∗ listβ(y)} shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗ listβ(y)} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗ listβ(v)} y:=*x; . . . {listα(x)} (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-53
SLIDE 53

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

{listβ(y)} rev(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • β < α ∧ x → y

∗ listβ(y)

  • {listα(x)} shuf(x); {listα(x)}

(subst) {listβ(y)} shuf(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • shuf(y);
  • β < α ∧ x → y

∗ listβ(y)

  • (conseq)

{β < α ∧ x → y ∗ listβ(y)} shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗ listβ(y)} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗ listβ(v)} y:=*x; . . . {listα(x)} (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-54
SLIDE 54

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

{listβ(y)} rev(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • β < α ∧ x → y

∗ listβ(y)

  • {listα(x)} shuf(x); {listα(x)}

(subst) {listβ(y)} shuf(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • shuf(y);
  • β < α ∧ x → y

∗ listβ(y)

  • (conseq)

{β < α ∧ x → y ∗ listβ(y)} shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗ listβ(y)} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗ listβ(v)} y:=*x; . . . {listα(x)} (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-55
SLIDE 55

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

{listβ(y)} rev(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • β < α ∧ x → y

∗ listβ(y)

  • {listα(x)} shuf(x); {listα(x)}

(subst) {listβ(y)} shuf(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • shuf(y);
  • β < α ∧ x → y

∗ listβ(y)

  • (conseq)

{β < α ∧ x → y ∗ listβ(y)} shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗ listβ(y)} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗ listβ(v)} y:=*x; . . . {listα(x)} (case list) {x = nil ∧ listα(x)} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {listα(x)} if x!=nil . . . {listα(x)} (proc) {listα(x)} shuffle(x) {listα(x)}

8/12

slide-56
SLIDE 56

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

{listβ(y)} rev(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • β < α ∧ x → y

∗ listβ(y)

  • {

α

} shuf(x); {listα(x)} (subst) {

β

} shuf(y); {listβ(y)} (frame)

  • β < α ∧ x → y

β

  • shuf(y);
  • β < α ∧ x → y

∗ listβ(y)

  • (conseq)

{β < α ∧ x → y ∗

β

} shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗

β

} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗

β

} y:=*x; . . . {listα(x)} (case list) {x = nil ∧

α

} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {

α

} if x!=nil . . . {listα(x)} (proc) {

α

} shuffle(x) {listα(x)}

8/12

slide-57
SLIDE 57

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

{listβ(y)} rev(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • β < α ∧ x → y

∗ listβ(y)

  • {

α

} shuf(x); {listα(x)} (subst) {

β

} shuf(y); {listβ(y)} (frame)

  • β < α ∧ x → y

β

  • shuf(y);
  • β < α ∧ x → y

∗ listβ(y)

  • (conseq)

{β < α ∧ x → y ∗

β

} shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗

β

} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗

β

} y:=*x; . . . {listα(x)} (case list) {x = nil ∧

α

} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {

α

} if x!=nil . . . {listα(x)} (proc) {

α

} shuffle(x) {listα(x)}

8/12

slide-58
SLIDE 58

A Cyclic Termination Proof for shuffle

proc shuffle(x) {listα(x)} { if x!=nil { y:=*x; reverse(y); shuffle(y); } } {listα(x)}

{listβ(y)} rev(y); {listβ(y)} (frame)

  • β < α ∧ x → y

∗ listβ(y)

  • rev(y);
  • β < α ∧ x → y

∗ listβ(y)

  • {

α

} shuf(x); {listα(x)} (subst) {

β

} shuf(y); {listβ(y)} (frame)

  • β < α ∧ x → y

β

  • shuf(y);
  • β < α ∧ x → y

∗ listβ(y)

  • (conseq)

{β < α ∧ x → y ∗

β

} shuf(y); {listα(x)} (seq) {β < α ∧ x → y ∗

β

} rev(y); . . . {listα(x)} (load) {β < α ∧ x → v ∗

β

} y:=*x; . . . {listα(x)} (case list) {x = nil ∧

α

} y:=*x; . . . {listα(x)} ( | =) {x = nil ∧ listα(x)} ǫ {listα(x)} (if) {

α

} if x!=nil . . . {listα(x)} (proc) {

α

} shuffle(x) {listα(x)}

8/12

slide-59
SLIDE 59

Some Related Tools

  • Mutant

(Berdine et al. ’06) Thor (Magill et al. ’10)

  • Costa

(Albert et al. ’07) Julia (Spoto et al. ’10) AProVE (Giesl et al. ’14)

  • Verifast

(Jacobs et al. ’15)

  • HipTNT

(Le, Qin & Chin ’15)

9/12

slide-60
SLIDE 60

Some Related Tools

  • Mutant

(Berdine et al. ’06) Thor (Magill et al. ’10)

  • Costa

(Albert et al. ’07) Julia (Spoto et al. ’10) AProVE (Giesl et al. ’14)

  • Verifast

(Jacobs et al. ’15)

  • HipTNT

(Le, Qin & Chin ’15)

9/12

slide-61
SLIDE 61

Some Related Tools

  • Mutant

(Berdine et al. ’06) Thor (Magill et al. ’10)

  • Costa

(Albert et al. ’07) Julia (Spoto et al. ’10) AProVE (Giesl et al. ’14)

  • Verifast

(Jacobs et al. ’15)

  • HipTNT

(Le, Qin & Chin ’15)

9/12

slide-62
SLIDE 62

Some Related Tools

  • Mutant

(Berdine et al. ’06) Thor (Magill et al. ’10)

  • Costa

(Albert et al. ’07) Julia (Spoto et al. ’10) AProVE (Giesl et al. ’14)

  • Verifast

(Jacobs et al. ’15)

  • HipTNT+

(Le, Qin & Chin ’15)

9/12

slide-63
SLIDE 63

Some Related Tools

  • Mutant

(Berdine et al. ’06) Thor (Magill et al. ’10)

  • Costa

(Albert et al. ’07) Julia (Spoto et al. ’10) AProVE (Giesl et al. ’14)

  • Verifast

(Jacobs et al. ’15)

  • HipTNT+

(Le, Qin & Chin ’15)

9/12

slide-64
SLIDE 64

Empirical Evaluation: Comparison with HipTNT+

Benchmark test Time (sec) / % Annotated HipTNT+ Cyclist traverse acyclic linked list 0.31 (25%) 0.02 (33%) traverse cyclic linked list 0.52 (29%) 0.02 (38%) append acyclic linked lists 0.36 (25%) 0.03 (10%) TPDB Shuffme 1.79 (22%) 0.21 (29%) TPDB Alternate 6.33 (13%) 1.47 (12%) TPDB UnionFind 4.03 (26%) 1.21 (25%) 10/12

slide-65
SLIDE 65

Empirical Evaluation: Comparison with AProVE

Time (seconds) Benchmark Suite Test AProVE Cyclist (% Annot.) Costa_Julia_09-Recursive Ackermann 3.82 0.14 (18%) BinarySearchTree 1.41 0.95 (13%) BTree 1.77 0.03 (22%) List 1.43 1.74 (19%) Julia_10-Recursive AckR 3.22 0.14 (18%) BTreeR 2.68 0.03 (22%) Test8 2.95 0.97 (13%) AProVE_11_Recursive CyclicAnalysisRec 2.61 5.21 (27%) RotateTree 5.86 0.32 (14%) SharingAnalysisRec 2.47 4.72 (16%) UnionFind TIMEOUT 1.21 (25%) BOG_RTA_11 Alternate 5.47 1.47 (12%) AppE 2.19 0.09 (23%) BinTreeChanger 3.38 3.33 (20%) CAppE 2.04 1.78 (25%) ConvertRec 3.72 0.06 (38%) DupTreeRec 4.18 0.03 (20%) GrowTreeR 3.53 0.05 (20%) MirrorBinTreeRec 4.96 0.02 (22%) MirrorMultiTreeRec 5.16 0.63 (33%) SearchTreeR 2.74 0.34 (14%) Shuffme 11.72 0.21 (29%) TwoWay 1.94 0.02 (25%)

11/12

slide-66
SLIDE 66

Future Work

  • More expressive contraints for predicate approximations
  • Can we infer procedure specifjcations?
  • Predicate label annotations
  • Entire pre-/post-conditions (bi-abduction)

12/12

slide-67
SLIDE 67

Future Work

  • More expressive contraints for predicate approximations
  • Can we infer procedure specifjcations?
  • Predicate label annotations
  • Entire pre-/post-conditions (bi-abduction)

12/12

slide-68
SLIDE 68

Future Work

  • More expressive contraints for predicate approximations
  • Can we infer procedure specifjcations?
  • Predicate label annotations
  • Entire pre-/post-conditions (bi-abduction)

12/12

slide-69
SLIDE 69

Future Work

  • More expressive contraints for predicate approximations
  • Can we infer procedure specifjcations?
  • Predicate label annotations
  • Entire pre-/post-conditions (bi-abduction)

12/12

slide-70
SLIDE 70

Thank You

github.com/ngorogiannis/cyclist