Collaborative Interactive Theorem Proving with Clide Martin Ring, Christoph Lüth ITP 2014, 15.07.2014, Vienna 1 [18]
Motivation Interactive theorem proving can be lonesome. . . 2 [18]
Motivation . . . but mathematics is a social activity! Interactive theorem proving can be lonesome. . . 2 [18]
Introducing Clide ◮ Previous work: a web interface for Isabelle ◮ Next step: extend this to real-time collaborative proof ◮ “Google docs for proofs” 3 [18]
Action! 4 [18]
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]
Under the hood ◮ The basic problem: synchronisation Client B Client A Client C Server ◮ Well researched solution: operational transformation 6 [18]
Operational Transformations ◮ Basic Problem: • a ✲ b ′ ✲ D ′ D ✲ ✲ b ′ a • ◮ 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) ⇒ b ′ ◦ a = a ′ ◦ b transform a b = � a ′ , b ′ � = (3) 7 [18]
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]
Operational Transformation: Basic Principle Text is modified using three basic actions: An example : ◮ Retain – Copy current character Input: I P T ◮ Delete – Drop current character Output: ◮ Insert c – Insert c Operation: [ An operation is a sequence of actions. 8 [18]
Operational Transformation: Basic Principle Text is modified using three basic actions: An example : ◮ Retain – Copy current character Input: P T ◮ Delete – Drop current character Output: I ◮ Insert c – Insert c Operation: [ Retain , An operation is a sequence of actions. 8 [18]
Operational Transformation: Basic Principle Text is modified using three basic actions: An example : ◮ Retain – Copy current character Input: T ◮ Delete – Drop current character Output: I ◮ Insert c – Insert c Operation: [ Retain , An operation is a sequence of actions. Delete , 8 [18]
Operational Transformation: Basic Principle Text is modified using three basic actions: An example : ◮ Retain – Copy current character Input: ◮ Delete – Drop current character Output: I T ◮ Insert c – Insert c Operation: [ Retain , An operation is a sequence of actions. Delete , Retain , 8 [18]
Operational Transformation: Basic Principle Text is modified using three basic actions: An example : ◮ Retain – Copy current character Input: ◮ Delete – Drop current character Output: I T P ◮ Insert c – Insert c Operation: [ Retain , An operation is a sequence of actions. Delete , Retain , Insert P ] 8 [18]
Operational Transformation: Basic Principle Text is modified using three basic actions: An example : ◮ Retain – Copy current character Input: ◮ Delete – Drop current character Output: I T P ◮ Insert c – Insert c Operation: [ Retain , An operation is a sequence of actions. Delete , Retain , Insert P ] 8 [18]
Operational Transformation: Basic Principle Text is modified using three basic actions: An example : ◮ Retain – Copy current character Input: ◮ Delete – Drop current character Output: I T P ◮ Insert c – Insert c Operation: [ Retain , An operation is a sequence of actions. Delete , Retain , Insert P ] ◮ Note: operations are partial . ◮ Need to consider: composition and transformation 8 [18]
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]
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]
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]
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]
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]
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]
Transforming Operations ◮ Transforming operations: pointwise completion • a ✲ b ′ ✲ • • ✲ ✲ b ′ a • ◮ Example: a = [ Insert X , Retain , Delete ] b = [ Delete , Retain , Insert Y ] transform a b = ([ , [ ) 10 [18]
Transforming Operations ◮ Transforming operations: pointwise completion • a ✲ b ′ ✲ • • ✲ ✲ b ′ a • ◮ Example: a = [ Retain , Delete ] b = [ Delete , Retain , Insert Y ] transform a b = ([ Insert X , , [ Retain , ) 10 [18]
Transforming Operations ◮ Transforming operations: pointwise completion • a ✲ b ′ ✲ • • ✲ ✲ b ′ a • ◮ Example: a = [ Delete ] b = [ Retain , Insert Y ] transform a b = ([ Insert X , Delete , , [ Retain , ) 10 [18]
Transforming Operations ◮ Transforming operations: pointwise completion • a ✲ b ′ ✲ • • ✲ ✲ b ′ a • ◮ Example: a = [] b = [ Insert Y ] transform a b = ([ Insert X , Delete , , [ Retain , Delete , ) 10 [18]
Transforming Operations ◮ Transforming operations: pointwise completion • a ✲ b ′ ✲ • • ✲ ✲ b ′ a • ◮ Example: a = [] b = [] transform a b = ([ Insert X , Delete , Retain ] , [ Retain , Delete , Insert Y ] ) 10 [18]
Transforming Operations ◮ Transforming operations: pointwise completion • a ✲ b ′ ✲ • • ✲ ✲ b ′ a • ◮ Example: a = [ Insert X , Retain , Delete ] b = [ Delete , Retain , Insert Y ] transform a b = ([ Insert X , Delete , Retain ] , [ Retain , Delete , Insert Y ] ) 10 [18]
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]
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]
The Control Algorithm - Server ◮ Purpose: ◮ sequentialise concurrent operations ◮ distribute transformed operations Client A c 1 ✲ r 1 c 2 ✲ r 2 c 3 ✲ r 3 Server r 0 Client B 13 [18]
The Control Algorithm - Server ◮ Purpose: ◮ sequentialise concurrent operations ◮ distribute transformed operations Client A • ✻ a c 1 ✲ r 1 c 2 ✲ r 2 c 3 ✲ r 3 Server r 0 b ❄ Client B • 13 [18]
The Control Algorithm - Server ◮ Purpose: ◮ sequentialise concurrent operations ◮ distribute transformed operations ✲ • Client A • c ′ ✻ ✻ 2 a ′ a c 1 ✲ r 1 c 2 ✲ r 2 c 3 ✲ r 3 Server r 0 b ❄ Client B • 13 [18]
The Control Algorithm - Server ◮ Purpose: ◮ sequentialise concurrent operations ◮ distribute transformed operations ✲ • ✲ • Client A • c ′ c ′ ✻ ✻ ✻ 2 3 a ′ a ′′ a c 1 ✲ r 1 c 2 ✲ r 2 c 3 ✲ r 3 Server r 0 b ❄ Client B • 13 [18]
The Control Algorithm - Server ◮ Purpose: ◮ sequentialise concurrent operations ◮ distribute transformed operations ✲ • ✲ • Client A • = c ′ c ′ ✻ ✻ ✻ = 2 3 = = = a ′ a ′′ a = = = = = c 1 ✲ r 1 c 2 ✲ r 2 c 3 ✲ r 3 c 4 = a ′′ ✲ r 4 Server r 0 b ❄ Client B • 13 [18]
Recommend
More recommend