Re: Example of applying sorted-nucleus? was Re: [TED] CORE Pages on Positive Conditions and Horn Rules Edited: Slots & Constraints

Michael Kifer wrote:

> Yes, you are right -- the current document is too terse. The intent was to
> expand it in due time with examples. Let me elaborate.

Thank you, this was helpful.

> Mathematically, a sort is just a set and, in theory, it doesn't matter how
> it is defined. But in a concrete KR language there must be a clear and
> simple mechanism that tells which symbols belong to which sort.
> 
> This kind of thing is done in every programming language to various
> degrees.  For instance, in C, things that are sequences of digits belong to
> the sort of integers. Things that look like 123.456 are floats, "..." are
> strings. Alphanumeric things are variable names, type names, and procedure
> names. They are distinguished contextually by their declarations.

The notion of sorts of integers, strings etc and quantification over 
sorts was at least somewhat familiar to me. It was the notion of 
treating the variable names themselves as sorts, as opposed to 
sorted-variables (i.e. where the variable is restricted to range over a 
sort), that was a little surprising at first. Just ignorance on my part.

> So, C and most other programming languages use a combination of syntax and
> explicit declarations to classify their symbols into sorts.
> 
> Now, RIF will need to make similar kinds of decisions. Since RIF is a
> family of languages rather than a single language, our job is harder and we
> need to come up with a simple yet extensible framework for specifying sorts
> to which RIF symbols belong. I am not proposing anything right now, but am
> simply indicating what the choices might be.
> 
> The most flexible framework is based on declarations. That is, each symbol
> can be explicitly or implicitly declared to belong to one of the sorts
> (ints, dates, URIs, predicate symbols, etc.)
> Unfortunately, this may not be a practical solution (at least, I don't know
> of a practical one).

Fine. I couldn't see how the BNF syntax and the description of sorts 
were supposed to tie up, now I understand that there is a known gap 
there to be filled in sometime.

> There are also flexible syntactic solutions. For instance, in RDF they use
> symbol^^type to indicate the sorts of the literals. We could extend that.

Actually that's the N3/Turtle syntax. The RDF/XML syntax uses the 
"rdf:datatype" annotation. Both of which are, of course, just concrete 
representations of the same abstract syntax (which could be expressed in 
Sandro's asn06). The rdf:datatype annotation seems fairly similar to 
Harold's rif:type annotation.

> Unfortunately, this syntax is UGLY. It also is not very flexible if we want
> some sorts to be non-disjoint (e.g., one to extend the other, which is very
> useful; such logics are called order-sorted).

Not sure I follow that. In RDF those datatypes include types which are 
non-disjoint (xsd:decimal contains xsd:integer contains xsd:int etc). It 
is true that a literal can only have a single explicit type and this is 
a limitation but I don't think that limitation fundamentally stems from 
that aspect of the syntax; non-literal individuals are not so restricted 
or course.

> But all this has to do with the abstract syntax only. In XML things are
> quite simple. We could use a combination of implicit sorts based on syntax
> (suitable for primitive data types like strings, integers, time, and date)
> and explicit declarations using the type attribute (for user-defined and
> dialect-defined sorts).

Fair enough, though I think we will probably want explicit types for 
time, date. That's not a problem of course since we've already agreed to 
adopt xsd.

> Now, regarding the RDF instantiation, we could use
> &^$#$%%rdf(prop,object,subject), where &^$#$%%rdf is a special
> predicate symbol for RDF triples.
> 
> The sort of the symbol &^$#$%%rdf would have to be the Boolean sort
> 
>     iri x iri x (iri+literal)
> 
> where iri is a sort that contains all iri symbols and "literal" is a sort
> that contains all primitive data types. iri+literal is the least upper
> bound of the sorts iri and literal.

I realize this just an example but a direct mapping in which rdf 
Properties can be treated as binary predicates (as in the UC8 example) 
would be preferable, I think.

That comment aside this example does reduce my uncertainty, thanks. So 
the components of the boolean sort are what I would informally think of 
as the syntactic entities like 'iri' (URIRefs in RDF-speak) rather than 
the interpretation domain elements that they correspond to ('resources' 
in RDF-speak). Makes sense.

> From this follows a requirement that sorts have to be partially ordered
> (order-sorted).  Most likely the sorts will be organized in a lattice or
> semi-lattice with lub being the union and glb being the intersection of the
> respective sorts.

Sure.

Dave

Received on Monday, 11 December 2006 21:16:17 UTC