arXiv · cs/0104010
Type Arithmetics: Computation based on the theory of types
Abstract
The present paper shows meta-programming turn programming, which is rich enough to express arbitrary arithmetic computations. We demonstrate a type system that implements Peano arithmetics, slightly generalized to negative numbers. Certain types in this system denote numerals. Arithmetic operations on such types-numerals - addition, subtraction, and even division - are expressed as type reduction rules executed by a compiler. A remarkable trait is that division by zero becomes a type error - and reported as such by a compiler.
Explore related subjects
Keep this discovery
Explore connections, maps & timelines
Oleg Kiselyov. 2001-04-03. Type Arithmetics: Computation based on the theory of types. https://arxiv.science/abs/cs/0104010
Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite arXiv Science by Indiciae: BibTeX · RIS.