# How to deal with infinite continued fractions in formal language?

A continued fraction is an expression obtained through an iterative process of representing a number as the sum of its integer part and the reciprocal of another number, then writing this other number as the sum of its integer part and another reciprocal, and so on.

Continued fractions can be infinite,

e.g. $$a_0+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+\ddots}}}$$

So it seems a term of first-order language. However, every term in first-order language has finite depth, compared with continued fractions, they have depth $\omega$, used individual and function symbols infinite times, hence are not a proper terms of first-order language.

So my question: Is there an extension of first-order language that can admit this kind of expression?

-
There is no infinite depth at all, just like there is no «sum of infinitely many terms» in a series: that's just notation. An «infinite continued fraction» is just a limit, and you can deal with this sort of limits in exactly the same way in which you deal with other limits. – Mariano Suárez-Alvarez Apr 5 '13 at 5:40
@MarianoSuárez-Alvarez I found it is hard to express limits in first-order language either... We need to express supremum and infimum of sets(possibly infinite), so does it require higher-order language? – Popopo Apr 5 '13 at 6:01

In this case, a continued fraction would be modeled formally as a sequence of naturals, which is again a function $\mathbb N\to \mathbb N$; a function $f$ is modeled as the set of ordered pairs $\langle x,f(x)\rangle$ for all $x$ in its domain, and the ordered pair $\langle x,y\rangle$ is represented by the set $\{\{x\},\{x,y\}\}$. So in the end everything can be reduced to sets.
I see, generally infinite continued fraction $[x_0;x_1,\dots]$ is a (partial) function in ${\mathbb R}^{{\mathbb R}^{\omega}}$, which maps some infinite sequences $\langle x_0,x_1,\dots\rangle$ of reals to a real number. – Popopo Apr 6 '13 at 8:06