*6.3. Statements and Sketch Constraints*

In this subsection, we outline that first-order sketch constraints give us indeed the means at hand to express the validity of statements in semantic structures, in an equivalent way, by structural properties of sketch encodings of those semantic structures (see Remark 29). In particular, we are interested to extend Makkai's approach and to encode the validity of arbitrary first-order statements in semantic structures by structural properties of atomic sketch encodings.

Thus, we go back to the setting in Section 5.2.2 and assume an Institution of Statements IS = (Cxt, Stm, Int, |=) with Carr Cxt, XE(Ξ) = FE(Ξ) and thus At(*K*) ⊂ Stm(*K*) for all contexts *K* in Cxt, i.e., Stm(*K*) contains all *atomic statements* in *K*.

We consider the instances of Definition 27 and Definition 28, respectively, for the category Cxt of contexts and the functor At : Cxt → Set assigning to each context *K* the set At(*K*) of all atomic statements in *K* as described in Remark 14.

Definition 27 of the syntax of sketch conditions follows exactly the same pattern as Definition 8 of the syntax of feature expression; thus, it should be possible to translate, for any context *K*, the statements in *K* into At-sketch conditions on *K*. This is indeed possible! However, to be able to translate *quantifications*, we have to assume that Cxt has pushouts (compare Appendix A).

**Definition 30** (From Statements to Sketch conditions)**.** *We assume that* Cxt *has pushouts. For an arbitrary but fixed choice of pushouts in* Cxt *we construct inductively and in parallel a*

*family of maps trK* : Stm(*K*) → AT(*K*)*, where K varies over all objects in* Ct*: For arbitry variable declarations X and arbitrary binding morphism γ*: *X* → *K, we define*

	- *2. Everything: trK*(*X*, , *γ*) := *T* ∈ AT(*K*)
	- *3. Void: trK*(*X*, ⊥, *γ*) := *F* ∈ AT(*K*)

*for Q* ∈ {∃, ∀} *where K <sup>ϕ</sup>*<sup>∗</sup> <sup>→</sup> *<sup>K</sup><sup>ϕ</sup> γ γ*∗ <sup>←</sup> *Y is the chosen pushout of K <sup>γ</sup>* <sup>←</sup> *<sup>X</sup> <sup>ϕ</sup>* → *Y.*

**Remark 39** (Translation of Feature Expressions)**.** *Every feature expression X Ex reappears as the statement* (*X*, *Ex*, *idX*)*, thus we can consider X trX*(*X*, *Ex*, *idX*) *as the translation of the feature expression X Ex into a* At*-sketch condition.*

Besides syntax, also Definition 10 of the semantics of feature expressions (and thus Definition 14 of satisfaction of statements) and Definition 28 of satisfaction of sketch conditions (and thus Definition 29 of satisfaction of sketch constraints) follow exactly the same pattern. This enables us to prove straightforwardly that the family of translation maps *trK* : Stm(*K*) → AT(*K*) establishes an equivalence between first-order statements and first-order At-sketch conditions. Note that the proposal in Remark 37 would make the statement in the following proposition even more catchy.

**Proposition 7** (Statements ∼= Sketch Constraints)**.** *For any* Ξ*-structure* U = (*U*, Φ<sup>U</sup> )*, context K, morphism ι* : *K* → *U and statement* (*X*, *Ex*, *γ*) *in K we have:*

$$(\iota, \mathcal{U}) \models\_{\mathbb{K}} (\mathcal{X}, \operatorname{Ex}, \gamma) \quad \text{iff} \quad \mathbb{S}^{\mathcal{U}}\_{\Phi} \models\_{\mathbb{K}} (\operatorname{tr}\_{\mathbb{K}}(\mathcal{X}, \operatorname{Ex}, \gamma), \iota),$$

*where* SU <sup>Φ</sup> = (*U*, *St*<sup>U</sup> <sup>Φ</sup>) *is the atomic sketch encoding of structure* U *as defined by (12).*

Instantiating this equivalence for the identity on *U* gives us exactly what we have been looking for, namely that the atomic sketch encoding of structures in an Institution of Statements encodes likewise all properties of structures that can be expressed by first-order statements and formulas.

**Corollary 7** (Statements ∼= Sketch Constraints)**.** *For any* Ξ*-structure* U = (*U*, Φ<sup>U</sup> ) *and any statement* (*X*, *Ex*, *γ*) *in U we have:*

$$(id\_{II}, \mathcal{U}) \vdash\_{\mathcal{U}} (X, Ex, \gamma) \quad \text{iff} \quad \mathbb{S}^{\mathcal{U}}\_{\Phi} \vdash\_{\mathcal{K}} (tr\_{K}(X, Ex, \gamma), id\_{\mathcal{U}})\_{\Phi}$$

*where* SU <sup>Φ</sup> = (*U*, *St*<sup>U</sup> <sup>Φ</sup>) *is the atomic sketch encoding of structure* U *as defined by (12).*

The case *X* = **0**, and thus *γ* =!*U*, corresponds to closed formulas and, due to Remark 18 (Validity of Closed Formulas), Corollary 7 ensures that we can detect all closed formulas that are valid in U, by inspecting the atomic sketch encoding S<sup>U</sup> Φ.

Proposition 7 and Corollary 7 are very good news for DPF and any other diagrammatic approach to Software Engineering. They ensure that we can describe both structure and constraints in the same diagrammatic, modelcentric format. There is, in principle, no need to combine diagrammatic models with dissimilar descriptions, like OCL code, for example, even if it comes to first-order properties. We can reason about and deal with a real system at a higher level of abstraction within one and the same diagrammatic paradigm!

**Example 51** (CT: Sketch constraints)**.** *Relying on Definition 30 and Remark 39, we can translate all the sample* Ξ*CT-expressions in Example 29 into corresponding sketch conditions. Concerning the* *visual representation, there is no essential difference between a* Ξ*CT-expression and the corresponding sketch condition: We replace by and by <sup>T</sup>. We rewrite* (*\_* ∧ *\_*) *to* {*\_* , *\_*} *and so on. The* Ξ*CT-expressions lec in Example 29 is transformed into the sketch condition*

*and the* Ξ*CT-expressions gec, representing the property* composition is always defined*, is transformed into the sketch condition:*

$$\overline{\mathcal{G}}^{\overline{\mathcal{G}}\overline{\mathcal{C}}} = \mathbf{0} \mapsto \mathbb{V}(\underset{x\mathbf{e}\_1}{\mathbf{x}}) \underset{x\mathbf{e}\_2}{\mathbf{x}} \qquad \stackrel{:}{\mathbb{E}} \Big|\underset{x\mathbf{e}\_1}{\mathbf{x}} \underset{x\mathbf{e}\_1}{\mathbf{x}} \underset{x\mathbf{e}\_2}{\mathbf{x}} \qquad \stackrel{:}{\underset{x\mathbf{e}\_1}{\mathbf{x}}} \Big|\underset{x\mathbf{e}\_2}{\mathbf{x}} \qquad \stackrel{:}{\underset{x\mathbf{e}\_1}{\mathbf{x}}} \Big|\underset{x\mathbf{e}\_3}{\mathbf{x}}$$

*For the sample sketch* <sup>G</sup> = (*G*, *St*G) *in Example 49, we do have* <sup>G</sup> <sup>|</sup>= (*lec*, *<sup>τ</sup>*1)*, with <sup>τ</sup>*<sup>1</sup> *given by the assignments xe*<sup>1</sup> → *a*, *xe*<sup>2</sup> → *b, but* G |= (*lec*, *τ*2)*, with τ*<sup>2</sup> *given by xe*<sup>1</sup> → *b*, *xe*<sup>2</sup> → *c, thus* G |= (*gec*, !*G*)*. General constraints imposing* uniqueness of composition*, independent of the existence of composition, can be formulated by the closed condition guc:*

$$\begin{array}{c} \mathsf{0} \blacktriangleright \forall (\begin{array}{c} xv\_{2} \\ xv\_{1} \end{array} \Big| \begin{array}{c} xv\_{2} \\ xv\_{3} \end{array} \Bigg| \begin{array}{c} xv\_{2} \\ xv\_{3} \end{array} \Bigg| \begin{array}{c} xv\_{2} \\ xv\_{1} \end{array} \Bigg| \begin{array}{c} xv\_{2} \\ xv\_{3} \end{array} \Bigg| \begin{array}{c} xv\_{2} \\ xv\_{1} \end{array} \Bigg| \begin{array}{c} xv\_{2} \\ xv\_{3} \end{array} \Bigg| \begin{array}{c} xv\_{2} \\ xv\_{3} \end{array} \Bigg| \begin{array}{c} xv\_{2} \\ xv\_{1} \end{array} \Bigg| \begin{array}{c} xv\_{3} \\ xv\_{1} \end{array} \Bigg| \begin{array}{c} xv\_{3} \\ xv\_{1} \end{array} \Bigg| \begin{array}{c} xv\_{2} \\ xv\_{3} \end{array} \end{array}$$

*ϕ simply maps xe*<sup>3</sup> *and xe*<sup>4</sup> *to xe.* G *does not satisfy the constraint* (*guc*, !*G*) *but would satisfy it if we delete the edge " f ", for example. The remaining requirements–existence and uniqueness of identities, identity laws and associativity law–can be expressed analogously.*

*Besides formalizing the "laws of a category", we can also take advantage of our knowledge about the properties of the features in* Ξ*CT–or to put it the other way around: We can formulate requirements that any intended semantics of the feature symbols in* Ξ*CT has to comply with. For example, we can require that, for a final object, all outgoing morphisms are monic:*

$$\mathfrak{c}t\_1 := \mathbf{0} \blacktriangleright \forall (\mathfrak{x}v : (\mathfrak{x}v^{\mathfrak{fns1}} \longrightarrow \forall (\mathfrak{x}v \xrightarrow{\mathfrak{x}t} \mathfrak{x}v\_1 : \mathfrak{x}v \xrightarrow[\mathfrak{x}\mathfrak{v}\ ]{\mathfrak{c}} \mathfrak{x}v\_1))))$$

*We can require that monomorphisms are closed under composition:*

*Note that we use* {· · · } *because the single triangle between the curly brackets visualizes, actually, three atomic* Ξ*CT-statements! We can also express our knowledge concerning the decomposition of monomorphisms:*

*ct*<sup>3</sup> := **0** ∀( *xv*<sup>2</sup> *xe*<sup>2</sup> *xv*<sup>1</sup> *xe*<sup>3</sup> *xe*<sup>1</sup> *xv*<sup>3</sup> : ( { *xv*<sup>2</sup> *xe*<sup>2</sup> cmp *xv*<sup>1</sup> *xe*<sup>3</sup> mon *xe*<sup>1</sup> *xv*<sup>3</sup> } −→ *xv*<sup>2</sup> *xe*<sup>2</sup> *xv*<sup>1</sup> *xe*<sup>3</sup> *xe*<sup>1</sup> mon *xv*<sup>3</sup> ))

G |= (*ct*2, !*G*) *simply because there is no match in G of the triangular context in ct*<sup>2</sup> *satisfying the premise of the implication in ct*2*. In contrast,* G |= (*ct*3, !*G*) *with the only counterexample given by the assignments xe*<sup>1</sup> → *c*, *xe*<sup>2</sup> → *d*, *xe*<sup>3</sup> → *g.*

*To be prepared for discussions, later in this section, we consider also the sketch condition mon defining the concept* monomorphism *and obtained by transforming the* Ξ*CT-expressions mon in Example 29:*

$$\overline{mon} = \{xv\_1 \bullet \forall \begin{pmatrix} & & \\ & & \\ xv\_2 & & \\ & & & xv\_3 \end{pmatrix}\_{xv\_1} \}\_{xv\_2} \times \underbrace{\begin{matrix} & xv\_1 \\ & & xv\_2 \\ & & \\ & & xv\_3 \end{matrix}\_{xv\_3}}\_{xv\_1} \times \underbrace{\begin{matrix} & xv\_1 \\ & & \\ & & xv\_2 \\ & & \\ & & & xv\_3 \end{matrix}\_{xv\_2}}\_{xv\_3} \times \underbrace{\begin{matrix} & xv\_1 \\ & & \\ & & \\ & & \\ & & \end{matrix}\_{xv\_3} \end{matrix}\_{xv\_2} \times \underbrace{\exists (\rho, & xv\_1 : T)) \}\_{xv\_3}$$

*where ϕ maps xe*<sup>1</sup> *and xe*<sup>2</sup> *to xe*4*.*

#### *6.4. Sketch Arrows, Constraints, Deduction, Meta-Modeling*

In this subsection, we present vital observations, insights, concepts and ideas to establish a basis for the future further development of the "logic dimension" of Institutions of Statements and, especially of DPF, based on the new concepts and results presented in this paper.
