001  (ns wildwood.caesar
002    "A dummy set of advocates and knowledge accessors with knowledge about the
003    death of Julius Caesar.
004  
005    # The Case Against Marcus Brutus
006  
007    Did Brutus conspire to kill Caesar in the forum in the Ides of March?
008  
009    Falco, the detective, must find out.
010  
011    ## The witnesses
012  
013    Anthony knows that Brutus is honourable, and that Caesar is buried.
014  
015    Brutus will admit he was in the forum on the ides of March and is a witness
016    that Cassius was also present.
017  
018    Cassius and Longus each bear witness that the other killed Caesar in the
019    Forum on the Ides of March.
020  
021    Drusilla believes that Brutus killed Caesar in the Forum on the Ides of
022    March, but was not a witness. She also bears witness that Caesar was buried
023    on the 18th March.
024  
025    Gaius believes that Brutus killed Caesar in the Forum in April, but was not
026    a witness.
027  
028    ## The rules
029  
030    There is a rule which says that if you kill someone and you have accomplices
031    then you're not honourable, and a default that has-accomplices is false.
032  
033    Note that has-accomplices boils down to
034    > For a given verb, object, location and time, there is more than one subject.
035  
036    That's quite sophisticated to represent.
037  
038    There is a rule which says you can't be killed after you're dead (temporal
039    reasoning).
040  
041    There is a rule which says if you've been killed or been buried then you're
042    dead.
043  
044    The case against Brutus is based on Drusilla's claim and on Gaius's.
045  
046    Drusilla's can be doubted because
047    1. She wasn't a witness and
048    2. Is a woman.
049  
050    Gaius's can be doubted because
051    1. he wasn't a witness, and because
052    2. it's inconsistent with the evidence that Caesar was buried on the 18th.
053  
054    ## The conclusion
055  
056    Thus, I think, Falco must conclude that Brutus didn't kill Caesar, because if
057    he had he must have had accomplices (Cassius and Longus, who clearly were
058    accomplices and implicate one another), but honourable men don't kill with
059    accomplices and Brutus is an honourable man.
060  
061    ## Features
062  
063    The `features` in DTree terms we're interested in to make these inferences are
064  
065    * `did-kill` - true of an entity which is in the subject position of a `kill` proposition;
066    * `was-killed` - true of an entity which is in the object position of a `kill` proposition;
067    * `buried` - true of an entity which is in the object position of a `bury` proposition;
068    * `dead` - true of an entity of which either `was-killed` or `buried` is true;
069    * `honourable` - true of an entity, provided that `did-lie` and `did-murder` are false;
070    * `did-murder` - true of an entity x that `did-kill[x,y]` for some object y is true of,
071    provided that there exists some other entity p of whom `did-kill[p,x]` is also true,
072    or that `was-unarmed[y]` is true;
073    * `did-lie` - true of an entity which has offered a proposition which for other reasons we do not believe. Tricky. False by default and I think we probably leave it at that for now.
074    * `was-unarmed` - true of an entity at a time `t` if they were unarmed at the time.
075  
076    Note that ALL of this is too complex for the simple DTree logic of the Arboretum /
077    KnacqTools generation. They could not unpack propositions as I'm proposing here.
078    "
079    (:require [wildwood.knowledge-accessor :refer [Accessor]]
080              [wildwood.advocate :refer [Advocate]]))
081  
082  
083  (def ides-of-march
084    "16th March, 44BC"
085    (+ -440000 300 16))
086  
087  (def eighteenth-march
088    "18th March, 44BC"
089    (+ -440000 300 18))
090  
091  (def march
092    "The month of March, 44BC, as a range."
093    (sort [(+ -440000 300 1) (+ -440000 300 30)]))
094  
095  (def april
096    "The month of April, 44BC, as a range."
097    (sort [(+ -440000 400 1) (+ -440000 400 30)]))
098  
099  (def anthony-kb
100    "Mark Antony knows that Brutus is honourable, and that Caesar is buried."
101    {:brutus [{:verb :is :subject :brutus :object :honourable}]
102     :caesar [{:verb :bury :subject :calpurnia :object :caesar :date eighteenth-march :nth-hand 1}]})
103  
104  (def brutus-kb
105    "Brutus will admit that he and Cassius were in the forum in the Ides of March"
106    {:brutus [{:verb :present :subject :brutus :object :forum :location :forum :date ides-of-march :nth-hand 1}]
107     :cassius [{:verb :present :subject :cassius :object :forum :location :forum :date ides-of-march :nth-hand 1}]
108     :forum [{:verb :present :subject :brutus :object :forum :location :forum :date ides-of-march :nth-hand 1}
109             {:verb :present :subject :cassius :object :forum :location :forum :date ides-of-march :nth-hand 1}]})
110  
111  (def cassius-kb
112    "Cassius and Longus each bear witness that the other killed Caesar in the
113    Forum on the Ides of March."
114    {:caesar [{:verb :kill :subject :longus :object :caesar :location :forum :date ides-of-march :nth-hand 1}]
115     :longus [{:verb :kill :subject :longus :object :caesar :location :forum :date ides-of-march :nth-hand 1}]
116     :forum [{:verb :kill :subject :longus :object :caesar :location :forum :date ides-of-march :nth-hand 1}]})
117  
118  (def drusila-kb
119    "Drusila has heard that Brutus killed Caesar in the forum. She keys it on all three, for efficiency
120    of retrieval."
121    {:caesar [{:verb :kill :subject :brutus :object :caesar :location :forum :date ides-of-march :nth-hand 2}
122              {:verb :bury :subject :calpurnia :object :caesar :date eighteenth-march :nth-hand 1}]
123     :brutus [{:verb :kill :subject :brutus :object :caesar :location :forum :date ides-of-march :nth-hand 2}]
124     :forum [{:verb :kill :subject :brutus :object :caesar :location :forum :date ides-of-march :nth-hand 2}]})
125  
126  (def faldo-db
127    "Falco believes that Caesar has been killed, but doesn't know by whom or when."
128    {:caesar [{:verb :kill :object :caesar :location :forum}]
129     :brutus [{:verb :kill :object :caesar :location :forum}]
130     :forum [{:verb :kill :object :caesar :location :forum}]})
131  
132  (def gaius-db
133    "Gaius has heard that Brutus killed Caesar, but believes it happened in April."
134    {:caesar [{:verb :kill :subject :brutus :object :caesar :location :forum :date april :nth-hand 2}]
135     :brutus [{:verb :kill :subject :brutus :object :caesar :location :forum :date april :nth-hand 2}]
136     :forum [{:verb :kill :subject :brutus :object :caesar :location :forum :date april :nth-hand 2}]})
137  
138  (def longus-kb
139    "Cassius and Longus each bear witness that the other killed Caesar in the
140    Forum on the Ides of March."
141    {:caesar [{:verb :kill :subject :cassius :object :caesar :location :forum :date ides-of-march :nth-hand 1}]
142     :cassius [{:verb :kill :subject :cassius :object :caesar :location :forum :date ides-of-march :nth-hand 1}]
143     :forum [{:verb :kill :subject :cassius :object :caesar :location :forum :date ides-of-march :nth-hand 1}]})
144