A Categorical Approach to Verifying Consistency in Concurrent Systems