A universally quantified rule computes a named mother for each human.
N3 source · output · proof · check · playground
The question
Tom and Ann are humans. How can a rule with explicitly declared variables give each a deterministically named mother?
Historical background
Notation3’s quantifiers originally let rule authors mark universal variables and existential witnesses in formulas. RDF 1.1 also described using fresh Skolem IRIs when applications need an identifier in place of a blank node. This example combines explicit scope with a computed identifier for each witness. W3C Team Submission, Notation3 · RDF 1.1 Concepts, replacing blank nodes with IRIs
What the N3 says
@prefix : <http://example.org/> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
# The universal :x matches a human; the universal :y receives the computed IRI.
@forAll :x .
@forAll :y .
{
:x a :Human .
(:mother :x) log:skolem :y
} => {
:x :hasMother :y
} .
# The humans.
:tom a :Human .
:ann a :Human .
Both :x and :y are declared with @forAll, so they are rule variables,
not constants. :x matches a human, and (:mother :x) log:skolem :y binds
:y to the chosen mother IRI. The conclusion uses these bound values.
This expresses the mother scenario with explicit Skolem naming. It does
not demonstrate an @forSome in a rule conclusion: there is no fresh
existential variable or restricted firing. Other examples, such as
shared existentials,
cover N3 existential declarations.
What eyemind concludes
Tom and Ann each have a mother IRI, with different names because their naming keys contain different people.
The check report writes the claims as terms:
// Checked answers: these follow from the input program and are every answer of its questions.
rdf(iri('http://example.org/tom'), iri('http://example.org/hasMother'), iri('https://eyereasoner.github.io/.well-known/genid/eb905bc2bb59e8e75a63d7c627a41516259fdb628ba0182bbe266c6adb9542e4'))
rdf(iri('http://example.org/ann'), iri('http://example.org/hasMother'), iri('https://eyereasoner.github.io/.well-known/genid/62678041c8482f38e049ccd244e1f97de558aabb64c58999bbe309f1d5c6291d'))
What the proof establishes
The proof cites the program compiled from the N3 rule: each :hasMother
triple has a step citing the rule, with the person’s :Human triple and the
computed name as its uses. The call tables hold every answer of the calls
the question makes, including one log:skolem call per person with the IRI
it names. No assumption about a rule’s firing order is needed, because both
conclusion variables are bound by the premise.
The checker follows the certificate without invoking the reasoning engine:
it checks each call table by applying the compiled program one level,
computing the names itself, requires the listing to be closed under the rule,
and replays each listed triple’s firing. The verdict is checked: the
claims follow from the program and are every answer of its question. The
proof cites the clauses of the compiled program, which --program writes
out.
Try it
node bin/eyemind.js examples/explicit-existential-rule-n3.n3
node bin/eyemind.js -c examples/explicit-existential-rule-n3.n3
node bin/eyemind.js --check-proof examples/proof/explicit-existential-rule-n3.js examples/explicit-existential-rule-n3.n3
Add :bob a :Human . to a copy. The same universally quantified rule
computes another mother IRI.
