Typechecking in ATS involves generating and solving constraints. As an example, the code below implements the well-known factorial function:

In this implementation, the function fact is assigned the following type: which means that fact returns a natural number r when applied to a natural number n. When the code is typechecked, the following constraints need to be solved:For each natural number n, n > 0 implies n - 1 >= 0

For each natural number n and each natural number r

_{1}, n > 0 implies n * r_{1}>= 0For each natural number n, 1 >= 0 holds.

By default, the constraint-solver implemented for ATS/Postiats makes use of the standard arithmetic of infinite precision. For the sake of efficiency, one may also choose to use machine-level arithmetic for solving integer constraints. Due to potential arithmetic overflow, results returned by the constraint-solver that uses machine-level arithmetic can be incorrect (but I have so far not knowingly encountered such a situation in practice).