Skip to main content
Log in

Spider Graphs: a graph transformation system for spider diagrams

  • Regular Paper
  • Published:
Software & Systems Modeling Aims and scope Submit manuscript

Abstract

The use of diagrammatic logic as a reasoning mechanism to produce inferences on subsets of some universe could provide a way to overcome the current limitations of visual modelling methods, which have to be integrated with textual languages to express complex constraints. On the other hand, graph transformations are becoming widespread as a way to express formal semantics for visual modelling languages, so that a mechanisation of diagrammatic logic based on graph transformation would facilitate language integration, based on a common underlying machinery. In this paper, we propose such a mechanisation for spider diagrams (SDs), an established language for reasoning with diagrams modelling relations between sets and constraints on their cardinalities. The concrete syntax of SDs extends that of Euler diagrams that use closed curves and the enclosed regions to represent sets and their intersections. The language is augmented with reasoning rules, i.e. syntactic transformation rules corresponding to logical inference rules. However, these rules are typically defined in procedural terms, so that a completely formal specification and an adequate mechanisation of them has not been achieved yet. We propose an abstract syntax for SDs in terms of typed graphs and define the corresponding language of Spider Graphs (SGs), expressing reasoning rules for SDs as graph transformation units. This enables a direct realisation of the reasoning system via graph transformation tools without resorting to ad hoc implementations, and we provide an implementation in AGG. Techniques for static analysis become available to reason on proof strategies and on possible optimisations.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15
Fig. 16
Fig. 17
Fig. 18
Fig. 19
Fig. 20
Fig. 21
Fig. 22
Fig. 23
Fig. 24
Fig. 25
Fig. 26
Fig. 27
Fig. 28
Fig. 29
Fig. 30
Fig. 31
Fig. 32
Fig. 33
Fig. 34

Similar content being viewed by others

Notes

  1. We consider only a given reasoning system, where each rule represents a valid inference. Incremental construction of SDs could also be specified via a set of rules, but not all of them, e.g. a rule for adding a spider, would be valid inferences.

  2. In this paper we consider only finite graphs, i.e. with \(V\) and \(E\) finite sets.

  3. The left argument of a composition \(\circ \) is the last morphism to be applied.

References

  1. Barwise, J., Etchemendy, J.: Hyperproof. CSLI (1994)

  2. Barwise, J., Etchemendy, J.: Visual information and valid reasoning. In: Allwein, G., Barwise, J. (eds.) Logical Reasoning with Diagrams, pp. 3–25. Oxford University Press, New York (1996)

  3. Bottoni, P., Fish, A.: Coloured Euler diagrams: a tool for visualizing dynamic systems and structured information. In: Proceeding Diagrams 2010, LNCS, vol. 6170, pp. 39–53 (2010)

  4. Bottoni, P., Koch, M., Parisi-Presicce, F., Taentzer, G.: Consistency checking and visualization of OCL constraints. In: Proceedings of the UML 2000, LNCS, vol. 1939, pp. 294–308 (2000)

  5. Bottoni, P., Koch, M., Parisi-Presicce, F., Taentzer, G.: A visualization of OCL using collaborations. In: Gogolla, M., Kobryn, C. (eds.) Proceedings of the UML 2001, LNCS, vol. 2185, pp. 257–271 (2001)

  6. Bottoni, P., Schürr, A., Taentzer, G.: Efficient parsing of visual languages based on critical pair analysis (and contextual layered graph transformation. In: Proceedings of the IEEE-VL’00, pp. 59–61. IEEE CS Press (2000)

  7. Cabot, J., Clariso, R., Riera, D.: Verification of UML/OCL class diagrams using constraint programming. In: Proceedings of the ICSTW ’08, pp. 73–80. IEEE CS Press (2008)

  8. Chow, S.C.: Generating and drawing area-proportional Euler and Venn diagrams. Ph.D. thesis, University of Victoria (2007)

  9. Cordasco, G., De Chiara, R., Fish, A.: Interactive visual classification with Euler diagrams. In: Proceedings of the VL/HCC 2009, pp. 185–192. IEEE CS Press (2009)

  10. Corradini, A., Heindel, T., Hermann, F., König, B.: Sesqui-pushout rewriting. In: Proceedings of the ICGT 2006, LNCS, vol. 4178, pp. 30–45. Springer, Berlin (2006)

  11. Ehrig, H., Ehrig, K., Habel, A., Pennemann, K.H.: Theory of constraints and application conditions: from graphs to high-level structures. Fundam. Inform. 74(1), 135–166 (2006)

    MATH  MathSciNet  Google Scholar 

  12. Ehrig, H., Ehrig, K., Prange, U., Taentzer, G.: Fundamental theory for typed attributed graphs and graph transformation based on adhesive HLR categories. Fundam. Inform. 74(1), 31–61 (2006)

    MATH  MathSciNet  Google Scholar 

  13. Ehrig, H., Ehrig, K., Prange, U., Taentzer, G.: Fundamentals of Algebraic Graph Transformation. Springer, Berlin (2006)

    MATH  Google Scholar 

  14. Ehrig, H., Heckel, R., Korff, M., Löwe, M., Ribeiro, L., Wagner, A., Corradini, A.: Algebraic approaches to graph transformation—part II: single pushout approach and comparison with double pushout approach. In: Rozenberg, G. (ed.) Handbook of Graph Grammars and Computing by Graph Transformations, Volume 1: Foundations, pp. 247–312. World Scientific, Singapore (1997)

    Chapter  Google Scholar 

  15. Ehrig, K., Küster, J.M., Taentzer, G., Winkelmann, J.: Generating instance models from meta models. In: Proceedings of the FMOODS 2006, LNCS, vol. 4037, pp. 156–170. Springer, Berlin (2006)

  16. Ehrig, K., Winkelmann, J.: Model transformation from VisualOCL to OCL using graph transformation. In: Proceedings of the GT-VMT 2006, ENTCS, vol. 152, pp. 23–37 (2006)

  17. Euler, L.: Lettres a une Princesse d’Allemagne sur divers sujets de physique et de philosophie. Letters 2, 102–108 (1775). Berne, Société Typographique

    Google Scholar 

  18. Fish, A.: Euler diagram transformations. In: Proceedings of the GT-VMT 2009, ECEASST, vol. 18. EASST (2009)

  19. Fish, A., Flower, J.: Investigating reasoning with constraint diagrams. In: Proceedings of the VLFM 2004, ENTCS, vol. 127, pp. 53–69. Elsevier (2005)

  20. Fish, A., Flower, J., Howse, J.: The semantics of augmented constraint diagrams. JVLC 16, 541–573 (2005)

    Google Scholar 

  21. Fish, A., John, C., Taylor, J.: A normal form for Euler diagrams with shading. In: Proceedings of the diagrams 2008, LNCS, vol. 5223, pp. 206–221. Springer, Berlin (2008)

  22. Flower, J., Fish, A., Howse, J.: Euler diagram generation. J. Vis. Lang. Comput. 19, 675–694 (2008)

    Article  Google Scholar 

  23. Flower, J., Masthoff, J., Stapleton, G.: Generating proofs with spider diagrams using heuristics. In: Proceedings of DMS-VLC, pp. 279–285. Knowledge Systems Institute (2004)

  24. Flower, J., Masthoff, J., Stapleton, G.: Generating readable proofs: a heuristic approach to theorem proving with spider diagrams. In: Proceedings of Diagrams 2004, LNAI, vol. 2980, pp. 166–181. Springer, Berlin (2004)

  25. Flower, J., Stapleton, G.: Automated theorem proving with spider diagrams. In: Proceedings of Computing: The Australasian Theory Symposium, ENTCS, vol. 91, pp. 116–132. Elsevier (2004)

  26. Goedicke, M., Meyer, T., Taentzer, G.: Viewpoint-oriented software development by distributed graph transformation: towards a basis for living with inconsistencies. In: Proceedings of IEEE RE’99, pp. 92–99 (1999)

  27. Habel, A., Heckel, R., Taentzer, G.: Graph grammars with negative application conditions. Fundam. Inform. 26(3,4), 287–313 (1996)

    MATH  MathSciNet  Google Scholar 

  28. Habel, A., Pennemann, K.H.: Correctness of high-level transformation systems relative to nested conditions. Math. Struct. Comput. Sci. 19(2), 245–296 (2009)

    Article  MATH  MathSciNet  Google Scholar 

  29. Hammer, E., Shin, S.J.: Euler’s visual logic. History and Philosophy of Logic, pp. 1–29 (1998)

  30. Hausmann, J.H., Heckel, R., Taentzer, G.: Detection of conflicting functional requirements in a use case-driven approach: a static analysis technique based on graph transformation. In: Proceedings of ICSE ’02, pp. 105–115. ACM Press (2002)

  31. Heckel, R., Küster, J.M., Taentzer, G.: Confluence of typed attributed graph transformation systems. In: Proceedings of ICGT ’02, LNCS, vol. 2505, pp. 161–176. Springer, Berlin (2002)

  32. Howse, J., Molina, F., Taylor, J., Kent, S., Gil, J.: Spider diagrams: a diagrammatic reasoning system. JVLC 12(3), 299–324 (2001)

    Google Scholar 

  33. Howse, J., Stapleton, G., Taylor, J.: Spider diagrams. LMS J. Comput. Math. 8, 145–194 (2005)

    Article  MATH  MathSciNet  Google Scholar 

  34. Jamnik, M.: Mathematical reasoning with diagrams: from intuition to automation. CSLI (2001)

  35. Kent, S.: Constraint diagrams: visualizing invariants in object-oriented models. In: Proceedings of OOPSLA ’97, pp. 327–341. ACM Press (1997)

  36. Kreowski, H.J., Kuske, S., Schürr, A.: Nested graph transformation units. Int. J. SEKE 7(4), 479–502 (1997)

    Google Scholar 

  37. de Lara, J., Taentzer, G.: Automated model transformation and its validation using AToM3 and AGG. In: Proceedings of Diagrams’04, LNCS, vol. 2980, pp. 182–198 (2004)

  38. Münch, M., Schürr, A., Winter, A.J.: Integrity constraints in the multi-paradigm language PROGRES. In: Selected Papers from TAGT’98, LNCS, vol. 1764, pp. 338–351. Springer, Berlin (2000)

  39. OMG: Meta Object Facility (MOF) 2.0 Query/View/ Transformation, v1.1. http://www.omg.org/spec/QVT/1.1/PDF/ (2011)

  40. Orejas, F., Ehrig, H., Prange, U.: A logic of graph constraints. In: Proceedings of FASE 2008, LNCS, vol. 4961, pp. 179–198. Springer, Berlin (2008)

  41. Rensink, A.: Representing first-order logic using graphs. In: Proceedings of ICGT 2004, LNCS, vol. 3256, pp. 319–335. Springer, Berlin (2004)

  42. Rensink, A., Schmidt, Á., Varró, D.: Model checking graph transformations: a comparison of two approaches. In: Proceedings of ICGT 2004, LNCS, vol. 3256, pp. 226–241 (2004)

  43. Ruskey, F.: A survey of Venn diagrams. Electron. J. Comb. (1997). www.combinatorics.org/Surveys/ds5/VennEJC.html

  44. Shin, S.J.: The Logical Status of Diagrams. CUP, Cambridge (1994)

  45. Sowa, J.: Conceptual Structures: Information Processing in Mind and Machine. Addison-Wesley, London (1984)

    MATH  Google Scholar 

  46. Stapleton, G., Howse, J., Taylor, J.: A decidable constraint diagram reasoning system. J. Log. Comput. 15(6), 975–1008 (2005)

    Article  MATH  MathSciNet  Google Scholar 

  47. Stapleton, G., Masthoff, J., Flower, J., Fish, A., Southern, J.: Automated theorem proving in Euler diagram systems. J. Autom. Reason. 39(4), 431–470 (2007)

    Article  MATH  MathSciNet  Google Scholar 

  48. Stapleton, G., Thompson, S., Howse, J., Taylor, J.: The expressiveness of spider diagrams. J. Log. Comput. 14(6), 857–880 (2004)

    Article  MATH  MathSciNet  Google Scholar 

  49. Swoboda, N., Allwein, G.: Using DAG transformations to verify Euler/Venn homogeneous and Euler/Venn FOL heterogeneous rules of inference. J. Soft. Syst. Model. 3(2), 136–149 (2004)

    Article  Google Scholar 

  50. Taentzer, G.: Parallel and distributed graph transformation—formal description and application to communication-based systems. Berichte aus der Informatik, Shaker (1996)

    Google Scholar 

  51. Thiévre, J., Viaud, M.L., Verroust-Blondet, A.: Using Euler diagrams in traditional library environments. In: Proceedings of Euler Diagrams’2004, ENTCS, vol. 134, pp. 189–202 (2005)

  52. Urbas, M., Jamnik, M., Stapleton, G., Flower, J.: Speedith: a diagrammatic reasoner for spider diagrams. In: Proceedings of Diagrams 2012, LNCS, vol. 7352, pp. 163–177. Springer, Berlin (2012)

  53. Warmer, J., Kleppe, A.: The Object Constraint Language: Precise Modeling with UML. Addison-Wesley, London (1999)

    Google Scholar 

  54. Zykov, A.: Hypergraphs. Russ. Math. Surv. 29(6), 89–156 (1974)

    Article  MathSciNet  Google Scholar 

Download references

Acknowledgments

We thank the anonymous referees for many insightful comments on the previous version which have helped us to greatly improve the paper. Thanks to John Taylor for comments on an early draft. Andrew Fish was partially funded by UK EPSRC grants EP/E011160: Visualisation with Euler Diagrams and EP/J010898/1: Automatic Diagram Generation. We also thank the AGG team, in particular Claudia Ermel and Olga Runge, for assistance with the implementation.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Andrew Fish.

Additional information

Communicated by Prof. Robert France.

Appendix: Presentation of rules 1–4,7

Appendix: Presentation of rules 1–4,7

We complete the presentation of the TUs realising the whole reasoning system, and for each of them, we prove its correctness.

Rule 1   [Introduction of a strand] Figure 35 shows the rule for adding strands, realising the first alternative for Rule 1, where a NAC (not shown here) prevents the formation of the forbidden graph (\(F1\)) in Fig. 8. Figure 36 shows the rule for the second alternative, replacing a tie by a strand. In both cases, the rule receives as parameters the labels associated with the spiders to be connected and picks non-deterministically a zone inhabited by both spiders. The resulting TU is a choice between the two rules.

$$\begin{aligned}&IntroduceStrand (\mathtt{S1,S2}) =(\mathtt{addStrand(S1,S2)} \mid \\&\quad \mathtt{replaceTieWithStrand(S1,S2)}) \end{aligned}$$
Fig. 35
figure 35

Rule addStrand(S1,S2)

Fig. 36
figure 36

Rule replaceTie WithStrand(S1,S2)

Lemma 4

The TU IntroduceStrand realises Rule 1 of the SD system.

Proof

The SD rule corresponds to two separate \(SD\) specifications:

figure f
figure g

The SG rules addStrand and replaceTieWithStr and clearly realise these specifications. Note that the condition \((\{s,t\},z)\not \in \tau \cup \upsilon \) for the first rule is guaranteed by its NAC. \(\square \)

Rule 2   [Extension of habitat] The spider to be extended is chosen by passing a parameter S to the TU, which will pass it on to the invoked rules. The zone in which to extend the chosen spider, and the spiders that are to have connections (of different types) with it added are chosen non-deterministically. The process is managed by a TU with control expression:

$$\begin{aligned}&\!\!\!\!\!ExtendHabitat(\mathtt{S}) =\\&\!\!\mathtt{extendSpiderToZone(S)};\\&\!\!\mathbf{asLongAsPossible}~~ \mathtt{markSpiderForConnections(S)}~~ \mathbf{end};\\&\!\!\mathbf{asLongAsPossible}~~ (\mathtt{addStrandForNewExtension(S)} \mid \\&\!\! \mathtt{addTieForNewExtension(S)} \mid \mathtt{noConnectionAddded})~\, \mathbf{end};\\&\!\! \mathtt{removeMarkFromZone}; \end{aligned}$$

The process starts with rule extendSpiderToZone in Fig. 37. A new inhabits edge is drawn from the chosen spider to a zone, which is marked to specialise the context for the rest of the TU.

Fig. 37
figure 37

Rule extendSpiderToZone

The iteration on rule markSpiderForConnections in Fig. 38 marks each spider, other than the chosen one, inhabiting the marked zone as a candidate for connection. All marks are removed in the second iteration within the TU, where for each candidate spider, a choice is made of whether to add a strand from the chosen spider to the candidate one, to add a tie or do neither. We only present the rule for adding a tie in Fig. 39, the case for strand being analogous; the third alternative simply removes the mark from the candidate spider.

Fig. 38
figure 38

Rule markSpiderForConnections

Fig. 39
figure 39

Rule addTie ForNewExtension

Finally, the mark is removed from the zone (rule remove MarkFromZone, not shown here). In Lemma 5, in order to track the effects of marking in the SG, we introduce a new temporary set \(M\subset \mathcal Z \cup \mathcal C \cup \mathcal S \), and we refer to this in the specification of the rules within the TU.

Lemma 5

The TU ExtendHabitat realises Rule 2 of the SD system.

Proof

The SD rule has specification:

figure h

The rules extendSpiderToZone(18), markSpider ForConnections(19) and addStrandForNewExten sion addTieForNewExtension noConnectionAdd ed(20) in the TU have effects as follows:

$$\begin{aligned}&\!\!\!\!z\not \in {h(s)}\cup {M} \vdash {z}\in {h'(s)}\cap {M'}.\end{aligned}$$
(18)
$$\begin{aligned}&\!\!\! \!z\in {h(s)}\cap {M}\wedge \exists {t}\!\in \!\mathcal S [z\in {h(t)}\wedge {t}\notin {M}] \vdash {t}\!\in \!{M'}.\end{aligned}$$
(19)
$$\begin{aligned}&\begin{aligned}&\!\!\!z\!\in {h(s)}\cap {M}\wedge \exists {t}\in \mathcal S [z\in {h(t)}\wedge {t}\\&\quad \in {M}\wedge (\{s,t\},z)\notin \tau \cup \upsilon ] \vdash (\{s,t\},z)\\&\quad \in \tau '\wedge {t}\notin {M'}. \\&\!\!\!\! z\in {h(s)}\cap {M}\wedge \exists {t}\in \mathcal S [z\in {h(t)}\wedge {t}\\&\quad \in {M}\wedge (\{s,t\},z)\notin \tau \cup \upsilon ] \vdash \\&(\{s,t\},z)\in \upsilon '\wedge {t}\notin {M'}. \\&\!\!\! z\in {h(s)}\cap {M}\wedge \exists {t}\in \mathcal S [z\in {h(t)}\wedge {t}\\&\quad \in {M}\wedge (\{s,t\},z)\notin \tau \cup \upsilon ] \vdash \\&\quad t\notin {M'}. \end{aligned} \end{aligned}$$
(20)

To see that effect of the TU complies with the SD specification, suppose that we have \(z\in \mathcal Z \wedge {z}\not \in {h(s)}\). Then, by entailment (18), the habitat of \(s\) is extended, satisfying the outer post-condition, and the zone \(z\) is marked, ensuring that subsequent rules apply only to this chosen zone. Entailment (19) marks any other spider that also inhabits the zone \(z\). The alternative rules have effects that correspond to the three alternative nested pre–post-condition pairs in the SD specification [see entailment (20)]. The removal of the mark from the spider for each rule application ensures that each marked spider triggers exactly one of these alternative rules once only, and so the process terminates. All of the marks have been removed in the post-state: the marks of the spiders by the above process, while the removeMarkFromZone rule precisely ensures that \(z\not \in M\) in the post-state. \(\square \)

Before we consider Rule 3, we need some notation.

Definition 7

Let \(G(z), Con(s,z)\) and \(Con_s(t,z)\) denote the strand–tie graph within zone \(z\), the set of vertices in the connected component of \(s\) in \(G(z)\) and the set of vertices in the connected component of \(t\) in \(G(z){\setminus }\{s\}\), respectively.

Rule 3   [Erasure of a spider] The deletion of a spider \(s\) is prepared by the deletion of all its connections to other spiders, reconstructing the connectedness of the ‘strand–tie graph’ in all the zones inhabited by \(s\), when needed. To this end, we compute the separate connected components resulting from the removal of \(s\), where each component has at least one spider that was directly connected to \(s\) in the original graph and which is taken as the representative of the component. The process is started by selecting one representative (of one connected component of the strand–tie graph in the given zone after the deletion of \(s\)) via the rule startComputation(S) of Fig. 40, while the marking of the spiders in a connected component is achieved with rule computeConnectedComponent of Fig. 41. The two NACs prevent the original spider \(s\), or an already marked spider, from being marked. Connections are then created between the representative of the computed component and another component (recognised by being directly connected to \(s\) but not marked) to ensure that connectedness of the strand–tie graph is not affected by the deletion of \(s\), through rule createStrandToOtherComponent of Fig. 42.

Fig. 40
figure 40

Rule startComputation

Fig. 41
figure 41

Rule compute ConnectedComponent

Fig. 42
figure 42

Rule createStrandToOtherComponent

The representative of the reached component is also marked, so that the process (of computing the connected component and then extending it by adding a connection) can be iterated, until all the spiders directly connected to the \(s\) are now directly or indirectly connected with one another (i.e. lie in the same component).

$$\begin{aligned}&EraseSpider (\mathtt{S}) =\\&\quad \mathbf{asLongAsPossible}\\&\qquad \mathtt{startComputation(S)};\\&\qquad \mathbf{asLongAsPossible}\\&\qquad \qquad \mathbf{asLongAsPossible}\,\, \mathtt{computeConnected}\\&\qquad \qquad \qquad \mathtt{Component(S)}\,\, \mathbf{end};\\&\qquad \qquad \mathbf{asLongAsPossible}\,\, \mathtt{createStrandToOther}\\&\qquad \qquad \qquad \mathtt{Component(S)} \,\,\mathbf{end};\\&\qquad \mathtt{removeZoneMark}\,\, \mathbf end ;\\&\quad \mathbf{end};\\&\quad \mathbf{asLongAsPossible}\,\, \mathtt{removeConnection(S)}\,\, \mathbf{end};\\&\quad \mathbf{asLongAsPossible}\,\, \mathtt{removeSpiderMark} \,\,\mathbf{end};\\&\quad \mathtt{deleteSpider(S)} \end{aligned}$$

At the end of this iteration, all the connections associated with the spider can be removed by rule removeConnec tion in Fig. 43 (left), whose SPO application also removes the connects edge to any other spider, and the spider is finally deleted by rule deleteSpider in Fig. 43 (right). Note that the NAC would make this rule fail if the spider inhabited some shaded zones, making the whole TU fail. Such a check could also be performed by an additional rule at the beginning of the process.

Fig. 43
figure 43

Rules removeConnection and deleteSpider

Lemma 6

The TU EraseSpider realises Rule 3 of the SD system.

Proof

The SD rule has specification:

figure i

The rules startComputation(21), computeConne ctedComponent(22), createStrandToOtherComp onent(23), removeConnection(24), delete- Spid er(25) in the TU have effects as follows:

$$\begin{aligned}&\begin{aligned}&z\in {h(s)}\cap {h(t_1)}\cap {h(t_2)}\\&\quad \wedge (\{s,t_1\},z),(\{s,t_2\},z)\in \tau \cup \upsilon \wedge \\&\quad (\{t_1,t_2\},z)\not \in \tau \cup \upsilon \vdash {z,t_1}\in M'. \end{aligned}\end{aligned}$$
(21)
$$\begin{aligned}&\begin{aligned}&z,t_1\in {M}\wedge {t_2}\not \in {M}\wedge {t_2}\ne {s}\wedge {z}\in {h(t_1)}\cap {h(t_2)}\wedge \\&\quad (\{t_1,t_2\},z)\in \tau \cup \upsilon \vdash {t_2}\in {M'}. \end{aligned}\end{aligned}$$
(22)
$$\begin{aligned}&\begin{aligned}&z\in {h(s)}\cap {h(t_1)}\cap {h(t_2)}\wedge {z},t_1\in {M}\wedge {t_2}\not \in {M}\\&\quad \wedge (\{s,t_2\},z)\in \tau \cup \upsilon \\&\quad \vdash (\{t_1,t_2\},z)\in \upsilon '\wedge {t_2}\in {M'}. \end{aligned}\end{aligned}$$
(23)
$$\begin{aligned}&z\in {h(s)}\wedge (\{s,t\},z){\in }\tau \cup \upsilon \vdash (\{s,t\},z)\not \in \tau '\cup \upsilon '.\end{aligned}$$
(24)
$$\begin{aligned}&h(s)\cap \mathcal Z ^*=\emptyset \vdash {s}\not \in \mathcal S '. \end{aligned}$$
(25)

We consider the effects of the nested part of the control condition of the TU, before considering the SD specification. The startComputation rule finds, and marks, an arbitrary (representative) spider \(t_1\) that is connected to spider \(s\) but is not connected to every other spider that \(s\) is connected to [see entailment (21)]. If there are no such spiders, then the removal of spider \(s\) cannot disconnect the strand–tie graph in \(z\) since every pair of spiders connected to \(s\) within \(z\) are already connected to each other; note that in this case no match for this SG rule is found and the TU proceeds to removeConnection. Otherwise, iterating computeConnectedComponent (see entailment (22)) repeatedly marks every spider (except for \(s\) itself) which is connected to a marked spider (by a connection), ending when all of \(Con_s(t_1,z)\) is marked. If there is a spider \(t_2\) such that \(t_2\not \in {Con_s}(t_1,z)\) (hence \(t_2\) is not marked) but there is a connection between \(s\) and \(t_2\) within \(z\), then rule createStrandToOtherComponent [see entailment (23)] adds a strand between \(t_2\) and \(t_1\) within \(z\). The iteration in the control condition marks all of the extended connected component (which is the union of the original connected components of \(t_1\) and \(t_2\) together with the new strand that joins them). This is repeated until there is only a single connected component. At this point, the deletion of the spider \(s\) will not disconnect the strand–tie graph. The removeZoneMark rule just removes the marking on the zone. So, the total effect of this nested part of the control condition is to add enough strands to ensure that the deletion of spider \(s\) does not disconnect any component of the strand–tie graph, satisfying the inner pre-/post-condition pair. Now, suppose we have a spider \(s\) such that \(h(s)\cap \mathcal Z ^*=\emptyset \), so the precondition of the eraseSpider SD rule is satisfied. Then, removeConnection [see entailment (24)] removes all connection nodes involving \(s\), and deleteSpider [see entailment (25)] removes \(s\), satisfying the outer post-condition. \(\square \)

Rule 4   [Erasure of shading] Shading can be erased from any shaded zone as shown in Fig. 44 for rule eraseShading.

Fig. 44
figure 44

Rule eraseShading: erasing shading from a zone

Lemma 7

The rule eraseShading realises Rule 4 of the SD system.

Proof

The rule effect clearly satisfies the SD rule specification given by:

figure j

\(\square \)

Rule 7   [Equivalence of Venn and Euler forms] The final rule establishes the equivalence between SDs in Euler and Venn forms, meaning that they have underlying EDs or VDs (which have no missing zones), by showing how to transform one form into the other. We first present the TU for adding missing zones, in which missing zones can be progressively introduced as the twins of existing zones, as defined by the control condition:

$$\begin{aligned}&AddMissingZones() =\\&\quad \mathbf{asLongAsPossible}\quad \mathtt{addMissingTwin};\\&\qquad \mathbf{asLongAsPossible}\quad \mathtt{completeInsideRelations}\quad \mathbf{end};\\&\quad \mathtt{removeTwin}\\&\mathbf{end} \end{aligned}$$

Rule addMissingTwin in Fig. 45 creates a new zone \(z_1\) and marks it as twin of some existing zone \(z_2\), outside some curve \(c\). The zone \(z_1\) is inside the boundary curve and \(c\), and \(twin_c(z_1,z_2)\) will hold at the end of the TU.

Fig. 45
figure 45

Rule addMissingTwin

The GAC in Fig. 46 checks that \(z_2\) lacks a twin. The newly created \(z_1\) must be inside all but only the curves that contain \(z_2\), as guaranteed by rule completeInsideRelations in Fig. 47. A NAC, not shown here, ensures that only one inside edge is created between a zone and a curve. The rule removeTwin (not shown here) is then applied to remove all twin edges, before proceeding with identifying and constructing the next twin.

Fig. 46
figure 46

A graphical representation of the GAC for identifying missing twins, to be checked on each match \(m\) for the LHS of the rule addMissingTwin in Fig. 45. The associated formula reads: ‘for all matches \(m_1:g_1\rightarrow {G}\) of the graph \(g_1\) in the outer \(\forall \)-box extending \(m\), it is not the case that there exists a match \(m_2:g_2\rightarrow {G}\) of the graph \(g_2\) in the outer \(\wedge \)-box extending \(m_1\) such that, for each match \(m_3:g_3\rightarrow {G}\) of the graph \(g_3\) in the next \(\forall \)-box extending \(m_2\), either a match extending \(m_3\) exists for the graph in the \(\vee \)-box, or neither of the two graphs in the \(\lnot \)-boxes has a match extending \(m_3\)

Fig. 47
figure 47

Rule completeInsideRelations

We also consider the opposite transformation, from Venn to Euler, by which any shaded uninhabited zone can be erased (provided it is not the last zone inside any curve), realised by the TU whose control expression is:

$$\begin{aligned}&EraseShadedZone() =\\&\qquad \mathbf{asLongAsPossible} \quad \mathtt{markShadedZone}\quad \mathbf{end};\\&\qquad \quad \mathbf{asLongAsPossible} \quad (\mathtt{deleteMarkedZone} \mid \\&\qquad \qquad \qquad \quad \mathtt{removeMarkFromZone}) \quad \mathbf{end}; \end{aligned}$$

In order to simulate a non-deterministic choice of the zones to be deleted, we first iterate on rule markShaded Zone (see Fig. 48) to mark all shaded zones satisfying the following conditions: (1) the zone is not the only one inside a curve (checked in the LHS of the rule and in the GAC of Fig. 49, where the different ways in which a second zone can be inside a curve are presented) and (2) the zone is not inhabited by any spider (checked in the NAC). After that, an iteration is performed on the alternative between deleting a marked zone and simply removing the mark.

Fig. 48
figure 48

Rule markShadedZone

Fig. 49
figure 49

A graphical representation of the GAC for checking that the zone is not the only one inside a curve, to be checked on each match \(m\) for the LHS of the markShadedZone rule in Fig. 48. The associated formula reads: ‘for any match \(m_1:g_1\rightarrow {G}\) of the graph \(g_1\) in the \(\forall \)-box extending \(m\), at least one of the two graphs inside the \(\vee \)-box has a match extending \(m_1\)

Lemma 8

The TUs for AddMissingZones and EraseShadedZone realise Rule 7 of the SD system.

Proof

The addition of all of the missing zones is specified as:

figure k

The rule addMissingTwin in the TU (where the GAC is written in square brackets) followed by the complete InsideRelations rule has effect:

$$\begin{aligned} \begin{aligned} c_1\in \mathcal C \wedge {z_2}&=(X_2\cup \{u\},Y_2\cup \{c_1\})\in \mathcal Z \wedge \\ \forall {z_4}\in \mathcal Z [\lnot {z_4}&=(X_4\cup \{c\},Y_4)\wedge \forall {c_5}\\&\qquad \in \mathcal C [{z_2}=(X_5\cup \{c_5\},Y_5)\wedge \\ z_4&=(X_6\cup \{c_5\},Y_6)\vee (z_2\!=\!(X_5,Y_5\cup \{c_5\})\wedge \\ z_4&=(X_6,Y_6\cup \{c_5\}))]]\vdash {z_1}\\&=(X\cup \{c_1,u\},Y)\in \mathcal{Z ^*}'. \end{aligned} \end{aligned}$$
(26)

In the post-state of the SG after completing the iteration, \(twins_c(z_1,z_2)\) holds. After the addMissingTwin rule, the Zone node for \(z_1=(\{u,c\},Y)\) is not a correct twin for \(z_2\) yet, but is related to \(z_2\) via a twin indicator. Immediately afterwards, iterating the rule completeInsideRelations adds all of the inside edges from \(z_1\) to the same set of curves as \(z_2\), as required to ensure that it represents the required missing twin zone.

The above ensures that the addition of any missing twin zone can be achieved. It remains to show that one can just add missing twin zones to any SD in order to create the Venn form. Since any SD has an outermost zone, we can consider if there is any curve which does not have a zone which is inside only that curve (and the boundary curve). Such a zone would be a twin of the outermost zone w.r.t. that curve. The addition of any such missing zone ensures that every zone inside exactly the boundary curve and one other curve is present. Then we consider if there are any missing zones that are inside exactly two curves (plus the boundary curve), which are twins of the zones that are inside one curve (plus the boundary curve). Continuing this process ensures that all missing zones are added.

The removal of some of the shaded zones that are not inhabited by any spider (and do not contain the last zone within any curve) is specified as:

figure l

The markShadedZone rule is specified by entailment (27) (with the GAC indicated within the second pair of square brackets):

$$\begin{aligned} \begin{aligned} z_1&=(X_1\cup \{u,c\},Y_1)\in \mathcal Z ^*\wedge {z_2}=(X_2\cup \{u,c\},Y_2){\in }\mathcal Z \wedge \\&(\lnot \exists {s}\in \mathcal S \bullet {z_1}\in {h(s)})\wedge (\forall {c_k}\in \mathcal C {\setminus }\{u,c\}\\&\quad \bullet ({z_1}{=}(X_1\cup \{u,c,c_k\},Y_1))\wedge ((\exists {z_3}{=}(X_3\cup \{c_k\},Y_3))\!\!\! \\&\vee (\exists {z_2}=(X_2\cup \{u,c,c_k\},Y_2)))) \vdash {z_1}\in {M'}. \end{aligned} \end{aligned}$$
(27)

This marks a set of shaded zones. During the following iteration, at each step one of deleteMarkedZone or removeMarkFromZone is selected. The effect of the two rules is described in entailments (28) and (29), respectively.

$$\begin{aligned}&z\in \mathcal Z ^*\cap {M}\vdash {z}\not \in \mathcal Z '\wedge {z}\not \in {M'}.\end{aligned}$$
(28)
$$\begin{aligned}&z\in \mathcal Z ^*\cap {M}\vdash {z}\in \mathcal Z '\wedge {z}\not \in {M'}. \end{aligned}$$
(29)

After the iteration is performed, a (possibly empty) subset of \(\mathcal Z ^*\) has been removed and no zone is marked. \(\square \)

Rights and permissions

Reprints and permissions

About this article

Cite this article

Bottoni, P., Fish, A. & Parisi Presicce, F. Spider Graphs: a graph transformation system for spider diagrams. Softw Syst Model 14, 1421–1453 (2015). https://doi.org/10.1007/s10270-013-0381-1

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10270-013-0381-1

Keywords

Navigation