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

abstract object creation in dynamic logic
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Abstract Object Creation in Dynamic Logic

to be or not to be created Wolfgang Ahrendt1 Frank S. de Boer2 Immo Grabe3

1Chalmers University, G¨

  • teborg, Sweden

2CWI, Amsterdam, The Netherlands 3Christian-Albrechts-University Kiel, Germany

KeY Symposium Speyer, 2009

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-2
SLIDE 2

Part I Motivation and Outline

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-3
SLIDE 3

Modeling Object Creation in Program Logics

  • bject-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

slide-4
SLIDE 4

Modeling Object Creation in Program Logics

  • bject-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

slide-5
SLIDE 5

Modeling Object Creation in Program Logics

  • bject-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

slide-6
SLIDE 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

slide-7
SLIDE 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

slide-8
SLIDE 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

slide-9
SLIDE 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

slide-10
SLIDE 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

slide-11
SLIDE 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

slide-12
SLIDE 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

slide-13
SLIDE 13

Part II Syntax and Semantics

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-14
SLIDE 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

slide-15
SLIDE 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 e1 then s2 else s3 fi | s1; s2 | u := e | e1.x := e2 | u := new

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-16
SLIDE 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 e1 then s2 else s3 fi | s1; s2 | u := e | e1.x := e2 | u := new expressions: e ::= u | e.x | null | e1 = e2 | (e1 ? e2 : e3) | op(e1, ..., en)

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-17
SLIDE 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 e1 then s2 else s3 fi | s1; s2 | u := e | e1.x := e2 | u := new expressions: e ::= u | e.x | null | e1 = e2 | (e1 ? e2 : e3) | op(e1, ..., en) 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

slide-18
SLIDE 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 e1 then s2 else s3 fi | s1; s2 | u := e | e1.x := e2 | u := new expressions: e ::= u | e.x | null | e1 = e2 | (e1 ? e2 : e3) | op(e1, ..., en) 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

slide-19
SLIDE 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 ◮ e1.x := e2 ◮ u := new Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-20
SLIDE 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

slide-21
SLIDE 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

slide-22
SLIDE 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

slide-23
SLIDE 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

slide-24
SLIDE 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

slide-25
SLIDE 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

slide-26
SLIDE 26

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) true in all states

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-27
SLIDE 27

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) true in all states u := new∀l.¬(u = l)

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-28
SLIDE 28

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) true in all states u := new∀l.¬(u = l) false in all states

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-29
SLIDE 29

Part III Calculus

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-30
SLIDE 30

Sequent Calculus

rules triggered by top-level formulas only:

◮ propositional rules, first-order rules, induction ◮ all these are standard!

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-31
SLIDE 31

Sequent Calculus

rules triggered by top-level formulas only:

◮ propositional rules, first-order rules, induction ◮ all these are standard! ◮ in particular: quantifier rules are standard!

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-32
SLIDE 32

Sequent Calculus

rules triggered by top-level formulas only:

◮ propositional rules, first-order rules, induction ◮ all these are standard! ◮ in particular: quantifier rules are standard!

rules triggered also by sub-formulas:

◮ program rules, update application rule ◮ notation used:

⌊ φ′ ⌋ ⌊ φ ⌋ meaning: premis obtained from conclusion by replacing any φ with φ′

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-33
SLIDE 33

Sequent Calculus

rules triggered by top-level formulas only:

◮ propositional rules, first-order rules, induction ◮ all these are standard! ◮ in particular: quantifier rules are standard!

rules triggered also by sub-formulas:

◮ program rules, update application rule ◮ notation used:

⌊ φ′ ⌋ ⌊ φ ⌋ meaning: premis obtained from conclusion by replacing any φ with φ′ ( \find(φ) \replacewith(φ′) )

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-34
SLIDE 34

Dynamic Logic Rules

split

⌊ [s1]

  • [s2]

φ ⌋ ⌊ [s1; s2] φ ⌋

if

⌊ (e → [s1] φ) ∧ (¬e → [s2] φ) ⌋ ⌊ [if e then s1 else s2 fi] φ ⌋

unwind

⌊ [if e then s; while e do s od else skip fi] φ ⌋ ⌊ [while e do s od] φ ⌋

assignVar

⌊ {u := e}φ ⌋ ⌊ [u := e] φ ⌋

assignField

⌊ {e1.x := e2}φ ⌋ ⌊ [e1.x := e2] φ ⌋

createObj

⌊ {u := new}φ ⌋ ⌊ [u := new] φ ⌋

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-35
SLIDE 35

Update Application Rule

for certain formulas {U}φ, the U can be ‘applied’ (resovled)

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-36
SLIDE 36

Update Application Rule

for certain formulas {U}φ, the U can be ‘applied’ (resovled)

applyUpd

⌊ φ′ ⌋ ⌊ {U}φ ⌋ if {U}φ φ′

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-37
SLIDE 37

Update Application Rule

for certain formulas {U}φ, the U can be ‘applied’ (resovled)

applyUpd

⌊ φ′ ⌋ ⌊ {U}φ ⌋ if {U}φ φ′ now define relation , resolving updates in a single step following slides: big-step definition of

  • Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe

Abstract Object Creation in Dynamic Logic

slide-38
SLIDE 38

Part IV Update Application

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-39
SLIDE 39

Update Application: Standard Cases I

¬{U}φ φ′ {U}(¬φ) φ′ {U}φ1 ∗ {U}φ2 φ′ {U}(φ1 ∗ φ2) φ′ with ∗ ∈ {∧, ∨, →}

  • p({U}e1, ..., {U}en) e′

{U}op(e1, ..., en) e′ ({U}e1 ? {U}e2 : {U}e3) e′ {U}(e1 ? e2 : e3) e′ {U}α α with α ∈ {true, false, null, l} this slide: U matches all updates

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-40
SLIDE 40

Update Application: Standard Cases II

{u := e}u e {u := α}v v u ≡ v α ≡ e | new ({u := e1}e2).x e′ {u := e1}(e2.x) e′ ( ({e.x := e1}e2) = e ? e1 : ({e.x := e1}e2).x ) e′ {e.x := e1}(e2.x) e′ ({e.x := e1}e2).y e′ {e.x := e1}(e2.y) e′ x ≡ y

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-41
SLIDE 41

Update Application: Restricted Standard Cases

The standard rules for quantifiers and equality are restricted to non-creating updates Unc of the forms ‘u := e’ , ‘e1.x := e2’ . ( ‘u := new’ excluded from these rules.) ∀l. {Unc}φ φ′ {Unc}(∀l. φ) φ′ ∃l. {Unc}φ φ′ {Unc}(∃l. φ) φ′ {Unc}e1 = {Unc}e2 e′ {Unc}(e1 = e2) e′

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-42
SLIDE 42

Object Creating Update Application: the Issue

recall:

◮ ‘{U}φ’ is the (explicit) weakest precondition wp(U, φ) ◮ applying U to φ (via ) computes weakest precondition

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-43
SLIDE 43

Object Creating Update Application: the Issue

recall:

◮ ‘{U}φ’ is the (explicit) weakest precondition wp(U, φ) ◮ applying U to φ (via ) computes weakest precondition

problem:

◮ result of {u := new}φ, i.e., wp({u := new}, φ), cannot talk

about new object because it does not exist in pre-state

◮ in particular: {u := new}u ?

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-44
SLIDE 44

Object Creating Update Application: the Issue

recall:

◮ ‘{U}φ’ is the (explicit) weakest precondition wp(U, φ) ◮ applying U to φ (via ) computes weakest precondition

problem:

◮ result of {u := new}φ, i.e., wp({u := new}, φ), cannot talk

about new object because it does not exist in pre-state

◮ in particular: {u := new}u ?

basic approach:

◮ totally avoid ‘{u := new}u’

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-45
SLIDE 45

Object Creating Update Application: the Issue

recall:

◮ ‘{U}φ’ is the (explicit) weakest precondition wp(U, φ) ◮ applying U to φ (via ) computes weakest precondition

problem:

◮ result of {u := new}φ, i.e., wp({u := new}, φ), cannot talk

about new object because it does not exist in pre-state

◮ in particular: {u := new}u ?

basic approach:

◮ totally avoid ‘{u := new}u’ ◮ observation: the only operations on objects are

◮ de-referencing fields ◮ test for equality Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-46
SLIDE 46

Object Creating Update Application: the Issue

recall:

◮ ‘{U}φ’ is the (explicit) weakest precondition wp(U, φ) ◮ applying U to φ (via ) computes weakest precondition

problem:

◮ result of {u := new}φ, i.e., wp({u := new}, φ), cannot talk

about new object because it does not exist in pre-state

◮ in particular: {u := new}u ?

basic approach:

◮ totally avoid ‘{u := new}u’ ◮ observation: the only operations on objects are

◮ de-referencing fields ◮ test for equality ◮ quantification Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-47
SLIDE 47

Object Creating Update Application: the Issue

recall:

◮ ‘{U}φ’ is the (explicit) weakest precondition wp(U, φ) ◮ applying U to φ (via ) computes weakest precondition

problem:

◮ result of {u := new}φ, i.e., wp({u := new}, φ), cannot talk

about new object because it does not exist in pre-state

◮ in particular: {u := new}u ?

basic approach:

◮ totally avoid ‘{u := new}u’ ◮ observation: the only operations on objects are

◮ de-referencing fields ◮ test for equality ◮ quantification

◮ in all cases, wp computation can employ meta knowledge

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-48
SLIDE 48

Object Creating Update Application: Field Access

({u := new}e).x e′ {u := new}(e.x) e′ e neither u nor conditional {u := new}u.x initT(x) initT(x) ≡ null | 0 | false ({u := new}b ? {u := new}(e1.x) : {u := new}(e2.x)) e′ {u := new}((b ? e1 : e2).x) e′

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-49
SLIDE 49

Object Creating Update Application: Equality

({u := new}e1) = ({u := new}e2) e′ {u := new}(e1 = e2) e′ e1, e2 neither u nor conditional {u := new}(u = e) false e neither u nor conditional {u := new}(u = u) true ({u := new}b ? {u := new}(e1 = e3) : {u := new}(e2 = e3)) e′ {u := new}((b ? e1 : e2) = e3) e′

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-50
SLIDE 50

Object Creating Update Application: Quantifiers

({u := new}φ[l/u]) ∧ ∀l.({u := new}φ) φ′ {u := new}∀l.φ φ′

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-51
SLIDE 51

Object Creating Update Application: Quantifiers

({u := new}φ[l/u]) ∧ ∀l.({u := new}φ) φ′ {u := new}∀l.φ φ′ ({u := new}φ[l/u]) ∨ ∃l.({u := new}φ) φ′ {u := new}∃l.φ φ′

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-52
SLIDE 52

Example Proof 1

closeFalse false =

notRight =

⇒ ¬ false

applyUpd =

⇒ {u := new}¬(u = c)

assignVar =

⇒ u := new¬(u = c)

allRight =

⇒ ∀l.(u := new¬(u = l))

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-53
SLIDE 53

Example Proof 2

closeTrue ∀l.¬false =

⇒ true

notLeft ¬(true), ∀l.¬false =

andLeft ¬(true) ∧ ∀l.¬false =

applyUpd {u := new}∀l.¬(u = l) =

assignVar u := new∀l.¬(u = l)) =

notRight =

⇒ ¬u := new∀l.¬(u = l)

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-54
SLIDE 54

(applyUpd step in Example Proof 2)

{u := new}(u = u) true {u := new}¬(u = u) ¬(true) {u := new}(u = l) false {u := new}¬(u = l) ¬false ∀l.{u := new}¬(u = l) ∀l.¬false {u := new}¬(u = u) ∧ ∀l.{u := new}¬(u = l) ¬(true) ∧ ∀l.¬false {u := new}∀l.¬(u = l) ¬(true) ∧ ∀l.¬false

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-55
SLIDE 55

Part V Abstract Object Creation in Symbolic Execution

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-56
SLIDE 56

KeY-style Symbolic Execution

up to here, backwards reasoning only KeYapproach: forward symbolic execution using update parallelisation

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-57
SLIDE 57

KeY-style Symbolic Execution

up to here, backwards reasoning only KeYapproach: forward symbolic execution using update parallelisation *

close u < v =

⇒ u < v

applyUpd u < v =

⇒ {w := u | u := v | v := u}v < u

mergeUpd u < v =

⇒ {w := u | u := v}{v := w}v < u

assignVar u < v =

⇒ {w := u | u := v}v := wv < u

mergeUpd,assignVar u < v =

⇒ {w := u}{u := v}v := wv < u

split,assignVar

u < v = ⇒ {w := u}u := v; v := wv < u

split,assignVar

u < v = ⇒ w := u; u := v; v := wv < u

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-58
SLIDE 58

Problem: Parallelising Object Creating Updates

no natural way of merging {u := new} with other updates consider the two formulas (one true, one false): u := new; v := u(u = v) u := new; v := new(u = v) symbolic execution generates: {u := new}{v := u}(u = v) {u := new}{v := new}(u = v) merging updates, both result in: {u := new | v := new}(u = v) cannot be true and false

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-59
SLIDE 59

Solution

◮ not merge object creation with other updates

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-60
SLIDE 60

Solution

◮ not merge object creation with other updates ◮ split {u := new} into creation and (mergable) assignment to u

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-61
SLIDE 61

Solution

◮ not merge object creation with other updates ◮ split {u := new} into creation and (mergable) assignment to u

new object creation rule:

createObj

⌊ {a := new}{u := a}φ ⌋ ⌊ u := newφ ⌋ a a fresh program variable

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-62
SLIDE 62

Solution

◮ not merge object creation with other updates ◮ split {u := new} into creation and (mergable) assignment to u

new object creation rule:

createObj

⌊ {a := new}{u := a}φ ⌋ ⌊ u := newφ ⌋ a a fresh program variable facilitate merging of all non-creating updates by shifting creation

shiftCreation

⌊ {u := new}{Unc}φ ⌋ ⌊ {Unc}{u := new}φ ⌋ u not appearing in (non-creating) Unc

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-63
SLIDE 63

Symbolic Execuion Proof

*

notRight, closeFalse =

⇒ ¬false

applyUpd =

⇒ {a := new}¬(v = a)

applyUpd =

⇒ {a := new}{u := v | v := a | w := u}¬(w = v)

assignVar,mergeUpd =

⇒ {a := new}{u := v | v := a}w := u¬(w = v)

mergeUpd =

⇒ {a := new}{u := v}{v := a}w := u¬(w = v)

shiftCreation =

⇒ {u := v}{a := new}{v := a}w := u¬(w = v)

createObj

= ⇒ {u := v}v := neww := u¬(w = v)

split,assignVar,split

= ⇒ u := v; v := new; w := u¬(w = v)

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-64
SLIDE 64

Part VI Object Creation vs. Object Activation

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-65
SLIDE 65

Abstract Object Creation Proof

reconsider proof from above ∗

closeFalse false =

notRight =

⇒ ¬ false

applyUpd =

⇒ {u := new}¬(u = c)

assignVar =

⇒ u := new¬(u = c)

allRight =

⇒ ∀l.(u := new¬(u = l))

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-66
SLIDE 66

Object Activation Proof

close c.cre, obj(next)=c =

⇒ c.cre

equality c.cre, obj(next)=c =

⇒ obj(next).cre

notLeft ¬obj(next).cre, c.cre, obj(next)=c =

(≈2 rules) (obj(next).cre ↔ next < next), c.cre, obj(next)=c =

allLeft

∀n.(obj(n).cre ↔ n < next), c.cre, obj(next)=c = ⇒

inReachableState

c.cre, obj(next)=c = ⇒

notRight c.cre =

⇒ ¬(obj(next)=c)

applyUpd c.cre =

⇒ {u :=obj(next); u.cre:=true; next:=next+1}¬(u =c)

createObj

c.cre = ⇒ u :=new¬(u =c)

impRight =

⇒ c.cre →u :=new¬(u =c)

allRight =

⇒ ∀l. (l.cre →u :=new¬(u =l))

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-67
SLIDE 67

Part VII Reflections

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic

slide-68
SLIDE 68

Reflections

◮ abstraction level of logic matches programming language ◮ changes to standard treatment very local

◮ additional update type,

not mergable with others, but shiftable to the front

◮ update application differs only in few cases

◮ formulas and proofs are simpler ◮ symbolic state representation:

◮ not diluted by createdness bookkeeping ◮ separates out

  • 1. newly created objects (shifted forward)
  • 2. symbolic value of fields and variables

Wolfgang Ahrendt, Frank S. de Boer, Immo Grabe Abstract Object Creation in Dynamic Logic