Determining Legality of a Society