Nested Interpolants Matthias Heizmann Jochen Hoenicke Andreas - - PowerPoint PPT Presentation

nested interpolants
SMART_READER_LITE
LIVE PREVIEW

Nested Interpolants Matthias Heizmann Jochen Hoenicke Andreas - - PowerPoint PPT Presentation

Nested Interpolants Matthias Heizmann Jochen Hoenicke Andreas Podelski University of Freiburg, Germany POPL 2010 Result Interpolant-based software model checking for recursive programs avoid construction of an abstract program Hoare


slide-1
SLIDE 1

Nested Interpolants

Matthias Heizmann Jochen Hoenicke Andreas Podelski

University of Freiburg, Germany

POPL 2010

slide-2
SLIDE 2
slide-3
SLIDE 3

Result Interpolant-based software model checking for recursive programs

◮ avoid construction of an abstract program ◮ Hoare logic nested words

slide-4
SLIDE 4

Software model checking

Thomas Ball, Sriram K. Rajamani: The SLAM project: debugging system software via static analysis. (POPL 2002) Thomas A. Henzinger, Ranjit Jhala, Rupak Majumdar, Gr´ egoire Sutre Lazy abstraction. (POPL 2002) Thomas A. Henzinger, Ranjit Jhala, Rupak Majumdar, Kenneth L. McMillan Abstractions from proofs. (POPL 2004)

program abstract program invariant theorem proving model checking

slide-5
SLIDE 5

Software model checking

Thomas Ball, Sriram K. Rajamani: The SLAM project: debugging system software via static analysis. (POPL 2002) Thomas A. Henzinger, Ranjit Jhala, Rupak Majumdar, Gr´ egoire Sutre Lazy abstraction. (POPL 2002) Thomas A. Henzinger, Ranjit Jhala, Rupak Majumdar, Kenneth L. McMillan Abstractions from proofs. (POPL 2004)

program abstract program invariant theorem proving model checking Bottleneck: Construction of abstract program

slide-6
SLIDE 6

Recent approaches: Avoid construction of abstract program

Franjo Ivancic, Ilya Shlyakhter, Aarti Gupta, Malay K. Ganai Model checking C programs using F-SOFT (ICCD 2005) Kenneth L. McMillan Lazy abstraction with interpolants (CAV 2006) Nels Beckman, Aditya V. Nori, Sriram K. Rajamani, Robert J. Simmons Proofs from tests (ISSTA 2008) Bhargav S. Gulavani, Supratik Chakraborty, Aditya V. Nori, Sriram K. Rajamani Automatically refining abstract interpretations (TACAS 2008)

slide-7
SLIDE 7

One idea: Use interpolants to avoid construction of the abstract program program abstract program invariant theorem proving model checking interpolating theorem prover

slide-8
SLIDE 8

One idea: Use interpolants to avoid construction of the abstract program program abstract program invariant theorem proving model checking interpolating theorem prover

Ranjit Jhala, Kenneth L. McMillan A practical and complete approach to predicate refinement (TACAS 2006) Kenneth L. McMillan Lazy abstraction with interpolants (CAV 2006) Quantified invariant generation using an interpolating saturation prover (TACAS 2008)

Open: Interpolants in interprocedural analysis

slide-9
SLIDE 9

Interprocedural static analysis - motivation

Recursive Programs?

slide-10
SLIDE 10

Interprocedural static analysis - motivation

Recursive Programs?

Modularity!

slide-11
SLIDE 11

Interprocedural static analysis - motivation

Recursive Programs?

Modularity! Interprocedural analysis, a classical topic in programming languages

Micha Sharir, Amir Pnueli Two approaches to interprocedural data flow analysis (1981) Thomas W. Reps, Susan Horwitz, Shmuel Sagiv Precise interprocedural dataflow analysis via graph reachability (POPL 1995) Shaz Qadeer, Sriram K. Rajamani, Jakob Rehof Summarizing procedures in concurrent programs (POPL 2004)

slide-12
SLIDE 12

Interpolants

Interpolant - for a proof

Given:

Proof A ⇒ B

Interpolation:

A ⇒ I ⇒ B . ... automatically generated by SMT solver (Craig interpolation)

slide-13
SLIDE 13

Interpolants

Interpolant - for a proof

Given:

Proof A ⇒ B

Interpolation:

A ⇒ I ⇒ B . ... automatically generated by SMT solver (Craig interpolation) Interpolant - for an execution traces

Given:

Infeasible trace st1 . . . sti sti+1 . . . stn

Interpolation: post( true , st1 . . . sti ) ⊆ I ⊆ wp( sti+1 . . . stn , false )

... can be new formula, not contained in program

slide-14
SLIDE 14

Inductive interpolants

Construct sequence of interpolants I0 . . . In inductively post( Ii , sti ) ⊆ Ii+1 suitable Hoare annotation to prove infeasibility of program slice

slide-15
SLIDE 15

Inductive interpolants

Construct sequence of interpolants I0 . . . In inductively post( Ii , sti ) ⊆ Ii+1 suitable Hoare annotation to prove infeasibility of program slice What if execution trace contains procedure calls?

slide-16
SLIDE 16

Interpolants for interprocedural analysis

What is an interpolant for an interprocedural execution?

slide-17
SLIDE 17

Interpolants for interprocedural analysis

What is an interpolant for an interprocedural execution?

◮ state with a stack?

locality of interpolant is lost

slide-18
SLIDE 18

Interpolants for interprocedural analysis

What is an interpolant for an interprocedural execution?

◮ state with a stack?

locality of interpolant is lost

◮ only local valuations?

call/return dependency lost, sequence of interpolants is not a proof

slide-19
SLIDE 19

Our gordian knot

How can we keep track of the call/return dependency in a sequence of states without a stack?

slide-20
SLIDE 20
slide-21
SLIDE 21

Nested words

Idea: Add call/return dependency explicitly to the word

Rajeev Alur Marrying words and trees (PODS 2007) Rajeev Alur, P. Madhusudan Adding nesting structure to words (DLT 2006, J. ACM 56(3) 2009) Rajeev Alur, Swarat Chaudhuri Temporal reasoning for procedural programs (VMCAI 2010)

slide-22
SLIDE 22

Nested words

Idea: Add call/return dependency explicitly to the word

Rajeev Alur Marrying words and trees (PODS 2007) Rajeev Alur, P. Madhusudan Adding nesting structure to words (DLT 2006, J. ACM 56(3) 2009) Rajeev Alur, Swarat Chaudhuri Temporal reasoning for procedural programs (VMCAI 2010)

slide-23
SLIDE 23

Nested interpolants

What is a sequence of interpolants for an interprocedural execution? Idea: Define sequence interpolants with respect to nested trace

slide-24
SLIDE 24

Nested interpolants

What is a sequence of interpolants for an interprocedural execution? Idea: Define sequence interpolants with respect to nested trace post

  • Ii , Ik , return
  • ⊆ Ii+1
slide-25
SLIDE 25

Control flow as nested word automata

procedure m(x) returns (res)

ℓ0: if x>100 ℓ1:

res:=x-10 else

ℓ2:

xm := x+11

ℓ3:

call m

ℓ4:

xm := resm

ℓ5:

call m

ℓ6:

res := resm

ℓ7: assert (x<=101 -> res=91)

return m

McCarthy 91 function

ℓ0 ℓ1 ℓ2 ℓ3 ℓ4 ℓ5 ℓ6 ℓ7 ℓerr x>100 res:=x-10 x<=100 xm:=x+11 call m xm:=resm call m res:=resm return m ↑ ℓ3 return m ↑ ℓ5 x≤101∧res=91

nested word automaton

slide-26
SLIDE 26

Floyd-Hoare proof as nested word automata

procedure m(x) returns (res)

{⊤}

ℓ0: if x>100

{x ≥ 101}

ℓ1:

res:=x-10 else

{x ≤ 100}

ℓ2:

xm := x+11

{xm ≤ 111}

ℓ3:

call m

{resm ≤ 101}

ℓ4:

xm := resm

{xm ≤ 101}

ℓ5:

call m

{resm = 91}

ℓ6:

res := resm

{res = 91 ∨ (x ≥ 101 ∧ res = x − 10)}

ℓ7: assert (x<=101 -> res=91)

return m

McCarthy 91 function

⊤ x ≥ 101 x ≤ 100 xm ≤ 111 resm ≤ 101 xm ≤ 101 resm = 91 res = 91∨ x ≥101∧res =x −10 x>100 res:=x-10 x<=100 xm:=x+11 call m xm:=resm call m res:=resm return m ↑ xm ≤111 return m ↑ xm ≤101

nested word automaton

slide-27
SLIDE 27

Floyd-Hoare proof as nested word automata

procedure m(x) returns (res)

{⊤}

ℓ0: if x>100

{x ≥ 101}

ℓ1:

res:=x-10 else

{x ≤ 100}

ℓ2:

xm := x+11

{xm ≤ 111}

ℓ3:

call m

{resm ≤ 101}

ℓ4:

xm := resm

{xm ≤ 101}

ℓ5:

call m

{resm = 91}

ℓ6:

res := resm

{res = 91 ∨ (x ≥ 101 ∧ res = x − 10)}

ℓ7: assert (x<=101 -> res=91)

return m

McCarthy 91 function

⊤ x ≥ 101 x ≤ 100 xm ≤ 111 resm ≤ 101 xm ≤ 101 resm = 91 res = 91∨ x ≥101∧res =x −10 x>100 res:=x-10 x<=100 xm:=x+11 call m xm:=resm call m res:=resm return m ↑ xm ≤111 return m ↑ xm ≤101

nested word automaton

e.g. post

  • x ≤ 100 , xm:=x+11

⊆ xm ≤ 111

slide-28
SLIDE 28

Constructing a proof of correctness

Compute sequence of nested interpolants

x<=100 xm:=x+11 call m x>100 res:=x-10 return m xm:=resm call m x>100 res:=x-10 return m res:=resm x≤101∧res=91) ϕ0 : x−1 ≤100 ϕ1 : x1

m =x−1+11

ϕ2 : x2 =x1

m

ϕ5 : res5

m =res4

ϕ6 : x6

m =res5 m

ϕ7 : x7 =x6

m

ϕ10 : res10

m =res9

ϕ11 : res11 =res10

m

ϕ12 : x−1 ≤ 100 ∧ res11 = 91 ϕ3 : x2 >100 ϕ4 : res4 =x2−10 ϕ8 : x7 >100 ϕ9 : res9 =x7−10

I0 : ⊤ I1 : x ≤100 I2 : xm ≤111 I3 : ⊤ I4 : ⊤ I5 : res ≤x − 10 I6 : resm ≤101 I7 : xm ≤101 I8 : ⊤ I9 : x ≥101 I10 : x ≥101 ∧ res =x − 10 I11 : resm =91 I12 : res =91 I13 : ⊥

infeasible nested trace π SSA of π sequence of interpolants for π

slide-29
SLIDE 29

Constructing a proof of correctness

Nested interpolant automaton

I0 : ⊤ I1 : x ≤100 I2 : xm ≤111 I3 : ⊤ I4 : ⊤ I5 : res ≤x − 10 I6 : resm ≤101 I7 : xm ≤101 I8 : ⊤ I9 : x ≥101 I10 : x ≥101 ∧ res =x − 10 I11 : resm =91 I12 : res =91 I13 : ⊥

sequence of interpolants for π

q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 q13 x<=100 xm:=x+11 call m x>100 res:=x-10 return m ↑ q2 xm:=resm call m x>100 res:=x-10 return m ↑ q7 res:=resm x≤101∧res=91) x<=100 x<=100 return m ↑ q7 return m ↑ q2

nested interpolant automaton

slide-30
SLIDE 30

Constructing a proof of correctness

Nested interpolant automaton

I0 : ⊤ I1 : x ≤100 I2 : xm ≤111 I3 : ⊤ I4 : ⊤ I5 : res ≤x − 10 I6 : resm ≤101 I7 : xm ≤101 I8 : ⊤ I9 : x ≥101 I10 : x ≥101 ∧ res =x − 10 I11 : resm =91 I12 : res =91 I13 : ⊥ x<=100 xm:=x+11 call m x>100 res:=x-10 return m xm:=resm call m x>100 res:=x-10 return m res:=resm x≤101∧res=91)

sequence of interpolants for π

q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 q13 x<=100 xm:=x+11 call m x>100 res:=x-10 return m ↑ q2 xm:=resm call m x>100 res:=x-10 return m ↑ q7 res:=resm x≤101∧res=91) x<=100 x<=100 return m ↑ q7 return m ↑ q2

nested interpolant automaton

slide-31
SLIDE 31

Constructing a proof of correctness

CEGAR

recursive program P P is correct P is incorrect L(A) ∩ L(AP) = ∅ ? π ∈ L(AΣ) ? no return nested error trace π such that π ∈ L(A) ∩ L(AP) no return refined abstraction A := A ∩ AI where AI is a nested interpolant automaton such that π ∈ L(AI) yes yes start with A such that L(A) ⊇ L(AΣ)

slide-32
SLIDE 32

Conclusion Interpolant-based software model checking for recursive programs

◮ avoid construction of an abstract program ◮ Hoare logic nested words