Creating and verifying stable AI-controlled systems in a rigorous and flexible way