towards automatic inference of inductive invariantsmanosk/assets/papers/i4-hotos19-slide… ·...

19
Towards Automatic Inference of Inductive Invariants Haojun Ma, Aman Goel, Jean-Baptiste Jeannin Manos Kapritsos, Baris Kasikci, Karem A. Sakallah University of Michigan

Upload: others

Post on 13-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Towards Automatic Inference ofInductive Invariants

Haojun Ma, Aman Goel, Jean-Baptiste JeanninManos Kapritsos, Baris Kasikci, Karem A. Sakallah

University of Michigan

Page 2: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

1

Distributed systems are subtle

Page 3: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

The alternative: formal verification

Formal specification or property

Proving the system maintains the property

Successful on distributed systems

Drawback: Manual effort

2

Page 4: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Existing verification approaches

All existing approaches require the human to find an inductive invariant

We want to automatically find inductive invariants

3

Manual Effort

Verdi(Coq) IronFleet(Dafny) Ivy I4

AutomatedPerson-hoursPerson-monthsPerson-years

Page 5: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Formal verification in 2 minutes

. . .

4

0 1 2 k k+1

Goal: prove that the safety property holds at all times

Initial state

Inductive proof● Base case: prove initial state is safe● Inductive step: if state k is safe, prove state k+1 is safe

An execution:

Page 6: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Safety property vs. inductive invariant

All states

Reachable states

5

Safe states

Inductive invariant

Page 7: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Lock server protocol

6

Server1

Client2

Safety property:no two clients can be linked to the same server

Server0

Client1

Client0

Page 8: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Finding an inductive invariant using Ivy

7

lock_hold

Safety property

Strengthening assertion

Automatically checks if an invariant is inductive

Requires the human to find an inductive invariant (Screenshot from Ivy)

Existing approaches rely on manual effort and human intuition

Page 9: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Outline

I4: a new approach

Design of I4

Evaluation

Future work

8

Page 10: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

I4: a new approach

Goal: Find an inductive invariant without relying on human intuition.

Insight: Distributed protocols exhibit regularity.

Implication: We can use inductive invariants from small instances to infer a generalized inductive invariant that holds for all instances.

9

• Behavior doesn’t fundamentally change as the size increases • E.g. lock server, Paxos, …

Page 11: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Leveraging model checking

Model checking

I4 applies model checking to small, finite instances …

… and then generalizes the result to all instances.

10

J Fully automated

L Doesn’t scale to distributed systems

Page 12: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Outline

Design of I4

Evaluation

Future work

11

Page 13: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Overview

12

Protocol.ivy Correct ✓

Invariant generalization

(Ivy)

Increase Size

Invariant generation ona finite instance(Model Checking)

Page 14: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Invariant generation on a finite instance

13

Protocol.finv

Create Small(Finite) Instance

Protocol.v ModelChecker

CounterexampleDebug(manually)

Protocol.ivy Correct ✓

Invariant generalization

(Ivy)

Increase Size

Page 15: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Invariant Generalization

14

Protocol.finv

Protocol.v

Counterexample

Protocol.ivy Correct ✓

Generalize

Protocol_inv.ivy Ivy

Weaken StrengtheningAssertionViolation

Increase Size

SafetyPropertyViolation

Create Small(Finite) Instance

Debug(manually)

ModelChecker

Page 16: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Outline

Evaluation

Future work

15

Page 17: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Evaluation

16

Lock Server Leader Election Distributed lock

1 server2 clients

3 nodes3 IDs

2 nodes4 epochs

~3s ~8s ~12s

✓ ✓ ✓

Page 18: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Outline

Future work

17

Page 19: Towards Automatic Inference of Inductive Invariantsmanosk/assets/papers/i4-hotos19-slide… · Client2 Safety property: no two clients can be linked to the same server Server0 Client1

Future work

More automation

Scalability to larger protocols

Verification of Implementations

18