Ghent is a city, every city is a human community, so Ghent is one too.
slide32.n3 · output · proof · check · try it in the playground
The question
A small teaching example, numbered after the slide it was made for. Ghent is a city, and every city is a human community.
What is Ghent, and can we choose what Eyeron prints?
What we tell Eyeron
:Ghent a :City .
{
?x a :City .
} => {
?x a :HumanCommunity .
} .
The fact reads “Ghent is a city”. The rule reads “whatever is a city is a
human community”: ?x can stand for anything.
Then a query:
{
?S a ?C .
} log:query {
?S a ?C .
} .
log:query decides what is printed. For every way the left side matches,
the right side is written out. Here both sides are the same pattern, so the
output is every type statement Eyeron knows, whether given or derived.
What Eyeron concludes
:Ghent a :City .
:Ghent a :HumanCommunity .
Without the query Eyeron would print only what it derived. With it, the
given fact :Ghent a :City is part of the answer too.
The proof, step by step
{ :Ghent a :HumanCommunity . }
pe:rule 1;
pe:binding [ pe:var "x"; pe:value :Ghent ];
pe:uses { :Ghent a :City . }.
{ :Ghent a :City . }
pe:fact "slide32.n3".
- Ghent is a human community, by rule 1 with
xstanding for Ghent. - Ghent is a city, a fact of
slide32.n3. This step also supports the second answer directly.
Checked: what the report says
# checked: 2 steps, 2 verified, 0 trusted
pe:condition [ pe:id "C1"; pe:name "resolution"; pe:checked 2; pe:failed 0 ];
pe:condition [ pe:id "C10"; pe:name "call fidelity"; pe:checked 4; pe:failed 0 ].
- C1 resolution: both steps are what they cite.
- C2 well-foundedness, C3 justification, C4 coverage and C7 relevance: the steps form a proper tree, every premise and answer is covered, and nothing is padding.
- C10 call fidelity: both answers really are matches of the query’s pattern, so the printed output is what the query asked for.
No calculation, negation or invented individual is involved, so the other conditions examined nothing. The verdict is checked.
Try it
eyeron examples/slide32.n3 # the answer
eyeron -p examples/slide32.n3 # the answer with its proof
eyeron -c examples/slide32.n3 # the proof, checked
Add :Paris a :City . and run again: Paris is printed both as a city and as a
human community.
Takeaway
One rule turns a fact into a new one, and a query chooses which statements, given or derived, make up the answer.
