Is it safe for children to sleep by themselves at the age of 4yo?

Yes. I'm guessing from the question that there is a lot of anxiety about leaving your children alone in general. Children are safe to sleep alone largely from birth, as long as the crib is empty of all items and set up right. Certainly by 6 mo, the academy of pediatrics says childr en can sleep completely unsupervised. By 4 years, this is a personal and cultural decision, not a safety decision.
Yes. It is safe & preferred for children to be allowed to develop self directed sleep as early as possible. This can be as early as the first week. A parent desire to monitor a childs sleep is a personal issue. Children will develop confidence thru experience. If baby is never left alone they begin to believe they can't function any other way & exagerated dependence is a possibility.
Yes. However, some children may not be ready by 4 years of age. 'not sleeping by themselves' could mean sharing the same bed, and then it is often expected and certainly safe to sleep alone instead, even as an infant. If 'not sleeping by themselves' means sharing a room, then it is not necessary to ever sleep alone as a child, but as one or more of those sharing reaches puberty, then alone is safer.