Part 1: general tails (C5, R4, E3, A4, B3 with indeterminate coefficients, over Q(delta))
  ok   (1) h_X = cubic part of L_X = (4*de)/35*X*Y^2
  ok   (1) h_Y = cubic part of L_Y = (A4)_X/4
   derivatives with conditions in degrees >= 4: [('y o Phi', 4), ('z o Phi', 4)]
  ok   (2) the nonzero conditions in degrees >= 4 are exactly the 26 non-U4 coefficients of (C5)_Z and of (C5)_Y - 2 delta A4
  ok   (2) all of them are homogeneous linear forms in the tail coefficients
  ok   (2) they involve only the coefficients of C5 and A4
  ok   (2) (C5)_Z in U4 involves only C5, with rational coefficients, rank 13; solution space of dim 8 = coordinate span of ['C500', 'C410', 'C320', 'C230', 'C140', 'C050', 'C401', 'C311']
  ok   (2) (C5)_Y - 2 delta A4 in U4: the A4-block is -2 delta x (selection of the 13 non-U4 coefficients), C5-block rational; so for every delta != 0 and every C5, A4 is unique modulo U4: A4 = (C5)_Y/(2 delta) mod U4
  ok   (2) the 26 linear conditions have rank 26 on the 36 coordinates of (C5, A4): solution space of dim 10 = 8 + 2
  ok   (2) pivots: y o Phi = 2 delta Psi + r L_X + s L_Y + ..., z o Phi = a L_X + b L_Y + ..., with a, b, r, s the U4-coefficients
   cubic remainders, general tails (h_X = (4 delta/35) X Y^2, h_Y = (A4)_X/4, a,b,r,s the U4-coefficients of (C5)_Z, (C5)_Y - 2 delta A4):
      x o Phi         -> 0
      y o Phi         -> (R4)_Y - r h_X - s h_Y - 2 delta B3
      z o Phi         -> (R4)_Z - a h_X - b h_Y
      x o x o Phi     -> 0
      y o x o Phi     -> x o ((C5)_Y - 2 delta A4)
      z o x o Phi     -> x o (C5)_Z
      x o x^2 o Phi   -> 0
      y o x^2 o Phi   -> (24*de)*X^2*Y
      z o x^2 o Phi   -> 0
      x o Psi         -> 0
      y o Psi         -> (A4)_Y - h_X
      z o Psi         -> (A4)_Z
      x o L_X         -> 4*X^3
      y o L_X         -> 0
      z o L_X         -> 0
      x o L_Y         -> 3*X^2*Y
      y o L_Y         -> X^3
      z o L_Y         -> 0
  ok   all 18 cubic remainders (general tails) are as listed
  ok   E3 enters no condition and no cubic remainder
Part 2: the solution space of (2), parametrized by c0..c5, a, b, r, s (dimension 10); cubic remainders modulo E0
  ok   the parametrization satisfies (2): (C5)_Z = a X^4 + b X^3Y, (C5)_Y - 2 delta A4 = r X^4 + s X^3Y
  ok   the parametrization (c0..c5, a, b, r, s) -> (C5, A4) is injective (rank 10 = 10), so it is the whole solution space
  ok   no conditions in degrees >= 4 remain (all 18 reductions)
  ok   pivots: y o Phi -> (2 delta, r, s) at (X^4Y, X^4, X^3Y), z o Phi -> (a, b) at (X^4, X^3Y)
  ok   h_X, h_Y as in (1) for the parametrized lifts
  ok   under (2), h_Y = (C5)_XY/(8 delta) modulo E0
  ok   rho_Z, rho_Y, wbar are linearly independent (8 x 3 matrix of rank 3 at a random point)
   relation table: cubic remainder modulo E0 = l_Z rho_Z + l_Y rho_Y + l_w wbar (identities in Q(delta)[tails], constants l):
      x o Phi         : (l_Z, l_Y, l_w) = (0, 0, 0)
      y o Phi         : (l_Z, l_Y, l_w) = (0, 1, 0)
      z o Phi         : (l_Z, l_Y, l_w) = (1, 0, 0)
      x o x o Phi     : (l_Z, l_Y, l_w) = (0, 0, 0)
      y o x o Phi     : (l_Z, l_Y, l_w) = (0, 0, 0)
      z o x o Phi     : (l_Z, l_Y, l_w) = (0, 0, 0)
      x o x^2 o Phi   : (l_Z, l_Y, l_w) = (0, 0, 0)
      y o x^2 o Phi   : (l_Z, l_Y, l_w) = (0, 0, 0)
      z o x^2 o Phi   : (l_Z, l_Y, l_w) = (0, 0, 0)
      x o Psi         : (l_Z, l_Y, l_w) = (0, 0, 0)
      y o Psi         : (l_Z, l_Y, l_w) = (0, 0, 1)
      z o Psi         : (l_Z, l_Y, l_w) = (0, 0, 0)
      x o L_X         : (l_Z, l_Y, l_w) = (0, 0, 0)
      y o L_X         : (l_Z, l_Y, l_w) = (0, 0, 0)
      z o L_X         : (l_Z, l_Y, l_w) = (0, 0, 0)
      x o L_Y         : (l_Z, l_Y, l_w) = (0, 0, 0)
      y o L_Y         : (l_Z, l_Y, l_w) = (0, 0, 0)
      z o L_Y         : (l_Z, l_Y, l_w) = (0, 0, 0)
  ok   every cubic remainder modulo E0 is a combination of rho_Z, rho_Y, wbar with constant (rational) coefficients
  ok   converse: rem(z o Phi) = rho_Z, rem(y o Phi) = rho_Y, rem(y o Psi) = wbar modulo E0 exactly, all other remainders are 0 modulo E0 (table of rank 3)
   hence, for every D_3 containing E0, M is closed iff (2) and rho_Z, rho_Y, wbar lie in D_3 (modulo E0)
  ok   all coefficients occurring (remainders, rho_Z, rho_Y, wbar) have denominators that are powers of delta
Part 3: consequences
  ok   E3 is free: its coefficients occur in no cubic remainder
  ok   d/dZ : T_4 -> T_3 has rank 10 = 10 (onto); hence R4 -> (R4)_Z mod D_3 is onto T_3/D_3 for every 4-dim D_3, kernel of dim 15 - 6 = 9
  ok   R4 enters rho_Z only through (R4)_Z: rho_Z - rho_Z|_{R4=0} = (R4)_Z modulo E0
  ok   B3 occurs only in rho_Y, as -2 delta B3: rho_Y - rho_Y|_{B3=0} = -2 delta B3 modulo E0; no B3 in rho_Z, wbar
   so, given R4 (and C5, r, s, delta != 0), rho_Y in D_3 iff B3 = ((R4)_Y - r h_X - s h_Y)/(2 delta) + (element of D_3): B3 is determined modulo D_3 (4 free coefficients)
  ok   wbar involves only c4, c5 (and delta): variables ['c4', 'c5']
   (C5): 8 free coefficients c0..c5 (incl. c4, c5) and a, b (coefficients of X^4Z, X^3YZ); A4 = (C5)_Y/(2 delta) mod U4, with U4-part given by r, s (free)
Part 4 (sanity): random members over QQ, direct closure (random.seed(20261011))
   member (wbar = 0): delta = 5/2, C5 = -X^5 - X^4*Y - 3*X^3*Y^2 - 3*X^2*Y^3 + 5/42*X*Y^4 - 3*X^4*Z + 2*X^3*Y*Z, r = -3, s = 2, wbar = 0, D_3 = [X^3, X^2*Y, -2*X^3 + 3*X^2*Y + X*Y^2 + Y^3 + 2*X^2*Z - 2*X*Y*Z - Y^2*Z + 2*X*Z^2 + 3*Y*Z^2 + 3*Z^3, 2*X^3 + 3*X^2*Y - X*Y^2 - 2*Y^3 - 2*X^2*Z - 2*X*Y*Z - 2*Y^2*Z - 3*X*Z^2 - 3*Y*Z^2]
  ok   member (wbar = 0): the three conditions hold, the reduction criterion holds, dim span = 20, closure of dim 20, H = [1, 3, 6, 4, 2, 2, 1, 1]
  ok      negative control (rho_Z broken): conditions (False, True, True), closed False (expected not closed)
  ok      negative control (rho_Y broken): conditions (True, False, True), closed False (expected not closed)
  ok      negative control (wbar != 0 not in D_3 (c4 + 1, R4, B3 re-solved)): conditions (True, True, False), closed False (expected not closed)
   member (wbar != 0): delta = 4, C5 = -X^5 + 3*X^4*Y - X^3*Y^2 - X^2*Y^3 - X*Y^4 + Y^5 - X^4*Z + 3*X^3*Y*Z, r = -2, s = 2, wbar = -137/70*X*Y^2 + 5/2*Y^3, D_3 = [X^3, X^2*Y, -137/70*X*Y^2 + 5/2*Y^3, X^3 - 3*X^2*Y - 3*X*Y^2 - Y^3 + 2*X^2*Z + X*Y*Z - X*Z^2 + 2*Y*Z^2]
  ok   member (wbar != 0): the three conditions hold, the reduction criterion holds, dim span = 20, closure of dim 20, H = [1, 3, 6, 4, 2, 2, 1, 1]
  ok      negative control (rho_Z broken): conditions (False, True, True), closed False (expected not closed)
  ok      negative control (rho_Y broken): conditions (True, False, True), closed False (expected not closed)
  ok      negative control (wbar not in D_3 (new D_3, R4, B3 re-solved)): conditions (True, True, False), closed False (expected not closed)
total time 2.7 s
ALL CHECKS PASSED
