(1) Compute P1 = contents and K = basis(pp) of inputs.
Compute P2 = initial sequences of non-constant coeffs of all basis elts,
Compute each Pijk, where suppose K has three elements, 0 <= i < length of initial sequences of non-constant coeffs of K1, 0 <= j < etc., Qijk is projection computed using ith, jth, and kth reducta of respective elements of K, and Pijk is the result of simplifying Qijk with respect to the side relations that the appropriate initial non-constant coeffs of the elements of K are equal to zero.
(Possible precomputation for each Pijk: do a heuristic test (e.g. Groebner basis to check emptiness of complex variety), or cad, to check that real varieties stay nonempty as you take progressively larger sequences of initial non-constant coeffs; if such a variety is empty, then you don't need to continue. It could happen that appropriate tails of initial sequences of elements of K could be thrown out of P2).
Set P = P1 un P2 un (all Pijk's).
Compute P-invariant decomposition of E^(r-1).