There are no such rings.
A commutative ring with finitely many ideals is artinian. A commutative artinian ring is a direct product of artinian local rings. The direct product of n local rings has n maximal ideals, so you know n = 2 or 3. However, the lattice of a direct product is a type of lattice product, and the lattices you give are not such products (since they are so small, just check all lattices of the appropriate cardinality).
For the particular lattices you are looking at, there is a counting argument: If R, S are rings, then the ideals of R × S are all I × J for ideals I and J of R and S respectively. In particular, if a commutative ring had M3 as an ideal lattice, then it would be a direct product of three artinian local rings, and so one could write 4 as a product of three positive integers greater than 1. If a commutative ring had N5 as an ideal lattice, then 5 would be a product of two positive integers greater than 1.
Your topology $\tau$ is indeed a cocomplete lattice. But notice that the notion of "lattice" only includes the order $\leq$ and the finite meets and joins $\land, \lor$.
In your case, the finite meets are indeed intersections: a finite intersection of open sets is an open set, by definition.
The joins (arbitrary ones) are unions: an arbitrary union of open sets is open, by definition.
But, as you notice, an arbitrary intersection of open sets need not be open: it seems as though $\tau$ is not complete. But it is, because of the theorem you mention. So where did we go wrong ?
Well we went wrong when we went from "$\tau$ is not stable under arbitrary intersections" to "$\tau$ doesn't have arbitrary meets".
Let's see why that goes wrong on an easier example. Consider a lattice with $4$ elements :$a,b,c,d$ where $a\leq b$ and $b\leq c, b\leq d$. This is indeed a lattice (check it if you're not convinced !).
Now let's call it $L$ and let $\land_L$ denote the meet in $L$. In particular we have $c\land_L d= b$. But consider the subset $\{a,c,d\}$: it is a partially ordered set, but it's not stable under $\land_L$: indeed $b$ is not in it. Can we conclude that it's not a lattice ? No, indeed in this subset the meet of $c,d$ exists, and it's $a$, but it doesn't coincide with $\land_L$. T
hat can happen on this level, but it can also happen for complete lattices: that is we may have a complete lattice $L$ with a sublattice $L'$ such that both $L,L'$ are complete and $\land_L = \land_{L'}$ (finite meets !) but arbitrary meets in $L'$ don't need to be the same as in $L$.That's exactly what happens here: you're seeing $\tau$ as a sublattice of $\mathcal{P}(X)$ (power set of $X$, with $\subset$). You notice that the two have the same finite meets; and you notice that (denoting by $\bigwedge_X$ arbitrary meets in $\mathcal{P}(X)$) $\tau$ is not stable under $\bigwedge_X$. Does that mean that $\tau$ is not complete ?
Certainly not; just as above. In fact; if $(O_i)_{i\in I}$ is a family of open sets, then $\bigwedge_{i\in I}O_i$ in $\tau$ (not in $\mathcal{P}(X)$ !) is precisely $\mathrm{Int}(\displaystyle\bigcap_{i\in I}O_i)$. Indeed, this is clearly open, it's clearly included in each of the $O_i$'s; furthermore if $O$ is an open set such that $O\subset O_i$ for each $i$, then $O\subset \displaystyle\bigcap_{i\in I}O_i$ by definition of the intersection, and thus, by definition of the interior, $O\subset \mathrm{Int}(\displaystyle\bigcap_{i\in I}O_i)$: thus this is precisely the definition of a meet: it's a lower bound such that every other lower bound is smaller than it.
In fact, there's nothing special about open sets here. Consider the following : let $L$ be a cocomplete and complete (though this second condition is not necessary) lattice, $L'$ a sublattice of $L$ (that is, $L'$ is a subset that is closed under finite meets and finite joins in $L$) such that arbitrary joins in $L'$ exist, and are the same as those in $L$. Then for any subset $S\subset L'$, the meet of $S$ in $L'$ is the join in $L'$ (and thus in $L$) of $\{x\in L'\mid x\leq \displaystyle\bigwedge_L S\}$; and the proof is exactly the same as above ! Remember that the interior of a set is nothing but the union (join) of all open sets included in it.
Best Answer
I believe that the notion of "ideal" for lattices came about later than the notion for rings, and that it originally arose in boolean algebras by analogy. It was later extended to lattices, and finally to partially ordered sets.
Kummer first introduced "ideal numbers" in his study of factorization in cyclotomic rings, $\mathbb{Z}[\zeta_p]$ where $\zeta_p$ is a primitive $p$th root of unity; some of these rings did not enjoy unique factorization, but Kummer used the notion of ideal number (with ideal being used in the sense of "existing in imagination or fancy only", and along the lines of an "imaginary embodiment of a quality"). These were "numbers" that did not actually exist in the rings, but which allowed for a kind of unique factorization (each element of $\mathbb{Z}[\zeta_p]$ could be written uniquely as a product of actual and ideal numbers). This was 1844.
Dedekind then took the notion of ideal number and replaced it with "ideal"; every "ideal number" of Kummer was identified with the set of all its "multiples", and this got extended to multiples of actual numbers. What we now call "principal ideals" corresponded to actual numbers, and nonprincipal ideals to ideal numbers. This allowed an extension from cyclotomic rings to arbitrary rings of integers in number fields. Dedekind gave several expositions of ideals, with the 1877 version probably being the most polished. You can find a very nice translation (with extended introductory remarks by John Stillwell) in Theory of Algebraic Integers by Richard Dedekind, Cambridge Mathematical Library , Cambridge University Press 1996, ISBN 0-521-56518-9.
Dedekind defines an ideal of the ring $R$ (always commutative) as a non-empty set $I$ such that
These notions were later extended by Artin and Noether in the 1920s to more general rings.
According to Orrin Frink (in this 1954 paper in the American Mathematical Monthly), it was M.H. Stone who investigated the notion in Boolean algebras (The theory of representations for Boolean algebras by M.H. Stone, Trans. Amer. Math. Soc. 40 (1936), 37-111). A quick perusal of the paper (found in JSTOR) suggests that this was indeed the first time that they were treated as "abstract rings".
This was then extended to other kinds of lattices. According to Frink, the definition of ideals in lattices proceeds by analogy to that of ideals in rings:
(viewing $\land$ as multiplication and $\lor$ as sum). The point being that in addition to being analogous, in the case of boolean lattices the concept of "ideal" as a ring and "ideal" as a lattice coincide, as you note.
Frink then extended the definition to arbitrary partially ordered sets in the paper mentioned above. He writes:
He then bases his definition on the notion of normal ideal that was studied by Stone, MacNeille, and Garrett Birkhoff: given a subset $A$, we let $A^*$ be the set of all upper bounds of $A$, and $A^+$ the set of all lower bounds of $A$. A "normal ideal" was a set $A$ such that $A=A^{*+} = (A^*)^+$. Frink defines:
E.S. Wolk discussed the "fruitfulness of this definition" in a paper on representations of partially ordered sets. Here it is in JSTOR.
So here we see a process whereby the extension first occurred by considering a special kind of ring (Boolean rings), then extending the notion "by analogy" to lattices, and finally to partially ordered sets with a view towards extending lattice theorems, particularly representation theorems.
However, there is another sense in which ideals for lattices and ideals for rings are instances of a particular kind of more general construction, as noted by Alex Youcis: the notion of congruence of an algebra (in the sense of universal algebra).
Let $A$ be an algebra in the sense of universal algebra (a set together with a family of finitary operations); examples include semigroups (a single binary operation), monoids (a binary operation and a zeroary operation), groups (a binary, a unary, and a zeroary operation), rings, lattices, $R$-algebras, vector spaces, and many others. Say we have an equivalence relation $\sim$ on $A$, and we want to define an algebra structure on $A/\sim$ by "operating on representatives". E.g., in groups, we want to define the product of the equivalence classes $[a]$ and $[b]$ of $a,b\in A$ to be the equivalence class of the product. More generally, if $f\colon A^n\to A$ is an $n$-ary operation on $A$, we want to define an induced operation $\overline{f}\colon (A/\sim)^n\to (A/\sim)$ by $$\overline{f}([a_1],\ldots,[a_n]) = [f(a_1,\ldots,a_n)].$$ Under what conditions will this be well-defined?
Theorem. The induced operation on equivalence classes is well-defined if and only if $\sim$, when viewed as a subset of $A\times A$, is a subalgebra of $A\times A$ (where the latter has the coordinatewise algebra structure).
This leads to:
Definition. Let $A$ be an algebra (in the sense of universal algebra). A congruence on $A$ is an equivalence relation that is a subalgebra of $A\times A$.
In the case of groups, congruences are in one-to-one correspondence with normal subgroups: given a normal subgroup $N$, we define the equivalence relation $\sim$ by $a\sim b$ if and only if $aN=bN$. Conversely, given a congruence $\Phi\subseteq A\times A$, we let $N=\{a\in A\mid (a,e)\in \Phi\}$; it is then not hard to show that $A$ is normal and that $(a,b)\in \Phi$ if and only if $aN=bN$.
Similarly, for rings, congruences are in one-to-one correspondence with ideals.
This does not hold for more general structures. We do have some connection: given a lattice $L$ and an ideal $J$ of $L$, we can define a relation $\Phi_J$ on $L$ by $$ \Phi_J = \{ (a,b)\in L^2 \mid \exists c\in J (a\lor c = b\lor c)\}.$$
This is an equivalence relation on $L$. $(a,a)\in\Phi_J$ for all $a\in L$, since we can take any $c\in J$ to get $a\lor c = a\lor c$. It is also easy to verify that $(a,b)\in\Phi_J$ implies $(b,a)\in\Phi_J$. And if $(a,b),(b,c)\in \Phi_J$, with $x,y\in J$ such that $a\lor x = b\lor x$ and $b\lor y = c\lor y$, then $$a\lor(x\lor y) = (a\lor x)\lor y = (b\lor x)\lor y = c\lor y\lor x = c\lor(x\lor y)$$ and $x\lor y\in J$ because $J$ is an ideal, so $(a,c)\in \Phi_J$.
For $\lor$-semilattices, $\Phi_J$ is a congruence on $L$: we need to verify that if $(a,b),(c,d)\in\Phi_J$, then $(a,b)\lor(c,d) = (a\lor b,c\lor d)$ is in $\Phi_J$. Indeed, if $a\lor x = b\lor x$ and $c\lor y=d\lor y$, then $$(a\lor c)\lor(x\lor y) = (a\lor x)\lor(c\lor y) = (b\lor x)\lor(d\lor y) = (b\lor d)\lor(x\lor y),$$ and $x\lor y\in J$ because $J$ is an ideal.
If $L$ is a distributive lattice, then we also get that $\Phi_J$ is closed under meets, so that $J$ determines a congruence. In fact,
In a Boolean algebra (and more generally, as noted by Martin Sleziak, in a generalized boolean lattice) every congruence is of the form $\Phi_J$ for some ideal $J$, but in an arbitrary distributive lattice, there may be congruences that are not induced by ideals.
(By the way, the same thing happens in semigroups, which also have a notion of "ideal"; see, e.g., Wikipedia; every ideal induces a congruence, but not every congruence is induced by an ideal. The notion of "ideal" in semigroups is also by analogy to "ideal" in rings, where an ideal of the ring forms an ideal of the multiplicative semigroup of the ring).