| Okasaki, C. From Fast Exponentiation to Square Matrices: An Adventure in Types. In Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming (September 1999). |
....(p:1 (p:0 (tail b) 2.3 Beyond Rank 2 To the knowledge of the authors, inductive datatypes having type transformers as arguments are rarely considered. An example would be A: 1 1 1 1 F G:F (FA) F (G G) F G) G G) with F G : A:FA GA. It has been studied in [Oka99] for the ecient representation of square matrices. Squareness is ensured by types but without the use of dependent types, by which one would just express that there is an n such that the matrix has n rows and n columns. The argument to 1 1 clearly has a monotonicity witness. As a toy ....
Chris Okasaki. From fast exponentiation to square matrices: An adventure in types. In Proceedings of the fourth ACM SIGPLAN International Conference on Functional Programming (ICFP '99), Paris, France, September 27-29, 1999, volume 34 of SIGPLAN Notices, pages 28-35. ACM, 1999.
....both before and after recursion. This is our invariant. We therefore make our type of AVL trees be AVL below, thereby ensuring that k = 0 when AVL # is first used. type AVL a = AVL # a ( a Our final example is Ross Paterson s datatype of square matrices [Pat98] a variant of which is given in [Oka99]. The datatype we develop is higher order, that is, it is parameterised by a type constructor. The invariant we shall now use is that the type constructor parameter f is equal to Cons Nil , for some k , where Cons and Nil are defined by Then f a is a list, with length k , of a s and f (f a) ....
Chris Okasaki. From fast exponentiation to square matrices: An adventure in types. In International Conference on Functional Programming, pages 28--35, 1999.
....type and produces a list of the same type. One might wonder whether there are interesting examples. It is by now well known that de Bruijn notation indeed may be represented as a nested datatype [3, 2] However, the question arose whether there are also examples taken from the outside world . In [12], a nested datatype is shown which represents arbitrary square matrices over some type with elements accessible in logarithmic time. It uses type constructors of rank 2. On the theoretical side, 1] studies even coinductive type constructors of rank 2 with considerable nesting. The present paper ....
....should be studied carefully. Can their behaviour be simulated in MICC 2 This is easy to see in the situation of [3] but not for the general approach to generalized folds [4] Can one nd data structures which need deeper nested inductive constructors than the example of square matrices in [12] Is there a chance to get a similar clean view on constructors of higher rank than 2 ....
Chris Okasaki. From fast exponentiation to square matrices: An adventure in types. In Proceedings of the fourth ACM SIGPLAN International Conference on Functional Programming (ICFP '99), Paris, France, September 27-29,
....classes and functional dependencies. GHC [ghc00] and Hugs [Jon00a] support these extensions to varying degree, though. It appears that the limits of what can be done within Haskell like type systems are yet to be found. Two recent examples of other tricks that seem to stretch the limits are [Oka99] and [Wei00] ....
Chris Okasaki. From Fast Exponentiation to Square Matrices: An Adventure in Types. In International Conference on Functional Programming, pages 28-35, Paris, France, September 1999.
....f a = MkCons a (f a) data Nil a = MkNil data SM f a = Zero (f (f a) j Succ (SM (Cons f) a) type SqMat a = SM Nil a but we know of no representation of square matrices as a rst order nested datatype. There are many more examples of second order nested datatypes that can be de ned in Haskell [3, 4, 8], but so far no one has given a semantics of these datatypes. The de nition of square matrices above could be given a meaning if we could de ne a hofunctor SM : Coc(Set) Coc(Set) using the following recursive de nition for each cocontinuous functor F : SM (F ) F F SM (Id F ) and a ....
C. Okasaki. From fast exponentiation to square matrices: An adventure in types. In Proceedings of the International Conference on Functional Programming, September 1999, pages 28-35.
....in (Augustsson and Carlsson 1999) There have been many recent studies on the use of nested datatypes (Bird and Meertens 1998) in constructing (sophisticated) datatypes to capture more invariants in data structures. For instance, a variety of examples can be found in (Bird and Paterson pear; Okasaki 1999; Hinze 1998; Hinze 1999b; Hinze 1999a) We feel that the advantage of this approach is that it requires relatively minor language extensions, which may include polymorphic recursion, higher order kinds, rank 2 polymorphism, to existing functional programming languages such as Haskell, while ....
Okasaki, C. (1999, September). From Fast Exponentiation to Square Matrices: An Adventure in Types. In Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming.
....of arbitrary height such that the structural constraints are enforced The usual recursive representation of binary leaf trees is apparently not very helpful since there is no way to ensure that the children of a node have the same height. As another example, consider square n Theta n matrices [14]. How do we represent square matrices such that the matrices are actually square Again, the standard representation using lists of lists fails to meet the constraints: the outer list and the inner lists have not necessarily the same length. In this paper, we present a framework that allows to ....
.... Delta Delta Delta ] rect 0 (h n m) h n n) This representation requires more constructors than the first one (n 2 1 instead of n 1) On the positive side, it can be easily generalized to higher dimensions. 5 Related and future work This work is inspired by a recent paper of C. Okasaki [14], who derives representations of square matrices from exponentiation algorithms. He shows, in particular, that the tail recursive version of the fast exponentiation gives rise to an implementation based on rightist right perfect trees. Interestingly, the simpler implementation based on fork node ....
Chris Okasaki. From fast exponentiation to square matrices: An adventure in types. In Proceedings of the 1999 ACM SIGPLAN International Conference on Functional Programming, Paris, France, 1999. To appear.
....leaf trees of arbitrary height such that the structural constraints are enforced The usual recursive representation of leaf trees is apparently not very helpful since there is no way to ensure that the children of a node have the same height. As another example, consider square n Thetan matrices (Okasaki, 1999). How do we represent square matrices such that the matrices are actually square Again, the standard representation using lists of lists fails to meet the constraints: the outer list and the inner lists have not necessarily the same length. In this paper, we present a framework that allows to ....
.... Delta Delta ] rect 0 (h n m) h n n) This representation requires more constructors than the first one (n 2 1 instead of n 1) On the positive side, it can be easily generalized to higher dimensions. 5 Related and future work This work is inspired by a recent paper of C. Okasaki (Okasaki, 1999) who derives representations of square matrices from exponentiation algorithms. He shows, in particular, that the tail recursive version of the fast exponentiation gives rise to an implementation based on rightist right perfect trees. Interestingly, the simpler implementation based on fork node ....
Okasaki, Chris. (1999). From fast exponentiation to square matrices: An adventure in types. Submitted for publication.
....represent the so called generalized tries (Hinze, 1999a) for Fork and Sequ. Note that MapFork is the type level counterpart of the function twice f x = f (f x ) which applies a given function twice to a given value. More examples of nested types of higher order kinds can be found in (Hinze, 1998; Okasaki, 1999; Hinze, 1999c) Now, before going on the reader is invited to consider programming, say, comparison functions for the datatypes above. This is a non trivial task especially for the nested and for the second order kinded types. In the sequel we will show that defining a generic comparison function ....
Okasaki, Chris. (1999). From fast exponentiation to square matrices: An adventure in types. Proceedings of the 1999 ACM SIGPLAN international conference on functional programming, Paris, France. To appear.
....[9, 7] the notion of sized types [13] and the programming language Cayenne [1] There have been many recent studies on the use of nested datatypes [2] in constructing (sophisticated) datatypes to capture more invariants in data structures. For instance, a variety of examples can be found in [3, 18, 10, 12, 11]. We feel that the advantage of this approach is that it requires relatively minor language extensions, which may include polymorphic recursion, higher order kinds, rank 2 polymorphism, to existing functional programming languages such as Haskell, while type checking in DML is much more involved. ....
Chris Okasaki. From Fast Exponentiation to Square Matrices: An Adventure in Types. In Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming, September 1999.
No context found.
Okasaki, C. From Fast Exponentiation to Square Matrices: An Adventure in Types. In Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming (September 1999).
No context found.
Chris Okasaki. From fast exponentiation to square matrices: An adventure in types. ACM SIGPLAN Notices, 34(9):28--35, 1999. International Conference on Functional Programming.
No context found.
Okasaki, C. From Fast Exponentiation to Square Matrices: An Adventure in Types. In Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming (September 1999).
No context found.
Chris Okasaki. From fast exponentiation to square matrices: An adventure in types. In 4th ACM International Conference on Functional Programming, pages 28--35, 1999.
No context found.
Chris Okasaki. From Fast Exponentiation to Square Matrices: An Adventure in Types. In International Conference on Functional Programming, pages 28{ 35, September 1999.
No context found.
Chris Okasaki. From fast exponentiation to square matrices: An adventure in types. ACM SIGPLAN Notices, 34(9):28--35, 1999. International Conference on Functional Programming.
No context found.
Chris Okasaki. From fast exponentiation to square matrices: An adventure in types. In Proceedings of the fourth ACM SIGPLAN International Conference on Functional Programming (ICFP '99), Paris, France, September 27-29, 1999, volume 34 of SIGPLAN Notices, pages 28-35. ACM, 1999.
No context found.
Chris Okasaki. From fast exponentiation to square matrices: An adventure in types. In Proceedings of the fourth ACM SIGPLAN International Conference on Functional Programming (ICFP '99), Paris, France, September 27-29, 1999, volume 34 of SIGPLAN Notices, pages 28-35. ACM, 1999.
Online articles have much greater impact More about CiteSeer.IST Add search form to your site Submit documents Feedback
CiteSeer.IST - Copyright Penn State and NEC