Towards a formal verification of Courcelle's theorem