  This paper is devoted to establishing a first order necessary condition of
Fritz John type for nonlinear infinite-dimensional optimization problems.
Different from the known constraint qualifications in the optimization theory,
a finite codimensionality condition is introduced. It is equivalent to suitable
a priori estimates, which are much easier to be verified. As applications, the
first order necessary conditions for optimal control problems of some
deterministic/stochastic control systems are derived in a uniform way.
