## 3 Mathematical Framework for Consistency
### Mathematical Representation of a Structural Model
#### 3.0.1 Port
We define a morphism between a block, port, or connection and a block that contains it. In the case of blocks, this morphism resembles the identity; it maps every object of the port to its parent or ancestor. This means that everything in the block is also contained in its ancestors. For connections, this relation will absorb the content of the connection to itself since the connection conceptually only refers to the ports rather than being a container that they are a part of. This also helps to disambiguate the difference between a port being in a connection that belongs to a different block and a direct belonging morphism from a port to a block. The last property of that point expresses that a model element has a unique parent, either the block itself or a block within it. All other blocks that contain it are its ancestors and will contain this parent. An example of the category depicting the system block from Figure 6 is depicted in Figure 7. This category indeed contains everything that is contained in the system block. In this case, this includes the A and B blocks, the P1 and P2 ports, and the C connection. We have defined all elements of the models: blocks, ports, and connections; we can now use these concepts to define the model itself. The model contains the blocks, ports, and connections and is structured as its root (main) block, with the difference that it also contains the root block and morphisms between elements of the root block and the root block. **Definition 12**. : _S2 ML Model An S2 ML model is a category \(M\) such that:_  
* _Ob(_\(M\)_) is a finite set of blocks, ports, and connections;_
* _There exists a block_ \(R\) _called the root of_ \(M\) _such that_ \(Ob(R)=Ob(M)\setminus R\)_, and for each_ \(x,y\in Ob(R)\)_,_ \(Hom_{M}(x,y)=Hom_{R}(x,y)\)_;_
* _The morphisms described between each object and a block in the definition of a block also hold between the objects of_ \(M\) _and the block_ \(R\)_;_
* _There are no other morphisms in the model than those described here and the morphisms derived from category theory axioms, i.e., identities and compositions._  
The root object in the model does contain all other objects; there will always be a belonging morphism from an object to the root object. We can draw diagrams over S2 ML models like diagrams are drawn over any other categories. In order to make these diagrams easy to read and faithful to the system, we only show the direct belonging morphisms and morphisms between ports and connections. Any morphism that is a composition or identity still exists in the category, but we do not show them in the diagrams. We have defined morphisms between the objects of the models. Although these morphisms can always be composed, they, in a way, are typed, as their properties can be  
Figure 7: Diagram of the system block from Figure 6.  
used to explain the relationship they express between the objects. The belonging morphisms express that an object is contained in a block. **Definition 13**. : _Belonging Morphism, Direct Belonging Morphism, Ancestor, Parent Let \(M\) be a model, let \(A,B\in Ob(M)\), and let \(f:A\longrightarrow B\) a morphism in \(M\)._  
_We call \(f\) a belonging morphism if and only if \(B\) is a block, and:_  
* \(A\) _is a block, and_ \(f\) _is the identity over this block;_
* \(A\) _is a port, and_ \(f\) _maps_ \(p\in A\) _to_ \(A\in Ob(B)\)_;_
* \(A\) _is a connection, and_ \(f\) _maps any_ \(x\in A\) _to_ \(A\in Ob(B)\)_._  
_If is a belonging morphism, we say that \(B\) is an ancestor of \(A\)._  
_We call \(f\) a direct belonging morphism if it is a belonging morphism and there is no block \(B^{\prime}\in Ob(B)\) such that \(A\in Ob(B^{\prime})\)._  
_If is a direct belonging morphism, we say that \(B\) is the parent of \(A\)._  
We call a morphism a belonging morphism if its target is a block, and it either is similar to the identity when its source is a block or a port, or it maps everything to the connection itself if the source is a connection.