Model Checking for Symbolic-Heap Separation Logic with Inductive - - PowerPoint PPT Presentation

model checking for symbolic heap separation logic with
SMART_READER_LITE
LIVE PREVIEW

Model Checking for Symbolic-Heap Separation Logic with Inductive - - PowerPoint PPT Presentation

Model Checking for Symbolic-Heap Separation Logic with Inductive Predicates James Brotherston 1 Nikos Gorogiannis 2 Max Kanovich 1 Reuben Rowe 1 1 UCL 2 Middlesex University Australian National University, Canberra, 9 December 2015 1/ 24 Model


slide-1
SLIDE 1

Model Checking for Symbolic-Heap Separation Logic with Inductive Predicates

James Brotherston1 Nikos Gorogiannis2 Max Kanovich1 Reuben Rowe1

1UCL 2Middlesex University

Australian National University, Canberra, 9 December 2015

1/ 24

slide-2
SLIDE 2

Model checking, in general

  • Model checking is the problem of checking whether a

structure S satisfies, or is a model of, some formula A: does S | = A?

2/ 24

slide-3
SLIDE 3

Model checking, in general

  • Model checking is the problem of checking whether a

structure S satisfies, or is a model of, some formula A: does S | = A?

  • In computer science, S is typically a Kripke structure

representing a system or program, and A a formula of modal or temporal logic.

2/ 24

slide-4
SLIDE 4

Model checking, in general

  • Model checking is the problem of checking whether a

structure S satisfies, or is a model of, some formula A: does S | = A?

  • In computer science, S is typically a Kripke structure

representing a system or program, and A a formula of modal or temporal logic.

  • More generally, S could be any kind of mathematical

structure and A a formula describing such structures.

2/ 24

slide-5
SLIDE 5

Model checking, in particular

  • Our setting: separation logic, used as a formalism for

verifying imperative pointer programs.

3/ 24

slide-6
SLIDE 6

Model checking, in particular

  • Our setting: separation logic, used as a formalism for

verifying imperative pointer programs.

  • Typically, we do static analysis: given an annotated

program, prove that it meets its specification. There are many such automatic analyses!

3/ 24

slide-7
SLIDE 7

Model checking, in particular

  • Our setting: separation logic, used as a formalism for

verifying imperative pointer programs.

  • Typically, we do static analysis: given an annotated

program, prove that it meets its specification. There are many such automatic analyses!

  • When static analysis fails, we might try run-time

verification: run the program and check that it does not violate the spec.

3/ 24

slide-8
SLIDE 8

Model checking, in particular

  • Our setting: separation logic, used as a formalism for

verifying imperative pointer programs.

  • Typically, we do static analysis: given an annotated

program, prove that it meets its specification. There are many such automatic analyses!

  • When static analysis fails, we might try run-time

verification: run the program and check that it does not violate the spec.

  • In that case, we need to compare memory states S against

specs A: does S | = A?

3/ 24

slide-9
SLIDE 9

Model checking, in particular

  • Our setting: separation logic, used as a formalism for

verifying imperative pointer programs.

  • Typically, we do static analysis: given an annotated

program, prove that it meets its specification. There are many such automatic analyses!

  • When static analysis fails, we might try run-time

verification: run the program and check that it does not violate the spec.

  • In that case, we need to compare memory states S against

specs A: does S | = A?

  • We focus on the popular symbolic-heap fragment of

separation logic, allowing arbitrary inductive predicates.

3/ 24

slide-10
SLIDE 10

Symbolic-heap separation logic

  • Terms t are either variables x, y, z . . . or the constant nil.

4/ 24

slide-11
SLIDE 11

Symbolic-heap separation logic

  • Terms t are either variables x, y, z . . . or the constant nil.
  • Pure formulas π and spatial formulas F given by:

π ::= t = t | t = t F ::= emp | x → t | Pt | F ∗ F (where P a predicate symbol, t a tuple of terms).

4/ 24

slide-12
SLIDE 12

Symbolic-heap separation logic

  • Terms t are either variables x, y, z . . . or the constant nil.
  • Pure formulas π and spatial formulas F given by:

π ::= t = t | t = t F ::= emp | x → t | Pt | F ∗ F (where P a predicate symbol, t a tuple of terms).

  • → (“points-to”) denotes an individual pointer to a record

in the heap.

4/ 24

slide-13
SLIDE 13

Symbolic-heap separation logic

  • Terms t are either variables x, y, z . . . or the constant nil.
  • Pure formulas π and spatial formulas F given by:

π ::= t = t | t = t F ::= emp | x → t | Pt | F ∗ F (where P a predicate symbol, t a tuple of terms).

  • → (“points-to”) denotes an individual pointer to a record

in the heap.

  • ∗ (“and separately”) demarks domain-disjoint heaps.

4/ 24

slide-14
SLIDE 14

Symbolic-heap separation logic

  • Terms t are either variables x, y, z . . . or the constant nil.
  • Pure formulas π and spatial formulas F given by:

π ::= t = t | t = t F ::= emp | x → t | Pt | F ∗ F (where P a predicate symbol, t a tuple of terms).

  • → (“points-to”) denotes an individual pointer to a record

in the heap.

  • ∗ (“and separately”) demarks domain-disjoint heaps.
  • Symbolic heaps A given by ∃x. Π : F, for Π a set of pure

formulas.

4/ 24

slide-15
SLIDE 15

Inductive definitions in separation logic

  • Inductive predicates defined by a set of rules of form:

A ⇒ Pt (We typically suppress the existential quantifiers in A.)

5/ 24

slide-16
SLIDE 16

Inductive definitions in separation logic

  • Inductive predicates defined by a set of rules of form:

A ⇒ Pt (We typically suppress the existential quantifiers in A.)

  • E.g., linked list segments with root x and tail element y:

emp ⇒ ls x x x = nil : x → z ∗ ls z y ⇒ ls x y

5/ 24

slide-17
SLIDE 17

Inductive definitions in separation logic

  • Inductive predicates defined by a set of rules of form:

A ⇒ Pt (We typically suppress the existential quantifiers in A.)

  • E.g., linked list segments with root x and tail element y:

emp ⇒ ls x x x = nil : x → z ∗ ls z y ⇒ ls x y

  • E.g., binary trees with root x given by:

x = nil : emp ⇒ bt x x = nil : x → (y, z) ∗ bt y ∗ bt z ⇒ bt x

5/ 24

slide-18
SLIDE 18

Semantics

  • Models are stacks s : Var → Val paired with heaps

h : Loc ⇀fin Val. ◦ is union of domain-disjoint heaps; e is the empty heap; nil is a non-allocable value.

6/ 24

slide-19
SLIDE 19

Semantics

  • Models are stacks s : Var → Val paired with heaps

h : Loc ⇀fin Val. ◦ is union of domain-disjoint heaps; e is the empty heap; nil is a non-allocable value.

  • Forcing relation s, h |

= A given by

s, h | =Φ t1 = (=)t2 ⇔ s(t1) = (=)s(t2)

6/ 24

slide-20
SLIDE 20

Semantics

  • Models are stacks s : Var → Val paired with heaps

h : Loc ⇀fin Val. ◦ is union of domain-disjoint heaps; e is the empty heap; nil is a non-allocable value.

  • Forcing relation s, h |

= A given by

s, h | =Φ t1 = (=)t2 ⇔ s(t1) = (=)s(t2) s, h | =Φ emp ⇔ h = e

6/ 24

slide-21
SLIDE 21

Semantics

  • Models are stacks s : Var → Val paired with heaps

h : Loc ⇀fin Val. ◦ is union of domain-disjoint heaps; e is the empty heap; nil is a non-allocable value.

  • Forcing relation s, h |

= A given by

s, h | =Φ t1 = (=)t2 ⇔ s(t1) = (=)s(t2) s, h | =Φ emp ⇔ h = e s, h | =Φ x → t ⇔ dom(h) = {s(x)} and h(s(x)) = s(t)

6/ 24

slide-22
SLIDE 22

Semantics

  • Models are stacks s : Var → Val paired with heaps

h : Loc ⇀fin Val. ◦ is union of domain-disjoint heaps; e is the empty heap; nil is a non-allocable value.

  • Forcing relation s, h |

= A given by

s, h | =Φ t1 = (=)t2 ⇔ s(t1) = (=)s(t2) s, h | =Φ emp ⇔ h = e s, h | =Φ x → t ⇔ dom(h) = {s(x)} and h(s(x)) = s(t) s, h | =Φ Pit ⇔ (s(t), h) ∈ PiΦ

6/ 24

slide-23
SLIDE 23

Semantics

  • Models are stacks s : Var → Val paired with heaps

h : Loc ⇀fin Val. ◦ is union of domain-disjoint heaps; e is the empty heap; nil is a non-allocable value.

  • Forcing relation s, h |

= A given by

s, h | =Φ t1 = (=)t2 ⇔ s(t1) = (=)s(t2) s, h | =Φ emp ⇔ h = e s, h | =Φ x → t ⇔ dom(h) = {s(x)} and h(s(x)) = s(t) s, h | =Φ Pit ⇔ (s(t), h) ∈ PiΦ s, h | =Φ F1 ∗ F2 ⇔ ∃h1, h2. h = h1 ◦ h2 and s, h1 | =Φ F1 and s, h2 | =Φ F2

6/ 24

slide-24
SLIDE 24

Semantics

  • Models are stacks s : Var → Val paired with heaps

h : Loc ⇀fin Val. ◦ is union of domain-disjoint heaps; e is the empty heap; nil is a non-allocable value.

  • Forcing relation s, h |

= A given by

s, h | =Φ t1 = (=)t2 ⇔ s(t1) = (=)s(t2) s, h | =Φ emp ⇔ h = e s, h | =Φ x → t ⇔ dom(h) = {s(x)} and h(s(x)) = s(t) s, h | =Φ Pit ⇔ (s(t), h) ∈ PiΦ s, h | =Φ F1 ∗ F2 ⇔ ∃h1, h2. h = h1 ◦ h2 and s, h1 | =Φ F1 and s, h2 | =Φ F2 s, h | =Φ ∃z. Π : F ⇔ ∃v ∈ Val|z|. s[z → v], h | =Φ π for all π ∈ Π and s[z → v], h | =Φ F

6/ 24

slide-25
SLIDE 25

Semantics of inductive predicates

Given inductive rule set Φ, the semantics PΦ of inductive predicate P is the least fixed point of a monotone operator constructed from Φ.

7/ 24

slide-26
SLIDE 26

Semantics of inductive predicates

Given inductive rule set Φ, the semantics PΦ of inductive predicate P is the least fixed point of a monotone operator constructed from Φ. E.g, recall linked list segments ls: emp ⇒ ls x x x = nil : x → z ∗ ls z y ⇒ ls x y

7/ 24

slide-27
SLIDE 27

Semantics of inductive predicates

Given inductive rule set Φ, the semantics PΦ of inductive predicate P is the least fixed point of a monotone operator constructed from Φ. E.g, recall linked list segments ls: emp ⇒ ls x x x = nil : x → z ∗ ls z y ⇒ ls x y The corresponding operator is: ϕ(X) = {(h, (s(x), s(y)) | s, h | = x = y and s, h | = emp, or s, h | = x → z ∗ Xzy} where Xzy is interpreted as (z, y) ∈ X.

7/ 24

slide-28
SLIDE 28

Problem statement

Model checking problem (MC). Given an inductive rule set Φ, stack s, heap h and symbolic heap A, decide whether s, h | =Φ A.

8/ 24

slide-29
SLIDE 29

Problem statement

Model checking problem (MC). Given an inductive rule set Φ, stack s, heap h and symbolic heap A, decide whether s, h | =Φ A. First, we can simplify the problem: Restricted model checking problem (RMC). Given an inductive rule set Φ, tuple of values a, heap h and predicate symbol P, decide whether (a, h) ∈ PΦ.

8/ 24

slide-30
SLIDE 30

Problem statement

Model checking problem (MC). Given an inductive rule set Φ, stack s, heap h and symbolic heap A, decide whether s, h | =Φ A. First, we can simplify the problem: Restricted model checking problem (RMC). Given an inductive rule set Φ, tuple of values a, heap h and predicate symbol P, decide whether (a, h) ∈ PΦ. Proposition MC and RMC are (polynomially) equivalent.

8/ 24

slide-31
SLIDE 31

Subtle problem 1

Naive idea: apply inductive rules backwards to Px until we reach the empty heap.

9/ 24

slide-32
SLIDE 32

Subtle problem 1

Naive idea: apply inductive rules backwards to Px until we reach the empty heap. But, suppose ((a, b), h) ∈ PΦ, and is generated by the rule ∃z. Pxz ∗ Pzy ⇒ Pxy. So, for some c ∈ Val, we have both ((a, c), h1) ∈ PΦ and ((c, b), h2) ∈ PΦ, where h = h1 ◦ h2.

9/ 24

slide-33
SLIDE 33

Subtle problem 1

Naive idea: apply inductive rules backwards to Px until we reach the empty heap. But, suppose ((a, b), h) ∈ PΦ, and is generated by the rule ∃z. Pxz ∗ Pzy ⇒ Pxy. So, for some c ∈ Val, we have both ((a, c), h1) ∈ PΦ and ((c, b), h2) ∈ PΦ, where h = h1 ◦ h2. But we do not know that h1, h2 are smaller than h.

9/ 24

slide-34
SLIDE 34

Subtle problem 1

Naive idea: apply inductive rules backwards to Px until we reach the empty heap. But, suppose ((a, b), h) ∈ PΦ, and is generated by the rule ∃z. Pxz ∗ Pzy ⇒ Pxy. So, for some c ∈ Val, we have both ((a, c), h1) ∈ PΦ and ((c, b), h2) ∈ PΦ, where h = h1 ◦ h2. But we do not know that h1, h2 are smaller than h. Moral: compute “sub-models” of (a, h) bottom-up until we reach a fixed point.

9/ 24

slide-35
SLIDE 35

Subtle problem 2

Suppose (a, e) ∈ PΦ is generated by the rule ∃z. z = x : Qxz ⇒ Px. So, for some b ∈ Val, we have ((a, b), e) ∈ QΦ, where b = a and b (trivially) does not appear in the empty heap e.

10/ 24

slide-36
SLIDE 36

Subtle problem 2

Suppose (a, e) ∈ PΦ is generated by the rule ∃z. z = x : Qxz ⇒ Px. So, for some b ∈ Val, we have ((a, b), e) ∈ QΦ, where b = a and b (trivially) does not appear in the empty heap e. Thus we must allow our sub-models to mention fresh, or “spare”, values not mentioned in a or h.

10/ 24

slide-37
SLIDE 37

Subtle problem 2

Suppose (a, e) ∈ PΦ is generated by the rule ∃z. z = x : Qxz ⇒ Px. So, for some b ∈ Val, we have ((a, b), e) ∈ QΦ, where b = a and b (trivially) does not appear in the empty heap e. Thus we must allow our sub-models to mention fresh, or “spare”, values not mentioned in a or h. Fortunately, for any given set of definitions Φ, we can get away with using only finitely many of these spare values.

10/ 24

slide-38
SLIDE 38

Our model checking constructions

Given Φ, a and h, define Good(a, h) = a ∪ {nil} ∪ all values in h.

11/ 24

slide-39
SLIDE 39

Our model checking constructions

Given Φ, a and h, define Good(a, h) = a ∪ {nil} ∪ all values in h. Now let β be the maximum number of variables in any rule in Φ, and define SpareΦ(a, h) to be a set of β fresh values.

11/ 24

slide-40
SLIDE 40

Our model checking constructions

Given Φ, a and h, define Good(a, h) = a ∪ {nil} ∪ all values in h. Now let β be the maximum number of variables in any rule in Φ, and define SpareΦ(a, h) to be a set of β fresh values. Then, given Φ, values a and heap h we define a monotone

  • perator, similar to the one that constructs the semantics of

inductive predicates except that

11/ 24

slide-41
SLIDE 41

Our model checking constructions

Given Φ, a and h, define Good(a, h) = a ∪ {nil} ∪ all values in h. Now let β be the maximum number of variables in any rule in Φ, and define SpareΦ(a, h) to be a set of β fresh values. Then, given Φ, values a and heap h we define a monotone

  • perator, similar to the one that constructs the semantics of

inductive predicates except that

  • we only consider heaps h′ ⊆ h,

11/ 24

slide-42
SLIDE 42

Our model checking constructions

Given Φ, a and h, define Good(a, h) = a ∪ {nil} ∪ all values in h. Now let β be the maximum number of variables in any rule in Φ, and define SpareΦ(a, h) to be a set of β fresh values. Then, given Φ, values a and heap h we define a monotone

  • perator, similar to the one that constructs the semantics of

inductive predicates except that

  • we only consider heaps h′ ⊆ h, and
  • all values instantiating variables must be taken from

Good(a, h) ∪ SpareΦ(a, h).

11/ 24

slide-43
SLIDE 43

Our model checking constructions

Given Φ, a and h, define Good(a, h) = a ∪ {nil} ∪ all values in h. Now let β be the maximum number of variables in any rule in Φ, and define SpareΦ(a, h) to be a set of β fresh values. Then, given Φ, values a and heap h we define a monotone

  • perator, similar to the one that constructs the semantics of

inductive predicates except that

  • we only consider heaps h′ ⊆ h, and
  • all values instantiating variables must be taken from

Good(a, h) ∪ SpareΦ(a, h). Again, we take the least fixed point of the operator, and write MC Φ

i (a, h) for the component corresponding to ith predicate.

11/ 24

slide-44
SLIDE 44

Correctness

Lemma For each predicate Pi, (a, h) ∈ PiΦ ⇔ (a, h) ∈ MC Φ

i (a, h) .

12/ 24

slide-45
SLIDE 45

Correctness

Lemma For each predicate Pi, (a, h) ∈ PiΦ ⇔ (a, h) ∈ MC Φ

i (a, h) .

Soundness (⇐) is easy — MC Φ

i (a, h) only constructs models of

Pi by construction.

12/ 24

slide-46
SLIDE 46

Correctness

Lemma For each predicate Pi, (a, h) ∈ PiΦ ⇔ (a, h) ∈ MC Φ

i (a, h) .

Soundness (⇐) is easy — MC Φ

i (a, h) only constructs models of

Pi by construction. However, completeness (⇒) is hard: we have to show that (a, h) must eventually turn up in MC Φ

i (a, h), even if its derivation

involves values outside Good(a, h) ∪ SpareΦ(a, h). Argument involves considering certain value substitutions and recycling values at each iteration of the fixed point construction.

12/ 24

slide-47
SLIDE 47

Decidability

Theorem The model checking problem MC is decidable.

13/ 24

slide-48
SLIDE 48

Decidability

Theorem The model checking problem MC is decidable. Proof. It suffices to show that RMC is decidable: does (a, h) ∈ PiΦ?

13/ 24

slide-49
SLIDE 49

Decidability

Theorem The model checking problem MC is decidable. Proof. It suffices to show that RMC is decidable: does (a, h) ∈ PiΦ? By our correctness lemma, this is equivalent to deciding whether (a, h) ∈ MC Φ

i (a, h).

13/ 24

slide-50
SLIDE 50

Decidability

Theorem The model checking problem MC is decidable. Proof. It suffices to show that RMC is decidable: does (a, h) ∈ PiΦ? By our correctness lemma, this is equivalent to deciding whether (a, h) ∈ MC Φ

i (a, h).

But clearly MC Φ

i (a, h) is a finite and computable set (because

we restrict to subheaps of h and a finite set of values), so this is a decidable problem.

13/ 24

slide-51
SLIDE 51

Complexity of model checking

Theorem MC is EXPTIME-complete.

14/ 24

slide-52
SLIDE 52

Complexity of model checking

Theorem MC is EXPTIME-complete.

  • Proof. Computing MC Φ

i (a, h) decides the problem and can be

seen to run in exponential time in the size of (a, h, Φ).

14/ 24

slide-53
SLIDE 53

Complexity of model checking

Theorem MC is EXPTIME-complete.

  • Proof. Computing MC Φ

i (a, h) decides the problem and can be

seen to run in exponential time in the size of (a, h, Φ). EXPTIME-hardness is by reduction from the satisfiability problem for our logic, which is EXPTIME-hard [Brotherston et al., CSL-LICS’14].

14/ 24

slide-54
SLIDE 54

Complexity of model checking

Theorem MC is EXPTIME-complete.

  • Proof. Computing MC Φ

i (a, h) decides the problem and can be

seen to run in exponential time in the size of (a, h, Φ). EXPTIME-hardness is by reduction from the satisfiability problem for our logic, which is EXPTIME-hard [Brotherston et al., CSL-LICS’14]. Proposition When Φ and a are fixed, MC is still NP-hard in the size of h.

14/ 24

slide-55
SLIDE 55

Complexity of model checking

Theorem MC is EXPTIME-complete.

  • Proof. Computing MC Φ

i (a, h) decides the problem and can be

seen to run in exponential time in the size of (a, h, Φ). EXPTIME-hardness is by reduction from the satisfiability problem for our logic, which is EXPTIME-hard [Brotherston et al., CSL-LICS’14]. Proposition When Φ and a are fixed, MC is still NP-hard in the size of h.

  • Proof. By reduction from the triangle partition problem: given

a graph G = (V, E) with |V | = 3q for some q > 0, decide whether there is a partition of G into triangles.

14/ 24

slide-56
SLIDE 56

MEM: Restriction to memory-consuming rules

An inductive rule set is memory-consuming (a.k.a. “in MEM”)

15/ 24

slide-57
SLIDE 57

MEM: Restriction to memory-consuming rules

An inductive rule set is memory-consuming (a.k.a. “in MEM”) if every rule in it is of the form Π : emp ⇒ Px,

  • r

∃z. Π : F ∗ x → t ⇒ Px . i.e., one or more pointers are “consumed” when recursing.

15/ 24

slide-58
SLIDE 58

MEM: Restriction to memory-consuming rules

An inductive rule set is memory-consuming (a.k.a. “in MEM”) if every rule in it is of the form Π : emp ⇒ Px,

  • r

∃z. Π : F ∗ x → t ⇒ Px . i.e., one or more pointers are “consumed” when recursing. In practice, almost all predicate definitions in the literature fall into MEM.

15/ 24

slide-59
SLIDE 59

Model checking in the MEM fragment

Theorem MC ∈ NP when all predicates are restricted to MEM.

16/ 24

slide-60
SLIDE 60

Model checking in the MEM fragment

Theorem MC ∈ NP when all predicates are restricted to MEM.

  • Proof. Given predicate Pi, values a and heap h, we can search

backwards by applying inductive rules to (a, h) ∈ Pi, noting that we can confine the search space of values using our previous observations. This search must terminate because at least one heap cell is consumed with each recursion.

16/ 24

slide-61
SLIDE 61

Model checking in the MEM fragment

Theorem MC ∈ NP when all predicates are restricted to MEM.

  • Proof. Given predicate Pi, values a and heap h, we can search

backwards by applying inductive rules to (a, h) ∈ Pi, noting that we can confine the search space of values using our previous observations. This search must terminate because at least one heap cell is consumed with each recursion. Theorem MC is in fact NP-hard for MEM(thus NP-complete), even when some further restrictions are added.

16/ 24

slide-62
SLIDE 62

Restriction: constructively valued definitions (CV)

Informally, a rule set is constructively valued (“in CV”) if values

  • f existentially quantified variables are determined by a given

heap and values for variables in the head.

17/ 24

slide-63
SLIDE 63

Restriction: constructively valued definitions (CV)

Informally, a rule set is constructively valued (“in CV”) if values

  • f existentially quantified variables are determined by a given

heap and values for variables in the head. E.g., consider two list definitions x = y: emp ⇒ ls(x, y) ∃z. x → z ∗ ls(z, y) ⇒ ls(x, y) x = y: emp ⇒ rls(x, y) ∃z. x = y: rls(x, z) ∗ z → y ⇒ rls(x, y) The existential z is constructively valued in ls, but not in rls.

17/ 24

slide-64
SLIDE 64

Restriction: deterministic definitions (DET)

A predicate Pi is said to be deterministic (in an inductive rule set Φ) if for any two of its inductive rules and any stack, the stack can satisfy the pure part of at most one of the rules.

18/ 24

slide-65
SLIDE 65

Restriction: deterministic definitions (DET)

A predicate Pi is said to be deterministic (in an inductive rule set Φ) if for any two of its inductive rules and any stack, the stack can satisfy the pure part of at most one of the rules. Again, take the list definitions: x = y: emp ⇒ ls(x, y) ∃z. x → z ∗ ls(z, y) ⇒ ls(x, y) x = y: emp ⇒ rls(x, y) ∃z. x = y: rls(x, z) ∗ z → y ⇒ rls(x, y) Here, rls is deterministic, but ls is not.

18/ 24

slide-66
SLIDE 66

Results on CV + DET fragments

Theorem MC is PTIME-solvable when all predicates are in MEM + CV + DET.

19/ 24

slide-67
SLIDE 67

Results on CV + DET fragments

Theorem MC is PTIME-solvable when all predicates are in MEM + CV + DET. Proof. Like in the MEM case, we can search backwards for a derivation

  • f (a, h) ∈ PiΦ using inductive rules. MEM ensures
  • termination. DET ensures at most one inductive rule can apply,

and CV ensures it can be instantiated in only one way.

19/ 24

slide-68
SLIDE 68

Results on CV + DET fragments

Theorem MC is PTIME-solvable when all predicates are in MEM + CV + DET. Proof. Like in the MEM case, we can search backwards for a derivation

  • f (a, h) ∈ PiΦ using inductive rules. MEM ensures
  • termination. DET ensures at most one inductive rule can apply,

and CV ensures it can be instantiated in only one way. Theorem If we remove any of the restrictions MEM, CV, DET, then the complexity of MC becomes PSPACE-hard or worse!

19/ 24

slide-69
SLIDE 69

Summary of problem complexities

CV DET CV + DET non-MEM EXPTIME EXPTIME EXPTIME ≥ PSPACE MEM NP NP NP PTIME

20/ 24

slide-70
SLIDE 70

Implementation

  • We have implemented the general EXPTIME algorithm and

the PTIME algorithm for MEM + CV + DET in OcaML.

21/ 24

slide-71
SLIDE 71

Implementation

  • We have implemented the general EXPTIME algorithm and

the PTIME algorithm for MEM + CV + DET in OcaML.

  • Tested on a range of annotated test programs, falling into

various fragments, taken from the Verifast tool (Jacobs et al., Leuvens).

21/ 24

slide-72
SLIDE 72

Implementation

  • We have implemented the general EXPTIME algorithm and

the PTIME algorithm for MEM + CV + DET in OcaML.

  • Tested on a range of annotated test programs, falling into

various fragments, taken from the Verifast tool (Jacobs et al., Leuvens).

  • Average-case performance is in line with predicted

complexity bounds.

21/ 24

slide-73
SLIDE 73

Implementation

  • We have implemented the general EXPTIME algorithm and

the PTIME algorithm for MEM + CV + DET in OcaML.

  • Tested on a range of annotated test programs, falling into

various fragments, taken from the Verifast tool (Jacobs et al., Leuvens).

  • Average-case performance is in line with predicted

complexity bounds.

  • Thus, run-time verification is broadly practical for

predicates in MEM + CV + DET; more complicated predicates can play a role in unit testing.

21/ 24

slide-74
SLIDE 74

Conclusions

  • Main contribution: for symbolic-heap separation logic with

arbitrary inductive predicates, the model checking problem is decidable and indeed EXPTIME-complete.

22/ 24

slide-75
SLIDE 75

Conclusions

  • Main contribution: for symbolic-heap separation logic with

arbitrary inductive predicates, the model checking problem is decidable and indeed EXPTIME-complete.

  • However, in practice most predicates are

memory-consuming, i.e. in MEM, in which case the problem becomes NP-complete.

22/ 24

slide-76
SLIDE 76

Conclusions

  • Main contribution: for symbolic-heap separation logic with

arbitrary inductive predicates, the model checking problem is decidable and indeed EXPTIME-complete.

  • However, in practice most predicates are

memory-consuming, i.e. in MEM, in which case the problem becomes NP-complete.

  • If we additionally insist on constructively valued (CV) and

deterministic (DET) definitions (some are, some aren’t), then the problem becomes PTIME-solvable.

22/ 24

slide-77
SLIDE 77

Future work

  • Investigate the complexity when we add classical

conjunction ∧ to the logic? (Satisfiability becomes undecidable.)

23/ 24

slide-78
SLIDE 78

Future work

  • Investigate the complexity when we add classical

conjunction ∧ to the logic? (Satisfiability becomes undecidable.)

  • Investigate complexity of satisfiability for combinations of

MEM/CV/DET.

23/ 24

slide-79
SLIDE 79

Future work

  • Investigate the complexity when we add classical

conjunction ∧ to the logic? (Satisfiability becomes undecidable.)

  • Investigate complexity of satisfiability for combinations of

MEM/CV/DET.

  • Implementing the NP algorithm for the MEM fragment can

be expected to yield better implementation performance (on MEM).

23/ 24

slide-80
SLIDE 80

Future work

  • Investigate the complexity when we add classical

conjunction ∧ to the logic? (Satisfiability becomes undecidable.)

  • Investigate complexity of satisfiability for combinations of

MEM/CV/DET.

  • Implementing the NP algorithm for the MEM fragment can

be expected to yield better implementation performance (on MEM).

  • Disprove entailments using model checking?

23/ 24

slide-81
SLIDE 81

Thanks for listening!

Try our techniques within the Cyclist distribution: github.com/ngorogiannis/cyclist Also available as an official POPL’16 Artefact.

24/ 24