Chapter4:ThePalimpsestModel
Inthischapter,IwillpresentaformalmodelofthePalimpsestsequencedatatype.The
presentationwillincludesomesimpleproofsofconsistencyandpropertiesofthemodelthat
showthatitcanbeusedtomeettherequirementsforflexible,divergencetolerantcollabo-
ration.ThedefinitionsinthischapteraremeanttomaketheintuitionsdiscussedinChapter
3precise,andtheproofsaretoguaranteethatthedefinitionsareconsistentanduseful.
4.1 Thetraditionalmodelofchanges
Thesimplestmodelistheoneusedbymostfile-differencealgorithms,andistheusual
oneindiscussionsoftexteditingandundo.Itusesthesimplestpossibleoperationsetto
achieveversion-completeness.Eachstateofasequenceisaffectedbyoneoftwopossible
kindsofoperation:insertionofsomeelementsintothesequenceordeletionofsomesubse-
quenceofelements.Thismodelcannotdirectlyrepresentsuchoperationsasmoveandcopy.
Moveisrepresentedasapairofoperations,asimpleinsertion(representingacopy),anda
deletion(ofthesourcedata).Copy,issimplyaninsertion;thereisnoconnectionbetween
thesourceofthecopy,andthenewtextinsertedbyit.Thiskindofrepresentationisinher-
entlystatic,althoughitiswellsuitedtoimplementingversion-completesystems.
ThestandardformalismrepresentsahistoryasasequenceofoperationsO
1 …O
k .Eachop-
erationiseitheraninsertionoperationoradeletionoperation,appliedasequenceofdata
items,D
1 ,…D
n .Whethertheinitialsequenceisemptyorcontainsaninitialvalue,doesnot
affecttheformalmodel.Aninsertionisapair(i, seq)
consistingofanoffsetiintothese-
quence,andastringtoinsertatthatposition.Thepositionisanumberfrom0tonindi-
catingtheelementofOafterwhichthesubsequenceistobeadded.Adeletionoperationisa
pairofintegers(s, e)withs < eandboth0 £ s £ nand0 £ e £ n.Eachoperationdefinesa
Inthischapter,IwillpresentaformalmodelofthePalimpsestsequencedatatype.The
presentationwillincludesomesimpleproofsofconsistencyandpropertiesofthemodelthat
showthatitcanbeusedtomeettherequirementsforflexible,divergencetolerantcollabo-
ration.ThedefinitionsinthischapteraremeanttomaketheintuitionsdiscussedinChapter
3precise,andtheproofsaretoguaranteethatthedefinitionsareconsistentanduseful.
4.1 Thetraditionalmodelofchanges
Thesimplestmodelistheoneusedbymostfile-differencealgorithms,andistheusual
oneindiscussionsoftexteditingandundo.Itusesthesimplestpossibleoperationsetto
achieveversion-completeness.Eachstateofasequenceisaffectedbyoneoftwopossible
kindsofoperation:insertionofsomeelementsintothesequenceordeletionofsomesubse-
quenceofelements.Thismodelcannotdirectlyrepresentsuchoperationsasmoveandcopy.
Moveisrepresentedasapairofoperations,asimpleinsertion(representingacopy),anda
deletion(ofthesourcedata).Copy,issimplyaninsertion;thereisnoconnectionbetween
thesourceofthecopy,andthenewtextinsertedbyit.Thiskindofrepresentationisinher-
entlystatic,althoughitiswellsuitedtoimplementingversion-completesystems.
ThestandardformalismrepresentsahistoryasasequenceofoperationsO
1 …O
k .Eachop-
erationiseitheraninsertionoperationoradeletionoperation,appliedasequenceofdata
items,D
1 ,…D
n .Whethertheinitialsequenceisemptyorcontainsaninitialvalue,doesnot
affecttheformalmodel.Aninsertionisapair(i, seq)
consistingofanoffsetiintothese-
quence,andastringtoinsertatthatposition.Thepositionisanumberfrom0tonindi-
catingtheelementofOafterwhichthesubsequenceistobeadded.Adeletionoperationisa
pairofintegers(s, e)withs < eandboth0 £ s £ nand0 £ e £ n.Eachoperationdefinesa