+ All Categories
Home > Documents > CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title:...

CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title:...

Date post: 07-Oct-2020
Category:
Upload: others
View: 3 times
Download: 0 times
Share this document with a friend
21
INTRODUCTION TO TLA + Presented by : Kevin Yeh
Transcript
Page 1: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

INTRODUCTION TO TLA+

Presented by : Kevin Yeh

Page 2: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

What is TLA+ • Specification Language for modelling complex or concurrent systems

• TLA+ toolbox performs model checks to check for correctness

• PlusCAL

Page 3: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

What can TLA+ do for you? • Modelling of ALGORITHMS prior to implementation

• Meant as a supplement to traditional test/verification

• Very powerful bug detection

Page 4: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

• Been used successfully at Amazon, HP, and Intel •  Two weeks before value was added

What can TLA+ do for you?

Page 5: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Intangibles • Requires up-front system understanding • Adds value even after production release

Page 6: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

TLA+ an Overview •  4 parts to a specification

•  Initial predicate •  Possible “Next” states •  Safety Properties •  Liveness Properties

Page 7: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Alternating One-bit Clock •  Initial Predicate

•  (b = 0 ) V (b = 1)

• Next States •  ((b = 0) /\ (b’ = 1)) V ((b = 1) /\ (b’ = 0 ))

Page 8: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Alternating One-bit Clock •  Initial Predicate

•  (b = 0 ) V (b = 1)

• Next States •  ((b = 0) /\ (b’ = 1)) V ((b = 1) /\ (b’ = 0 ))

Page 9: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Die Hard Problem • What you have: 3-gallon jug, 5-gallon jug, and a faucet • Goal: Measure 4 gallons

Page 10: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Die Hard Problem

Page 11: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Die Hard Problem FillSmall == /\ small’ = 3 /\ big’ = big

SmallToBig == \/ /\ big+ small >5 /\ big’ = 5 /\ small’ = small – (5-big) \/ /\ big + small <= 5 /\ big’ = big + small /\ small’ = 0

Page 12: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Model Checker

State Statistics Invariant Checker

•  Builds up a Directed Graph of all possible states.

Page 13: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Die Hard - Solution

Page 14: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Safety/Liveness Properties • Safety Property – Define a correct behavior of your

procedure •  Partial Correctness : (terminated) => (Correct_Output)

•  Liveness Property – Define a correct behavior that must eventually hold •  Termination

Page 15: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Euclid’s Algorithm – a high level view •  Find the Greatest Common Divisor of two numbers • General Procedure:

•  PlusCAL -> TLA+ •  Write the definition of GCD using set logic: GCD(m,n) •  Use definition to write Safety/Liveness Properties

•  This is how TLA+ is used in industry

Page 16: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Euclid’s Algorithm • PlusCAL code:

Page 17: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM
Page 18: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM
Page 19: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM
Page 20: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Model Checking

Safety Liveness

0 BUGS!

Page 21: CSE814 Kevin Yeh Presentationcse814/Lectures/TLA+Presentation.pdf · Title: CSE814_Kevin_Yeh_Presentation.pptx Author: Laura Dillon Created Date: 12/3/2014 4:19:18 AM

Questions?


Recommended