Collaborative Interactive Theorem Proving with Clide Martin Ring, - - PowerPoint PPT Presentation

collaborative interactive theorem proving with clide
SMART_READER_LITE
LIVE PREVIEW

Collaborative Interactive Theorem Proving with Clide Martin Ring, - - PowerPoint PPT Presentation

Collaborative Interactive Theorem Proving with Clide Martin Ring, Christoph Lth ITP 2014, 15.07.2014, Vienna 1 [18] Motivation Interactive theorem proving can be lonesome. . . 2 [18] Motivation . . . but mathematics is a social activity!


slide-1
SLIDE 1

Collaborative Interactive Theorem Proving with Clide

Martin Ring, Christoph Lüth ITP 2014, 15.07.2014, Vienna

1 [18]

slide-2
SLIDE 2

Motivation

Interactive theorem proving can be

  • lonesome. . .

2 [18]

slide-3
SLIDE 3

Motivation

Interactive theorem proving can be

  • lonesome. . .

. . . but mathematics is a social activity!

2 [18]

slide-4
SLIDE 4

Introducing Clide

◮ Previous work: a web interface for Isabelle ◮ Next step: extend this to real-time collaborative proof ◮ “Google docs for proofs”

3 [18]

slide-5
SLIDE 5

Action!

4 [18]

slide-6
SLIDE 6

Use Cases

◮ Scientific collaboration: a small number of co-authors writing a joint proof ◮ Proof review: one user explicates content of proof to others, e.g. teacher to students or

vice versa

◮ Machine-assisted collaboration: collaborating with a machine

5 [18]

slide-7
SLIDE 7

Under the hood

◮ The basic problem: synchronisation

Client B Client C Server Client A

◮ Well researched solution: operational transformation

6 [18]

slide-8
SLIDE 8

Operational Transformations

◮ Basic Problem:

  • D

a ✲ D′ b

  • a

b

◮ Basic correctness:

∀D. applyOp b′ (applyOp a D) = applyOp a′ (applyOp b D). (1)

◮ Given by auxiliary transform

and two equations: applyOp (b ◦ a) D = applyOp b (applyOp a D) (2) transform a b = a′, b′ = ⇒ b′ ◦ a = a′ ◦ b (3)

7 [18]

slide-9
SLIDE 9

Operational Transformation: Basic Principle

Text is modified using three basic actions:

◮ Retain – Copy current character ◮ Delete – Drop current character ◮ Insert c – Insert c

An operation is a sequence of actions.

8 [18]

slide-10
SLIDE 10

Operational Transformation: Basic Principle

Text is modified using three basic actions:

◮ Retain – Copy current character ◮ Delete – Drop current character ◮ Insert c – Insert c

An operation is a sequence of actions. An example: Input: I P T Output: Operation: [

8 [18]

slide-11
SLIDE 11

Operational Transformation: Basic Principle

Text is modified using three basic actions:

◮ Retain – Copy current character ◮ Delete – Drop current character ◮ Insert c – Insert c

An operation is a sequence of actions. An example: Input: P T Output: I Operation: [Retain,

8 [18]

slide-12
SLIDE 12

Operational Transformation: Basic Principle

Text is modified using three basic actions:

◮ Retain – Copy current character ◮ Delete – Drop current character ◮ Insert c – Insert c

An operation is a sequence of actions. An example: Input: T Output: I Operation: [Retain, Delete,

8 [18]

slide-13
SLIDE 13

Operational Transformation: Basic Principle

Text is modified using three basic actions:

◮ Retain – Copy current character ◮ Delete – Drop current character ◮ Insert c – Insert c

An operation is a sequence of actions. An example: Input: Output: I T Operation: [Retain, Delete, Retain,

8 [18]

slide-14
SLIDE 14

Operational Transformation: Basic Principle

Text is modified using three basic actions:

◮ Retain – Copy current character ◮ Delete – Drop current character ◮ Insert c – Insert c

An operation is a sequence of actions. An example: Input: Output: I T P Operation: [Retain, Delete, Retain, Insert P]

8 [18]

slide-15
SLIDE 15

Operational Transformation: Basic Principle

Text is modified using three basic actions:

◮ Retain – Copy current character ◮ Delete – Drop current character ◮ Insert c – Insert c

An operation is a sequence of actions. An example: Input: Output: I T P Operation: [Retain, Delete, Retain, Insert P]

8 [18]

slide-16
SLIDE 16

Operational Transformation: Basic Principle

Text is modified using three basic actions:

◮ Retain – Copy current character ◮ Delete – Drop current character ◮ Insert c – Insert c

An operation is a sequence of actions. An example: Input: Output: I T P Operation: [Retain, Delete, Retain, Insert P]

◮ Note: operations are partial. ◮ Need to consider: composition and transformation

8 [18]

slide-17
SLIDE 17

Composing Operations

◮ Composing operations: case distinction on the action

◮ Note: not simple concatenation!

◮ Example:

p = [Delete, Insert X, Retain] q = [Retain, Insert Y, Delete] compose a b =

◮ compose is partial.

9 [18]

slide-18
SLIDE 18

Composing Operations

◮ Composing operations: case distinction on the action

◮ Note: not simple concatenation!

◮ Example:

p = [Insert X, Retain] q = [Retain, Insert Y, Delete] compose a b = [Delete,

◮ compose is partial.

9 [18]

slide-19
SLIDE 19

Composing Operations

◮ Composing operations: case distinction on the action

◮ Note: not simple concatenation!

◮ Example:

p = [Retain] q = [Insert Y, Delete] compose a b = [Delete, Insert X,

◮ compose is partial.

9 [18]

slide-20
SLIDE 20

Composing Operations

◮ Composing operations: case distinction on the action

◮ Note: not simple concatenation!

◮ Example:

p = [Retain] q = [Delete] compose a b = [Delete, Insert X, Insert Y,

◮ compose is partial.

9 [18]

slide-21
SLIDE 21

Composing Operations

◮ Composing operations: case distinction on the action

◮ Note: not simple concatenation!

◮ Example:

p = [] q = [] compose a b = [Delete, Insert X, Insert Y, Delete]

◮ compose is partial.

9 [18]

slide-22
SLIDE 22

Composing Operations

◮ Composing operations: case distinction on the action

◮ Note: not simple concatenation!

◮ Example:

p = [Delete, Insert X, Retain] q = [Retain, Insert Y, Delete] compose a b = [Delete, Insert X, Insert Y, Delete]

◮ compose is partial. ◮ Extensional equivalence of operations:

compose a b ∼ = [Delete, Delete, Insert X, Insert Y]

9 [18]

slide-23
SLIDE 23

Transforming Operations

◮ Transforming operations: pointwise completion

  • a ✲
  • b

  • a

b

◮ Example:

a = [Insert X, Retain, Delete] b = [Delete, Retain, Insert Y] transform a b = ([ , [ )

10 [18]

slide-24
SLIDE 24

Transforming Operations

◮ Transforming operations: pointwise completion

  • a ✲
  • b

  • a

b

◮ Example:

a = [Retain, Delete] b = [Delete, Retain, Insert Y] transform a b = ([Insert X, , [Retain, )

10 [18]

slide-25
SLIDE 25

Transforming Operations

◮ Transforming operations: pointwise completion

  • a ✲
  • b

  • a

b

◮ Example:

a = [Delete] b = [Retain, Insert Y] transform a b = ([Insert X, Delete, , [Retain, )

10 [18]

slide-26
SLIDE 26

Transforming Operations

◮ Transforming operations: pointwise completion

  • a ✲
  • b

  • a

b

◮ Example:

a = [] b = [Insert Y] transform a b = ([Insert X, Delete, , [Retain, Delete, )

10 [18]

slide-27
SLIDE 27

Transforming Operations

◮ Transforming operations: pointwise completion

  • a ✲
  • b

  • a

b

◮ Example:

a = [] b = [] transform a b = ([Insert X, Delete, Retain] , [Retain, Delete, Insert Y] )

10 [18]

slide-28
SLIDE 28

Transforming Operations

◮ Transforming operations: pointwise completion

  • a ✲
  • b

  • a

b

◮ Example:

a = [Insert X, Retain, Delete] b = [Delete, Retain, Insert Y] transform a b = ([Insert X, Delete, Retain] , [Retain, Delete, Insert Y] )

10 [18]

slide-29
SLIDE 29

Formalisation: Correctness

◮ Correctness of compose (??):

theorem composeCorrect: [ [ compose a b = Some ab; applyOp a d = Some d ′; applyOp b d ′ = Some d ′′ ] ] = ⇒ applyOp ab d = Some d ′′

◮ Correctness of transform (??):

theorem transformCorrect: transform a b = Some (a ′,b ′) = ⇒ compose a b ′ = None ∧ compose a b ′ = compose b a ′

◮ To show previous lemmas, need to construct graphs of the partial functions. ◮ Application: generate Scala code from Isabelle

11 [18]

slide-30
SLIDE 30

Annotations

◮ Two types of annotation actions

◮ Plain n – Retain n characters ◮ Annotate n c – Annotate n characters with annotation c

◮ Annotations ≈ identity operations with side-effects ◮ No interference with operations – can be handled separately

lemma transformIdL: transform (ident (inputLength b)) b = Some (ident (outputLength b), b)

◮ Multiple named annotations per collaborator ◮ Selections, syntax coloring, substitutions, tooltips, completion, etc.

12 [18]

slide-31
SLIDE 31

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A Server r0 c1 ✲ r1 c2 ✲ r2 c3 ✲ r3 Client B

13 [18]

slide-32
SLIDE 32

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • Server r0

c1 ✲ r1 a

c2 ✲ r2 c3 ✲ r3 Client B

  • b

13 [18]

slide-33
SLIDE 33

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • c′

2

✲ •

Server r0 c1 ✲ r1 a

c2 ✲ r2 a′

c3 ✲ r3 Client B

  • b

13 [18]

slide-34
SLIDE 34

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • c′

2

✲ •

c′

3

✲ •

Server r0 c1 ✲ r1 a

c2 ✲ r2 a′

c3 ✲ r3 a′′

Client B

  • b

13 [18]

slide-35
SLIDE 35

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • c′

2

✲ •

c′

3

✲ •

Server r0 c1 ✲ r1 a

c2 ✲ r2 a′

c3 ✲ r3 a′′

c4 = a′′

✲ r4

= = = = = = = = = = Client B

  • b

13 [18]

slide-36
SLIDE 36

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • c′

2

✲ •

c′

3

✲ •

Server r0 c1 ✲ r1 a

c2 ✲ r2 a′

c3 ✲ r3 a′′

c4 = a′′

✲ r4

= = = = = = = = = = Client B

  • b

c′′

3

✲ •

b′

13 [18]

slide-37
SLIDE 37

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • c′

2

✲ •

c′

3

✲ •

Server r0 c1 ✲ r1 a

c2 ✲ r2 a′

c3 ✲ r3 a′′

c4 = a′′

✲ r4

= = = = = = = = = = Client B

  • b

c′′

3

✲ •

b′

c′

4

✲ •

b′′

13 [18]

slide-38
SLIDE 38

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • c′

2

✲ •

c′

3

✲ •

Server r0 c1 ✲ r1 a

c2 ✲ r2 a′

c3 ✲ r3 a′′

c4 = a′′

✲ r4

c5 = b′′

= = = = = = = = = = r5 Client B

  • b

c′′

3

✲ •

b′

c′

4

✲ •

b′′

= = = = = = = = = =

13 [18]

slide-39
SLIDE 39

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A Server r0 c1 ✲ r1 c2 ✲ r2 c3 ✲ r3 Client B

14 [18]

slide-40
SLIDE 40

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • Server r0

c1 ✲ r1 a

c2 ✲ r2 c3 ✲ r3 Client B

  • b

14 [18]

slide-41
SLIDE 41

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • Server r0

c1 ✲ r1 a

c2 ✲ r2 c3 ✲ r3 Client B

  • b

c′′

3

✲ •

b′

14 [18]

slide-42
SLIDE 42

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • Server r0

c1 ✲ r1 a

c2 ✲ r2 c3 ✲ r3 c4 = b′

✲ r4

Client B

  • b

c′′

3

✲ •

b′

= = = = = = = = = =

14 [18]

slide-43
SLIDE 43

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • c′

2

✲ •

Server r0 c1 ✲ r1 a

c2 ✲ r2 a′

c3 ✲ r3 c4 = b′

✲ r4

Client B

  • b

c′′

3

✲ •

b′

= = = = = = = = = =

14 [18]

slide-44
SLIDE 44

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • c′

2

✲ •

c′

3

✲ •

Server r0 c1 ✲ r1 a

c2 ✲ r2 a′

c3 ✲ r3 a′′

c4 = b′

✲ r4

Client B

  • b

c′′

3

✲ •

b′

= = = = = = = = = =

14 [18]

slide-45
SLIDE 45

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • c′

2

✲ •

c′

3

✲ •

c′

4

✲ •

Server r0 c1 ✲ r1 a

c2 ✲ r2 a′

c3 ✲ r3 a′′

c4 = b′

✲ r4

a′′′

Client B

  • b

c′′

3

✲ •

b′

= = = = = = = = = =

14 [18]

slide-46
SLIDE 46

The Control Algorithm - Server

◮ Purpose:

◮ sequentialise concurrent operations ◮ distribute transformed operations

Client A

  • c′

2

✲ •

c′

3

✲ •

c′

4

✲ •

Server r0 c1 ✲ r1 a

c2 ✲ r2 a′

c3 ✲ r3 a′′

c4 = b′

✲ r4

a′′′

c5 = a′′′

✲ r5

= = = = = = = = = = Client B

  • b

c′′

3

✲ •

b′

= = = = = = = = = =

14 [18]

slide-47
SLIDE 47

The Control Algorithm - Client

◮ Purpose: buffer operations while waiting for acknowledgment

  • a

✲ •

Revision r

15 [18]

slide-48
SLIDE 48

The Control Algorithm - Client

◮ Purpose: buffer operations while waiting for acknowledgment

  • a

✲ •

Revision r

  • c

Revision r + 1

15 [18]

slide-49
SLIDE 49

The Control Algorithm - Client

◮ Purpose: buffer operations while waiting for acknowledgment

  • a

✲ •

Revision r

  • c

a′

✲ •

c′

Revision r + 1

15 [18]

slide-50
SLIDE 50

The Control Algorithm - Client

◮ Purpose: buffer operations while waiting for acknowledgment

  • a

✲ •

Revision r

15 [18]

slide-51
SLIDE 51

The Control Algorithm - Client

◮ Purpose: buffer operations while waiting for acknowledgment

  • a

✲ •

b

✲ •

Revision r

15 [18]

slide-52
SLIDE 52

The Control Algorithm - Client

◮ Purpose: buffer operations while waiting for acknowledgment

  • a

✲ •

b

✲ •

Revision r

  • c

Revision r + 1

15 [18]

slide-53
SLIDE 53

The Control Algorithm - Client

◮ Purpose: buffer operations while waiting for acknowledgment

  • a

✲ •

b

✲ •

Revision r

  • c

a′

✲ •

c′

Revision r + 1

15 [18]

slide-54
SLIDE 54

The Control Algorithm - Client

◮ Purpose: buffer operations while waiting for acknowledgment

  • a

✲ •

b

✲ •

Revision r

  • c

a′

✲ •

c′

b′

✲ •

c′′

Revision r + 1

15 [18]

slide-55
SLIDE 55

The Control Algorithm - Client

◮ Purpose: buffer operations while waiting for acknowledgment

  • a

✲ •

b

✲ •

Revision r

  • c

a′

✲ •

c′

b′

✲ •

c′′

Revision r + 1

◮ Problem: web client must be implemented in JavaScript

15 [18]

slide-56
SLIDE 56

System Architecture: Components

clide-core clide-web clide-isabelle clide-haskell

Akka Remoting Akka Remoting Akka Remoting WebSocket W e b S

  • c

k e t WebSocket WebSocket

...

Akka Remoting

16 [18]

slide-57
SLIDE 57

Universal Collaboration

◮ Clide is generic: Isabelle is just one particular collaborator based on the great PIDE

framework.

◮ Paradigm of universal collaboration: document-centered collaborative development. ◮ Allows easy development of new assistants: just define interaction with document,

synchronisation and integration provided by Clide.

◮ Examples: prototypical Haskell and Scala IDE

17 [18]

slide-58
SLIDE 58

Concluding Remarks

◮ Clide: Interactive Collaborative Real-Time Theorem Proving

◮ Based on formalisation of Operational Transformations in Isabelle ◮ Compares well to Isabelle/jEdit or ProofGeneral ◮ Flexible system architecture built on Scala, Akka

◮ Clide is generic

◮ Prototypical Haskell and Scala instantiations ◮ Novel concept of universal collaboration 18 [18]