Reducing Causality to Functions with Structural Models