  In this paper we give an ordinal analysis of the theory of second order
arithmetic. We do this by working with proof trees -- that is, "deductions"
which may not be well-founded. Working in a suitable theory, we are able to
represent functions on proof trees as yet further proof trees satisfying a
suitable analog of well-foundedness. Iterating this process allows us to
represent higher order functions as well: since functions on proof trees are
just proof trees themselves, these functions can easily be extended to act on
proof trees which are themselves understood as functions. The corresponding
system of ordinals parallels this, using higher order collapsing function.
