If $A[X] \cong B[X]$ as rings, are the degrees of irreducible polynomials the same in $A$ and in $B$?

First, I ask my question and then I add some explanations:

Suppose that $A$ and $B$ are two commutative rings such that $A[X] \cong B[X]$ as rings. Denote by $D_A$ the set of all positive integers $n$ such that there exists an irreducible polynomial of degree $n$ over $A$ — the same for $D_B$. Is it true that $D_A = D_B$?


Some time ago, I wanted to find many proofs (like here) that $\Bbb Z[X]$ and $\Bbb R[X]$ are not isomorphic (obviously they are not because they don't even have the same cardinality, I know). I thought to the following argument:

"The irreducible polynomials in $\Bbb R[X]$ have degree $≤2$, while irreducible polynomials in $\Bbb Z[X]$ can have arbitrary large degree (for instance $X^n+2X^{n-1}+\cdots+2X+2$, by Eisenstein's criterion)".

But I wasn't sure of the correctness of this argument. The isomorphism $A[X] \cong B[X]$ is not required to preserve the degree. If it is preserved, then my claim should be true. I think that examples like this could prevent the isomorphism from preserving the degree.

A possibly relevant question is What are the possible sets of degrees of irreducible polynomials over a field?, on MO. In particular, this can be interesting when $D_A$ and $D_B$ are infinite.

Thank you for your comments!


Edit2: I'm afraid my argument below breaks down. $B[X]$ may have more maximal ideals than the "uppers" of the $\mathfrak n\in max(B)$, so that the primes of codimension 1 are not necessarily the $\mathfrak n[X]$ with $\mathfrak n\in max(B)$. Here's an example: let $B=\mathbb{Z}_{(2)}=\{m/n|m,n\in\mathbb{Z}\,\&n \not\equiv 0(\textrm{mod}\ 2)\}$, a local domain of dimension 1. We have a surjection $g:B[X]\twoheadrightarrow\mathbb{Q}$ given by $X\mapsto 1/2$. So the kernel of $g$ is a maximal ideal of $B[X]$, while this ideal is the "upper" $<\underline 0,X-1/2>$ to the minimal prime $\underline 0$ of $B$. My apologies... End-of-edit2.

Just a few comments. As is well-known, prime ideals of $A[X]$ come in two flavors, "downers" and "uppers". The former are the $\mathfrak p[X]=\{t\in A[X]|$ all coefficients of $t$ are in $\mathfrak p\}$, and latter are the $<\mathfrak p,h> = \{t\in A[X]|\, t$ mod $\mathfrak p[X]$ is divisible by $h$ in $Q(A/\mathfrak p)[X]\}$ (where $h\in Q(A/\mathfrak p)[X]$ is any monic, irreducible polynomial), with $\mathfrak p\in spec(A)$. One has $\mathfrak p[X] \subsetneq <\mathfrak p,h>$, and both lie over the prime ideal $\mathfrak p$ of $A$.

Now let $f:A[X]\to B[X]$ be a ring isomorphism.

If $\mathfrak m\in max(A)$, the "lower" $\mathfrak m[X]$ is a prime of codimension one in $A[X]$ (only the uppers to $\mathfrak m$ are larger, and there are no inclusion relations between them), so $f(\mathfrak m[X])$ must be of codimension one in $B[X]$, hence of the form $\mathfrak n[X]$ with $\mathfrak n\in max(B)$. This clearly gives a bijection between the maximal ideals of $A$ and those of $B$. And $f$ will then induce an isomorphism $A/\mathfrak m[X]\to B/\mathfrak n[X]$. As $A/\mathfrak m$ and $B/\mathfrak n$ are fields, we find that for each maximal ideal $\mathfrak n$ of $B$ there must be a $h\in \mathfrak n[X]$ and $b,c\in B$ with $b\notin \mathfrak n$ such that $f(X)=bX+c+h$. (In particular, the coefficient of $X$ in $f(X)$ is not in any maximal ideal of $B$, hence it is a unit in $B$.)

But I'm not sure under what circumstances this implies that $f(X)$ must be a linear polynomial.

Edit1: if $rad(B)$ denotes the Jacobson radical of $B$, that is $\bigcap max(B)$, we have a natural injection $(B/rad(B))[X]\rightarrowtail\prod_{\mathfrak n\in max(B)}((B/\mathfrak n)[X])$. Let $c$ be the coefficient of $X^{n}$ in $f(X)$ for some $n\geq 2$; since the image of $f(X)$ in every $B/\mathfrak n[X]$ is linear, it follows that $c\in rad(B)$. In other words, $f(X)$ is the sum of a linear polynomial and a polynomial with coefficients in $rad(B)$. In particular, $f(X)$ is linear when $rad(B)=0$, or, equivalently, $rad(A)=0$.

And if $f(X)=bX+c$ is linear, clearly $b\in B^{*}$, $f(A)=B$, and $f$ preserves degrees - in particular those of the irreducible polynomials over $A$. End-of-edit1.

The minimal prime ideals of $A$ and $B$ must also correspond to each other, as $\mathfrak p[X]\in min(A[X])$ for each $\mathfrak p\in min(A)$, and all minimal primes of $A[X]$ (and $B[X]$) are of this form. Perhaps this observation could be of some use when someone settles the case where $A$ and $B$ are domains.

When they are domains, we cannot conclude $f$ extends to $Q(A)[X]\to Q(B)[X]$ - unless we know that $f(A)\subseteq B$.