📝 Original Info
- Title: Declarative Combinatorics: Isomorphisms, Hylomorphisms and Hereditarily Finite Data Types in Haskell
- ArXiv ID: 0808.2953
- Date: 2009-01-19
- Authors: ** Paul Tarau (Department of Computer Science and Engineering, University of North Texas) **
📝 Abstract
This paper is an exploration in a functional programming framework of {\em isomorphisms} between elementary data types (natural numbers, sets, multisets, finite functions, permutations binary decision diagrams, graphs, hypergraphs, parenthesis languages, dyadic rationals, primes, DNA sequences etc.) and their extension to hereditarily finite universes through {\em hylomorphisms} derived from {\em ranking/unranking} and {\em pairing/unpairing} operations. An embedded higher order {\em combinator language} provides any-to-any encodings automatically. Besides applications to experimental mathematics, a few examples of ``free algorithms'' obtained by transferring operations between data types are shown. Other applications range from stream iterators on combinatorial objects to self-delimiting codes, succinct data representations and generation of random instances. The paper covers 59 data types and, through the use of the embedded combinator language, provides 3540 distinct bijective transformations between them. The self-contained source code of the paper, as generated from a literate Haskell program, is available at \url{http://logic.csci.unt.edu/tarau/research/2008/fISO.zip}. {\bf Keywords}: Haskell data representations, data type isomorphisms, declarative combinatorics, computational mathematics, Ackermann encoding, G\"{o}del numberings, arithmetization, ranking/unranking, hereditarily finite sets, functions and permutations, encodings of binary decision diagrams, dyadic rationals, DNA encodings
💡 Deep Analysis
Deep Dive into Declarative Combinatorics: Isomorphisms, Hylomorphisms and Hereditarily Finite Data Types in Haskell.
This paper is an exploration in a functional programming framework of {\em isomorphisms} between elementary data types (natural numbers, sets, multisets, finite functions, permutations binary decision diagrams, graphs, hypergraphs, parenthesis languages, dyadic rationals, primes, DNA sequences etc.) and their extension to hereditarily finite universes through {\em hylomorphisms} derived from {\em ranking/unranking} and {\em pairing/unpairing} operations. An embedded higher order {\em combinator language} provides any-to-any encodings automatically. Besides applications to experimental mathematics, a few examples of ``free algorithms’’ obtained by transferring operations between data types are shown. Other applications range from stream iterators on combinatorial objects to self-delimiting codes, succinct data representations and generation of random instances. The paper covers 59 data types and, through the use of the embedded combinator language, provides 3540 distinct bijective
📄 Full Content
Isomorphic Data Encodings in Haskell and their
Generalization to Hylomorphisms on
Hereditarily Finite Data Types
Paul Tarau
Department of Computer Science and Engineering
University of North Texas
E-mail: tarau@cs.unt.edu
Abstract. This paper is an exploration in a functional programming
framework of isomorphisms between elementary data types (natural num-
bers, sets, multisets, finite functions, permutations binary decision di-
agrams, graphs, hypergraphs, parenthesis languages, dyadic rationals,
primes, DNA sequences etc.) and their extension to hereditarily finite
universes through hylomorphisms derived from ranking/unranking and
pairing/unpairing operations.
An embedded higher order combinator language provides any-to-any en-
codings automatically.
Besides applications to experimental mathematics, a few examples of
“free algorithms” obtained by transferring operations between data types
are shown. Other applications range from stream iterators on combina-
torial objects to self-delimiting codes, succinct data representations and
generation of random instances.
The paper covers 59 data types and, through the use of the embedded
combinator language, provides 3540 distinct bijective transformations
between them.
The self-contained source code of the paper, as generated from a literate
Haskell program, is available at http://logic.csci.unt.edu/tarau/
research/2008/fISO.zip.
A short, 5 page version of the paper, published as [1] describes the idea
of organizing various data transformations as encodings to sequences of
natural numbers and gives a few examples of hylomorphisms that lift the
encodings to related hereditarily finite universes.
Keywords: Haskell data representations, data type isomorphisms, declar-
ative combinatorics, computational mathematics, Ackermann encoding,
G¨odel numberings, arithmetization, ranking/unranking, hereditarily fi-
nite sets, functions and permutations, encodings of binary decision dia-
grams, dyadic rationals, DNA encodings
1
Introduction
Analogical/metaphorical thinking routinely shifts entities and operations from
a field to another hoping to uncover similarities in representation or use [2].
arXiv:0808.2953v4 [cs.PL] 19 Jan 2009
Compilers convert programs from human centered to machine centered rep-
resentations - sometime reversibly.
Complexity classes are defined through compilation with limited resources
(time or space) to similar problems [3, 4].
Mathematical theories often borrow proof patterns and reasoning techniques
across close and sometime not so close fields.
A relatively small number of universal data types are used as basic building
blocks in programming languages and their runtime interpreters, correspond-
ing to a few well tested mathematical abstractions like sets, functions, graphs,
groups, categories etc.
A less obvious leap is that if heterogeneous objects can be seen in some way
as isomorphic, then we can share them and compress the underlying informa-
tional universe by collapsing isomorphic encodings of data or programs whenever
possible.
Sharing heterogeneous data objects faces two problems:
– some form of equivalence needs to be proven between two objects A and
B before A can replace B in a data structure, a possibly tedious and error
prone task
– the fast growing diversity of data types makes harder and harder to recognize
sharing opportunities.
Besides, this rises the question: what guaranties do we have that sharing
across heterogeneous data types is useful and safe?
The techniques introduced in this paper provide a generic solution to these
problems, through isomorphic mappings between heterogeneous data types, such
that unified internal representations make equivalence checking and sharing pos-
sible. The added benefit of these “shapeshifting” data types is that the functors
transporting their data content will also transport their operations, resulting in
shortcuts that provide, for free, implementations of interesting algorithms. The
simplest instance is the case of isomorphisms – reversible mappings that also
transport operations. In their simplest form such isomorphisms show up as en-
codings to some simpler and easier to manipulate representation, for instance
natural numbers.
Such encodings can be traced back to G¨odel numberings [5, 6] associated to
formulae, but a wide diversity of common computer operations, ranging from
data compression and serialization to wireless data transmissions and crypto-
graphic codes qualify.
Encodings between data types provide a variety of services ranging from free
iterators and random objects to data compression and succinct representations.
Tasks like serialization and persistence are facilitated by simplification of reading
or writing operations without the need of special purpose parsers. Sensitivity
to internal data representation format or size limitations can be circumvented
without extra programming effort.
2
An Embedded Data Transformation Language
We will start by designing an embedded transformation la
…(Full text truncated)…
Reference
This content is AI-processed based on ArXiv data.