Quantifier scopes

An existential of the document reaches into quoted formulas, unless one declares its own.

quantifier-scopes-n3.n3 · output · proof · check · playground


The question

A report quotes that someone saw a comet, and the document asserts that this someone is an astronomer. A rumor quotes that someone waved. Which source quotes a known astronomer?


Historical background

The 2011 Notation3 submission specified explicit universal and existential quantification alongside nested formulas. With both features, a document can need to distinguish a name bound at the top level from the same name redeclared inside one formula. That distinction is the test in this deck. W3C Team Submission, Notation3 quantification


What the N3 says

@forSome :someone .
:report :says { :someone :saw :comet } .
:someone a :Astronomer .

:rumor :says {
    @forSome :someone .
    :someone :waved :hello
} .

{ ?source :says { ?who :saw :comet } . ?who a :Astronomer }
    => { ?source :credibleObserver ?who } .
{ ?source :says { ?who :waved :hello } . ?who a :Astronomer }
    => { ?source :wavingAstronomer ?who } .

A declaration binds its IRI in its formula and in the formulas inside it. The document’s :someone is therefore one individual, quoted and asserted alike. The rumor’s formula declares :someone again, which shadows the outer one: its waver is a different, local individual.


What gets compiled

fact(rdf(iri("http://example.org/report"), iri("http://example.org/says"), graph([rdf(bnode('n3', "someone"), iri("http://example.org/saw"), iri("http://example.org/comet"))])))
fact(rdf(bnode('n3', "someone"), iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), iri("http://example.org/Astronomer")))
fact(rdf(iri("http://example.org/rumor"), iri("http://example.org/says"), graph([rdf(qbnode("someone_2.2"), iri("http://example.org/waved"), iri("http://example.org/hello"))])))

The document’s existential is one constant, bnode('n3', "someone"), in the report’s graph term and in the asserted fact. The rumor’s own existential is a variable of its graph term, qbnode(...). A rule variable such as ?who never stands for a graph term’s own variable, so the rumor’s waver cannot be named outside its quote.


What eyemind concludes

:report :credibleObserver _:b0 .

The check report records the answer with the document’s existential:

rdf(iri('http://example.org/report'), iri('http://example.org/credibleObserver'), bnode('n3', 'someone'))

The rumor’s waver is no known astronomer, so nothing follows about it.


What the proof establishes

The report ends with verdict('checked'). The proof’s one derived fact replays its firing: the premises are the source facts, which share the term bnode('n3', 'someone'), and the graph term is matched by a helper whose backward search the proof’s call tables answer. Those tables also show that the rumor’s graph matches nothing and that no :wavingAstronomer triple holds, so the claims are every answer of the original questions.


Try it

node bin/eyemind.js examples/quantifier-scopes-n3.n3
node bin/eyemind.js --program examples/quantifier-scopes-n3.n3 > /tmp/quantifier-scopes.js
node bin/eyemind.js --check-proof examples/proof/quantifier-scopes-n3.js examples/quantifier-scopes-n3.n3