Solution (source code)

= Solution

Take a reduced fraction $a/b\in R$, with $b\neq0$. Since $\gcd(a,b)=1$, <Bézout's identity> supplies integers $u,v$ with $ua+vb=1$. As the <subring> $R$ contains all <integers>,
$$
\boxed{\frac1b=u\frac ab+v\in R.}
$$
Thus a denominator appearing in a reduced fraction in $R$ is automatically a <unit> of $R$.

Now let $I\cap\mathbb Z=d\mathbb Z$. Because $d\in I$, the <principal ideal> $dR$ is contained in $I$. For the reverse inclusion, take $x\in I$ and write $x=a/b$ in lowest terms. Multiplying by $b\in R$ gives $a=bx\in I\cap\mathbb Z=d\mathbb Z$, so $a=dc$ for some integer $c$. The preceding result gives $1/b\in R$, whence
$$
x=\frac ab=d\left(\frac cb\right)\in dR.
$$
Therefore
$$
\boxed{I=dR.}
$$
This includes $d=0$: the same argument forces every $x\in I$ to be zero. This is the <ideals of subrings of the rational numbers> property; every such <ring> is a <principal ideal domain>.