版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Rule-based Logical Reasoning2022-5-23Database Group, Southeast University, ChinaReported By: 藤晓程,崇志宏2022-5-23Database Group, Southeast University, ChinaOutlineOutline1.A brief introduction on reasoning 1.A brief introduction on reasoning systemssystems2.Logic programming language - Datalog3.Evaluati
2、on of Datalog with mapreduceRuled-based Reasoning Systems2022-5-23Database Group, Southeast University, China2022-5-23Database Group, Southeast University, ChinaHistoryRule-Based Systems : Rule-Based Systems : Also known as expert expert systemssystemsIdeaIdea: to capture the knowledge of a human ex
3、pert in a specialized domain and embody it within a software system. The knowledgeknowledge is stored as rulesrules of the form IF condition THEN action For example: If income 1000 THEN deny-If income K is a fixpointfixpoint of TP The Fixpoint ApproachProgram P:Program P:greenPath(x,y) :- green(x,y)
4、greenPath(x,y) :- greenPath(x,z), greenPath(z,y) Input I: Input I: green(1,2),green(2,3) =IgreenPath(1,2), greenPath(2,3) = greenPath(1,3) = (I) 2PT(I) 3PT(I) 2PT(I) PT(I) PTThe Fixpoint Approach (Forward Chaining )2022-5-23Database Group, Southeast University, China Naive Evaluation: Naive Evaluati
5、on: Begin with EDBUse rules to infer new factsRepeat until no new facts can be inferredIn this case : minimum minimum fixpointfixpointwhich equals P(I)P(I)Program P:Program P:greenPath(x,y) :- green(x,y)greenPath(x,y) :- greenPath(x,z), greenPath(z,y) Input I: Input I: green(1,2),green(2,3) =IgreenP
6、ath(1,2), greenPath(2,3) = greenPath(1,3) = The Fixpoint Approach(I) PT(I) 2PT(I) PT(I) 3PT(I) 2PTThe Fixpoint Approach (Forward Chaining )2022-5-23Database Group, Southeast University, ChinaProof theoretic Approach (Backward Chaining )A fact is in the result if there exists a proof for it using the
7、 rules and the database facts (goal-drivengoal-driven)1.Each leaf is labeledby a fact from database instance I I2.Parent-child relationshipconstructed fromrule A1 A2, ., AngreenPath(1,3)greenPath(1,2)greenPath(2,3) green(1,2) green(2,3)rule 2rule 12022-5-23Database Group, Southeast University, China
8、OutlineOutline1.Syntax(语法)2.Semantics(语义)3.Datalog with Negation(3.Datalog with Negation(带否定带否定) )4.Evaluation of Datalog(计算)2022-5-23Database Group, Southeast University, ChinaDatalog with negationExampleTwo Minimal ModelsTwo Minimal Models2022-5-23Database Group, Southeast University, ChinaModel t
9、heoretic semantics : problems1.some programs have no model2.some programs have several minimal models(choose between them)342022-5-23Database Group, Southeast University, ChinaFixpoint semantics : problems1.TP may not have any fixpointP1 = p p2.TP may have several minimal fixpointsP2 = p q, q p two
10、minimal fixpoints : p and q.3.4.Use propositional program for convenience2022-5-23Database Group, Southeast University, ChinaSemipositive datalogonly apply negation to edb relationsT(x, y) G(x, y)T(x, y) G(x, z),T(z, y)Solution:1.new edb relation R holding the complement of R (w.r.t. the active doma
11、in)2.Replace R(x) by R(x)2022-5-23Database Group, Southeast University, ChinaStratified datalogIdeaIdea: if an IDB R has already been definedIDB R has already been defined, then we know what NOT R isStratified programStratified program: each IDB relation is defined byprevious rules before its negati
12、on is needed2022-5-23Database Group, Southeast University, ChinaDependency Graph 1.Nodes = IDB predicates.2.Arc p - q iff p .q.3.Arc p - q labeled iff q is negated2022-5-23Database Group, Southeast University, ChinaAnother Example: “Win”win(X) :- move(X,Y) & NOT win(Y)you win by forcing your opp
13、onent to a position where they have no move2022-5-23Database Group, Southeast University, ChinaStrata largest number of s on a path from that predicate2022-5-23Database Group, Southeast University, ChinaStratified Programsno recursion involving negation (Stratified Datalog)finite strata-stratified-
14、stratified modelInfinite stratum -unstratified -no stratified model2022-5-23Database Group, Southeast University, ChinaStratified Model/Perfect fixpointEvaluate strata 0, 1, in orderResult is the stratified model.2022-5-23Database Group, Southeast University, ChinaTechnical pointsstratified model is
15、 one of the minimal models for the programIf no negation, the stratified model is the minimum modelagreement2022-5-23Database Group, Southeast University, ChinaUnstratified Datalogextensions of the stratified semanticsFrom least to most general:Locally stratified models,modularly stratified models,s
16、table/well-founded modelswell-founded models.2022-5-23Database Group, Southeast University, ChinaLocally stratified models 2022-5-23Database Group, Southeast University, ChinaWell-founded semanticsprovide a natural semantics for all datalog programsgives up settling all IDB facts some facts remain u
17、nknown3-Valued Models2022-5-23Database Group, Southeast University, ChinaExamplewin(x) moves(x, y),win(y)TrueTrue:win(d),win(f )FalseFalse:win(e),win(g)UnknownUnknown:win(a),win(b),win(c)well-founded semanticswell-founded semanticsThe goal is to compute the set of winning states (i.e., the set of st
18、ates such that there exists a winning strategy for a player in this state).2022-5-23Database Group, Southeast University, China3-valued minimal model for (extended) datalogdenote true by 1, false by 0, and unknown by true by 1, false by 0, and unknown by extended : datalog program with 0, 1/2 and 1
19、as literals in bodiesomit unknownomit unknownI(ab)=min(I(a),I(b)I(a)=1-I(a)1/200002022-5-23Database Group, Southeast University, China3-valued minimal model for (extended) datalogStart :all atoms are false, denote this instanceLemma: Lemma: sequence converges (收敛) to the least fixpoint of 3-TP P has
20、 a unique minimal 3-valued model that equals the least fixpoint of 3-TPsemanticssemantics:minimal 3-valued model2022-5-23Database Group, Southeast University, China3-stable Models of DatalogI :I : 3-valued instance over sch(P)pg(P,I) pg(P,I) : replace each negative literal A by (i.e., 0, 1 or 1/2)an
21、 extended datalog programminimal model /least fixpoint: minimal model /least fixpoint: pg(P, I I)() ( conseqP(I) conseqP(I) )A 3-valued instance I I over sch(P) is a 3-stable 3-stable model model of Piff conseqP(I) = Iiff conseqP(I) = I.2022-5-23Database Group, Southeast University, ChinaExample 202
22、2-5-23Database Group, Southeast University, Chinawell-founded semanticsseveral 3-stable models.at least one 3-stable model.well-founded semantics :well-founded semantics :consisting of all positive and negative facts belonging to all 3-stable modelsPrevious example: Pwf =p, q,rwell-founded model is
23、also 3-stable model2022-5-23Database Group, Southeast University, ChinaProblemSteps:1.Checking all possible 3-valued instances 2.determining which are 3-stable models3.taking their intersectioneffective but very inefficientHow to compute the well-founded semantics efficiently?2022-5-23Database Group
24、, Southeast University, ChinaA Fixpoint DefinitionDefine sequence:I I0 =I Ii+1 = conseqP (I Ii)Idea: alternate underestimates and overestimates of positive facts until convergence2022-5-23Database Group, Southeast University, ChinaExample I I0 = = p,q,r ,s,t,uI I1 1 = p,q,r ,s,t,uI I2 2 = p,q,r ,s,t
25、,uI I3 3 = p,q,r ,s,t,uI I4 4 = p,q,r ,s,t,uI I3(p)=I I4(p)=1I I3(q)=I I4(q)=1I I3(r)=I I4(r)=0Others 1/2well-founded semantics:p, q, rAlternating fixpoint semanticsAlternating fixpoint semantics2022-5-23Database Group, Southeast University, ChinaWell-Founded and Stratified Semantics Agree TheoremTh
26、eoremP :stratified datalog programP is total under the well-founded semanticsfor each 2-valued instance I over edb(P ), Pwf (I) = Pstrat(I).2022-5-23Database Group, Southeast University, ChinaOutlineOutline1.Syntax(语法)2.Semantics(语义)3.Datalog with Negation(带否定)4.Evaluation of Datalog(4.Evaluation of
27、 Datalog(计算计算) )2022-5-23Database Group, Southeast University, ChinaEvaluation of DatalogTwo major classes of evaluation approaches: Bottom-UpApply the datalog rules “from body to head” (forward) Top-DownApply the datalog rules “from head to body” (backward)2022-5-23Database Group, Southeast Univers
28、ity, ChinaBottom-upExample2022-5-23Database Group, Southeast University, Chinanaive algorithm redundant computation2022-5-23Database Group, Southeast University, ChinaSeminaive Evaluationinfer new facts at stage i + 1 using facts newly derived at stage iFacts newly inferred2022-5-23Database Group, S
29、outheast University, ChinaTop-downDirect the search for a proof , e.g. T(2,x)T(x,y) :- G(x,y)T(x,y) :- G(x,y)T(x,y) :- G(x,z) ,T(z,y)T(x,y) :- G(x,z) ,T(z,y)Infinite recursive loops possible:T(2,x)G(2,3)T(3,x)G(3,1) T(1,x)G(1,2)T(2,x).2022-5-23Database Group, Southeast University, Chinaquery-subquer
30、y (QSQ) frameworkSideways Information Passing(SIP):Sideways Information Passing(SIP):How information is passed in the bodya left-to-right evaluationadornment2022-5-23Database Group, Southeast University, ChinaSupplementary Relations and QSQ Templates bound by some previous literal, And needed by sub
31、sequent literal or in the resultQSQ template sequence : (sup0, . . . , supn)2022-5-23Database Group, Southeast University, ChinaExample adorned rules for the RSG query2022-5-23Database Group, Southeast University, China 2022-5-23Database Group, Southeast University, China 2022-5-23Database Group, So
32、utheast University, China 2022-5-23Database Group, Southeast University, China 2022-5-23Database Group, Southeast University, ChinaBottom-up VS Top-downTop-downTop-downAd: goal-oriented Disad: one-tuple-at-a-time, infinite loops possible.Bottom-upBottom-upAd: avoid infinite loopsDisad:a lot of irrel
33、evant computation 2022-5-23Database Group, Southeast University, ChinaMagic set Transforms a program into a new query :1.same answer as the original query.2.bottom-up technique ; facts produced by top-down approaches 2022-5-23Database Group, Southeast University, ChinaTransformation 2022-5-23Databas
34、e Group, Southeast University, ChinaTransformation 2022-5-23Database Group, Southeast University, ChinaImprovementsRepeated Variables and Constants in Rule Repeated Variables and Constants in Rule BodiesBodies2022-5-23Database Group, Southeast University, ChinaImprovementsCountingCounting:record dep
35、ths at which supplementary relation atoms occurnot safe: infinite set of tuples possible2022-5-23Database Group, Southeast University, ChinaMagic set and well-founded modelsProblem for example :the magic sets transformation of a stratified program may not be stratified Extend magic sets to stratifie
36、d/modular stratified programs?Well-founded models?SipsSips(sideways information passing strategy) 2022-5-23Database Group, Southeast University, Chinapredict call graphArc from a to qi label 0Arc form a to pi label 12022-5-23Database Group, Southeast University, Chinawell-founded sipsFor each arc in
37、 the sip1.Qi is either the head of R or or in an SCC lower than the SCC of the head R2.Each ground instance of Qi is two-valuedPreserve the well-founded modelPreserve the well-founded model2022-5-23Database Group, Southeast University, ChinaOutlineOutline1.A brief introduction on reasoning systems2.
38、Logic programming language - Datalog3.Evaluation of Datalog with 3.Evaluation of Datalog with mapreducemapreduce2022-5-23Database Group, Southeast University, ChinaMapreduce Framework2022-5-23Database Group, Southeast University, ChinaNave Evaluation1.Join:R(1,2),R(2,3),R(1,4),R(4,3) ,A(1,2),A(2,3),A(1,4),A(4,3) (1)Map-(1,R2),(2,R3),(1,R4),(4,R3) ,(2,A1),(3,A2),(4,A1),(3,A4)Reduce-A(1,3),A(1,3),A(1,2),A(2,3),A(1,4),A(4,3)2.Remove duplicate - A(1,3),A(1,2),A(2,3),A(1,4),A(4,3) (2)3.Compute
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年乡镇生态护林员队伍管理测试题
- 2026年私募股权基金培训岗绩效考核指标体系
- 2026年国企高层次人才服务专员题
- 2026年击剑领先时的保守与冒险战术权衡考试题库
- 数字身份识别安全管理规定
- 2026年事业单位引进急需紧缺人才职称绿色通道题库
- 2026年烟草公司笔试知识重点解析与案例
- 2026年五粮液公司品牌推广与营销策略题目
- 政府采购与招投标法规知识测试题2026
- 2026年金融科技公司的合规建设面试解析
- 贵州概算调整管理办法
- 洗面奶洗脸课件
- 中心静脉导管(CVC)维护相关知识理论考核试题及答案
- T-CSBZ 013-2025 不可移动石质文物保养维护规程
- 能源费用托管服务方案投标文件(技术方案)
- 2025年陕西省中考化学试卷真题(含答案)
- GB/T 27534.6-2025畜禽遗传资源调查技术规范第6部分:马、驴
- 人教版初中地理七下期中考试模拟试卷(含答案)
- 绿色供应链管理政策与操作规程
- 生产计划量化考核指标
- JBT 10205.2-2023 液压缸 第2部分:缸筒技术规范 (正式版)
评论
0/150
提交评论