1 / 6

Lecture 26: Introduction to Logic Programming with Prolog

The University of North Carolina at Chapel Hill. Lecture 26: Introduction to Logic Programming with Prolog. COMP 144 Programming Language Concepts Spring 2002. Felix Hernandez-Campos March 25. Logic Programming. A logic program is a collection of axiom from which theorems can be proven

lam
Télécharger la présentation

Lecture 26: Introduction to Logic Programming with Prolog

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The University of North Carolina at Chapel Hill Lecture 26: Introduction to Logic Programming with Prolog COMP 144 Programming Language Concepts Spring 2002 Felix Hernandez-Campos March 25 COMP 144 Programming Language Concepts Felix Hernandez-Campos

  2. Logic Programming • A logic program is a collection of axiom from which theorems can be proven • A program is a theorem • The language tries to find a collection of axioms and inference steps that imply the goal • Axiom are written in a standard form known as Horn clauses • A Horn clause consists of a consequent (head H) and a body (terms Bi) H  B1, B2,…, Bn • Semantics: when all Bi are true, we can deduce that H is true COMP 144 Programming Language Concepts Felix Hernandez-Campos

  3. A and B imply C If we know that A and B imply C, and that C implies D, then we can deduce that A and B imply D Resolution • Horn clauses can capture most logical statements • But not all • The derivation of new statements is known as resolution • The logic programming system combines existing statements to find new statements • For instance, C  A, B D  C D  A, B COMP 144 Programming Language Concepts Felix Hernandez-Campos

  4. Variable Free Variable X acquired value Rochester during the resolution This is known as Unification Example flowery(X)  rainy(X) rainy(Rochester) flowery(Rochester) Predicate Applied to a Variable Predicate Applied to an Atom COMP 144 Programming Language Concepts Felix Hernandez-Campos

  5. Prolog • PROgramming in LOGic • It is the most widely used logic programming language • Its development started in 1970 and it was result of ta collaboration between researchers from Marseille, France, and Edinburgh, Scotland • Main applications: • Artificial intelligence: expert systems, natural language processing, … • Databases: query languages, data mining,… • Mathematics: theorem proving, symbolic packages,… COMP 144 Programming Language Concepts Felix Hernandez-Campos

  6. Reading Assignment • Read • Scott Ch. 11 intro • Scott Sect. 11.3 intro, 11.3.1 COMP 144 Programming Language Concepts Felix Hernandez-Campos

More Related