Differential forms and invariant sets of dynamical systems