Principles of Programming Languages Lecture 13: Paradigms: Logic Programming.
|
|
- Austen Philip Garrison
- 5 years ago
- Views:
Transcription
1 Principles of Programming Languages Lecture 13: Paradigms: Logic Programming. Andrei Arusoaie 1 1 Department of Computer Science January 16, 2018
2 Outline Paradigms
3 Outline Paradigms Logic Programming
4 Paradigms Imperative Programming:
5 Paradigms Imperative Programming: Object Oriented Programming:
6 Paradigms Imperative Programming: Object Oriented Programming: Functional Programming:
7 Paradigms Imperative Programming: Object Oriented Programming: Functional Programming: Logic Programming
8 General facts about PLs
9 General facts about PLs We have seen PLs where the computations are based on:
10 General facts about PLs We have seen PLs where the computations are based on: state + modifiable variable + assignment
11 General facts about PLs We have seen PLs where the computations are based on: state + modifiable variable + assignment higher-order + recursion
12 General facts about PLs We have seen PLs where the computations are based on: state + modifiable variable + assignment higher-order + recursion Are there other approaches?
13 General facts about PLs We have seen PLs where the computations are based on: state + modifiable variable + assignment higher-order + recursion Are there other approaches? Yes
14 General facts about PLs We have seen PLs where the computations are based on: state + modifiable variable + assignment higher-order + recursion Are there other approaches? Yes: Logic programming
15 Some background
16 Some background Computation vs. Deduction
17 Some background Computation vs. Deduction Computation: = 10 (using some predefined rules, i.e., n + 0 = 0)
18 Some background Computation vs. Deduction Computation: = 10 (using some predefined rules, i.e., n + 0 = 0) Deduction: requires more than automatic application of rules
19 Some background Computation vs. Deduction Computation: = 10 (using some predefined rules, i.e., n + 0 = 0) Deduction: requires more than automatic application of rules, i.e., needs human ingenuity to complete
20 Some background Computation vs. Deduction Computation: = 10 (using some predefined rules, i.e., n + 0 = 0) Deduction: requires more than automatic application of rules, i.e., needs human ingenuity to complete Example: a 2 + b 2 = c 2
21 Some background Computation vs. Deduction Computation: = 10 (using some predefined rules, i.e., n + 0 = 0) Deduction: requires more than automatic application of rules, i.e., needs human ingenuity to complete Example: a 2 + b 2 = c 2... Pythagoras first proof
22 Some background: FOL
23 Some background: FOL Reminder:
24 Some background: FOL Reminder: Terms: f (t1,..., t n ) where f has arity n, and can contain variables
25 Some background: FOL Reminder: Terms: f (t1,..., t n ) where f has arity n, and can contain variables variables
26 Some background: FOL Reminder: Terms: f (t1,..., t n ) where f has arity n, and can contain variables variables Predicates: p(t 1,..., t n ) where p is a predicate of arity n
27 Some background: FOL Reminder: Terms: f (t1,..., t n ) where f has arity n, and can contain variables variables Predicates: p(t 1,..., t n ) where p is a predicate of arity n Formulas: φ := p(t 1,..., t n ) φ φ φ x.φ
28 Some background
29 Some background Reminder:
30 Some background Reminder: Inference rules: C 1 C 2... C n H RULENAME
31 Some background Reminder: Inference rules: C 1 C 2... C n H RULENAME Examples: nat(0) ZERO nat(n) nat(s(n)) SUCC
32 Some background Reminder: Inference rules: C 1 C 2... C n H RULENAME Examples: nat(0) ZERO even(0) EVEN0 nat(n) nat(s(n)) SUCC even(n) even(s(s(n))) EVENSUCC
33 Proofs Proof that even(s(s(s(s(0)))) holds: even(0) EVEN0 even(s(s(0))) EVENSUCC even(s(s(s(s(0))))) EVENSUCC
34 Proofs Proof that even(s(s(s(s(0)))) holds: even(0) EVEN0 even(s(s(0))) EVENSUCC even(s(s(s(s(0))))) EVENSUCC Proof strategies: goal-directed vs. forward-reasoning
35 Proofs Proof that even(s(s(s(s(0)))) holds: even(0) EVEN0 even(s(s(0))) EVENSUCC even(s(s(s(s(0))))) EVENSUCC Proof strategies: goal-directed vs. forward-reasoning Logic programming uses goal-directed: for the current goal, search the rule that might have been applied to arrive at this conclusion even(0) EVEN0 even(n) even(s(s(n))) EVENSUCC
36 Logic programming: general facts This paradigm is based on formal logic
37 Logic programming: general facts This paradigm is based on formal logic Programs are sets of sentences in the logical form of clauses (referred to as rules):
38 Logic programming: general facts This paradigm is based on formal logic Programs are sets of sentences in the logical form of clauses (referred to as rules): H : C1,..., C 2.
39 Logic programming: general facts This paradigm is based on formal logic Programs are sets of sentences in the logical form of clauses (referred to as rules): H : C1,..., C 2. H is the head of the clause
40 Logic programming: general facts This paradigm is based on formal logic Programs are sets of sentences in the logical form of clauses (referred to as rules): H : C1,..., C 2. H is the head of the clause C 1,..., C 2 is the body
41 Logic programming: general facts This paradigm is based on formal logic Programs are sets of sentences in the logical form of clauses (referred to as rules): H : C1,..., C 2. H is the head of the clause C 1,..., C 2 is the body H. denotes a clause without body, a.k.a. facts
42 Logic programming: general facts This paradigm is based on formal logic Programs are sets of sentences in the logical form of clauses (referred to as rules): H : C1,..., C 2. H is the head of the clause C 1,..., C 2 is the body H. denotes a clause without body, a.k.a. facts Logic programming can be seen as controlled deduction
43 Logic programming: general facts This paradigm is based on formal logic Programs are sets of sentences in the logical form of clauses (referred to as rules): H : C1,..., C 2. H is the head of the clause C 1,..., C 2 is the body H. denotes a clause without body, a.k.a. facts Logic programming can be seen as controlled deduction Logic programming languages (or families of PL): Prolog, ASP (Answer set programming), Datalog
44 Logic programming: how it works Prolog: early 1970, Alain Colmerauer and Robert Kowalski Demo in Prolog: goals. nat(0) ZERO nat(n) nat(s(n)) SUCC
45 Logic programming: how it works Prolog: early 1970, Alain Colmerauer and Robert Kowalski Demo in Prolog: goals. nat(0) ZERO nat(n) nat(s(n)) SUCC even(0) EVEN0 even(n) even(s(s(n))) EVENSUCC Proof search: goal-directed
46 Substitutions σ = {x 3, y y, z f (a, b)} - substitution
47 Substitutions σ = {x 3, y y, z f (a, b)} - substitution Let T 1 = g(h(z, y), x, y) be a term
48 Substitutions σ = {x 3, y y, z f (a, b)} - substitution Let T 1 = g(h(z, y), x, y) be a term Then, σ(t 1 ) = σ(g(h(z, y), x, y)) = g(h(f (a, b), y ), 3, y )).
49 Unification When proving, the conclusion of an inference rule matches the current goal.
50 Unification When proving, the conclusion of an inference rule matches the current goal. How? Unification A substitution σ is the unifier of t 1 and t 2 if σ(t 1 ) = σ(t 2 ). Various algorithms for unification (Robinson,... )
51 Answer substitutions Unification variables in goals, i.e, even(s(s(x)).
52 Answer substitutions Unification variables in goals, i.e, even(s(s(x)). Demo in Prolog: queries. even(0) EVEN0 even(n) even(s(s(n))) EVENSUCC
53 Answer substitutions Unification variables in goals, i.e, even(s(s(x)). Demo in Prolog: queries. even(0) EVEN0 even(n) even(s(s(n))) EVENSUCC Other aspects:
54 Answer substitutions Unification variables in goals, i.e, even(s(s(x)). Demo in Prolog: queries. even(0) EVEN0 even(n) even(s(s(n))) EVENSUCC Other aspects: Backtracking: more than one possible rule applicable
55 Answer substitutions Unification variables in goals, i.e, even(s(s(x)). Demo in Prolog: queries. even(0) EVEN0 even(n) even(s(s(n))) EVENSUCC Other aspects: Backtracking: more than one possible rule applicable Subgoal order: which of the premises to consider?
56 Demo Light meal problem Facts: meat(steak, 10). meat(pork, 12). fish(tuna, 2). fish(trout, 4). starter(salad, 1). starter(soup, 3). desert(fruit, 1). desert(cake, 10). desert(icecream, 4).
57 Demo Light meal problem Main course: main_course(n, K) :- meat(n, K);fish(N, K).
58 Demo Light meal problem Main course: main_course(n, K) :- meat(n, K);fish(N, K). A simple meal: meal(s, M, D) :- starter(s, SK), main_course(m, MK), desert(d, DK).
59 Demo Light meal problem Main course: main_course(n, K) :- meat(n, K);fish(N, K). A simple meal: meal(s, M, D) :- starter(s, SK), main_course(m, MK), desert(d, DK). A light meal: light_meal(s, M, D) :- starter(s, SK), main_course(m, MK), desert(d, DK), SK + MK + DK < 10.
60 Resources Reading material: Chapter/Lecture 1: ~dg/teaching/lis2014/modules/lp-fp-07.pdf
Constraint 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 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 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 informationChapter 2 & 3: Representations & Reasoning Systems (2.2)
Chapter 2 & 3: A Representation & Reasoning System & Using Definite Knowledge Representations & Reasoning Systems (RRS) (2.2) Simplifying Assumptions of the Initial RRS (2.3) Datalog (2.4) Semantics (2.5)
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 Notes on Forward Logic Programming
Lecture Notes on Forward Logic Programming 15-317: Constructive Logic Frank Pfenning Lecture 21 November 15, 2016 1 Introduction In this lecture we return to the view that a logic program is defined by
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 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 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 informationAutomated Reasoning. Natural Deduction in First-Order Logic
Automated Reasoning Natural Deduction in First-Order Logic Jacques Fleuriot Automated Reasoning Lecture 4, page 1 Problem Consider the following problem: Every person has a heart. George Bush is a person.
More informationOverview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.
Overview CS389L: Automated Logical Reasoning Lecture 6: First Order Logic Syntax and Semantics Işıl Dillig So far: Automated reasoning in propositional logic. Propositional logic is simple and easy to
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 informationDATABASE THEORY. Lecture 11: Introduction to Datalog. TU Dresden, 12th June Markus Krötzsch Knowledge-Based Systems
DATABASE THEORY Lecture 11: Introduction to Datalog Markus Krötzsch Knowledge-Based Systems TU Dresden, 12th June 2018 Announcement All lectures and the exercise on 19 June 2018 will be in room APB 1004
More informationIntroduction Prolog Activity! Prolog. Dr. Mattox Beckman. University of Illinois at Urbana-Champaign Department of Computer Science
Prolog Dr. Mattox Beckman University of Illinois at Urbana-Champaign Department of Computer Science Outline Introduction Objectives Logic Prolog Prolog Queries Builtin Structures Activity! Activity Objectives
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 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 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 informationEvolutionary Search in Machine Learning. Lutz Hamel Dept. of Computer Science & Statistics University of Rhode Island
Evolutionary Search in Machine Learning Lutz Hamel Dept. of Computer Science & Statistics University of Rhode Island What is Machine Learning? Programs that get better with experience given some task and
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 informationConcepts of programming languages
Concepts of programming languages Prolog Winand, Roald, Sjoerd, Alexey and Anvar 1 What is logic programming? Logic programming is a type of programming paradigm which is largely based on formal logic.
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 informationImplementation of Lambda-Free Higher-Order Superposition. Petar Vukmirović
Implementation of Lambda-Free Higher-Order Superposition Petar Vukmirović Automatic theorem proving state of the art FOL HOL 2 Automatic theorem proving challenge HOL High-performance higher-order theorem
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 informationProlog. Artificial Intelligence. Lecture 2 Karim Bouzoubaa
Prolog Artificial Intelligence Lecture 2 Karim Bouzoubaa Content Introduction Declarative and logic programming Example Computational model Prolog reasoning Structure of prolog programs Prolog concepts
More informationwill take you everywhere.
Prolog COMP360 Logic will get you from A to B. Imagination will take you everywhere. Albert Einstein Prolog Assignment A programming assignment in Prolog has been posted on Blackboard Upload your.pl file
More informationCom S 541. Programming Languages I
Programming Languages I Lecturer: TA: Markus Lumpe Department of Computer Science 113 Atanasoff Hall http://www.cs.iastate.edu/~lumpe/coms541.html TR 12:40-2, W 5 Pramod Bhanu Rama Rao Office hours: TR
More informationPrinciples of Programming Languages (II)
Principles of Programming Languages (II) Matteo Pradella April 2016 Matteo Pradella Principles of Programming Languages (II) April 2016 1 / 38 1 Logic Programming: Prolog 2 The Prolog Language Matteo Pradella
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 informationChapter 9: Constraint Logic Programming
9. Constraint Logic Programming 9-1 Deductive Databases and Logic Programming (Winter 2007/2008) Chapter 9: Constraint Logic Programming Introduction, Examples Basic Query Evaluation Finite Domain Constraint
More informationHANDBOOK OF LOGIC IN ARTIFICIAL INTELLIGENCE AND LOGIC PROGRAMMING
HANDBOOK OF LOGIC IN ARTIFICIAL INTELLIGENCE AND LOGIC PROGRAMMING Volume 5 Logic Programming Edited by DOV M. GABBAY and C. J. HOGGER Imperial College of Science, Technology and Medicine London and J.
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 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 informationLecture 1: Conjunctive Queries
CS 784: Foundations of Data Management Spring 2017 Instructor: Paris Koutris Lecture 1: Conjunctive Queries A database schema R is a set of relations: we will typically use the symbols R, S, T,... to denote
More informationFrom Hoare Logic to Matching Logic Reachability. Grigore Rosu and Andrei Stefanescu University of Illinois, USA
From Hoare Logic to Matching Logic Reachability Grigore Rosu and Andrei Stefanescu University of Illinois, USA Matching Logic Reachability - Goal - Language independent program verification framework Derives
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 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 informationACSC300: Logic Programming
ACSC300: Logic Programming Lecture 1: Introduction to Logic Programming and Prolog Harris Papadopoulos Course Aims This course aims to help you to: Understand a radically different programming paradigm:
More informationLogic Programming II & Revision
Logic Programming II & Revision Gerardo Schneider Department of Informatics University of Oslo 1 Some corrections (1) hsiblings(x,y) :- child(x,parent), child(y,parent), X \== Y, child(x,parent1), child(y,parent2),
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 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 informationThe semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers.
Semantics The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers. The semantics of a programming language assigns a precise
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 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 informationArtificial Intelligence. Chapters Reviews. Readings: Chapters 3-8 of Russell & Norvig.
Artificial Intelligence Chapters Reviews Readings: Chapters 3-8 of Russell & Norvig. Topics covered in the midterm Solving problems by searching (Chap. 3) How to formulate a search problem? How to measure
More informationLecture Notes on Prolog
Lecture Notes on Prolog 15-317: Constructive Logic Frank Pfenning Lecture 14 October 27, 2015 In this lecture we introduce some simple data structures such as lists, and simple algorithms on them such
More informationDescription Logics Reasoning Algorithms Concluding Remarks References. DL Reasoning. Stasinos Konstantopoulos. IIT, NCSR Demokritos
Stasinos Konstantopoulos 10-3-2006 Overview Description Logics Definitions Some Family Members Reasoning Algorithms Introduction Resolution Calculus Tableau Calculus Concluding Remarks Definitions The
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 informationType Systems COMP 311 Rice University Houston, Texas
Rice University Houston, Texas 1 Type Systems for Programming Language were invented by mathematicians before electronic computers were invented. What is a type? A meaningful subset of the set of the domain
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 informationA Motivational Introduction to Computational Logic and (Constraint) Logic Programming
A Motivational Introduction to Computational Logic and (Constraint) Logic Programming The following people have contributed to this course material: Manuel Hermenegildo (editor), Technical University of
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 informationData Integration: Logic Query Languages
Data Integration: Logic Query Languages Jan Chomicki University at Buffalo Datalog Datalog A logic language Datalog programs consist of logical facts and rules Datalog is a subset of Prolog (no data structures)
More informationBliksem 1.10 User Manual
Bliksem 1.10 User Manual H. de Nivelle January 2, 2003 Abstract Bliksem is a theorem prover that uses resolution with paramodulation. It is written in portable C. The purpose of Bliksem was to develope
More informationProgramming Systems in Artificial Intelligence Introduction
Click to add Text Programming Systems in Artificial Intelligence Introduction Siegfried Nijssen 23/02/16 Discover thediscover world at the Leiden world University at Leiden University Programming Paradigms
More informationLecture 5 - Axiomatic semantics
Program Verification March 2014 Lecture 5 - Axiomatic semantics Lecturer: Noam Rinetzky Scribes by: Nir Hemed 1.1 Axiomatic semantics The development of the theory is contributed to Robert Floyd, C.A.R
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 informationDefining Datalog in Rewriting Logic
M. A. Feliú Universidad Politécnica de Valencia, DSIC / ELP Joint work with María Alpuente, Christophe Joubert and A. Villanueva Coimbra, September 2009 Motivation Recent interest in defining complex interprocedural
More informationFormal Predicate Calculus. Michael Meyling
Formal Predicate Calculus Michael Meyling May 24, 2013 2 The source for this document can be found here: http://www.qedeq.org/0_04_07/doc/math/qedeq_formal_logic_v1.xml Copyright by the authors. All rights
More informationLecture Notes on Prolog
Lecture Notes on Prolog 15-317: Constructive Logic Frank Pfenning Lecture 14 October 15, 2009 In this lecture we introduce some simple data structures such as lists, and simple algorithms on them such
More informationMap coloring example
Map coloring example A B C D E F Database for map coloring coloring(a,b,c,d,e,f) :- different(a,b), different(a,c), different(a,d), different(a,f), different(b,c), different(b,e), different(c,d), different(c,e),
More informationSolutions to Exercises
TDDC36 (LOGIC): EXAM Solutions to Exercises EXERCISE 1 1. Prove the following propositional formula: [ ( P Q) (P Q) R ] [ Q R ] (a) (2 points) using tableaux (b) (2 points) using Gentzen system (as provided
More informationcomparing Lisp and Prolog
comparing Lisp and Prolog Yves Lespérance Adapted from Peter Roosen-Runge 1 exam 1/3 Lisp, 2/3 Prolog; concepts, definitions, comparisons; small programming "fragments" testing mainly 'reading knowledge'
More informationThis lecture covers: Prolog s execution strategy explained more precisely. Revision of the elementary Prolog data types
This lecture covers: Prolog s execution strategy explained more precisely The execution strategy has been presented as simply placing all matching clauses onto the stack. In fact, Prolog is slightly more
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 informationOverview. A Compact Introduction to Isabelle/HOL. Tobias Nipkow. System Architecture. Overview of Isabelle/HOL
Overview A Compact Introduction to Isabelle/HOL Tobias Nipkow TU München 1. Introduction 2. Datatypes 3. Logic 4. Sets p.1 p.2 System Architecture Overview of Isabelle/HOL ProofGeneral Isabelle/HOL Isabelle
More informationIntroduction to Functional Programming in Haskell 1 / 56
Introduction to Functional Programming in Haskell 1 / 56 Outline Why learn functional programming? The essence of functional programming What is a function? Equational reasoning First-order vs. higher-order
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 informationTowards a Logical Reconstruction of Relational Database Theory
Towards a Logical Reconstruction of Relational Database Theory On Conceptual Modelling, Lecture Notes in Computer Science. 1984 Raymond Reiter Summary by C. Rey November 27, 2008-1 / 63 Foreword DB: 2
More informationProving Theorems with Athena
Proving Theorems with Athena David R. Musser Aytekin Vargun August 28, 2003, revised January 26, 2005 Contents 1 Introduction 1 2 Proofs about order relations 2 3 Proofs about natural numbers 7 3.1 Term
More informationEfficient Two-Phase Data Reasoning for Description Logics
Efficient Two-Phase Data Reasoning for Description Logics Abstract Description Logics are used more and more frequently for knowledge representation, creating an increasing demand for efficient automated
More informationWan Hussain Wan Ishak
September 1 st Session 2014/2015 (A141) Wan Hussain Wan Ishak School of Computing UUM College of Arts and Sciences Universiti Utara Malaysia (P) 04-9285150 (E) hussain@uum.edu.my (U) http://wanhussain.com
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 informationAutomatic Reasoning (Section 8.3)
Automatic Reasoning (Section 8.3) Automatic Reasoning Can reasoning be automated? Yes, for some logics, including first-order logic. We could try to automate natural deduction, but there are many proof
More informationCS590U Access Control: Theory and Practice. Lecture 18 (March 10) SDSI Semantics & The RT Family of Role-based Trust-management Languages
CS590U Access Control: Theory and Practice Lecture 18 (March 10) SDSI Semantics & The RT Family of Role-based Trust-management Languages Understanding SPKI/SDSI Using First-Order Logic Ninghui Li and John
More informationProlog Cut: Summary. CSC324 Logic & Relational Programming Illustrated in Prolog. Prolog Cut: Summary. Non-deterministic Programming
Prolog Cut: Summary CSC324 Logic & Relational Programming Illustrated in Prolog Afsaneh Fazly Cut (! ) can be used to: remove duplicate (& unnecessary) responses. remove incorrect responses. improve efficiency
More informationFunctional Programming
The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@ifi.uio.no Department of informatics University of Oslo, Norway Motivation ML Demo Which programming languages are functional?
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 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 informationX-KIF New Knowledge Modeling Language
Proceedings of I-MEDIA 07 and I-SEMANTICS 07 Graz, Austria, September 5-7, 2007 X-KIF New Knowledge Modeling Language Michal Ševčenko (Czech Technical University in Prague sevcenko@vc.cvut.cz) Abstract:
More informationType Inference Systems. Type Judgments. Deriving a Type Judgment. Deriving a Judgment. Hypothetical Type Judgments CS412/CS413
Type Inference Systems CS412/CS413 Introduction to Compilers Tim Teitelbaum Type inference systems define types for all legal programs in a language Type inference systems are to type-checking: As regular
More informationTHE DEVELOPMENT OF PARALLEL RESOLUTION ALGORITHMS USING THE GRAPH REPRESENTATION. Andrey Averin, Vadim Vagin
International Journal "Information Theories & Applications" Vol.13 263 THE DEVELOPMENT OF PARALLEL RESOLUTION ALGORITHMS USING THE GRAPH REPRESENTATION Andrey Averin, Vadim Vagin Abstract. The parallel
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 informationCOMP2411 Lecture 20: Logic Programming Examples. (This material not in the book)
COMP2411 Lecture 20: Logic Programming Examples (This material not in the book) There are several distinct but often equivalent ways to think about logic programs 1. As computing logical consequences of
More informationPropositional Resolution Part 3. Short Review Professor Anita Wasilewska CSE 352 Artificial Intelligence
Propositional Resolution Part 3 Short Review Professor Anita Wasilewska CSE 352 Artificial Intelligence Resolution Strategies We present here some Deletion Strategies and discuss their Completeness. Deletion
More informationFirst Order Predicate Logic CIS 32
First Order Predicate Logic CIS 32 Functionalia Demos? HW 3 is out on the web-page. Today: Predicate Logic Constructing the Logical Agent Predicate Logic First-order predicate logic More expressive than
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 informationAn Experimental CLP Platform for Integrity Constraints and Abduction
An Experimental CLP Platform for Integrity Constraints and Abduction Slim Abdennadher and Henning Christiansen Computer Science Department, University of Munich Oettingenstr. 67, 80538 München, Germany
More informationλ calculus is inconsistent
Content Rough timeline COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Gerwin Klein, June Andronick, Toby Murray λ Intro & motivation, getting started [1] Foundations & Principles
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 informationContext-Free Grammars
Department of Linguistics Ohio State University Syntax 2 (Linguistics 602.02) January 3, 2012 (CFGs) A CFG is an ordered quadruple T, N, D, P where a. T is a finite set called the terminals; b. N is a
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 informationInternational Journal on Artificial Intelligence Tools Mode Analysis During Program Development
International Journal on Artificial Intelligence Tools Mode Analysis During Program Development --Manuscript Draft-- Manuscript Number: Full Title: Article Type: Keywords: Corresponding Author: IJAIT-D-13-00094R4
More informationPrinciples of Programming Languages
Principles of Programming Languages Lesson Collaboration 22 An Introduction and Management to Logic Programming Dana Fisman Logic Programming ( Pure Prolog ) www.cs.bgu.ac.il/~ppl172 1 Review of Last Lecture
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 informationInf2D 12: Resolution-Based Inference
School of Informatics, University of Edinburgh 09/02/18 Slide Credits: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann Last time Unification: Given α and β, find θ such that αθ = βθ Most general unifier
More informationCS 381: Programming Language Fundamentals
CS 381: Programming Language Fundamentals Summer 2017 Introduction to Logic Programming in Prolog Aug 2, 2017 Outline Programming paradigms Logic programming basics Introduction to Prolog Predicates, queries
More informationLambda Calculi With Polymorphism
Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn
More informationLogic Programming: Lecture 1
Logic Programming: Lecture 1 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in PLC, 3 April 2017 Logic programming Programming with relations Variables Names starting with a capital letter
More informationUnification Algorithms
King s College London December 2007 Motivations Unification algorithms have become popular in recent years, due to their key role in the fields of logic programming and theorem proving. Logic Programming
More information