Presentation is loading. Please wait.

Presentation is loading. Please wait.

Safety and Liveness. Recall Program –State space Program computation –Of the form Consider the set of all program computations.

Similar presentations


Presentation on theme: "Safety and Liveness. Recall Program –State space Program computation –Of the form Consider the set of all program computations."— Presentation transcript:

1 Safety and Liveness

2 Recall Program –State space Program computation –Of the form Consider the set of all program computations

3 Program Correctness How do we define that a program is correct with respect to its specification? –Intuition: A program is correct if all its computations are in the specification For above intuition to work, the specification should be the set of acceptable sequences of program states

4 Hence, From now on, let specification be a set of infinite sequences of states

5 Example Coke and Pepsi vending machine

6 Safety and Liveness Safety –Intuition: Nothing bad happens Intuition: If something bad happens, it cannot be fixed Intuition: if a sequence violates specification then it does so at some finite point after which it cannot be fixed. –  :  SafetySpec : (  :  is a prefix of    ::   SafetySpec)

7 Safety and Liveness Liveness –Intuition: Something good happens eventually Intuition: No matter what has happened so far, the specification can be met  :  is finite sequence of states:  ::   LivenessSpec

8 Examples of Properties Invariant (S) : Closed (S) : P Leads to Q P Converges to Q P ensures Q

9 Manipulation of Safety/Liveness Properties Union/Intersection of safety and liveness properties

10 Towards Proving spec = safety  liveness S w denotes the set of all computations  S w denotes the set of all computations with prefix  (S w -  S w ) is a safety specification

11 Towards Proving spec = safety  liveness Consider (infinitely many) safety properties sf1, sf2, … –Is the union of them a safety specification? –Is the intersection of them a safety specification?

12 Towards Proving spec = safety  liveness Let spec be the given specification –Consider the set of safety properties sf 1, sf 2, … such that spec  sf i –Consider the intersection of these safety properties Let sf denote this intersection

13 Properties of sf Consider a sequence   sf – spec –Let  be any prefix of  –There must exist  such that   spec –If not spec  (sf  (S w -  S w )), which is a safety specification This is a contradiction as sf is supposed to smallest safety specification containing spec

14 Towards Proving spec = safety  liveness spec = sf  (spec  (S w – sf)) Safety specification Liveness specification

15 Topology based explanation


Download ppt "Safety and Liveness. Recall Program –State space Program computation –Of the form Consider the set of all program computations."

Similar presentations


Ads by Google