Matmonim: Daf Yomi by Rabbi David Lapin

Sanhedrin 40b-41a Educate Before Punishing - מניין להתראה מן התורה

Rabbi David Lapin

The requirement to have warned the accused moments before his actions, might not be to determine his intentionality, but rather for the witnesses to have done everything possible, to educate, inspire and restrain the accused before effecting his punishment. 
Source Sheet