Quick Start Prolog Learning to Program in Prolog
- Slides: 17
Quick. Start Prolog Learning to Program in Prolog Richard Banister November 9, 2005 Applied Computing Technology Laboratory
What is Prolog? l. A Logical Programming Language l Why logical? l Created by Robert Kowalski and Alain Colmerauer sometime around 1972. l Original intended for natural language parsing l Now used in AI, expert systems Applied Computing Technology Laboratory 2
The Logical Paradigm l Based on logical reasoning l Execution as mathematical proof l Non-sequential design l Fun! Applied Computing Technology Laboratory 3
Prolog as a Logical Language l Predicates are entered into a “database” l Rules are created l Queries are run against said predicates and rules l Results are determined only from what is known to be true l Well, how do we “do” anything? Applied Computing Technology Laboratory 4
A Logical Example l Take this example: cat(Timmy). legs(cat, 4). ? - legs(Timmy, 4) yes l Yeah! l We can also do useful stuff Applied Computing Technology Laboratory 5
Prolog Advantages l It’s a Logical Programming language l It’s the only game in town l That’s about it. Applied Computing Technology Laboratory 6
Prolog Disadvantages l Limited sphere of usefulness l Not a “pure” logical language l It don’t have the fancy graphics the youngsters are raving about l It won’t make you popular with the ladies Applied Computing Technology Laboratory 7
Java or Prolog? l Kind of a silly question l Depends greatly on project goal l Prolog for web app = not a good idea l Java for robot army = maybe not a good idea either l Yet they are being combined together as we speak Applied Computing Technology Laboratory 8
Prolog Specification l l l Well, it’s a funny story Prolog spec available… for a price Grammar is not reprintable on web Decidedly geek-non-friendly This, along with late spec publication (1995!), may be why Prolog hasn’t taken over the world? But we do know some things about the grammar Applied Computing Technology Laboratory 9
Prolog Grammar l A free approximate grammar can be found online: (https: //www. freytag. us/twiki/bin/view/Freytag/ISOStandard. Prolog. Grammar) l l Here’s a sample: Possibly not complete, but note simplicity Applied Computing Technology Laboratory 10
Is Prolog “Dead? ” l Not quite. Still kicking in AI l New extensions are being developed: Visual Prolog l Prova l Applied Computing Technology Laboratory 11
Language Specifics Predicate: A statement given to be true ex. cat(Timmy). Rule: A method for proving future results ex. cat(X) : - legs(4, X), whiskers(X), intent_to_destroy(X). Query: A request to prove a result ex. whiskers(Uncle Jerry). Intent_to_destroy(Uncle Jerry). Legs(1, Uncle Jerry). ? - cat(Uncle Jerry). no Applied Computing Technology Laboratory 12
Step 0: Getting Started l Get to know logical programming and Prolog l There are many websites that contain useful, if cryptic, Prolog information. Applied Computing Technology Laboratory 13
Step 1: Really Getting Started l Download & install GNU interpreter: http: //pauillac. inria. fr/~diaz/gnu-prolog/ l You can get the source, too, if you really want it l Read up… the GNU interpreter isn’t easy Applied Computing Technology Laboratory 14
Step 2: Writing l Create a plain text file l Some editors have context-sensitive highlighting, but it’s probably not necessary l File should contain predicates and rules, not queries l Create a legendary, essential logical application (maybe, dog(Rover)? ) Applied Computing Technology Laboratory 15
Step 3: Import Source File Start the interpreter. l Use the consult command (or shortcut) to open and compile the source code l ex. consult(‘/projects/prolog/cat. pl’). Note the use of Unix-style file reference. This isn’t necessarily “documented” in the help file. l Assuming no errors, run queries on your program l Applied Computing Technology Laboratory 16
Learning more about Prolog l Visit the Quick. Start Languages web site http: //actlab. csc. villanova. edu/quickstart l Read up on logical languages http: //en. wikipedia. org/wiki/Logic_programming l Devote your life to this tutorial http: //web. archive. org/web/20041028043137/http: //cs. wwc. edu/~cs_dept/KU/PR/Prolog. html Applied Computing Technology Laboratory 17
- Visual prolog examples
- Visual prolog vs swi-prolog
- Quick find algorithm
- Quickchek menu
- Signal generator proteus
- Microsoft planner quick start guide
- Ms teams quick start guide
- Teams quick start guide
- But we gotta start somewhere
- Triage chart
- Cuadro comparativo e-learning b-learning m-learning
- Head start early learning outcomes framework
- Laboratory schools pros and cons
- Hitrust right start program
- Supervised learning dan unsupervised learning
- Concept learning task in machine learning
- Analytical learning in machine learning
- Non associative learning example