• No results found

Discussions on the SLOT control algorithm

3.4 An operation-based textual merging algorithm

3.4.3 Discussions on the SLOT control algorithm

Compared with transformation control algorithms such asdOPT[46],adOPTed[109],

GOT [137], and GOTO [136] proposed for real-time collaborative editing, SLOT is more efficient in the sense it is has a linear time complexity. In addition, it is also much simpler in the sense that it does not need any exclusion transformation, which is a significant merit in practice because it is difficult to define exclusion transforma- tion functions that always meet the reversibility property (Property 1.3) due to the information loss in inclusion transformations [137].

Furthermore, the SLOT algorithm has avoided transformation property 2 (Prop- erty 1.2) that imposes a condition that the transformation of an operation against a pair of operations is independent of the order in which the pair of operations are transformed against each other. In practice, it is difficult to verify TP2; if TP2 is violated, convergence may not be guaranteed. The reason why the SLOT algorithm can avoidTP2is that under no circumstance could an operation be transformed with

the same pair of operations in different orders. Given any two logs L1 and L2, oper-

ations in L1 and L2 need to be transformed with each other by SLOT(L1, L2) only

once to maintain consistency. For example, in Figure 3.18, to merge changes made by

Author 2 intoAuthor 1’s version of document (i.e., M1) and to merge changes made by Author 1 into Author 2’s version of document (i.e., M2), SLOT(L1, L2) = (L01,

L0

2) will be executed only once. Then the two authors’ versions of the document will

be convergent after applying operations in L0

2 onM1 and applying operations in L01

onM2.

The following theorem is established to prove that theSLOTtransformation con- trol algorithm is able to maintain convergence:

Theorem 3.2. Given any two logs L1 and L2, if SLOT(L1, L2) = (L01, L02), then

L1 ◦ L02 ≡ L2 ◦ L01.

Proof: Suppose logL1 contains a list ofmediting operations [D1,· · ·,Dm]. If log

L2 is empty, thenSLOT(L1,L2) = (L1, [ ]). The theorem apparently holds because

L1 ◦[ ] ≡ [ ] ◦ L1. Otherwise, suppose L2 contains a list of n editing operations [O1,

· · ·,On], then it must beL01= [Dn1,· · ·,Dmn] whereDni (1≤i≤m) is the transformed

form ofDi that has inclusively transformed against allnediting operations inL2 and

L0

2 = [O1m, · · ·, Omn] where Omj (1 ≤ j ≤ n) is the transformed form of Oj that has

inclusively transformed against all m operations in L1.

According to the definition of theSLOTtransformation control algorithm, suppose D0 i = Di (1≤ i ≤ m) and O0j = Oj (1 ≤ j ≤ n), then Dki = IT(D k−1 i , O i−1 k ) where 1 ≤ i ≤ m, 1 ≤ k ≤ n, and Dk

i is the transformed form of Di that has inclusively

transformed against the firstk operations inL2. Ojl =IT(O l−1

j ,D j−1

l ) where 1≤j ≤

n, 1 ≤ l ≤m, andOl

j is the transformed form ofOj that has inclusively transformed

against the first l operations in L1. Then we have: L2 ◦ L01 ≡ [O1, · · ·, On] ◦ [D1n,

· · ·, Dn m] ≡ O1 ◦ · · · ◦ On◦D1n ◦ · · · ◦ Dmn ≡ · · · ◦ On◦IT(D1n−1, On) ◦ · · · (by SLOT) ≡ · · · ◦ Dn−1 1 ◦IT(On, D1n−1) ◦ · · · (by TP1) ≡ · · · ◦ D n−1 1 ◦O1n ◦ · · · (by SLOT) ≡ O1 ◦ · · · On−1 ◦ Dn1−1 ◦ O 1 n◦D2n ◦ · · · ◦ Dnm ≡ · · · ◦ O 1 n◦IT(D n−1 2 , O 1 n)

136 ◦ · · · (by SLOT)≡ · · · ◦ Dn−1 2 ◦IT(O 1 n, D n−1 2 ) ◦ · · · (by TP1) ≡ · · · ◦D n−1 2 ◦O 2 n ◦ · · · (by SLOT) ≡ · · · ≡ O1 ◦ · · · ◦ On−1◦Dn1−1 ◦ D n−1 2 · · · ◦ D n−1 m ◦Omn ≡ · · ·

◦ On−1◦IT(D1n−2, On−1) ◦ · · · (by SLOT) ≡ · · · ◦ D1n−2◦IT(On−1, Dn1−2)◦ · · · (by

TP1) ≡ · · · ◦ Dn−2 1 ◦O 1 n−1 ◦ · · · (by SLOT) ≡O1 ◦ · · · On−2 ◦Dn1−2 ◦O 1 n−1◦D n−1 2 ◦ · · · ◦ Dn−1 m ◦ Omn ≡ · · · ≡ O1 ◦ · · · ◦ On−2◦Dn1−2 ◦ D n−2 2 · · · ◦ Dn− 2 m ◦ Onm−1 ◦ Onm ≡ · · · ≡D10 ◦ D 0 2 ◦ · · · ◦D 0 m ◦Om1 ◦O m 2 ◦ · · · O m n ≡D1 ◦D2 ◦ · · · ◦Dm ◦ Om 1 ◦ Om2 ◦ · · · Omn ≡ [D1, . . ., Dm] ◦ [Om1 , · · ·, Omn] ≡ L1 ◦ L02. The theorem is hereby proven.

In the event of log compression by the COMET algorithm, we need to consider its effect on maintaining convergence by the SLOT algorithm. If logsL1 and L2 are

not compressed, we have provenL1 ◦L02 ≡L2 ◦L01 where (L01,L02) =SLOT(L1,L2).

If L1 was not compressed at the time of transformation but L01 was compressed into

L0

1c =COMET(L01) before being merged into Author 2’s version of document (i.e., M2), in order to maintain convergence, it should be L1 ◦ L02 ≡ L2 ◦ L01c. Because

L1 ◦L02 ≡ L2 ◦ L01 has been proven, we will proveL1 ◦ L02 ≡L2 ◦ L01c by provingL01

≡ L0

1c. The following transpose property (TPP) and operational merging property

(OMP) are important to prove the above theorem:

Property 3.1. Transpose Property 1(TPP)

Given any two operations Oa and Ob, where Oa 7→ Ob, if Transpose(Oa, Ob) =

(O0

b, O0a), then [Oa, Ob]≡ [O0b,O0a].

This property has been described and proven by Sun [132].

Property 3.2. Operational Merging Property (OMP)

Given any two operationsOaandOb, whereOa7→Ob, ifOM(Oa,Ob) = (Oa0,Ob0),

then [Oa, Ob] ≡ [O0a, O0b].

Proof: refer to Appendix B - Formal proofs of theorems and properties for the formal proof of the property.

Finally, according to the definition of the COMET compression algorithm, and

Theorem 3.3. Given a log L, if COMET(L) = Lc, then L ≡ Lc.

Proof: According to the definition of the COMET algorithm, Lc is obtained

by repeatedly applying the OM function followed by the Transpose function on L. First, supposeLc is obtained by applying theOMfunction followed by the Transpose

function one time. LetL= [O1,· · ·,Oi−1,Oi,Oi+1,Oi+2,· · ·,On], andLc = [O1,· · ·,

Oi−1,O

00

i+1,O

00

i,Oi+2,· · ·,On] whereOM(Oi,Oi+1) = (O0i,Oi0+1) andTranspose(Oi0,

O0

i+1) = (O

00

i+1, O

00

i). Suppose CTO1 = S, the theorem is true because:

1. S0 =S L[1, i-1] = S L

c[1, i-1] (by L[1, i-1] = Lc[1, i-1]);

2. S00 =S0 L[i,i+1] = S0 L

c[i, i+1] (by OMP and TPP);

3. S000 =S00 ◦ L[i+2, n] = S00 ◦ Lc[i+2, n] (byL[i+2, n] = Lc[i+2, n]).

It can be easily shown by an introduction argument that the theorem is true if Lc is obtained by applying theOMfunction followed by the Transposefunction on L

any number of times.