TITLE: The "functions" of untyped lambda calculus are not (set theoretic) functions so what are they?
QUESTION [18 upvotes]: You can't model $\lambda$ functions as set functions because the domain of a $\lambda$ function includes that function itself.  This violates foundation.    
However they clearly are some sort of arrow.  Are the arrows of $\lambda$ calculus there own thing or can they be represented in some other way?

REPLY [3 votes]: What you are missing is that $f(f)$ is not the same as $f(code(f))$. A function $f$ may be coded as another object $code(f)$, which may be in the domain of $f$. In computation theory, λ-functions are coded as strings of a certain form, which can be thought of as programs of some sort. Applying one program $p$ to another program $q$ requires a machine/interpreter to perform the application, such as a universal Turing machine $U$, such that $U(p,x)$ is the output of executing the program $p$ on input $x$. $U$ itself is not a program, but corresponds to one, namely $code(U)$. Multiple inputs can be coded, for example we can have a function $pair$ such that a program given $pair(x,y)$ can obtain $x$ and $y$. Indeed, we could design $code(U)$ such that $U(code(U),pair(p,x)) = U(p,x)$. Similarly, we have $f(code(f)) = U(code(f),code(f))$.