5.1. Sketches of Statements: Syntax and Semantics
To be prepared for the topics in
Section 6, we introduce a very abstract and semantics-independent concept of
sketch.
Definition 16 (Sketch). Let us have a category of contexts and a functor , assigning to each a set of all statements in context K.
An- sketch is given by a context and a set of statements in context K.
In this subsection, we consider the case , with an arbitrary Institution of Statements according to Theorem 1.
All definitions and constructions are, however, institution-independent; thus, they apply analogously to the case , with an arbitrary Institution of Equations according to Proposition 2.
Example 36 (FOL: Sketches). We extend the sample context K in Example 31 to an -sketch with the atomic statements (facts) , , and the proper first-order statements , , , . The expression , representing the property being sibling of someone, and the expression , representing the property younger than, are defined in Example 26.
Example 37 (ALC: Sketches). Contexts in ALC are sets of individual names as already mentioned in Example 32. A concept assertion in ALC, i.e., a statement of the form with and a (derived) concept, can be seen as a statement in where the assignment defines a binding with .
A role assertion, i.e., a statement of the form where and is a role, can be seen as a statement in . An ABox in ALC is a finite set of assertional axioms. Thus, a pair of a set of individual names and an ABox of assertional axioms in is just an -sketch in our sense.
Example 38 (mFOL: Sketches). We extend the context in Example 33 to an -sketch with the atomic statements , , and .
Obviously, this -sketch describes exactly the sample footprint in Example 11! Actually, we can describe all FOL-footprints, declaring only unary, binary or tertiary predicate symbols, as -sketches. This fact confirms that the mFOL-example establishes indeed a meta-level for the FOL-example.
We have to be aware, however, that not all -sketches correspond to FOL-footprints. For each predicate symbol in a FOL-footprint, we have to declare an arity, and this arity should be unique! Therefore, only those -sketches, with exactly one atomic statement for each element in correspond to FOL-footprints. To describe those requirements concerning the structure of sketches, we can utilize sketch implications
, introduced in the next subsection, and/or sketch constraints
introduced in Section 6. Example 39 (CT: Sketches). These are just the sketches, as we know them from Category Theory, with the essential difference that we are not restricting ourselves to commutative, limit and colimit statements only. We do not need to encode, for example, the concept monomorphism by means of pullbacks but can define it directly as a property of edges utilizing the -expressions we discussed in Example 29.
As an example, we consider the context G from Example 34 and extend it to an -sketch visualized above. contains the atomic statements , , and the proper first-order statements:
, , .
Example 40 (RM: Sketches). We extend the sample context from Example 35 to an -sketch . First, we declare two tables, i.e., contains two atomic statements , with bindings and visualized by the following typed graphs:
Then, we declare for each table a primary key, i.e., we add two atomic statements , with bindings , given by and . Moreover, we declare a foreign key with depicted by .
We could also require that each employee has a name and add an atomic statement with given by .
Analogously to the requirements in Example 38, we do have the requirement that a table identifier can only appear once in a -statement. There are, however, other database specific requirements: Any table should have exactly one primary key, a foreign key has to refer to a primary key, and others. As said before, to describe those kinds of structural requirements, we need sketch implications and/or sketch constraints. □
For any context
K in
, any set
of statements in
K and any interpretation
of context
K in a
-structure
we define, relying on Definition 14:
Be aware that the statements in
S may have different variable declarations
X.
Definition 17 (Interpretation of sketch). A valid interpretation (model)of an -sketch is an interpretation of context K such that .
We denote by the full subcategory of determined by all valid interpretations of and by we denote the corresponding restriction of the projection functor .
Remark 21 (Traditional presentations). If has an initial object , we can consider sketches with only containing closed formulas, i.e., statements of the form (see Remark 15). As discussed before, the projection functor , due to Definition 13, is an isomorphism. In such a way, is not only determining the interpretation subcategory but can also be seen as a presentation (specification) of the corresponding full subcategory of isomorphic to .
In other words: due to Remark 18, we can describe as the full subcategory of given by all Ξ-structures in such that for all closed formulas in .
Example 41 (FOL: Interpretations). If we interpret the symbolic literals in by the real persons in our family in December 2021, we will not obtain a valid interpretation of the -sketch in Example 36 since the statement is not satisfied by this interpretation. If we use, however, the statement instead, the interpretation becomes valid.
Note that the statement is satisfied by the interpretation even if there is no witness for this statement in the context. ’s only sister is not present in the context K!
Example 42 (mFOL: Interpretations). An interpretation of the sample context assigns to each element in and , respectively, a set. Since is the slice category , a certain set can either serve as a sort or as a predicate.
Our choice of in Example 23 ensures, in addition, that the valid interpretations of the sample -sketch from Example 38 are in one-to-one correspondence to the -structures in . We do have such a semantical one-to-one correspondence for any FOL-footprint, declaring only unary, binary or tertiary predicate symbols, and the corresponding -sketch. This confirms that the mFOL-example establishes a meta-level for the FOL-example also w.r.t. semantics.
It is maybe worth mentioning that any -sketch with two different atomic statements for, at least, one element in has no valid interpretation at all in .
Example 43 (Category Theory: Interpretations). Since we defined in Example 24 a very liberal semantics, we do have interpretations , of the sample -sketch in Example 39, where the graph homomorphism maps the edges e and f to different edges in U even if both are declared as the composition of a and b.
If we would have also included into the sketch the general statement with the closed expression expressing the property composititon is always unique (see Example 29), could be only a valid interpretation of if ι identifies e and f.
Example 44 (RM: Interpretations).
Analogously to Example 42, our choice of in Example 25 ensures that the valid interpretations of “well-formed” -sketches, i.e., -sketches representing database schemata, formalize exactly the traditional semantics of database schemata as outlined in Section 3.1.5. Morphisms between sketches are defined by means of semantic entailment in a certain Institution of Statements .
Definition 18 (Statement entailment). For any context K in and any sets of statements in K, we say that S entails T in a - structure , in symbols, if, and only if, for all interpretations of K in : implies .
Sentails T, in symbols, if, and only if, for all Ξ-structures in .
Definition 19 (Sketch morphism). An -morphism between two -sketches , is a morphism in such that . An -morphism is calledstrictif .
denotes the category of all -sketches and all -morphisms between them. Its subcategory of all -sketches and all strict -morphisms is denoted by .
We will consider three different kinds of directed relationships between sketches distinguished by three different kinds of arrow-symbols. We choose the arrow-symbol “⤏” for sketch morphisms since it is the kind of directed relationship we will mention the least.
If is clear from the context, we will also use the shorthand notations and instead of and , respectively.
-morphisms with and simply reflect statement entailments. For any -morphism , the condition ensures, due to the satisfaction condition that the functor restricts to a functor from () into (). In such a way, the assignments extend to a functor .
According to well-known general results (see Corollary 4.3 in [
2]), we know that
has whatever limits or colimits the category
has since limits and colimits in the category
of
-sketches and
-morphisms are constructed by means of limits and colimits in the category
, respectively (compare Propositions 5 and 6). This ensures also that we do have
amalgamation [
1,
2,
38]:
maps all colimits in
that are preserved by the inclusion
, to limits in
.
The Theory of Institutions gives us “for free” -sketches, -morphisms, the category as well as the extended model functor.
However, to employ sketches as a specification formalism and to develop deduction calculi for sketches, we need a number of other concepts, constructions and results.
5.2. Sketches of Statements vs. Structures
In the Introduction, we discussed, among other things, two central motivations for the development of our framework: (1) We want to be able to give a general abstract account of the concept of free structures generalizing concepts like a group generated by a set of generators and a set of defining relations. (2) We want to provide an alternative general mechanism to encode structures “syntactically” that avoids the kind of circularity inherent to the technique of “signature extensions”.
In the remaining part of this section, we outline proposals to meet these objectives.
5.2.1. Freely Generated Structures
To reconstruct the concept of a group generated by a set of generators and a set of defining relations, we need operations only. Those cases of free algebras are discussed in
Section 5.3.1.
First, We Consider Structures Freely Generated in
A -structure is freely generated in by an -sketch if, and only if, is in and there is a valid interpretation of in that is universal relative to . That is, for all -structures in and all valid interpretations of in there exists a unique morphism in such that in , i.e., such that establishes an interpretation morphism in according to Definition 13.
A -structure, freely generated in by an -sketch , is obviously uniquely determined “up to isomorphism in ” if it exists.
The universal property of entails that is initial in (), thus the projection functor establishes a functor from () into the co-slice category .
In the case that
contains only atomic statements, the definition of morphisms between
-structures ensures
for any morphism
in
; thus, the assignments
establish a functor from
into
. Due to the universal property of
, we obtain
. Together with the equation
, this ensures that the two functors establish an isomorphism between
and
(compare Proposition 4.10 in [
2]). This justifies that we can call, in this
atomic case, the pair
a
sketch representation of
.
Note that the -structure with a -indexed family of empty sets is trivially freely generated in by .
Second, We Consider Structures Freely Generated Relative to a Subcategory :
Let be an arbitrary full subcategory of . A -structure is freely generated in by an -sketch if, and only if, is an object in and there is a valid interpretation of in that is universal relative to . That is, for all -structures in and all valid interpretations of in there exists a unique morphism in such that in , i.e., such that establishes an interpretation morphism in .
A -structure, freely generated in by an -sketch is, obviously, uniquely determined “up to isomorphism in ” if it exists. In this case, the universal property of entails that is initial in the subcategory of all valid interpretations of in -structures in . Analogous to the case , we obtain, moreover, an isomorphism between and the co-slice category if contains only atomic statements.
Third, We Consider Subcategories Described by Logical Means
One logical means to describe subcategories of are -sketches with only containing closed formulas, i.e., statements of the form . As discussed in Remark 21, those sketches can be seen as presentations in the traditional sense of the Theory of Institutions specifying subcategories of .
As another logical means to describe subcategories of
, we will introduce sketch implications in
Section 5.2.3 (see Remark 27).
5.2.2. Elementary Diagrams
To establish sketch-based mechanisms to encode structures “syntactically”, we have to assume an Institution of Statements with and for all contexts K in , i.e., contains all atomic statements in K.
There are two canonical ways to transform a
-structure
into an
-sketch. The atomic variant
encodes only the semantics of feature symbols and uses therefore only atomic statements:
The full variant
is available if
for all
and encodes the semantics of all feature expressions:
We obviously have
. For any statement
in
U we obtain, according to (
13) and the definition of satisfaction relations in Definition 14,
thus
is a valid interpretation of
as well as of
.
In traditional First-Order Logic, we meet the full variant in the form of elementary diagrams [
39]. The difference to our encoding is that the carrier of a first-order structure is not considered as a context. Instead, each element of the carrier is added as a constant to the signature. The encoding of structures as sketches avoids this kind of circularity. The “signature extension trick” works only for first-order signatures with constants symbols and, more critically, it requires that the carriers of first-order structures are sets! It looks like the sketch encoding mechanism is much more flexible and general.
The elementary diagrams in [
2] give an abstract account of the signature extension approach but are based on an atomic variant of encoding.
There are no structures at all in [
15] only atomic sketches! In [
13], we followed Makkai and have not considered structures either. Instead, we worked, directly, with the atomic sketch encodings
of structures.
To validate, in retrospective, the approaches in [
13,
15], a noticeable portion of the remaining part of the paper, will be spent to answer the following question:
Question 4: Is there any justification to ignore completely the concept of semantic structure (model)? |
By construction, any -structure in is freely generated in by the -sketch with the universal interpretation . contains only atomic statements thus becomes a sketch representation of in the sense of the last subsection. In particular, there is an isomorphism between and .
The crucial observation is, however, that the assignments define an embedding of into the category of all -sketches and all -sketch arrows defined in the next subsection in Definition 20. This embedding establishes, moreover, an isomorphism between and the subcategory of given by all atomic -sketches and all strict -sketch arrows between them. An -sketch is atomic if (see Remark 14).
The concepts (atomic) -sketch and (strict) -sketch arrow concern only the “structure” of sketches and are completely semantics-independent. That is, the transition along the encoding functor from the category to the isomorphic category implements an abstraction from the concept semantic structure (model) to the concept atomic sketch. In case , this abstraction is exhaustive. In case , however, we need an additional semantics-independent, purely structural characterization identifying exactly all those atomic -sketches in with in , to make the abstraction complete (see Remark 29).
A sketch is constituted by a context and a set of statements. The informal term “structure of a sketch” takes into account the context; for each statement, the syntactic structure of the corresponding expression and its “location”, i.e., its binding morphism, the set of statements as such and the “distribution” of the statements over the context.
5.2.3. Sketch Arrows and Sketch Implications
We can not only transform -structures into the -sketches and . We can even encode the validity of certain classes of “closed formulas” in by means of semantics-independent, pure structural closedness properties of or , respectively. To see this, we need some preparations.
First, we have to take a step back and consider a very simple, semantics-independent relationship between sketches. To be prepared for
Section 6, we define this relationship on the same level of abstraction as Definition 16 (Sketch).
Definition 20 (Sketch Arrow). Let us be given a category and a functor . An arrow between two -sketches , is given by a context morphism . is calledstrictif .
denotes the category of all -sketches and all -sketch arrows between them. Its subcategory of all -sketches and all strict -sketch arrows is denoted by .
If is clear from the context, we will also use the shorthand notations and instead of and , respectively. If and , we will also just write instead of . We consider the case , with an Institution of Statements.
Remark 22 (Sketch Morphisms vs. Sketch Arrows). An -morphism is a -sketch arrow satisfying the semantical morphism condition . Not every -sketch arrow provides an -morphism , but each -morphism has an underlying -sketch arrow.
Any strict -sketch arrow satisfies, trivially, the morphism condition and provides, in such a way, a strict -morphism due to Definition 19.
There is, however, another semantical condition that is kind of dual to the morphism condition. We call this condition the implication condition and, as a “terminological sleight of hand”, we introduce the concept of a “sketch implication”, simply indicating that a sketch arrow is intended to be the subject of this dual semantical condition.
Definition 21 (Sketch implication). An - implication is given by two -sketches , and a context morphism .
An -implication is calledstrictif .
denotes the category of all -sketches and all -implications between them. Its subcategory of all -sketches and all strict -implications is denoted by .
If is clear from the context, we will also use the shorthand notations and instead of and , respectively. If and , we will also simply write instead of .
What we call the implication condition is nothing but the usual condition that an implication is valid if each “solution” of the premise gives rise to a “solution” of the conclusion.
Definition 22 (Validity of Sketch Implications). Let us be given an -implication between two -sketches and .
Aninterpretation of context P in a Ξ-structure satisfies, in symbols, if, and only if, implies that there exists an interpretation of context C in with such that .
is valid in a -structure , in symbols, if, and only if, we have for all interpretations of P in .
isvalid (in ), in symbols, if, and only if, for all Ξ-structures in .
Remark 23 (Subcategories of valid Sketch Implications). For any Ξ-structure and any -sketch we have . Moreover, and implies . In such a way, the collection of all -implications, valid in a Ξ-structure , defines a corresponding subcategory of with the same objects as .
Intersecting all those subcategories for all Ξ-structures in , we obtain the subcategory of given by all -implications valid in .
Remark 24 (Sketch Implications vs. Sketch Arrows). An -implication is simply another notation for a -sketch arrow . The only difference is that we allow to be the subject of semantical implication conditions , like , while the corresponding -sketch arrow is considered as a pure structural entity without any semantical significance.
In contrast to -morphisms (compare Remark 22), a strict -sketch arrow does not give, trivially, rise to an -implication satisfying semantical implication conditions.
For any -sketch arrow , we can construct a respective strict -sketch arrow with . The satisfaction condition ensures that the corresponding -implications and are semantically equivalent: if, and only if, for all Ξ-structures .
Remark 25 (Sketch Implications vs. Sketch Morphisms). The concepts sketch morphism and sketch implication are skewed but kind of dual. Sketch morphisms talk about “reducts of models” while sketch implications state the existence of “model extensions”.
In case and , a -sketch arrow provides an -morphism if, and only if, while the validity in of the corresponding -implication means semantic entailment exactly in the opposite direction !
Remark 26 (Deduction Rules). Attention, the exposition in the following remarks and examples, relies implicitly on the observation that sketch arrows can be utilized asdeduction rules. A deduction rule, given by a -sketch arrow , issoundfor a certain Institution of Statements if, and only if, the respective -implication is valid in !
The utilization of sketch arrows as deduction rules is triggered by Definition 23 as well as Proposition 3 and Corollary 2 at the end of this subsection and will be discussed shortly in Remark 32.
Remark 27 (Valid Sketch Implications and Axioms). There are -implications (or, more precisely, -implication schemata) that areuniversalin the sense that they are valid in any Institution of Statements , since they reflect the structure and semantics of feature expressions. In particular, the introduction and elimination rules for logical connectives can be described by those universal sketch implications. In case of conjunction∧, for example, we do have the two -sketches and . In addition, the “elimination rule” as the “introduction rule” are universal sketch implications.
For existential quantification,
we do also have a kind of modus ponens at hand described by the following universal sketch implication: The validity of other -implications may only depend on the chosen base category of an Institution of Statements. As long as is a presheaf topos, we do have, for example, -implications at hand expressing reflexivity, symmetry and transitivity of equality, i.e., reflecting the properties of identifications of entities by means of maps (compare the definition of the -expression in Example 29).
Besides universal -implications, we do also have -implications that are valid in all Ξ-structures , and we have chosen to be in . In case , we may be able to axiomatize in the sense that there is a set of -implications such that where is the full subcategory of given by all those Ξ-structures such that for all -implications in .
In the same way, we can utilize any set of -implications as a set ofaxiomsdescribing the full subcategory of given by all those Ξ-structures in such that for all -implications in .
At the end of Section 5.2.1, we described a mechanism to define subcategories of by means of axioms in the traditional Hilbert-style, i.e., by -sketches with only containing closed formulas
, i.e., statements of the form . This mechanism can be integrated in the sketch implication based axiomatization mechanism, in a trivial way, by simply adding to a corresponding introduction rule
. For certain classes of closed formulas, there exist more elaborated transformations of Hilbert-style axioms into sketch implication based axioms, as discussed in Section 5.2.4. Example 45 (FOL: Sketch implications). Horn clauses are defined and utilized in PROLOG, in a way that it seems to be appropriate to consider them as sketch implications rather than universally quantified implications. That is, we consider a Horn clause not as a closed formula with a finite conjunction of atomic expressions , with and an atomic expression , , but rather as the corresponding -implication with , and , .
Example 46 (ALC: Sketch implications).
A so-called TBox in ALC is a finite set of terminological axioms
, i.e., of general concept inclusions
. For the way the semantics of general concept inclusions
is defined in ALC, they correspond, analogous to Horn clauses, rather to sketch implications (than to closed formulas): Example 47 (Category Theory: Sketch implications).
There are, at least, three ways to axiomatize that all vertices do have an identity. First, we can require, due to Remark 18:where graph X consists only of a vertex and is the inclusion of X into (see Examples 14 and 29). As proposed in Remark 27, we can equivalently add the introduction rule: to our axioms. According to a general pattern, discussed in the next Section 5.2.4, we can use, instead, the equivalent rule: In turn, this second rule can be composed with a simple variant of the modus ponens rule (15), and we obtain a third equivalent rule: Example 48 (RM: Sketch implication).
In DPF, we worked, until now, only with atomic statements and atomic sketch implications called universal constraint
. In [18,21], the reader can find many examples of those sketch implications expressing properties like: any table should have exactly one primary key, a foreign key has to refer to a primary key, and many, many others. In Remark 28, we will relate the present DPF-terminology to the concepts introduced in this paper. □ In the remaining part of the subsection, we demonstrate how to encode the validity of sketch implications by a semantics-independent, pure structural closedness property of the sketch encodings
of
-structures
as defined in (
13).
For any context
P any statement
in
P and any interpretation
of
P in a
-structure
, we have
, due to (
2), thus the satisfaction condition and the equivalences in (
14) provide the following equivalence of statements:
To be prepared for
Section 6, we define the closedness property on the same level of abstraction as Definition 16 (Sketch) and Definition 20 (Sketch Arrow).
Definition 23 (Closedness). Let us be given a category and a functor . A -sketch is closed w.r.t. a- sketch arrow relative to a strict- sketch arrow if, and only if, there exists a strict -sketch arrow such that .
A -sketch isclosed w.r.t. a- sketch arrow if, and only if, it is closed w.r.t. relative to each strict -sketch arrow .
We consider the case
,
with
an Institution of Statements. From Definition 22, Definition 23 and Equation (
16), we obtain immediately:
Proposition 3 (Validity ≅ Closedness). For any -sketch arrow , the following two statements are equivalent for any Ξ-structure :
In case of arrows between atomic sketches, we can obviously replace by .
Corollary 2 (Validity ≅ Closedness). For any -sketch arrow with and atomic, the following two statements are equivalent for any Ξ-structure :
Remark 28 (DPF–Answer to Question 3).
In DPF, we worked, until now, only with atomic statements and we have not considered sketch arrows [18,21]. Having now the concept sketch arrow
explicitly at hand, we can gain a better understanding of the present situation in DPF and are able to answer Question 3 (p. 7).The “specification morphisms” in DPF are strict sketch morphisms in the sense of Definition 19. “Specification entailments” in DPF are sketch implications in the sense of Definition 21 but only of the special kind , i.e., we have, especially, . The validity of specification entailments is defined analogously to the validity of sketch implications in Definition 22.
“Universal constraints” in DPF correspond to strict sketch arrows in the sense of Definition 20, and we defined the semantics of universal constraints in accordance with Definition 23. The crucial flaw is that we used, unfortunately and inadequately, the concept specification morphism to define universal constraints and the closedness property. Effectively, we utilized only the pure structural “strict sketch arrow feature” of DPF specification morphisms for this purpose. However, because of the semantic denotation of the concept specification morphism, this was wrong and caused confusion.
We touched upon the construction of strict sketch arrows , as discussed in Remark 24, but only in the skewed understanding that “each specification entailment gives rise to a universal constraint”. Besides this, we have been aware and utilized the observation that “each universal constraint gives rise to a transformation rule ” (compare Remarks 26 and 32).
5.2.4. Sketch Implications, Closed Formulas and Makkai’s Generalized Sketches
A closer look at the definition of validity of sketch implications in Definition 22 and at the definition of the semantics of feature expressions in Definition 10 makes, straightforwardly, it apparent that the definition of the satisfaction relation in Definition 14 establishes an equivalence between finite sketch implications and universally quantified conditional existence statements (see also Remark 18).
Proposition 4 (Sketch Implications ≅ Closed Formulas). For any Ξ-structure and any closed expression , the following two statements are equivalent:
In the case that and are conjunctions, we can be even more specific.
Corollary 3 (Sketch Implications ≅ Closed Formulas). For any Ξ-structure and any closed expression with and , the following two statements are equivalent:
Finally, we can specialize the equivalence to conjunctions of atomic statements.
Corollary 4 (Sketch Implications ≅ Closed Formulas: Atomic-case). For any Ξ-structure and any closed expression with a finite conjunction of atomic expressions , , and a finite conjunction of atomic expressions , , , the following two statements are equivalent:
Now we are sufficiently prepared to give a reasonable answer to Question 4 (p. 39).
Remark 29 (Answer to Question 4).
We discussed in Section 5.2.2 that the assignments establish an isomorphism between and the subcategory of given by all atomic -sketches and all strict -sketch arrows between them.A sufficient condition to complete the abstraction from structures to atomic sketches is the existence of a set of atomic (!) -implications such that (see Remark 27). The “purely structural characterization of exactly all those atomic -sketches in with in ”, we have been asking for in Section 5.2.2, is then provided by Corollary 2 and is nothing but the closedness of an atomic -sketch w.r.t. all the -sketch arrows underlying the atomic -implications in . If we are only interested in those subcategories of which can be axiomatized by a set of atomic (!) -implications, we can indeed completely forget about structures and can be content with the “universe of atomic sketches”.
This is exactly Makkai’s approach in [15]. He does not consider Ξ-structures at all. He relies, instead, on categories of atomic -sketches and strict -sketch arrows between them. He uses the term sketch entailment
for those strict sketch arrows
which are utilized for specification purposes. Note that the restriction to strict sketch arrows
means that he works exclusively with sketch entailments of the form (see Remark 24). In the terminology of Institutions of Statements, Makkai’s approach can be characterized by the choices and for all objects K in . In particular, he focuses on presheaf topoi, i.e., functor categories , as base categories.
The structure of limit and colimit statements (see Remark 10) is strongly related to the structure of those closed formulas that can be equivalently described by atomic sketch implications (see Corollary 4). We guess that this is one of the underlying reasons that Makkai contents himself with atomic sketches and sketch arrows between them?
We should mention, however, that Makkai uses an additional mechanism to be able to reside in the “universe of atomic sketches”. This mechanism (also known in Category Theory as the collage or the cograph of a distributor/profunctor) transforms atomic multi sketches for a presheaf topos and a certain footprint on into plain contexts, i.e., into objects in another presheaf toposwith a category constructed out of and Ξ. We explain and exemplify this construction in Remark 41 in Section 6. In cases where atomic sketch implications (and thus the corresponding universally quantified conditional existence statements
in Corollary 3) are not expressive enough to axiomatize the structures , we are interested in, and where we need more expressive first-order statements, to do the job, we can utilize the general first-order sketch constraints, introduced in Section 6, for a pure structural characterization of the respective atomic sketch encodings (see Corollary 7). 5.2.5. A Semantic Deduction Theorem
We consider semantic entailment between sketch implications.
Definition 24 (Entailment of Sketch Implications). A set of -implications entails an - implication semantically, in symbols, if, and only if, for all Ξ-structures in , it holds that , i.e., for all in , implies .
Any -sketch arrow can be factorized, i.e., can be obtained by composing the -sketch arrows and , where .
Due to Definition 22, for any interpretation of context P in a -structure the statement means nothing but simply the existence of a morphism in such that . That is, we have, especially, if, and only if, if, and only if, . Moreover, this allows for reformulating the validity of sketch implications.
Lemma 1 (Factorization of Sketch Implications). For any set of -implications and any -implication , the following two statements are equivalent:
Lemma 1 means, in practice, that we can restrict ourselves to - implications of the form to specify (axiomatize) subcategories of . By coincidence, we even have a semantic deduction theorem available for those special kinds of sketch implications.
Theorem 2 (Semantic Deduction Theorm). For any set of -implications of the form and any -implication , the following two statements are equivalent:
For all Ξ-structures in and all interpretations of context in : and implies .
Theorem 2 guarantees that it is a reasonable idea to describe the deduction of sketch implications, which are semantically entailed by a given set
of sketch implications, by means of deduction calculi generating new sketches
from a given sketch
based on a utilization of the sketch implications in
as deduction rules. To deduce all (!) semantically entailed sketch implications, it may be necessary to also include deduction rules related to a set
of sketch implications representing the choice of
,
and
, respectively (compare Remarks 27 and 29). This is exactly the approach in [
6,
7].
In [
7], we also presented a deduction calculus which constructs directly sketch implications from a set of given sketch implications. Besides the composition of sketch implications, as mentioned in Remark 23, we could choose parallel composition and instantiation as the other basic constructions for such a deduction calculus:
Parallel composition: and implies
Instantiation: For any context morphism : implies .
Of course, we could also use, instead, more specialized and sophisticated constructions analogously to
resolution in PROLOG or
parallel resolution in [
7], for example.
Remark 30 (Resolution in PROLOG). In Example 45, we argued that Horn clauses in PROLOG should be rather considered as sketch implications than universally quantified implications.
Concerning resolution
, there is also a discrepancy between the theoretical justification and the actual effect of the resolution procedure in PROLOG. Resolution is explained as a special case of the general principle of “proof by refutation” [40]. Actually, PROLOG computes, however, (in a constructive way!) a Horn clause that is semantically entailed by the Horn clauses and the facts in the given PROLOG program (compare the Semantic Deduction Theorem 2). 5.3. Sketches of Equations
For an Institutions of Equations
an
-sketch
is given by a context
X in
, i.e., an
S-set
X, and a set
E of
-equations in
X. A valid interpretation of
is an interpretation
of context
X in a
-algebra
such that
, i.e.,
for all
-equations
in
E according to (
9).
Based on these definitions, we can define
-morphisms,
-sketch arrows and
-implications, respectively, exactly in the same way as we have done it for Institutions of Statements
in
Section 5.1 and
Section 5.2. Moreover, we have, obviously, for Institutions of Equations also corresponding variants of Definition 22 (Validity of Sketch Implications), Definition 24 (Entailment of Sketch Implications), Lemma 1 (Factorization of Sketch Implications) and Theorem 2 (Semantic Deduction Theorem) available.
Abstract and Universal Algebra have been developed independent of First-Order Logic and conditional
-equations are usually not introduced as “universally quantified implications”. They are rather described as
-implications
, in the sense of Definition 21 where
represents the set of equations in the premise of a conditional
-equation and
the single equation in the conclusion. In particular, the validity of conditional
-equations in
-algebras
is defined in perfect accordance with Definition 22 (Validity of Sketch Implications) (compare [
6,
7,
41]). Therefore, we will also use the term
conditional -equation for
-implications
with
Y,
finite and
a singleton.
Finally, we reached the point where we can give an answer to Question 2 (p.
Section 1.1.1): Yes, Theorem 2 is the general Semantic Deduction Theorem, we have been looking for and the equivalence, mentioned in the question, corresponds to the specialization of the general Semantic Deduction Theorem for conditional
-equations.
5.3.1. Freely Generated Algebras
The footprints in Institutions of Equations are algebraic signatures and we have . Conditional -equations are the traditional means to specify subcategories of . Given a set of Conditional -equations, we denote by the subcategory of given by all those -algebras such that , i.e., (as defined in Definition 22) for all conditional -equations in (compare Remark 27).
In case , we may call a conditional -equation with an empty premise. Note that there is a simply but crucial conceptual difference between a -equation and the corresponding conditional -equation with an empty premise. is just a simple statement in context Y while is a tool to make statements about -algebras. Being not aware of this difference is often a source of confusion!
First, We Consider -Algebras Freely Generated in
A
-algebra
is freely generated by an
-sketch
if, and only if, there is a valid interpretation
of
in
that is universal relative to
. That is, for all
-algebras
and all valid interpretations
of
in
there exists a unique morphism
such that
in
, i.e., such that
establishes an interpretation morphism
in
(see
Section 4.1).
The universal property of entails that is initial in (), thus the projection functor establishes a functor from () into the co-slice category .
In contrast to Institutions of Statements, we have for arbitrary (!)
-sketches
(and not only for atomic
-sketches) that the definition of homomorphisms between
-algebras ensures
for any homomorphism
in
thus the assignments
establish a functor from
into
. Due to the universal property of
, we obtain
. Together with the equation
, this ensures that the two functors establish an isomorphism between
and
(compare Proposition 4.10 in [
2]). This justifies that we can call the pair
a sketch representation of
.
For arbitrary
-sketches
, a
-algebra
, freely generated by
, exists and is uniquely determined “up to isomorphism”. In the introductory
Section 1.1.1, we used the notation
to denote those freely generated
-algebras.
The
-algebra, freely generated by
is nothing but the
-term algebra
on
X and the unique morphism
is simply the evaluation of terms ( see Equation (
8)). In general,
can be constructed as a quotient of
.
Second, We Consider -Algebras Freely Generated Relative to a Subcategory
Let be a set of conditional -equations. A -algebra is freely generated in by an -sketch if, and only if, , and there is a valid interpretation of in that is universal relative to . That is, for all -algebras in and all valid interpretations of in there exists a unique morphism such that in , i.e., such that establishes an interpretation morphism in .
In this case, the universal property of entails that is initial in the subcategory of given by all valid interpretations of in -algebras in . Moreover, we obtain an isomorphism between and the co-slice category .
For arbitrary sets
of conditional
-equations and arbitrary
-sketches
, a
-algebra
, freely generated by
in
, exists and is uniquely determined “up to isomorphism”. In the introductory
Section 1.1.1, we used the notation
to denote those freely generated
-algebras.
can be constructed as a quotient of
.
In case of groups, is a set of conditional -equations with an empty premise, representing the group axioms, and is called the group freely generated by the set of generators X and the set R of defining relations.
5.3.2. Elementary Diagrams for Algebras
For Institutions of Equations, we have chosen
. An atomic
-equation in a context
K is a
-equation of the form:
where
is the assumed representation of
as a list of variable declarations (see
Section 4.2). Note that the usual encoding of n-ary operations by (n + 1)-ary predicates establishes a one-to-one correlation between the corresponding atomic equations and atomic statements, respectively.
By , we denote the subset of of all atomic -equation in a context K. The assignments extend to a functor .
In full analogy to Institutions of Statements, there are two canonical ways to transform a
-algebra
into an
-sketch. The atomic variant
encodes only the semantics of the operations in
:
The full variant
encodes the semantics of all terms (derived operations):
We have obviously and is a valid interpretation of as well as of . Any -algebra is freely generated by the -sketch as well as by the -sketch with the universal interpretation . That is, as are sketch representations of in the sense of the last subsection.
Conditional -equations are not atomic; thus, we have to rely on the full encodings of -algebras to have a chance to express the validity of conditional -equations by a closedness property analogously to Proposition 3.
Fortunately, the assignments define an embedding of into the category of all -sketches and all -sketch arrows transforming each homomorphism between -algebras into a strict -sketch arrow.
5.3.3. Generalized Sketch Arrows and Sketch Implications
To be able to formulate a characterization of the validity of conditional -equations by means of a closedness property, in the sense of Proposition 3, we have to consider more general sketch arrows based on the substitution of variables by terms. First, we extend the category by Kleisli morphisms.
Definition 25 (Generalized Context Morphisms). We consider an Institution of Equations and a signature . A - context morphism is given by an S-map . The composition of two Σ-context morphisms , is given by the S-map where is the usual translation of Σ-terms induced by the substitution. denotes the category of all contexts and all Σ-context morphisms.
By construction,
is a subcategory of
for any signature
. Second, the sentence functor
extends to a functor
with:
for all
-context morphisms
, i.e., for all
S-maps
, and all
-equations
in
K. Since
and
for all
S-maps
,
, this defines indeed a functor.
Remark 31 (Generalized Sketch Implications). We will use, implicitly, strict -sketch arrows to formulate a characterization of the validity of conditional Σ-equations by means of a closedness property in the sense of Proposition 3.
Besides this, it is very tempting to consider also “generalized sketch implications”, defined by -sketch arrows, and to study validity, entailment and factorization for those generalized sketch implications. In particular, it would be interesting to clarify the relation between those generalized sketch implications and the morphisms in the Lawvere theories for partial algebraic specifications we studied in [9]. For now, we overcome this temptation and postpone the study of generalized sketch implications to a following paper. We will concentrate on conditional Σ-equations and corresponding constructions and results.
Before this, we would like to add a short side note: Σ-terms appear on an “internal level” as constituents of Σ-equations and on an “external level” as constituents of generalized context morphisms. Our ongoing studies around graph algebras indicate that we will probably need closely related, but different, concepts for these distinct levels if we want to generalize the idea of operations to graphs (and other kinds of presheaves). □
To avoid headaches, we formulate explicitly the respective instance of Definition 23 for conditional
-equations (compare [
7]).
Definition 26 (Closedness for Conditional Equations). An -sketch is closed w.r.t. the underlying -sketch arrow of a conditional Σ-equation if, and only if, for all Σ-context morphisms , i.e., all substitutions , it holds that implies .
In addition, here is the respective specialized instance of Proposition 3.
Corollary 5 (Validity ≅ Closedness for Conditional Equations). For any -sketch arrow , the following two statements are equivalent for any Σ-algebra :
The corresponding conditional Σ-equation is valid in , i.e., .
The -sketch , defined by Equation (19), is closed w.r.t. the -sketch arrow according to Definition 26.
Remark 32 (Sketch Arrows as Deduction Rules). The most natural thing to do, if a structure is not closed w.r.t. a certain construction, is to repair this flaw by simply adding the missing parts. Applying this universal “repairing principle” to the closedness property in Definition 26, means nothing but to add new Σ-equations to a given set of Σ-equations by deploying -sketch arrows as deduction rules.
To apply an -sketch arrow as a deduction rule, we have, first, to find amatchof the left-hand side of the rule in an -sketch , i.e., a substitution such that . Second, we apply the rule for this match and generate the -sketch . The resulting commutative square becomes a pushout in the category of all strict -sketch arrows if .
Remark 33 (Answer to Question 1). Based on the concepts sketch, sketch implication, sketch arrow and the related general definitions and results, we presented so far, we can give a kind of reasonable answer to Question 1 (p.3):
Each sketch implication has an underlying sketch arrow and, the other way around, each sketch arrow gives rise to a sketch implication. Due to Proposition 3 (Validity ≅ Closedness), the validity of sketch implications in semantic structures can be, moreover, equivalently expressed by a closedness property of sketch encodings of semantic structures w.r.t. sketch arrows.
Each sketch arrow of the form can be utilized as a rule allowing us to deduce new sketches from given sketches (as exemplified in Remark 32). Proposition 3 and Theorem 2 (Semantic Deduction Theorem) ensure that those deductions are sound and that they allow us, moreover, to deduce sketch implications semantically entailed by a given set of sketch implications.