The best way to write a program is to write it.
The PAC learning framework provides a formal way to quantify the learnability of a concept class.