lecture 4 correctness and fairness verification and assurance

29
Lecture 4 Correctness and Fairness Verification and Assurance

Upload: erik-griffin

Post on 18-Jan-2018

225 views

Category:

Documents


0 download

DESCRIPTION

Logical Specification of Correctness Properties The formula is called an invariant because it must always be true. Invariants are proved using induction, not over the natural numbers, but over all possible states of computation. (a)Prove A holds in the initial (base) case. (b)Assume that A is true is all states up the the current state (c) Prove that A is true in the next state (inductive step). If (a) and (c) can be proved we can conclude that A is true for all states of all computations.

TRANSCRIPT

Page 1: Lecture 4 Correctness and Fairness Verification and Assurance

Lecture 4Correctness and Fairness

Verification and Assurance

Page 2: Lecture 4 Correctness and Fairness Verification and Assurance

Concurrent programs can have errors that cannot be discovered by testing.

We review specification or correctness properties.

We use inductive proofs of invariants to ensure correctness of concurrent programs.

As we have seen construction of state diagrams can be impractical for real programs.

We can use a computer program to construct and check a state diagram. Such a program is called a model checker.

Introduction of Specification and Verification

Page 3: Lecture 4 Correctness and Fairness Verification and Assurance

Logical Specification of Correctness Properties

The formula is called an invariant because it must always be true.

Invariants are proved using induction, not over the natural numbers, but over all possible states of computation.

(a) Prove A holds in the initial (base) case.

(b) Assume that A is true is all states up the the current state

(c) Prove that A is true in the next state (inductive step).

If (a) and (c) can be proved we can conclude that A is true for all states of all computations.

Page 4: Lecture 4 Correctness and Fairness Verification and Assurance

Is Mutual Exclusion Enforced?

(p34p5↔wantp " " )

¬ (𝑝 4∧𝑞 4 )

𝑝 3∨𝑝 4∨𝑝5→𝑤𝑎𝑛𝑡𝑝

By induction we can show that and

By symmetric we can argue that what is true for p is true for qso

Mutual Exclusion is enforced if is an invariant.

Page 5: Lecture 4 Correctness and Fairness Verification and Assurance

Basic Concepts of Temporal Logic

The truth value of any logical statement about a computer program may change during its execution. First-order logic does not provide for this circumstance.

Page 6: Lecture 4 Correctness and Fairness Verification and Assurance

Always

Page 7: Lecture 4 Correctness and Fairness Verification and Assurance

Eventually

Page 8: Lecture 4 Correctness and Fairness Verification and Assurance
Page 9: Lecture 4 Correctness and Fairness Verification and Assurance

Duality

Page 10: Lecture 4 Correctness and Fairness Verification and Assurance

Sequences of Operatorseventually will be always true

Page 11: Lecture 4 Correctness and Fairness Verification and Assurance

Order of Operators affects Meaning

Page 12: Lecture 4 Correctness and Fairness Verification and Assurance

Until and Weak-Until

Page 13: Lecture 4 Correctness and Fairness Verification and Assurance
Page 14: Lecture 4 Correctness and Fairness Verification and Assurance
Page 15: Lecture 4 Correctness and Fairness Verification and Assurance

K-Bounded Overtaking

Lamport’s Bakery Algorithm is an example of k-bounded overtaking for what value of k?

Page 16: Lecture 4 Correctness and Fairness Verification and Assurance

Deductive Proof of Dekker's Algorithm

Page 17: Lecture 4 Correctness and Fairness Verification and Assurance

Reasoning about Progress

Page 18: Lecture 4 Correctness and Fairness Verification and Assurance
Page 19: Lecture 4 Correctness and Fairness Verification and Assurance
Page 20: Lecture 4 Correctness and Fairness Verification and Assurance
Page 21: Lecture 4 Correctness and Fairness Verification and Assurance
Page 22: Lecture 4 Correctness and Fairness Verification and Assurance
Page 23: Lecture 4 Correctness and Fairness Verification and Assurance
Page 24: Lecture 4 Correctness and Fairness Verification and Assurance
Page 25: Lecture 4 Correctness and Fairness Verification and Assurance
Page 26: Lecture 4 Correctness and Fairness Verification and Assurance
Page 27: Lecture 4 Correctness and Fairness Verification and Assurance
Page 28: Lecture 4 Correctness and Fairness Verification and Assurance
Page 29: Lecture 4 Correctness and Fairness Verification and Assurance