zebra puzzle continued recap Prolog concepts family relations
|
|
- Delphia Preston
- 5 years ago
- Views:
Transcription
1 zebra puzzle continued recap Prolog concepts family relations 1 recapping the Zebra puzzle 2
2 ****** the facts ****** There are 5 houses, occupied by politicallyincorrect gentlemen of 5 different nationalities, who all have different coloured houses, keep different pets, drink different drinks, and smoke different (now-extinct) brands of cigarettes.... specific constraints... 3 translating constraints to Prolog % Who owns the zebra and who drinks water? find(zebraowner,waterdrinker) :- makehouses(5, List), % The Englishman lives in a red house. house( red, englishman, _, _, _) on List, % The Spaniard keeps a dog. house( _, spaniard, dog, _, _) on List,... Notice: this is a single clause contaning all the constraints 4
3 the empty houses?- makehouses(5, List). List = [house(_g233, _G234, _G235, _G236, _G237), house(_g245, _G246, _G247, _G248, _G249), house(_g257, _G258, _G259, _G260, _G261), house(_g269, _G270, _G271, _G272, _G273), house(_g281, _G282, _G283, _G284, _G285)] 5 special predicates "just to the left of"? "lives next to"? define sublist2(s, L) sublist2([s1, S2], [S1, S2 L]). % why do we get a warning here? sublist2(s, [_ T]) :- sublist2(s, T). define nextto predicate nextto(h1, H2, L) :- sublist2([h1, H2], L). nextto(h1, H2,L) :- sublist2([h2, H1], L). 6
4 translate constraints The ivory house is just to the left of the green house. sublist2( [house(ivory, _, _, _, _), house(green, _, _, _, _)], List),... The horse owner lives next to the Kools smoker. nextto(house( _, _, _, _, kools), house( _, _, horse, _, _), List),... 7 so far so good after 1st 9 rules: the subgoal house(yellow, _G430, _G431, _G432, kools) on [house(red, englishman, snail, _G384, old_gold), house(green, spaniard, dog, coffee, _G397), house(ivory, ukrainian, _G407, tea, _G409), house(green, _G418, _G419, _G420, _G421), house(yellow, _G430, _G431, _G432, kools)] succeeds, but... 8
5 if at first you don't succeed.. constraint 10 says % A Norwegian owns the first house. List = [house(_, norwegian, _, _, _) _], this fails because List = [house(red, englishman,... so this binding is undone and a search begins for another alternative backtracking eventually finds a solution. see Chapter 26 9 looking for the zebra Who owns the zebra and who drinks water? find(zebraowner,waterdrinker) :- makehouses(5, List), house( red, englishman, _, _, _) on List, %... assert all the constraints... house( _, WaterDrinker, _, water, _) on List, house( _, ZebraOwner, zebra, _, _) on List. solution is generated and then queried in the same clause. notice that neither water nor zebra occur anywhere in the constraints! 10
6 solving the puzzle?- ['/cs/course/3401/zebra.pl'].?- find(zebraowner, WaterDrinker). ZebraOwner = japanese WaterDrinker = norwegian ; No 11 Prolog concepts: a recap 12
7 classification procedural/operational vs. denotational Java, C, etc. Lisp, Prolog denotational functional vs. declarative Lisp Prolog denotation = denotation = expression statement 13 clauses facts and rules are called clauses. A fact is a clause with no condition. Prolog uses a particular form of logic called clause logic special form of first-order logic (FOL) 14
8 queries a query is one or more terms input, as a conjunction, to the Prolog interpreter answer to the query is yes if all terms succeed. each term in the query succeeds if it can be shown to: match a fact in the database, or match the goal of a clause whose body succeeds 15 clarification text, p. 141:?- relation [, relation]... non-standard usage of the word "relation" a relation in the book's sense is not a relation in the mathematical sense. name(me, 'Peter') is a proposition stating an instance of the name relation. 16
9 terminology the mathematical denotation of a functor is a relation, but more common terminology for Prolog: functors denote predicates with 0 or more arguments. "predicates" : the ingredients of predicate logic "first-order predicate logic" "first-order logic" or just "FOL" 17 example of is to illustrate the is predicate length([], 0). length([h T], L) :- length(t, L1), L is 1 + L1. notice: two clauses define the predicate one fact and one (recursive) rule 18
10 family relations 19 a simple disjunction Ch. 18, p. 154 parent(parent, Child) :- mother(parent, Child). parent(parent, Child) :- father(parent, Child). what's the logical meaning of 2 rules with same predicate? what's the database to support queries such as?- parent(parent, 'Elizabeth').?- parent('mary', Child).? 20
11 family relations the database parent(parent, Child) :- mother(parent, Child). parent(parent, Child) :- father(parent, Child). father('george', 'Elizabeth'). father('george', 'Margaret'). mother('mary', 'Elizabeth'). mother('mary', 'Margaret'). consulting the clauses?- [p154]. % p154 compiled 0.01 sec, 1,220 bytes Yes?- 21 explicit searching?- parent(parent, Child). Parent = 'Mary' Child = 'Elizabeth' ; Parent = 'Mary' Child = 'Margaret' ; Parent = 'George' Child = 'Elizabeth' ; Parent = 'George' Child = 'Margaret' ; no 22
12 implicit search [trace]?- parent(parent, Child1), parent(parent, Child2), not(child1 = Child2). T Call: (8) parent(_g313, _G314) Call: (8) parent(_g313, _G314)? creep Call: (9) mother(_g313, _G314)? creep Exit: (9) mother('mary', 'Elizabeth')? creep T Exit: (8) parent('mary', 'Elizabeth') Exit: (8) parent('mary', 'Elizabeth')? creep T Call: (8) parent('mary', _G317) Call: (8) parent('mary', _G317)? creep Call: (9) mother('mary', _G317)? creep Exit: (9) mother('mary', 'Elizabeth')? creep T Exit: (8) parent('mary', 'Elizabeth') Exit: (8) parent('mary', 'Elizabeth')? creep Redo: (9) mother('mary', _G317)? creep Exit: (9) mother('mary', 'Margaret')? creep T Exit: (8) parent('mary', 'Margaret') Exit: (8) parent('mary', 'Margaret')? creep Parent = 'Mary' Child1 = 'Elizabeth' Child2 = 'Margaret' 23
Prolog Core Concepts and Notation
Prolog Core Concepts and Notation Yves Lespérance Adapted from Peter Roosen-Runge Readings: C & M Ch 1, 2, 3.1-3.3, 8 1 declarative/logic programming idea: write a program that is a logical theory about
More informationProlog examples continued
Prolog examples continued arithmetic functions translating a simple Lisp function modelling an addition circuit puzzle solving 1 arithmetic functions we keep arithmetic functions as functions for convenience:?-
More informationLogic-Oriented Programming (5/11/2004)
1 Logic-Oriented Programming (5/11/2004) Daniel P. Friedman, David W. Mack, William E. Byrd Computer Science Department, Indiana University Bloomington, IN 47405, USA Oleg Kiselyov Fleet Numerical Meteorology
More informationSolving Constraint Satisfaction Problems Using Equivalence Relations. Author: Carl Devore
LogicProblem.mws 31 March 2001 Solving Constraint Satisfaction Problems Using Equivalence Relations Author: Carl Devore If you use this program, please send me email at ,
More informationPrologue to Prolog. Logic Programming Sterling and Shapiro. Constraint Logic Programming Marriott and Stuckey
In the Lecture Series Aims and Objectives This course aims to discuss the basic aspects of constraint and logic programming. It will focus on constraint logic programming and its realisation in Eclipse,
More informationConstraint Satisfaction Problems (CSP)
Constraint Satisfaction Problems (CSP) (Where we postpone making difficult decisions until they become easy to make) R&N: Chap. 5 1 What we will try to do... Search techniques make choices in an often
More informationConstraint Satisfaction Problems (CSP) (Where we postpone making difficult
Constraint Satisfaction Problems (CSP) (Where we postpone making difficult decisions until they become easy to make) R&N: Chap. What we will try to do... Search techniques make choices in an often arbitrary
More informationProlog Lecture 1. David Eyers Michaelmas Notes derived from those created by Andy Rice and Kate Taylor, used with permission
Prolog Lecture 1 David Eyers Michaelmas 2009 Notes derived from those created by Andy Rice and Kate Taylor, used with permission Course aims Introduce a declarative style of programming Explain fundamental
More informationTopic B: Backtracking and Lists
Topic B: Backtracking and Lists 1 Recommended Exercises and Readings From Programming in Prolog (5 th Ed.) Readings: Chapter 3 2 Searching for the Answer In order for a Prolog program to report the correct
More informationPredicate Calculus. Problems? Syntax. Atomic Sentences. Complex Sentences. Truth
Problems? What kinds of problems exist for propositional logic? Predicate Calculus A way to access the components of an individual assertion Predicate Calculus: used extensively in many AI programs, especially
More informationCS 321 Programming Languages and Compilers. Prolog
CS 321 Programming Languages and Compilers Prolog Prolog PROgramming LOGic Algorithm = Logic + Control Logic programming deals with computing relations rather than functions. To understand Prolog one must
More informationRealization of Forward Checking in Logic. Christian Holzbaur. Department of Medical Cybernetics and AI. University of Vienna, and
Realization of Forward Checking in Logic Programming via Extended Unication Christian Holzbaur (email: christian@ai-vie.uucp) Department of Medical Cybernetics and AI University of Vienna, and Austrian
More informationProlog. Logic Programming vs Prolog
Language constructs Prolog Facts, rules, queries through examples Horn clauses Goal-oriented semantics Procedural semantics How computation is performed? Comparison to logic programming 1 Logic Programming
More informationFundamentals of Prolog
Fundamentals of Prolog Prof. Geraint A. Wiggins Centre for Cognition, Computation and Culture Goldsmiths College, University of London Contents Summary of Lecture 1 What makes a good Prolog program? What
More informationIntroduction to Prolog
Introduction to Prolog David Woods dwoods@scss.tcd.ie Week 3 - HT Declarative Logic The Prolog programming language is, at its theoretical core, a declarative language. This is unlike more commonly used
More informationRecursion, Structures, and Lists
Recursion, Structures, and Lists Artificial Intelligence Programming in Prolog Lecturer: Tim Smith Lecture 4 04/10/04 30/09/04 AIPP Lecture 3: Recursion, Structures, and Lists 1 The central ideas of Prolog
More informationMaterial. Thought Question. Outline For Today. Example: Map-Coloring EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 6, 4/20/2005 University of Washington, Department of Electrical Engineering Spring 2005 Instructor: Professor Jeff A. Bilmes Material Read all of chapter
More informationChapter 16. Logic Programming Languages ISBN
Chapter 16 Logic Programming Languages ISBN 0-321-49362-1 Chapter 16 Topics Introduction A Brief Introduction to Predicate Calculus Predicate Calculus and Proving Theorems An Overview of Logic Programming
More informationTests, Backtracking, and Recursion
Tests, Backtracking, and Recursion Artificial Intelligence Programming in Prolog Lecture 3 30/09/04 30/09/04 AIPP Lecture 3: Rules, Results, and Backtracking 1 Re-cap A Prolog program consists of predicate
More informationWeek 7 Prolog overview
Week 7 Prolog overview A language designed for A.I. Logic programming paradigm Programmer specifies relationships among possible data values. User poses queries. What data value(s) will make this predicate
More informationWhat is Prolog? - 1. A Prolog Tutorial. Prolog Programming. What is Prolog? - 2. » Declaring some facts about objects and their relationships
What is Prolog? - 1 Prolog is an example of a logic programming language A Prolog Tutorial Based on Clocksin and Mellish Chapter 1 Invented by Alain Colmeraurer in 1972 The version implemented at the University
More informationWhat is Prolog? - 1. A Prolog Tutorial. What is Prolog? - 2. Prolog Programming. » Declaring some facts about objects and their relationships
What is Prolog? - 1 Prolog is an example of a logic programming language Invented by Alain Colmeraurer in 1972 A Prolog Tutorial Based on Clocksin and Mellish Chapter 1 The version implemented at the University
More informationIntroduction to predicate calculus
Logic Programming Languages Logic programming systems allow the programmer to state a collection of axioms from which theorems can be proven. Express programs in a form of symbolic logic Use a logical
More informationLecture 1. Introduction
Lecture 1 1 Constraint Programming Alternative approach to programming Combination of reasoning and computing Constraint on a sequence of variables: a relation on their domains Constraint Satisfaction
More informationChapter 16. Logic Programming Languages
Chapter 16 Logic Programming Languages Chapter 16 Topics Introduction A Brief Introduction to Predicate Calculus Predicate Calculus and Proving Theorems An Overview of Logic Programming The Origins of
More informationProlog (cont d) Remark. Using multiple clauses. Intelligent Systems and HCI D7023E
Intelligent Systems and HCI D703E Lecture : More Prolog Paweł Pietrzak Prolog (cont d) 1 Remark The recent version of SWI- Prolog displays true and false rather than and no Using multiple clauses Different
More informationLogic Programming Languages
Logic Programming Languages Introduction Logic programming languages, sometimes called declarative programming languages Express programs in a form of symbolic logic Use a logical inferencing process to
More informationChapter 16. Logic Programming Languages ISBN
Chapter 16 Logic Programming Languages ISBN 0-321-49362-1 Chapter 16 Topics Introduction A Brief Introduction to Predicate Calculus Predicate Calculus and Proving Theorems An Overview of Logic Programming
More informationproof through refutation
Prolog's logic; resolution grammars & parsing 1 proof through refutation we saw that Prolog uses the strategy: test the claim that a query is false by (1) finding it is immediately true (matches a fact
More informationLogic Programming. Efficiency Issues. Temur Kutsia
Logic Programming Efficiency Issues Temur Kutsia Research Institute for Symbolic Computation Johannes Kepler University of Linz, Austria kutsia@risc.uni-linz.ac.at Efficiency Issues in Prolog Narrow the
More informationPrinciples of Programming Languages Topic: Logic Programming Professor Lou Steinberg
Principles of Programming Languages Topic: Logic Programming Professor Lou Steinberg 1 Logic Programming True facts: If I was born in year B, then in year Y on my birthday I turned Y-B years old I turned
More informationDeclarative Programming Prolog CS360
Declaratie Programming Prolog CS360 Terms Numerical literals String literals Ø By default, any string that starts is all lowercase Ø Use single quotes for anything else Atoms Ø Essentially, strings Ø Also,
More informationCOMP219: Artificial Intelligence. Lecture 6: Recursion in Prolog
COMP219: Artificial Intelligence Lecture 6: Recursion in Prolog 1 Overview Last time Introduction to Prolog: facts, rules, queries; family tree program Today: Recursive rules in Prolog; writing and evaluating
More information1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.
1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered
More informationNotes for Chapter 12 Logic Programming. The AI War Basic Concepts of Logic Programming Prolog Review questions
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions The AI War How machines should learn: inductive or deductive? Deductive: Expert => rules =>
More informationProgramming Paradigms
PP 2017/18 Unit 6 Prolog Basics 1/42 Programming Paradigms Unit 6 Prolog Basics J. Gamper Free University of Bozen-Bolzano Faculty of Computer Science IDSE PP 2017/18 Unit 6 Prolog Basics 2/42 Outline
More informationThread-Based Competitive Or-Parallelism
Thread-Based Competitive Or-Parallelism Paulo Moura 1,3, Ricardo Rocha 2,3, and Sara C. Madeira 1,4 1 Dep. of Computer Science, University of Beira Interior, Portugal {pmoura, smadeira}@di.ubi.pt 2 Dep.
More informationLogic Languages. Hwansoo Han
Logic Languages Hwansoo Han Logic Programming Based on first-order predicate calculus Operators Conjunction, disjunction, negation, implication Universal and existential quantifiers E A x for all x...
More informationProlog-2 nd Lecture. Prolog Predicate - Box Model
Prolog-2 nd Lecture Tracing in Prolog Procedural interpretation of execution Box model of Prolog predicate rule How to follow a Prolog trace? Trees in Prolog use nested terms Unification Informally Formal
More informationA filtering algorithm for eonstrai
A filtering algorithm for eonstrai Jean-Charles R&XV GDR 1093 CNRS LIRMM UMR 9928 Universite Montpellier II / CNRS 161, rue Ada - 34392 Montpellier Cedex 5 - France e-mail : regin@lirmm.fr Abstract Many
More informationdocumenting programs, including: A traditional, command line interactive top level.
Computational Logic Developing Programs with a Logic Programming System 1 Our Development Environment: The Ciao System We use the (ISO-Prolog subset of the) Ciao multiparadigm programming system. In particular,
More informationProlog 2. Unification and Recursion
Prolog 2 Unification and Recursion The Notion of Unification Unification is when two things become one Unification is kind of like assignment Unification is kind of like equality in algebra Unification
More informationLast Week COMP219: Artificial Intelligence Lecture 8 Prolog Lecture 2 Recursive Definitions Recursion The Ancestor Relation
COMP219: Artificial Intelligence Lecture 8 Prolog Lecture 2 Recursive Definitions Dr. Annabel Latham Ashton Building Room 2.05 http://www.csc.liv.ac.uk/~alatham/comp219.html Last Week Prolog programs comprised
More informationCAP 5602 Summer, Lesson 4: Loops. The topics 1. the cut and some of its uses 2. the while loop 3. the do until loop
CAP 5602 Summer, 2011 Lesson 4: Loops The topics 1. the cut and some of its uses 2. the while loop 3. the do until loop 1. The cut The cut (!) is a way of controlling backtracking. If a rule contains a
More informationWhat needs to be kept track of ffl The current substitution ffl The current goal ffl The clause currently in use ffl Backtrack Information 2
Prolog Implementation ffl The Generic Idea: Everything except unification. ffl An Introduction to the WAM: Flat unification only. 1 What needs to be kept track of ffl The current substitution ffl The current
More informationIN112 Mathematical Logic
Institut Supérieur de l Aéronautique et de l Espace IN112 Mathematical Logic Lab session on Prolog Christophe Garion DMIA ISAE Christophe Garion IN112 IN112 Mathematical Logic 1/ 31 License CC BY-NC-SA
More informationCSC324 Logic & Relational Programming Illustrated in Prolog
CSC324 Logic & Relational Programming Illustrated in Prolog Afsaneh Fazly 1 Winter 2013 1 with many thanks to Anya Tafliovich, Gerald Penn and Sheila McIlraith. 1 2 admin notes Please check your marks
More informationAn introduction to logic programming with Prolog
An introduction to logic programming with Prolog Dr. Constantinos Constantinides Department of Computer Science and Software Engineering Concordia University A running example: A family genealogy tree
More informationIN112 Mathematical Logic
Institut Supérieur de l Aéronautique et de l Espace IN112 Mathematical Logic Lab session on Prolog Christophe Garion DMIA ISAE Christophe Garion IN112 IN112 Mathematical Logic 1/ 31 License CC BY-NC-SA
More informationObjectives. Principles of Constraint Programming Krzysztof R. Apt. Chapter 2 Constraint Satisfaction Problems: Examples. Example: SEND + MORE = MONEY
Objectives Principles of Constraint Programming Krzysztof R. pt Chapter 2 Constraint Satisfaction Problems: xamples Define formally Constraint Satisfaction Problems (CSP), Modeling: representation of a
More informationPROgramming in LOGic PROLOG Recursion, Lists & Predicates
PROgramming in LOGic PROLOG Recursion, Lists & Predicates CSC9Y4 1 Recursion Recursion in Prolog means placing in the body of a rule a call to the predicate which occurs in the head of the rule. Here is
More informationA Sample Prolog Session
A Sample Prolog Session 1 The Monkey Banana program Below is the program as shown in Figure 2.14[1]. % Figure 2.14 A program for the monkey and banana problem. % move( State1, Move, State2): making Move
More informationImplementação de Linguagens 2016/2017
Implementação de Linguagens Ricardo Rocha DCC-FCUP, Universidade do Porto ricroc @ dcc.fc.up.pt Ricardo Rocha DCC-FCUP 1 Logic Programming Logic programming languages, together with functional programming
More informationFinal-Term Papers Solved MCQS with Reference
Solved MCQ(S) From FinalTerm Papers BY Arslan Jan 14, 2018 V-U For Updated Files Visit Our Site : Www.VirtualUstaad.blogspot.com Updated. Final-Term Papers Solved MCQS with Reference 1. The syntax of PHP
More informationMethods for Interactive Constraint Satisfaction
JEPPE NEJSUM MADSEN nejsum@diku.dk Methods for Interactive Constraint Satisfaction MASTER S THESIS February 14, 2003 DEPARTMENT OF COMPUTER SCIENCE University of Copenhagen Abstract A constraint satisfaction
More informationsimplicity hides complexity flow of control, negation, cut, 2 nd order programming, tail recursion procedural and declarative semantics and & or
simplicity hides complexity flow of control, negation, cut, 2 nd order programming, tail recursion simple and/or composition of goals hides complex control patterns not easily represented by traditional
More informationDerived from PROgramming in LOGic (1972) Prolog and LISP - two most popular AI languages. Prolog programs based on predicate logic using Horn clauses
Prolog Programming Derived from PROgramming in LOGic (1972) Good at expressing logical relationships between concepts Prolog and LISP - two most popular AI languages Execution of a Prolog program is a
More informationChapter 16. Logic Programming. Topics. Predicate Calculus and Proving Theorems. Resolution. Resolution: example. Unification and Instantiation
Topics Chapter 16 Logic Programming Proving Theorems Resolution Instantiation and Unification Prolog Terms Clauses Inference Process Backtracking 2 Predicate Calculus and Proving Theorems A use of propositions
More informationLOGIC AND DISCRETE MATHEMATICS
LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University
More informationProlog Introduction. Gunnar Gotshalks PI-1
Prolog Introduction PI-1 Physical Symbol System Hypothesis A physical symbol system has the necessary and sufficient means for general intelligent action. Allen Newell and Herbert A. Simon PI-2 Physical
More informationTopic 1: Introduction to Knowledge- Based Systems (KBSs)
Topic 1: Introduction to Knowledge- Based Systems (KBSs) 1.5 Introduction to Logic Programming (Prolog) 32 Simple example: Algorithm for checking sorted list? We all know how to check if a list is sorted:
More informationCOMP 9416, session 1, 2006 p. 1. Datalog. COMP 9416, session 1, 2006
OMP 9416, session 1, 2006 p. 1 Datalog OMP 9416, session 1, 2006 OMP 9416, session 1, 2006 p. 2 Atoms, integers and variables The fact "person(socrates).", the fact "sum(2,3,y)." and the rule "mortal(x)
More informationThe Logic Paradigm. Joseph Spring. 7COM1023 Programming Paradigms
The Logic Paradigm Joseph Spring 7COM1023 Programming Paradigms 1 Discussion The Logic Paradigm Propositional and Predicate Logic See also notes and slides on PP website Horn Clauses Definition, Examples
More informationOperators (2A) Young Won Lim 10/5/13
Operators (2A) Copyright (c) 2013 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version
More informationQ1:a. Best first search algorithm:
Q1:a Best first search algorithm: 1. Open=[A10]; closed=[] 2. Evaluate A10; open=[c20,b30,d40];closed=[a10] 3. Evaluate C20; open=[b30,g35,d40,h40]; closed=[c20, A10] 4. Evaluate B30; open=[e10,f20,g35,d40,h40];
More informationLecture Notes on Prolog
Lecture Notes on Prolog 15-317: Constructive Logic Frank Pfenning Lecture 15 October 24, 2017 1 Introduction Prolog is the first and still standard backward-chaining logic programming language. While it
More informationProlog Programming. Lecture Module 8
Prolog Programming Lecture Module 8 Prolog Language Prolog is unique in its ability to infer facts from the given facts and rules. In Prolog, an order of clauses in the program and goals in the body of
More informationKnowledge Representation
Knowledge Representation B. Dwyer, University of Adelaide 2004 1. Introduction 3 1.1. What is Knowledge Representation? 3 2. Prolog Basics 5 2.1. Facts 5 2.2. Rules 6 2.2.1. Conjunction (AND) 7 2.2.2.
More informationSTRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH
Slide 3.1 3 STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH 3.0 Introduction 3.1 Graph Theory 3.2 Strategies for State Space Search 3.3 Using the State Space to Represent Reasoning with the Predicate
More informationA thesis. presented to the University ofwaterloo. in fullment of the. thesis requirement for the degree of. Master of Mathematics.
Domain Independant Heuristics in Hybrid Algorithms for CSP's by Paul van Run A thesis presented to the University ofwaterloo in fullment of the thesis requirement for the degree of Master of Mathematics
More informationLast Week. Today. Prolog: recursion examples. Recursion in Prolog. CSC326 Programming Languages (Week 12,Friday)
Last Week CSC326 Programming Languages (Week 12,Friday) Yilan Gu guyilan@ecf.toronto.edu http://www.cs.toronto.edu/~yilan/326f09/ More on Prolog reasoning mechanism Operators Lists Today Recursion in Prolog
More information6.034 Notes: Section 11.1
6.034 Notes: Section 11.1 Slide 11.1.1 We've now spent a fair bit of time learning about the language of first-order logic and the mechanisms of automatic inference. And, we've also found that (a) it is
More informationCPS 506 Comparative Programming Languages. Programming Language Paradigm
CPS 506 Comparative Programming Languages Logic Programming Language Paradigm Topics Introduction A Brief Introduction to Predicate Calculus Predicate Calculus and Proving Theorems An Overview of Logic
More informationThe current topic: Prolog. Announcements. Meaning of a Prolog rule. Prolog syntax. Reminder: The deadline for Lab 2 re-mark requests is Friday.
The current topic: Prolog! Introduction! Object-oriented programming: Python! Functional programming: Scheme! Python GUI programming (Tkinter)! Types and values Logic programming: Prolog! Introduction
More informationPart I Logic programming paradigm
Part I Logic programming paradigm 1 Logic programming and pure Prolog 1.1 Introduction 3 1.2 Syntax 4 1.3 The meaning of a program 7 1.4 Computing with equations 9 1.5 Prolog: the first steps 15 1.6 Two
More information7COM1023 Programming Paradigms
7COM1023 Programming Paradigms Practical 7: The Logic Paradigm Tutorial: Exercises Propositional and Predicate Logic form the basis for logic programming. 1. Explain what is meant by propositional logic.
More informationsimplicity hides complexity flow of control, negation, cut, 2 nd order programming, tail recursion procedural and declarative semantics and & or
simplicity hides complexity flow of control, negation, cut, 2 nd order programming, tail recursion simple and/or composition of goals hides complex control patterns not easily represented by traditional
More informationProlog. IFT 6802 Introduction to Prolog. Declarative programming LOGIC PROGRAMMING BASICS. LOGIC PROGRAMMING BASICS (suite) Facts
Prolog IFT 6802 Introduction to Prolog Par Jean Vaucher (& Laurent Magnin) A programming language based on the formalism and the concepts of formal logic. PROgrammation LOGique Robinson (resolution) Kowalski
More informationF1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept
F1 A Java program Ch 1 in PPIJ Introduction to the course The computer and its workings The algorithm concept The structure of a Java program Classes and methods Variables Program statements Comments Naming
More informationName: CSCI E-220: Artificial Intelligence Midterm Exam, Fall Term 2001
Name: CSCI E-220: Artificial Intelligence Midterm Exam, Fall Term 2001 This is a 75-minute, open-book exam. Take a minute to look over the exam, and begin by answering the questions you feel most comfortable
More informationThe Einstein Puzzle. Hints to Einstein Puzzle. Hints to Einstein Puzzle (cont) Specify Einstein Puzzle in SAT. Specify Einstein Puzzle in SAT
The Einstein Puzzle SAT: Propositional Satisfiability 22c:145 Artificial Intelligence Russell & Norvig, Ch. 7.6 Supposedly, Albert Einstein wrote this riddle, and said 98% of the world could not solve
More informationLogic Programming. Let us have airline flight information of the form: 1. Application Domains: 2. Definitions
Logic Programming 1. Application Domains: Logic programming language application areas include natural language processing, expert systems, specifications checking, theorem proving, and control systems
More informationLecture 11: Feb. 10, 2016
CS323: AI (Hands on with Prolog) Spring 2016 Lecturer: K.R. Chowdhary Lecture 11: Feb. 10, 2016 : Professor of CS (VF) Disclaimer: These notes have not been subjected to the usual scrutiny reserved for
More informationCS A331 Programming Language Concepts
CS A331 Programming Language Concepts Lecture 10 Alternative Programming Languages (Functional LISP Declarative - PROLOG) March 24, 2014 Sam Siewert Functional PL Concepts Based on Lambda Calculus Output
More informationAdvanced Prolog Programming
1 Introduction CIS335, Assignment 4 Advanced Prolog Programming Geraint Wiggins November 12, 2004 This practical is the second self-assessed exercise for MSc students on the Prolog module. It is intended
More informationCASE STUDY LOGIC PROGRAMMING
CASE STUDY LOGIC PROGRAMMING 1 OUTLINE Preliminary Concepts Horn Clauses Logic Programming in Prolog Prolog Program Elements Practical Aspects of Prolog Prolog Examples Solving Word Puzzles Natural Language
More informationVisual Prolog Tutorial
Visual Prolog Tutorial Jim Mims April 2008 (with modification by Danjie Zhu) Preface What is Prolog? Programming in Logic. Edinburgh syntax is the basis of ISO standard. High-level interactive language.
More informationSoftware Paradigms (Lesson 6) Logic Programming
Software Paradigms (Lesson 6) Logic Programming Table of Contents 1 Introduction... 2 2 Facts... 3 3 Predicates (Structured Terms)... 4 3.1 General Structures... 4 3.2 Predicates (Syntax)... 4 3.3 Simple
More informationPROLOG. First simple Prolog Program. Basic elements of Prolog. Clause. NSSICT/CH/Nov., 2012.
PROLOG Prolog is a programming language for symbolic, n-numeric computations. It is specially well suited for solving problems that involve objects and relation between objects. First simple Prolog Program
More informationCSC4504/Prolog. : Formal Languages & Applications. J Paul Gibson, D311. An Introduction To Prolog
CSC4504/Prolog. : Formal Languages & Applications J Paul Gibson, D311 paul.gibson@telecom-sudparis.eu http://www-public.telecom-sudparis.eu/~gibson/teaching/csc4504/ An Introduction To Prolog /~gibson/teaching/csc4504/problem8-prolog.pdf
More informationCOMP4418 Knowledge Representation and Reasoning
COMP4418 Knowledge Representation and Reasoning Week 3 Practical Reasoning David Rajaratnam Click to edit Present s Name Practical Reasoning - My Interests Cognitive Robotics. Connect high level cognition
More informationAgenda. CS301 Session 20. A logic programming trick. A simple Prolog program. Introduction to logic programming Examples Semantics
CS301 Session 20 Introduction to logic programming Examples Semantics Agenda 1 2 A logic programming trick A two-way translator in two lines of code: translate([],[]). translate([word Words],[Mot Mots])
More informationFaculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology
Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4020 July 5, 2007 14.00-15.30 This exam (8 pages) consists of 60 True/False
More information6. Inference and resolution
Computer Science and Software Engineering University of Wisconsin - Platteville 6. Inference and resolution CS 3030 Lecture Notes Yan Shi UW-Platteville Read: Textbook Chapter 8 Part of the slides are
More informationBacktrack control. Chapter 5
Chapter 5 Backtrack control Prolog will automatically backtrack to satisfy a goal. This relieves the programmer of the burden of putting in backtrack explicitly. On the negative side, this might lead to
More informationTHE PREDICATE CALCULUS
2 THE PREDICATE CALCULUS Slide 2.1 2.0 Introduction 2.1 The Propositional Calculus 2.2 The Predicate Calculus 2.3 Using Inference Rules to Produce Predicate Calculus Expressions 2.4 Application: A Logic-Based
More informationPROLOG PROgramming in LOGic
PROLOG PROgramming in LOGic 1 Knowledge-Based Information Systems (Relational) database systems are very efficient in the handling of data. Information is data together with a suitable interpretation.
More informationProgramming Languages 2nd edition Tucker and Noonan
Programming Languages 2nd edition Tucker and Noonan Chapter 15 Logic Programming Q: How many legs does a dog have if you call its tail a leg? A: Four. Calling a tail a leg doesn t make it one. Abraham
More informationFirst-Order Logic (FOL)
First-Order Logic (FOL) FOL consists of the following parts: Objects/terms Quantified variables Predicates Logical connectives Implication Objects/Terms FOL is a formal system that allows us to reason
More informationLogic Programming in Prolog
Cristian Giumale / Lecture Notes 1 Logic Programming in Prolog There are important advantages of using programming systems based on logic: Data are neatly separated from the inference engine, which is
More information