What does it mean for a function to be "a nested function g[p], within the outer function f[p,t]".
In my experience, when people ask questions like this, they are mixing two very different things:
- How we describe math to each other
- How programming languages evaluate code
These are different and you not only have to understand both, but be able to translate between them.
In the code you posted, you have tried to attach a set of assumptions to a function definition. You cannot do this.
Do you want a function that returns a function? Do you want a function that takes a function like "g" as an argument?