Theoretical foundations for finite-time transient stability and sensitivity analysis of power systems