the harpo verifier status 2018 october 15 verifying the
play

+ The HARPO Verifier Status 2018 October 15 Verifying the - PowerPoint PPT Presentation

+ The HARPO Verifier Status 2018 October 15 Verifying the Correctness of HARPO Programs 1 Verifying the Correctness of HARPO Programs Presented at NECEC 2018, St. Johns NL Inaam Ahmed Computer Engineering Research Labs, Dept. ECE, MUN


  1. + The HARPO Verifier Status 2018 October 15 Verifying the Correctness of HARPO Programs 1

  2. Verifying the Correctness of HARPO Programs Presented at NECEC 2018, St. John’s NL Inaam Ahmed Computer Engineering Research Labs, Dept. ECE, MUN 2018 November 13 Verifying the Correctness of HARPO Programs 2

  3. + Review ofHarpo ◼ HARdware Parallel Objects ◼ An executing Harpo program is a static network of objects. ◼ Each contains 0 or more threads ◼ Each contains 0 or more locations or arrays and connects to 0 or more other objects. ◼ Objects communicate via client/server rendezvous. ◼ Objects are implemented as software (e.g. concurrent C) or hardware (e.g. FPGA). Verifying the Correctness of HARPO Programs 3

  4. + Data flowarchitecture Abstract Harpo Attributed Syntax First Checker source AST Tree Pass C Back VHDL Boogie End Back end Back end VHDL Boogie C source source Verifying the Correctness of HARPO Programs 4

  5. + HARPO Program ◼ HARPO Programs Program (ClassDecl | IntfDecl | ObjectDecl | ConstDecl |; ) ◼ Interfaces Contains method declaration with ghost parameters ◼ Classes Classes have the annotations claim and invariant ◼ Objects Ghost objects are annotated with ghost keyword ◼ Constants Constants having HARPO primitive type Verifying the Correctness of HARPO Programs 5

  6. + Program Translation into Boogie Abstract Harpo Attributed Syntax First Checker source AST Tree Pass VHDL Boogie Verification Back end Z3 Boogie Back end Report Verifying the Correctness of HARPO Programs 6

  7. + Running example:Input ( class Math obj c:int32 :=0; ( thread (*t0*) claim c c:=2+2; assert c=4; thread ) class ) Verifying the Correctness of HARPO Programs 7

  8. + class AST { // slightly simplified [ ClassDeclNd ( ObjDeclNd [c]( NamedTypeNd( Int32 ) : loc{Int32}, ValueInitExpNd(IntLiteralExpNd(0):Int32):Int32), ThreadDeclNd [t#0]( ThrdClaimNd( [ NameExpNd( c ) : Int32), SeqCommandNd( AssertCmdNd( ChainExpNd( [ LessOp ], [ FetchExpNd( NameExpNd( c ) : loc{Int32} ) : Int32, IntLiteralExpNd( 20 ) : Int32 ] ) : Bool ) ) ) ) ) ) ,] Verifying the Correctness of HARPO Programs 8

  9. + AST after firstpass Verifying the Correctness of HARPO Programs 9

  10. + Checker Passes modify and add attributes to the AST in-place Class Symbol Envoron- Table ment Symbol Class Resolver Type Table Environment Creator Builder Creator Abstract Type Syntax Checker Tree Verifying the Correctness of HARPO Programs 10

  11. + Running example after TableCreator ◼ Creates a map ◼ from fully qualified names ◼ to declaration nodes in the AST Math Math.c Math.*t0* Int32 Verifying the Correctness of HARPO Programs 11

  12. + Resolver pass ◼ Links each Name node to a declaration ◼ After this, the symbol table is no longer needed! Verifying the Correctness of HARPO Programs 12

  13. + Type CreatorPass ◼ Creates types as needed. ◼ Associates all Type nodes (except NoType nodes) witha type. ◼ TypeNodes – syntactic representation of types ◼ Types – semantic representation of types Verifying the Correctness of HARPO Programs 13

  14. + Running Example afterType Creation Pass LocationType PrimitiveType(Int32) Verifying the Correctness of HARPO Programs 14

  15. + Boogie Back-end ◼ Goal: Translate Harpo to Boogie that can run on Boogie Verification Tool ◼ A standard approach for program verification is to use the theorem proving ◼ Source code with program specifications is converted into the verification conditions ◼ Theorem prover use the verification to determine the correctness of the program ◼ Longer term goal: Implement the Boogie backend into an interactive tool Verifying the Correctness of HARPO Programs 15

  16. + Complexity ◼ Generating the verification conditions is complex task ◼ Mitigate the complexity by dividing the task into two steps: ◼ Convert source into IVL (Boogie) ◼ Let Boogie talk with theorem prover (Z3) Verifying the Correctness of HARPO Programs 16

  17. + Memory Model ◼ We are using heap memory model which maps the fields and object references to values. ◼ Objects Heap ◼ Array Heap Ref -2 -1 0 1 2 3 x y z bool m <Ref> Boolean T T T F F T 12 13 T <Ref> 15 16 4.0 Integer 1 2 56 7 98 62 2.6 76.0 8.6 233.6 8.8 98.0 Real Verifying the Correctness of HARPO Programs 17

  18. + Boogie Prelude ◼ Independent of the source program being translated. ◼ Contains some important properties such as, ◼ modeling memory ◼ reference types ◼ type axioms ◼ array length and permission type ◼ Required for translation of HARPO program. ◼ Final output program consists of boogie prelude and the translation of specific HARPO program. Verifying the Correctness of HARPO Programs 18

  19. + Boogie Back End Pass Abstract Boogie Syntax Source Tree Code Translate String Buffer Traverse Decls to Builder Tree Boogie Boogie Prelude String Verifying the Correctness of HARPO Programs 19

  20. + A Few Translations Program HARPO Code Boogie Code components ( class A Class const unique A: ClassName; class members class) ( interface B Interface const unique B: ClassName; Interface members interface ) Field obj h: Int8 : = Exp const unique A.h: Field int; const c: real; Constants const c: real16: = Exp h axiom x == Exp b while ( G b ) invariant I While Statement (while G h invariant I statement(s) while) Boogie statements Procedure A.T(this: Ref) Modifies H. ArrayH; (thread T claim init_Permission block Thread Requires dtype(this) <: C; thread) {…thread block …claim translation} Verifying the Correctness of HARPO Programs 20

  21. Listing 0 Translated ◼ Boogie Source //prelude 1. type Ref; 2. type Field a; 3. type HeapType = <a> [Ref,Field a]a; 4. var Heap:HeapType; 5. type Perm = real ; 6. type PermissionType = <a>[Ref, Field a]Perm; // Specific translated part of Listing 0 7. type className; 8. function dtype(Ref) returns (className); 9. const unique Math:className; 10.const unique Math.c : Field int; 11.procedure Math.t0( this :Ref) 12.modifies Heap; 13.{ var Permission : PermissionType where a. ( forall <a> r:Ref, f : Field a :: Permission[r,f] == 0.0 ) ; 14.var oldHeap, tmpHeap : HeapType ; 15.Permission[this, Math.c] := 1.0; 16.assert Permission[ this , Math.c ] == 1.0 ; 17.Heap[ this ,Math.c]:= 2+2; 18.assert Permission[ this , Math.c ] > 0.0 ; 19.assert Heap[ this ,Math.c]==4 ;} Verifying the Correctness of HARPO Programs 21

  22. Conclusion and Future Work ◼ Automated the process of translation ◼ Implementation will result an independent backend of verifier ◼ Support concurrent threads verification ◼ Some Language features, like functions and predicates, are needed to be added ◼ Develop a verification tool like Dafny Verifying the Correctness of HARPO Programs 22

  23. + The End Verifying the Correctness of HARPO Programs 23

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