This paper deals with the so-called Stanley conjecture, which asks whether they are non-isomorphic trees with the same symmetric function generalization of the chromatic polynomial. By establishing a correspondence between caterpillars trees and integer compositions, we prove that caterpillars in a large class (we call trees in this class proper) have the same symmetric chromatic function generalization of the chromatic polynomial if and only if they are isomorphic.