Many other representations of numbers are possible, including binary and
balanced base three. Type-level computation may also include type
representations of boolean values, lists, trees and so on. It is closely
connected to theorem proving, via
the Curry-Howard isomorphism.

Contents

1 Library support

Robert Dockins has gone as far as to write
a library
for type level arithmetic, supporting the following operations on type
level naturals: addition, subtraction, multiplication, division,
remainder, GCD, and also contains the following predicates: test for
zero, test for equality and < > <= >=

This library uses a binary representation and can handle numbers at
the order of 10^15 (at least). It also contains a test suite to help
validate the somewhat unintuitive algorithms.

2 More type hackery

Not to be outdone, Oleg Kiselyov has
written
on invertible, terminating, 3-place addition, multiplication,
exponentiation relations on type-level Peano numerals, where any two
operands determine the third. He also shows the invertible factorial
relation. Thus providing all common arithmetic operations on Peano
numerals, including n-base discrete logarithm, n-th root, and the
inverse of factorial. The inverting method can work with any
representation of (type-level) numerals, binary or decimal.

Oleg says, "The implementation of RSA on the type level is left for future work".