Asimov's "I, Robot" stories cover this territory well. The robots must follow three laws, which are simple enough on their surface, but in application prove tough to predict. The humans begin to see that the laws have unintended and undesirable consequences.