A general formulation of time-optimal quantum control and optimality of singular protocols. (10th July 2020)