concept law in category system administration

This is an excerpt from Manning's book Functional and Reactive Domain Modeling.
Previous chapters covered the parallels between functional programming and mathematics in general, and algebra in particular. You explored algebraic data types, sum types, and product types, and you learned how to combine them to form abstractions that model your domain elements. This chapter takes this discussion to the next level; you’ll begin with specifications of the model and, using algebraic composition of types, build APIs for our domain model. These APIs are contracts that obey the laws of the domain, and you’ll use the algebra of types to ensure that they’re correctly constructed. You’ll learn how to develop APIs as algebraic specifications and write properties that verify the laws that form the business rules.
As I mentioned earlier, one of the steps toward an algebra-based API design is to formalize the laws of the algebra. You need to explicitly record some of the invariants that your APIs have to honor. These can be generic constraints or they can be driven by rules from the domain.
Let’s consider an example. One of the basic laws that you should enforce is as follows: For all accounts, given a balance B, a successful sequence of one credit and one debit of equal amount will give back B. Using our API definitions, you can formalize the law as a property of your model and record it as part of your test suite. You’ll explore how to verify invariants of the model when we discuss property-based testing in chapter 9. Here’s a sample translation of the law: