Fundamentals of Prolog
|
|
- Jayson Reeves
- 6 years ago
- Views:
Transcription
1 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 makes a bad Prolog program? More about Prolog clause syntax More about Prolog guery syntax Proof strategy
2 Summary of Lecture 1 Course structure Examinations, practicals, books Prolog in English Using the Prolog system Fundamental Prolog syntax Predicates Clauses Heads & Bodies Atoms & Numbers Variables Full-stops (periods) Goldsmiths College, University of London 2
3 What makes a good Prolog program? In order of decreasing importance: correctness & careful design clarity & comments speed (at least for our purposes here) Because we understand the logical meaning of logic programs we can rely on the computer to transform elegant but inefficient programs into ugly (but invisible) efficient ones Goldsmiths College, University of London 3
4 What makes a bad Prolog program? In no particular order: hacking undesigned code at the terminal using obscure or meaningless variable and predicate names not commenting code abusing the procedural aspects of Prolog to produce logically meaningless code Goldsmiths College, University of London 4
5 More about Prolog clause syntax (1) Recall that a Prolog program is made up of predicates... and a predicate is made up of clauses. A clause has a head and maybe a body. The head of a clause always takes one of two forms: predname predname( argument1, argument2,...) If the predicate is always true, there is no body, and we finish with a full-stop (period). Goldsmiths College, University of London 5
6 More about Prolog clause syntax (2) If the predicate is conditional, we connect it to a body of subgoals with the if operator, :- Each subgoal is a Prolog literal... which is either like a head, as before; or a negated literal, written \+ predname \+ predname( argument1,...) Note the space after the \+ operator We will return to \+ later Goldsmiths College, University of London 6
7 More about Prolog clause syntax (3) We can combine literals in Prolog clauses with the operators, (comma) meaning and conjunction ; (semicolon) meaning or disjunction, (and) binds more strongly than ;, so a, b ; c means that either both a and b are true, or c is true You should never need to use ; in a program because you can express disjunction via multiple clauses. It makes Prolog compilation less effective and your program less clear Goldsmiths College, University of London 7
8 More about Prolog clause syntax (4) There is also -> (minus, greater than) supposedly meaning implies You should never need to use ->, and it is best avoided because it does not mean the same as logical implies and can therefore beconfusing We can make complex expressions using brackets ( l1( a1, a2 ); l2( a3 )), l3( a1 ) l1( a1, a2 ); ( l2( a3 ), l3( a1 )) l1( a1, a2 ); l2( a3 ), l3( a1 ) Goldsmiths College, University of London 8
9 More about Prolog query syntax We run a Prolog program by posing a query Prolog query syntax is the same as the syntax of the clause body Literals in queries can be combined with and, or, not and implies, just as in programs Goldsmiths College, University of London 9
10 Proof strategy Prolog answers queries by attempting to prove them true Suppose we have consulted the ancestor/2 program: ancestor/2 is defined as ancestor( A, B ) :- parent( A, B ). ancestor( A, B ) :- parent( A, C ), ancestor( C, B ). Suppose parent/2 is defined as parent( alan, clive ). parent( clive, dave ). and we ask the question ancestor( alan, dave ). Goldsmiths College, University of London 10
11 Proof strategy (2) To prove this, prolog starts at the top of the database, and tries to find a predicate called ancestor; Then it looks at each clause in turn, and tries to unify its head with the goal; Once unification is complete, it attempts to prove the literals in the body, in order of appearance Goldsmiths College, University of London 11
12 Unification Unification works by comparing the structure of terms and literals: First compare the predicate/functor name; Then, for each argument; If both of the two unificands are variables, then make them the same variable, and unification succeeds; Otherwise, if one unificand is a variable, then set it to the value of the other, and unification succeeds; Otherwise, if both unificands are atomic and are the identical, unification succeeds; Otherwise, unification succeeds if the two arguments can be unified Otherwise, unification fails Goldsmiths College, University of London 12
13 Proof Strategy (3) Prove: ancestor( alan, dave ) Find: ancestor clause 1 Unify: A = alan, B = dave Prove: parent( alan, dave ) FAIL Try again: Find: ancestor clause 2 Unify: A = alan, B = dave Prove: parent( alan, C ) Find: parent clause 1 Unify: C = clive SUCCEED Next goal: Prove: ancestor( clive, dave ) Find: ancestor clause 1 Unify: A = clive, B = dave Prove: parent( clive, dave ) SUCCEED Answer: yes. Goldsmiths College, University of London 13
14 Summary In this lecture, we have covered: Prolog style More Prolog syntax Prolog standard proof (search) strategy Goldsmiths College, University of London 14
More Non-logical Features of Prolog
More Non-logical Features of Prolog Prof. Geraint A. Wiggins Centre for Cognition, Computation and Culture Goldsmiths College, University of London Contents Commit operators Implementing Negation as Failure
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 informationChapter 16. Logic Programming. Topics. Unification. Resolution. Prolog s Search Strategy. Prolog s Search Strategy
Topics Chapter 16 Logic Programming Summary (resolution, unification, Prolog search strategy ) Disjoint goals The cut operator Negative goals Predicate fail Debugger / tracer Lists 2 Resolution Resolution
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 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 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 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 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 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 informationFoundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution
Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller 09/1 Contents Motivation
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. 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 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 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 informationProlog. Intro to Logic Programming
Prolog Logic programming (declarative) Goals and subgoals Prolog Syntax Database example rule order, subgoal order, argument invertibility, backtracking model of execution, negation by failure, variables
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 informationResolution (14A) Young W. Lim 6/14/14
Copyright (c) 2013-2014. 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 published by the Free
More informationLecture Overview Prolog 1. Introduction Interaction Terms 2. Clauses and predicates Clauses Predicates Variables 3.
1 Lecture Overview Prolog 1. Introduction Interaction Terms 2. Clauses and predicates Clauses Predicates Variables 3. Satisfying goals 2 Prolog A standard free Prolog can be downloaded from http://www.swi-prolog.org
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 informationLogical reasoning systems
Logical reasoning systems Theorem provers and logic programming languages Production systems Frame systems and semantic networks Description logic systems CS 561, Session 19 1 Logical reasoning systems
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 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 informationLecture 4: January 12, 2015
32002: AI (First Order Predicate Logic, Interpretation and Inferences) Spring 2015 Lecturer: K.R. Chowdhary Lecture 4: January 12, 2015 : Professor of CS (VF) Disclaimer: These notes have not been subjected
More informationOperators (2A) Young Won Lim 10/2/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 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 informationConstraint Solving. Systems and Internet Infrastructure Security
Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Constraint Solving Systems
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 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 informationMIDTERM EXAM (Solutions)
MIDTERM EXAM (Solutions) Total Score: 100, Max. Score: 83, Min. Score: 26, Avg. Score: 57.3 1. (10 pts.) List all major categories of programming languages, outline their definitive characteristics and
More informationLecture 17 of 41. Clausal (Conjunctive Normal) Form and Resolution Techniques
Lecture 17 of 41 Clausal (Conjunctive Normal) Form and Resolution Techniques Wednesday, 29 September 2004 William H. Hsu, KSU http://www.kddresearch.org http://www.cis.ksu.edu/~bhsu Reading: Chapter 9,
More informationSAT solver of Howe & King as a logic program
SAT solver of Howe & King as a logic program W lodzimierz Drabent June 6, 2011 Howe and King [HK11b, HK11a] presented a SAT solver which is an elegant and concise Prolog program of 22 lines. It is not
More informationBacktracking. Backtracking. Backtracking. Backtracking. Backtracking. Backtracking. Functional & Logic Programming - Backtracking October, 01
Functional & Logic Programming - October, 01 already seen how to control execution ordering the clauses and goals can affect the speed of execution and the order of evaluation of the clauses now going
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 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 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 informationA Pearl on SAT Solving in Prolog (extended abstract)
A Pearl on SAT Solving in Prolog (extended abstract) Jacob M. Howe and Andy King 1 Introduction The Boolean satisfiability problem, SAT, is of continuing interest because a variety of problems are naturally
More informationCS 561: Artificial Intelligence
CS 561: Artificial Intelligence Instructor: TAs: Sofus A. Macskassy, macskass@usc.edu Nadeesha Ranashinghe (nadeeshr@usc.edu) William Yeoh (wyeoh@usc.edu) Harris Chiu (chiciu@usc.edu) Lectures: MW 5:00-6:20pm,
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 informationOperational Semantics
15-819K: Logic Programming Lecture 4 Operational Semantics Frank Pfenning September 7, 2006 In this lecture we begin in the quest to formally capture the operational semantics in order to prove properties
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 informationMixed Integer Linear Programming
Mixed Integer Linear Programming Part I Prof. Davide M. Raimondo A linear program.. A linear program.. A linear program.. Does not take into account possible fixed costs related to the acquisition of new
More informationChemistry Studio. B.Tech Project. Ashish Gupta (Y8140) Akshay Mittal (Y8056)
Chemistry Studio An Intelligent Tutoring System: Problem Solving B.Tech Project Ashish Gupta (Y8140) Akshay Mittal (Y8056) Mentored By: Prof. Amey Karkare, IIT Kanpur Dr. Sumit Gulwani, MSR Redmond Dr.
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 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 informationCSL105: Discrete Mathematical Structures. Ragesh Jaiswal, CSE, IIT Delhi
is another way of showing that an argument is correct. Definitions: Literal: A variable or a negation of a variable is called a literal. Sum and Product: A disjunction of literals is called a sum and a
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 informationSLDNF-Draw user s manual Chapter 1: static trees
SLDNF-Draw user s manual Chapter 1: static trees Marco Gavanelli December 26, 2016 1 Running and consulting Run ECL i PS e and consult file sldnf.pl: >eclipse ECLiPSe Constraint Logic Programming System
More informationInfinite Derivations as Failures
Infinite Derivations as Failures Andrea Corradi and Federico Frassetto DIBRIS, Università di Genova, Italy name.surname@dibris.unige.it Abstract. When operating on cyclic data, programmers have to take
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 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 informationKnowledge Representation and Reasoning Logics for Artificial Intelligence
Knowledge Representation and Reasoning Logics for Artificial Intelligence Stuart C. Shapiro Department of Computer Science and Engineering and Center for Cognitive Science University at Buffalo, The State
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 informationINTRODUCTION TO PROLOG
INTRODUCTION TO PROLOG PRINCIPLES OF PROGRAMMING LANGUAGES Norbert Zeh Winter 2018 Dalhousie University 1/44 STRUCTURE OF A PROLOG PROGRAM Where, declaratively, Haskell expresses a computation as a system
More informationMathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 37 Resolution Rules
Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras Lecture - 37 Resolution Rules If some literals can be unified, the same algorithm should be able
More informationIntroduction to Logic Programming in Prolog 1 / 39
Introduction to Logic Programming in Prolog 1 / 39 Outline Programming paradigms Logic programming basics Introduction to Prolog Predicates, queries, and rules Understanding the query engine Goal search
More informationAdvanced Logic and Functional Programming
Advanced Logic and Functional Programming Lecture 1: Programming paradigms. Declarative programming. From first-order logic to Logic Programming. Programming paradigms Programming paradigm (software engineering)
More informationCS 360: Programming Languages Lecture 10: Logic Programming with Prolog
CS 360: Programming Languages Lecture 10: Logic Programming with Prolog Geoffrey Mainland Drexel University Section 1 Administrivia Midterm Tuesday Midterm is Tuesday, February 14! Study guide is on the
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 informationExercises on the Fundamentals of Prolog
1 Introduction Exercises on the Fundamentals of Prolog These exercises are intended to help reinforce material taught in the lectures of CIS335 course in Prolog. They do not contribute any marks to the
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 informationLearning Rules. Learning Rules from Decision Trees
Learning Rules In learning rules, we are interested in learning rules of the form: if A 1 A 2... then C where A 1, A 2,... are the preconditions/constraints/body/ antecedents of the rule and C is the postcondition/head/
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 informationAnswer Key #1 Phil 414 JL Shaheen Fall 2010
Answer Key #1 Phil 414 JL Shaheen Fall 2010 1. 1.42(a) B is equivalent to B, and so also to C, where C is a DNF formula equivalent to B. (By Prop 1.5, there is such a C.) Negated DNF meets de Morgan s
More informationKnowledge Representation and Reasoning Logics for Artificial Intelligence
Knowledge Representation and Reasoning Logics for Artificial Intelligence Stuart C. Shapiro Department of Computer Science and Engineering and Center for Cognitive Science University at Buffalo, The State
More informationThe object level in Prolog. Meta-level predicates and operators. Contents. The flow of computation. The meta level in Prolog
Lecture 8 Meta-level predicates and operators Contents Object level vs. meta level Controlling flow of computation Checking and dismantling expressions Comparison operators The object level in Prolog Prolog
More informationLogic Programming: Prolog
Logic Programming: Prolog COMS W4115 Aristotle Prof. Stephen A. Edwards Fall 2006 Columbia University Department of Computer Science Logic All Caltech graduates are nerds. Stephen is a Caltech graduate.
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 informationHomework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture
Homework 1 Due Date: Wednesday 11/26/07 - at the beginning of the lecture Problems marked with a [*] are a littlebit harder and count as extra credit. Note 1. For any of the given problems make sure that
More informationData Integration: Datalog
Data Integration: Datalog Jan Chomicki University at Buffalo and Warsaw University Feb. 22, 2007 Jan Chomicki (UB/UW) Data Integration: Datalog Feb. 22, 2007 1 / 12 Plan of the course 1 Datalog 2 Negation
More informationCMSC 331 Final Exam Section 0201 December 18, 2000
CMSC 331 Final Exam Section 0201 December 18, 2000 Name: Student ID#: You will have two hours to complete this closed book exam. We reserve the right to assign partial credit, and to deduct points for
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 informationType checking by theorem proving in IDRIS
Type checking by theorem proving in IDRIS p. 1 Type checking by theorem proving in IDRIS Scottish Theorem Proving, 10th February 2012 ecb10@st-andrews.ac.uk University of St Andrews Edwin Brady Type checking
More informationLogic as a Programming Language
Logic as a Programming Language! Logic can be considered the oldest programming language! Aristotle invented propositional logic over 2000 years ago in order to prove properties of formal arguments! Propositions
More informationCSEN403 Concepts of Programming Languages. Topics: Logic Programming Paradigm: PROLOG Search Tree Recursion Arithmetic
CSEN403 Concepts of Programming Languages Topics: Logic Programming Paradigm: PROLOG Search Tree Recursion Arithmetic Prof. Dr. Slim Abdennadher 8.2.2015 c S. Abdennadher 1 Logic Programming versus Prolog
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 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 informationMathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 9 Normal Forms
Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras Lecture - 9 Normal Forms In the last class we have seen some consequences and some equivalences,
More informationFamily Example: Some Facts. respects(barb,dan). respects(barb,katie). respects(dan,brian). respects(dan,barbara).
Family Example: Some Facts respects(barb,dan). respects(barb,katie). respects(dan,brian). respects(dan,barbara). Some Queries?- respects(barb,katie). yes?- respects(barb,x). X=dan; % you type ; and RETURN
More informationLogic: TD as search, Datalog (variables)
Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from Chpt 12) June, 8, 2017 CPSC 322, Lecture 23 Slide 1 Lecture Overview Recap Top
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 information2SAT Andreas Klappenecker
2SAT Andreas Klappenecker The Problem Can we make the following boolean formula true? ( x y) ( y z) (z y)! Terminology A boolean variable is a variable that can be assigned the values true (T) or false
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 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 informationLogic Programming and Resolution Lecture notes for INF3170/4171
Logic Programming and Resolution Lecture notes for INF3170/4171 Leif Harald Karlsen Autumn 2015 1 Introduction This note will explain the connection between logic and computer programming using Horn Clauses
More informationCSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27
CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 2.1-2.7 p. 1/27 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer
More informationRacklog: Prolog-Style Logic Programming
Racklog: Prolog-Style Logic Programming Version 6.90.0.16 Dorai Sitaram February 27, 2018 (require racklog) package: racklog Racklog is an embedding of Prolog-style logic programming in Racket. Embedding
More informationzebra puzzle continued recap Prolog concepts family relations
zebra puzzle continued recap Prolog concepts family relations 1 recapping the Zebra puzzle 2 ****** the facts ****** There are 5 houses, occupied by politicallyincorrect gentlemen of 5 different nationalities,
More informationQUTE: A PROLOG/LISP TYPE LANGUAGE FOR LOGIC PROGRAMMING
QUTE: A PROLOG/LISP TYPE LANGUAGE FOR LOGIC PROGRAMMING Masahiko Sato Takafumi Sakurai Department of Information Science, Faculty of Science University of Tokyo 7-3-1 Hongo, Bunkyo-ku, Tokyo 113, JAPAN
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 informationLogic Programming: The Prolog Language
Logic Programming: The Prolog Language Stephen A. Edwards Columbia University Fall 2012 Logic All Caltech graduates are nerds. Stephen is a Caltech graduate. Is Stephen a nerd? Logic All Caltech graduates
More informationIntegrity Constraints (Chapter 7.3) Overview. Bottom-Up. Top-Down. Integrity Constraint. Disjunctive & Negative Knowledge. Proof by Refutation
CSE560 Class 10: 1 c P. Heeman, 2010 Integrity Constraints Overview Disjunctive & Negative Knowledge Resolution Rule Bottom-Up Proof by Refutation Top-Down CSE560 Class 10: 2 c P. Heeman, 2010 Integrity
More informationProlog Assessed Exercise
Prolog Assessed Exercise David Eyers 21st April 2009 The purpose of this exercise is to implement in Prolog the Bellman-Ford algorithm for computing singlesource shortest paths
More informationCOP4020 Programming Languages. Logical programming with Prolog Prof. Xin Yuan
COP4020 Programming Languages Logical programming with Prolog Prof. Xin Yuan Topics Logic programming with Prolog COP4020 Spring 2013 2 Definitions: Prolog Terms Terms are symbolic expressions that are
More informationDescription logic reasoning using the PTTP approach
Description logic reasoning using the PTTP approach Zsolt Nagy, Gergely Lukácsy, Péter Szeredi Budapest University of Technology and Economics Department of Computer Science and Information Theory {zsnagy,
More informationOn the BEAM Implementation
On the BEAM Implementation Ricardo Lopes 1,Vítor Santos Costa 2, and Fernando Silva 1 1 DCC-FC and LIACC, Universidade do Porto, Portugal {rslopes,fds}@ncc.up.pt 2 COPPE-Sistemas, Universidade Federal
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 informationExtending Pattern Directed Inference Systems. EECS 344 Winter 2008
Extending Pattern Directed Inference Systems EECS 344 Winter 2008 Extending the basic PDIS model How to increase the convenience of the system How to increase the logical power of the system How to increase
More informationInformation Science 1
Topics covered Information Science 1 Fundamental Programming Constructs (1) Week 11 Terms and concepts from Week 10 Flow of control and conditional statements Selection structures if statement switch statement
More informationQuick n Dirty Prolog Tutorial
CSc 245 Introduction to Discrete Structures Quick n Dirty Prolog Tutorial (McCann) Last Revised: February 2014 Background: Prolog, whose name is from the phrase PROgramming in LOGic, is a special purpose
More information