*3.5. Institutions of Statements*

Generalizing concepts like *set of generators* in Group Theory, *underlying graph of a sketch* in Category Theory, *set of individual names* in Description Logics and *underlying graph of a model* in Software Engineering, we introduce in this section the concept of a *context* as one of our main conceptual and methodological proposals. Furthermore, we introduce the concept *statement (in a context)* in generalizing the corresponding concepts defining relation in Group Theory, diagram in a sketch in Category Theory, concept/role assertion in Description Logic and constraint in Software Engineering. We use institutions [2,31] as a methodological guideline to define and present the formalisms build upon these new concepts.

3.5.1. Category of Contexts and Sentence Functor

As **abstract signatures** in an Institution of Statements, we introduce contexts.

**Definition 11** (Seventh parameter: Contexts)**.** *As the seventh parameter of an Institution of Statements, we choose another subcategory* Cxt *of* Base*. The objects in* Cxt *are called contexts while we refer to the morphisms in* Cxt *as context morphisms.*

*If* Base *has initial objects, we assume that* Cxt *contains, at least, one of them denoted by* **0***.*

Even if Cxt is called the "seventh parameter", the choice of Cxt relies only on the chosen Base and does not depend on all the other parameters we introduced (see Figure 1)!

**Remark 13** (Variables vs. context vs. carrier)**.** *Introducing contexts, we establish a technological layer independent of "pure syntax" (variables) and "pure semantics" (carriers of structures) as we postulated it in Requirement 2 (p. 3). We prefer to consider variable declarations as something finite or enumerable while contexts can be arbitrary.*

*In case* Var *is a subcategory of* Cxt*, we perceive the inclusion* Var Cxt *as a* change of roles*: Variables are essentially syntactic items but can also serve as* generators of structures*, like groups and (term) algebras, for example.*

*If we are interested in completeness proofs and corresponding freely generated structures, we have to suppose* Carr Cxt*. Coming back to the discussion in Section 1.1.1, the introduction of contexts allows us to keep syntax and semantics separated and to avoid, in such a way, certain kinds of circularity in the definition of formalisms.*

**Example 31** (FOL: Context)**.** *PROLOG distinguishes between* atomic values (literals) *and* (logical) variables*. Literals can be either* number literals *or* symbolic literals*.*

*Our choice of contexts reflects this line of tradition. We define* Cxt*FOL as the subcategory of* Carr*FOL* <sup>=</sup> Base*FOL* <sup>=</sup> Set*<sup>S</sup> given by all S-sets <sup>K</sup>* = (*Ks* <sup>|</sup> *<sup>s</sup>* <sup>∈</sup> *<sup>S</sup>*) *with Ks a finite set of literals and logical variables for all s* ∈ *S.*

*For the sample footprint* Ξ*FOL* = (Φ*FOL*, *αFOL*) *with S* = {*prs*, *nat*} *(see Example 11), we consider a sample context K with Knat the set of all natural numbers from* 0 *to* 200 *and Kprs* = {*Anna*, *Michael*, *Dora*, *Heinz*, *Sorin*, *Gabi*, *Uwe*}*.*

**Example 32** (ALC: Context)**.** *This example has been chosen since it works explicitly with contexts in our sense. ALC uses the term* individual name *instead of* symbolic literal *and contexts in ALC are* sets *NO* of individual names*.*

**Example 33** (mFOL: Context)**.** *In this example, we describe the traditional formalism* manysorted first-order logic without functions *as such; thus, a context should declare finite sets of sort and predicate symbols, respectively.*

*Analogously to the definition of* Var*mF in Example 8, we assume an enumerable set PSym of admissible predicate symbols and an enumerable set SSym of admissible sort symbols.* Cxt*mF is then the full subcategory of* Set/*MmF given by all finite MmF-typed sets* (*K*, *τ<sup>K</sup>* : *K* → *MmF*) *such that τ*−<sup>1</sup> *<sup>K</sup>* (*S*) <sup>⊆</sup> *SSym and <sup>τ</sup>*−<sup>1</sup> *<sup>K</sup>* (*P*) ⊆ *PSym.*

*To be able to reconstruct the sample FOL-footprint* Ξ*FOL* = (Φ*FOL*, *αFOL*) *(see Example 11), we choose for the sample mFOL-footprint* Ξ*mF* = (Φ*mF*, *αmF*) *in Example 13 the sample context* (*K*, *<sup>τ</sup><sup>K</sup>* : *<sup>K</sup>* <sup>→</sup> *MmF*) *with <sup>τ</sup>*−<sup>1</sup> *<sup>K</sup>* (*S*) :<sup>=</sup> {*prs*, *nat*} *and <sup>τ</sup>*−<sup>1</sup> *<sup>K</sup>* (*P*) := {parent, male, age, less}*.*

**Example 34** (CT: Context)**.** *We simply choose* Cxt*CT* := Carr*CT* = Base*CT* = Graph*. As an example, we consider the following finite graph G.*

**Example 35** (RM: Context)**.** *A context in this example declares the items in a database schema, i.e., a finite graph with table identifiers, datatype identifiers, and column identifiers, respectively. Analogously to Example 33, we assume an enumerable sets TId of admissible table identifiers, DId of admissible datatype identifiers and C Id of admissible column identifiers, respectively.*

*As* Cxt*RM, we choose the full subcategory of* Graph/*MRM given by all finite MRM-typed graphs* (*K*, *<sup>τ</sup><sup>K</sup>* : *<sup>K</sup>* <sup>→</sup> *MRM*) *such that <sup>τ</sup>*−<sup>1</sup> *<sup>K</sup>* (*T*) <sup>⊆</sup> *TId, <sup>τ</sup>*−<sup>1</sup> *<sup>K</sup>* (*D*) <sup>⊆</sup> *DId and <sup>τ</sup>*−<sup>1</sup> *<sup>K</sup>* (*c*) ⊆ *CId. We intend to formalize the database schema, discussed in Section 3.1.5, and consider the sample RM-context* (*K*, *τK*) *as depicted in the following diagram.*

*Note that both tables do have a column with name ssn; thus, we distinguish between them by means of the table identifiers.*

Feature expressions can be utilized to make statements in a certain context. Those *statements in context* are the **sentences** in an Institution of Statements.

**Definition 12** (Statement)**.** *An* XE(Ξ)*-statement* (*X*, *Ex*, *γ*) *in context K* ∈ Cxt*Obj is given by a feature* Ξ*-expression X Ex in* XE(Ξ, *X*) *and a binding morphism γ*: *X* → *K in* Base*. By* Stm(*K*)*, we denote the set of all* XE(Ξ)*-statements in K.*

Statements are part of sketches and examples of sketches are presented in Section 5.

**Remark 14** (Atomic statements)**.** *For a feature symbol F* ∈ Φ *and a context K there can be different variable declarations X, X , morphisms β* : *αF* → *X, β* : *αF* → *X and binding morphisms γ* : *X* → *K, γ* : *X* → *K such that β*; *γ* = *β* ; *γ . That is, the distinct statement expressions* (*X*, *F*(*β*), *γ*) *and* (*X* , *F*(*β* ), *γ* ) *represent somehow the "same statement" in K.*

*We choose therefore a kind of normal form to define the concept* atomic statement*: Atomic statements in context K are statements of the form* (*αF*, *F*(*idαF*), *γ*)*, γ* : *αF* → *K. For any context K we denote by* At(*K*) *the set of all atomic statements in K.*

*In abuse of notation, we will sometimes use for atomic statements the same notation F*(*γ*) *as for atomic expressions. Thus, we can, in the examples, take advantage of our notational conventions based on the idea of "associative arrays".*

**Remark 15** (General statements and closed formulas)**.** *If* Base *has an initial object* **0***, there is for any closed expression* **0** *Ex (see Remarks 8 and 12) a unique initial morphism γ* =!*<sup>K</sup>* : **0** → *K; thus, we have* (**0**, *Ex*, !*K*) ∈ Stm(*K*) *for any context K and all the closed expressions* **0** *Ex in* XE(Ξ, **0**)*. We call* (**0**, *Ex*, !*K*) *a general statement in K.*

*The general statements in* Stm(**0**)*, i.e., statements of the form* (**0**, *Ex*, *id***0**) *are the precise formal counterpart of traditional closed formulas within our framework. Be aware that there may be statements* (*X*, *Ex*, *γ* : *X* → **0**) *in* Stm(**0**) *with X non-initial.*

**Remark 16** (Expression vs. statement)**.** *The idea behind our definition of statements is to encapsulate the relatively intricate construction of first-order syntactic entities and do it once and for all. In such a way, we achieve the following objectives: (1) There is no need to lift arbitrary "semantic entities", like elements in the carrier of a structure, to the syntactic level. (2) We can define and work with first-order statements in arbitrary base categories. (3) We do not depend on translation maps (compare Definition A1 in Appendix A) to translate first-order statements. (4) The translation of first-order statements is simply performed by composition in the category* Base*!*

*This encapsulation trick we have seen in [31] where it is used for "initial/free constraints".*

Any morphism *ϕ* : *K* → *G* in Cxt induces a map Stm(*ϕ*): Stm(*K*) → Stm(*G*) defined by simple post-composition for all statements (*X*, *Ex*, *γ*) in *K*:

$$\mathsf{Stm}(\mathfrak{q})(X,\mathsf{Ex},\gamma) := (X,\mathsf{Ex},\gamma;\mathfrak{q})\tag{2}$$

It is easy to show that the assignments *K* → Stm(*K*) and *ϕ* → Stm(*ϕ*) provide a functor Stm: Cxt → Set. This is the **sentence functor** of an Institution of Statements.
