Ranking and Unranking of Hereditarily Finite Functions and Permutations
نویسنده
چکیده
Prolog’s ability to return multiple answers on backtracking provides an elegant mechanism to derive reversible encodings of combinatorial objects as Natural Numbers i.e. ranking and unranking functions. Starting from a generalization of Ackerman’s encoding of Hereditarily Finite Sets with Urelements and a novel tupling/untupling operation, we derive encodings for Finite Functions and use them as building blocks for an executable theory of Hereditarily Finite Functions. The more difficult problem of ranking and unranking Hereditarily Finite Permutations is then tackled using Lehmer codes and factoradics. The paper is organized as a self-contained literate Prolog program available at http://logic.csci.unt.edu/tarau/research/2008/pHFF.zip.
منابع مشابه
Ranking Catamorphisms and Unranking Anamorphisms on Hereditarily Finite Datatypes
Using specializations of unfold and fold on a generic tree data type we derive unranking and ranking functions providing natural number encodings for various Hereditarily Finite datatypes. In this context, we interpret unranking operations as instances of a generic anamorphism and ranking operations as instances of the corresponding catamorphism. Starting with Ackerman’s Encoding from Hereditar...
متن کاملA Functional Hitchhiker's Guide to Hereditarily Finite Sets, Ackermann Encodings and Pairing Functions
The paper is organized as a self-contained literate Haskell program that implements elements of an executable finite set theory with focus on combinatorial generation and arithmetic encodings. The code, tested under GHC 6.6.1, is available at http://logic.csci.unt.edu/tarau/ research/2008/fSET.zip. We introduce ranking and unranking functions generalizing Ackermann’s encoding to the universe of...
متن کاملDeclarative Combinatorics: Isomorphisms, Hylomorphisms and Hereditarily Finite Data Types in Haskell
This paper is an exploration in a functional programming framework of isomorphisms between elementary data types (natural numbers, sets, finite functions, permutations binary decision diagrams, graphs, hypergraphs, parenthesis languages, dyadic rationals, DNA sequences etc.) and their extension to hereditarily finite universes through hylomorphisms derived from ranking/unranking and pairing/unp...
متن کامل"Everything Is Everything" Revisited: Shapeshifting Data Types with Isomorphisms and Hylomorphisms
This paper is an exploration of isomorphisms between elementary data types (e.g., natural numbers, sets, finite functions, graphs, hypergraphs) 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-toany encodings automatically. A few examples of free a...
متن کاملRanking and unranking permutations in linear time
A ranking function for the permutations on n symbols assigns a unique integer in the range [0, n! − 1] to each of the n! permutations. The corresponding unranking function is the inverse: given an integer between 0 and n! − 1, the value of the function is the permutation having this rank. We present simple ranking and unranking algorithms for permutations that can be computed using O(n) arithme...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- CoRR
دوره abs/0808.0554 شماره
صفحات -
تاریخ انتشار 2008