SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Prolog 应 用及相关

     工具
     实例
     应用
     资料
Prolog 开发 工具
......
推荐
 SWI-Prolog( 开源 )
    http://www.swi-prolog.org/
 GNU-Prolog( 开源 )
    http://www.gprolog.org/


 Visual Prolog( 商业 )
    http://www.visual-prolog.com/
 Amzi!( 商业 )
    http://www.amzi.com/


更多工具及其比较:
http://en.wikipedia.org/wiki/Comparison_of_Prolog_implementations
简单 ?

强 大!
Hanoi in Java
public class Test {
                private static void emitStep(int source, int dest) {
                                 System.out.println(source + " -> " + dest);
                }
                static class Step {
                                 Step(int n, int s, int d, int t) {
                                                    this.n = n;
                                                    source = s;
                                                    dest = d;
                                                    temp = t;
                                 }
                                 int n, source, dest, temp;
                }
                private static void hanoi(int n, int source, int dest, int temp) {
                                 java.util.Stack<Step> steps = new java.util.Stack<Step>();
                                 steps.add(new Step(n, source, dest, temp));
                                 while (steps.empty() == false) {
                                                    Step step = steps.pop();
                                                    if (step.n == 1) {
                                                                       emitStep(step.source, step.dest);
                                                                       continue;
                                                    }
                                                    steps.push(new Step(step.n - 1, step.temp, step.dest, step.source));
                                                    steps.push(new Step(1, step.source, step.dest, 0));
                                                    steps.push(new Step(step.n - 1, step.source, step.temp, step.dest));
                                 }
                }
                public static void main(String[] args) {
                                 hanoi(3, 1, 3, 2);
     }
}
Hanoi in Prolog
move(1,X,Y,_):-
write('Move top disk from '),write(X),write(' to '), write(Y), nl.


move(N,X,Y,Z):-
N>1,M is N-1,move(M,X,Z,Y),move(1,X,Y,_),move(M,Z,Y,X).




                              30 行 2
                              行
简单 的例子
“ 复杂 ”的例子




word(d,o,g). word(r,u,n). word(t,o,p).
word(f,i,v,e). word(f,o,u,r). word(l,o,s,t).word(m,e,s,s). word(u,n,i,t).
word(b,a,k,e,r). word(f,o,r,u,m). word(g,r,e,e,n). word(s,u,p,e,r).
word(p,r,o,l,o,g).word(v,a,n,i,s,h). word(w,o,n,d,e,r). word(y,e,l,l,o,w).

   solution(L1,L2,L3,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13,L14,L15,L16).
应用
编 程启发
思维
 Prolog 的逻辑编程思想

新语 言设计
 eg: Joe Armstrong —— Erlang

算法新解
    汉诺塔、着色问题、八数码问题、 N 后问题 ...
Prolog 应 用
自然语 言处 理
 NLP Techniques in Prolog by Patrick Blackburn and
 Kristina Striegnitz
 http://cs.union.edu/~striegnk/courses/nlp-with-prolog/html/


机器定理证 明
 加法、微分、化简、方程 ...

专 家系统
 医疗诊断系统、投资风险分析系统、家具设
 计系统 ...
NLP




The man bites the dog.
NLP




与 / 或解析树
专 家系统
Prolog 相关
趋势




                  Google Trends


TIOBE Jan 2013
相关语 言进 展

包含 Prolog 逻辑编程特性,但不支持 Prolog 语法
 。
  Mercury: http://www.mercury.cs.mu.oz.au/index.html

  Mozart: http://www.mozart-oz.org/


包含 Prolog 逻辑编程特性,同时支持 Prolog 语法
 。
  Ciao: http://www.clip.dia.fi.upm.es/Software
  Logtalk: http://logtalk.org/
组织 和会议

ALP(Association for Logic Programming)
 逻辑编程协会
 http://www.logicprogramming.org/


ICLP(International Conference on Logic
 Programming)
 逻辑编程国际会议
 http://www.iclp2014.net/ Shanghai, China, Oct, 2014.
学习书 籍

入门
  "Programming In Prolog". William F. Clocksin and
   Christopher S. Mellish. Springer-Verlag, 2003 (5th ed).
  "Prolog Programming for Artificial Intelligence". Ivan Bratko.
   Addison-Wesley, 2001 (3rd ed).
高级
  "The Art of Prolog: Advanced Programming Techniques".
   Leon Sterling and Ehud Shapiro. MIT Press, 1994 (2nd ed).
  "The Craft of Prolog". Richard A. O'Keefe. MIT Press, 1990.
在线资 料

 笨办 法学 Prolog by 泰安小码农 — 轻 松入门
                         —
http://fengdidi.github.com/blog/2011/11/15/di-0zhang-wei-
   shi-yao-yao-xue-xi-prolog/


 Adventure in Prolog  by Amzi! Inc. —— 语 法大全
http://www.amzi.com/AdventureInProlog/advfrtop.htm

 prolog :- tutorial by J.R.Fisher —— 经 典实 例
http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/c
   ontents.html
相关 文献
 Visual Prolog 的搜索控制机制分析 , 雷英杰 , 王宝树 , 赵晔 ,
  王涛,计算机科学, 2005 Vol.32
 基于 Prolog 的某型直升机故障诊断专家系统的研究 , 刘卓,
  南京大学, 2012
 一个动物识别专家系统在 PROLOG 下的实现,夏明华,成
  都信息工程学院学报, 2003 Vol.18
 Use of Prolog for developing a new programming
  language, JL Armstrong, SR Virding, MC Williams - C.
  Moss and, 1992
谢谢 !

Weitere ähnliche Inhalte

Andere mochten auch

LISP Programming Language (Artificial Intelligence)
LISP Programming Language (Artificial Intelligence)LISP Programming Language (Artificial Intelligence)
LISP Programming Language (Artificial Intelligence)wahab khan
 
ProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) IntroductionProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) Introductionwahab khan
 
Artificial intelligance
Artificial intelliganceArtificial intelligance
Artificial intelliganceBramwell Su
 
Artificial intelligence Prolog Language
Artificial intelligence Prolog LanguageArtificial intelligence Prolog Language
Artificial intelligence Prolog LanguageREHMAT ULLAH
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lispkyleburton
 
Prolog Programming : Basics
Prolog Programming : BasicsProlog Programming : Basics
Prolog Programming : BasicsMitul Desai
 
Artificial Intelligence Presentation
Artificial Intelligence PresentationArtificial Intelligence Presentation
Artificial Intelligence Presentationlpaviglianiti
 

Andere mochten auch (11)

LISP Programming Language (Artificial Intelligence)
LISP Programming Language (Artificial Intelligence)LISP Programming Language (Artificial Intelligence)
LISP Programming Language (Artificial Intelligence)
 
ProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) IntroductionProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) Introduction
 
Artificial intelligance
Artificial intelliganceArtificial intelligance
Artificial intelligance
 
Artificial intelligence Prolog Language
Artificial intelligence Prolog LanguageArtificial intelligence Prolog Language
Artificial intelligence Prolog Language
 
Prolog & lisp
Prolog & lispProlog & lisp
Prolog & lisp
 
Introduction to Prolog
Introduction to PrologIntroduction to Prolog
Introduction to Prolog
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lisp
 
Prolog Programming : Basics
Prolog Programming : BasicsProlog Programming : Basics
Prolog Programming : Basics
 
Prolog basics
Prolog basicsProlog basics
Prolog basics
 
Practical AI in Games
Practical AI in GamesPractical AI in Games
Practical AI in Games
 
Artificial Intelligence Presentation
Artificial Intelligence PresentationArtificial Intelligence Presentation
Artificial Intelligence Presentation
 

Prolog

  • 1. Prolog 应 用及相关  工具  实例  应用  资料
  • 4. 推荐  SWI-Prolog( 开源 )  http://www.swi-prolog.org/  GNU-Prolog( 开源 )  http://www.gprolog.org/  Visual Prolog( 商业 )  http://www.visual-prolog.com/  Amzi!( 商业 )  http://www.amzi.com/ 更多工具及其比较: http://en.wikipedia.org/wiki/Comparison_of_Prolog_implementations
  • 6. Hanoi in Java public class Test { private static void emitStep(int source, int dest) { System.out.println(source + " -> " + dest); } static class Step { Step(int n, int s, int d, int t) { this.n = n; source = s; dest = d; temp = t; } int n, source, dest, temp; } private static void hanoi(int n, int source, int dest, int temp) { java.util.Stack<Step> steps = new java.util.Stack<Step>(); steps.add(new Step(n, source, dest, temp)); while (steps.empty() == false) { Step step = steps.pop(); if (step.n == 1) { emitStep(step.source, step.dest); continue; } steps.push(new Step(step.n - 1, step.temp, step.dest, step.source)); steps.push(new Step(1, step.source, step.dest, 0)); steps.push(new Step(step.n - 1, step.source, step.temp, step.dest)); } } public static void main(String[] args) { hanoi(3, 1, 3, 2); } }
  • 7. Hanoi in Prolog move(1,X,Y,_):- write('Move top disk from '),write(X),write(' to '), write(Y), nl. move(N,X,Y,Z):- N>1,M is N-1,move(M,X,Z,Y),move(1,X,Y,_),move(M,Z,Y,X). 30 行 2 行
  • 9.
  • 10. “ 复杂 ”的例子 word(d,o,g). word(r,u,n). word(t,o,p). word(f,i,v,e). word(f,o,u,r). word(l,o,s,t).word(m,e,s,s). word(u,n,i,t). word(b,a,k,e,r). word(f,o,r,u,m). word(g,r,e,e,n). word(s,u,p,e,r). word(p,r,o,l,o,g).word(v,a,n,i,s,h). word(w,o,n,d,e,r). word(y,e,l,l,o,w). solution(L1,L2,L3,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13,L14,L15,L16).
  • 12. 编 程启发 思维 Prolog 的逻辑编程思想 新语 言设计 eg: Joe Armstrong —— Erlang 算法新解 汉诺塔、着色问题、八数码问题、 N 后问题 ...
  • 13. Prolog 应 用 自然语 言处 理 NLP Techniques in Prolog by Patrick Blackburn and Kristina Striegnitz http://cs.union.edu/~striegnk/courses/nlp-with-prolog/html/ 机器定理证 明 加法、微分、化简、方程 ... 专 家系统 医疗诊断系统、投资风险分析系统、家具设 计系统 ...
  • 14. NLP The man bites the dog.
  • 18. 趋势 Google Trends TIOBE Jan 2013
  • 19. 相关语 言进 展 包含 Prolog 逻辑编程特性,但不支持 Prolog 语法 。  Mercury: http://www.mercury.cs.mu.oz.au/index.html  Mozart: http://www.mozart-oz.org/ 包含 Prolog 逻辑编程特性,同时支持 Prolog 语法 。  Ciao: http://www.clip.dia.fi.upm.es/Software  Logtalk: http://logtalk.org/
  • 20. 组织 和会议 ALP(Association for Logic Programming) 逻辑编程协会 http://www.logicprogramming.org/ ICLP(International Conference on Logic Programming) 逻辑编程国际会议 http://www.iclp2014.net/ Shanghai, China, Oct, 2014.
  • 21. 学习书 籍 入门  "Programming In Prolog". William F. Clocksin and Christopher S. Mellish. Springer-Verlag, 2003 (5th ed).  "Prolog Programming for Artificial Intelligence". Ivan Bratko. Addison-Wesley, 2001 (3rd ed). 高级  "The Art of Prolog: Advanced Programming Techniques". Leon Sterling and Ehud Shapiro. MIT Press, 1994 (2nd ed).  "The Craft of Prolog". Richard A. O'Keefe. MIT Press, 1990.
  • 22. 在线资 料  笨办 法学 Prolog by 泰安小码农 — 轻 松入门 — http://fengdidi.github.com/blog/2011/11/15/di-0zhang-wei- shi-yao-yao-xue-xi-prolog/  Adventure in Prolog  by Amzi! Inc. —— 语 法大全 http://www.amzi.com/AdventureInProlog/advfrtop.htm  prolog :- tutorial by J.R.Fisher —— 经 典实 例 http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/c ontents.html
  • 23. 相关 文献  Visual Prolog 的搜索控制机制分析 , 雷英杰 , 王宝树 , 赵晔 , 王涛,计算机科学, 2005 Vol.32  基于 Prolog 的某型直升机故障诊断专家系统的研究 , 刘卓, 南京大学, 2012  一个动物识别专家系统在 PROLOG 下的实现,夏明华,成 都信息工程学院学报, 2003 Vol.18  Use of Prolog for developing a new programming language, JL Armstrong, SR Virding, MC Williams - C. Moss and, 1992