Solving Software Reuse Problems with Theorem Provers