SlideShare a Scribd company logo
1 of 18
 
[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Read as IF
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Variables in Prolog get their values by being  unified  with values. Until it gets a value, a variable is said to be  free ; when it gets a value, it becomes  bound . When backtracking; variables becomes free again. Variables are used as part of the pattern-matching, process, not as a kind of information storage.
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
domains mydom = i(integer); s(string) predicates procedure wr(mydom) - (i) clauses wr(i(Int)):- write("Was integer: ",Int). wr(s(Str)) :- write("Was String: ",Str). GOAL wr(i(88)). Passing input to the predicate The variable will be bound to 88 Procedure means no fail! Only input flow accepted! Case/switch statement!
Factorial of 1 is 1 Factorial of N is N multiplied with factorial of N-1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Erroneous - Always exit failure - Always fail procedure - Always success determ - succeed or fails multi - 1 or more solutions (never fail) nondeterm - 0 or more solutions predicates   append(list,list,list)- procedure (i,i,o), determ (i,i,i) nondeterm (o,i,i)
write(Param1, Param2, Param3, ..., ParamN) readln(Line) readchar(CharParam) file_str(Filename, Text)  - file_str("t.dat", My_text) openread(SymbolicFileName, OSFileName) openwrite(SymbolicFileName, OSFileName) closefile(SymbolicFileName)
[object Object],[object Object],save(fileName) /* (i) */ save(fileName, databaseName) /* (i, i) */
Stack: the stack is used for transferring arguments and return addresses for predicate calls. The stack also holds the information for backtrackpoints. Heap:  the heap holds all objects that are more or less permanent, such as database facts, window buffers, file buffers etc. Gstack:  the global stack, normally called gstack, is the place where lists, compound structures and strings are placed. The Gstack is only released during backtracking. Trail:  the trail is only used when the program uses reference variables. It holds information about which reference variables must be unbound during backtracking. The trail is allocated in the heap.
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

Introduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in LogicIntroduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in LogicVishal Tandel
 
Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4DigiGurukul
 
PROLOG: Arithmetic Operations In Prolog
PROLOG: Arithmetic Operations In PrologPROLOG: Arithmetic Operations In Prolog
PROLOG: Arithmetic Operations In PrologDataminingTools Inc
 
Prolog (present)
Prolog (present) Prolog (present)
Prolog (present) Melody Joey
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsShiraz316
 
Prolog Programming Language
Prolog Programming  LanguageProlog Programming  Language
Prolog Programming LanguageReham AlBlehid
 
L03 ai - knowledge representation using logic
L03 ai - knowledge representation using logicL03 ai - knowledge representation using logic
L03 ai - knowledge representation using logicManjula V
 
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...Ashish Duggal
 
Inference in First-Order Logic
Inference in First-Order Logic Inference in First-Order Logic
Inference in First-Order Logic Junya Tanaka
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logicAmey Kerkar
 
First Order Logic resolution
First Order Logic resolutionFirst Order Logic resolution
First Order Logic resolutionAmar Jukuntla
 
String Matching with Finite Automata and Knuth Morris Pratt Algorithm
String Matching with Finite Automata and Knuth Morris Pratt AlgorithmString Matching with Finite Automata and Knuth Morris Pratt Algorithm
String Matching with Finite Automata and Knuth Morris Pratt AlgorithmKiran K
 
Predicate Logic
Predicate LogicPredicate Logic
Predicate Logicgiki67
 
Informed and Uninformed search Strategies
Informed and Uninformed search StrategiesInformed and Uninformed search Strategies
Informed and Uninformed search StrategiesAmey Kerkar
 

What's hot (20)

Introduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in LogicIntroduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in Logic
 
Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4Artificial Intelligence Notes Unit 4
Artificial Intelligence Notes Unit 4
 
PROLOG: Arithmetic Operations In Prolog
PROLOG: Arithmetic Operations In PrologPROLOG: Arithmetic Operations In Prolog
PROLOG: Arithmetic Operations In Prolog
 
Prolog (present)
Prolog (present) Prolog (present)
Prolog (present)
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
First order logic
First order logicFirst order logic
First order logic
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representation
 
First order logic
First order logicFirst order logic
First order logic
 
Prolog Programming Language
Prolog Programming  LanguageProlog Programming  Language
Prolog Programming Language
 
L03 ai - knowledge representation using logic
L03 ai - knowledge representation using logicL03 ai - knowledge representation using logic
L03 ai - knowledge representation using logic
 
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
 
Inference in First-Order Logic
Inference in First-Order Logic Inference in First-Order Logic
Inference in First-Order Logic
 
AI_Unit I notes .pdf
AI_Unit I notes .pdfAI_Unit I notes .pdf
AI_Unit I notes .pdf
 
Ai lab manual
Ai lab manualAi lab manual
Ai lab manual
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logic
 
First Order Logic resolution
First Order Logic resolutionFirst Order Logic resolution
First Order Logic resolution
 
Chapter 4 (final)
Chapter 4 (final)Chapter 4 (final)
Chapter 4 (final)
 
String Matching with Finite Automata and Knuth Morris Pratt Algorithm
String Matching with Finite Automata and Knuth Morris Pratt AlgorithmString Matching with Finite Automata and Knuth Morris Pratt Algorithm
String Matching with Finite Automata and Knuth Morris Pratt Algorithm
 
Predicate Logic
Predicate LogicPredicate Logic
Predicate Logic
 
Informed and Uninformed search Strategies
Informed and Uninformed search StrategiesInformed and Uninformed search Strategies
Informed and Uninformed search Strategies
 

Similar to Artificial intelligence Prolog Language

Similar to Artificial intelligence Prolog Language (20)

AI Lab Manual.docx
AI Lab Manual.docxAI Lab Manual.docx
AI Lab Manual.docx
 
Using binary classifiers
Using binary classifiersUsing binary classifiers
Using binary classifiers
 
Erlang session1
Erlang session1Erlang session1
Erlang session1
 
Fol
FolFol
Fol
 
Prolog PPT_merged.pdf
Prolog PPT_merged.pdfProlog PPT_merged.pdf
Prolog PPT_merged.pdf
 
Chaps 1-3-ai-prolog
Chaps 1-3-ai-prologChaps 1-3-ai-prolog
Chaps 1-3-ai-prolog
 
Python Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard WayPython Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard Way
 
app4.pptx
app4.pptxapp4.pptx
app4.pptx
 
R language
R languageR language
R language
 
CPPDS Slide.pdf
CPPDS Slide.pdfCPPDS Slide.pdf
CPPDS Slide.pdf
 
Prolog 7-Languages
Prolog 7-LanguagesProlog 7-Languages
Prolog 7-Languages
 
Prolog & lisp
Prolog & lispProlog & lisp
Prolog & lisp
 
2015 bioinformatics python_strings_wim_vancriekinge
2015 bioinformatics python_strings_wim_vancriekinge2015 bioinformatics python_strings_wim_vancriekinge
2015 bioinformatics python_strings_wim_vancriekinge
 
Python slide
Python slidePython slide
Python slide
 
Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.
 
3.5
3.53.5
3.5
 
Pl vol1
Pl vol1Pl vol1
Pl vol1
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory building
 
Prolog
PrologProlog
Prolog
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
 

More from REHMAT ULLAH

Men's clothing at style war
Men's clothing  at style warMen's clothing  at style war
Men's clothing at style warREHMAT ULLAH
 
software project management Software development life cycle
software project  management Software development life cyclesoftware project  management Software development life cycle
software project management Software development life cycleREHMAT ULLAH
 
Software project management Improving Team Effectiveness
Software project management Improving Team EffectivenessSoftware project management Improving Team Effectiveness
Software project management Improving Team EffectivenessREHMAT ULLAH
 
software project management Software inspection
software project management Software inspectionsoftware project management Software inspection
software project management Software inspectionREHMAT ULLAH
 
Improving of software processes
Improving of software processesImproving of software processes
Improving of software processesREHMAT ULLAH
 
software project management Elaboration phase
software project management Elaboration phasesoftware project management Elaboration phase
software project management Elaboration phaseREHMAT ULLAH
 
software project management Improvement in size
software project management  Improvement in sizesoftware project management  Improvement in size
software project management Improvement in sizeREHMAT ULLAH
 
Software development life cycle Construction phase
Software development life cycle Construction phaseSoftware development life cycle Construction phase
Software development life cycle Construction phaseREHMAT ULLAH
 
software project management Artifact set(spm)
software project management Artifact set(spm)software project management Artifact set(spm)
software project management Artifact set(spm)REHMAT ULLAH
 
software project management Waterfall model
software project management Waterfall modelsoftware project management Waterfall model
software project management Waterfall modelREHMAT ULLAH
 
Software project management Software economics
Software project management Software economicsSoftware project management Software economics
Software project management Software economicsREHMAT ULLAH
 
Introduction of software project management
Introduction of software project managementIntroduction of software project management
Introduction of software project managementREHMAT ULLAH
 
software project management Cocomo model
software project management Cocomo modelsoftware project management Cocomo model
software project management Cocomo modelREHMAT ULLAH
 
software project management Assumption about conventional model
software project management Assumption about conventional modelsoftware project management Assumption about conventional model
software project management Assumption about conventional modelREHMAT ULLAH
 
Usability engineering Usability testing
Usability engineering Usability testingUsability engineering Usability testing
Usability engineering Usability testingREHMAT ULLAH
 
Usability engineering Usability issues(iphone)
Usability engineering Usability issues(iphone)Usability engineering Usability issues(iphone)
Usability engineering Usability issues(iphone)REHMAT ULLAH
 
Usability engineering Usability issues in mobile web
Usability engineering Usability issues in mobile webUsability engineering Usability issues in mobile web
Usability engineering Usability issues in mobile webREHMAT ULLAH
 
Usability engineering Usability issues in firefox
Usability engineering Usability issues in firefoxUsability engineering Usability issues in firefox
Usability engineering Usability issues in firefoxREHMAT ULLAH
 
Software Quality Assurance(Sqa) automated software testing
Software Quality Assurance(Sqa) automated software testingSoftware Quality Assurance(Sqa) automated software testing
Software Quality Assurance(Sqa) automated software testingREHMAT ULLAH
 

More from REHMAT ULLAH (20)

Poker Game
Poker GamePoker Game
Poker Game
 
Men's clothing at style war
Men's clothing  at style warMen's clothing  at style war
Men's clothing at style war
 
software project management Software development life cycle
software project  management Software development life cyclesoftware project  management Software development life cycle
software project management Software development life cycle
 
Software project management Improving Team Effectiveness
Software project management Improving Team EffectivenessSoftware project management Improving Team Effectiveness
Software project management Improving Team Effectiveness
 
software project management Software inspection
software project management Software inspectionsoftware project management Software inspection
software project management Software inspection
 
Improving of software processes
Improving of software processesImproving of software processes
Improving of software processes
 
software project management Elaboration phase
software project management Elaboration phasesoftware project management Elaboration phase
software project management Elaboration phase
 
software project management Improvement in size
software project management  Improvement in sizesoftware project management  Improvement in size
software project management Improvement in size
 
Software development life cycle Construction phase
Software development life cycle Construction phaseSoftware development life cycle Construction phase
Software development life cycle Construction phase
 
software project management Artifact set(spm)
software project management Artifact set(spm)software project management Artifact set(spm)
software project management Artifact set(spm)
 
software project management Waterfall model
software project management Waterfall modelsoftware project management Waterfall model
software project management Waterfall model
 
Software project management Software economics
Software project management Software economicsSoftware project management Software economics
Software project management Software economics
 
Introduction of software project management
Introduction of software project managementIntroduction of software project management
Introduction of software project management
 
software project management Cocomo model
software project management Cocomo modelsoftware project management Cocomo model
software project management Cocomo model
 
software project management Assumption about conventional model
software project management Assumption about conventional modelsoftware project management Assumption about conventional model
software project management Assumption about conventional model
 
Usability engineering Usability testing
Usability engineering Usability testingUsability engineering Usability testing
Usability engineering Usability testing
 
Usability engineering Usability issues(iphone)
Usability engineering Usability issues(iphone)Usability engineering Usability issues(iphone)
Usability engineering Usability issues(iphone)
 
Usability engineering Usability issues in mobile web
Usability engineering Usability issues in mobile webUsability engineering Usability issues in mobile web
Usability engineering Usability issues in mobile web
 
Usability engineering Usability issues in firefox
Usability engineering Usability issues in firefoxUsability engineering Usability issues in firefox
Usability engineering Usability issues in firefox
 
Software Quality Assurance(Sqa) automated software testing
Software Quality Assurance(Sqa) automated software testingSoftware Quality Assurance(Sqa) automated software testing
Software Quality Assurance(Sqa) automated software testing
 

Recently uploaded

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 

Recently uploaded (20)

Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

Artificial intelligence Prolog Language

  • 1.  
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. Variables in Prolog get their values by being unified with values. Until it gets a value, a variable is said to be free ; when it gets a value, it becomes bound . When backtracking; variables becomes free again. Variables are used as part of the pattern-matching, process, not as a kind of information storage.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. domains mydom = i(integer); s(string) predicates procedure wr(mydom) - (i) clauses wr(i(Int)):- write("Was integer: ",Int). wr(s(Str)) :- write("Was String: ",Str). GOAL wr(i(88)). Passing input to the predicate The variable will be bound to 88 Procedure means no fail! Only input flow accepted! Case/switch statement!
  • 13.
  • 14. Erroneous - Always exit failure - Always fail procedure - Always success determ - succeed or fails multi - 1 or more solutions (never fail) nondeterm - 0 or more solutions predicates append(list,list,list)- procedure (i,i,o), determ (i,i,i) nondeterm (o,i,i)
  • 15. write(Param1, Param2, Param3, ..., ParamN) readln(Line) readchar(CharParam) file_str(Filename, Text) - file_str("t.dat", My_text) openread(SymbolicFileName, OSFileName) openwrite(SymbolicFileName, OSFileName) closefile(SymbolicFileName)
  • 16.
  • 17. Stack: the stack is used for transferring arguments and return addresses for predicate calls. The stack also holds the information for backtrackpoints. Heap: the heap holds all objects that are more or less permanent, such as database facts, window buffers, file buffers etc. Gstack: the global stack, normally called gstack, is the place where lists, compound structures and strings are placed. The Gstack is only released during backtracking. Trail: the trail is only used when the program uses reference variables. It holds information about which reference variables must be unbound during backtracking. The trail is allocated in the heap.
  • 18.