Integral function as trial function

Hi,
In case I have a 2D trialfunction u = (u1, u2), and I know that because of the divergence-free condition I have u2 (x,y) = - \int_0^y \partial_1 u1 (x,s) d s,
is it possible to turn u2 from TrialFunction to Function, define it in Fenics as the integral function of u1, and still use it as a part of the form F? I mean in this sense:

F = inner(u, grad(u1)) * v1 * dx + inner(grad(u1),grad(v1)) * dx.

where v1 is 1-dimensional, u1 is 1-dimensional, but its integral function u2 is also a part of F (as u is a vector of u1 and u2). Are there tutorials or guidelines or possibilities for this?
Thank you so much.