Case 2. In the expression ‘(3)^2 ’, ‘3’ denotes not 3 but rather 9, the role of the functor ‘( )^2’ is two-fold. It both denotes a function and induces a linguistic context in which the embedded term denotes something other than what it would otherwise denote: namely the square of the denotation of that term. Hence, ‘( )^2’ denotes the identity function, id, and induces a "squared context" such that ‘3’ denotes the square of its customary denotation, which id takes as argument.
* This is adapted from Humberstone, Lloyd (2008), “Can every modifier be treated as a sentence modifier?”, Philosophical Perspectives 22. I have changed it a bit to make the analogy tighter.