Done a bit more work on what I want the caesar dummy to do

This commit is contained in:
Simon Brooke 2020-04-24 08:19:12 +01:00
parent c6f12b4d4e
commit 72f486bc27
3 changed files with 126 additions and 19 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,13 +1,75 @@
(ns wildwood.caesar (ns wildwood.caesar
"A dummy set of advocates and knowledge accessors with knowledge about the "A dummy set of advocates and knowledge accessors with knowledge about the
death of Julius Caesar." death of Julius Caesar.
# The Case Against Marcus Brutus
Did Brutus conspire to kill Caesar in the forum in the Ides of March?
Falco, the detective, must find out.
## The witnesses
Anthony knows that Brutus is honourable, and that Caesar is buried.
Brutus will admit he was in the forum on the ides of March and is a witness
that Cassius was also present.
Cassius and Longus each bear witness that the other killed Caesar in the
Forum on the Ides of March.
Drusilla believes that Brutus killed Caesar in the Forum on the Ides of
March, but was not a witness. She also bears witness that Caesar was buried
on the 18th March.
Gaius believes that Brutus killed Caesar in the Forum in April, but was not
a witness.
## The rules
There is a rule which says that if you kill someone and you have accomplices
then you're not honourable, and a default that has-accomplices is false.
Note that has-accomplices boils down to
> For a given verb, object, location and time, there is more than one subject.
That's quite sophisticated to represent.
There is a rule which says you can't be killed after you're dead (temporal
reasoning).
There is a rule which says if you've been killed or been buried then you're
dead.
The case against Brutus is based on Drusilla's claim and on Gaius's.
Drusilla's can be doubted because
1. She wasn't a witness and
2. Is a woman.
Gaius's can be doubted because
1. he wasn't a witness, and because
2. it's inconsistent with the evidence that Caesar was buried on the 18th.
## The conclusion
Thus, I think, Falco must conclude that Brutus didn't kill Caesar, because if
he had he must have had accomplices (Cassius and Longus, who clearly were
accomplices and implicate one another), but honourable men don't kill with
accomplices and Brutus is an honourable man.
"
(:require [wildwood.knowledge-accessor :refer [Accessor]] (:require [wildwood.knowledge-accessor :refer [Accessor]]
[wildwood.advocate :refer [Advocate]])) [wildwood.advocate :refer [Advocate]]))
(def ides-of-march (def ides-of-march
"16th March, 44BC" "16th March, 44BC"
(+ -440000 300 16)) (+ -440000 300 16))
(def eighteenth-march
"18th March, 44BC"
(+ -440000 300 18))
(def march (def march
"The month of March, 44BC, as a range." "The month of March, 44BC, as a range."
(sort [(+ -440000 300 1) (+ -440000 300 30)])) (sort [(+ -440000 300 1) (+ -440000 300 30)]))
@ -16,27 +78,49 @@
"The month of April, 44BC, as a range." "The month of April, 44BC, as a range."
(sort [(+ -440000 400 1) (+ -440000 400 30)])) (sort [(+ -440000 400 1) (+ -440000 400 30)]))
(def anthony-kb
"Mark Antony knows that Brutus is honourable, and that Caesar is buried."
{:brutus [{:verb :is :subject :brutus :object :honourable}]
:caesar [{:verb :bury :subject :calpurnia :object :caesar :date eighteenth-march :nth-hand 1}]})
(def brutus-kb
"Brutus will admit that he and Cassius were in the forum in the Ides of March"
{:brutus [{:verb :present :subject :brutus :object :forum :location :forum :date ides-of-march :nth-hand 1}]
:cassius [{:verb :present :subject :cassius :object :forum :location :forum :date ides-of-march :nth-hand 1}]
:forum [{:verb :present :subject :brutus :object :forum :location :forum :date ides-of-march :nth-hand 1}
{:verb :present :subject :cassius :object :forum :location :forum :date ides-of-march :nth-hand 1}]})
(def cassius-kb
"Cassius and Longus each bear witness that the other killed Caesar in the
Forum on the Ides of March."
{:caesar [{:verb :kill :subject :longus :object :caesar :location :forum :date ides-of-march :nth-hand 1}]
:longus [{:verb :kill :subject :longus :object :caesar :location :forum :date ides-of-march :nth-hand 1}]
:forum [{:verb :kill :subject :longus :object :caesar :location :forum :date ides-of-march :nth-hand 1}]})
(def drusila-kb (def drusila-kb
"Drusila knows that Longus killed Caesar in the forum. She keys it on all three, for efficiency "Drusila has heard that Brutus killed Caesar in the forum. She keys it on all three, for efficiency
of retrieval." of retrieval."
{:caesar [{:verb :killed :subject :longus :object :caesar :location :forum :date ides-of-march}] {:caesar [{:verb :kill :subject :brutus :object :caesar :location :forum :date ides-of-march :nth-hand 2}
:longus [{:verb :killed :subject :longus :object :caesar :location :forum :date ides-of-march}] {:verb :bury :subject :calpurnia :object :caesar :date eighteenth-march :nth-hand 1}]
:forum [{:verb :killed :subject :longus :object :caesar :location :forum :date ides-of-march}]}) :brutus [{:verb :kill :subject :brutus :object :caesar :location :forum :date ides-of-march :nth-hand 2}]
:forum [{:verb :kill :subject :brutus :object :caesar :location :forum :date ides-of-march :nth-hand 2}]})
(def faldo-db (def faldo-db
"Falco knows that Caesar has been killed, but doesn't know by whom or when." "Falco believes that Caesar has been killed, but doesn't know by whom or when."
{:caesar [{:verb :killed :object :caesar :location :forum}] {:caesar [{:verb :kill :object :caesar :location :forum}]
:brutus [{:verb :killed :object :caesar :location :forum}] :brutus [{:verb :kill :object :caesar :location :forum}]
:forum [{:verb :killed :object :caesar :location :forum}]}) :forum [{:verb :kill :object :caesar :location :forum}]})
(def gaius-db (def gaius-db
"Gaius knows that Brutus killed Caesar, but believes it happened in April." "Gaius has heard that Brutus killed Caesar, but believes it happened in April."
{:caesar [{:verb :killed :subject :brutus :object :caesar :location :forum :date april}] {:caesar [{:verb :kill :subject :brutus :object :caesar :location :forum :date april :nth-hand 2}]
:brutus [{:verb :killed :subject :brutus :object :caesar :location :forum :date april}] :brutus [{:verb :kill :subject :brutus :object :caesar :location :forum :date april :nth-hand 2}]
:forum [{:verb :killed :subject :brutus :object :caesar :location :forum :date april}]}) :forum [{:verb :kill :subject :brutus :object :caesar :location :forum :date april :nth-hand 2}]})
(def marc-anthony-kb
"Mark Antony knows that Brutus is honourable."
{:brutus [{:verb :is :subject :brutus :object :honourable}]})
(def longus-kb
"Cassius and Longus each bear witness that the other killed Caesar in the
Forum on the Ides of March."
{:caesar [{:verb :kill :subject :cassius :object :caesar :location :forum :date ides-of-march :nth-hand 1}]
:cassius [{:verb :kill :subject :cassius :object :caesar :location :forum :date ides-of-march :nth-hand 1}]
:forum [{:verb :kill :subject :cassius :object :caesar :location :forum :date ides-of-march :nth-hand 1}]})