Variational form of mixed finite element

The mixed variational problem is as follows. There are two known quantities. I did the following variational, but they all reported errors. Why?

Utt + △U+L(p)=0;
p=L(U);

((U_n+1 - 2*U_n + U_n-1)/dt^2 , v)+ (▽(U_n+1 + U_n-1)/2, ▽v)+ (L(p_n), v)=0;
(p_n, u)= (L((U_n+1 + U_n-1)/2, u)=0;

the command

fespace Vh(Th, [P2, P1]);
varf RKG([Un+1,p1],[u,v])=…
varf RHS([Un,Un-1],[u,v])=…
matrix A = RKG(Xh, Xh, solver=UMFPACK);
matrix B = RHS(Xh, Xh);
complex[int] sol(Xh.ndof), aux(Xh.ndof);
Xh [w0, w1] = [Un, Un-1]; // An error is reported in this line at runtime
sol = w0;
for(real t=0+dt2;t<=Tf;t+=dt)
{
aux = B
sol;
sol = A^-1 * aux;
},