Compositional Action System Derivation Introduction Using Enforced - - PowerPoint PPT Presentation

compositional action system derivation
SMART_READER_LITE
LIVE PREVIEW

Compositional Action System Derivation Introduction Using Enforced - - PowerPoint PPT Presentation

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Compositional Action System Derivation Introduction Using Enforced Properties Action systems Enforced properties Example Brijesh Dongol


slide-1
SLIDE 1

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Compositional Action System Derivation Using Enforced Properties

Brijesh Dongol and Ian J. Hayes

School of Information Technology and Electrical Engineering, The University of Queensland

MPC 2010

slide-2
SLIDE 2

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Outline

1

Introduction

2

Action systems

3

Enforced properties

4

Example

slide-3
SLIDE 3

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

History

  • Sequential program derivation (Dijkstra, 1975)
  • Safety-based concurrent program derivation (Feijen and

van Gasteren, 1999)

  • Progress-based concurrent program derivation (Dongol

and Mooij, 2006 & 2008)

  • Enforced properties (Dongol and Hayes, 2009), (Dongol,

2009) - PhD thesis

slide-4
SLIDE 4

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

This paper

Goals Techniques 1. 2. 3. 4. Calculational development Incremental trace refinement Compositionally address safety and progress Simplify existing rules

slide-5
SLIDE 5

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

This paper

Goals Techniques 1. 2. 3. 4. Calculational development Incremental trace refinement Compositionally address safety and progress Simplify existing rules Weakest precondition

slide-6
SLIDE 6

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

This paper

Goals Techniques 1. 2. 3. 4. Calculational development Incremental trace refinement Compositionally address safety and progress Simplify existing rules Weakest precondition Enforced properties and frames

slide-7
SLIDE 7

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

This paper

Goals Techniques 1. 2. 3. 4. Calculational development Incremental trace refinement Compositionally address safety and progress Simplify existing rules Weakest precondition Enforced properties and frames Temporal logic on relations

slide-8
SLIDE 8

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

This paper

Goals Techniques 1. 2. 3. 4. Calculational development Incremental trace refinement Compositionally address safety and progress Simplify existing rules Weakest precondition Enforced properties and frames Temporal logic on relations Action systems framework

slide-9
SLIDE 9

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Syntax

Statements and actions S ::= diverge | skip | x := E | x :∈ V | S1 ; S2 | x ·[[S]] A ::= b → S | A1 ⊓ A2 | x ·[[A]] Action systems A ˆ = A0 ; do A od is an action system with initialisation action A0 and main action A

slide-10
SLIDE 10

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Frames

  • If x is a variable of type T:

x ·[[S]] = S ; x :∈ T x ·[[b → S]] = b → x ·[[S]] x ·[[A1 ⊓ A2]] = x ·[[A1]] ⊓ x ·[[A2]]

slide-11
SLIDE 11

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Frames

  • If x is a variable of type T:

x ·[[S]] = S ; x :∈ T x ·[[b → S]] = b → x ·[[S]] x ·[[A1 ⊓ A2]] = x ·[[A1]] ⊓ x ·[[A2]]

  • Frames allow introduction of new (internal) variables
slide-12
SLIDE 12

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Frames

  • If x is a variable of type T:

x ·[[S]] = S ; x :∈ T x ·[[b → S]] = b → x ·[[S]] x ·[[A1 ⊓ A2]] = x ·[[A1]] ⊓ x ·[[A2]]

  • Frames allow introduction of new (internal) variables
  • Frames can be turned into statements by refinement
slide-13
SLIDE 13

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Refinement

Suppose s ∈ seq.Σ. We assume

  • rL.s removes local variables from each state in s
  • rS.s removes stuttering in s

Definition (Trace refinement) A ⊑Tr C ˆ = ∀t : Tr.C • ∃s : Tr.A • rS.(rL.s) = rS.(rL.t)

slide-14
SLIDE 14

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Refinement

Suppose s ∈ seq.Σ. We assume

  • rL.s removes local variables from each state in s
  • rS.s removes stuttering in s

Definition (Trace refinement) A ⊑Tr C ˆ = ∀t : Tr.C • ∃s : Tr.A • rS.(rL.s) = rS.(rL.t) Lemma

If Tr.C ⊆ Tr.A , then A ⊑Tr C .

slide-15
SLIDE 15

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

A temporal logic on relations

Linear temporal logic (LTL)

(Manna and Pnueli, 1992) always (), eventually (), until (U), unless (W) defined for formulas on single-state predicates

Relational linear temporal logic (RLTL)

Defined over two-state relations

  • Semantics mostly the same as LTL
  • Difference: For sequence of states s and RLTL formula Q,

(s, u) ⊢ Q ⇐ ⇒ ∀v : dom.s • v ≥ u ∧ v + 1 ∈ dom.s ⇒ (s, v) ⊢ Q

slide-16
SLIDE 16

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Enforced properties

Definition (Enforced property)

Suppose, A is an action system and R is a RLTL formula. Action system A with enforced property R, denoted A ?R, is an action system such that

Tr.(A ?R) ˆ = {s : Tr.A | s ⊢ R}

slide-17
SLIDE 17

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Enforced properties

  • Given an initial action system A , suppose we want to

derive an action system that satisfies RLTL property R

slide-18
SLIDE 18

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Enforced properties

  • Given an initial action system A , suppose we want to

derive an action system that satisfies RLTL property R

  • 1. Enforce property R on A to obtain A ?R
slide-19
SLIDE 19

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Enforced properties

  • Given an initial action system A , suppose we want to

derive an action system that satisfies RLTL property R

  • 1. Enforce property R on A to obtain A ?R
  • 2. Derive B such that A ?R ⊑Tr B and Tr.B |

= R

slide-20
SLIDE 20

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Enforced properties

  • Given an initial action system A , suppose we want to

derive an action system that satisfies RLTL property R

  • 1. Enforce property R on A to obtain A ?R
  • 2. Derive B such that A ?R ⊑Tr B and Tr.B |

= R

  • 3. Hence, B satisfies R and furthermore does not need to

enforce R

slide-21
SLIDE 21

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Enforced properties

  • Given an initial action system A , suppose we want to

derive an action system that satisfies RLTL property R

  • 1. Enforce property R on A to obtain A ?R
  • 2. Derive B such that A ?R ⊑Tr B and Tr.B |

= R

  • 3. Hence, B satisfies R and furthermore does not need to

enforce R

  • We have rules that allow
  • introduction of new enforced properties
  • manipulation of existing enforced properties
  • introduction of new variables (via frames)
  • introduction and modification of actions
slide-22
SLIDE 22

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Enforced properties

  • Given an initial action system A , suppose we want to

derive an action system that satisfies RLTL property R

  • 1. Enforce property R on A to obtain A ?R
  • 2. Derive B such that A ?R ⊑Tr B and Tr.B |

= R

  • 3. Hence, B satisfies R and furthermore does not need to

enforce R

  • We have rules that allow
  • introduction of new enforced properties
  • manipulation of existing enforced properties
  • introduction of new variables (via frames)
  • introduction and modification of actions
  • Each rule ensures trace refinement
slide-23
SLIDE 23

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Enforced properties

Lemma

For action systems A and C , and RLTL formulae R and R′ each of the following holds: a.

A ⊑Tr A ?R

b.

A ?R ⊑Tr A ?R′ provided R′ ⇒ R

c.

A ?R ⊑Tr C ?R provided A ⊑Tr C

d.

A ?R ⊑ ⊒Tr A provided Tr.A | = R

e.

A ?(R ∧ R′) ⊑ ⊒Tr (A ?R)?R′

slide-24
SLIDE 24

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Enforced properties

Lemma

For action systems A and C , and RLTL formulae R and R′ each of the following holds: a.

A ⊑Tr A ?R

b.

A ?R ⊑Tr A ?R′ provided R′ ⇒ R

c.

A ?R ⊑Tr C ?R provided A ⊑Tr C

d.

A ?R ⊑ ⊒Tr A provided Tr.A | = R

e.

A ?(R ∧ R′) ⊑ ⊒Tr (A ?R)?R′ Proof.

If Tr.C ⊆ Tr.A , then A ⊑Tr C (from previous lemma).

slide-25
SLIDE 25

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Enforced properties

Definition

If A is an action, p is a predicate, and r a relation, then

A!p ˆ = [p] ; A ; [p] A!r ˆ = rel.A ∩ r

  • A!p blocks if
  • p does not hold prior to executing A, or
  • the execution of A does not establish p
  • A!r blocks if no execution of A can satisfy r
slide-26
SLIDE 26

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Enforced properties

Lemma

For actions A, A1, and A2; predicates p, p1, and p2; and relations r, r1, and r2, each of the following holds: a.

A!(p1 ∧ p2) = (A!p1)!p2

b.

A!(r1 ∩ r2) = (A!r1)!r2

c.

A!p = [p] ; A provided p ⇒ A.p

d.

A!r = A provided rel.A ⊆ r

e.

(A1 ⊓ A2)!p = (A1!p) ⊓ (A2!p)

f.

(A1 ⊓ A2)!r = (A1!r) ⊓ (A2!r)

slide-27
SLIDE 27

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Example - Industrial press

Weight top bot pnr motor

slide-28
SLIDE 28

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Example - Industrial press

Weight top bot pnr motor

  • Program variables: locked and motor
  • Environment variables: top, pnr,bot, and pressed
slide-29
SLIDE 29

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Requirements

Safety requirements: (locked ⇒ top ∧ motor = Off)

(1) (locked ⇒ (locked W pressed)) (2) (¬locked ∧ motor = Off ⇒

(¬locked ∧ motor = Off) W ((bot ∨ ¬pnr) ∧ ¬pressed)) (3) (pnr ∧ motor = Off ⇒ ((pnr ∧ motor = Off) W (bot ∧ ¬pressed)))

(4) (motor = On ⇒ (motor = On W locked)) (5)

Progress requirements: we say p q ⇐

⇒ (p ⇒ q)

(locked ∧ pressed) ¬locked

(6)

(¬locked ∧ ¬pnr ∧ ¬pressed) motor = On

(7)

(bot ∧ ¬pressed) motor = On

(8)

slide-30
SLIDE 30

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Assumptions on the environment

Safety assumptions: (top ⇒ ¬pnr ∧ ¬bot) ∧ (bot ⇒ pnr)

(9) top, pnr, bot | (top⇒¬pnr′ ∧ ¬bot′) ∧ (¬top ∧ ¬pnr⇒¬bot′)

(pnr ⇒ ¬top′) ∧ (bot⇒pnr′)

(10)

Progress assumptions: (¬locked ∧ motor = Off) ⇒ ¬top ∧ pnr ∧ bot (11) (motor = On) ⇒ top ∧ ¬bot ∧ ¬pnr

(12)

slide-31
SLIDE 31

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Initial program

Define:

Safe ˆ = (1) ∧ (2) ∧ (3) ∧ (4) ∧ (5) Prog ˆ = (6) ∧ (7) ∧ (8) RelyProg ˆ = (11) ∧ (12) env ˆ = pressed ·[[(10)]]!(9) do true → env ⊓ true → motor, locked ·[[skip]]

  • d

?(Safe ∧ Prog ∧ RelyProg)

slide-32
SLIDE 32

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Calculational rules

Lemma (Unless) (p ⇒ (p W q)) holds provided (p ∧ ¬q ⇒ p′ ∨ q′)

slide-33
SLIDE 33

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Derivation - replace unless properties

(2) = {definition} (locked ⇒ locked W pressed) ⇐ {Lemma (unless)} (locked ∧ ¬pressed ⇒ (locked′ ∨ pressed′)) ⇐ {logic} (locked ∧ ¬locked′ ⇒ pressed)

slide-34
SLIDE 34

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

  • Apply similar calculation to (3), (4), (5) to obtain Safe′.
  • Safe′ ⇒ Safe
  • Recall A ?R ⊑Tr A ?R′ provided R′ ⇒ R
slide-35
SLIDE 35

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

  • Apply similar calculation to (3), (4), (5) to obtain Safe′.
  • Safe′ ⇒ Safe
  • Recall A ?R ⊑Tr A ?R′ provided R′ ⇒ R

do true → env ⊓ true → motor, locked ·[[skip]]

  • d

?(Safe ∧ Prog ∧ RelyProg)

slide-36
SLIDE 36

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

  • Apply similar calculation to (3), (4), (5) to obtain Safe′.
  • Safe′ ⇒ Safe
  • Recall A ?R ⊑Tr A ?R′ provided R′ ⇒ R

do true → env ⊓ true → motor, locked ·[[skip]]

  • d

?(Safe ∧ Prog ∧ RelyProg) ⊑Tr do true → env ⊓ true → motor, locked ·[[skip]]

  • d

?(Safe′ ∧ Prog ∧ RelyProg)

slide-37
SLIDE 37

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Deriving actions

  • Consider action that turns the motor on
slide-38
SLIDE 38

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Deriving actions

  • Consider action that turns the motor on
  • From calculation wp.(motor := On).Safe′, we obtain:

(motor = Off ⇒ (bot′ ∨ ¬pnr′) ∧ ¬pressed′) ∧ ¬locked

slide-39
SLIDE 39

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Deriving actions

  • Consider action that turns the motor on
  • From calculation wp.(motor := On).Safe′, we obtain:

(motor = Off ⇒ (bot′ ∨ ¬pnr′) ∧ ¬pressed′) ∧ ¬locked

  • Because controller does not modify bot, pnr, and pressed

we get action:

motor = Off ∧ (bot ∨ ¬pnr) ∧ ¬pressed ∧ ¬locked → motor := On

slide-40
SLIDE 40

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Deriving actions

  • Consider action that turns the motor on
  • From calculation wp.(motor := On).Safe′, we obtain:

(motor = Off ⇒ (bot′ ∨ ¬pnr′) ∧ ¬pressed′) ∧ ¬locked

  • Because controller does not modify bot, pnr, and pressed

we get action:

motor = Off ∧ (bot ∨ ¬pnr) ∧ ¬pressed ∧ ¬locked → motor := On

  • Similarly, we get for actions that turn motor off and modify

lock

motor = On ∧ top → motor, locked := Off, true locked ∧ motor = Off ∧ pressed → locked := false

slide-41
SLIDE 41

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Deriving actions

  • Consider action that turns the motor on
  • From calculation wp.(motor := On).Safe′, we obtain:

(motor = Off ⇒ (bot′ ∨ ¬pnr′) ∧ ¬pressed′) ∧ ¬locked

  • Because controller does not modify bot, pnr, and pressed

we get action:

motor = Off ∧ (bot ∨ ¬pnr) ∧ ¬pressed ∧ ¬locked → motor := On

  • Similarly, we get for actions that turn motor off and modify

lock

motor = On ∧ top → motor, locked := Off, true locked ∧ motor = Off ∧ pressed → locked := false

  • These actions are guaranteed to satisfy Safe′
slide-42
SLIDE 42

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Action introduction

Lemma

If grd.(A!p) ⇒ grd.(A!p) ∧ b

do A ⊓ (true → x ·[[skip]]) od ?p ⊑ do A ⊓ (b → x := v) od ?p

slide-43
SLIDE 43

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Action introduction

Recalling that A ?R ⊑Tr C ?R provided A ⊑Tr C , we obtain:

do true → env ⊓ true → motor, locked ·[[skip]]

  • d

?(Safe′ ∧ Prog ∧ RelyProg)

slide-44
SLIDE 44

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Action introduction

Recalling that A ?R ⊑Tr C ?R provided A ⊑Tr C , we obtain:

do true → env ⊓ true → motor, locked ·[[skip]]

  • d

?(Safe′ ∧ Prog ∧ RelyProg) ⊑Tr do true → env ⊓ motor = Off ∧ (bot ∨ ¬pnr) ∧ ¬pressed ∧ ¬locked → motor := On ⊓ motor = On ∧ top → motor, locked := Off, true ⊓ locked ∧ motor = Off ∧ pressed → locked := false

  • d

?(Prog ∧ RelyProg) Safe′

slide-45
SLIDE 45

Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example

Conclusion

  • In this paper:
  • Rules for calculational proofs of temporal formulae
  • Frames and enforced properties work together to allow

incremental refinement

  • Relational linear temporal logic supports compositionality
  • Theory supports proofs of safety and progress properties
  • Fairness assumptions can be encoded using enforced

properties

  • Future work:
  • Real-time controllers - teleo-reactive programs, sampling

logic

  • Tool support