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.
Presentation Outline • Definition • History and background • Logical calculus • Resolution theorem proving • Prolog syntax and example program • Strengths and weaknesses • Summary and conclusions
Logic programming • based on symbolic logic • write declarations and infer the results • logic programming languages are declarative languages
What does declarative mean? • Logic programmers write declarations describing relationships between entities • the ‘what’ vs. the ‘how’ • what does the answer look like? (specification) vs. • how do I exactly compute the answer?(implementation)
Let’s sort a list nonprocedurally permute(oldList, newList) Ù sorted(newList) => sort(oldList, newList) • j such that 1 ≤ j < n, list(j) ≤ list(j + 1) => sorted(list) example from [Sebesta]
Prolog Prolog = Programmation en Logique • Early 70’s • Alain Colmerauer and Phillipe Roussel • Robert Kowalski
Origins of Prolog Q-systems – designed for machine natural language translation (Colmerauer) • used to construct automatic English-French translations • used in Canada to translate weather forecasts from English to French
First large Prolog program man-machine communication system –1972 TOUT PSYCHIATRE EST UNE PERSONNE. CHAQUE PERSONNE QU'IL ANALYSE, EST MALADE. *JACQUES EST UN PSYCHIATRE A *MARSEILLE. EST-CE QUE *JACQUES EST UNE PERSONNE? OU EST *JACQUES? EST-CE QUE *JACQUES EST MALADE? OUI. A MARSEILLE. JE NE SAIS PAS.
Propositional calculus the language… • atoms: T, F, {w | w is a string and begins with a capital letter}…H, On_A_B • connectives: Ù, Ú, Ø, → • rules for forming sentences(aka. well-formed formulas, wff’s)
Rules for wff’s • any atom is a wff • If w1 and w2 are wff’s, so are:w1 Ù w2conjunctionw1 Ú w2disjunctionw1 →w2implication Ø w1negation • there are no other wff’s
more terms… • literal: atom or negated atom (P, ØP) • w1 →w2(antecedent) (consequent)
Propositional calculus the inference rules…(6 of them anyway) • w2 from w1 and w1 →w2 (modus ponens) • w1 Ù w2 from w1 and w2 (Ù introduction) • w2 Ù w1 from w1 Ù w2 (commutativity of Ù) • w1 from w1 Ù w2 (Ù elimination) • w1 Ú w2 from w1 or w2 (Ú introduction) • w1 from Ø(Øw1) (Ø elimination)
Propositional calculus the semantics… • associate atoms with propositions about the world Shaun_strong with “Shaun is strong”|_________________| denotation |__________________________________________| interpretation
Propositional calculus remember…? • literal: an atom or its negation a new term! • clause: a set of literals with disjunction implied {P, Q, ØR} ≡ (P ÚQ ÚØR)
Propositional calculus a new inference rule…resolution S1 S2from{a} S1 and{Øa} S2 P ÚR from P ÚQ and R ÚØQ { } from{a} and {Øa}
limitations… • Propositional calculus limits us to referring to ‘hard-coded’ propositions about the world. • What if we also want to refer to objects and propositions by name?
Summary and Conclusions Proponets say… • Logical language => logically organized=> fewer errors, less maintenance • Programs concise => less development time => good prototyping language Opponents say… • BUNK! http://www.mozart-oz.org/features.html
Presentation Review • Definition • History and background • Logical calculus • Resolution theorem proving • Prolog syntax and example program • Strengths and weaknesses • Summary and conclusions