A Functional Approach to the Legal Review of Autonomous Weapon Systems