SlideShare a Scribd company logo
1 of 23
Prolog
The language of logic
History
• Kowalski: late 60’s Logician who showed
logical proof can support computation.
• Colmerauer: early 70’s Developed early
version of Prolog for natural language
processing, mainly multiple parses.
• Warren: mid 70’s First version of Prolog
that was efficient.
Characteristics
• Prolog approximates first-order logic.
• Every program is a set of Horn clauses.
• Inference is by resolution.
• Search is by backtracking with unification.
• Basic data structure is term or tree.
• Variables are unknowns not locations.
• Prolog does not distinguish between inputs
and outputs. It solves relations/predicates.
SWI-Prolog Notes
• Free! Down Loadable
• To load a file:
– consult( ‘C:kiblerprologtest’).
• For help:
– help(predicate-name).
• “ ; “ will give you next solution.
• listing(member) will give definition.
Example
• Facts: ()
– likes(john,mary).
– likes(john,X). % Variables begin with capital
• Queries
– ?- likes(X,Y).
– X=john, y=Mary. % hit “;” for more
– ?- likes(X,X).
– X=john.
Example
• Rules
– likes(john,X) :- likes(X,wine). % :- = if
– likes(john,X):- female(X), likes(X,john).
• Note: variables are dummy. Standarized apart
• Some Facts:
– likes(bill,wine). female(mary). female(sue).
• Query: ? - likes(john,Y).
– Y = bill ;
– no.
• If someone is parent of a person then he/she
is father/mother of him.
• father(sikander, arfa)
• parent(X,Y):-father(X,Y).
• Parent(X,Y):-mother(X.Y).
Family
father(a,b).
father(e,d).
mother(c,b).
mother(d,f).
parent(X,Y) :- father(X,Y).
parent(X,Y) :- mother(X,Y).
grandfather(X,Y):- father(X,Z),parent(Z,Y).
% Do your own for practice.
Informal Summary
• Program is facts + rules. (horn clauses).
• Query = conjunct of predicates.
• First set of bindings for variables that solve
query are reported. If none, then Prolog
returns no.
• Use “;” to get other solutions.
• Can be viewed as constraint satisfaction
program.
MapColoring
• color(r). color(g). color(b).
• colormap(C1,C2,C3):-
color(C1),color(C2),color(C3), C1==C2,
C1==C3, C2==C3.
• Query: colormap(X,Y,Z).
– X = r, Y= g, Z=b.
• Is that it. Yes! Turn on trace.
Unification: (matching) terms
• Two terms UNIFY if there is a common
substitution for all variables which makes them
identical.
• f(g(X),Y) = f(Z,Z). % = cheap unification
– X = _G225, Y=g(_G225).
• Look at parse tree for each term.
– variables match
– variable matches anything (set the binding)
– function symbols only match identical function
symbols.
Satisfiability: uses unification
• sat(true). % base case
• sat(not(false)). % base case
• sat(or(X,Y)):- sat(X).
• sat(or(X,Y)):-sat(Y).
• sat(and(X,Y)):-sat(X),sat(Y).
• test1(X,Y):- sat(and(not(X),X)).
• test2(X,Y):- sat(and(X,not(Y))).
Semantic Network representation
in prolog
Semantic Network representation
in prolog
• nodes represent individuals such as the
canary tweety and classes such as ostrich,
crow, robin, bird, and vertebrate.
• isa links represent the class hierarchy
relationship.
• We adopt canonical forms for the data
relationships within the net.
Semantic Network
Representation
• We use an isa(Type, Parent) predicate to
indicate that Type is a member of Parent
and a hasprop(Object, Property, Value)
predicate to represent property relations.
• hasprop indicates that Object has Property
with Value. Object and Value are nodes in
the network, and Property is the name of the
link that joins them.
isa(canary, bird). hasprop(tweety, color, white)
isa(robin, bird). hasprop(robin, color, red).
isa(ostrich, bird). hasprop(canary, color, yellow).
isa(penguin, bird). hasprop(penguin, color, brown).
isa(bird, animal). hasprop(bird, travel, fly).
isa(fish, animal). hasprop(ostrich, travel, walk).
isa(opus, penguin). hasprop(fish, travel, swim).
isa(tweety, canary). hasprop(robin, sound, sing).
hasprop(canary, sound, sing).
hasprop(bird, cover, feathers). hasprop(animal, cover,
skin).
Semantic Network
Representation
• We create a recursive search algorithm to
find whether an object in our semantic net
has a particular property. Properties are
stored in the net at the most general level at
which they are true. Through inheritance, an
individual or subclass acquires the
properties of its superclasses. Thus the
property fly holds for bird and all its
subclasses.
Semantic Network
Representation
• hasproperty(Object, Property, Value) :-
hasprop(Object, Property, Value).
hasproperty(Object, Property, Value) :-
isa(Object, Parent), hasproperty(Parent,
Property, Value).
Frame Representation
• Semantic nets can be partitioned, with
additional information added to node
descriptions, to give them a frame-like
structure (Minsky 1975, Luger 2009).
• We present the bird example again using
frames, where each frame represents a
collection of relationships of the semantic
net and the isa slots of the frame define the
frame hierarchy as in
Frame Representation
• One way
• frame(name(bird), isa(animal),[travel(flies),
feathers]).
• Other way
• bird(isa,animal).
• bird(fly,wings).
Frame Representation
• Which method will be easy for query?
DFS
% solve(goal, solution Path)
% s(state, successor-state)
dfs(N,[N]) :- goal(N).
dfs(N,[N|Sol1]):- s(N,N1), dfs(N1,Sol1).
s(a,b). s(a,c). s(b,d). s(b,e). s(c,f).
s(c,g). s(d,h). s(e,i). s(e,j). s(f,k).
goal(i). goal(f).
?- dfs(a,N).
N = [a, b, e, i] ;
N = [a, c, f] ;
Limitations
• 2nd order: Can’t ask what is relationship
between heart and lungs?
• Probabilities: What is likelihood of fire
destroying Julian?

More Related Content

What's hot

Prolog Programming Language
Prolog Programming  LanguageProlog Programming  Language
Prolog Programming LanguageReham AlBlehid
 
Text similarity measures
Text similarity measuresText similarity measures
Text similarity measuresankit_ppt
 
Word Embeddings - Introduction
Word Embeddings - IntroductionWord Embeddings - Introduction
Word Embeddings - IntroductionChristian Perone
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)Nitesh Singh
 
Hidden Markov Models with applications to speech recognition
Hidden Markov Models with applications to speech recognitionHidden Markov Models with applications to speech recognition
Hidden Markov Models with applications to speech recognitionbutest
 
NLP, Expert system and pattern recognition
NLP, Expert system and pattern recognitionNLP, Expert system and pattern recognition
NLP, Expert system and pattern recognitionMohammad Ilyas Malik
 
Introduction to Natural Language Processing (NLP)
Introduction to Natural Language Processing (NLP)Introduction to Natural Language Processing (NLP)
Introduction to Natural Language Processing (NLP)VenkateshMurugadas
 
Language Model.pptx
Language Model.pptxLanguage Model.pptx
Language Model.pptxFiras Obeid
 
First order predicate logic (fopl)
First order predicate logic (fopl)First order predicate logic (fopl)
First order predicate logic (fopl)chauhankapil
 

What's hot (20)

Prolog Programming Language
Prolog Programming  LanguageProlog Programming  Language
Prolog Programming Language
 
Text similarity measures
Text similarity measuresText similarity measures
Text similarity measures
 
First order logic
First order logicFirst order logic
First order logic
 
Word Embeddings - Introduction
Word Embeddings - IntroductionWord Embeddings - Introduction
Word Embeddings - Introduction
 
First order logic
First order logicFirst order logic
First order logic
 
First order logic
First order logicFirst order logic
First order logic
 
Graph Planning
Graph PlanningGraph Planning
Graph Planning
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)
 
Hidden Markov Models with applications to speech recognition
Hidden Markov Models with applications to speech recognitionHidden Markov Models with applications to speech recognition
Hidden Markov Models with applications to speech recognition
 
Learning in AI
Learning in AILearning in AI
Learning in AI
 
What is word2vec?
What is word2vec?What is word2vec?
What is word2vec?
 
NLP, Expert system and pattern recognition
NLP, Expert system and pattern recognitionNLP, Expert system and pattern recognition
NLP, Expert system and pattern recognition
 
Introduction to Natural Language Processing (NLP)
Introduction to Natural Language Processing (NLP)Introduction to Natural Language Processing (NLP)
Introduction to Natural Language Processing (NLP)
 
Word2Vec
Word2VecWord2Vec
Word2Vec
 
Ontology engineering
Ontology engineering Ontology engineering
Ontology engineering
 
Word2Vec
Word2VecWord2Vec
Word2Vec
 
Unit8: Uncertainty in AI
Unit8: Uncertainty in AIUnit8: Uncertainty in AI
Unit8: Uncertainty in AI
 
Rule Based System
Rule Based SystemRule Based System
Rule Based System
 
Language Model.pptx
Language Model.pptxLanguage Model.pptx
Language Model.pptx
 
First order predicate logic (fopl)
First order predicate logic (fopl)First order predicate logic (fopl)
First order predicate logic (fopl)
 

Similar to Prolog

10 logic+programming+with+prolog
10 logic+programming+with+prolog10 logic+programming+with+prolog
10 logic+programming+with+prologbaran19901990
 
#8 formal methods – pro logic
#8 formal methods – pro logic#8 formal methods – pro logic
#8 formal methods – pro logicSharif Omar Salem
 
Presentation of GetTogether on Functional Programming
Presentation of GetTogether on Functional ProgrammingPresentation of GetTogether on Functional Programming
Presentation of GetTogether on Functional ProgrammingFilip De Sutter
 
dfgsdfdsgdfgfdgdrgdfgffdhyrthfgnhgjhgdfs.ppt
dfgsdfdsgdfgfdgdrgdfgffdhyrthfgnhgjhgdfs.pptdfgsdfdsgdfgfdgdrgdfgffdhyrthfgnhgjhgdfs.ppt
dfgsdfdsgdfgfdgdrgdfgffdhyrthfgnhgjhgdfs.pptNobitaNobi489694
 
The Logical Burrito - pattern matching, term rewriting and unification
The Logical Burrito - pattern matching, term rewriting and unificationThe Logical Burrito - pattern matching, term rewriting and unification
The Logical Burrito - pattern matching, term rewriting and unificationNorman Richards
 
Basic Knowledge Representation in First Order Logic.ppt
Basic Knowledge Representation in First Order Logic.pptBasic Knowledge Representation in First Order Logic.ppt
Basic Knowledge Representation in First Order Logic.pptAshfaqAhmed693399
 
Artificial intelligence Prolog Language
Artificial intelligence Prolog LanguageArtificial intelligence Prolog Language
Artificial intelligence Prolog LanguageREHMAT ULLAH
 
Cuckoo Search Algorithm: An Introduction
Cuckoo Search Algorithm: An IntroductionCuckoo Search Algorithm: An Introduction
Cuckoo Search Algorithm: An IntroductionXin-She Yang
 
Introduction to Groovy (Serbian Developer Conference 2013)
Introduction to Groovy (Serbian Developer Conference 2013)Introduction to Groovy (Serbian Developer Conference 2013)
Introduction to Groovy (Serbian Developer Conference 2013)Joachim Baumann
 
Tutorial - Introduction to Rule Technologies and Systems
Tutorial - Introduction to Rule Technologies and SystemsTutorial - Introduction to Rule Technologies and Systems
Tutorial - Introduction to Rule Technologies and SystemsAdrian Paschke
 
Challenge@RuleML2015 Datalog+, RuleML and OWL 2 - Formats and Translations f...
Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations f...Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations f...
Challenge@RuleML2015 Datalog+, RuleML and OWL 2 - Formats and Translations f...RuleML
 

Similar to Prolog (20)

10 logic+programming+with+prolog
10 logic+programming+with+prolog10 logic+programming+with+prolog
10 logic+programming+with+prolog
 
Prolog2 (1)
Prolog2 (1)Prolog2 (1)
Prolog2 (1)
 
#8 formal methods – pro logic
#8 formal methods – pro logic#8 formal methods – pro logic
#8 formal methods – pro logic
 
Presentation of GetTogether on Functional Programming
Presentation of GetTogether on Functional ProgrammingPresentation of GetTogether on Functional Programming
Presentation of GetTogether on Functional Programming
 
dfgsdfdsgdfgfdgdrgdfgffdhyrthfgnhgjhgdfs.ppt
dfgsdfdsgdfgfdgdrgdfgffdhyrthfgnhgjhgdfs.pptdfgsdfdsgdfgfdgdrgdfgffdhyrthfgnhgjhgdfs.ppt
dfgsdfdsgdfgfdgdrgdfgffdhyrthfgnhgjhgdfs.ppt
 
Chaps 1-3-ai-prolog
Chaps 1-3-ai-prologChaps 1-3-ai-prolog
Chaps 1-3-ai-prolog
 
The Logical Burrito - pattern matching, term rewriting and unification
The Logical Burrito - pattern matching, term rewriting and unificationThe Logical Burrito - pattern matching, term rewriting and unification
The Logical Burrito - pattern matching, term rewriting and unification
 
Basic Knowledge Representation in First Order Logic.ppt
Basic Knowledge Representation in First Order Logic.pptBasic Knowledge Representation in First Order Logic.ppt
Basic Knowledge Representation in First Order Logic.ppt
 
Artificial intelligence Prolog Language
Artificial intelligence Prolog LanguageArtificial intelligence Prolog Language
Artificial intelligence Prolog Language
 
Cuckoo Search Algorithm: An Introduction
Cuckoo Search Algorithm: An IntroductionCuckoo Search Algorithm: An Introduction
Cuckoo Search Algorithm: An Introduction
 
Knowledge Extraction
Knowledge ExtractionKnowledge Extraction
Knowledge Extraction
 
Introduction to Groovy (Serbian Developer Conference 2013)
Introduction to Groovy (Serbian Developer Conference 2013)Introduction to Groovy (Serbian Developer Conference 2013)
Introduction to Groovy (Serbian Developer Conference 2013)
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Prolog & lisp
Prolog & lispProlog & lisp
Prolog & lisp
 
Logic Programming and ILP
Logic Programming and ILPLogic Programming and ILP
Logic Programming and ILP
 
Bioinformatica p2-p3-introduction
Bioinformatica p2-p3-introductionBioinformatica p2-p3-introduction
Bioinformatica p2-p3-introduction
 
Module_5_1.pptx
Module_5_1.pptxModule_5_1.pptx
Module_5_1.pptx
 
Tutorial - Introduction to Rule Technologies and Systems
Tutorial - Introduction to Rule Technologies and SystemsTutorial - Introduction to Rule Technologies and Systems
Tutorial - Introduction to Rule Technologies and Systems
 
Genetic algorithms
Genetic algorithms Genetic algorithms
Genetic algorithms
 
Challenge@RuleML2015 Datalog+, RuleML and OWL 2 - Formats and Translations f...
Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations f...Challenge@RuleML2015  Datalog+, RuleML and OWL 2 - Formats and Translations f...
Challenge@RuleML2015 Datalog+, RuleML and OWL 2 - Formats and Translations f...
 

Recently uploaded

DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 

Recently uploaded (20)

DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 

Prolog

  • 2. History • Kowalski: late 60’s Logician who showed logical proof can support computation. • Colmerauer: early 70’s Developed early version of Prolog for natural language processing, mainly multiple parses. • Warren: mid 70’s First version of Prolog that was efficient.
  • 3. Characteristics • Prolog approximates first-order logic. • Every program is a set of Horn clauses. • Inference is by resolution. • Search is by backtracking with unification. • Basic data structure is term or tree. • Variables are unknowns not locations. • Prolog does not distinguish between inputs and outputs. It solves relations/predicates.
  • 4. SWI-Prolog Notes • Free! Down Loadable • To load a file: – consult( ‘C:kiblerprologtest’). • For help: – help(predicate-name). • “ ; “ will give you next solution. • listing(member) will give definition.
  • 5. Example • Facts: () – likes(john,mary). – likes(john,X). % Variables begin with capital • Queries – ?- likes(X,Y). – X=john, y=Mary. % hit “;” for more – ?- likes(X,X). – X=john.
  • 6. Example • Rules – likes(john,X) :- likes(X,wine). % :- = if – likes(john,X):- female(X), likes(X,john). • Note: variables are dummy. Standarized apart • Some Facts: – likes(bill,wine). female(mary). female(sue). • Query: ? - likes(john,Y). – Y = bill ; – no.
  • 7. • If someone is parent of a person then he/she is father/mother of him. • father(sikander, arfa) • parent(X,Y):-father(X,Y). • Parent(X,Y):-mother(X.Y).
  • 8. Family father(a,b). father(e,d). mother(c,b). mother(d,f). parent(X,Y) :- father(X,Y). parent(X,Y) :- mother(X,Y). grandfather(X,Y):- father(X,Z),parent(Z,Y). % Do your own for practice.
  • 9. Informal Summary • Program is facts + rules. (horn clauses). • Query = conjunct of predicates. • First set of bindings for variables that solve query are reported. If none, then Prolog returns no. • Use “;” to get other solutions. • Can be viewed as constraint satisfaction program.
  • 10. MapColoring • color(r). color(g). color(b). • colormap(C1,C2,C3):- color(C1),color(C2),color(C3), C1==C2, C1==C3, C2==C3. • Query: colormap(X,Y,Z). – X = r, Y= g, Z=b. • Is that it. Yes! Turn on trace.
  • 11. Unification: (matching) terms • Two terms UNIFY if there is a common substitution for all variables which makes them identical. • f(g(X),Y) = f(Z,Z). % = cheap unification – X = _G225, Y=g(_G225). • Look at parse tree for each term. – variables match – variable matches anything (set the binding) – function symbols only match identical function symbols.
  • 12. Satisfiability: uses unification • sat(true). % base case • sat(not(false)). % base case • sat(or(X,Y)):- sat(X). • sat(or(X,Y)):-sat(Y). • sat(and(X,Y)):-sat(X),sat(Y). • test1(X,Y):- sat(and(not(X),X)). • test2(X,Y):- sat(and(X,not(Y))).
  • 14. Semantic Network representation in prolog • nodes represent individuals such as the canary tweety and classes such as ostrich, crow, robin, bird, and vertebrate. • isa links represent the class hierarchy relationship. • We adopt canonical forms for the data relationships within the net.
  • 15. Semantic Network Representation • We use an isa(Type, Parent) predicate to indicate that Type is a member of Parent and a hasprop(Object, Property, Value) predicate to represent property relations. • hasprop indicates that Object has Property with Value. Object and Value are nodes in the network, and Property is the name of the link that joins them.
  • 16. isa(canary, bird). hasprop(tweety, color, white) isa(robin, bird). hasprop(robin, color, red). isa(ostrich, bird). hasprop(canary, color, yellow). isa(penguin, bird). hasprop(penguin, color, brown). isa(bird, animal). hasprop(bird, travel, fly). isa(fish, animal). hasprop(ostrich, travel, walk). isa(opus, penguin). hasprop(fish, travel, swim). isa(tweety, canary). hasprop(robin, sound, sing). hasprop(canary, sound, sing). hasprop(bird, cover, feathers). hasprop(animal, cover, skin).
  • 17. Semantic Network Representation • We create a recursive search algorithm to find whether an object in our semantic net has a particular property. Properties are stored in the net at the most general level at which they are true. Through inheritance, an individual or subclass acquires the properties of its superclasses. Thus the property fly holds for bird and all its subclasses.
  • 18. Semantic Network Representation • hasproperty(Object, Property, Value) :- hasprop(Object, Property, Value). hasproperty(Object, Property, Value) :- isa(Object, Parent), hasproperty(Parent, Property, Value).
  • 19. Frame Representation • Semantic nets can be partitioned, with additional information added to node descriptions, to give them a frame-like structure (Minsky 1975, Luger 2009). • We present the bird example again using frames, where each frame represents a collection of relationships of the semantic net and the isa slots of the frame define the frame hierarchy as in
  • 20. Frame Representation • One way • frame(name(bird), isa(animal),[travel(flies), feathers]). • Other way • bird(isa,animal). • bird(fly,wings).
  • 21. Frame Representation • Which method will be easy for query?
  • 22. DFS % solve(goal, solution Path) % s(state, successor-state) dfs(N,[N]) :- goal(N). dfs(N,[N|Sol1]):- s(N,N1), dfs(N1,Sol1). s(a,b). s(a,c). s(b,d). s(b,e). s(c,f). s(c,g). s(d,h). s(e,i). s(e,j). s(f,k). goal(i). goal(f). ?- dfs(a,N). N = [a, b, e, i] ; N = [a, c, f] ;
  • 23. Limitations • 2nd order: Can’t ask what is relationship between heart and lungs? • Probabilities: What is likelihood of fire destroying Julian?