Cook the lentils in plenty of water until just soft, drain, but save ½pint of the cooking liquid.
While the lentils are cooking saute the onion, garlic, basil and cayenne in the oil until soft but not brown. Add the carrot, pepper and mushrooms. Cover and cook over a low heat for 10 minutes or until the carrot has softened.
Add the cooked lentils, tomato puree and seasoning. If the mixture is very thick add a little of the reserved cooking liquid from the lentils.
Cook for a further five minutes, transfer to an oven-proof dish, cover with mashed potato and sprinkle the grated cheese on top.
Bake for 30 minutes in a moderate oven, until the top is golden brown.