It's often convenient to construct quotient rings in an iterated fashion, e.g. when localizing a polynomial ring:
B.<x>=QQ[]
C.<y>=B[]
However, Sage complains when I am trying to calculate a kernel of a homomorphism into such an iteratively constructed ring:
A.<a,b>=QQ[]
f=A.hom([x,y],C)
f.kernel()
Here, Sage treats B as the base ring for C and QQ as the base ring for A and kernel() is not implemented for different base rings. I know, that I could simply construct C as
C.<x,y>=QQ[]
to overcome the problem, but in practice B might be the argument of a method and it would be convenient to extend the ring B instead of having to unpick its construction and create a new ring from scratch.
Is there a way to make this work? E.g. by "flattening" such an iterated construction in an automated fashion?