Key Issues of Common-Sense Reasoning

Understanding and modeling common-sense reasoning, in such a way that it can be automatically performed, is considered here as the key challenge that once achieved would allow systems for Ambient Intelligence to be indeed intelligent. According to E. K. Muller, there are some fundamental key issues that must be addressed by any method for common-sense reasoning.

Automating commonsense reasoning is a task that requires an expressive-enough language, a knowledge base where to store such a large amount of knowledge, and a set of mechanisms capable of manipulating this knowledge, so as to infer new information.

Scone is an open-source knowledge based system written in Common Lisp. The main difference with respect other approaches is found in the way how search and in- ference are implemented. Scone adopts a marker-passing algorithm [1] devised to be run in the NETL machine [2]. Despite the fact that these marker-passing algo- rithms cannot be compared with general theorem-provers, they are indeed quicker, and most of the search and inference operations involved in common-sense reasoning are supported: inheritance of properties, roles, and relations in a multiple-inheritance type hierarchy; default reasoning with exceptions; detecting type violations; search based on set intersection; and maintaining multiple, overlapping world-views at once in the same knowledge base.

Resorting to the scenarios described in [3] the following items are intended to validate the suitability of Scone for automating common-sense reasoning. To this end, the scenarios described in [3] are going to be implemented in Scone, satisfying the requirements stated so as to automate common-sense reasoning.

Representation

"In the living room, Lisa picked up a newspaper ..."

(new-indv {Lisa} {person})
(new-is-a {Lisa} {female})
(new-indv {living room} {room})
(new-type {newspaper} {thing})
(new-indv {Lisa newspaper} {newspaper})

(new-event-indv {Lisa takes up} {take up})
(in-context {take up bc})
(the-x-of-y-is-z {pickedObject} {lisa takes up} {lisa newspaper})
(the-x-of-y-is-z {picker} {lisa takes up} {lisa})

Properties, Events, and Time

“We must represent Lisa, the newspaper, and the living room.”

(new-indv {Lisa} {person})
(new-is-a {Lisa} {female})
(new-indv {living room} {room})
(new-type {newspaper} {thing})
(new-indv {Lisa newspaper} {newspaper}) 

“We need to represent the time-varying locations of Lisa and the newspaper.”

CL-USER> (in-context {take up bc})
{events:take up bc}
CL-USER> (the-x-of-y-is-z {pickedObject} {lisa takes up} {lisa newspaper})
{events:Lisa newspaper is the pickedObject of Lisa takes up (0-2673)}
CL-USER> (the-x-of-y-is-z {picker} {lisa takes up} {lisa})
{events:Lisa is the picker of Lisa takes up (0-2674)}
CL-USER>  (the-x-of-y-is-z {pickedObjectLocation} {lisa takes up} {living room})
{events:living room is the pickedObjectLocation of Lisa takes up (0-2675)}

;; we ask about Lisa and the Lisa Newspaper location
CL-USER> (statement-true? {lisa} {is located at} {kitchen})
NIL
CL-USER> (statement-true? {lisa} {is located at} {living room})
{events:picker is located at pickedObjectLocation (0-2641)}
CL-USER> (statement-true? {lisa} {is located at} {bedroom})
NIL
CL-USER> (get-the-x-of-y {pickerlocation} {lisa takes up})
{events:living room}
CL-USER> (get-the-x-of-y {pickedobjectLocation} {lisa takes up})
{events:living room}
CL-USER> (statement-true? {lisa newspaper} {is located at} {kitchen})
NIL
CL-USER> (statement-true? {lisa newspaper} {is located at} {living room})
{events:pickedObject is located at pickedObjectLocation (0-2642)}

;; Now, without having said anything about the Lisa Newspaper location, when Lisa change her location so does the Lisa's Newspaper 
CL-USER> (the-only-x-of-y-is-z {pickerlocation} {lisa takes up} {bedroom})
{events:bedroom is the pickerLocation of Lisa takes up (0-2672)}
CL-USER> (get-the-x-of-y {pickedobjectLocation} {lisa takes up})
{events:bedroom}
CL-USER> (statement-true? {lisa newspaper} {is located at} {living room})
NIL
CL-USER> (statement-true? {lisa newspaper} {is located at} {bedroom})
{events:pickedObject is located at pickedObjectLocation (0-2642)}

“We need to represent the event of Lisa picking up the newspaper”.

CL-USER> (new-event-indv {Lisa takes up} {take up})
{events:Lisa takes up}

“We must represent that Lisa picked up the newspaper when she and the newspaper were in the living room”.

That requirement is achieved by stating that as a constraint of the event. The picker has to be located in the same place as the pickedObjectLocation
(new-statement {picker} {is located at} {pickedObjectLocation})

Object Identity

"We must represent that Lisa and the newspaper are not the same object"

We ask if both things are the same thing:
CL-USER> (is-x-eq-y? {lisa} {lisa newspaper})
NIL 

Reasoning

“We can perform common-sense reasoning or inference.”

If Lisa is located at the kitchen, and now se moves from the kitchen to the living room, where is she now?
CL-USER> (new-event-indv {Lisa moves} {move})
{events:Lisa moves}
CL-USER>  (the-x-of-y-is-z {after context} {lisa moves}   {move ac})
{events:move ac is the after context of Lisa moves (0-2662)}
CL-USER> (the-x-of-y-is-z {before context} {lisa moves}  {move bc})
{events:move bc is the before context of Lisa moves (0-2663)}
CL-USER> (the-x-of-y-is-z {movingObject} {lisa moves} {lisa})
{events:Lisa is the movingObject of Lisa moves (0-2664)}
CL-USER> (the-x-of-y-is-z {moveOrigin} {lisa moves} {kitchen})
{events:kitchen is the moveOrigin of Lisa moves (0-2665)}
CL-USER> (the-x-of-y-is-z {movingObjectLocation} {lisa moves} {kitchen})
{events:kitchen is the movingObjectLocation of Lisa moves (0-2666)}
CL-USER> (the-x-of-y-is-z {moveDestination} {lisa moves} {living room})
{events:living room is the moveDestination of Lisa moves (0-2667)}
CL-USER> (in-context {move bc})
{events:move bc}
CL-USER> (statement-true? {lisa} {is located at} {kitchen})
{events:movingObject is located at moveOrigin (0-2611)}
CL-USER> (statement-true? {lisa} {is located at} {living room})
NIL
CL-USER> (statement-true? {lisa} {is located at} {bedroom})
NIL
CL-USER> (in-context {move ac})
{events:move ac}
CL-USER> (statement-true? {lisa} {is located at} {kitchen})
NIL
CL-USER> (statement-true? {lisa} {is located at} {living room})
{events:movingObject is located at moveDestination (0-2616)}
CL-USER> (statement-true? {lisa} {is located at} {kitchen})
NIL

Representation of Common-sense Knowledge

“We must construct representations of common-sense knowledge that ca be used by the reasoning method to reason about this scenario as well as other scenarios”

To this end, we resort to the "Scone context" concept. Therefore, by describing how was the context before an actio took place, and how it is afterwards, we can reason causes and effects of actions.
(new-event-type {move}
 '({event})
 :roles
 ((:type {movingObject} {thing})
  (:type{movingObjectLocation} {place})
  (:type {moveOrigin} {place} :english ("beginning" "start"))
  (:type {moveDestination} {place} :english ("end" "finish")))
 :throughout
 ((new-eq {personLocation} {movingObjectLocation})
  (new-split '({moveOrigin} {moveDestination})))
 :before
 ((in-context (new-context {move bc}))
  (new-statement {movingObject} {is located at} {moveOrigin})
  (the-x-of-y-is-z {movingObjectLocation} {move} {moveOrigin})
  (new-not-statement {movingObject} {is located at} {moveDestination}))
 :after
 ;((in-context {after context})
 ((in-context (new-context {move ac}))
  (new-not-statement {movingObject} {is located at} {moveOrigin})
  (new-statement {movingObject} {is located at} {moveDestination})
  (the-x-of-y-is-z {movingObjectLocation} {move} {moveDestination})))

(in-context {general})
(new-event-type {take up} '({event})
			 :roles
			 ((:type {pickedObject} {thing})
			  (:type {pickedObjectLocation} {place})
			  (:type{pickerLocation} {place})
			  (:type{picker} {person}))
  :throughout
  ((new-eq {picker} {person})
   (new-eq {personlocation} {pickerlocation})
   (the-x-of-y-is-z {personlocation} {picker} {pickerlocation}))
  :before
  ((in-context (new-context {take up bc}))
   (new-statement {picker} {is located at} {pickedObjectLocation})
   (new-statement {pickedObject} {is located at} {pickedObjectLocation})
   (the-x-of-y-is-z {pickerLocation} {take up} {pickedObjectLocation})
   (new-eq {pickerLocation} {pickedObjectLocation})
   (new-eq {personLocation} {pickerLocation}) )
  :after
  ((in-context (new-context {take up ac}))
   (new-statement {picker} {is located at} {pickerLocation})
   (the-x-of-y-is-z {pickedObjectLocation} {take up} {pickerLocation})
   (new-statement {pickedObject} {is located at} {pickerLocation})
   (new-eq {pickedObjectLocation} {pickerLocation})
  (new-statement {picker} {is holding the} {pickedObject})))

Effects of Events

"Given that Lisa picked up the newspaper, and this piece of common-sense knowledge, we should be able to infer that Lisa was then holding the newspaper”

CL-USER> (in-context {take up bc})
{events:take up bc}
CL-USER> (statement-true? {lisa} {is holding the} {lisa newspaper})
NIL
CL-USER> (in-context {take up ac})
{events:take up ac}
CL-USER> (statement-true? {lisa} {is holding the} {lisa newspaper})
{events:picker is holding the pickedObject (0-2655)}

Context-Sensitive Effects

“We should be able to represent that, if a person picks up a slippery object and is not careful, then the person will not be holding the object.”

In order to achieve this requirement, we are going to consider three different contexts. Depending on if the objetc is a slippery object or not, and depending also on if the person that takes up the object is paying attention or no, then the after context to be applied will be different.
:after
  ((in-context {take up slippery object ac})
   (new-statement {picker} {is located at} {pickerLocation})
   (new-statement {pickedObject} {is located at} {pickerLocation})
   (new-not-statement {pickedObject} {is located at} {pickerLocation})
   (new-statement {pickedObject} {is located at} {pickerLocation})
   (new-not-statement {pickedObject} {is located at} {pickerLocation})
   (new-statement {picker} {is holding the} {pickedObject})
   (new-not-statement {picker} {is holding the} {pickedObject})

   (in-context {take up slippery object with attention ac})
   (new-statement {picker} {is located at} {pickerLocation})
   (the-x-of-y-is-z {pickedObjectLocation} {take up} {pickerLocation})
   (new-statement {pickedObject} {is located at} {pickerLocation})
   (new-eq {pickedObjectLocation} {pickerLocation})
   (new-statement {picker} {is holding the} {pickedObject})

   (in-context {take up ac})
   (new-statement {picker} {is located at} {pickerLocation})
   (the-x-of-y-is-z {pickedObjectLocation} {take up} {pickerLocation})
   (new-statement {pickedObject} {is located at} {pickerLocation})
   (new-eq {pickedObjectLocation} {pickerLocation})
   (new-statement {picker} {is holding the} {pickedObject})))

CL-USER> (if (is-x-a-y? (get-the-x-of-y-in-context {pickedObject} {lisa takes up a slippery object})  {slippery object})
	     (if  (statement-true? {lisa} {pays attention to} {lisa takes up a slippery object})
		 (the-x-of-y-is-z {after context} {lisa takes up a slippery object} {take up slippery object with attention ac})
		 (the-x-of-y-is-z {after context} {lisa takes up a slippery object} {take up slippery object ac}))
	     (the-x-of-y-is-z {after context} {lisa takes up a slippery object}  {take up ac}))
{events:take up slippery object ac is the after context of Lisa takes up a slippery object (0-2696)}
CL-USER> (new-statement {picker} {pays attention to} {take up})
{events:picker pays attention to take up (0-2695)}
CL-USER> (if (is-x-a-y? (get-the-x-of-y-in-context {pickedObject} {lisa takes up a slippery object})  {slippery object})
	     (if (statement-true? {picker} {pays attention to} {take up})
		 (the-x-of-y-is-z {after context} {lisa takes up a slippery object} {take up slippery object with attention ac})
		 (the-x-of-y-is-z {after context} {lisa takes up a slippery object} {take up slippery object ac}))
	     (the-x-of-y-is-z {after context} {lisa takes up a slippery object}  {take up ac}))
{events:take up slippery object with attention ac is the after context of Lisa takes up a slippery object (0-2697)}
CL-USER> (get-the-x-of-y {after context} {lisa takes up a slippery object})
{events:take up slippery object with attention ac}
CL-USER> (in-context (get-the-x-of-y {after context} {lisa takes up a slippery object}))
{events:take up slippery object with attention ac}
CL-USER> (statement-true? {lisa} {is holding the} {wet glass})
{events:picker is holding the pickedObject (0-2644)}

Nondeterministic Effects

“We should be able to represent that if a person picks up a slippery object, then the person may or may not be holding the object”

For this key issue, we are going to consider two different types of contexts. Depending on if the object is an slippery object or not, questions would be answered or not.
:after
  ((in-context {take up slippery object ac})
   (new-statement {picker} {is located at} {pickerLocation})
   (new-statement {pickedObject} {is located at} {pickerLocation})
   (new-not-statement {pickedObject} {is located at} {pickerLocation})
   (new-statement {pickedObject} {is located at} {pickerLocation})
   (new-not-statement {pickedObject} {is located at} {pickerLocation})
   (new-statement {picker} {is holding the} {pickedObject})
   (new-not-statement {picker} {is holding the} {pickedObject})

   (in-context {take up ac})
   (new-statement {picker} {is located at} {pickerLocation})
   (the-x-of-y-is-z {pickedObjectLocation} {take up} {pickerLocation})
   (new-statement {pickedObject} {is located at} {pickerLocation})
   (new-eq {pickedObjectLocation} {pickerLocation})
   (new-statement {picker} {is holding the} {pickedObject})))

CL-USER> *context*
{common:general}
CL-USER> (if (is-x-a-y? (get-the-x-of-y-in-context {pickedObject} {lisa takes up a slippery object})  {slippery object})
  	       (if (statement-true? {lisa} {pays attention to} {lisa takes up a slippery object})
	             (the-x-of-y-is-z {after context} {lisa takes up a slippery object} {take up slippery object with attention ac})
	             (the-x-of-y-is-z {after context} {lisa takes up a slippery object} {take up slippery object ac}))
                              (the-x-of-y-is-z {after context} {lisa takes up a slippery object}  {take up ac}))
{events:take up slippery object ac is the after context of Lisa takes up a slippery object (0-2693)}
CL-USER>  (in-context (get-the-x-of-y {after context} {lisa takes up a slippery object}))
{events:take up slippery object ac}
CL-USER> (statement-true? {lisa} {is holding the} {wet glass})
It cannot be predicted because: {events:Not picker is holding the pickedObject (0-2638)} and
 {events:picker is holding the pickedObject (0-2637)}
CL-USER> (statement-true? {wet glass} {is located at} {living room})
It cannot be predicted because: {events:Not pickedObject is located at pickerLocation (0-2636)} and
 {events:pickedObject is located at pickerLocation (0-2635)}

Concurrent Events

“We should be able to represent that certain concurrent events are impossible; for example, a person cannot walk into two rooms simultaneously.”

For this restriction we are going to stablish that both rooms are not equivalent. Furthermore, just one of the them can be the "enteringRoom" of the event.
CL-USER> (in-context {walk into ac})
{events:walk into ac}
CL-USER>(statement-true? {lisa} {is located at} {kitchen})
{events:walker is located at enteringRoom (0-1946)}
CL-USER> (statement-true? {lisa} {is located at} {living room})
NIL
CL-USER>(statement-true? {lisa} {is located at} {bedroom})
NIL
CL-USER> (the-x-of-y-is-z {enteringRoom} {lisa walks into} {living room})
{events:living room} cannot be the {events:enteringRoom} of {events:Lisa walks into}.  Continuing...
NIL

“We must be able to reason about concurrent events with cumulative or canceling effects. For example, if a shopping cart is pushed, it moves forward. If it is pulled, it moves backward. But if it is simultaneously pulled and pushed, then it moves neither forward nor backward; instead, it spins around.”

In order to cancel effects of concurrent events it would be necessary to specify what events are cancelled among themself. To do so, we have defined the relation "cancel effects of". Furthermore, we have also defined the "get-the-after-context-of-concurrent-event" in charge of defining a new after context, result of merging the after contexts of the concurrent events.
(defun get-the-after-context-of-concurrent-event (x y z)
  "Get the resultan after context of a compound event"
  (setq x_ac (get-the-x-of-y {after context} x))
  (if (not (is-x-a-y? x {compound event}))
      (format t "~A should be a compound event" x)
      (if (statement-true? y {cancels effects of} z)
	  (progn
 	    (format t "~A cancels the effects of ~A" y z)
	    (setq current_context *context*)
	    (in-context x_ac)
	    (new-statement y {cancels effects of} z)
	    (in-context current_context))
	  (progn
	    (with-temp-markers (m m1)
	      (loop for i in (list-context-contents (get-the-x-of-y {after context} y))
		 do(progn
		     (mark-context-contents (get-the-x-of-y {after context} y) m)
		     (mark-context-contents (get-the-x-of-y {after context} z) m1)
		     (loop for j in (list-marked m)			    
			do (connect-wire :context (lookup-element j) (lookup-element x_ac)))
		     (loop for j in (list-marked m1)
			do (connect-wire :context (lookup-element j) (lookup-element x_ac))))))))))

CL-USER> (get-the-after-context-of-concurrent-event  {pullandpush} {push} {pull})
{push} cancels the effects of {pull}
{common:general}
CL-USER> (list-context-contents {pullandpush ac})
({events:push cancels effects of pull (0-1996)})

Space

“We must be able to deal with space. We must represent the knowledge that, after a person walks into a room, the person will be in that room. From this knowledge and the fact that Lisa walked into the kitchen, we should be able to infer that afterward Lisa was in the kitchen. “

;; (load "/home/mjsantof/repo/mariajose.santofimia/tesis/CMU/Scone/files/pathToFiles")
;; (load-kb "/home/mjsantof/repo/mariajose.santofimia/tesis/CMU/Scone/files/keyIssues/KI_9.lisp")
(load-kb KI_9.lips)
CL-USER> (in-context {walk into bc})
{events:walk into bc}
CL-USER>(statement-true? {lisa} {is located at} {bedroom})
{events:walker is located at from (0-1939)}
CL-USER> (statement-true? {lisa} {is located at} {kitchen})
NIL
CL-USER> (in-context {walk into ac})
{events:walk into ac}
CL-USER> (statement-true? {lisa} {is located at} {kitchen})
{events:walker is located at enteringRoom (0-1948)}
CL-USER> (statement-true? {lisa} {is located at} {bedroom})
NIL
CL-USER> (get-the-x-of-y-in-context {walkerlocation} {lisa walks into})
{events:kitchen}
CL-USER> (in-context {walk into bc})
{events:walk into bc}
CL-USER> (get-the-x-of-y-in-context {walkerlocation} {lisa walks into})
{events:bedroom}

Indirect Effects

“Where did the newspaper end up? It ended up in the kitchen” We know that, if a person is holding an object, then the object moves along with the person.

CL-USER> (in-context {take up bc})
{events:take up bc}
CL-USER> (get-the-x-of-y-in-context {pickedObjectLocation} {Lisa takes up})
NIL
CL-USER> (get-the-x-of-y {pickedObjectLocation} {Lisa takes up})
{events:living room}
CL-USER> (in-context {take up ac})
{events:take up ac}
CL-USER> (get-the-x-of-y {pickedObjectLocation} {Lisa takes up})
{events:living room}
CL-USER> (the-only-x-of-y-is-z {pickerLocation} {Lisa takes up} {Bedroom})
{events:bedroom is the pickerLocation of Lisa takes up (0-1901)}
CL-USER> (get-the-x-of-y {pickedObjectLocation} {Lisa takes up})
{events:bedroom}
CL-USER> (get-the-x-of-y {pickedObject} {Lisa takes up})
{events:Lisa newspaper}

Common Sense Law of Inertia

“The book was gone... “ In this case we should be able to infer that someone took the book out of the room (or a natural phenomenon occurred): What happened to the book? Someone must have taken it!

(load-kb KI_13.lips)

CL-USER> (list-events-causing-x (lookup-element (new-statement {lisa newspaper} {is located at} {lisas bedroom})))
({events:Lisa moves} {events:watchDevice} {events:locateReport}
 {events:findLocation} {events:locate} {events:watchArea})

Delayed Effects and Continuous Change

“Jamie walks to the kitchen sink, puts the stopper in the drain, turns on the faucet, and leaves the kitchen”

(new-event-type {turn on faucet} '({event} {turn on} {turn off faucet})
				    :roles
				    ((:indv {turnedOnFaucet} {faucet}))
   :before
   ((in-context (new-context {turn on faucet bc}))
    (new-statement {turnedOnFaucet} {status} {off}))
   :after
   ((if(eq (get-the-x-of-y {sinkTapStatus} {faucetSink}) {opened tap})
       (progn    
	 (in-context (new-context {turn on faucet ac}))
	 (new-statement {turnedOnFaucet} {status} {on})
	 (new-statment {faucetLiquid} {is being dropped through} (get-the-x-of-y {sinkPipe} {faucetSink})))
       (progn
	 (in-context (new-context {turn on faucet ac}))
	 (new-statement {faucetLiquid} {is contained in} {faucetSink})
	 (in-context (new-context {turn on faucet DE}))
	 (new-statement {faucetSink} {gets overflowed with} {faucetLiquid})
	 (new-statement {faucetSink} {is dropping} {faucetLiquid})))))

Release from the Common Sense Law of Inertia

Notice that the water level continues to change after the event of turning on the faucet.

Therefore we must be able to represent that, after the faucet is turned on, the water level is released from the commonsense law of inertia and is permitted to vary. We must further represent that the water level is proportional to the time elapsed since the faucet was turned on.
(load-kb KI_15.lips)
(load-kb event-calculus.lisp)
CL-USER> (in-context {turn on faucet bc})
{events:turn on faucet bc}
CL-USER> (list-context-contents *context*)
({events:LEVEL of faucetLiquid holds at instant T0 (0-2586)}
 {events:turn on faucet bc has LEVEL of faucetLiquid (0-2585)}
 {events:LEVEL of faucetLiquid} {events:faucetValve status off (0-2584)})
CL-USER> (in-context {turn on faucet ac})
{events:turn on faucet ac}
CL-USER> (list-context-contents *context*)
({events:LEVEL of faucetLiquid holds at instant T2 (0-2590)}
 {events:LEVEL of faucetLiquid releases at instant T1 (0-2589)}
 {events:faucetValve status on (0-2588)})
CL-USER> *current-time-point*
{events:instant T1}
CL-USER> (get-element-fluent  (lookup-element {faucetliquid}) :level)
(* FLOW (/ T_S BASEAREA))
CL-USER> (get-element-fluent  (lookup-element {faucetliquid}) :level {instant-t0})
EMPTY
CL-USER> (get-element-fluent  (lookup-element {faucetliquid}) :level {instant-t2})
FULL
CL-USER> (get-element-fluent  (lookup-element {faucetliquid}) :level {instant-t1})
(* FLOW (/ T_S BASEAREA))
CL-USER> (properties (lookup-element {faucetliquid}))
(:LEVEL-AT-INSTANT-T2 FULL :LEVEL-AT-INSTANT-T1 (* FLOW (/ T_S BASEAREA))
 :LEVEL-AT-INSTANT-T0 EMPTY :LEVEL FULL :ENGLISH-NAMES
 (("faucetLiquid" . :INVERSE-ROLE)))

Triggered Events

Default Reasoning

Mental States

Modeling Mental Contexts and Their Interactions

Reasoning Types

Bibliography

[1] S.E. Fahlman, Marker-Passing Inference in the Scone Knowledge-Base System, in: First International Conference on Knowledge Science, Engineering and Man- agement (KSEM’06), Springer-Verlag (Lecture Notes in AI), 2006.

[2] S.E. Fahlman, NETL: A System for Representing and Using Real-World Knowl- edge, MIT Press, Cambridge, MA, 1979.

[3] E. T. Mueller, Commonsense Reasoning, Morgan Kaufmann, ISBN 0-12-369388-8, 2006.