Rinse the green lentils and put them in a pan with 400ml water. Bring to the boil, then simmer for 20 minutes until tender. Drain and set aside.
Meanwhile, put the potatoes in a pan of salted water, bring to the boil and cook for 15 minutes until soft. Drain, then mash with the butter and milk. Season with salt and pepper.
Heat the olive oil in a large pan. Add the onion, carrots and celery and cook for 8 minutes until soft.
Add the garlic, tomato puree, rosemary and thyme. Cook for 1 minute.
Add the chopped tomatoes and the cooked lentils. Simmer for 10 minutes until the mixture thickens. Season well with salt and pepper.
Transfer the lentil mixture to an ovenproof dish. Spread the mash over the top in an even layer. Fluff with a fork for a crispy finish.
Bake at 200C (180C fan) for 20 minutes until the top is golden.