Universal instances

“Everyone has a mother”, but not the same one.

universal-instances-n3.n3 · output · proof · check · playground


The question

Some statements are about everything at once: everything has property p, or everyone has a mother. A particular case can be read off such a statement: s has property p, Bob has a mother. “Everyone has a mother” does not say that one person is everyone’s mother, so Bob’s mother and Liz’s mother must stay apart. Can eyemind read off the cases and keep the mothers apart?


Historical background

Notation3’s explicit quantifiers can occur with nested formulas. The outer universal and the inner existential play the familiar roles of a statement about every individual and a corresponding witness for each one. This example makes their scopes visible in the derived instances. W3C Team Submission, Notation3 quantification


What the N3 says

@forAll :x .
@forSome :y .
:x :p :o .
:x :hasMother :y .

{ :s :p :o } => { :universalInstance :holds true } .
{ :bob :hasMother ?mother } => { :bob :mother ?mother } .
{ :liz :hasMother ?mother } => { :liz :mother ?mother } .

@forAll :x says that :x in this document stands for anything; @forSome :y that :y stands for some individual. Declared in the same formula after @forAll, the existential lies in the universal’s scope: for every x there is some y, and which y may depend on x.


What gets compiled

fact(rdf(X, iri("http://example.org/p"), iri("http://example.org/o")))
fact(rdf(X, iri("http://example.org/hasMother"), bnode('n3', ["y", X])))

Both statements become eyemind facts with a variable: a fact states every instance of its variables. The existential becomes a blank node that carries the universal it depends on, so each x has its own witness.


What eyemind concludes

:universalInstance :holds true .
:bob :mother _:b0 .
:liz :mother _:b1 .

The check report shows the two mothers as different terms:

rdf(iri('http://example.org/bob'), iri('http://example.org/mother'), bnode('n3', ['y', iri('http://example.org/bob')]))
rdf(iri('http://example.org/liz'), iri('http://example.org/mother'), bnode('n3', ['y', iri('http://example.org/liz')]))

What the proof establishes

The report ends with verdict('checked'). Each replayed firing must match its step: Bob’s mother is the instance of the fact with X bound to :bob, so a proof claiming Liz’s witness for Bob fails. The call tables are followed through the fact with variables, which the rule calls with X already bound, so the claims are every answer of the original questions.


Try it

node bin/eyemind.js examples/universal-instances-n3.n3
node bin/eyemind.js --program examples/universal-instances-n3.n3 > /tmp/universal-instances.js
node bin/eyemind.js --check-proof examples/proof/universal-instances-n3.js examples/universal-instances-n3.n3