A Methodology for Programming with Concurrency: The Formalism