system modelling and design
play

System Modelling and Design A Simple ATM Beyond Specification - PowerPoint PPT Presentation

Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM System Modelling and Design A Simple ATM Beyond Specification Revision: 1.2, April 23, 2008 Ken Robinson School of Computer Science & Engineering The University of


  1. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM System Modelling and Design A Simple ATM Beyond Specification Revision: 1.2, April 23, 2008 Ken Robinson School of Computer Science & Engineering The University of New South Wales, Sydney Australia May 17, 2010 � Ken Robinson 2005-2010 c mailto::k.robinson@unsw.edu.au

  2. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM Outline I Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0 Improving the Model ATMR0 Password Encryption

  3. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM Objectives of this Lecture • to demonstrate that nondeterminism can be closer to reality than determinism. • to illustrate the above using a simple ATM example.

  4. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM Objectives of this Lecture • to demonstrate that nondeterminism can be closer to reality than determinism. • to illustrate the above using a simple ATM example.

  5. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM Objectives of this Lecture • to demonstrate that nondeterminism can be closer to reality than determinism. • to illustrate the above using a simple ATM example.

  6. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0: A Simplistic Model of an ATM We want to produce a model of an ATM. The model will be kept reasonably simple, but also reasonably realistic. Required ATM operations: • an operation to insert the card and provide a password; • an operation to withdraw money; The initial attempt might be as shown in the ATM0 machine. This is likely to be the type of specification produced by someone familiar only with machine level development.

  7. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0: A Simplistic Model of an ATM We want to produce a model of an ATM. The model will be kept reasonably simple, but also reasonably realistic. Required ATM operations: • an operation to insert the card and provide a password; • an operation to withdraw money; The initial attempt might be as shown in the ATM0 machine. This is likely to be the type of specification produced by someone familiar only with machine level development.

  8. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0: A Simplistic Model of an ATM We want to produce a model of an ATM. The model will be kept reasonably simple, but also reasonably realistic. Required ATM operations: • an operation to insert the card and provide a password; • an operation to withdraw money; The initial attempt might be as shown in the ATM0 machine. This is likely to be the type of specification produced by someone familiar only with machine level development.

  9. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0: A Simplistic Model of an ATM We want to produce a model of an ATM. The model will be kept reasonably simple, but also reasonably realistic. Required ATM operations: • an operation to insert the card and provide a password; • an operation to withdraw money; The initial attempt might be as shown in the ATM0 machine. This is likely to be the type of specification produced by someone familiar only with machine level development.

  10. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0: A Simplistic Model of an ATM We want to produce a model of an ATM. The model will be kept reasonably simple, but also reasonably realistic. Required ATM operations: • an operation to insert the card and provide a password; • an operation to withdraw money; The initial attempt might be as shown in the ATM0 machine. This is likely to be the type of specification produced by someone familiar only with machine level development.

  11. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM Context I CONTEXT ATM ctx SETS ACCOUNT The set of account IDs RESPONSES Set of responses CONSTANTS OK REFUSED RESPONSE Possible responses

  12. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM Context II AXIOMS axm 1: finite ( ACCOUNT ) axm 4: RESPONSES = { OK , REFUSED } axm 5: OK � = REFUSED axm 6: RESPONSE = {{ OK } , { REFUSED } , ∅ } END

  13. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM Password context I CONTEXT Password SETS PASSWORD END

  14. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0 I MACHINE ATM0 SEES ATM ctx, Password VARIABLES accounts password balance customer response

  15. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0 II INVARIANTS inv 1: accounts ⊆ ACCOUNT inv 2: finite ( accounts ) inv 3: password ∈ accounts → PASSWORD inv 4: balance ∈ accounts → Z inv 5: customer ⊆ accounts inv 6: card ( customer ) ≤ 1 inv 7: response ∈ RESPONSE

  16. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0 III EVENTS Initialisation begin act 1: accounts := ∅ act 2: password := ∅ act 3: balance := ∅ act 4: customer := ∅ act 5: response := ∅ end

  17. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0 IV Event InsertCard � = any account pass when account ∈ ACCOUNT grd 1: grd 2: pass ∈ PASSWORD grd 3: customer = ∅ grd 4: response = ∅

  18. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0 V then act 1: response , customer : | ( account ∈ accounts ∧ pass = password ( account ) ⇒ response ′ = { OK } ∧ customer ′ = { account } ) ∧ (( account / ∈ accounts ∨ pass � = password ( account )) ⇒ response ′ = { REFUSED } ∧ customer ′ = ∅ ) end

  19. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0 VI Event WithDraw � = any amount account when response = ∅ grd 1: grd 2: customer � = ∅ grd 3: amount ∈ N grd 4: { account } = customer

  20. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0 VII then act 1: response : | ( balance ( account ) ≥ amount ⇒ response ′ = { OK } ) ∧ ( balance ( account ) < amount ⇒ response ′ = { REFUSED } ) act 2: balance : | ( balance ( account ) ≥ amount ⇒ balance ′ = balance − { account �→ balance ( account ) − amount } ) ⊳ ∧ ( balance ( account ) < amount ⇒ balance ′ = balance ) end

  21. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM ATM0 VIII Event ResetResponse � = Resets response when grd 1: response � = ∅ then act 1: response := ∅ end END

  22. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM Improving the Model This ATM0 model is seriously ill-conceived. It puts bank-like state inside the ATM. This is obviously wrong: ATMs have no banking knowledge, they are simply boxes in the wall that interact with a card user and communicate with a remote banking system. We will attempt to build a more realistic model that separates the ATM and the remote banking system. First, we need to specify the context information that is common to both the ATM and the remote banking system. This is shown in CardStatus and Password contexts. It’s split into two machines because the account, service card and response modelling “belongs” to the banking system, but the modelling of passwords is global.

  23. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM Improving the Model This ATM0 model is seriously ill-conceived. It puts bank-like state inside the ATM. This is obviously wrong: ATMs have no banking knowledge, they are simply boxes in the wall that interact with a card user and communicate with a remote banking system. We will attempt to build a more realistic model that separates the ATM and the remote banking system. First, we need to specify the context information that is common to both the ATM and the remote banking system. This is shown in CardStatus and Password contexts. It’s split into two machines because the account, service card and response modelling “belongs” to the banking system, but the modelling of passwords is global.

  24. Outline Objectives of this Lecture ATM0: A Simplistic Model of an ATM Improving the Model This ATM0 model is seriously ill-conceived. It puts bank-like state inside the ATM. This is obviously wrong: ATMs have no banking knowledge, they are simply boxes in the wall that interact with a card user and communicate with a remote banking system. We will attempt to build a more realistic model that separates the ATM and the remote banking system. First, we need to specify the context information that is common to both the ATM and the remote banking system. This is shown in CardStatus and Password contexts. It’s split into two machines because the account, service card and response modelling “belongs” to the banking system, but the modelling of passwords is global.

Recommend


More recommend