SlideShare a Scribd company logo
1 of 17
ADITYA ENGINEERING COLLEGE (A)
Logic Programming
By
R S S RAJU BATTULA
Asst.Prof
Dept of Computer Science and Engineering
Aditya Engineering College(A)
Surampalem.
Aditya Engineering College (A)
Principles of Programming Languages
• Predicate calculus
• Predicate calculus for proving Theorems
• Origins of Prolog
• Basic Elements of Prolog
• Deficiencies of Prolog
• Programming with Prolog
• Applications of Logic Programming
• Multi Paradigm Programming
Thursday, May 21, 2020R S S RAJU BATTULA
Logic Programming Contents
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Introduction: (Logic Programming)
Programming uses the symbolic form is called as Logic Programming. It is
also called as declarative language.
The syntax of logic programming is different from imperative and functional
languages.
 The semantics of logic Programming also bears from imperative languages.
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Introduction to Predicate calculus:
Particular form of symbolic logic used for logic programming is predicate calculus.
Symbolic logic provides basis for logic programming. predicate calculus contains
Propositions.
Symbolic logic can be used for 3 basic needs
1. To express prepositions.
2. To express relationship between prepositions.
3. Describe how prepositions can create from others.
Particular form of symbolic logic used for logic programming is called “First order
Predicate calculus”.
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Prepositions:
Proposition is logical statement that may or may not be true. It consists of objects and
relationships of objects to each other.
Objects:
Objects in propositions are represented by simple terms: either constants or variables
Constant: a symbol that represents an object
Variable: a symbol that can represent different objects at different times
Different from variables in imperative languages
The simplest form of proposition is called atomic proposition consist of compound
terms. A compound term is one element of a mathematical relation, written in a form
that has the appearance of mathematical function
Compound term composed of two parts
Functor: function symbol that names the relationship
Ordered list of parameters (tuple)
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Eg: man(Jake)  1-tuple
like ( bob, playing)  2-tuple
Propositions are connected by 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  b
a implies b
b implies a
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Quantifiers:
Name Example Meaning
universal x.p For all x, p is true.
Existential x.p There exists value of x, p is
true
Clausal Form:
It is a simple form of preposition.
Format:
B1 U B2 U B3 U……..U Bn A1 n A2 n A3 n…..n An
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Origins of PROLOG: (Programming with Logic)
Invented by : Alain Colmerauer with Philippe Roussel
Year:1972
Associated with: Artificial Intelligence and Computational Linguistics.
Developed and Implemented in: Marseille, France
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Basic Elements of PROLOG:
1. FACT
2. OBJECTS
3. RELATION
4. PREDICATES
5. STRUCTURE OF PROLOG
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU B ATTULA
Facts ,objects and Relations:
Fact: A FACT can be described as symbolic relationship.
Eg: Samyra likes John.
likes(Samyra , John).
Relation Objects
Objects: An object is the name of the element of certain type.
6 types of objects:
1. Char 2. Integer 3. Real 4. String 5. Symbol 6. File
Relation: A relation is a name that defines the way in which a collection of
objects or variables belong together.
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Predicate:
Eg:
car is blue.
is( car, blue).
1. With out a period to a clause is called a predicate.
2. Predicate express relationship.
3. The elements with in the parenthesis are the arguments of predicate, which may
be objects or variables.
4. The word before the parenthesis is the name of the relation.
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Structure of PROLOG:
Domains
//defining objects ,variables
Predicates
//defining a Relationship, Function
Clauses
// defining Facts, Rules
Eg:
Domains
Person1,person2= symbol
Predicates
Likes(person1,person2)
Clauses
Likes(aditya, naina).
Likes(bob, hezal).
Output:
Goal: likes(bob, hezal).
TRUE
Goal: likes(bob, mary).
False
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Variables, Rules and Unification Process:
Variables: unknown quantity.
3 types of variables:
1. Bound (value is initiated to variable )
2. Free (which are not initiated or not defined at a
particular time )
3. Anonymous ( no variable no value)
Eg:
Domains
Disease, Indication =symbol
Predicate
Symptom(Disease, Indication)
Clauses
Symptom (flu, chills).
Symptom (cold, headache).
Symptom (flu, cough).
Goal:
Symptom( cold, indication)
Indication=headache
1 solution
Goal:
Symptom( ----, chill).
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Unification: (Pattern Matching)
The process by which a prolog tries to
match a term against the facts in an
effort to prove a goal is called
unification process.
In short, The process of matching the
items with variables is known as
Unification.
Predicates unify with each other if:
1. They have the same relation name.
2. They have the same number of
arguments.
3. All argument pairs unify with each
other.
Eg:
Domains
City, State=string
Predicate
Address(City, State)
Clauses
Address(“Lass Vegas”, “California”).
Address(“London”, ”Ontario”).
Address (“Egg Harbor”, ”New Jersey”).
Goal:
Address(“London”, ”Ontario”).
TRUE
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Rule:
A Rule is an expression that shows that the
truth of a particular fact is depends upon
one or more facts.
:- operator is called BREAK
Comma: an AND relationship.
Semicolon : an OR relationship.
Eg:
Jenny likes X if X likes Badminton.
Likes(Jenny, X) :- likes(X, Badminton).
Eg:
Domains
City, State=string
Predicate
Address(string , string)
go
Clauses
go:-
Address(City, State).
go.
Address (“Las Vegas”, ”California”).
Address(“London”, ”Ontario”).
Address (“Egg Harbor”, ”New Jersey”).
Goal:
Address(“London”, ”Ontario”).
TRUE
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Deficiencies of PROLOG:
1. Resolution order control:
Prolog always matches dame order, from beginning to end of given goal.
2. The closed world Assumption:
Prolog can prove the given goal is true but can’t prove given goal is false.
3. The Negation Problem:
The logical NOT is not an integral part of Prolog because
A:- B1n B2 n B3 n …. n Bn
if all B’s are true there only A’s will true, vice versa is difficult.
4. Intrinsic Limitations:
it specify the program to do but not to specify how to do.
Aditya Engineering College (A)
Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA
Applications of logic Programming:
1.RDBMS
Tables can be described using structures and relationships given by using RULE.
2. Expert Systems
Most widely used logical Programming in expert systems is APES.
3.Natural Language Processing
Natural Language interface to computer s/w systems such as intelligent databases
and other Knowledge based.

More Related Content

What's hot

Basic database analysis(database)
Basic database analysis(database)Basic database analysis(database)
Basic database analysis(database)welcometofacebook
 
Database Systems - Entity Relationship Modeling (Chapter 4/2)
Database Systems - Entity Relationship Modeling (Chapter 4/2)Database Systems - Entity Relationship Modeling (Chapter 4/2)
Database Systems - Entity Relationship Modeling (Chapter 4/2)Vidyasagar Mundroy
 
ER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSRubal Sagwal
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramShakila Mahjabin
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship modelJafar Nesargi
 
Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Nimrakhan89
 
3 data modeling using the entity-relationship (er) model
3 data modeling using the entity-relationship (er) model3 data modeling using the entity-relationship (er) model
3 data modeling using the entity-relationship (er) modelKumar
 
Equivalence of Logics: the categorical proof theory perspective
Equivalence of Logics: the categorical proof theory perspectiveEquivalence of Logics: the categorical proof theory perspective
Equivalence of Logics: the categorical proof theory perspectiveValeria de Paiva
 

What's hot (20)

Basic database analysis(database)
Basic database analysis(database)Basic database analysis(database)
Basic database analysis(database)
 
Database Systems - Entity Relationship Modeling (Chapter 4/2)
Database Systems - Entity Relationship Modeling (Chapter 4/2)Database Systems - Entity Relationship Modeling (Chapter 4/2)
Database Systems - Entity Relationship Modeling (Chapter 4/2)
 
Entity relationship modelling
Entity relationship modellingEntity relationship modelling
Entity relationship modelling
 
E R model
E R modelE R model
E R model
 
ER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMS
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship model
 
Chapter 8
Chapter 8Chapter 8
Chapter 8
 
E r model
E r modelE r model
E r model
 
Er model
Er modelEr model
Er model
 
Data model and entity relationship
Data model and entity relationshipData model and entity relationship
Data model and entity relationship
 
DBMS UNIT1
DBMS UNIT1DBMS UNIT1
DBMS UNIT1
 
Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..
 
3 data modeling using the entity-relationship (er) model
3 data modeling using the entity-relationship (er) model3 data modeling using the entity-relationship (er) model
3 data modeling using the entity-relationship (er) model
 
DBMS - ER Model
DBMS - ER ModelDBMS - ER Model
DBMS - ER Model
 
Erd chapter 3
Erd chapter 3Erd chapter 3
Erd chapter 3
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Data modeling
Data modelingData modeling
Data modeling
 
Equivalence of Logics: the categorical proof theory perspective
Equivalence of Logics: the categorical proof theory perspectiveEquivalence of Logics: the categorical proof theory perspective
Equivalence of Logics: the categorical proof theory perspective
 
ER MODEL
ER MODELER MODEL
ER MODEL
 

Similar to Prolog ppt

Interactive Analysis of Word Vector Embeddings
Interactive Analysis of Word Vector EmbeddingsInteractive Analysis of Word Vector Embeddings
Interactive Analysis of Word Vector Embeddingsgleicher
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory buildingClarkTony
 
Introduction to Relational Database Management Systems
Introduction to Relational Database Management SystemsIntroduction to Relational Database Management Systems
Introduction to Relational Database Management SystemsAdri Jovin
 
Csr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminskiCsr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminskiCSR2011
 
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)Rai University
 
Mca ii-dbms- u-iii-sql concepts
Mca ii-dbms- u-iii-sql conceptsMca ii-dbms- u-iii-sql concepts
Mca ii-dbms- u-iii-sql conceptsRai University
 
Lec2_Information Integration.ppt
 Lec2_Information Integration.ppt Lec2_Information Integration.ppt
Lec2_Information Integration.pptNaglaaFathy42
 
Mapping Domain Names to Categories
Mapping Domain Names to CategoriesMapping Domain Names to Categories
Mapping Domain Names to CategoriesGene Chuang
 
EARL: Joint Entity and Relation Linking for Question Answering over Knowledge...
EARL: Joint Entity and Relation Linking for Question Answering over Knowledge...EARL: Joint Entity and Relation Linking for Question Answering over Knowledge...
EARL: Joint Entity and Relation Linking for Question Answering over Knowledge...Holistic Benchmarking of Big Linked Data
 
Latent Relational Model for Relation Extraction
Latent Relational Model for Relation ExtractionLatent Relational Model for Relation Extraction
Latent Relational Model for Relation ExtractionGaetano Rossiello, PhD
 
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdf
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdfLecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdf
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdfssuserf86fba
 
2022-10, UCL NLP meetup, Toward a Better Understanding of Relational Knowledg...
2022-10, UCL NLP meetup, Toward a Better Understanding of Relational Knowledg...2022-10, UCL NLP meetup, Toward a Better Understanding of Relational Knowledg...
2022-10, UCL NLP meetup, Toward a Better Understanding of Relational Knowledg...asahiushio1
 
A Statistical and Schema Independent Approach to Identify Equivalent Properti...
A Statistical and Schema Independent Approach to Identify Equivalent Properti...A Statistical and Schema Independent Approach to Identify Equivalent Properti...
A Statistical and Schema Independent Approach to Identify Equivalent Properti...Kalpa Gunaratna
 

Similar to Prolog ppt (20)

Interactive Analysis of Word Vector Embeddings
Interactive Analysis of Word Vector EmbeddingsInteractive Analysis of Word Vector Embeddings
Interactive Analysis of Word Vector Embeddings
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory building
 
Introduction to Relational Database Management Systems
Introduction to Relational Database Management SystemsIntroduction to Relational Database Management Systems
Introduction to Relational Database Management Systems
 
Ra Revision
Ra RevisionRa Revision
Ra Revision
 
Csr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminskiCsr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminski
 
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
 
Mca ii-dbms- u-iii-sql concepts
Mca ii-dbms- u-iii-sql conceptsMca ii-dbms- u-iii-sql concepts
Mca ii-dbms- u-iii-sql concepts
 
Lec2_Information Integration.ppt
 Lec2_Information Integration.ppt Lec2_Information Integration.ppt
Lec2_Information Integration.ppt
 
On_Mapping_Relational_Databases_to_RDF_and_SHACL.pdf
On_Mapping_Relational_Databases_to_RDF_and_SHACL.pdfOn_Mapping_Relational_Databases_to_RDF_and_SHACL.pdf
On_Mapping_Relational_Databases_to_RDF_and_SHACL.pdf
 
Relational+algebra (1)
Relational+algebra (1)Relational+algebra (1)
Relational+algebra (1)
 
2 rel-algebra
2 rel-algebra2 rel-algebra
2 rel-algebra
 
AI_Session 21 First order logic.pptx
AI_Session 21 First order logic.pptxAI_Session 21 First order logic.pptx
AI_Session 21 First order logic.pptx
 
Relational Algebra1.pptx
Relational Algebra1.pptxRelational Algebra1.pptx
Relational Algebra1.pptx
 
Mapping Domain Names to Categories
Mapping Domain Names to CategoriesMapping Domain Names to Categories
Mapping Domain Names to Categories
 
3_Relational_Model.pdf
3_Relational_Model.pdf3_Relational_Model.pdf
3_Relational_Model.pdf
 
EARL: Joint Entity and Relation Linking for Question Answering over Knowledge...
EARL: Joint Entity and Relation Linking for Question Answering over Knowledge...EARL: Joint Entity and Relation Linking for Question Answering over Knowledge...
EARL: Joint Entity and Relation Linking for Question Answering over Knowledge...
 
Latent Relational Model for Relation Extraction
Latent Relational Model for Relation ExtractionLatent Relational Model for Relation Extraction
Latent Relational Model for Relation Extraction
 
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdf
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdfLecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdf
Lecture-2-Relational-Algebra-and-SQL-Advanced-DataBase-Theory-MS.pdf
 
2022-10, UCL NLP meetup, Toward a Better Understanding of Relational Knowledg...
2022-10, UCL NLP meetup, Toward a Better Understanding of Relational Knowledg...2022-10, UCL NLP meetup, Toward a Better Understanding of Relational Knowledg...
2022-10, UCL NLP meetup, Toward a Better Understanding of Relational Knowledg...
 
A Statistical and Schema Independent Approach to Identify Equivalent Properti...
A Statistical and Schema Independent Approach to Identify Equivalent Properti...A Statistical and Schema Independent Approach to Identify Equivalent Properti...
A Statistical and Schema Independent Approach to Identify Equivalent Properti...
 

Recently uploaded

PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
Post office management system project ..pdf
Post office management system project ..pdfPost office management system project ..pdf
Post office management system project ..pdfKamal Acharya
 
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSORINTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSORTanishkaHira1
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...HenryBriggs2
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessorAshwiniTodkar4
 
Fundamentals of Internet of Things (IoT) Part-2
Fundamentals of Internet of Things (IoT) Part-2Fundamentals of Internet of Things (IoT) Part-2
Fundamentals of Internet of Things (IoT) Part-2ChandrakantDivate1
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxhublikarsn
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptAfnanAhmad53
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)ChandrakantDivate1
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...ronahami
 
Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...
Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...
Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...dannyijwest
 

Recently uploaded (20)

PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Post office management system project ..pdf
Post office management system project ..pdfPost office management system project ..pdf
Post office management system project ..pdf
 
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSORINTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor
 
Fundamentals of Internet of Things (IoT) Part-2
Fundamentals of Internet of Things (IoT) Part-2Fundamentals of Internet of Things (IoT) Part-2
Fundamentals of Internet of Things (IoT) Part-2
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .ppt
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...
Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...
Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...
 

Prolog ppt

  • 1. ADITYA ENGINEERING COLLEGE (A) Logic Programming By R S S RAJU BATTULA Asst.Prof Dept of Computer Science and Engineering Aditya Engineering College(A) Surampalem.
  • 2. Aditya Engineering College (A) Principles of Programming Languages • Predicate calculus • Predicate calculus for proving Theorems • Origins of Prolog • Basic Elements of Prolog • Deficiencies of Prolog • Programming with Prolog • Applications of Logic Programming • Multi Paradigm Programming Thursday, May 21, 2020R S S RAJU BATTULA Logic Programming Contents
  • 3. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Introduction: (Logic Programming) Programming uses the symbolic form is called as Logic Programming. It is also called as declarative language. The syntax of logic programming is different from imperative and functional languages.  The semantics of logic Programming also bears from imperative languages.
  • 4. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Introduction to Predicate calculus: Particular form of symbolic logic used for logic programming is predicate calculus. Symbolic logic provides basis for logic programming. predicate calculus contains Propositions. Symbolic logic can be used for 3 basic needs 1. To express prepositions. 2. To express relationship between prepositions. 3. Describe how prepositions can create from others. Particular form of symbolic logic used for logic programming is called “First order Predicate calculus”.
  • 5. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Prepositions: Proposition is logical statement that may or may not be true. It consists of objects and relationships of objects to each other. Objects: Objects in propositions are represented by simple terms: either constants or variables Constant: a symbol that represents an object Variable: a symbol that can represent different objects at different times Different from variables in imperative languages The simplest form of proposition is called atomic proposition consist of compound terms. A compound term is one element of a mathematical relation, written in a form that has the appearance of mathematical function Compound term composed of two parts Functor: function symbol that names the relationship Ordered list of parameters (tuple)
  • 6. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Eg: man(Jake)  1-tuple like ( bob, playing)  2-tuple Propositions are connected by 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  b a implies b b implies a
  • 7. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Quantifiers: Name Example Meaning universal x.p For all x, p is true. Existential x.p There exists value of x, p is true Clausal Form: It is a simple form of preposition. Format: B1 U B2 U B3 U……..U Bn A1 n A2 n A3 n…..n An
  • 8. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Origins of PROLOG: (Programming with Logic) Invented by : Alain Colmerauer with Philippe Roussel Year:1972 Associated with: Artificial Intelligence and Computational Linguistics. Developed and Implemented in: Marseille, France
  • 9. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Basic Elements of PROLOG: 1. FACT 2. OBJECTS 3. RELATION 4. PREDICATES 5. STRUCTURE OF PROLOG
  • 10. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU B ATTULA Facts ,objects and Relations: Fact: A FACT can be described as symbolic relationship. Eg: Samyra likes John. likes(Samyra , John). Relation Objects Objects: An object is the name of the element of certain type. 6 types of objects: 1. Char 2. Integer 3. Real 4. String 5. Symbol 6. File Relation: A relation is a name that defines the way in which a collection of objects or variables belong together.
  • 11. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Predicate: Eg: car is blue. is( car, blue). 1. With out a period to a clause is called a predicate. 2. Predicate express relationship. 3. The elements with in the parenthesis are the arguments of predicate, which may be objects or variables. 4. The word before the parenthesis is the name of the relation.
  • 12. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Structure of PROLOG: Domains //defining objects ,variables Predicates //defining a Relationship, Function Clauses // defining Facts, Rules Eg: Domains Person1,person2= symbol Predicates Likes(person1,person2) Clauses Likes(aditya, naina). Likes(bob, hezal). Output: Goal: likes(bob, hezal). TRUE Goal: likes(bob, mary). False
  • 13. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Variables, Rules and Unification Process: Variables: unknown quantity. 3 types of variables: 1. Bound (value is initiated to variable ) 2. Free (which are not initiated or not defined at a particular time ) 3. Anonymous ( no variable no value) Eg: Domains Disease, Indication =symbol Predicate Symptom(Disease, Indication) Clauses Symptom (flu, chills). Symptom (cold, headache). Symptom (flu, cough). Goal: Symptom( cold, indication) Indication=headache 1 solution Goal: Symptom( ----, chill).
  • 14. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Unification: (Pattern Matching) The process by which a prolog tries to match a term against the facts in an effort to prove a goal is called unification process. In short, The process of matching the items with variables is known as Unification. Predicates unify with each other if: 1. They have the same relation name. 2. They have the same number of arguments. 3. All argument pairs unify with each other. Eg: Domains City, State=string Predicate Address(City, State) Clauses Address(“Lass Vegas”, “California”). Address(“London”, ”Ontario”). Address (“Egg Harbor”, ”New Jersey”). Goal: Address(“London”, ”Ontario”). TRUE
  • 15. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Rule: A Rule is an expression that shows that the truth of a particular fact is depends upon one or more facts. :- operator is called BREAK Comma: an AND relationship. Semicolon : an OR relationship. Eg: Jenny likes X if X likes Badminton. Likes(Jenny, X) :- likes(X, Badminton). Eg: Domains City, State=string Predicate Address(string , string) go Clauses go:- Address(City, State). go. Address (“Las Vegas”, ”California”). Address(“London”, ”Ontario”). Address (“Egg Harbor”, ”New Jersey”). Goal: Address(“London”, ”Ontario”). TRUE
  • 16. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Deficiencies of PROLOG: 1. Resolution order control: Prolog always matches dame order, from beginning to end of given goal. 2. The closed world Assumption: Prolog can prove the given goal is true but can’t prove given goal is false. 3. The Negation Problem: The logical NOT is not an integral part of Prolog because A:- B1n B2 n B3 n …. n Bn if all B’s are true there only A’s will true, vice versa is difficult. 4. Intrinsic Limitations: it specify the program to do but not to specify how to do.
  • 17. Aditya Engineering College (A) Principles of Programming Languages Thursday, May 21, 2020R S S RAJU BATTULA Applications of logic Programming: 1.RDBMS Tables can be described using structures and relationships given by using RULE. 2. Expert Systems Most widely used logical Programming in expert systems is APES. 3.Natural Language Processing Natural Language interface to computer s/w systems such as intelligent databases and other Knowledge based.