# Substituting variable/function

I got a problem with substituting a solution into another equation. I could break down my problem to a simple example:

```
r = var('r');
p = function('p')(r);
v = var('v');
v = p + p.derivative(r);
p1(r)=desolve(p.derivative(r)==0,p,ivar=r); p1(r)
v.subs(p(r)==p1)
```

Output:

```
_C
_C + diff(p(r), r)
```

What's happening here? Why is p substituted, but not diff(p,r)=0? What's the correct way to do this substitution?