A theoretical framework for back-propagation