W3C home > Mailing lists > Public > public-rule-workshop-discuss@w3.org > August 2005

Re: LP Semantics (non-monotonicity) in Usage Scenarios?

From: Michael Kifer <kifer@cs.sunysb.edu>
Date: Sat, 27 Aug 2005 13:51:02 -0400
To: jos.deroo@agfa.com
Cc: sandro@w3.org, public-rule-workshop-discuss@w3.org
Message-Id: <20050827175102.9F17BCB5D3@kiferserv.kiferhome.com>


To: jos.deroo@agfa.com wrote:
> 
> > How would you use non-mon (MMS/LP) features in the three usage
> > scenarios in the draft charter?  Each scenario includes the merging of
> > rulesets created without knowledge of what they would be merged with.
> > I don't see how you can do that safely with a non-monotonic logic.  If
> > a drug-interaction rulebase relies on any kind of non-mon feature,
> > then it's quite possible to give incorrect results when the pharmacy
> > merges it with another drug rulebase.
> >
> > This doesn't exactly require non-mon to be out of scope, but it seems
> > to justify a monotonic logic (eg FOL) as the primary deliverable.
> 
> Hi, Sandro
> 
> To spend my second last holiday, and seeing you writing Prolog,
> I did a small test case..
> 
> This is a piece of Prolog that I tranformed from an N3 piece
> 
> triple(m_Ann,m_complication,m_gastroentritis).
> 
> triple(m_aspirin,m_prescribedFor,m_gastroentritis).
> triple(m_aspirin,m_excludedFor,b_a1).
> triple(b_a1,rdf_first,m_ulcer).
> triple(b_a1,rdf_rest,b_a2).
> triple(b_a2,rdf_first,m_postSurgery).
> triple(b_a2,rdf_rest,rdf_nil).
> 
> triple(XP,m_isPrescribed,XM) :-
>         triple(XP,m_complication,XD),
>         triple(XM,m_prescribedFor,XD),
>         triple(XM,m_excludedFor,XL),
>         triple(XP,m_fineWith,XL).
> 
> triple(XP,m_fineWith,rdf_nil).
> 
> triple(XP,m_fineWith,XL) :-
>         triple(XL,rdf_first,XA),
>         \+ triple(XP,m_complication,XA),
>         triple(XL,rdf_rest,XB),
>         triple(XP,m_fineWith,XB).
> 
> 
> and when I ask
> ?- triple(m_Ann,m_isPrescribed,X).
> 
> I get
> X = m_aspirin
> 
> this is because of the NAF at \+ triple(XP,m_complication,XA)
> 
> 
> When I transform that same piece of N3 to FOL, ready for prover9
> 
> set(auto).
> clauses(sos).
> qname("e:") = 
> iri("http://eulersharp.sourceforge.net/2003/03swap/log-rules#").
> qname("q:") = iri("http://www.w3.org/2004/ql#").
> qname("rdfs:") = iri("http://www.w3.org/2000/01/rdf-schema#").
> qname("log:") = iri("http://www.w3.org/2000/10/swap/log#").
> qname("m:") = iri("http://www.agfa.com/w3c/euler/med#").
> qname("rdf:") = iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#").
> 
> triple(qname("m:Ann"),qname("m:complication"),qname("m:gastroentritis")).
> triple(qname("m:aspirin"),qname("m:prescribedFor"),qname("m:gastroentritis")).
> triple(qname("m:aspirin"),qname("m:excludedFor"),skf_e39_0_).
> triple(skf_e39_0_,qname("rdf:first"),qname("m:ulcer")).
> triple(skf_e39_0_,qname("rdf:rest"),skf_e47_0_).
> triple(skf_e47_0_,qname("rdf:first"),qname("m:postSurgery")).
> triple(skf_e47_0_,qname("rdf:rest"),qname("rdf:nil")).
> - triple(x,qname("m:complication"),y)
> | - triple(z,qname("m:prescribedFor"),y)
> | - triple(z,qname("m:excludedFor"),u)
> | - triple(x,qname("m:fineWith"),u)
> | triple(x,qname("m:isPrescribed"),z).
> triple(x,qname("m:fineWith"),qname("rdf:nil")).
> - triple(x,qname("rdf:first"),y)
> | triple(z,qname("m:complication"),y)
> | - triple(x,qname("rdf:rest"),u)
> | - triple(z,qname("m:fineWith"),u)
> | triple(z,qname("m:fineWith"),x).
> 
> - triple(qname("m:Ann"),qname("m:isPrescribed"),qname("m:aspirin")).
> 
> 
> I don't get a proof, so no evidence to prescribe Ann an aspirin.
> 
> It is only when I *explicitly* add
> 
> - triple(qname("m:Ann"),qname("m:complication"),qname("m:ulcer")).
> - triple(qname("m:Ann"),qname("m:complication"),qname("m:postSurgery")).
> 
> 
> that prover9 says
> THEOREM PROVED
> 
> of course adding could also mean that it follows from
> certain specific rules, but again, written explitly.
> 
> 
> 
> That piece of N3 is experimental, in that it uses
> what I think are "integrity constraints", but anyhow
> 
> 
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. 
> @prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>.
> @prefix m: <http://www.agfa.com/w3c/euler/med#>.
> 
> m:Ann m:complication m:gastroentritis.
> 
> m:aspirin m:prescribedFor m:gastroentritis.
> m:aspirin m:excludedFor (m:ulcer m:postSurgery).
> 
> {?P m:complication ?D.
>  ?M m:prescribedFor ?D.
>  ?M m:excludedFor ?L.
>  ?P m:fineWith ?L}
>  => {?P m:isPrescribed ?M}.
> 
> {}
>  => {?P m:fineWith rdf:nil}.
> 
> {?L rdf:first ?A.
>  {?P m:complication ?A} => {}.
>  ?L rdf:rest ?B.
>  ?P m:fineWith ?B}
>  => {?P m:fineWith ?L}.
> 
> {m:Ann m:isPrescribed m:aspirin} => {e:quod e:erat e:demonstrandum}.
> 
> 
> and here the same situation as the FOL test
> i.e. no proof found (using euler)
> and only after adding
> 
> 
> {m:Ann m:complication m:ulcer} => {}.
> {m:Ann m:complication m:postSurgery} => {}.
> 
> 
> we get
> 
> {{{m:Ann m:complication m:gastroentritis} e:evidence 
> <file:/euler/med.n3#_5>.
>   {m:aspirin m:prescribedFor m:gastroentritis} e:evidence 
> <file:/euler/med.n3#_9>.
>   {m:aspirin m:excludedFor _:e39_0_} e:evidence <file:/euler/med.n3#_10>.
>   {{_:e39_0_ rdf:first m:ulcer} e:evidence <file:/euler/med.n3#_10>.
>    {{m:Ann m:complication m:ulcer} => {}} e:evidence 
> <file:/euler/med.n3#_6>.
>    {_:e39_0_ rdf:rest _:e47_0_} e:evidence <file:/euler/med.n3#_10>.
>    {{_:e47_0_ rdf:first m:postSurgery} e:evidence 
> <file:/euler/med.n3#_10>.
>     {{m:Ann m:complication m:postSurgery} => {}} e:evidence 
> <file:/euler/med.n3#_7>.
>     {_:e47_0_ rdf:rest ()} e:evidence <file:/euler/med.n3#_10>.
>     {m:Ann m:fineWith ()} e:evidence <file:/euler/med.n3#_19>} e:sequent {
>    {m:Ann m:fineWith _:e47_0_} e:evidence <file:/euler/med.n3#_25>}} 
> e:sequent {
>   {m:Ann m:fineWith _:e39_0_} e:evidence <file:/euler/med.n3#_25>}} 
> e:sequent {
>  {m:Ann m:isPrescribed m:aspirin} e:evidence <file:/euler/med.n3#_16>}} 
> e:sequent {
> {e:quod e:erat e:demonstrandum} e:evidence <file:/euler/med.n3#_27>}.
> 
> 
> 
> Michael, I installed flora-2 and it is running well but am
> not yet doing above test; I think it will be similar like
> the prolog test, or what do you think?

Yes, you are right.

By the way, we are not advocating for NAF at the exclusion of classical
negation. There are extensions of LP, which support classical negation as
well (flora-2 doesn't support that yet). In the above example, one might
argue that using classical negation instead of NAF would be better because
in prescribing medicine a (good) doctor might  first want to establish that
there are no complications with ulcer, etc.


	--michael  
Received on Saturday, 27 August 2005 17:51:14 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:16:23 GMT