120 likes | 464 Views
Prolog. Kyle Marcotte. Outline. What is Prolog? Origins of Prolog (History) Basic Tutorial TEST!!! (sort of…actually not really at all) My example Why Prolog?. Prolog is…. General purpose logic programming language We’ll talk about what it’s associated with later
E N D
Prolog Kyle Marcotte
Outline • What is Prolog? • Origins of Prolog (History) • Basic Tutorial • TEST!!! (sort of…actually not really at all) • My example • Why Prolog?
Prolog is… • General purpose logic programming language • We’ll talk about what it’s associated with later • Prolog is declarative • Logic is expressed in terms of relations, execution triggered by running queries over relations • Single data type -> TERM • Relation is defined by a CLAUSE
A little history • Idea conceived in France -> Alain Colmerauer (1970s) • First compiler written by David H. D. Warren in Edinburgh, Scotland • Initially aimed at ___________
A little bit of Prolog never hurt anyone • Terms are either atoms, numbers, variables, or compound terms • Atom – general purpose name with no inherent meaning ex. [], x, hello, ‘Ther’ ‘helother’ • Variable – can be instantiated via unification (first letter is capitalized) • Compound term – functor (atom) and a number of arguments ex. truckyear(mazda,1986)
…I promise… • Prolog programs describe relations which are defined by clauses • 2 types of clauses: facts and rules • Rules: “Head <= Body” <- Head is true if Body is true • A rule’s body consists of calls to predicates (goals) • Clauses with empty bodies are facts ex. skydiver(‘Ian’). same as skydiver(‘Ian’) <= true.
What is Prolog For? • Other than natural language processing….
What is Prolog For? • Other than language processing…. • Theorem proving • Expert systems • Games • Automated answering machines • Sophisticated control systems