Theory of dark optical solitons