Logic Programming Languages

Slides:



Advertisements
Similar presentations
CS4026 Formal Models of Computation Part II The Logic Model Lecture 1 – Programming in Logic.
Advertisements

First-Order Logic.
Chapter 11 :: Logic Languages
1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In.
Logic Use mathematical deduction to derive new knowledge.
Propositional Calculus A propositional calculus formula is composed of atomic propositions, which area simply statements that are either true or false.
CSE 452: Programming Languages
Logic Programming Languages. Objective To introduce the concepts of logic programming and logic programming languages To introduce a brief description.
1 COMP 144 Programming Language Concepts Felix Hernandez-Campos Lecture 26: Introduction to Logic Programming with Prolog COMP 144 Programming Language.
CSE 452: Programming Languages
ISBN Chapter 16 Logic Programming Languages.
Logic Programming Languages
CPS 506 Comparative Programming Languages
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Chapter 16 Logic Programming Languages. Copyright © 2012 Addison-Wesley. All rights reserved.1-2 Chapter 16 Topics Introduction A Brief Introduction to.
1-1 Introduction Logic programming languages, sometimes called declarative programming languages Express programs in a form of symbolic logic Use a logical.
Declarative vs Procedural Programming  Procedural programming requires that – the programmer tell the computer what to do. That is, how to get the output.
1 COSC3306: Programming Paradigms Lecture 8: Declarative Programming Specifications Haibin Zhu, Ph.D. Computer Science Nipissing University (C) 2003.
Introduction to Prolog Asst. Prof. Dr. Senem Kumova Metin Revised lecture notes of “Concepts of Programmig Languages, Robert W. Sebesta, Ch. 16”
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
CHAPTER 15 & 16 Functional & Logic Programming Languages.
Programming Languages Tucker and Noonan – 2e Chapter 15 – Part 1 Logic Programming “Q: How many legs does a dog have if you call its tail a leg? A: Four.
1 Logic Programming Foundations; Prolog In Text: Chapter 15.
Dr. Muhammed Al-Mulhem ICS An Introduction to Logical Programming.
Logic Programming Languages Session 13 Course : T Programming Language Concept Year : February 2011.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
Prolog Harry R. Erwin, PhD COMM2M University of Sunderland.
C. Varela1 Logic Programming (PLP 11) Predicate Calculus, Horn Clauses, Clocksin-Mellish Procedure Carlos Varela Rennselaer Polytechnic Institute November.
Artificial Intelligence “Introduction to Formal Logic” Jennifer J. Burg Department of Mathematics and Computer Science.
Propositional Logic Predicate Logic
Logic Programming Tarik Booker. What will we cover?  Introduction  Definitions  Predicate Calculus  Prolog  Applications.
ISBN Chapter 16 Logic Programming Languages.
1-1 An Introduction to Logical Programming Sept
Artificial Intelligence CIS 342 The College of Saint Rose David Goldschmidt, Ph.D.
Introduction to Prolog Asst. Prof. Dr. Senem Kumova Metin Revised lecture notes of “Concepts of Programmig Languages, Robert W. Sebesta, Ch. 16”
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
Artificial Intelligence Logical Agents Chapter 7.
Logic Programming Languages
By P. S. Suryateja Asst. Professor, CSE Vishnu Institute of Technology
Chapter 7. Propositional and Predicate Logic
Logic Programming Languages
CSNB 143 Discrete Mathematical Structures
Knowledge Representation and Reasoning
CS 3304 Comparative Languages
Proposition & Predicates
Knowledge Representation
Logic Programming Foundations; Prolog
Horn Clauses and Unification
Logic Programming Languages
Logic Use mathematical deduction to derive new knowledge.
Chapter 11 :: Logic Languages
Carlos Varela Rensselaer Polytechnic Institute November 10, 2017
(1.4) An Introduction to Logic
Horn Clauses and Unification
Horn Clauses and Unification
Back to “Serious” Topics…
Horn Clauses and Unification
Logic Programming Language
Chapter 7. Propositional and Predicate Logic
CSNB234 ARTIFICIAL INTELLIGENCE
Horn Clauses and Unification
Predicates and Quantifiers
CS2136: Paradigms of Computation
Logic Programming & Prolog
Chapter 2: Prolog (Introduction and Basic Concepts)
UNIT-V Logic Programming Languages & Functional Programming Languages
Representations & Reasoning Systems (RRS) (2.2)
Carlos Varela Rennselaer Polytechnic Institute August 30, 2007
Habib Ullah qamar Mscs(se)
Presentation transcript:

Logic Programming Languages

Objective To introduce the concepts of logic programming and logic programming languages To introduce a brief description of a subset of prolog

Introduction Logic programs are declarative programs Programming Language Symbolic logic Logic programs are declarative programs Specify the desired results - true State the fact Logical Inferencing Process Result

Introduction The major difference between logic programming and other programming languages (imperative and functional) Every data item that exist in logic programming has written in specific representation (symbolic logic) Prolog is a logic programming that widely used logic language

Introduction Prolog specified the way of computer carries out the computation and it is divided to 3 parts: logical declarative semantic of prolog new fact prolog can infer from the given fact explicit control information supplied by the programmer

Symbolic representation: Predicate Calculus Logic Formalism Proposition Higher-order PL FOPL mathematical representation of formal logic is a particular form of symbolic logic that is used for logic programming

Symbolic representation: Predicate Calculus Logic Formalism Proposition Higher-order PL FOPL symbolic logic used for the three basic need of formal logic to express propositions to express the relationships between propositions to describe how new propositions can be inferred from other propositions that are assumed to be true

Symbolic representation: Predicate Calculus Logic Formalism Proposition Higher-order PL FOPL Formal logic was developed to provide a method for describing proposition.

Symbolic representation: Predicate Calculus Logic Formalism Proposition Higher-order PL FOPL Proposition is a logical statement also known as fact consist of object and relationships of object to each other

Proposition Object: Constant represents an object, or Variable represent different objects at different times Simple proposition called as atomic propositions, consist of compound terms – one element of mathematic relation which written in a form that has the appearance of mathematical function notation. Example (constants): single parameter (1-tuple): man(jake) double parameter (2-tuples): like(bob,steak)

Proposition Object: Constant represents an object, or Variable represent different objects at different times Simple proposition called as atomic propositions, consist of compound terms – one element of mathematic relation Example: single parameter (1-tuple): man(jake) double parameter (2-tuples): like(bob,steak) functor shows the names the relation

Proposition Object: Constant represents an object, or Variable represent different objects at different times Simple proposition called as atomic propositions, consist of compound terms – one element of mathematic relation Example: single parameter (1-tuple): man(jake) double parameter (2-tuples): like(bob,steak) list of parameter

Proposition Two modes for proposition: proposition defined to be true (fact), and the truth of the proposition is something that is to be determined (queries) Compound propositions have two or more atomic proposition, which are connected by logical operator (is the same way logic expression in imperative languages)

Logic operators Name Symbol Example Meaning negation ¬ ¬ a not a conjunction  a  b a and b disjunction  a  b a or b equivalence  a  b a is equivalent to b implication  a  b a implies b  a  b b implies a

Compound propositions Example: a  b  c a  b  d (a  (b))  d Precedence:       higher lower

Variables in Proposition Variable known as quantifiers Predicate calculus includes two quanifiers, X – variable, and P – proposition Name Example Meaning universal X,P For all X, P is true existential X,P There exists a value of X such that P is true

Variables in Proposition Example X.(woman(X)  human(X)) X.(mother(mary,X)  male(X))

Variables in Proposition Example X.(woman(X)  human(X))  for any value of X, if X is a woman, then X is a human (NL: woman is a human) X.(mother(mary,X)  male(X))

Variables in Proposition Example X.(woman(X)  human(X))  for any value of X, if X is a woman, then X is a human (NL: woman is a human) X.(mother(mary,X)  male(X))  there exist a value of X such that mary is the mother of X and X is a male (NL: mary has a son)

Clausal Form Simple form of proposition, it is a standard form for proposition without loss of generality Why we need to transform PC into CF? too many different ways of stating propositions that have the same meaning Example: X.(woman(X)  human(X)) X.(man(X)  human(X))

Clausal Form General syntax for CF B1  B2  …  Bn  A1  A2  …  Am  if all the As are true, then at least one B is true Example: human(X)  woman(X)  man(X) likes(bob, trout)  likes(bob, fish)  fish(trout)

Clausal Form Example: likes(bob, trout)  likes(bob, fish)  fish(trout) Characteristics of CF: Existential quantifiers are not required Universal quantifiers are implicit in the use of variables in the atomic propositions No operator other than conjunction and disjunction are required consequent antecedent

Clausal Form Example: likes(bob, trout)  likes(bob, fish)  fish(trout)  if bob likes fish and trout is a fish, then bob likes trout 

Clausal Form Example: father(louis, al)  father(louis, violet)  father(al,bob)  mother(violet, bob)  grandfather(louis, bob)  if al is bob’s father and violet is bob’s mother and louis is bob’s grandfather, louis is either al’s father or violet’s father

Proving Theorems Method to inferred the collection of proposition use a collections of proposition to determine whether any interesting or useful fact can be inferred from them Introduced by Alan Robinson (1965)

Proving Theorems Alan Robinson introduced resolution in automatic theorem proving resolution is an inference rule that allows inferred proposition to be computed from given propositions resolution was devised to be applied to propositions in clausal form

Proving Theorems Idea of resolution: P1  P2 and Q1  Q2 which given P1 is identical to Q2  Q1  P2

Proving Theorems Example: older(joanne, jake)  mother(joanne, jake) wiser(joanne, jake)  older(joanne, jake)  wiser(joanne, jake)  mother(joanne, jake)

Proving Theorems Example: father(bob, jake)  mother(bob, jake)  parent(bob, jake) gfather(bob, fred)  father(bob, jake)  father(jake, fred) gfather(bob, fred)  mother(bob, jake)  parent(bob, jake)  father(jake, fred)

Proving Theorems Process of determining useful values for variables during resolution – unification Unification Hypotheses : original propositions Goal: presented in negation of the theorem Proposition in unification must be presented in Horn Clauses

Proving Theorems Horn Clauses: Headed Horn Clauses Example: likes(bob, trout)  likes(bob, fish)  fish(trout) Headless Horn Clauses father(bob, jake)

Applications of Symbolic Computation Relational databases Mathematical logic Abstract problem solving Understanding natural language Design automation Symbolic equation solving Biochemical structure analysis Many areas of artificial intelligent