I will distinguish between mathematical functions and computational functions which I will think of for concreteness as $\lambda$-functions.
In every context I’ve encountered, the type signature of a lambda function depends only on its input-output relation. However, it seems to me that we can distinguish between two functions of the same input output types on the basis that they use a different set of types in their computation:
$f:\mathbb N\to \mathbb N \quad f=\lambda x:\mathbb N, (x+1)$
$g:\mathbb N\to \mathbb N \quad g=\lambda x:\mathbb N, (\text{toNat}\, (\text{toInt}\,x) + 1)$
Where $\text{toNat}:\mathbb Z \to \mathbb N, \text{toInt}:\mathbb N \to \mathbb Z$ do the obvious thing. (Note that $g$'s computations "depend on type $\mathbb Z$" but $f$'s do not).
In my own words, $f$ and $g$ have the same type signature but don’t have the same “type dependence” because $g$ depends on $\mathbb Z$.
Primary question: Is there a standard term for what I've called "type dependence"? Is there a standard theory of how to distinguish between $f$ and $g$ in terms of their “type dependence”?
Note: my question is not about "extentionality vs intentionality". See the comments.
—————
Secondary question:
I want to think about the difference between “type signature” and “type dependence” in categorical terms.
If we have morphisms (which we will think of as $\lambda$-functions) $f:A\to B$ and $g:B\to C$, then $g\circ f$ has type signature $g\circ f:A\to C$, but in a sense, the function $g\circ f$ has a type dependency on $B$.
Let’s say we have a $\lambda$-function $h:A\to C$, such that $h$ computes the same as $g\circ f$, which we will denote as an equivalence $h\equiv g\circ f$, but $h$ does not have a type dependence on $B$.
We want to be able to say: “the diagram containing $f,g,h$ commutes” while only referring to the equivalence in terms of "input-output equivalence" of $h$ and $g\circ f$, not their equivalence in terms of "type dependence".
Secondary question. Is there some kind of pre-existing theory within category theory about these things related to what I’ve been calling “type dependence”?