Modeling Dialog in ICARUS using abductive reasoning

There are four [agent]s and one thing: M C P1 O; (= I1 (injury-of P1))

      (Trust ?p) <== (and (not (= ?p me)) (can-hear me ?p))
      (belief ?p1 (can-hear ?p2 ?p1)) <== (and (= ?p1 me) (can-hear me ?p2))

Initial State S0

      --in All------------------------
      (= me [self])
      (can-hear me me)
      (trust me)

      --In M--------------------------- 
      (can-hear me C)
      (injured P1) -- this cannot be in his model of C or 
                      or he wouldn't do an inform
      -- (= me M)
      -- (can-hear me me)
      -- (Trust me)
      -- (Trust C)
         --In C------------------------ 
         -- (= me C)
         -- (can-hear me me)
         -- (can-hear C M) --> (one-hear me M)
         -- (Trust me)
         -- (Trust C)

      --In C------------------------ 
      (can-hear me M)
      -- (= me C)
      -- (can-hear me me)
      -- (Trust me)
      -- (Trust M)
         --In M------------------------ 
         -- (= me M)
         -- (can-hear me me)
         -- (can-hear M C) --> (one-hear me C)
         -- (Trust me)
         -- (Trust M)

      --In O--------------------------- 
      (can-hear me C)
      (can-hear me M)
      -- (= me M)
      -- (can-hear me me)
      -- (Trust me)
      -- (Trust C)
      -- (Trust M)

         --In M------------------------ 
         -- (= me M)
         -- (can-hear me me)
         -- (can-hear M C) --> (one-hear me C)
         -- (Trust me)
         -- (Trust C)
            --In C------------------------ 
            -- (= me C)
            -- (can-hear me me)
            -- (can-hear C M) --> (one-hear me M)
            -- (Trust me)
            -- (Trust C)

         --In C------------------------ 
         -- (= me C)
         -- (can-hear me me)
         -- (can-hear C M) --> (one-hear me M)
         -- (Trust me)
         -- (Trust C)
            --In M------------------------ 
            -- (= me M)
            -- (can-hear me me)
            -- (can-hear M C) --> (one-hear me C)
            -- (Trust me)
            -- (Trust C)

         
M - We have an injured person.
    inform C (of M's belief B)
    request-help (indirect speech act)    

       new general entries to working memory? or general memory

       (hears me (say M *(injured P1)))        
       (belief me (said M *(injured P1))
       (belief me (hears C (say M *(injured P1)))))
       (belief me (belief C (said M *(injured P1))))
       (belief me (belief C (injured P1)))
       (belief me (hears M (say M *(injured P1)))))
       (belief me (belief M (said M *(injured P1))))
       (belief me (belief M (injured P1)))  ;; of course M already believed it!!!
       (belief me (injured P1))

       general statements

       (hears X (say Y S)) then
         (said Y S)
       (and (hears X (say Y S)) (can-hear ?p Y)) then
         (believes X (hears ?p (say Y S))
       (belief me (belief me ,[statement]) then
         (belief me ,[statement])
       (say Y *,[statement]) and (trusts X Y)) then
         (believes X (believes Y ,[statement]))
       ((hears X (say Y *,[statement]) and (trusts X Y)) then
         (believes X (believes Y ,[statement]))
       ((hears X (say Y *,[statement]) and (trusts X Y)) then
         (believes X ,[statement]))
       

C - Where is the injury?
    wh-question
    Location-question (where is)
    Note where does the name fo 'the injury' come from
      and how do we know its P1's injury
      do we have functions as term constructer 
      (hears me (say C *(where-is On-His-Body (injury P1))   

    (hears me (say C *(where-is On-His-Body I1))

M - He is bleeding from the left leg and torso
    reply-to-question - finds answer

    (hears me (say M *(reply-to-question 
           *(where-is On-His-Body l1)
           *(breeding P1 'left-leg) ))
    (hears me (say M *(reply-to-question 
           *(where-is On-His-Body l1)
           *(breeding P1 'torso) ))

C - How bad is the bleeding?
    How-bad question
    quantative-judgement
    Which-is-larger (indirect speech act)

    (hears me (say C *(how-bad-is 'the-bleeding)) )
       or
    (hears me (say C *(which-is-larger *(bleeding P1 'left-leg) *(bleeding P1 'torso)) ))

M - The leg is much worse 
    reply-to-question - finds answer

    (hears me (say M *(reply-to-question *(larger *(bleeding P1 'left-leg)) ))

C - Okay, use a tourniquet to stop the bleeding.
    acknowledgement +
    suggestion-to-act +
    reason-for-action 

    (hears me (say C *(acknowledge 'reply-to-question) ))
    (hears me (say C *(suggestion-to-act *(do (apply-tourniquet))) ))
    (hears me (say C *(reason-for-action
       *(do (apply-tourniquet))
       *(goal (stop 'the-bleeding P1)) ))) 

M - Right, where shall I put it?
    acknowledgements + 
    location-question (on agent)

    (hears me (say N *(acknowledge 'suggestion-to-act) ))
    (hears me (say M *(acknowledge 'reason-for-action) ))
    (hears me (say M *(where-do-I-put PI 'the-tourniquit)) )
 
C - Just below the joint above the wound. Keep turning until it stops bleeding.
    reply-to-question (with suggestion-to-act B)

    (hears me (say C *(reply-to-question 
           *(where-do-I-put P! 'the-tourniquit)
           *(suggestion-to-act (and
              *(do (use 
                 (what 'the-tourniquit)
                 (where (just-below (the joint (below 'the wound)))) ))
              *(do (turn
                 (what 'the-tournetiquit)
                 (until (stopped 'the bleeding)) )) )) ))

M - Okay, the bleeding has stopped.
    acknowledgement +
    goal-satisfaction

    (hears me (say M *(acknowledge 'reply-to-question) ))
    (hears me (say M *(goal-satiefied *(stop 'bleeding P!)) ))
    
================================================================

beliefs

  precepts
  
  (hear X ,[sound])
  (say X ,[sentence]) < [sound]

  belief

  (belief X ,[believable-sentence])
  [believable-sentence] = Or[
    [sentence],
    `(belief ,[agent] ,[believable-sentence])] 
    
    ie omits (not (belief A S)) but not (believes A1 (believes A2 S))
    maybe should include (and (belief A1 S1) (belief A2 S2)) 

action/skill

    Currently actions can only 'do' precepts
    there are NO internal actions

    speech acts

    (inform (listener speaker belief)
      (before
        (isA speaker [speaker])
        (isA listener [listener])
        (isA belief [belief])
        (belief speaker belief))
      )
      (do
        (say speaker belief)
      )
      (then
        (belief listener belief)
        (belief listener (belief speaker belief))
      )
    )
   
    (request-help (listener speaker goal)
      (before
        (isA speaker [speaker])
        (isA listener [listener])
        (isA goal [goal])
      )
      (do
        (say speaker *(please-help-with listener goal))
      )
      (then
        (belief listener (goal goal))
      )
    )
  
    (where-is (listener speaker where-is-loc entity)
      (before
        (isA speaker [speaker])
        (isA listener [listener])
        (isA where-is-loc Enum['Geography,On-His-Body,On-Issue, ...])
        (isA amount [amount])
      )
      (do
        (say speaker *(where-is ,where-is-type ,entity))
      )
      (then
        (goal listener (do (answer-question speaker *(where-is ,where-is-loc ,entity))))
      )
    )
  
    (where-is (listener speaker where-is-loc entity)
      (before
        (isA speaker [speaker])
        (isA listener [listener])
        (isA where-is-loc Enum['Geography,On-His-Body,On-Issue, ...])
        (isA entity [entity])
      )
      (do
        (say speaker *(where-is ,where-is-type ,entity))
      )
      (then
        (goal listener (do (answer-question speaker *(where-is ,where-is-loc ,entity))))
      )
    )
  
    (reply-to-question (listener speaker question) 
      (before
        (isA speaker [speaker])
        (isA listener [listener])
        (isA question [question])
      )
      (do
        (if (isAnswer ?answer question)
           (say speaker *(reply-to-question ,question ,answer))
           (say speaker *(reply-to-question ,question 'I-dont-know-the-answer)) )
      )
      (then
        (belief listener (heard speaker request))
      )
   )

    (acknowledge-request (listener speaker request)t 
      (before
        (isA speaker [speaker])
        (isA listener [listener])
        (isA request [request])
      )
      (do
        (say speaker *(acknowledge-request ,request))
      )
      (then
        (belief listener (heard speaker request))
      )
    )


    ; acknowledge the latest speech act
    (acknowledge (listener speaker speech-arc-name) 
      (before
        (isA speaker [speaker])
        (isA listener [listener])
        (isA speech-act-name [speech-act-name])
        (the-last-speech-act-called ?speech-act speech-act-name) 
      )
      (do
        (say speaker *(acknowledge ,speech-act-name))
      )
      (then
        (belief listener (heard speaker ?speech-act))
      )
   )

------------------------------------------------------------------------