The story you read about Feynman is this one: http://longnow.org/essays/richard-feynman-connection-machine...
I remember seeing a program that would output Haskell functions given just their type signatures. If you think of type signatures as invariants, this is exactly what drostie described. Alas my Google-fu was unable to find a reference to it.