Idea – Software Failure Prevention From Output Recognition?

I’m not a programmer so this will just be naive speculation on my part. Inspired by machine learning like face recognition. The idea is that not only are the inputs filtered to give valid outputs but output are also analyzed by computer recognition. If you get unexpected results, or unintended behavior. The recognition will catch this. If this works it would be like if a vehicle like an airplane had freewill. The output is all the time recognized and coinciding with the will (software) of the airplane.