Strona domowa (i nie tylko) Piotra Fulmańskiego

Transkrypt

Strona domowa (i nie tylko) Piotra Fulmańskiego
PROLOG
Zajęcia
Przykładowe pytania na egzamin
PRZYKŁADY!!!
1. Dlaczego mówimy o programowaniu w logice? Na czy polega ten paradygmat
programowania?
2. Co należy rozumieć pod pojęciem obiektu?
3. Co to jest relacja, fakt reguła?
4. Podaj przykład koniunkcji, alternatywy, negacji.
5. Co to jest stała, zmienna, struktura?
6. Podaj przykład własnego operatora i sposobu jego użycia.
7. Czym różni się predykat is od =:=?
8. Podaj przykład prostego programu obliczeniowego (np. silnia) i go omów.
9. Podaj przykład listy i wymień różne sposoby jej zapisu.
10. Podaj przykład wykorzystania listy.
11. Podaj przykład programu odczytujacego dane z pliku i omów jego działanie.
12. Napisz przykładowy program sortując - omów go.
13. Jak działa mechanizm nawracania w Prologu?
14. Na ile istotna jest kolejność faktów i reguł?
15. Co nazywamy odcięciem? Jaki ma wpływ na wykonanie programu?
16. Co to jest akumulator?
17. Czym jest metoda obliczeniowa ,,z góry na dół'' i ,,z dołu do góry''?
18. Omów sposób konstruowania i dekompozycji termów przy pomocy predykat
=..
19. Omów predykaty służące do manipulowania bazą wiedzy.
20. Pytanie o wynik/sposób działania prostego programu.
Jaka będzie wartość zmiennej Odpowiedz w poniższym wywołaniu
21.
z(m,[a,l,a,m,a,k,o,t,a],Odpowiedz).
następującego programu
z(X,[X|Xs],Xs).
z(X,[Y|Ys],[Y|Zs]):-z(X,Ys,Zs).
22. Jakie są zalety reprezentacji wiedzy przy pomocy rachunku zdań?
23. Dlaczego reprezentacja wiedzy przy pomocy rachunku zdań jest
niewystarczająca?
24. Co to jest rachunek predykatów?
25. Umiejętność przekształcenia wyrażenia do postaci klauzulowej.
26. Jak zapisujemy klauzule? (jaką możemy nadać jej interpretacje i jaki to ma
sens?)
27. Co to jest rezolucja?
28. Co to jest unifikacja?
29. Co oznacza całkowita falsyfikowalność i jak możemy ją wykorzystać?
30. Co to są klauzule Horna?
Co się działo na wykładzie
1. Poznajemy PROLOG-a.
Pobierz plan wykładu
2. Operatory.
Pobierz plan wykładu
3. Listy.
Pobierz plan wykładu
4. Odcięcie (patrz skrypt poniżej).
5. Wejście i wyjście. Sortowanie
Pobierz plan wykładu
Skrypt
Część informacji dotyczących PROLOG-a zawarta jest w skrypcie do zajęć ze
sztucznej inteligencji.
Linki do stron
1.
2.
3.
4.
http://home.agh.edu.pl/~gjn/dydaktyka/LecRBS/GJN-LabProlog/
http://cs.wwc.edu/KU/PR/Prolog.php
http://www.ida.liu.se/~ulfni/lpp/
Ulle Endriss, Lecture Notes. An Introduction to Prolog Programming (local
version) Znakomite wprowadzenie - polecam
Zadanie
SIGNING ON
Logic Problems Issue 16 page 46
On one page of the visitor's book at Sandholme Castle, seat of the Duke of
Wallingfen, were the names of ten couples from various locations in the Englishspeaking world who had paid to look round the ancestral pile. From the clues given
below, can you fill in the blank page of the book with the surnames and home-towns
of each couple?
Clues:
1. The Drummonds are from Edinburgh; their name appears on the line above
the Jones family, who were not the last couple to sign the page.
2. Mr and Mrs Ince's signatures are immediately followed by those of the London
couple.
3. The couple on line 3 gave a North American address; their surname contains
two more letters than that of the Portsmouth pair and three more = than that
of the couple on line 9.
4. Only one couple's surname initial immediately preceeds that of the next family
to sign; they are not the Childers family, whose name appears on line 5 and
who do not live in Melbourne.
5. Bristol is the address on the line above Durban; one of these cities is the
home of the Adams family.
6. The Los Angeles couple signed on line 8; their surname contains an even
number of letters.
7. Mr and Mrs Fellowes, who are not transatlantic visitors, wrote their name on
an odd-numbered line, unlike the couple from Wellington.
8. The Toronto family's name immediately follows that of the Harringtons, who
are not from Washington.
9. Mr and Mrs Bourne signed on the lower half of the page, whilst the Giles
family, who did not sign on line 6, are not resident in the U.K. London,
Edinburgh, Bristol and Portsmouth are all in the U.K. Durban is in South Africa.
Los Angeles and Washington (D.C.) are in the U.S.A. Toronto is in Canada.
Wellington is in NewZealand. And of course, Melbourne is in Australia.
Rozwiązania zadań z ćwiczeń
1. Rebus
Zadanie to stanowi świetny przykład na to jak można zoptymalizowć
rozwiązanie wykorzystując wiedzę o postawionym problemie.
o Wersja 1
o Wersja 1 lekko poprawiona
o Wersja 2
o Wersja 3
o Wersja 4
o Wersja 5
o Wersja 6
o Wersja 7
o Wersja 8
2. Rodzeństwo
o Rozwiązanie 1
o Rozwiązanie 2
3. Misjonarze i kanibale
o Rozwiązanie
4. Kody Graya
o Rozwiązanie
Autorami zamieszczonych rozwiązań są Krzysztof Jastrzebski oraz Robert Szymacha.

Podobne dokumenty