|
Re: Bug in the proof of Data.FiniteMap and DData.Map: msg#00050lang.haskell.glasgow.bugs
On Fri, 19 Mar 2004 09:00:22 +0100, Robert Will <robertw@xxxxxxxxxxxxxxxxxx> wrote: both of the data structures are based on Adams' balancing algorithm I have been redoing proofs of Adam's algorithms too some years ago when writing DData -- there were some errors but I think that calling it "bugged" is rather harsh :-) Anyway, I think you are referring to two separate cases (as far as I can remember though): 1) Given a constant "delta" (the maximal relative size differences between any two nodes in the tree) and the "ratio" (the ratio between the outer and inner sibling of the heavier subtree in a node that needs rebalancing). "delta" is "w" in Adam's paper, and "ratio" the inverse of alpha. Now, we can prove that delta must be larger than 4.65 with a ratio of 2, and we can prove that we need at least a ratio of 2 to maintain the balance invariants. In his paper though Adams uses an incorrect ratio of 1. However, both Data.FiniteMap and DData.Map use the correct ratio. 2) For "join", and "merge", the proof brakes down too, but I remember that it suffices to replace Adam's "<" comparisons with "<=" comparisons. This is why the balancing assertion checks in "Data.FiniteMap" are turned off (as they fail), but this relatively easy to fix. (DData.Map uses the correct comparison and works with assertion checking on). Unfortunately, I couldn't find my notes on this issue anymore, but I think that when you re-run the proofs with "<=", it will work out correctly. In general, I would like to stress that one tends to overrate the usefullness of balancing -- Balancing is automatic for random data and balancing is only needed to avoid some pathological worst-cases. Almost any choice of balancing scheme will do. This is why the Data.FiniteMap structure has proven its use in practice even when sometimes producing slightly unbalanced trees. All the best, Daan.
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: PATCH: add malloc function attribute to rts malloc functions, Simon Marlow |
|---|---|
| Next by Date: | Bug report., MR K P SCHUPKE |
| Previous by Thread: | Bug in the proof of Data.FiniteMap and DData.Map, Robert Will |
| Next by Thread: | Re: Bug in the proof of Data.FiniteMap and DData.Map, Robert Will |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |