When we program a computer to make choices intelligently after determining its options, examining their consequences, and deciding which is most favorable or most moral or whatever, we must program it to take an attitude towards its freedom of choice essentially isomorphic to that which a human must take to his own.
"Ascribing Mental Qualities to Machines" (1979) Sect. 5.5: Free Will. Reprinted in Formalizing Common Sense: Papers By John McCarthy, 1990, ISBN 0893915351