没有合适的资源?快使用搜索试试~ 我知道了~
首页cs-125 prolog 笔记
cs-125 prolog 笔记
需积分: 10 13 下载量 119 浏览量
更新于2023-03-03
评论
收藏 489KB PDF 举报
我们大学(Swansea 大学,计算机排名全英前十),老师的Prolog笔记,有兴趣的可以看看。 (全英文)
资源详情
资源评论
资源推荐
Learn Prolog Now!
Patrick Blackburn
Johan Bos
Kristina Striegnitz
Copyright
c
by Patrick Blackburn, Johan Bos and Kristina Striegnitz, 2001
patrick@aplog.org
jbos@cogsci.ed.ac.uk
kris@coli.uni-sb.de
This course is also available online:
http://www.coli.uni-sb.de/ kris/learn-prolog-now
Contents
1 Facts, Rules, and Queries 1
1.1 Some simple examples ........................ 1
1.1.1 Knowledge Base 1 ...................... 1
1.1.2 Knowledge Base 2 ...................... 3
1.1.3 Knowledge Base 3 ...................... 4
1.1.4 Knowledge Base 4 ...................... 6
1.1.5 Knowledge Base 5 ...................... 8
1.2 Prolog Syntax ............................. 8
1.2.1 Atoms ............................. 9
1.2.2 Numbers ............................ 9
1.2.3 Variables ............................ 9
1.2.4 Complex terms ........................ 10
1.3 Exercises ................................ 11
1.4 Practical Session 1 .......................... 13
2 Matching and Proof Search 17
2.1 Matching ................................ 17
2.1.1 Examples ........................... 19
2.1.2 The occurs check ....................... 22
2.1.3 Programming with matching ................. 23
2.2 Proof Search .............................. 26
2.3 Exercises ................................ 31
2.4 Practical Session 2 .......................... 33
3 Recursion 37
3.1 Recursive definitions ......................... 37
3.1.1 Example 1: Eating ...................... 37
3.1.2 Example 2: Descendant ................... 40
3.1.3 Example 3: Successor .................... 43
3.1.4 Example 3: Addition ..................... 45
3.2 Clause ordering, goal ordering, and termination ......... 47
3.3 Exercises ................................ 49
3.4 Practical Session 3 .......................... 51
4 Lists 55
4.1 Lists ................................... 55
4.2 Member ................................. 59
4.3 Recursing down lists ......................... 61
4.4 Exercises ................................ 65
4.5 Practical Session 4 .......................... 66
5 Arithmetic 69
5.1 Arithmetic in Prolog .......................... 69
5.2 A closer look .............................. 71
5.3 Arithmetic and lists .......................... 73
5.4 Comparing integers .......................... 75
5.5 Exercises ................................ 78
5.6 Practical Session 5 .......................... 79
6 More Lists 81
6.1 Append ................................. 81
6.1.1 Defining append ....................... 82
6.1.2 Using append ......................... 84
6.2 Reversing a list ............................ 87
6.2.1 Naive reverse using append ................. 87
6.2.2 Reverse using an accumulator ............... 88
6.3 Exercises ................................ 89
6.4 Practical Session 6 .......................... 90
7 Definite Clause Grammars 93
7.1 Context free grammars ........................ 93
7.1.1 CFG recognition using append ............... 95
7.1.2 CFG recognition using difference lists ........... 98
7.2 Definite clause grammars ...................... 100
7.2.1 A first example ........................ 100
7.2.2 Adding recursive rules .................... 102
7.2.3 A DCG for a simple formal language ............ 104
7.3 Exercises ................................ 105
7.4 Practical Session 7 .......................... 106
8 More Definite Clause Grammars 109
8.1 Extra arguments ............................ 109
8.1.1 Context free grammars with features ............ 109
8.1.2 Building parse trees ..................... 114
8.1.3 Beyond context free languages ............... 117
8.2 Extra goals ............................... 118
8.2.1 Separating rules and lexicon ................ 119
8.3 Concluding remarks .......................... 121
8.4 Exercises ................................ 122
8.5 Practical Session 8 .......................... 122
9 A Closer Look at Terms 125
9.1 Comparing terms ........................... 125
9.2 Terms with a special notation .................... 127
9.2.1 Arithmetic terms ....................... 127
9.2.2 Lists as terms ......................... 129
9.3 Examining Terms ........................... 131
9.3.1 Types of Terms ........................ 131
9.3.2 The Structure of Terms .................... 133
9.4 Operators ................................ 136
9.4.1 Properties of operators .................... 136
9.4.2 Defining operators ...................... 137
9.5 Exercises ................................ 138
9.6 Practical Session ........................... 140
剩余183页未读,继续阅读
liulei007
- 粉丝: 3
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0