Common Logic: Abstract Syntax and SemanticsCommon Logic Working GroupIntroductionThe purpose of this document is to provide an abstract syntax for the Common Logic standard and a corresponding semantics. The idea here is to provide a syntax at a sufficiently high level of abstraction that it can be satisfied by many "concrete" languages — e.g., KIF, Conceptual Graphs, or the familiar Principia-style syntax found in most mathematical logic texts. In the development of a standard language and semantics for use in Ontology and Knowledge Engineering generally, one can take two approaches to this diversity. One approach is simply to legislate that one particular syntax shall be the standard. This, of course, would be the simplest solution, but quite likely the least effective, as it would marginalize those who prefer other languages, many of whom would not be inclined to change. The other approach is to specify a standard at a higherxter level of abstraction, which, at that level, can encompass all of the distinct concrete languages. CL has chosen the latter path; it does not privilege any one in a large class of concrete languages over another. Nevertheless, it still offers the advantages of the single language approach: Because all compliant languages are, at CL's level of abstraction, the "same" language, translation between those languages — guided by specifications detailing how each language exemplifies the abstract CL syntax — will be straightforward. SyntaxLexiconA CL language is based upon an initial stock of primitive syntactic entities. Specifically, a CL lexicon λ consists of the following mutually disjoint sets:
We stipulate that Con, OrdVar and SeqVar be pairwise disjoint. Var = OrdVar ∪ SeqVar is known as the set of variables of λ. Let PrimTrm = Con ∪ Var; PrimTrm is known as the set of primitive terms of λ. Note that, unlike traditional logical languages, there is no distinction between individual constants and predicates in CL lexicon. This reflects the underlying perspective that everything is a "first-class" logical citizen. CL LanguagesEvery CL lexicon determines a class of languages. Structurally speaking, these languages are all identical, insofar as they all satisfy the same abstract conditions. They differ only in the details of their outward form. We will illustrate this below. Term ClassesFor any set M, let M* be the set of finite sequences of elements of M, i.e., M* = ∪0≤n<ωMn, where Mn is the set of all n-tuples of elements of M. Say that T is a term class for λ if T is a smallest class that includes PrimTrm and is closed under an operation App — called a generator for T — such that
For any term class Trm for λ, let FuncTrm = Range(App),3 where App is a generator for Trm, and let SingTrm = Trm – SeqVar. FuncTrm is the set of function terms of λ (relative to Trm), and SingTrm is the class of singular terms of λ (relative to Trm). Formula classesLet λ be a CL lexicon, and let Trm be a term class for λ. Let FuncTrm be the class of function terms of λ relative to Trm and SingTrm the class of singular terms of λ relative to Trm. Let Atom be a one-to-one function on FuncTrm and let AtomicFla be the range of Atom. Say that F is a formula class for λ, relative to Trm, if it is a smallest class that includes AtomicWff and is closed under a set Op — known as a generator set for F — of operations Atom, Id, Neg, Conj, Disj, Cond, Bicond, ExQuant, UnivQuant that satisfy the following conditions:
The clauses for "quantified" formulas here, i.e., those entities in the ranges of ExQuant and UnivQuant, allow for the use of restricted quantifiers. Thus, in a KIF-like implementation of CL, these clauses would allow such formulas as
(forall ((?x Boy))
(exists ((?y Girl))
(Kissed ?x ?y)))
to represent "Every boy kissed a girl."
Note that, because the operations in a generator set for a formula class Fla for λ are all one-to-one and disjoint in their ranges, every element of Fla will have exactly one "decomposition" under the inverses of those operations, and that all such decompositions are finite. 4 Let φ ∈ Fla. An object ε in the decomposition of φ is an atom of φ just in case ε is element of the lexicon λ. φ is atomic if φ ∈ AtomicWff. ψ is a subformula of φ if ψ ∈ Fla and ψ is in the decomposition of φ. We define a CL language to be a formula class Fla for a CL lexicon λ. If L = Fla is a CL language, where Fla is formula class for λ relative to Trm, then we say that L is a language for λ (alternatively, that λ underlies L), and we say that Trm is the set of terms of L. L is said to be first-order if SeqVar = ∅. If λ and λ′ are CL lexicons with the same sets of constants and L and L′ are CL languages for λ and λ′, respectively, then L and L′ are said to be equivalent. SemanticsInterpretationsLet L be a CL language for λ, and let Trm be the terms of L. A CL interpretation I for L is a 4-tuple 〈D,ext,skol,V〉 satisfying the following conditions. First, D = A ∪ R is a nonempty set such that A ∩ R = ∅. Intuitively, A represents the set of individuals of I and R the set of relations-in-intension (though, as will be seen, it is possible to think of them extensionally as sets). ext is a function from D into D*, though we stipulate that, for all a ∈ A, ext(a) = ∅. Intuitively, ext represents the extension of every relation. However, to smooth the semantics for the highly unrestricted syntax of CL languages, in which there is no syntactic distinction between individual constants and predicates, the individuals of D are assigned extensions as well, albeit always empty ones — thus, the result of predicating one individual of another, while semantically meaningful, will always yield falsehood. The purpose of skol is to enable the definition of reasonable denotations for function terms when the term occurring in function position in such a term does not denote a total function (i.e., denotes either a partial function, a non-functional relation, or an individual). Toward that end, for 〈e1, …, en〉 ∈ D*, say that an object e ∈ D is defined on 〈e1, …, en〉 in I just in case there is at least one object e0 ∈ D such that 〈e0, e1, …, en〉 ∈ ext(e). Define an I-skolemization of e to be any (total) function f : D* → D such that, for all 〈e1, …, en〉 on which e is defined we have 〈f(e1, …, en), e1, …, en〉 ∈ ext(e).5 Note that (given standard ZFC set theory) every element of D has a skolemization. The object skol in our interpretation I = 〈D, ext, skol, V〉, then, is stipulated to be a function that maps every element e in the domain D of I to an I-skolemization of e. This mechanism enables one to use a term denoting a functional relation as both a predicate and a function symbol with the intuitively correct result. Thus, for example, in a Principia-style CL language, one could correctly assert both 'FatherOf(Adam,Cain)' and 'Gardener(FatherOf(Cain))'. This approach, of course, does have as a consequence that certain expressions that are intuitively nonsensical — e.g., 'Gardener(FatherOf(17))' — turn out to be meaningful, and even possibly true. However, this has little practical upshot, as such "unintended" truths are easily rendered innocuous by a proper formulation of one's axioms.6 Finally, V is a "denotation" function that assigns appropriate values to the primitive terms of L. Specifically, if τ ∈ Con ∪ OrdVar, then V(τ) ∈ D, and if τ ∈ SeqVar, then, V(τ) ∈ D*. Denotations and TruthGiven the notion of an interpretation, we can now define what it is for a formula of a CL language to be true in an interpretation. First, we need some notation. For n-tuples s1,..,sn, let cnct(s1,..,sn) be the concatenation of s with s′.7 This definition is useful for defining semantic values for function terms. Further notation will be useful in defining truth for quantified formulas (i.e., formulas in the range of ExQuant and UnivQuant). First, for χ ∈ (Var ∪ (Var × Con)), let |χ| = χ if χ ∈ Var, and if χ = 〈ν,κ〉 ∈ (Var × Con)), let |χ| = ν. Now let I = 〈D, ext, skol, V〉 be an interpretation for L. For χ1,…,χn ∈ (Var ∪ (Var × Con)), say that V′ is a [χ1,…,χn]-variant of V iff
We then say that an interpretation I′ = 〈D, ext, skol, V′ 〉 for L is a [χ1,…,χn]-variant of I iff V′ is a [χ1,…,χn]-variant of V. In plain but somewhat less precise English, a [χ1,…,χn]-variant I′ of I is an interpretation that is just like I except that its denotation function V′ possibly assigns something else to each |χi|; in particular, in the case where χi is a pair 〈ν,κ〉 ∈ (Var × Con), V′ assigns a member of the extension of V(κ) to ν. This somewhat complicated definition enables the formulation of the very simple definition of truth for quantified formulas below. So let L be a CL language for a lexicon λ, Trm the set of terms of L, and App a generator for Trm, and let I = 〈D,ext,skol,V〉 be an interpretation for L. Given I, the denotations of the non-primitive terms of L in I are completely determined by skol and V. This can be expressed in terms of a unique extension V# of V such that, for any term τ ∈ Trm:
The purpose of V## is simply to enable us to form proper sequences out of the semantic values of sequences of terms, some of which denote objects in D and others of which (viz., the sequence variables) denote sequences of such objects. For example (in a Principia-style CL language again), suppose 'Moved' denotes a 3-place relation that holds between an object o and locations p1and p2 just in case o has moved from p1 to p2. Thus, in an interpretation where V('a') is o and V('@r') is the pair 〈p1,p2〉 ('@r' here being a sequence variable), we want 'Moved(a,@r)' to be true just in case the triple 〈o,p1,p2〉 ∈ ext('Moved'). We accomplish this simply by formulating the semantic clause in terms of the concatenation of sequences. But for this we need, not the object o itself, but its singleton sequence 〈o〉. And thus 'Moved(a,@r)' is true in our interpretation just in case cnct(V##('a'),V##('@r')) = cnct(〈o〉,〈p1,p2〉) = 〈o,p1,p2〉) ∈ ext('Moved'). Given V, we define truth for the formulas of L in our interpretation I as follows. Let φ ∈ L.
Note that this semantics requires no "pruning" to serve as an appropriate semantics for first-order CL languages, as interpretations themselves involve no non-first-order entities; given an interpretation I = 〈D,ext,skol,V〉 the range D* of the sequence variables itself lies outside of I proper. If L is first-order, the clauses for formulas containing sequence variables simply never kick in. The True and the FalseIt is convenient for many applications to introduce truth functional constants denoting truth and falsity. Given the syntax and semantics for CL above, these notions can be introduced simply as definitions. Specifically, the syntax generates both the empty conjunction Conj(∅) and the empty disjunction Disj(∅) for any given generator set. (In KIF, for example, these would correspond to the formulas '(and)' and '(or)', respectively.) On the semantics for these operators, Conj(∅) is true in all interpretations and Disj(∅) is false in all interpretations. Hence, in any given CL language, constants for truth and falsity can be introduced and defined axiomatically to be equivalent to these formulas. Thus, for example, in KIF, one might add the constants 'true' and 'false' and the axioms '(iff true (and))' and '(iff false (or))'. KIF: A Paradigmatic CL LanguageCL is in fact an outgrowth of the KIF project. CL simply abstracts away from the particularities of KIF — its choice of basic syntactic elements, its use of parenthesis, its choice of keywords, etc. A full CL language will therefore be structurally identical to a KIF language, but might differ in its surface form. Not surprisingly, then, it is rather straightforward to demonstrate that any KIF language is also a CL language. For purposes here, we will take KIF expressions to be strings.8. Let A be the usual set of alphanumeric characters together with the characters "-" and "_". Our first task is to specify a lexicon for a KIF language. Although the syntax for KIF is now based more generally upon unicode, for purposes here we can take the set Con of constants of a lexicon to be a set of (finite) strings over A, minus the usual KIF keywords (i.e., "forall", "exists", "not", etc.). OrdVar consists of the result of prefixing "?" to all strings over A, and SeqVar the result of prefixing "@" to those same strings. Clearly, Con, OrdVar, and SeqVar are all mutually disjoint, and the sets OrdVar and SeqVar are denumerable. Hence, Con, OrdVar, and SeqVar jointly constitute a CL lexicon. Relative to this lexicon, then, Var is the set OrdVar ∪ SeqVar and PrimTrm is the set Con ∪ Var. Consider now the set S of strings over the set A ∪ {"?", "@", " ", "(", ")"} (" " being the space character). Define an operation App* on (S – SeqVar) × S* such that App*(t, s1, …, sn) = ⌈(t s1 … sn)⌉. ("⌈" and "⌉" here are quasi-quotes, or "Quine corners".) Let Trm be the smallest set containing PrimTrm that is closed under App*, and let App be App* restricted to Trm. App is easily seen to be a generator for Trm, and that Trm is the set of KIF function terms that is determined by the given lexicon. Let the function Atom be the identity function; thus, AtomicWff = FuncTrm in KIF. Consider now the following operations:
Let F be the smallest set containing AtomicWff that is closed under these operations. F is exactly the set of formulas of the KIF language determined by the given lexicon, i.e., the above operations, restricted to F, jointly constitute a generator set for F. XML: A DTD for CLXML provides another important framework for defining CL languages. The following simple Document Type Definition (DTD) provides a convenient XML expression of a CL language (relative to some an unspecified lexicon). The DTD's URI is http://cl.tamu.edu/docs/cl.dtd. <!ELEMENT formula (and | or | implies | iff | not | forall | exists | atom)> <!ELEMENT and (formula*)> <!ELEMENT or (formula*)> <!ELEMENT implies (formula, formula)> <!ELEMENT iff (formula, formula)> <!ELEMENT not (formula)> <!ELEMENT forall (varlist, formula)> <!ELEMENT exists (varlist, formula)> <!ELEMENT atom ((con | var | fnterm), (con | var | fnterm | seqvar)*)> <!ELEMENT fnterm ((con | var | fnterm), (con | var | fnterm | seqvar)+)> <!ELEMENT varlist (var | seqvar | sortvar)*> <!ELEMENT sortvar (var, con)> <!ELEMENT con (#PCDATA)> <!ELEMENT var (#PCDATA)> <!ELEMENT seqvar (#PCDATA)> Thus, for example, in a language satisfying this DTD, "Every boy kissed a girl" would be rendered as follows:
<formula>
<forall>
<varlist>
<sortvar>
<var>x</var>
<con>Boy</con>
</sortvar>
</varlist>
<exists>
<varlist>
<sortvar>
<var>y</var>
<con>Girl</con>
</sortvar>
</varlist>
<atom>
<con>Kissed</con>
<var>x</var>
<var>y</var>
</atom>
</exists>
</forall>
</formula>
It is straightforward to show that any language defined by the above DTD is CL-conformant in the sense to be defined in the following section. ConformanceCL languages are both syntactically anarchic (hence rather non-traditional) and quite powerful expressively. In many contexts, one might desire to use a language that is more structured, less expressive, or both — as is the case with most familiar first-order languages. If conformance with CL required one to adopt both the anarchic syntax of CL languages and its full expressive power, it is unlikely that CL would receive wide acceptance. Hence, conformance comes in two varieties: direct, for languages that fully embrace both CL's anarchic syntax and its semantic expressiveness, and indirect, for more languages that are more constrained syntactically, semantically, or both. Direct ConformanceA given language is directly conformant with the CL standard just in case it is an instance of a CL language. Hence, as just illustrated, to demonstrate that a language L* is directly conformant, one must simply:
Indirect ConformanceAs indicated, more constrained languages can still be thought of as CL conformant in a robust, well-defined sense. Specifically, where L is a CL language, we define a subset L′ ⊆ L to be indirectly conformant relative to L just in case L′ is recursive. Hence, in general, to show that a given language L′ (simply a set of formulas, recall) is indirectly conformant, one must simply provide a recursive specification of L′ relative to some CL language L. Typically, of course, a specification of an indirectly conformant language will be provided independent of any specific CL language. The class of interpretations for an indirectly conformant language L′ can simply be thought of as identical to the class of interpretations for its CL superlanguage L where the true-in relation is restricted to L′. However, typically, once again, it is assumed that the notion of interpretation can be defined for L′ independently of any directly conformant language. A language will be said to be CL conformant (conformant, for short) just in case it is either a CL language or indirectly conformant relative to some CL language. Example: The Language of Traditional FOLThe traditional language of first-order logic, relative to some choice of constants, is a prime example of an indirectly conformant language. Specifically, let L be a CL language for some lexicon λ such that SeqVar = ∅. Let p-arity and f-arity be total recursive functions from disjoint subsets Pred, Func of Con into the set of positive integers. Let τ ∈ Con. We say that τ is an n-place predicate if p-arity(τ) = n, and that τ is an n-place function symbol if f-arity(τ) = n. Otherwise we say that τ is an individual constant. Let IndCon = Con - (Pred ∪ Func) . Let Trm* be the smallest set containing IndCon and OrdVar and containing App(α,τ1,…,τn) whenever α is an n-place function symbol and τ1,…,τn ∈ Trm*. Let arity be p-arity ∪ f-arity. We then define the traditional first-order (TFO) sublanguage L1 of L determined by arity to be those formulas φ of L that satisfy the following two conditions:
L1 is clearly indirectly conformant. First-order CL and Traditional First-order LanguagesIn this section we clarify the relation between first-order CL (henceforth, "CL1") languages and more traditional first-order languages. We will show that CL1 languages and their FO counterparts are equally expressive in a well-defined sense. Traditional First-order Languages and Their Model TheoryWe will exploit the notion of a TFO sublanguage of a CL language to clarify the connection between traditional first-order logic and first-order CL. Specifically, we will clarify the connection between a CL1 language and its TFO counterparts. There is no loss of generality here, since any first-order language can be thought of as a TFO sublanguage of some CL language. We begin by altering our general CL semantics slightly to define a variant of traditional first-order model theory for TFO sublanguages. To motivate this alteration, note that, because we include relations in the basic logical ontology of CL, the validities of a TFO language with respect to the model theory of CL are not coextensive with the validities of that language relative to traditional model theory. For instance, the following is valid relative to CL's model theory:8a
(=> (and (P a)
(not (Q a)))
(not (forall (?x ?y)
(= ?x ?y))))
The reason for this is that, in CL, there is no intrinsic distinction between predicates and individual constants, and, as befits a classical model theory, all constants denote. This does not change with the introduction of the arity functions that generate a TFO language. Hence, in such languages, predicates denote objects in the domain of quantification no less than individual constants. Thus, in any CL interpretation of the sentence above, 'P' and 'Q' both denote. And since the denotation of only one has the denotation of 'a' in its extension, it follows that 'P' and 'Q' cannot denote the same thing, and hence that there cannot be only one thing in the domain. In traditional first-order model theory, however, predicates do not denote objects in the domain of an interpretation, they only have extensions over that domain. Hence, the above sentence will be false in interpretations containing a single object that is in the extension of 'P' but not 'Q'. It is straightforward to circumscribe a subclass of CL interpretation, and a corresponding notion of truth, relative to which validity is coextensive with more traditional first-order model theory. Thus, let L be a CL language and L1 be a traditional first-order sublanguage of L determined by arity. An interpretation I = 〈D,ext,skol,V〉 for L is L1-agreeable just in case the following conditions hold (where, as usual, D = A ∪ R):
It is nearly trivial to transform an L1-agreeable CL interpretation into a more traditional first-order interpretation. The definition of what it is for a formula φ of L1 to be true1 in an L1-agreeable interpretation I = 〈D,ext,skol,V〉 of L is identical with the definition of truth in I except for the quantificational clauses, which differ slightly. Specifically, say that a [χ1,…,χn]-variant V′ of V is L1-agreeable iff V′(χi) ∈ A whenever χi is a variable.9 Then:
φ is valid1 iff it is true1 in all L1-agreeable interpretations. It is easy to see that the valid1 formulas of L1 are exactly the traditional first-order validities. Notably, our CL-valid formula above is obviously not true in an L1-agreeable interpretation I in which V('a') is the only object in the set A of individuals of the domain D of I. Intepreting TFO Sublanguages in CL1In this section we show that TFO languages are interpretable in CL in two very natural senses, one interpretation-relative and the other interpretation-independent. Interpretability I: Interpretability Relative to an InterepretationThe first notion of interpretability plays off the fact that, relative to an L1-agreeable interpretation, the definition of truth1 differs from the definition of truth only in the range of the quantifiers. This suggests the following set of definitions. Let L be a CL1 language – for definiteness, let us assume KIF syntax – and let L1 be the TFO sublanguage of L generated by an arity function arity. Let L+ be the result of adding a single predicate 'Ind' to L. For any L1-agreeable interpretation I = 〈D,ext,skol,V〉 for L (where, as usual, D = A ∪ R), let I+ = 〈D+,ext+,skol+,V+〉 be any interepretation such that
Now define a simple mapping + from the sentences of L1 into those of L+ as follows:
So, for example, let φ be the sentence
(forall (?x (?d Direction) (?t1 Time) (?t3 Time))
(if (and (moving-in ?x ?d ?t1)
(not (exists (?y (?t2 Time))
(and (between ?t2 ?t1 ?t3)
(acts-on ?y ?x ?t2)))))
(moving-in ?x ?d ?t3)))
expressing the proposition that if an object is moving in a certain
direction at a given time t1 then it is still moving in that
direction at a later time t3 if nothing acts upon it at any
intervening time. Then φ+ is
(forall ((?x Ind) (?d Direction) (?t1 Time) (?t3 Time))
(if (and (moving-in ?x ?d ?t1)
(not (exists ((?y Ind) (?t2 Time))
(and (between ?t2 ?t1 ?t3)
(acts-on ?y ?x ?t2)))))
(moving-in ?x ?d ?t3)))
Given our two + functions we have the following simple theorem: Let I be any L1-agreeable interpretation for L. Then for any L1 sentence φ, φ is true1 in I iff φ+ is true in I+. The proof is a simple induction on the formulas of L1. Interpretability II: TFO Languages as CL1 TheoriesThe function arity that generates a TFO sublanguage L1 of a CL1 language L separates the syntactically undifferentiated constants of L into n-place predicates, n-place function symbols, and individual constants. This partitioning of the constants explicitly reflects the intuitive, but typed, ontology of traditional first-order logic that is expressed in its semantics – relations (including functions) and individuals. CL1 basically shares the same ontology, albeit untyped: relations are first-class logical citizens. We can therefore make the implict ontology of TFO languages in L despite its undifferentiated constants simply by extending L to a new language L++ by introducing appropriate new constants and interpreting them in a way that parallels the semantics of traditional first-order logic. And we can capture its typed character by suitably restricting the quantifiers, as in the first notion of interpretability. Moreover, we can axiomatize this ontology explicitly as a theory of L++. Specifically, we show that, for any TFO sublanguage L1 of a CL1 language L, there is a theory in a "natural" extension L++ of L whose models are exactly (slightly modified versions of) the class of L1-agreeable interpretations. [Details forthcoming…] Intepreting CL1 Languages as TFO TheoriesIn logic, as in life generally, turnabout is fair play. Just as we can "translate" any given TFO language into a CL1 theory, so we can translate any CL1 language into a theory in a TFO language. [Details forthcoming…] Notes1. If SeqVar is empty, then languages built on λ will be first-order. We allow SeqVar to be empty to allow to allow first-order languages to be fully conformant without embracing sequence variables. 2. T is a smallest such class just in case it satisfies the conditions in question but is not a proper superclass of any other class satisfying those conditions. 3. Where Range(App) = { τ ∈ Trm : for some x, App(x) = τ}. 4. Suppose φ ∈ Fla has an infinite decomposition. Then Fla – {φ} still satisfies the conditions above, as closure under the operations in the generator set only requires finite compositions of those operations applied to the base sets. But then Fla is not a smallest class of the relevant sort, contrary to its definition. This will be important for the semantics of CL languages below. 5. We identify the first rather than the last element of an n-tuple in the extension of a function with the value of the function, as this increases the usability of an important sublanguage of any CL langage. This will be discussed below. 6. Note that, on this semantics, '(∃x)F(x,y)' entails, but is not entailed by, '(∃x)x = F(y)' (indeed, as in classical first-order logic, the latter is a logical truth of our semantics). Hence, perhaps somewhat paradoxically at first sight, from the fact that something is identical to the FatherOf 17, it doesn't follow that 17 has a father. Note, however, that this is going to be an issue for any language that
7. More exactly, where s = 〈e1,…,en〉 and s′ = 〈en+1,…,en+m〉, cnct(s,s′) = 〈s1,…,sn+m〉. 8. It is perhaps most natural to take the expressions of KIF to be strings, but other construals (e.g., sequences) are of course possible. 8a. This fine example is due to Ian Horrocks. 9. We only need to consider this case because when χi = 〈ν,κ〉 we are already guaranteed by the definitions of a [χ1,…,χn]-variant and an L1-agreeable interpretation that V′(ν) ∈ A. |