# Chinese Remainder Theorem

Let $I$ and $J$ be integral fractional ideals over the same order $S$ in an étale algebra. Assume that $I$ and $J$ are coprime, that is, $I+J=S$. Then $I \cap J = I\cdot J$ and we have a canonical $S$-linear isomorphism

$$
{S\over I \cap J} \simeq {S\over I} \times {S\over J}.
$$

## `ChineseRemainderTheorem(Is, as): SeqEnum[AlgEtQIdl], SeqEnum[AlgEtQElt] -> AlgEtQElt`

Given a sequence $Is$ of ideals of $S$, pairwise coprime, and a sequence $as$ of elements of $S$, it returns an element $e$ such that $e-as[i] \in Is[i]$ for every $i$.

## `ChineseRemainderTheorem(I, J, a, b): AlgEtQIdl, AlgEtQIdl, AlgEtQElt, AlgEtQElt -> AlgEtQElt`

Given two coprime ideals $I$ and $J$ of $S$, two elements $a,b \in S$, finds $e$ such that $(e-a) \in I$ and $(e-b) \in J$.

## `ChineseRemainderTheoremFunctions(Is): SeqEnum[AlgEtQIdl] -> Map, Map`

Given a sequence $Is$ of $N$ integral fractional $S$-ideals $I_1,\ldots,I_N$, pairwise coprime, returns a map $S \to S^N$ representing the natural isomorphism ${S \over I} \to {S \over I_1} \times \cdots \times {S \over I_N}$, where $I=\prod_i I_i$, and a map $S^N \to S$ representing the inverse.

## `Example: CRT Functions (ex-d7dd94)`

```magma
> _<x> := PolynomialRing(Integers());
> A := EtaleAlgebra((x^2+2)*(x^2+3));
> O := MaximalOrder(A);
> I1 := PrimesAbove(2*O)[1];
> I2 := PrimesAbove(3*O)[1];
> toProd, fromProd := ChineseRemainderTheoremFunctions([I1,I2]);
> toProd(One(A));
[
<1, 0>,
<1, 0>
]

```
