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OO\UXOHVFODXVHV
&RQVWUDLQWSURJUDPPLQJ $QRWKHU([DPSOH
(DUO\DSSURDFKHV Mortgage: principal P, interest rate I, repayment R and
balance B over T periods
² ORFDOSURSDJDWLRQ
2
5HDVRQ5HFXUVLYHO\ :K\&RQVWUDLQWVDQGQRW&
=HURWLPHSHULRGVWKHQ% 3
%RWKSURJUDPVFDQDQVZHUWKHJRDO
• mortgage(500, 3, 10/100, 150, B).
%XWWKH&/3SURJUDPFDQDQVZHU
HOVHQHZSULQF33
,5DQGQHZWLPH7
&RQVWUDLQWVLQFRPELQDWRULDO
6HQGLQJPRUHPRQH\
SUREOHPV
6(1' VPP6(1'025<
025(
>6(1'025<@>@
FRQVWUDLQ>6(1'025<@
021(<
ODEHOLQJ>6(1'025<@
6 0
ZKHUH6(1'025<DUHGLJLWVVXFK
DOOGLIIHUHQWBQHT>6(1'025<@
WKDWHTXDWLRQKROGV
6
(
1'
0RGHUQFRQVWUDLQW &RXUVH&RQVWUDLQWORJLF
SURJUDPPLQJODQJXDJHV SURJUDPPLQJ
&RQVLVWRI %RRN
² 3URJUDPPLQJZLWK&RQVWUDLQWVDQLQWURGXFWLRQ
² SURJUDPPLQJODQJXDJH
² .LP0DUULRWWDQG3HWHU-6WXFNH\
² FRQVWUDLQWVROYHUVIRUFHUWDLQGRPDLQV
² 0,73UHVV
ILQLWHGRPDLQVHJVHQGPRUHPRQH\
² ,6%1KDUGFRYHU
UHDOQXPEHUVHJPRUWJDJH
WUHHFRQVWUDLQWV
)LUVWPRGHUQFRQVWUDLQWODQJXDJHV
6HHDOVR
KWWSPXQNRUDFVPXR]DXaSMVERRNERRNKWPO
² FRQVWUDLQWORJLFSURJUDPPLQJODQJXDJHV
17 18
3
:KDWZHZLOOGR ,QGXFWLYHORJLFSURJUDPPLQJ
3DUW,FRPSOHWH 7KHVWXG\RILQGXFWLYHPDFKLQH
² FRQVWUDLQWVDQGFRQVWUDLQWVROYHUV OHDUQLQJDQGGDWDPLQLQJXVLQJ
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LRQDOORJLF
,PDJLQHDQHXUDOQHWVWDWLVWLFDO
in(e1,o1,o2).
in(e1,o3,o4).
SDFNDJHLQIHUWKHVWUXFWXUDODOHUW
...
3/LVPRUHH[SUHVVLYHDQG square(e1,o3).
GHFODUDWLYH
square(e1,o4).
...
3/LVZHOOXQGHUVWRRG
,QIHUHQFHUXOHV
27
$ILUVWRUGHU
&ODXVH 5XOH
UHSUHVHQWDWLRQ
Atom(nitro,a1,carbon,-4).
Atom(nitro,a2,hydrogen,-2). SRV(WULDQJOH(;LQ(;<WULDQJOH(<
Atom(nitro,a3,carbon,-2).
... SRV(FLUFOH(;LQ(<;FRQILJ(<XS
SRV(
Benzene-ring(nitro,[a1,a2,a3,a4,a5,a6]).
…
could be defined as a ‘view’
predicate/relation
5
FRYHUV+SRVHLII.%8+_ SRVH ,QGXFWLYHORJLFSURJUDPPLQJ
Pos if here are two distinct triangles with identical configuration, and a circle”
pos(E) :- triangle(E,X,C),triangle(E,Y,C),not(X=Y),circle(E,Z).
5HSUHVHQWDWLRQDOLVVXHV
² KRZWRUHSUHVHQWH[DPSOHVK\SRWKHVHV
DQGEDFNJURXQGNQRZOHGJH"
3UREOHPVHWWLQJVDQGDOJRULWKPV
E square(e1,o1).
triangle(e1,o2,up).
in(e1,o2,o1). ?-pos(e1)
circle(e1,o3). Yes
² SUHGLFWLYH
triangle(e1,o4,up).
in(e1,o4,o3). ² GHVFULSWLYH
² GLVWDQFHEDVHG
triangle(e5,o51,up). NQHDUHVWQHLJKERUFOXVWHULQJ
?-pos(e5)
square(e5,o52).
No
in(e5,o52,o51). 32
,QGXFWLYHORJLFSURJUDPPLQJ ,QGXFWLYHORJLFSURJUDPPLQJ
6WUXFWXULQJWKHVHDUFKVSDFH 2ZQQRWHVDQGVOLGHV
² OHDUQLQJDVVHDUFK0LWFKHOO 6+1LHQKX\V&KHQJDQG5RQDOGGH
² JHQHUDOLW\UHODWLRQSURYLGHVVWUXFWXUH :ROI)RXQGDWLRQVRI,QGXFW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