Melt the butter over a low heat. Add the onion, leeks and garlic and cook, lid on, over a low heat until soft. This should take about 15 minutes. If the vegetables show any signs of browning, add a small splash of water to the pan.
Add the stock and split peas to the pan, cover and bring to the boil. Simmer gently for 45 minutes then add the carrot and simmer for a further 30 minutes.
When the split peas are disintegrating, and the carrot is soft, check the seasoning, adjusting if necessary and add the ham if using. Simmer for a couple more minutes then serve.