Оцените презентацию от 1 до 5 баллов!
Тип файла:
ppt / pptx (powerpoint)
Всего слайдов:
23 слайда
Для класса:
1,2,3,4,5,6,7,8,9,10,11
Размер файла:
578.00 kB
Просмотров:
88
Скачиваний:
0
Автор:
неизвестен
Слайды и текст к этой презентации:
№1 слайд![Structure of the program in](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img0.jpg)
Содержание слайда: Structure of the program in Prolog. Execution management
Lecture 4
№2 слайд![Peculiarities of Visual](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img1.jpg)
Содержание слайда: Peculiarities of Visual Prolog
Visual Prolog is a compiled language
Other versions have elements of interpretation of a code during the execution
Strict data typing
Rules are not data: you can’t add or remove them during the execution
You can’t define new operations
№3 слайд![Program sections compiler](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img2.jpg)
Содержание слайда: Program sections
compiler directives
CONSTANTS – section of constants description
DOMAINS – section of domains description
DATABASE – section of description of internal database predicates
PREDICATES – section of predicates description
CLAUSES – section of clauses description
GOAL – section of internal goal description
№4 слайд![Peculiarities of Visual](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img3.jpg)
Содержание слайда: Peculiarities of Visual Prolog
All sections can be in any order
Predicates and domain must be defined before their usage
Predicates declared in a section DATABASE can be added and removed from internal database while the execution
№5 слайд![Program containing only the](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img4.jpg)
Содержание слайда: Program containing only the goal
GOAL
write("hello"), readchar(_).
№6 слайд![Compiler directives trace to](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img5.jpg)
Содержание слайда: Compiler directives
trace – to trace the program
nowarnings – to suppress the message that a variable occurs only once
include – insertion of some file content
check_determ – compulsory check of predicates determination
№7 слайд![Peculiarities of Visual](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img6.jpg)
Содержание слайда: Peculiarities of Visual Prolog
You can start tracing only for the definite predicate
If there is a tracing the optimization of recursion is not working
To establish non-determination of predicates by default: Options – Project – Compiler options – Warnings – Default predicate type – Nondeterm
№8 слайд![Constants CONSTANTS pi . path](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img7.jpg)
Содержание слайда: Constants
CONSTANTS
pi=3.14
path="c:\\prolog\\bgi"
№9 слайд![Domains integer an integer](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img8.jpg)
Содержание слайда: Domains
integer – an integer number (-32768...32767)
real – a float number (±e-307...±e308)
char – a symbol in apostrophes
string – a sequence of symbols in double quotation marks
symbol – a symbolic constant (atom)
file – a file
№10 слайд![Description of your own](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img9.jpg)
Содержание слайда: Description of your own domain
<name_domain> = <description_domain>
or
file = <symbolic file name1>; ...;
<symbolic file nameN>
or
<name_list_domain> = <name_domain_of_list_elements>*
Examples:
DOMAINS
i=integer
list=i*
№11 слайд![Description of a structured](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img10.jpg)
Содержание слайда: Description of a structured domain
<name_structure> = <name_functor> (<name_domain_first_component>, ..., <name_domain_last_component>) [;<name_functor>(...)]*
Examples:
flatpoint = p(integer, integer)
triangle = tr(point, point, point)
fullpoint = p(integer, integer); p(integer, integer, integer)
№12 слайд![Description of predicates lt](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img11.jpg)
Содержание слайда: Description of predicates
<name_predicate> (<name_first_argument>, ..., <name_last_argument>).
Examples:
PREDICATES
mother(string,string).
member(integer,integer*).
member(real,real*).
member(char,char*).
member(string,string*).
№13 слайд![Standard predicates readln](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img12.jpg)
Содержание слайда: Standard predicates
readln(_)
readint(_)
readreal(_)
readchar(_)
readterm(name_domain, term_domain)
write([<variable / constant / value>,…])
writef – format output
№14 слайд![Standard predicates div mod](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img13.jpg)
Содержание слайда: Standard predicates
div()
mod()
trunc()
round()
random(_)
random(<число>,_)
All embedded predicates are determinated
№15 слайд![Program Relatives DOMAINS s](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img14.jpg)
Содержание слайда: Program “Relatives”
DOMAINS
s=string
PREDICATES
nondeterm mother(s,s)
nondeterm grandmother(s,s)
CLAUSES
mother("Наташа","Даша").
mother("Даша","Маша").
grandmother(X,Y):-
mother(X,Z),
mother(Z,Y).
№16 слайд![Execution management Method](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img15.jpg)
Содержание слайда: Execution management
Method of a depth search (backtracking)
Method of a rollback after a failure
Cut and rollback
Method of a user-defined search
№17 слайд![Backtracking DOMAINS s string](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img16.jpg)
Содержание слайда: Backtracking
DOMAINS
s=string
PREDICATES
mother(s,s)
grandmother(s,s)
CLAUSES
mother(“Dasha",“Masha").
mother(“Natasha",”Dasha").
mother(“Natasha",”Glasha").
mother(“Dasha",”Sasha").
grandmother(X,Y):–
mother(X,Z),
mother(Z,Y).
№18 слайд![Method of a rollback after a](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img17.jpg)
Содержание слайда: Method of a rollback after a failure
DOMAINS
s=string
PREDICATES
mother(s,s)
grandmother(s,s)
CLAUSES
mother(“Dasha",“Masha").
mother(“Natasha",”Dasha").
mother(“Natasha",”Glasha").
mother(“Dasha",”Sasha").
grandmother(X,Y):–
mother(X,Z),
mother(Z,Y).
№19 слайд![Method of a rollback after a](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img18.jpg)
Содержание слайда: Method of a rollback after a failure
DOMAINS
s=string
PREDICATES
mother(s,s)
grandmother(s,s)
CLAUSES
mother(“Dasha",“Masha").
mother(“Natasha",”Dasha").
mother(“Natasha",”Glasha").
mother(“Dasha",”Sasha").
grandmother(X,Y):–
mother(X,Z),
mother(Z,Y).
№20 слайд![Method of a rollback after a](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img19.jpg)
Содержание слайда: Method of a rollback after a failure
DOMAINS
s=string
PREDICATES
mother(s,s)
grandmother(s,s)
show_names
CLAUSES
mother(“Dasha",“Masha").
mother(“Natasha",”Dasha").
mother(“Natasha",”Glasha").
mother(“Dasha",”Sasha").
grandmother(X,Y):–
mother(X,Z),
mother(Z,Y).
№21 слайд![Method of a rollback after a](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img20.jpg)
Содержание слайда: Method of a rollback after a failure
DOMAINS
s=string
PREDICATES
mother(s,s)
grandmother(s,s)
show_names2(s)
CLAUSES
mother(“Dasha",“Masha").
mother(“Natasha",”Dasha").
mother(“Natasha",”Glasha").
mother(“Dasha",”Sasha").
grandmother(X,Y):–
mother(X,Z),
mother(Z,Y).
№22 слайд![Cut and rollback](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img21.jpg)
Содержание слайда: Cut and rollback
№23 слайд![Method of a user-defined](/documents_6/62a75b6578e6ee18c0a9b22ec423ec30/img22.jpg)
Содержание слайда: Method of a user-defined search