Feb 12, 2007
Discussion of data-structures for tree algorithms
Angela tried to implement the Braun tree algorithms of
Chris Okasaki
- we want to use fold to write insertion (from list to braun tree) [n (log n)] as well as Chris' own order n algorithm
- also fold on braun tree
- Joseph asked if we would not need to compute sizes if we were to use Coq since it would contain the sizes anyway; we talked about set-prop discinction in Coq.
- Walid mentioned Hoare type theory being developed by Greg Morissett Hoare type theory tries to combine type theory with logic for imperative programs.
- Cherif: Okasaki's diff function on trees is unnecessary because we have two different constructors which tell us which trees are different. We noted that this is a trade off space-for-time where the extra bit we store in space at each note buys us a log N factor in some algorithm. Cherif's size runs in (log n) time.
- Angela was able to implement Okasaki's original size functions
Problems with index size.
People have problems with (n+n) vs. (n*2).
- Walid had explained the lemma + cast technique last time. It would be god to compare the DML one with Daniel's implementation of insert.
- Note: Somebody send an e-mail to Hongwei (Joseph voluneered) about insert for braun trees.
- We were looking at Dan's implementation of insert. The insertion is so short because it turns that (S (S (m*2))) is equal to ((S m)*2). This is an interesting, serendipitous interaction of normalization and
definitions of (+) and (*) in Coq.
- What we did is we talked about normalization and how it works including a Q&A.
- One idea is to compare with Cris Okasaki datastructure paper.
Next : implement lemmas in Coq and cast.
WALID: "The facility of having lemmas and being able to do casts when
we need, but it will alwasy be better if we know how to write our
problem without needing any additional lemmas. It is better to design
your programs to work with only standard definitions." The key is to
understand definitions clearly.
Example?