Quick Prolog
.
Sunday, April 15, 2012
Monday, April 9, 2012
Ch4
% ex4.1
% (a)
family((_,SurNamre,_,_),_,[]).
% (b)
child(person(Name,Surname,_,works(_,_))).
% (c)
family(person(_,_,_,unemployed),person(_,_,_,works(_,_)),_).
% (d)
family(Husband,Wife,Children),
dateofbirth(Husband,date(_,_,Year1)),
dateofbirth(Wife,date(_,_,Year2)),
(Year1-Year2>=15
;
Year2-Year1>=15
)
,member(Child,Children).
% ex4.2 different from answer //????????
twins(Child1,Child2):-
family(_,_,Children),
Child1(Name1,_,_,_),
Child2(Name2,_,_,_),
different(Name1,Name2),
dateofbirth(Child1,Date),
dateofbirth(Child2,Date).
% ex4.3
nth_member(1,[X|Tail],X).
nth_member(N,[Y|Tail],X):-
N1 is N-1,
nth_member(N1,Tail,X).
# ex4.4
The input string shrinls on each non-silent cycle, and it cannot shrink indefinitely.
% ex4.5 ??? should silent is before trans?
accepts(State,_,_):-
final(State).
accepts(State,[X|Rest],MaxMoves):-
MaxMoves>0,
trans(State,X,State2),
NewMax is MaxMoves-1,
accepts(State2,Rest,NewMax).
accepts(State,String,MaxMoves):-
MaxMoves>0,
silent(State,State2),
NewMax is MaxMoves-1,
accepts(State2,String,NewMax).
% ex4.7
% (a)
jump(X/Y,X2/Y2):-
(dxy(Dx,Dy)
;
dxy(Dy,Dx))
,
X2 is X+Dx,
Y2 is Y+Dy,
inboard(X2),
inboard(Y2).
dxy(2,1).
dxy(2,-1).
dxy(-2,1).
dxy(-2,-1).
inboard(P):-
P>=1,
P<=8.
% (b)
knightparh([square]).
knightpath([S1,S2|Rest]):-
jump(S1,S2),
knightpath([S2|Rest]).
% (c)
?- knightpath([2/1,R,5/4,S,X/8]).
.
% (a)
family((_,SurNamre,_,_),_,[]).
% (b)
child(person(Name,Surname,_,works(_,_))).
% (c)
family(person(_,_,_,unemployed),person(_,_,_,works(_,_)),_).
% (d)
family(Husband,Wife,Children),
dateofbirth(Husband,date(_,_,Year1)),
dateofbirth(Wife,date(_,_,Year2)),
(Year1-Year2>=15
;
Year2-Year1>=15
)
,member(Child,Children).
% ex4.2 different from answer //????????
twins(Child1,Child2):-
family(_,_,Children),
Child1(Name1,_,_,_),
Child2(Name2,_,_,_),
different(Name1,Name2),
dateofbirth(Child1,Date),
dateofbirth(Child2,Date).
% ex4.3
nth_member(1,[X|Tail],X).
nth_member(N,[Y|Tail],X):-
N1 is N-1,
nth_member(N1,Tail,X).
# ex4.4
The input string shrinls on each non-silent cycle, and it cannot shrink indefinitely.
% ex4.5 ??? should silent is before trans?
accepts(State,_,_):-
final(State).
accepts(State,[X|Rest],MaxMoves):-
MaxMoves>0,
trans(State,X,State2),
NewMax is MaxMoves-1,
accepts(State2,Rest,NewMax).
accepts(State,String,MaxMoves):-
MaxMoves>0,
silent(State,State2),
NewMax is MaxMoves-1,
accepts(State2,String,NewMax).
% ex4.7
% (a)
jump(X/Y,X2/Y2):-
(dxy(Dx,Dy)
;
dxy(Dy,Dx))
,
X2 is X+Dx,
Y2 is Y+Dy,
inboard(X2),
inboard(Y2).
dxy(2,1).
dxy(2,-1).
dxy(-2,1).
dxy(-2,-1).
inboard(P):-
P>=1,
P<=8.
% (b)
knightparh([square]).
knightpath([S1,S2|Rest]):-
jump(S1,S2),
knightpath([S2|Rest]).
% (c)
?- knightpath([2/1,R,5/4,S,X/8]).
.
爸爸的書單
The Computer Modelling of Mathematical Reasoning
by Alan Bundy

is a book in which the author tried to establish a form of logic reasoning and its operation, based on the connection from a mathematical form to a logic form.
是我認為一本關於運用數學語言做本質性思維的書籍,這本書所表達的方法,在人工智慧書中,是經常見到的,例如搜尋法等等,但這本書所使用數學推理與語言表 達運作方式的論述,卻呈現了人工智慧本質性思考運作的一貫性與整合性,這讓我想到,孔子說:「吾道一以貫之」,我想就是我對這本經典書籍的看法。如果可以 貫通理解這本書的觀念,學習上不但可以很清晰與邏輯,而且可以具有突出性與卓越的能力。
Modelling High-Level Cognitive Processes

is addressed to model cognitive processes from high level. Since it introduced a system environment, COGENT environment, with a graphical interface, we could easily catch the ideas how to use Logic to make a reasoning model to explore the world of human cognition. The examples given in the book would help us to think of our interest of the research subjects.
1. PROLOG Programming for Artificial Intelligence (International computer science series)
by Ivan Bratko

是你正在讀的書籍,它的特色是對Prolog的語法有清楚與仔細的解說案例,一步一步,第一部分是基本Prolog的語言特性與基本使用方法-技巧介紹,第二部分則是應用範疇的使用介紹,其中包含在不同運算需求下的Prolog架構。
這本書在運用邏輯程式來解決問題的學習上可以從四個方面來看:a).一方面了解解決問題的處理問題方式(思維角度,範圍限制與探討架構),b).一方面運用邏輯的方式來界定問題(問題的正式化界定方式),c).再一方面學習邏輯程式在知識與問題架構的表達方式(解答問題領域的知識表達與採用的可能表達結構),d).建立認識Prolog程式的表達語法。這其中包含一些常見的演算法,都實作在這本書的例子中了,深入研讀對往後在各種理論上的學習,不但可以加快速度,而且最重要的可以立即協助思維問題的關鍵點,最後這個部分最為重要,★★★因為它讓你可以建立理論與實作的橋樑。
下列書籍是有關Prolog中最重要的幾本書,我想能夠仔細研讀每一本書的人大致上不是很多,除非該課系是非常重視Prolog邏輯語言的專業科系,例如愛丁堡,因此,愛丁堡人工智慧領域,無論在模型推理、數學推理、音樂推理、語言推理等等都是以Prolog做為思維與表達的基礎工具。
我是依據難度排序,第二本較為簡單,但在Prolog的表達上卻更精鍊與簡易,可是運用的範例與建立基礎認識的經驗不夠,所以第一本書閱讀完後,透過第二本書,可以獲得一個關鍵的綱要觀念,雖然表面上似乎是都在教Prolog,但實際上每一本書所涉及的問題處理層次的表達方式是不同的,
2. Programming in Prolog
by W. F. Clocksin

例如第三本書對建立Prolog的Meta(元)-Prolog有深入的介紹,例如將一組推理機制放入一個推理系統中做修正,以更改與學習新的推理原則,作為推理系統演進的開發,這是必須學習的;
3. The Art of PROLOG: Advanced Programming Techniques (Logic Programming) 五顆星
by Leon Sterling (Paperback - 21 Apr 1994)
第四本書有豐富的例子,讓我們在面對不同問題時,可以建立對不同問題時,可以運用Prlog的思維與表達方式(建立對實作各種演算法的認識);
After read the prolog book, then you would not have a problem about Algorithm. I have not come to read this book. There are a lot of professionals highly recommended these two books for establishing capability to solve a problem within a logic form.

4. PROLOG by Example: How to Learn, Teach, and Use It (Symbolic Computation)
by Helder Coelho, J. C. Cotta, and H. Coelho
第五本書,則是針對Prolog在表達上,與處理問題上的精密、效率、清晰度與容易出錯的地方,有深入的介紹(我所認識的學者中,能夠引用第五本書的作者,都是思維很深入與表達相當清晰的學者,但這需要時間)。以上這些學習需要循序漸進的,但如水一般日積月纍則石穿水入,專注與持續(不間斷)學習是建立基本功力的唯一條件,這也是我為什麼時時提醒你與弟弟都保持Prolog的學習,即使每天只有30分鐘練習,也要不間斷,而仰行即使一週只有一次週末時間,也必須保持閱讀與程式練習,尤其是程式練習。
5. The Craft of PROLOG (Logic Programming)
by Richard A. O'Keef

Prolog and Natural-Language Analysis

Introduction to Lambda Calculus
for me reference

.
by Alan Bundy
is a book in which the author tried to establish a form of logic reasoning and its operation, based on the connection from a mathematical form to a logic form.
是我認為一本關於運用數學語言做本質性思維的書籍,這本書所表達的方法,在人工智慧書中,是經常見到的,例如搜尋法等等,但這本書所使用數學推理與語言表 達運作方式的論述,卻呈現了人工智慧本質性思考運作的一貫性與整合性,這讓我想到,孔子說:「吾道一以貫之」,我想就是我對這本經典書籍的看法。如果可以 貫通理解這本書的觀念,學習上不但可以很清晰與邏輯,而且可以具有突出性與卓越的能力。
Modelling High-Level Cognitive Processes
is addressed to model cognitive processes from high level. Since it introduced a system environment, COGENT environment, with a graphical interface, we could easily catch the ideas how to use Logic to make a reasoning model to explore the world of human cognition. The examples given in the book would help us to think of our interest of the research subjects.
1. PROLOG Programming for Artificial Intelligence (International computer science series)
by Ivan Bratko
是你正在讀的書籍,它的特色是對Prolog的語法有清楚與仔細的解說案例,一步一步,第一部分是基本Prolog的語言特性與基本使用方法-技巧介紹,第二部分則是應用範疇的使用介紹,其中包含在不同運算需求下的Prolog架構。
這本書在運用邏輯程式來解決問題的學習上可以從四個方面來看:a).一方面了解解決問題的處理問題方式(思維角度,範圍限制與探討架構),b).一方面運用邏輯的方式來界定問題(問題的正式化界定方式),c).再一方面學習邏輯程式在知識與問題架構的表達方式(解答問題領域的知識表達與採用的可能表達結構),d).建立認識Prolog程式的表達語法。這其中包含一些常見的演算法,都實作在這本書的例子中了,深入研讀對往後在各種理論上的學習,不但可以加快速度,而且最重要的可以立即協助思維問題的關鍵點,最後這個部分最為重要,★★★因為它讓你可以建立理論與實作的橋樑。
下列書籍是有關Prolog中最重要的幾本書,我想能夠仔細研讀每一本書的人大致上不是很多,除非該課系是非常重視Prolog邏輯語言的專業科系,例如愛丁堡,因此,愛丁堡人工智慧領域,無論在模型推理、數學推理、音樂推理、語言推理等等都是以Prolog做為思維與表達的基礎工具。
我是依據難度排序,第二本較為簡單,但在Prolog的表達上卻更精鍊與簡易,可是運用的範例與建立基礎認識的經驗不夠,所以第一本書閱讀完後,透過第二本書,可以獲得一個關鍵的綱要觀念,雖然表面上似乎是都在教Prolog,但實際上每一本書所涉及的問題處理層次的表達方式是不同的,
2. Programming in Prolog
by W. F. Clocksin
例如第三本書對建立Prolog的Meta(元)-Prolog有深入的介紹,例如將一組推理機制放入一個推理系統中做修正,以更改與學習新的推理原則,作為推理系統演進的開發,這是必須學習的;
3. The Art of PROLOG: Advanced Programming Techniques (Logic Programming) 五顆星
by Leon Sterling (Paperback - 21 Apr 1994)
第四本書有豐富的例子,讓我們在面對不同問題時,可以建立對不同問題時,可以運用Prlog的思維與表達方式(建立對實作各種演算法的認識);
After read the prolog book, then you would not have a problem about Algorithm. I have not come to read this book. There are a lot of professionals highly recommended these two books for establishing capability to solve a problem within a logic form.
4. PROLOG by Example: How to Learn, Teach, and Use It (Symbolic Computation)
by Helder Coelho, J. C. Cotta, and H. Coelho
第五本書,則是針對Prolog在表達上,與處理問題上的精密、效率、清晰度與容易出錯的地方,有深入的介紹(我所認識的學者中,能夠引用第五本書的作者,都是思維很深入與表達相當清晰的學者,但這需要時間)。以上這些學習需要循序漸進的,但如水一般日積月纍則石穿水入,專注與持續(不間斷)學習是建立基本功力的唯一條件,這也是我為什麼時時提醒你與弟弟都保持Prolog的學習,即使每天只有30分鐘練習,也要不間斷,而仰行即使一週只有一次週末時間,也必須保持閱讀與程式練習,尤其是程式練習。
5. The Craft of PROLOG (Logic Programming)
by Richard A. O'Keef
Prolog and Natural-Language Analysis
Introduction to Lambda Calculus
for me reference
.
Subscribe to:
Comments (Atom)