# Labeled Directed Graphs from Requirements Loops

For any Requirements Loop, it is possible (and not difficult) to define directed labeled graphs that reflect, in a well defined format, specific properties of that loop. The graphs can be used to compute answers to some specific questions about the propositions and relationships between propositions in a Requirements Loop. In turn, we can make recommendations on how to change a Requirements Loop, in order to ensure that it has some properties we want.

I’ll use the example detailed here. The first explanation in it, of where requirements come from, is as follows.

*RL1.1: How did observed events in the environment lead to requirements?*

- Student receives an email message from the university.
- Student decides if the email is relevant or not.
- If the student decides that the email message is irrelevant, then, at least for some such email messages, the student complains to other students and staff.
- Staff decides that complaints should be addressed, and therefore, there is a requirement to do so.

RL1.1 has four propositions, p1 to p4, corresponding to the four items above. If each proposition is a node in a graph, we are missing the links. Links will represent a relationship between these propositions.

In What is an explanation?, I wrote that the logical form of an explanation is that of an argument: a proposition can be a premise, and can have premises, in which case it is a conclusion from those premises. We say that p is a conclusion of q if it is the case that believing p should lead one to also believe q (or more precisely, if p and q are binary truth variables, then believing that p is true should lead one to believe that q is also true).

Which propositions are premises for which conclusions in RL1.1?

- If “Student receives an email message from the university” is a conclusion, what are its premises? There are none in RL1.1. In absence of premises for that proposition, it can only be a premise in an argument, or we need to look for, and add its premises to RL1.1.
- What are the premises of “Student decides if the email is relevant or not”? The student needs to receive an email in order to need to decide whedeci that email is relevant, so that p1 is premise for p2.
- The student may complain because they received an irrelevant email message, so p2 is premise for p3.
- Because staff know that students complain, and staff decided that complaints should be addressed, there is a requirement to do so, so that p3 is premise for p4.

The relationship is premise for in RL1.1 gives a graph with four nodes and three edges, each edge labeled “is premise for”:

- p1 is premise for p2
- p2 is premise for p3
- p3 is premise for p4

The graph simply looks like this: p1 –> p2 –> p3 –> p4, where each link “–>” reads that its source is a premise for its target. The graph can be visualized in different ways, and one example is below.

There is another relationship, which is different from being a premise for, and yields the same directed links. If we want to show the sequence of events in RL1.1, we have the same links, now labeled as showing sequence.

It is important to keep in mind that precedence and being a premise for are two different relationships, regardless of how often we may see them between the same propositions, and having the same direction. The graph does not capture these differences; this is a limitation of the graph as defined above.

Another important point is that you can read Figure 2 as showing two graphs, each defined by one relationship, over the same nodes; each graph is defined by its type of links. One graph captures the relationship “precedes” and the other “is premise for”.

The graphs in Figure 2 can be used to compute answers to the following questions:

- Which events precede those described in a given proposition? This question can be answered by finding all paths to p4, where each link on the path is labeled “precedes”. For example, if we ask which events precede p4, the answer are propositions p1, p2, p3.
- Which events, in which sequence, precede those described in a given proposition? The answer now, differently from item one above, is not the set of propositions, but the path itself, so p1 –> p2 –> p3 –> p4.
- What should one believe, in order to believe that a given proposition is true? These are all propositions on all paths to the proposition. For example, what should one believe to believe that p4 is true? p1, p2, and p3, because in order to believe p4, one needs to believe p3 (because of the “is premise for” from p3 to p4), and then to believe p3 one needs to believe p2, and so on.

The above are not an exhaustive list of questions, but should make the point clear. The more relationships we capture in the hypergraph of a Requirements Loop, the richer it is, and the more questions we can ask. And the benefit of doing this, of building these graphs, is that we can answer these questions without inspecting the Requirements Loop visually, regardless of the size (number of propositions) of that Loop.