Table Of Content2005InternationalConferenceonAnalysisofAlgorithms DMTCSproc. AD,2005,71–94
The Lyapunov tortoise and the dyadic hare
Benoˆıt Daireaux1 and Ve´ronique Maume-Deschamps2 and Brigitte
Valle´e1
1CNRSUMR6072,GREYC,Universite´deCaen,F-14032Caen,France
2 InstitutdemathematiquesdeBourgogneUniversitedeBourgogne-UMR5584duCNRS9,AvenueAlainSavary
B.P.4787021078DijonCedexFrance
We study a gcd algorithm directed by Least Significant Bits, the so–called LSB algorithm, and provide a precise
average–caseanalysisofitsmainparameters[numberofiterations,numberofshifts,etc...]. Thisanalysisisbased
onaprecisestudyofthedynamicalsystemswhichprovideacontinuousextensionofthealgorithm,and,here,itis
provedconvenienttousebotha2–adicextensionandarealone. Thisleadstotheframeworkofproductsofrandom
matrices,andourresultsthusinvolveaconstantγ whichistheLyapunovexponentofthesetofmatricesrelativeto
thealgorithm.Thealgorithmcanbeviewedasaracebetweenadyadicharewithaspeedof2bitsbystepanda“real”
tortoisewithaspeedequaltoγ/log2∼0.05bitsbystep. Evenifthetortoisestartsbeforethehare,thehareeasily
catchesupwiththetortoise[unlikeinAesop’sfable[1]...],andthealgorithmterminates.
1 Introduction
Like any gcd algorithm, the LSB algorithm performs a sequence of divisions and exchanges, and the
divisionsareusedto“shorten”theintegers.However,theLSBdivisionaimstocreatezeroesontherightof
thebinaryextension[whereasusualonescreatezeroesontheleft],whichright–shiftstheneasilysuppress.
Atafirstglance,itresemblestheBinaryAlgorithm. However,bothalgorithmsarequitedifferent: inthe
BinaryAlgorithm,theexchangeisperformedassoonastheremainderrbecomessmallerthanthedivisor
u,whereastheLSBalgorithmperformsanexchangeassoonastheremainderrhasadyadicnormsmaller
thanu. Inthissense,theBinaryalgorithmtendstoshortenintegersbothontherightandontheleft,while
the LSB algorithm is totally dyadic, only shortens on the right, and may even increases the size on the
left...
To the best of our knowledge, the LSB algorithm was introduced for the first time by Stehle´ and Zim-
mermann [21], who use it in their improvement of the recursive gcd algorithm. This algorithm appears
to be interesting, because it is more “stable” than other gcd–algorithms. The authors provided a worst–
caseanalysisofthealgorithm,whichprovesthat,forafixedinput–size,themaximalnumberofiterations
grows linearly with the size of data. They also made experimental observations [20]; for instance, they
remark that the size of remainders is not generally decreasing, a quotient of ±1 occurs with probability
1/3,andtheaveragenumberofiterationsappearstobelinearwithrespecttosize.
Wesucceedtoprovetheseexperimentalobservations.Theanalysesprovidedhereareinstancesofdynam-
icalanalysis,[describedin[22]forinstance],whereoneproceedsinthreemainsteps: First,the(discrete)
algorithm is extended into a continuous process, which can be defined in terms of a dynamical system,
whereexecutionsofthegcdalgorithmarethendescribedbyparticulartrajectories[i.e.,trajectoriesof“ra-
tional”points]. Second,themainparametersofthealgorithmareextendedandstudiedinthiscontinuous
framework:thestudyofparticulartrajectoriesisreplacedbythestudyofgenerictrajectories. Finally,one
operatesatransfer“fromcontinuoustodiscrete”,andprovesthattheprobabilisticbehaviourofgcdalgo-
rithms[relatedto“rational”trajectories]isquitesimilartothebehaviouroftheircontinuouscounterparts
[relatedtogenerictrajectories].
Particulars of the LSB Algorithm. In the LSB case, the analysis will be more involved. We have
to record the number of zeroes produced on the left of integers, and this is easily done by the 2–adic
valuation. But,wealsohavetotakeintoaccountthetotalsizeofintegers,andthiscannotbedoneinthe
dyadicframework. Inshort,thetopologyisultrametric,butthesizeisarchimedean.
ItwillproveconvenienttousethesetofmatricesN,
(cid:18) (cid:19)
0 1 a
N :={N = ;q = ;k ≥1,aodd,a∈[−2k+1,2k−1]}, (1)
[q] 1 q 2k
1365–8050(cid:13)c 2005DiscreteMathematicsandTheoreticalComputerScience(DMTCS),Nancy,France
72 BenoˆıtDaireaux andVe´roniqueMaume-Deschamps andBrigitteValle´e
where each matrix N is drawn with probability δ := 1/|q|2 = 2−2k. The choice of probabilities is
[q] q 2
relatedtothe2–adictopology,whiletheEuclideannormofmatrixN isusedtodealwiththeusualnotion
ofsize. Then,theLyapunovexponentγ ofthissetofmatricesplaysafundamentalroˆleinourpaper. Itis
classicallydefinedasthelimit
1
γ := lim E[log||N ·N ·...·N ||],
nn→∞ 1 2 n
[when each matrix N is independently drawn in N]. More precisely, the exponent γ := γ/log2
k 0
measurestheaverageincreaseofintegersizeateachstep. Ontheotherhand,theintegerkin(1)isequal
totheright–shift,andthusthedecreaseoftheintegersize; inourprobabilisticmodelinheritedfromthe
dyadictopology,itsaveragevalueisequalto2. Wehavethenexplainedourtitle: ourtortoiselivesinthe
real world, and moves [on average] according to the Lyapunov exponent, while the move of our hare is
directedbydyadicrules.
Randommatricesanditeratedfunctionssystems. Insummary, ourfirststeptransformstheanalysis
oftheLSBalgorithmintoastudyofthesetN ofrandommatrices. Thesubjectofrandommatriceshas
been widely studied in works of Furstenberg [12], Guivarc’h and Raugi [14], Le Page [18], and is well
summarizedinthebookofBougerolandLacroix[4]. Inparticular,ChapterIIofPartAofthisbookand
thewholePartBaredevotedtothecaseofmatricesoforder2. Wearenowinthe“real”world,andthe
dyadictopologyisjusttranslatedonprobabilities.Likein[4],wethenconsidertheactionofmatricesN
[q]
ontherealprojectiveline,anditprovesmoreconvenienttotransportthewholeframewokonthecompact
torusJ :=R/πZ[viathe“tangent”map]. OursetN isnowtransformedintoasetLofrandomfunctions
‘ : J → J (whereeachfunction‘isdrawnwithdyadicprobabilityδ ),andwefindourselveswithinthe
‘
framework of Iterated Functions Systems (IFS), where it is classical to deal with transfer operators G ,
z
definedas
X
G [f](x):= δ ·|‘0(x)|z·f ◦‘(x),
z ‘
‘∈L
whichdependonaparameterz,actonfunctionsf :J →Cand“summarize”allthepropertiesoftheset
N. Notethatparameterz“marks”the“real”size(symbolizedbyourtortoise).
Inourstudy,weneedadoublegeneralizationofthesetransferoperators,andintroducetwonewparam-
eters,aparametert,which“marks”thedyadicsize(symbolizedbyourhare),anda(third)parameterw,
whichmarksthestep–costcthatwewishtostudy. Accordingly,thewholepaperdealswiththeoperator
G [f]:=Xδt·exp[wc(‘)]·|‘0|z·f ◦‘.
t,z,w ‘
‘∈L
Likeinpreviousdynamicalanalyses†,weprovethatthisoperatorplaystheroˆleofageneratingoperator,
whichitselfgeneratesalltheobjectsof“classical”analysisofalgorithms—namely(Dirichlet)generating
functions,orthemomentgeneratingfunctions. ThemainpropertiesofsetN ofmatricescanbe“read”on
the (dominant) spectral objects of the operator, namely its dominant eigenvalue λ(t,z,w). Notably, the
Lyapounovexponentγ isrelatedtothederivativeofz →λ(1,z,0)atz =0,
1
γ =− λ0(1,0,0).
2 z
Themainresults.Ourfirstresultconfirmsandprovesalltheexperimentalfactsobservedin[20,21],and,
moregenerally,describes,inaverypreciseway,agenericexecutionoftheLSB–algorithm. Onaninteger
input(u,v),theLSBalgorithmperformsP(u,v)iterations,withatotalnumberK(u,v)ofright-shifts,a
totalnumberS(u,v)ofsubtractions;duringtheexecution,aquotientaoccursC (u,v)times.Itperforms
a
atotalofB(u,v)elementaryoperationsonbits[B(u,v)isoftencalledthebit-complexity]. Whatarethe
averagevaluesoftheseparameterswhen(u,v)isarandompairofbinarylengthN,forsufficientlylarge
N? Weprove,inTheorem1,thatallthemeanvaluesoftheseparameters[exceptthebit–complexity]are
ofasymptoticorderN,andthemeanvalueofthebit–complexityisofasymptoticorderN2. Furthermore,
all the constants that appear in the dominant terms involve the Lyapunov exponent in base 2, namely
γ :=γ/log2,
0
1 5 N
E [P]∼ ·N, E [K]∼2·E [P], E [S]∼ E [P], E [B]∼E [S+K]·
N 2−γ N N N 2 N N N 2
0
†Remarkthatallpreviousdynamicalanalysesuseddynamicalsystems,notiteratedfunctionssystems.
TheLyapunovtortoiseandthedyadichare 73
1 1
and,foraquotientawith‘(a)binarydigits, E [C ]∼ · ·E [P].
N a 3 4‘(a)−1 N
Anumericalvalueforconstantγ isγ ∼0.0344/log2∼0.0497. Then,weobtain
0 0
E [P]∼0.51·N E [K+S]∼2.30·N, E [B]∼1.15·N2.
N N N
This must be compared to the behaviour of the Binary Algorithm, which has already been analyzed in
[23],whereitisproventhat
E [P]∼0.39·N, E [K+B]∼2.11·N, E [B]∼1.10·N2.
N N N
Then,itappearsthatthebehaviourofLSBalgorithmisquitesimilartotheBinaryAlgorithm.
OursecondresultprovidesananalysisofthecontinuousextensionoftheLSBalgorithm. SincetheLSB
algorithm is based on the 2-adic norm, this extension is quite naturally a 2-adic extension, and we then
workinthefieldQ of2-adicnumbers.Thisextensiongeneratesthe(2–adic)continuedfractionexpansion
2
ofadyadicnumberx,andinparticularprovidesafternstepsarationalapproximationQ ofx,itsn-th
n
convergent. Theorem2studiesthesizeL(Q )ofthen–thconvergent,andprovesthatitasymptotically
n
followsaGaussianLaw. Notably,theexpectationofthesizesatisfies
E[L(Q )]∼(2+γ )·n.
n 0
Planofthepaper. WepresentinSection2theLSBalgorithm, the2-adiccontinuedfractionexpansion
andstateourmainresults,Theorems1and2. Section3introducestheLSBdynamicalsystem,whichis
furtherextendedintoaniteratedfunctionssystem(IFS).Wepresentthemainactor,thetransferoperator
relativetothisIFS.Then,Propositions1and2performtransfers“fromcontinuoustodiscrete”,andrelate
thetransferoperatortogeneratingfunctions. Finally,Theorem3[provedinsection5]describesthemain
analyticalpropertiesoftheoperatorwhichmakepossibletoapplytheTauberiantheoremandtheQuasi-
PowertheoremforprovingTheorems1and2.
2 The LSB algorithm.
This section is devoted to describing the general framework of this paper. First, we present the LSB
algorithm, and make precise the probabilistic model used in our analysis. Then, we state our first main
result [Theorem 1] which provides the mean values of the main parameters of the LSB algorithm. In a
secondstage,weextendthisalgorithmintoacontinuousprocess,namelythe2-adic(centered)continued
fractionexpansion. Oursecondmainresult[Theorem2]exhibitstheGaussianbehaviourofthelengthof
continuants.
2.1 The LSB Division.
The division directed by the least significant bits [LSB’s] of integers resembles the usual one, which is
directedbythemostsignificantbits[MSB’s];howeveritaimstocreatezeroesontherightofthebinary
expansion of the integers, whereas the usual division creates them on the left of this expansion. Since
the2–adicvaluationequalsthenumberofzeroesontheright,itisthenquitenaturaltodescribetheLSB
divisionwiththehelpofthe2-adicnorm: Indeed,theLSBdivisioncanbedefinedbyreplacingtheusual
normbythe2-adiconeinthedefinitionoftheclassicalEuclideandivision.
Letusfirstrecallsomefactsaboutthe2-adicvaluation. The2-adicvaluationofanintegera∈Z,denoted
byν(a),isthelargestksuchthat2k dividesa. Thevaluationoftherationala/b ∈ Qisthendefinedby:
ν(a/b)=ν(a)−ν(b). Fromthisvaluation,onedefinesthe2-adicabsolutevalueofarationalx:
|x| =2−ν(x).
2
The2-adicdistancebetweentwointegersxandy isthencloselyrelatedtothenumberofsignificantbits
whicharecommonbetweenxandy. Thisiswhyitisveryusefulinthecasewhenthedivisionbetweenu
andvisdirectedbytheleastsignificantbitsofuandv. Itisaultrametricabsolutevalue,andtherelations
|x+y| ≤max(|x| ,|y| ), |x+y| =max(|x| ,|y| ) if|x| 6=|y|
2 2 2 2 2 2 2 2
alwayshold.
74 BenoˆıtDaireaux andVe´roniqueMaume-Deschamps andBrigitteValle´e
First,wedenotebyΩe thesetofvalidinputsofthedivision,
Ωe :={(u,v)∈Z2;vodd,ueven}. (2)
Givenavalidinput(u,v) ∈ Ωe,thecenteredLSBdivisionreturnsaremainderr smaller(withrespectto
the2-adicnorm)thanuandaquotientqsuchthat
1
v =uq+r, with |q|<1, 0≤|r| ≤ |u| . (3)
2 2 2
Sincethepair(r,u)satisfiesν(r) > ν(u),theshiftedpair(r0,u0) := (2−ν(u)·r,2−ν(u)·u)belongsto
thesetΩe: thiswillbethenewpairforthenextstep.
Forinstance,thedivisionbetweenv = 29= 11101 andu = 12= 1100 isnaivelymadeasfollows,in
2 2
ordertoobtainaremainderrwithatleastthreezeroesontheright: witharightbinaryshift,we“forget”
thetwozeroesontherightofuandthedifferencebetween11101 and11 equals11010 . Thereisonly
2 2 2
onezeroontheright,thenwe“forget”itandwecontinue;thedifference1101 −11 =1010createsone
2 2
supplementaryzeroontheright: we“forget”itandwecontinue;finallythedifference101 −11 =10
2 2 2
createsathirdzeroontheright. Then,westopandfinallythedivisioncanbewrittenas
1 +10 +100 7
11101 =1100 × 2 2 2 +1000 , i.e., 29= 12+8.
2 2 100 2 4
2
Suchaprocessleadstoadivisionoftheform
1
v =uq+r, 0<q <2and0≤|r| ≤ |u| . (4)
2 2 2
Sincewewishtoobtainadivisionoftype(3),wefinallycenterthequotientqandwrite
−1 −1
29= 12+32, 11101 =1100 × 2 +100000 ,
4 2 2 100 2
2
and the pair (r,u) is (32,12). The new pair (r0,u0) is then obtained by right-shifting the pair (r,u).
Finally,thenewpairgeneratedbythedivisionof29by12is(8,3).
Generallyspeaking,the(centered)quotient(alsocalledthe“digit”)qisoftheform
a (cid:16) u (cid:17)−1
q = with k :=ν(u), a=v· cmod2k+1.
2k 2ν(u)
Herexcmodydenotesthecenteredremainderofxmody. Remarkthatais oddandbelongsto[−2k+
1,2k−1]. Itiseasytoprovethatthesetofpossibledigitsrelativetoallvalidpairs(u,v)is
a
Q:={ ;k ≥1,aodd,a∈[−2k+1,2k−1]}. (5)
2k
Remarkthat,intheLSBdivisionv =qu+r,theabsolutevalue|r|oftheremaindermaybestrictlylarger
than |u|; It can be true even for the shifted r0. Of course, this situation cannot occur with the classical
division.
Inthesequel,wewillmakeadeepuseofthematrixrepresentationofthedivision:ifwedefineforq ∈Q,
thematrices
(cid:18) 0 2k (cid:19) (cid:18) 0 1 (cid:19)
M = , N = =2−kM , (6)
[q] 2k a [q] 1 q [q]
thentheoldpair(u,v),theintermediatepair(r,u)andthenewpair(r0,u0)satisfy
(cid:18) u (cid:19) (cid:18) r (cid:19) (cid:18) u (cid:19) (cid:18) r0 (cid:19)
=N , =M .
v [q] u v [q] u0
We denote by M, [resp. N] the set of matrices M [resp. N ] when q ∈ Q. The set N plays an
[q] [q]
essentialroˆleinthepaper.
TheLyapunovtortoiseandthedyadichare 75
Input:(u,v)=(72001,2011176)
Inbase2(u,v)=(111101011000000101000 ,10001100101000001 ).
2 2
i ui[base2] ui[base10] continuantri+1 continuantpi+1 quotientai/2ki
0 10001100101000001 72001 1 0
1 111101011000000101000 2011176 -11 1000 -3/8
2 11001001101101010000 826192 1101 1000 1/2
3 110000110001010000000 1598080 -100011 10001000 1/8
4 10011000111100000000 626432 11110011 -1000 -1/2
5 111010010101000000000 1911296 -101111111 1000101000 -1/2
6 110000010010000000000 1582080 1001001101 1000001000 1/2
7 100010001100000000000 1120256 -100001001001 11010011000 -1/2
8 1000001011000000000000 2142208 11101011 111010111000 1/2
9 1100000000000000 49152 -100000101011101 100001101111000 1/4
10 1000001000000000000000 2129920 100100010110101 11001001001000 -1/2
11 100010000000000000000 1114112 -1011110010111111 10100000000101000 1/2
12 110000000000000000000 1572864 10000011101100001011 -110001110001001000 -5/8
13 1000000000000000000000 2097152 10001100101000001 111101011000000101000 3/4
Fig.1:AnexecutionoftheLSBAlgorithm.
2.2 The LSB Algorithm.
Onthevalidinput(u,v)ofΩe,theLSBalgorithmperformsasequenceofsteps,eachstepbeingcomposed
byaLSBdivision,followedbyabinaryshiftandanexchange. Thetotalexecutionontheinput(u :=
0
v,u :=u)isdescribedasfollows
1
uu10 ==qq21uu21++rr21,, uu32 ::==22−−νν((uu21))··rr21,, uu21 ::==22−−νν((uu21))··uu21,,
... ... ...
ui−1 =.q.i.ui+ri, ui+1 :=2.−..ν(ui)·ri, ui :=2.−.ν.(ui)·ui
andstopsatthep-thiterationwithu =0. Figure1describesaninstanceofsuchanexecution.
p+1
Onaninput(u,v)whosegcdequalsd,thepreviousexecutioncreatesmatrixproductsoftheform
(cid:18) (cid:19) (cid:18) (cid:19) (cid:18) (cid:19)
u 0 0 1
=M =N , with M :=M ·M ·...·M , N := M, (7)
v d 2kd [q1] [q2] [qp] 2k
where k = k +···+k is the total number of shifts performed. It also creates the continued fraction
1 p
expansionoftherationalu/v,
u 1
= (8)
v 1
q +
1 1
q +
2
...+ 1
q +0
p
Ifh (x)denotesthelinearfractionaltransformation(LFT)associatedtomatrixM [orN ], defined
[q] [q] [q]
as
1 2k
h (x):= = , (9)
[q] q+x a+2kx
thenthepreviouscontinuedfractionexpansioncanbewrittenas
u
=h ◦h ◦...h (0)=h(0). (10)
v [q1] [q2] [qp]
RemarkthattheLFThandthematrixM areoftheform
(cid:18) (cid:19)
αx+β α β
h(x)= , M =
γx+δ γ δ
withα,β,γ,δcoprimeintegers.Whenthealgorithmperformspiterations,itthusgivesrisetoacontinued
fractionofdepthp.
76 BenoˆıtDaireaux andVe´roniqueMaume-Deschamps andBrigitteValle´e
2.3 Probabilistic behaviour of the LSB Algorithm.
We wish to study this algorithm from a probabilistic point of view, and then provide a theory which
explainstheexperimentalfactsalreadyobservedbyStelhe´andZimmermannin[21]or[20].Theseauthors
havestudiedthisalgorithmfromtheworst–casepointofview. Theyhaveestablishedthatthealgorithm
runs in quadratic time (in the worst–case) and they have exhibited the precise worst–case number of
iterations:Itariseswheneachdivision–stepusestheminimal–sizequotient,equalto1/2,andinvolvesthe
√
absolutevalueofthesmallesteigenvalueofthematrixM equalto( 17−1)/2. Then,themaximum
[1/2]
numberofiterationsoftheLSBAlgorithmonapair(u,v)withmax(|u|,|v|)≤N,isasymptoticto
log√ N.
17−1
2
Theyhavealsoobservedthatthesequenceofremainders(u ,u ,u ,...,u )isnotgenerallydecreasing.
0 1 2 p
Here,wewishtodescribetheprobabilisticbehaviourofsomeimportantparametersrelatedtothisalgo-
rithm,inordertocomparethemwithalreadyknownresultsconcerningothergcdalgorithms.
Infact,weconsidertwosetsΩandΩe: thesecondoneisformedwithallthevalidinputsofthealgorithm,
while the first one only contains the valid inputs that are coprime. We mainly deal with the set Ω. It
mayseemstrange—atleastfromanalgorithmicpointofview—tostudythesetsofinputsforwhichthe
answerofthealgorithmistrivial! However,weshallseethatthis(trivial)setisinasensegeneric,andit
willbeeasytotransfertheresultsonΩtothe(morenatural)setΩe.
FortheLSBAlgorithm,thesetsΩe andΩare
Ωe :={(u,v)∈Z2;vodd,ueven}, Ω:={(u,v)∈Ωe, gcd(u,v)=1}.
Wethenendowthesesetswithasize. ItisconvenientheretodealwiththeEuclideannorm||.||,sothat
thesquareofthenormoftheinput(u,v)is(u2+v2). Wethenchooseasthesizeoftheinputthequantity
L(u,v)definedfromthebinarylength‘,[‘(x):=blog xc+1],
2
1
L(u,v):= ‘(u2+v2). (11)
2
Finally,thesets
n o
ΩN :={(u,v)∈Ω; L(u,v)=N}, ΩeN := (u,v)∈Ωe; L(u,v)=N (12)
gathervalidinputsofsizeN andareendowedwithuniformprobabilitiesdenotedbyPN,PeN. Wewishto
analyzetheprobabilisticbehaviorofthemainobservables(asdigitsorcontinuants)onthesetΩ ,when
N
thesizeN oftheinputbecomeslarge. Wethen(easily)returntoΩeN.
The complexity analysis of each algorithm first aims to quantify the number of iterations that are per-
formed during the execution (3). More generally, we wish to study general additive parameters which
onlydependonthesequenceofthedigitsq . WeconsideracostcdefinedonthesetQ,andweattachto
i
theexecution(3)oftheLSBalgorithmontheinput(u,v)thetotalcostC(u,v)definedby
p
X
C(u,v):= c(q ). (13)
i
i=1
Here,weconsideralargeclassofdigit-costscforwhichtheaverage
X 1
µ[c]:= ·c(q) (14)
|q|2
q∈Q 2
is finite. This class contains some particular parameters whichare are of great algorithmic interest. For
instance, if c = 1, then C = P is the number of iterations. If c is the characteristic function of some
particularquotientq ,thenC isthenumberofoccurrencesofthisparticularquotientduringtheexecution
0
of the algorithm. If c is the digit–size ‘, then C is the length of the binary encoding of the continued
fraction. If c(q) := k, then C = K is the total number of binary shifts performed by the algorithm.
If c(q) := s(a) isthe number of ones in the binary representation of a, then S is the total number of
subtractionsperformedbythealgorithm. Ifc(u,q):=‘(u)·[k(q)+s(a)]then
p
X
B(u,v)= ‘(u )[k(q )+s(a )]
i i i
i=1
isthecomplexityinbitsofoneexecutionofthealgorithm.
TheLyapunovtortoiseandthedyadichare 77
2.4 The first result.
As is usual in probabilistic analysis of algorithms, generating functions are the basic tools in our study.
WheninterestedinatotalcostC,wedealwiththebivariategeneratingfunctionS (s,w),
C
X exp[wC(u,v)]
S (s,w):= ,
C (u2+v2)s
(u,v)∈Ω
andwelookforanalternativeexpressionforit[seeProposition1]. Then,theDirichletseriesT (s)and
C
T (s),
1
T (s):= X C(u,v) = X tn, T (s)= X 1 = X |Ωn|
C (u2+v2)s ns 1 (u2+v2)s ns
(u,v)∈Ω n≥1 (u,v)∈Ω n≥1
satisfy
∂
T (s)= S (s,w)] , T (s)=S (s,0),
C ∂w C w=0 1 C
andtheyinheritthealternativeexpressionobtainedforS (s,w). Ontheotherhand,t isthecumulated
C n
costC onthesetofpairs(u,v)forwhich(u2+v2)equalsn. Then,theexpectationofcostC onΩ can
N
beexpressedwiththepartialsumsofthecoefficientsofthetwoseries
P22N t
E [C]:= n=22N−1 n .
N P22N |Ω |
n=22N−1 n
Finally,TauberianTheoremswillbeusedfor“extracting”coefficientsfromaDirichletseries[seeTheorem
A].
RemarkthattheseriesSeC(s,w)[theanalogueofS(s,w)onΩe]iscloselyrelatedtoSC(s,w). Thisisdue
tothefactthat,for(u,v)∈Ω,thetwocostsC(du,dv)andC(u,v)areequal. Then,
X 1
Se(s,w)=Z(s)·S(s,w), where Z(s):=
(u2+v2)s
(u,v)∈Ωe
isaZetafunctioncloselyrelatedtotheZetafunctiononZ[i].
ConsiderthesetN :={N ; q ∈Q},whereeachmatrixN ischosenwithprobability|q|−2. Thisis
[q] [q] 2
asetofrandommatrices,andwecandefinethebinaryLyapunovexponentofthissetN,
1
γ := lim E[log ||N ·N ·...N ||].
0 nn→∞ 2 1 2 n
Thisquantitywillbeprovedtoexistandtobestrictlypositive. Extensivecomputations[11]haveshown
thatγ issmall,andcloseto0.0497. Thisquantitywillplayacentralroˆleinthewholepaper.
0
OurfirsttheoremprovidestheasymptoticbehaviouroftheexpectationofageneraladditivecostConsets
ΩN,ΩeN,andwefocusonparticularparametersofalgorithmicinterest,namelythenumberP ofiterations,
thetotalnumberKofbinaryshifts,thenumberSofsubtractions.Weobtainalsotheasymptoticbehoviour
ofthecompexityinbitsB.
Theorem1. ConsideranadditivecostC associatedtoadigit–costc. OnthesetsΩN,ΩeN,endowedwith
theuniformprobability,theaveragevalueofC isasymptoticallylinearwithrespecttotheinputsizeN,
1
EN[C]∼EeN[C]∼ 2−γ ·µ[C]·N,
0
Hereγ isthebinaryLyapunovexponentofsetN andµ[C]is[bydefinition]equaltotheaverageµ[c]of
0
digit–costc
X 1
µ[C]:=µ[c]:= ·c(q).
|q|2
q∈Q 2
78 BenoˆıtDaireaux andVe´roniqueMaume-Deschamps andBrigitteValle´e
ForcostsP (numberofiterations),K(numbertotalofshifts),S (numberofsubtractions),C (numberof
a
occurrencesofquotientswithnumeratorequaltoa),theconstantsare
5 4
µ[P]=1, µ[K]=2, µ[S]= , µ[C ]= ·4−‘(a).
2 a 3
OnthesetsΩN,ΩeN,endowedwiththeuniformprobability,theaveragevalueofthebit–complexityB is
asymptoticallylinearwithrespecttotheinputsizeN,
1 N2
EN[B]∼EeN[B]∼ 2−γ ·µ[K+S]· 2 .
0
Remark. This theorem perfectly fits the following heuristic model. An execution of the algorithm is a
racebetweentheLyapounovTortoiseandtheDyadicHare.Atanystepofthealgorithm,thehareisonthe
rightofthenumber,whilethetortoiseisontheleft. Atthebeginning,thetortoiseisthusN bitsaheadthe
hare. Theaveragespeedofthetortoiseisγ bitsbystep,andtheharerunsmuchfastersinceitsaverage
0
speedis2bitsbystep. Theharethuswins2−γ bitsbysteptothetortoiseandfinallycatcheswithit
0
afterN/(2−γ )steps.
0
2.5 Extension of the LSB algorithm.
OursecondresultprovidesananalysisofthecontinuousextensionoftheLSBalgorithm. SincetheLSB
algorithm is based on the 2-adic norm, this extension is quite naturally a 2-adic extension, and we then
workinthefieldQ of2-adicnumbers. WerefertoGouvea[13]andKoblitz[17]foragoodintroduction
2
onp-adicnumbers. ThesetQ isthecompletionofQwithrespecttothe2-adicabsolutevalue. Itisan
2
ultrametriclocallycompactspaceandthesetQisdenseinQ . TheHenselexpansionprovidesanatural
2
representationof2-adicnumbers: Eachy ∈Q hasauniqueexpansionoftheform
2
X
y = a 2n, witha ∈{0,1}andn ∈Z. (15)
n n 0
n≥n0
Thisexpansionisinasensedualtothebinaryexpansionofarealx. However,intheHenselexpansion,
theexponentsnbelongtoasetoftheform{n ∈ Z;n ≥ n }andmaytendto+∞whileinthebinary
0
expansion,theexponentsbelongtoasetoftheform{n∈Z;n≤n }andmaytendto−∞.
0
FromtheHenselexpansion,itiseasytodefinethe2-adic(non–centered)integerpartbxc andthe(non–
2
centered)fractionalpart{x} ofa2-adicnumberx
2
0
X X
bxc = α 2n, and{x} := α 2n.
2 n 2 n
n=ν(x) n≥1
Then, bxc isarationaloftheforma/2k, withaoddand1 ≤ a < 2k+1 sothatbxc belongsto]0,2[.
2 2
The quantity {x} defines a 2–adic number which belongs to the open unit ball B of Q , (it is also the
2 2
closedballofradius1/2),
(cid:26) (cid:27)
1
B :={x∈Q , |x| <1}= x∈Q , |x| ≤ . (16)
2 2 2 2 2
Wecan“center”therationalbxc inordertogetarationaldxc whichbelongto]−1,+1[:
2 2
If bxc >1,thendxc :=bxc −2, {{x}} :={x} +2,
2 2 2 2 2
elsedxc :=bxc , {{x}} :={x} .
2 2 2 2
Then,each2-adicnumberxadmitsauniquedecompositionoftheform
x=dxc +{{x}} , with dxc ∈Q,|dxc |<1,{{x}} ∈B.
2 2 2 2 2
Remark that, when the integer pair (u,v) belongs to Ωe, the rational u/v belongs to B, and the previous
decomposition,appliedtotherationalv/uiscloselyrelatedtotheLSBdivisionontheintegerpair(u,v)
oftheformv =uq+rgivenin(3):
lvk nnvoo r r0
=q, = = .
u 2 u 2 u u0
TheLyapunovtortoiseandthedyadichare 79
Then,themappingT :B →Bdefinedas
(cid:24) (cid:23) (cid:26)(cid:26) (cid:27)(cid:27)
1 1 1
T(x):= − = ifx6=0, T(0)=0, (17)
x x x
2 2
extendsonestepoftheLSBalgorithm: onarationalu/vofB,itproducestherationalr/u=r0/u0.
ThismappingisforinstancedescribedbyBrowkinin[6,5].Withthismapping,wecandefinethe(infinite)
trajectory(y,T(y),T2(y),...,Ti(y),...)ofanyy ∈B,andalsoits2-adiccontinuedfractionexpansion,
oftheform
1
y = , (18)
1
q +
1 1
q +
2
... 1
q +...
n
whereeachdigitq =q (y)=(cid:4)Ti−1(y)(cid:7)belongstothesetQ.
i i
Oursecondmainresultdealswiththeprobabilisticanalysisofthiscontinuousprocess. Wedealwiththe
Haar measure η defined on the ball B, and we are interested in the behaviour of truncated trajectories
(y,T(y),...Tn(y)) at a fixed depth n, for a randomly chosen y. We wish to describe the evolution of
parametersofthese(truncated)trajectories,whenthetruncationdepthbecomeslarge. Therearetwomain
typesofparameters.
First, we consider, as previously, a digit–cost c, and attach the total cost on the truncated trajectory
(y,T(y),...Tn(y))definedas
n
X
C(n)(y):= c(q (y)).
i
i=1
Such costs have already been analysed by Daireaux in [7] for digit–costs of moderate growth, and they
areprovedtofollowanasymptoticgaussianlaw. Inthemoregeneralcasewhenµ[c](definedin(14))is
finite,theErgodicTheoremshowsthat
E[C(n)]∼µ[c]·n.
Remark. OurTheorem1alsoprovesthatrationaltrajectoriesbehave(onaverage)asgenerictrajectories.
2.6 The second result
Here,weareinterestedinasecondtypeofparameters,theso–calledcontinuants,whicharemoredifficult
toanalyse. Considera2-adicnumbery ∈ B anditsCFEexpansion,givenin(18),truncatedatdepthn.
ThisdefinesavectorQ (y):=(p (y),r (y)),viatherelation
n n n
(cid:18) (cid:19) (cid:18) (cid:19)
p (y) 0
n =M ·M ·...·M , (19)
rn(y) [q1] [q2] [qn] 1
andtherationalp (y)/r (y)=h ◦h ◦...◦h (0)approximatesthe2-adicnumbery[withrespect
n n [q1] [q2] [qn]
tothe2−adicnorm].Wewishtostudytherandomvariablelog||Q (y)||whentheballBisendowedwith
n
theHaarmeasureη. Thisquantityisequaltothesizeofthen–thapproximantofy. Weshalldealwith
theLe´vyMomentGeneratingFunction,E[exp(wlog||Q ||)],whichisdefinedby
n
Z
E[exp(wlog||Q ||)]= exp[wlog||Q (y)||]dη(y). (20)
n n
B
whereηistheHaarmeasuredefinedontheballB.
Oursecondmainresultprovesthattherandomvariablelog||Q ||followsanasymptoticgaussianlaw.
n
Theorem2. ConsideranyxintheopenunitballB ofQ anddenotebyQ (x) := (p (x),r (x))the
2 n n n
vector of Z2 whose components form the n-th convergent p /r of the dyadic x. Denote by ||.|| the
n n
Euclidean norm. When B is endowed with the uniform density with respect to the Haar measure η, the
randomvariablelog||Q ||asymptoticallyfollowsaGaussianLaw,withanoptimalspeedofconvergence
√ n
inO(1/ n). Moreover,themeanandthevariancesatisfy
E[log ||Q ||]=(2+γ )·n+a+O(τ−n), V[log ||Q ||]=b·n+c+O(τ−n)
2 n 0 2 n
80 BenoˆıtDaireaux andVe´roniqueMaume-Deschamps andBrigitteValle´e
Here, γ is the binary Lyapunov exponent of set of matrices N, where each matrix N is chosen with
0 [q]
probability|q|−2,anda,b,c,τ areconstants,withb>0,τ <1.
2
Remark. IfwewishtodealwiththesizeLdefinedin(11),weobtain
E[L(Q )]=(2+γ )·n+O(1).
n 0
Onceagain, thisresultcanbeexplainedbyourheuristicAesop’smodel. Here, thetortoiseandthehare
nolongerraceoneagainsteachother, butworktogetherandaddtheirrespectivespeeds. Thenthetotal
speedis2+γ bitsperstep,and,afternsteps,theyhaveperformeda(2+γ )·nlongrun.
0 0
2.7 Comparison of the two results.
Comparing our two Theorems leads to a rather surprising phenomenon. If a rational number of size
N behaves as a generic dyadic number, the size of its n–th convergent would be equal to (2+γ )·n
0
[from Theorem 2]. On the other side, [from Theorem 1], the LSB algorithm terminates after P(N) :=
N/(2−γ )steps,thelengthoftheP(N)–thconvergentshouldbeequalto
0
2+γ
N · 0,
2−γ
0
whereas it must be equal to N. In all the previously known cases (see [22]), the constant involved in
Theorem1istheinverseoftheconstantofTheorem2. Here,thedifferencesuggests(andshows)thatthe
continuants of a rational number do not behave in the same way as the continuants of a generic dyadic
number. Wehaveneverseenthissituationbefore,and,atthemoment,wedonothaveagoodexplanation
ofthisphenomenon.
3 Dynamical systems relative to the LSB algorithm
We first present the dynamical system underlying the 2-adic CFE, and explain why it is necessary to
perform a further extension which both considers real trajectories in addition to 2-adic ones. We then
introduce our main tool, the transfer operator, which we use as a generating operator. Finally, we state
Theorem3, whichdescribesthemainanalyticalpropertiesofourtransferoperators, andexplainhowto
“transfer”analyticalpropertiesfromtheoperatortoourproblem.
3.1 The LSB Dynamical System.
Werecallthatadynamicalsystemisapair(X,S)formedbyacompactsetX andamappingS :X →X
forwhichthereexistasuitablecountablepartitionofX suchthattherestrictionofS toeachelementof
the partition is C2 and invertible. Here, the pair (B,T) (defined in (16, 17) defines a dynamical system
whichextendstheLSBAlgorithm.Wenowdescribeitsmaincharacteristics,andlistsomeofitsimportant
properties.
Letq ∈ Qbeanalloweddigitdefinedin(5). WedenotebyB theopenballofcenter1/q andofradius
q
|1/q|2:
2
( (cid:12)(cid:12) 1(cid:12)(cid:12) (cid:12)(cid:12)1(cid:12)(cid:12)2) ( (cid:12)(cid:12) 1(cid:12)(cid:12) 1(cid:12)(cid:12)1(cid:12)(cid:12)2)
Bq := x∈B, (cid:12)(cid:12)x− q(cid:12)(cid:12) <(cid:12)(cid:12)q(cid:12)(cid:12) = x∈B, (cid:12)(cid:12)x− q(cid:12)(cid:12) ≤ 2(cid:12)(cid:12)q(cid:12)(cid:12) .
2 2 2 2
WhenqvariesinQ,theballsB aredisjointandformapartitionofB\{0}:
q
[
B =B\{0},andB ∩B =∅forq0 6=q.
q q q0
q∈M
Forallq ∈Q,therestrictionT :B →BofT totheballB isoftheform
[q] q q
1
T (x)= −q,
[q] x
and defines a surjective mapping : T (B )=B. Its inverse branch is the LFT h : B 7→ B already
(q] q [q] q
definedin(9)
1 2k a
h (x)= = ifq = .
[q] q+x 2kx+a 2k
Description:catches up with the tortoise [unlike in Aesop's fable [1] number x, and in particular provides after n steps a rational approximation Qn of x, its n-th.