Split derivative into lhs and rhs

Hi all,

I am trying to solve the following problem \min F(y) =\min \frac{1}{2}\int_\Omega(y-u)^2dx+\int_\Omega f(y-u)dx = \min f_1 (y) + f_2(y), where u and f are given functions. Therefore I need to solve F'(y)=0, where F' is linear. I would like to compute the derivative using an ufl file. So I tried the following:

element = FiniteElement("Lagrange", triangle, 1)
v = TestFunction(element)
u = Coefficient(element)
y = Coefficient(element)
f = Coefficient(element)

g = 0.5*inner(y-u,y-u)*dx+inner(f,y-u)*dx
F = derivative(g,y,v)

Since F is linear ( i.e. not non-linear), I cannot use

solve(F== 0, *y, bcs)

How do I tell the solver, that this problem is linear? I’ve already tried a=lhs(F), L = rhs(F) but this didn’t work. I am aware that I can compute the derivative myself, but I need this also for other quadratic functionals.