abstract object creation in dynamic logic
play

Abstract Object Creation in Dynamic Logic to be or not to be created - PowerPoint PPT Presentation

Abstract Object Creation in Dynamic Logic to be or not to be created Wolfgang Ahrendt 1 Frank S. de Boer 2 Immo Grabe 3 1 Chalmers University, G oteborg, Sweden 2 CWI, Amsterdam, The Netherlands 3 Christian-Albrechts-University Kiel, Germany


  1. Abstract Object Creation in Dynamic Logic to be or not to be created Wolfgang Ahrendt 1 Frank S. de Boer 2 Immo Grabe 3 1 Chalmers University, G¨ oteborg, Sweden 2 CWI, Amsterdam, The Netherlands 3 Christian-Albrechts-University Kiel, Germany KeY Symposium Speyer, 2009 Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  2. Part I Motivation and Outline Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  3. Modeling Object Creation in Program Logics object-oriented programming languages (like Java): ◮ high-level way of creating objects ◮ abstract away from memory allocation ◮ programmer has no access to non-created (pre-)objects Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  4. Modeling Object Creation in Program Logics object-oriented programming languages (like Java): ◮ high-level way of creating objects ◮ abstract away from memory allocation ◮ programmer has no access to non-created (pre-)objects this abstraction not matched by program logics (incl. KeY): ◮ non-created objects can be referred to in the logic ◮ additional artifacts (ghost fields) to distinguish created objects ◮ consistency conditions on reachable states Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  5. Modeling Object Creation in Program Logics object-oriented programming languages (like Java): ◮ high-level way of creating objects ◮ abstract away from memory allocation ◮ programmer has no access to non-created (pre-)objects this abstraction not matched by program logics (incl. KeY): ◮ non-created objects can be referred to in the logic ◮ additional artifacts (ghost fields) to distinguish created objects ◮ consistency conditions on reachable states because of mismatch: ◮ loose full abstraction property ◮ additional complexity in formulas and proofs ◮ symbolic state bloated by createdness information Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  6. Approach Taken ◮ a logic that can only ‘talk about’ created objects Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  7. Approach Taken ◮ a logic that can only ‘talk about’ created objects problem: calculus cannot ‘substitute’ new objects into pre-conditions Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  8. Approach Taken ◮ a logic that can only ‘talk about’ created objects problem: calculus cannot ‘substitute’ new objects into pre-conditions ◮ solution: non-standard substitution using meta-knowledge about ‘newness’ Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  9. Approach Taken ◮ a logic that can only ‘talk about’ created objects problem: calculus cannot ‘substitute’ new objects into pre-conditions ◮ solution: non-standard substitution using meta-knowledge about ‘newness’ ◮ carry over to symbolic execution paradigm Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  10. In the Following ◮ simple object-oriented while-language ◮ dynamic logic for that language ◮ abstract object creation semantics ◮ backwards reasoning calculus (wp-style) ◮ symbolic execution with abstract object creation Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  11. Relevance ◮ we examine object creation in simplified setting ◮ but: keep simplifications orthogonal to object creation issue Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  12. Relevance ◮ we examine object creation in simplified setting ◮ but: keep simplifications orthogonal to object creation issue ◮ applicable to full languages featuring abstract object creation (including Java) Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  13. Part II Syntax and Semantics Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  14. A Simple Object-Oriented While Language ◮ only one class: Object ◮ 3 types: Object, Integer, Boolean ◮ no methods ◮ variables (e.g. u , v , w ) distinct from fields (e.g. x , y , z ) Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  15. A Simple Object-Oriented While Language ◮ only one class: Object ◮ 3 types: Object, Integer, Boolean ◮ no methods ◮ variables (e.g. u , v , w ) distinct from fields (e.g. x , y , z ) statements: s ::= while e do s od | if e 1 then s 2 else s 3 fi | s 1 ; s 2 | u := e | e 1 . x := e 2 | u := new Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  16. A Simple Object-Oriented While Language ◮ only one class: Object ◮ 3 types: Object, Integer, Boolean ◮ no methods ◮ variables (e.g. u , v , w ) distinct from fields (e.g. x , y , z ) statements: s ::= while e do s od | if e 1 then s 2 else s 3 fi | s 1 ; s 2 | u := e | e 1 . x := e 2 | u := new expressions: e ::= u | e . x | null | e 1 = e 2 | ( e 1 ? e 2 : e 3 ) | op ( e 1 , ..., e n ) Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  17. A Simple Object-Oriented While Language ◮ only one class: Object ◮ 3 types: Object, Integer, Boolean ◮ no methods ◮ variables (e.g. u , v , w ) distinct from fields (e.g. x , y , z ) statements: s ::= while e do s od | if e 1 then s 2 else s 3 fi | s 1 ; s 2 | u := e | e 1 . x := e 2 | u := new expressions: e ::= u | e . x | null | e 1 = e 2 | ( e 1 ? e 2 : e 3 ) | op ( e 1 , ..., e n ) to separate issues object creation and aliasing: ◮ no native statement e . x := new Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  18. A Simple Object-Oriented While Language ◮ only one class: Object ◮ 3 types: Object, Integer, Boolean ◮ no methods ◮ variables (e.g. u , v , w ) distinct from fields (e.g. x , y , z ) statements: s ::= while e do s od | if e 1 then s 2 else s 3 fi | s 1 ; s 2 | u := e | e 1 . x := e 2 | u := new expressions: e ::= u | e . x | null | e 1 = e 2 | ( e 1 ? e 2 : e 3 ) | op ( e 1 , ..., e n ) to separate issues object creation and aliasing: ◮ no native statement e . x := new ◮ can be simulated by u := new; e . x := u ( u fresh) Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  19. The Logic ◮ expressions may also contain logical variables (e.g., l ) ◮ boolean expressions are formulas ◮ true, false are formulas ◮ logical connectives ∧ , ∨ , → , ¬ ◮ quantified formulas ∀ l .φ , ∃ l .φ ◮ modal formulas (base cases): � s � φ , [ s ] φ , {U} φ , with s a statement and U (singular) update of form: ◮ u := e ◮ e 1 . x := e 2 ◮ u := new Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  20. Semantics informal in this talk ◮ [ [ u := new] ] σ : create new object and assign it to u Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  21. Semantics informal in this talk ◮ [ [ u := new] ] σ : create new object and assign it to u terminology: in a state σ : current references = created objects plus null Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  22. Semantics informal in this talk ◮ [ [ u := new] ] σ : create new object and assign it to u terminology: in a state σ : current references = created objects plus null ◮ [ [ e ] ] σ ∈ current references Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  23. Semantics informal in this talk ◮ [ [ u := new] ] σ : create new object and assign it to u terminology: in a state σ : current references = created objects plus null ◮ [ [ e ] ] σ ∈ current references ◮ [ [ ∀ l .φ ] ] σ : φ holds for all current references l Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  24. Semantics informal in this talk ◮ [ [ u := new] ] σ : create new object and assign it to u terminology: in a state σ : current references = created objects plus null ◮ [ [ e ] ] σ ∈ current references ◮ [ [ ∀ l .φ ] ] σ : φ holds for all current references l ◮ [ [ ∃ l .φ ] ] σ : φ holds for some current reference l e , l of type Object Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

  25. Semantics informal in this talk ◮ [ [ u := new] ] σ : create new object and assign it to u terminology: in a state σ : current references = created objects plus null ◮ [ [ e ] ] σ ∈ current references ◮ [ [ ∀ l .φ ] ] σ : φ holds for all current references l ◮ [ [ ∃ l .φ ] ] σ : φ holds for some current reference l e , l of type Object examples: ∀ l . � u := new �¬ ( u = l ) Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

Recommend


More recommend