Learn Prolog Now phần 2 pdf

Learn Prolog Now phần 2 pdf

Learn Prolog Now phần 2 pdf

... shoot(gun) Y = knife yes 26 Chapter 2. Matching and Proof Search 2. 2 Proof Search Now that we know about matching, we are in a position to learn how Prolog actually searches a knowledge base to see ... Facts, Rules, and Queries This tells Prolog to consult the file kb2.pl, and load the contents as its new knowledge base. Assuming that the kb2.pl contains no typos, Prolog will rea...
Ngày tải lên : 12/08/2014, 20:22
  • 18
  • 153
  • 0
Learn Prolog Now phần 1 pps

Learn Prolog Now phần 1 pps

... 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 Copyright c by ... 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...
Ngày tải lên : 12/08/2014, 20:22
  • 19
  • 139
  • 0
Learn Prolog Now phần 3 doc

Learn Prolog Now phần 3 doc

... to charlotte. Now that the first subgoal is satisfied, Prolog moves to the second subgoal. It has to prove 2. 4. Practical Session 2 35 2 ?- trace. Yes Prolog is now in trace mode, and will evaluate all queries ... is_digesting(stork,mosquitp)}, Prolog needs to find a value for Z such that, firstly, just_ate(stork,Z). 40 Chapter 3. Recursion 3.1 .2 Example 2: Descendant Now tha...
Ngày tải lên : 12/08/2014, 20:22
  • 18
  • 202
  • 0
Learn Prolog Now phần 4 doc

Learn Prolog Now phần 4 doc

... and a2b /2 decides that the two tails are lists of as and bs of exactly the same length! This immediately gives us the following rule: a2b([a|Ta],[b|Tb]) :- a2b(Ta,Tb). This says: the a2b /2 predicate ... list: [[], dead(zed), [2, [b, chopper]], [], Z]. Now, we could find out like this: ?- [X1,X2,X3,X4 | Tail] = [[], dead(zed), [2, [b, chopper]], [], Z]. X1=[] X2 = dead(zed) X3 = [2, [b,cho...
Ngày tải lên : 12/08/2014, 20:22
  • 18
  • 295
  • 0
Learn Prolog Now phần 5 ppt

Learn Prolog Now phần 5 ppt

... Prolog handles the four basic operations of addition, multiplication, subtraction, and division. Arithmetic examples Prolog Notation 6 2 8 8 is 6 +2. 6 2 12 12 is 6 *2. 6 2 4 4 is 6 -2. 6 8 2 -2 ... given Prolog the query is(X,+(3 ,2) ) and Prolog will respond X=5 5.6. Practical Session 5 79 6. 3 is +(1 ,2) . 7. 3 is X +2. 8. X is 1 +2. 9. 1 +2 is 1 +2. 10. is(X,+(1...
Ngày tải lên : 12/08/2014, 20:22
  • 18
  • 212
  • 0
Learn Prolog Now phần 6 docx

Learn Prolog Now phần 6 docx

... of append. 92 Chapter 6. More Lists 6 .2. Reversing a list 87 6 .2 Reversing a list Append is a useful predicate, and it is important to know how to use it. But it is just as important to know that ... query s([a,woman,shoots],[])? Prolog gets into an infinte loop. Can you see why? The point is this. Prolog translates DCG rules into ordinary Prolog rules. If we place the recursive rul...
Ngày tải lên : 12/08/2014, 20:22
  • 18
  • 187
  • 0
learn prolog now phần 7 pot

learn prolog now phần 7 pot

... our new DCG. Here’s what the response would be. X = _26 25 NP = [the,woman] ; X = _26 25 NP = [the,man] ; X = _26 25 NP = [a,woman] ; X = _26 25 NP = [a,man] ; X = subject NP = [he] ; X = subject NP ... Furthermore, we now take advantage of Prolog s first argument indexing which makes looking up a word in the lexicon more efficient. First argument indexing is a technique for making Prolog s...
Ngày tải lên : 12/08/2014, 20:22
  • 18
  • 150
  • 0
learn prolog now phần 8 potx

learn prolog now phần 8 potx

... = _28 08 Y = _28 08 yes 9.5. Exercises 139 ?- 12 is 2* 6 ?- 14 =\= 2* 6 ?- 14 = 2* 7 ?- 14 == 2* 7 ?- 14 \== 2* 7 ?- 14 =:= 2* 7 ?- [1 ,2, 3|[d,e]] == [1 ,2, 3,d,e] ?- 2+ 3 == 3 +2 ?- 2+ 3 =:= 3 +2 ?- 7 -2 =\= ... terms: ?- 2+ 3 == + (2, 3). yes ?- + (2, 3) == 2+ 3. yes ?- 2- 3 == - (2, 3). yes ?- * (2, 3) == 2* 3. yes ?- 2* (7 +2) == * (2, +(7 ,2) ). yes In short, the famili...
Ngày tải lên : 12/08/2014, 20:22
  • 18
  • 207
  • 0
learn prolog now phần 9 docx

learn prolog now phần 9 docx

... with b(1) instead of b (2) . p(X) a(_G111) X = _G111 _G111 = 1 b(_G1 12) ,c(_G1 12) ,d(_G1 12) ,e(_G1 12) X = _G1 12 c(1),d(1),e(1) _G1 12 = 1 d(1),e(1) c (2) ,d (2) ,e (2) _G1 12 = 2 d (2) ,e (2) e (2) f(_G113) X = _G113 _G113 ... the cut are blocked. s(X,Y) q(_G111,_G1 12) X=_G111, Y=_G1 12 i(_G111),!,j(_G1 12) !,j(_G1 12) _G111=1 j(_G1 12) _G1 12= 1 _G1 12= 2 _G1 12= 3 X=0,Y=...
Ngày tải lên : 12/08/2014, 20:22
  • 18
  • 168
  • 0
learn prolog now phần 10 doc

learn prolog now phần 10 doc

... module(preds1,[pred1 /2] ). at the top of file preds1.pl you can define the module preds1 which exports the predicate pred1 /2. And similarly, you can define the module preds2 exporting the predicate pred2 /2 by putting :- ... the predicate pred2 /2 by putting :- module(preds2,[pred2/3]). at the top of file preds2.pl. helperpred is now hidden in the modules preds1 and preds2, so that there is...
Ngày tải lên : 12/08/2014, 20:22
  • 21
  • 168
  • 0
Từ khóa: