Beruflich Dokumente
Kultur Dokumente
MPC 2010
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
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
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example
This paper
Goals 1. Calculational development 2. Incremental trace renement 3. Compositionally address safety and progress 4. Simplify existing rules
Techniques
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example
This paper
Goals 1. Calculational development 2. Incremental trace renement 3. Compositionally address safety and progress 4. Simplify existing rules
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example
This paper
Goals 1. Calculational development 2. Incremental trace renement 3. Compositionally address safety and progress 4. Simplify existing rules
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example
This paper
Goals 1. Calculational development 2. Incremental trace renement 3. Compositionally address safety and progress 4. Simplify existing rules
Techniques Weakest precondition Enforced properties and frames Temporal logic on relations
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example
This paper
Goals 1. Calculational development 2. Incremental trace renement 3. Compositionally address safety and progress 4. Simplify existing rules
Techniques Weakest precondition Enforced properties and frames Temporal logic on relations Action systems framework
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
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:
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:
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:
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example
Renement
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example
Renement
Denition (Trace renement) 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 .
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 Introduction Action systems Enforced properties Example
Enforced properties
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 satises RLTL property R
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 satises RLTL property R 1. Enforce property R on A to obtain A ?R
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 satises 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
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 satises 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 satises R and furthermore does not need to enforce R
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 satises 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 satises 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 modication of actions
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 satises 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 satises 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 modication of actions
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
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
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example
Enforced properties
Denition
If A is an action, p is a predicate, and r a relation, then
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)
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 Introduction Action systems Enforced properties Example
Program variables: locked and motor Environment variables: top, pnr,bot, and pressed
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example
Requirements
Safety requirements:
(1) (locked top motor = Off ) (locked (locked W pressed)) (2) (locked motor = Off (3) (locked motor = Off ) W ((bot pnr) pressed))
(pnr motor = Off ((pnr motor = Off ) W (bot pressed))) (motor = On (motor = On W locked))
Progress requirements: we say p
(4) (5)
( p q)
(6) (7) (8)
(locked pressed) locked (locked pnr pressed) motor = On (bot pressed) motor = On
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes
Safety assumptions:
Introduction Action systems Enforced properties Example
(9)
top, pnr, bot | (top pnr bot ) (top pnr bot ) (10) (pnr top ) (bot pnr )
Progress assumptions:
(locked motor = Off ) top pnr bot (11) (motor = On) top bot pnr (12)
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example
Initial program
Dene:
Safe = (1) (2) (3) (4) (5) Prog = (6) (7) (8) RelyProg = (11) (12) env = pressed [[ (10) ]] !(9) do true env true motor, locked [[skip]] od ?(Safe Prog RelyProg)
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example
Calculational rules
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes Introduction Action systems Enforced properties Example
(2) {denition} (locked locked W pressed) {Lemma (unless)} (locked pressed (locked pressed )) {logic} (locked locked pressed) =
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
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
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
Tr
do true env true motor, locked [[skip]] od ?(Safe Prog RelyProg)
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
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:
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:
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 = On top motor, locked := Off , true locked motor = Off pressed locked := false
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 = On top motor, locked := Off , true locked motor = Off pressed locked := false
These actions are guaranteed to satisfy Safe
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
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:
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:
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 od ?(Prog RelyProg) Safe
Compositional Action System Derivation Using Enforced Properties Brijesh Dongol and Ian J. Hayes
Conclusion
In this paper:
Introduction Action systems Enforced properties Example
Rules for calculational proofs of temporal formulae Frames and enforced properties work together to allow
incremental renement
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