180 likes | 285 Views
Modular Verification with Shared Abstractions. Uri Juhasz Noam Rinetzky Arnd Poetzsch-Heffter Mooly Sagiv Eran Yahav. research problem. Goal: Hoare style verification of ADTs, where ADT instances may have a shared representation
E N D
Modular Verification with Shared Abstractions Uri Juhasz Noam Rinetzky Arnd Poetzsch-Heffter Mooly Sagiv Eran Yahav
research problem • Goal: Hoare style verification of ADTs, where ADT instances may have a shared representation • 2 Lists Data Structures with shared list of node objects • 2 PairIterators sharing an Iterator • We aim for a program analysis • problem: a mutation of the shared state via one ADT instance may change the “logical” state of the other instances
Class Integer { private int val =0; public void inc() { this.val++; } public int val() { return this.val; } } Class Client { Integer i = new Integer(); Wrapper w= new Wrapper(i); assert(w.val() == 0); i.inc(); assert(w.val() == 1); } Example Class Wrapper { Integer wi; Wrapper(Integer in) { this.wi=in; } int val() { return this.wi.val(); } }
things change! If someone is going to pull the rug out fromunder your feet you better know how to jump
Class Integer { private int val =0; public void inc() { this.val++; } public int val() { return this.val; } } Class Client { Integer i = new Integer(); Wrapper w= new Wrapper(i); assert(w.val() == 0); i.inc(); assert(w.val() == 1); } Running Example Class Wrapper { Integer wi; Wrapper(Integer in) { this.wi=in; } int val() { return this.wi.val(); } }
Concrete Heap Client The state before the call i.inc() w Wrapper i wi Integer val=0
Concrete + Model Heap Client The state before the call i.inc() Abstract value (model field) in blue w Wrapper wv=0 i rep wv =rep.v wi Integer val=0 v=0 v=val
call Client The state before the call i.inc() Abstract value (model field) in blue w Wrapper wv=0 i rep wv =rep.v Integer val=0 v=val
entry Client The state after the call, at entry to the Integer code ( inc() ) Abstract value (model field) in blue w Wrapper wv=0 i rep wv =rep.v v=0 val=0 v=val Concrete value (private field) in black
Exit 1/2 Client The state after the body of the Integer method has finished, before it returns control to the client. Abstract value (model field) in blue w Wrapper wv=0 i rep wv =rep.v v=0 val=1 v=val (Modified) concrete value (private field) in red
Exit 2/2 Client The state after the body of the Integer method has finished, before it returns control to the client. Abstract value (model field) in blue w Wrapper wv=0 i rep wv =rep.v v=1 val=1 v=val (Modified) abstract value (model field) in red
Return 1/2 Client The state after updating abstract values, before return to the client. w Wrapper wv=0 i rep wv =rep.v v=1 v=val (modified) abstract value (model field) in red
Return 2/2 Client The state after updating abstract values, before return to the client. (modified) abstract value (model field) in red w Wrapper wv=1 i rep wv =rep.v v=1 v=val
summary maintain a DAG of components • component ~ an ADT instance • every component has an abstract state • maintain dependencies between components, such that the dependencies reflect the sharing • Reference model fields • update abstract value of model fields when shared part is changed • delay update of effected model fields • wait until they are “back in context”
Representing shared ADTs example: representing 2 ADTs (x and z) sharing a third one (y). Matthew’s approach [POPL’05] Uri’s approach x x z z y y S(y) P(x,y) P(x,y) Q(z,y) Q(z,y) S(y)