from explicit to implicit dynamic frames in java dynamic
play

From Explicit to Implicit Dynamic Frames in Java Dynamic Logic and - PowerPoint PPT Presentation

. . . From Explicit to Implicit Dynamic Frames in Java Dynamic Logic and KeY . Wojciech Mostowski Halmstad University . . NWPT 2015, 21 st October 2015 hh.se . . Overview 1 Context 2 Permission-based verification 3 Permissions with


  1. . . . From Explicit to Implicit Dynamic Frames in Java Dynamic Logic and KeY . Wojciech Mostowski Halmstad University . . NWPT 2015, 21 st October 2015 hh.se

  2. . . Overview 1 Context 2 Permission-based verification 3 Permissions with explicit framing 4 From self framing to implicit frames 5 Translation of Separation Logic 6 Wrap-up . hh.se

  3. http://www.key-project.org . KeY: Marriage of the two to enable interactive verification with permissions Both work with Design-by-Contract principles and (modified) JML Self-contained, automated interactive verifier Specification language JML with dynamic frames – JML* Emphasis on Java, based on Dynamic Logic Deductive Verification of Object-Oriented Programs . Automated tool support, Chalice/Silicon based JML with permissions on the specification layer Permission-based Separation Logic for Java Verification of Concurrent Data Structures VerCors: Projects. . http://fmt.cs.utwente.nl/research/projects/VerCors/ hh.se

  4. . KeY: Marriage of the two to enable interactive verification with permissions Both work with Design-by-Contract principles and (modified) JML Self-contained, automated interactive verifier Specification language JML with dynamic frames – JML* Emphasis on Java, based on Dynamic Logic Deductive Verification of Object-Oriented Programs . Automated tool support, Chalice/Silicon based JML with permissions on the specification layer Permission-based Separation Logic for Java Verification of Concurrent Data Structures VerCors: Projects. . http://fmt.cs.utwente.nl/research/projects/VerCors/ http://www.key-project.org hh.se

  5. . KeY: Marriage of the two to enable interactive verification with permissions Both work with Design-by-Contract principles and (modified) JML Self-contained, automated interactive verifier Specification language JML with dynamic frames – JML* Emphasis on Java, based on Dynamic Logic Deductive Verification of Object-Oriented Programs . Automated tool support, Chalice/Silicon based JML with permissions on the specification layer Permission-based Separation Logic for Java Verification of Concurrent Data Structures VerCors: Projects. . http://fmt.cs.utwente.nl/research/projects/VerCors/ http://www.key-project.org hh.se

  6. Each heap read access guarded by p 1 (or 100%) Each heap write access guarded by p 1 Forking & locking Representatives: Separation Logic and Implicit Dynamic Frames (absence of data races) Verification guarantees non-interference for heap access [Resource invariants] Permission transfers (produce/consume style) . Synchronisation: Programs are verified (thread locally) w.r.t. these annotations Specifications provide permission annotations (fractions) Classical Permission-Based Reasoning . . hh.se

  7. . . Classical Permission-Based Reasoning Specifications provide permission annotations (fractions) Programs are verified (thread locally) w.r.t. these annotations Synchronisation: Forking & locking Permission transfers (produce/consume style) [Resource invariants] Verification guarantees non-interference for heap access (absence of data races) Representatives: Separation Logic and Implicit Dynamic Frames . Each heap read access guarded by p ≤ 1 (or 100%) Each heap write access guarded by p = 1 hh.se

  8. . . Classical Permission-Based Reasoning Specifications provide permission annotations (fractions) Programs are verified (thread locally) w.r.t. these annotations Synchronisation: Forking & locking Permission transfers (produce/consume style) [Resource invariants] Verification guarantees non-interference for heap access (absence of data races) Representatives: Separation Logic and Implicit Dynamic Frames . Each heap read access guarded by p ≤ 1 (or 100%) Each heap write access guarded by p = 1 hh.se

  9. . . Classical Permission-Based Reasoning Example . class Counter { int c; //@ requires Perm( this .c, 1); ensures Perm( this .c, 1); void increase() { this .c++; } void use() { lock(); increase(); unlock(); } //@ requires true ; ensures Perm( this .c, 1); native void lock(); //@ requires Perm( this .c, 1); ensures true ; native void unlock(); } hh.se

  10. where framing is explicit: Explicitly listed read and write frames ( accessible & assignable ) Changes specified in terms of old and new values ( \old ) . . Explicit and Implicit Framing In Separation Logic-like reasoning framing is implicit: Write permission indicates that a location might be changed Read permission indicates that a location might be read Both are very important for modular reasoning Heap locations without permission are out of scope JML* and Java Dynamic Logic are based on the original dynamic frames idea Explicit heap (logic) variable Frames can be abstract . hh.se

  11. . . Explicit and Implicit Framing In Separation Logic-like reasoning framing is implicit: Write permission indicates that a location might be changed Read permission indicates that a location might be read Both are very important for modular reasoning Heap locations without permission are out of scope JML* and Java Dynamic Logic are based on the original dynamic frames idea Explicit heap (logic) variable Frames can be abstract . where framing is explicit: Explicitly listed read and write frames ( accessible & assignable ) Changes specified in terms of old and new values ( \old ) hh.se

  12. heap heapAtPre o Object f Field o f fp o f o f get heap anon heap allLocs fp anonHeap get (accessible) (assignable) . Java Dynamic Logic . JML* Example . . class Counter { int c; //@ model \locset fp = this .c; //@ ensures this .c == \old ( this .c) + 1; assignable fp; void increase() { this .c++; } //@ ensures \result == this .c; accessible fp; int /*@ strictly_pure @*/ get() { return this .c; } } hh.se

  13. . . (accessible) (assignable) Java Dynamic Logic . JML* Example . class Counter { int c; //@ model \locset fp = this .c; //@ ensures this .c == \old ( this .c) + 1; assignable fp; void increase() { this .c++; } //@ ensures \result == this .c; accessible fp; int /*@ strictly_pure @*/ get() { return this .c; } } ∀ o : Object , f : Field ( o , f ) ∈ fp ∨ o . f @ heap = o . f @ heapAtPre get () = { heap : = anon ( heap , allLocs \ fp , anonHeap ) } get () hh.se

  14. . . Permissions in JML* Symbolic permissions Additional flexibility for complex permission flows 2 Second heap to store permissions Parallel to the regular heap Separate framing Heaps named explicitly Can be switched-off – sequential reasoning 3 Method to show self-framing of specifications w.r.t. permissions Self-framing is not automatic like in Separation Logic 4 Modular specifications with abstractions – synchronisation through Java API . 1 Permission system that allows for the new = modified old specification style hh.se

  15. . . Permissions in JML* Symbolic permissions Additional flexibility for complex permission flows 2 Second heap to store permissions Parallel to the regular heap Separate framing Heaps named explicitly Can be switched-off – sequential reasoning 3 Method to show self-framing of specifications w.r.t. permissions Self-framing is not automatic like in Separation Logic 4 Modular specifications with abstractions – synchronisation through Java API . 1 Permission system that allows for the new = modified old specification style hh.se

  16. . . Permissions in JML* Symbolic permissions Additional flexibility for complex permission flows 2 Second heap to store permissions Parallel to the regular heap Separate framing Heaps named explicitly Can be switched-off – sequential reasoning 3 Method to show self-framing of specifications w.r.t. permissions Self-framing is not automatic like in Separation Logic 4 Modular specifications with abstractions – synchronisation through Java API . 1 Permission system that allows for the new = modified old specification style hh.se

  17. . . Permissions in JML* Symbolic permissions Additional flexibility for complex permission flows 2 Second heap to store permissions Parallel to the regular heap Separate framing Heaps named explicitly Can be switched-off – sequential reasoning 3 Method to show self-framing of specifications w.r.t. permissions Self-framing is not automatic like in Separation Logic 4 Modular specifications with abstractions – synchronisation through Java API . 1 Permission system that allows for the new = modified old specification style hh.se

  18. . Example . Permissions in JML* . public class ArrayList { Object[] cnt; int s; //@ model \locset fp = s, cnt, cnt[*]; //@ requires \readPerm ( \perm (s)); //@ ensures \result == s; //@ accessible <heap> fp; accessible <permissions> \nothing ; /*@ pure @*/ int size() { return s; } //@ requires \readPerm ( \perm (cnt)); //@ requires \writePerm ( \perm (s)) && \writePerm ( \perm (cnt[s])); //@ ensures size() == \old (size()) + 1; //@ assignable <heap> fp; assignable <permissions> \strictly_nothing ; void add(Object o) { cnt[s++] = o; } } hh.se

  19. . Example . Permissions in JML* . public class ArrayList { Object[] cnt; int s; //@ model \locset fp = s, cnt, cnt[*]; //@ requires \readPerm ( \perm (s)); //@ ensures \result == s; //@ accessible <heap> fp; accessible <permissions> \nothing ; /*@ pure @*/ int size() { return s; } //@ requires \readPerm ( \perm (cnt)); //@ requires \writePerm ( \perm (s)) && \writePerm ( \perm (cnt[s])); //@ ensures size() == \old (size()) + 1; //@ assignable <heap> fp; assignable <permissions> \strictly_nothing ; void add(Object o) { cnt[s++] = o; } } hh.se

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend