Step 1Melt the butter in a skillet over medium heat. Add the leeks and cook until softened, about 5 minutes. Add the mushrooms and shallot and reduce the heat to low. Cook until the mushrooms begin to darken and give off their moisture, another 5 minutes. Season with one-half teaspoon salt.
Step 2Heat the oven to 400 degrees. Generously butter a heavy 11- by 7-inch baking dish.
Step 3Slice the potatoes very thin and pat them dry with a kitchen towel. Arrange half of the potatoes in a rough layer in the baking dish, then distribute the leek and mushroom mixture over the top. Scatter half the grated cheese over that and season with one-fourth teaspoon salt. Top with the remaining potatoes in as solid a layer as possible. Scatter the remaining cheese on top.
Step 4Heat the milk just to a simmer in a small saucepan and pour it over the potatoes. You should just barely be able to see milk under the top layer. Pour the cream over the top and bake.
Step 5After 30 minutes, the cream-milk mixture should be puffed and bubbling and beginning to brown. The potatoes should be starting to become tender. Bake until the top is thoroughly browned, the milk bubbles have subsided and the gratin is a compact mass, another 30 to 35 minutes. Remove from the oven and serve at once.