What are the two main functions of criminal law?

Describe the written sources of American criminal law and their purposes.