A (Co)algebraic Approach to Programming and Verifying Computer Networks