Examples of modules that $M_\mathfrak{p} \subset N_\mathfrak{p}$ that does not imply $M \subset N$? I came across a theorem in algebraic number theory:

Theorem Let $A$ be a Dedekind ring and $M, N$ two modules over $A$. If $M_\mathfrak{p} \subset N_\mathfrak{p}$ for all prime ideals $\mathfrak{p} \subset A$, then $M \subset N$.

Proof. Let $a \in M$. For each $\mathfrak{p}$ we can find $x_\mathfrak{p} \in N$ and $s_\mathfrak{p} \in A \setminus \mathfrak{p}$ such that $a/1=x_\mathfrak{p}/s_\mathfrak{p}$. Let $\mathfrak{b}$ be the prime ideal generated by the $s_\mathfrak{p}$. Then $\mathfrak{b}$ is the unit ideal, and we can write
\[
1=\sum y_\mathfrak{p}s_\mathfrak{p}
\]
with elements $y_\mathfrak{p} \in A$ all but a finite number of which are $0$. This yields
\[
a = \sum y_\mathfrak{p}s_\mathfrak{p}a = \sum y_\mathfrak{p}x_\mathfrak{p} \in N
\]
as desired. $\square$

Here $M_\mathfrak{p}$ means the localisation of $M$ at $\mathfrak{p}$.
My question is not about the theorem per se, but I guess there should be some counterexamples. Chances are there are modules $M,N$ such that
$$
M_\mathfrak{p} \subset N_\mathfrak{p} \text{ does not imply } M \subset N.
$$
But I find it pretty hard to construct an example. I try to breakdown this question into pieces:

*

*Does this coincide with local property? It's pretty close:


Let $\phi:M \to N$ be an $A$-modue homomorphism (no futher property assumed on $A$ at this point), then the followings are equivalent:

*

*$\phi$ is injective.


*$\phi_\mathfrak{p}:M_\mathfrak{p} \to N_\mathfrak{p}$ is injective for each prime ideal $\mathfrak{p}$.


*$\phi_\mathfrak{m}:M_\mathfrak{m} \to N_\mathfrak{m}$ is injective for each maximal ideal $\mathfrak{m}$.

It looks like we are talking about 2 implies 1. But the inclusion map $M \to N$ is not given in this theorem. Also in the proof of the theorem, Serge Lang used properties of Dedekind ring (fractional ideals form a group) explicitly. If local property is the case, why would he ignore it?


*Is it possible to get a desired counterexample given by $M_\mathfrak{p} \not\subset N_\mathfrak{p}$ for at least one prime ideal?


*Is it possible to get a desired counterexample given by $A$ not being Dedekind, or even wilder, $A$ is not Noetherian? Noetherian counterexamples will certainly be more interesting.
Thanks in advance!

Edit 1: I added proof of the theorem to avoid unnecessary confusion.
 A: In fact, the claim is true for any unital ring $R$. Indeed, suppose that $M_\mathfrak p \subseteq N_\mathfrak p$ for all prime ideals $\mathfrak p$ of $R$.
Let $a \in M$. Then for any prime ideal $\mathfrak p$ we consider $\frac a1 \in M_\mathfrak p \subseteq N_\mathfrak p$. Hence there exist $n_\mathfrak p \in N$ and $s_\mathfrak p,t_\mathfrak p \in R-\mathfrak p$, s.t.
$$t_\mathfrak p(s_\mathfrak pa-n_\mathfrak p) = 0$$
Now consider the ideal $I$ of $R$ generated by all the elements $t_\mathfrak ps_\mathfrak p$. We claim that it is the whole ring $R$. Suppose the opposite is true, then you can find a maximal ideal $\mathfrak m$ containing it. However, then we get $t_\mathfrak ms_\mathfrak m \in I \subseteq \mathfrak m$, which is a contradiction, as $t_\mathfrak ms_\mathfrak m \in R- \mathfrak m$. Hence $I=R$. In particular, we can find $y_\mathfrak p \in R$, s.t.
$$1 = \sum_\mathfrak p y_\mathfrak pt_\mathfrak ps_\mathfrak p$$
where all but finitely many of the $y_\mathfrak p$ are $0$. Therefore:
$$a = \sum_\mathfrak p y_\mathfrak pt_\mathfrak ps_\mathfrak pa = \sum_\mathfrak p (y_\mathfrak pt_\mathfrak p)n_\mathfrak p \in N$$
Hence $M \subseteq N$.

From the proof we can notice that we can relax the condition and ask for $M_\mathfrak m \subseteq N_\mathfrak p$ for all maximal ideals $\mathfrak m$ of $R$, which is a common feature when it comes to localizing at prime ideals.
A: Question: "My question is not about the theorem per se, but I guess there should be some counterexamples. Chances are there are modules $M,N$ such that $M_p⊂N_p$ does not imply $M⊂N$."
Answer: Let $A$ be any commutative unital ring and let $L,L'$ be invertible $A$-modules with
$$L_{\mathfrak{p}}\cong L_{\mathfrak{p}}' \cong A_{\mathfrak{p}}$$
for all primes. Hence there is an abstract inclusion $L_{\mathfrak{p}}\subseteq L'_{\mathfrak{p}}$ for any prime ideal.This does not imply there is a "global" inclusion $L \subseteq L'$.
Example: Let $K$ be any number field with ring of integers $A$, and let $I,J$ be two invertible $A$-modules that are not contained in each other. This gives a counter example: The $A$-modules $I,J$ have isomorphic stalks since they both have rank one.
