learn prolog now phần 7 pot

learn prolog now phần 7 pot

learn prolog now phần 7 pot

... sentence from the parse tree of its subparts. 106 Chapter 7. Definite Clause Grammars 7. 4 Practical Session 7 The purpose of Practical Session 7 is to help you get familiar with the DCGs, differ- ence ... 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...

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

... 1is3+-2. When we learned about arithmetic in Prolog, we saw that Prolog knows about the con- ventions for disambiguating arithmetic expressions. So, when we write 2+3*3 for example, Prolog knows that ... 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 =\= 9-2 ?-p==’...

Ngày tải lên: 12/08/2014, 20:22

18 207 0
Learn Prolog Now phần 1 pps

Learn Prolog Now phần 1 pps

... 174 12.3 Practical Session 176 12.3.1 Step 1 176 12.3.2 Step 2 176 12.3.3 Step 3 176 12.3.4 Step 4 177 12.3.5 Step 5 177 12.3.6 Step 6 177 1.1. Some simple examples 7 the first item in the knowledge ... 165 11.2.3 setof/3 1 67 11.3 Exercises 168 11.4 Practical Session 11 170 12 Working With Files 171 12.1 Splitting Programs Over Files 171 12.1.1 Reading in Programs 171 12.1.2 Mo...

Ngày tải lên: 12/08/2014, 20:22

19 139 0
Learn Prolog Now phần 2 pdf

Learn Prolog Now phần 2 pdf

... Proof Search Now that we know about matching, we are in a position to learn how Prolog actually searches a knowledge base to see if a query is satisfied. That is, we are now able to learn about ... = mia _ 178 = vincent _ 178 = marcellus loves(_ 178 ,mia) _158 = marcellus, _663 = mia _ 178 = vin- cent _ 178 = marcellus There is only one possibility of matching jealous(X,Y) against th...

Ngày tải lên: 12/08/2014, 20:22

18 153 0
Learn Prolog Now phần 3 doc

Learn Prolog Now phần 3 doc

... (7) g(a) ? Call: (7) h(a) ? Fail: (7) h(a) ? Fail: (7) g(a) ? Redo: (7) f(_G348) ? Exit: (7) f(b) ? Call: (7) g(b) ? Exit: (7) g(b) ? Call: (7) h(b) ? Exit: (7) h(b) ? Exit: (6) k(b) ? X=b Yes Study ... time Prolog comes back with a ?, we obtain (something like) the following: [trace] 2 ?- k(X). Call: (6) k(_G348) ? Call: (7) f(_G348) ? Exit: (7) f(a) ? Call: (7) g(a) ? Exit: (7) g(a) ? Cal...

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

... Chapter 4. Lists Now the first rule won’t help (vincent and yolanda are distinct atoms) so Prolog goes to the second clause, the recursive rule. This gives Prolog a new goal: it now has to see if member(vincent,[trudy,vincent,jules]). Now, ... [dead(zed),[2,[b,chopper]],[], _78 00] Z = _78 00 yes That is: the head of the list is bound to X, the tail is bound to Y. (We also get the inf...

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

... 3 is +(1,2). 7. 3 is X+2. 8. X is 1+2. 9. 1+2 is 1+2. 10. is(X,+(1,2)). 11. 3+2 = +(3,2). 12. * (7, 5) = 7* 5. 13. * (7, +(3,2)) = 7* (3+2). 14. * (7, (3+2)) = 7* (3+2). 15. * (7, (3+2)) = 7* (+(3,2)). Exercise ... 2 3 3 is 6/2. 7 2 3 3 is 7/ 2. 1 is the remainder when 7 is divided by 2 1 is mod (7, 2). (Note that as we are working with integers, division gives us back an integer an...

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

... 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 rule s -> s,conj,s in the knowledge ... end of the knowledge base, so that Prolog always ecounters the translation of the non-recursive rule first. What happens now, when we pose the query s([a,woman,sho...

Ngày tải lên: 12/08/2014, 20:22

18 187 0
learn prolog now phần 9 docx

learn prolog now phần 9 docx

... tool for learning how operators work in Prolog. So, before going on to learn more about how to write things onto the screen, try the following queries. Make sure you understand why Prolog answers ... chosen a value for Y. 4. Prolog then goes on, and by instantiating Y to 1, Prolog matches j(Y) with the fact j(1). So we have found a solution. 5. But we can find more. Prolog is free t...

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

... caroline List = [laura,rose] ; Child = _77 36 Mother = charlotte List = [caroline,laura,rose] ; Child = _77 36 Mother = laura List = [rose] ; Child = _77 36 Mother = martha List = [charlotte,caroline,laura,rose] ... you have to tell Prolog that this module is a library, so that Prolog knows where to look for it (namely, not in the directory where your other code is, but at the place where...

Ngày tải lên: 12/08/2014, 20:22

21 168 0
w