SlideShare a Scribd company logo
1 of 12
Download to read offline
Formal Logic




        Mathematical Structures
         for Computer Science
                Chapter 1	





Copyright © 2006 W.H. Freeman & Co.       MSCS Slides   Formal Logic
Declarative Programming Languages

     ●        A declarative language is based on predicate logic.	

     ●        A program written in a declarative language consists
              only of statements (actually predicate wffs) that are
              declared as hypotheses.	

     ●        Execution of a declarative program allows the user to
              pose queries, asking for information about possible
              conclusions that can be derived from the hypotheses.	

     ●        After obtaining the user’s query, the language turns on
              its “inference engine” and applies its rules of inference
              to the hypotheses to see which conclusions fit the
              user’s query.	




Section 1.5                            Logic Programming                  1
Prolog
     ●        Prolog (PROgramming in LOGic) is a declarative
              programming language.	

     ●        The set of declarations that constitutes a Prolog program is
              also known as a Prolog database.	

     ●        Items in a Prolog database are either facts or rules.	

     ●        Example of Prolog facts (a binary predicate called “eat”):	

              ■  eat (bear, fish)	

              ■  eat (bear, fox)	

              ■  eat (deer, grass)	

     ●        “bear,” “fish,” “fox,” “deer,” and “grass” are constants
              because they represent specific elements in the domain.	




Section 1.5                              Logic Programming                    2
Prolog

     ●        Other facts that we could add to the Prolog database:	

              ■    animal (bear)	

              ■    animal (fish)	

              ■    animal (fox)	

              ■    animal (deer)	

              ■    plant (grass)	

     ●        We can now pose some simple queries. 	

              ■    is (eat (deer, grass))	

                     •  yes	

              ■    is (eat (bear, rabbit))	

                     •  no	


     ●        “is” asks if the fact exists in the database.	




Section 1.5                                       Logic Programming      3
Prolog

     ●        Queries may include variables, for example:	

               ■    which(x: eat(bear, x))	

     ●        produces:	

               ■    fish	

               ■    fox	

     ●        The second type of item in a Prolog database is a
              Prolog rule. 	

     ●        A rule is a description of a predicate by means of an
              implication. 	





Section 1.5                                     Logic Programming     4
Prolog Rules

     ●        For example, we might use a rule to define a predicate
              of prey:	

              ■    prey(x) if eat(y, x) and animal(x)	

     ●        This says that x is a prey if it is an animal that is eaten.
              If we add this rule to our database, then in response to
              the query:	

              ■    which(x: prey(x))	

     ●        we would get:	

              ■    fish	

              ■    fox	





Section 1.5                                 Logic Programming                5
Horn Clauses and Resolution

     ●        We can describe the facts in our database by the wffs	

              ■    E(b, fi)	

              ■    E(b, fo)	

              ■    E(d, g)	

              ■    A(b)	

              ■    A( fi)	

              ■    A( fo)	

              ■    A(d)	

              ■    P(g)	

              ■    with the rule: E(y, x) Λ A(x) → Pr (x)	

     ●        Prolog treats the rule as being universally quantified
              and uses universal instantiation to strip off the
              universal quantifiers:	

              ■    (∀y)(∀x)[E(y, x) Λ A(x) → Pr(x)]	


Section 1.5                                    Logic Programming         6
Horn Clauses and Resolution

     ●        A Horn clause is a wff composed of predicates or the
              negations of predicates (with either variables or
              constants as arguments) joined by disjunctions, where,
              at most, one predicate is unnegated.	

     ●        Example of Horn clause:	

              ■    [E(y, x)]ʹ′ V [A(x)]ʹ′ V Pr(x)	

     ●        This can be rewritten using DeMorgan’s law as	

              ■    [E(y,x) Λ A(x)] V Pr(x)	

     ●        This is equivalent to:	

              ■    E(y, x) Λ A(x) → Pr(x)	

     ●        The above is a rule in the Prolog program.	



Section 1.5                                    Logic Programming       7
Horn Clauses and Resolution
     ●        The rule of inference used by Prolog is called resolution.	

     ●        Two Horn clauses in a Prolog database are resolved into a new Horn
              clause if one contains an unnegated predicate that matches a negated
              predicate in the other clause.	

     ●        For example: 	

                      •  A(a)	

                      •  [A(a)]ʹ′ V B(b) 	

               ■    is equivalent to:	

                      •  A(a), A(a) → B(b) 	

               ■    Prolog infers:	

                      •  B(b)	

     ●        which is just an application of modus ponens.	

     ●        Therefore, Prolog’s rule of inference includes modus ponens as
              a special case.	



Section 1.5                                      Logic Programming                   8
Recursion
     ●        Prolog rules are implications. 	

     ●        Their antecedents may depend on facts or other rules.	

     ●        The antecedent of a rule may also depend on that rule
              itself, in which case the rule is defined in terms of itself.	

     ●        For example, we can then define a binary relation in-food-
              chain(x, y), meaning “y is in x’s food chain.” This means
              one of two things:	

              1.     x eats y directly.	

              2.     x eats something that eats something that eats something ...
                       that eats y. 	

                    	

This can also be stated as:	

              2.     x eats z and y is in z’s food chain.	




Section 1.5                                  Logic Programming                      9
Recursion
     ●        Case (1) is simple to test from our existing facts, but without (2), in-
              food-chain means nothing different than eat.	

     ●        On the other hand, (2) without (1) sends us down an infinite path of
              something eating something eating something and so on, with nothing
              telling us when to stop.	

     ●        Recursive definitions always need a stopping point that consists of
              specific information.	

     ●        The Prolog rule for in-food-chain incorporates (1) and (2):	

               ■   in-food-chain(x, y) if eat(x, y)	

               ■   in-food-chain(x, y) if eat(x, z) and in-food-chain(z, y)	

     ●        is a recursive rule because it defines the predicate in-food-chain
              in terms of in-food-chain.	





Section 1.5                                    Logic Programming                         10
Expert Systems
     ●        Many interesting applications programs have been
              developed, in Prolog and similar logic programming
              languages, that gather a database of facts and rules about
              some domain and then use this database to draw
              conclusions.	

     ●        Such programs are known as expert systems, knowledge-
              based systems, or rule-based systems.	

     ●        The database in an expert system attempts to capture the
              knowledge (“elicit the expertise”) of a human expert in a
              particular field.	

     ●        This includes both the facts known to the expert and the
              expert’s reasoning path in reaching conclusions from those
              facts.	



Section 1.5                             Logic Programming                  11

More Related Content

What's hot

Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answersRojaPriya
 
20110930 information retrieval raskovalov_lecture1
20110930 information retrieval raskovalov_lecture120110930 information retrieval raskovalov_lecture1
20110930 information retrieval raskovalov_lecture1Computer Science Club
 
Python interview questions
Python interview questionsPython interview questions
Python interview questionsPragati Singh
 
Python Interview questions 2020
Python Interview questions 2020Python Interview questions 2020
Python Interview questions 2020VigneshVijay21
 
QwalKeko, a History Querying Tool
QwalKeko, a History Querying ToolQwalKeko, a History Querying Tool
QwalKeko, a History Querying Toolstevensreinout
 
Prolog Programming Language
Prolog Programming  LanguageProlog Programming  Language
Prolog Programming LanguageReham AlBlehid
 
Most Asked Python Interview Questions
Most Asked Python Interview QuestionsMost Asked Python Interview Questions
Most Asked Python Interview QuestionsShubham Shrimant
 

What's hot (8)

Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answers
 
20110930 information retrieval raskovalov_lecture1
20110930 information retrieval raskovalov_lecture120110930 information retrieval raskovalov_lecture1
20110930 information retrieval raskovalov_lecture1
 
Python interview questions
Python interview questionsPython interview questions
Python interview questions
 
Python Interview questions 2020
Python Interview questions 2020Python Interview questions 2020
Python Interview questions 2020
 
QwalKeko, a History Querying Tool
QwalKeko, a History Querying ToolQwalKeko, a History Querying Tool
QwalKeko, a History Querying Tool
 
ICLP-DC12
ICLP-DC12ICLP-DC12
ICLP-DC12
 
Prolog Programming Language
Prolog Programming  LanguageProlog Programming  Language
Prolog Programming Language
 
Most Asked Python Interview Questions
Most Asked Python Interview QuestionsMost Asked Python Interview Questions
Most Asked Python Interview Questions
 

Viewers also liked

Chapter 19 Wound Management, Stoma And Incontinence Products
Chapter 19    Wound  Management,  Stoma And  Incontinence  ProductsChapter 19    Wound  Management,  Stoma And  Incontinence  Products
Chapter 19 Wound Management, Stoma And Incontinence Productsdunerafael
 
Apollo Insulation Aluminum Composite Foils - Catalog 2012
Apollo Insulation Aluminum Composite Foils - Catalog 2012Apollo Insulation Aluminum Composite Foils - Catalog 2012
Apollo Insulation Aluminum Composite Foils - Catalog 2012Trading Green Ltd.
 
Expocision elementos y hosting
Expocision elementos y hostingExpocision elementos y hosting
Expocision elementos y hostingtatianagomezdiaz
 
¿Qué es un doctorado? Explicación visual
¿Qué es un doctorado? Explicación visual¿Qué es un doctorado? Explicación visual
¿Qué es un doctorado? Explicación visualCBRE España
 
MATC ACE Syllabus-Grant Writing Essentials_ArthurUpham
MATC ACE Syllabus-Grant Writing Essentials_ArthurUphamMATC ACE Syllabus-Grant Writing Essentials_ArthurUpham
MATC ACE Syllabus-Grant Writing Essentials_ArthurUphamArthur Upham
 
3927 IIJ - Programme Guide 2015-v8
3927 IIJ - Programme Guide 2015-v83927 IIJ - Programme Guide 2015-v8
3927 IIJ - Programme Guide 2015-v8Colin J. O'Sullivan
 
1 la sdr pedre¥a va a por la trainera-carta a los socios
1 la sdr pedre¥a va a por la trainera-carta a los socios1 la sdr pedre¥a va a por la trainera-carta a los socios
1 la sdr pedre¥a va a por la trainera-carta a los sociosNombre Apellidos
 
Turning Pages Presentation Rtfacts
Turning Pages Presentation RtfactsTurning Pages Presentation Rtfacts
Turning Pages Presentation Rtfactsrogerpayton
 
Como iniciar-la-lectoescritura-en-los-niños-jugando
Como iniciar-la-lectoescritura-en-los-niños-jugandoComo iniciar-la-lectoescritura-en-los-niños-jugando
Como iniciar-la-lectoescritura-en-los-niños-jugandoJose Hilares Quispe
 
Pure products pamphlets new
Pure products pamphlets newPure products pamphlets new
Pure products pamphlets newPURE PRODUCTS
 
Neuroformación mailpermission 5
Neuroformación mailpermission 5Neuroformación mailpermission 5
Neuroformación mailpermission 5Miguel Ángel Gago
 
Creacions fotogràfiques a partir de frases fetes
Creacions fotogràfiques a partir de frases fetesCreacions fotogràfiques a partir de frases fetes
Creacions fotogràfiques a partir de frases fetesceiplacreu torrefarrera
 
Simulation and Surveillance: The Transformation of Government and Control in ...
Simulation and Surveillance: The Transformation of Government and Control in ...Simulation and Surveillance: The Transformation of Government and Control in ...
Simulation and Surveillance: The Transformation of Government and Control in ...Nikolaos Vaslamatzis
 
Enhancing input on and above the interactive surface
Enhancing input on and above the interactive surfaceEnhancing input on and above the interactive surface
Enhancing input on and above the interactive surfaceReem Alattas
 
Savoy Studios Custom Hospitality Lighting
Savoy Studios Custom Hospitality LightingSavoy Studios Custom Hospitality Lighting
Savoy Studios Custom Hospitality Lightingmarcus mccoy
 

Viewers also liked (20)

Chapter 19 Wound Management, Stoma And Incontinence Products
Chapter 19    Wound  Management,  Stoma And  Incontinence  ProductsChapter 19    Wound  Management,  Stoma And  Incontinence  Products
Chapter 19 Wound Management, Stoma And Incontinence Products
 
Apollo Insulation Aluminum Composite Foils - Catalog 2012
Apollo Insulation Aluminum Composite Foils - Catalog 2012Apollo Insulation Aluminum Composite Foils - Catalog 2012
Apollo Insulation Aluminum Composite Foils - Catalog 2012
 
Expocision elementos y hosting
Expocision elementos y hostingExpocision elementos y hosting
Expocision elementos y hosting
 
¿Qué es un doctorado? Explicación visual
¿Qué es un doctorado? Explicación visual¿Qué es un doctorado? Explicación visual
¿Qué es un doctorado? Explicación visual
 
Programa de alianzas estratégicas
Programa de alianzas estratégicasPrograma de alianzas estratégicas
Programa de alianzas estratégicas
 
MATC ACE Syllabus-Grant Writing Essentials_ArthurUpham
MATC ACE Syllabus-Grant Writing Essentials_ArthurUphamMATC ACE Syllabus-Grant Writing Essentials_ArthurUpham
MATC ACE Syllabus-Grant Writing Essentials_ArthurUpham
 
3927 IIJ - Programme Guide 2015-v8
3927 IIJ - Programme Guide 2015-v83927 IIJ - Programme Guide 2015-v8
3927 IIJ - Programme Guide 2015-v8
 
1 la sdr pedre¥a va a por la trainera-carta a los socios
1 la sdr pedre¥a va a por la trainera-carta a los socios1 la sdr pedre¥a va a por la trainera-carta a los socios
1 la sdr pedre¥a va a por la trainera-carta a los socios
 
Cyf1
Cyf1Cyf1
Cyf1
 
Poesia de la vaca
Poesia de la vacaPoesia de la vaca
Poesia de la vaca
 
Turning Pages Presentation Rtfacts
Turning Pages Presentation RtfactsTurning Pages Presentation Rtfacts
Turning Pages Presentation Rtfacts
 
Impactia, evaluar la actividad científica del SSPA
Impactia, evaluar la actividad científica del SSPAImpactia, evaluar la actividad científica del SSPA
Impactia, evaluar la actividad científica del SSPA
 
Como iniciar-la-lectoescritura-en-los-niños-jugando
Como iniciar-la-lectoescritura-en-los-niños-jugandoComo iniciar-la-lectoescritura-en-los-niños-jugando
Como iniciar-la-lectoescritura-en-los-niños-jugando
 
Pure products pamphlets new
Pure products pamphlets newPure products pamphlets new
Pure products pamphlets new
 
Neuroformación mailpermission 5
Neuroformación mailpermission 5Neuroformación mailpermission 5
Neuroformación mailpermission 5
 
Creacions fotogràfiques a partir de frases fetes
Creacions fotogràfiques a partir de frases fetesCreacions fotogràfiques a partir de frases fetes
Creacions fotogràfiques a partir de frases fetes
 
Simulation and Surveillance: The Transformation of Government and Control in ...
Simulation and Surveillance: The Transformation of Government and Control in ...Simulation and Surveillance: The Transformation of Government and Control in ...
Simulation and Surveillance: The Transformation of Government and Control in ...
 
C.roseus paper
C.roseus paperC.roseus paper
C.roseus paper
 
Enhancing input on and above the interactive surface
Enhancing input on and above the interactive surfaceEnhancing input on and above the interactive surface
Enhancing input on and above the interactive surface
 
Savoy Studios Custom Hospitality Lighting
Savoy Studios Custom Hospitality LightingSavoy Studios Custom Hospitality Lighting
Savoy Studios Custom Hospitality Lighting
 

Similar to CPSC 125 Ch 1 Sec 5

#8 formal methods – pro logic
#8 formal methods – pro logic#8 formal methods – pro logic
#8 formal methods – pro logicSharif Omar Salem
 
Family Tree on PROLOG
Family Tree on PROLOGFamily Tree on PROLOG
Family Tree on PROLOGAbdul Rafay
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)Nitesh Singh
 
2nd Proj. Update: Integrating SWI-Prolog for Semantic Reasoning in Bioclipse
2nd Proj. Update: Integrating SWI-Prolog for Semantic Reasoning in Bioclipse2nd Proj. Update: Integrating SWI-Prolog for Semantic Reasoning in Bioclipse
2nd Proj. Update: Integrating SWI-Prolog for Semantic Reasoning in BioclipseSamuel Lampa
 
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
 
ARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptxARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptxRuchitaMaaran
 
Prolog,Prolog Programming IN AI.pdf
Prolog,Prolog Programming IN AI.pdfProlog,Prolog Programming IN AI.pdf
Prolog,Prolog Programming IN AI.pdfCS With Logic
 
A scalable ontology reasoner via incremental materialization
A scalable ontology reasoner via incremental materializationA scalable ontology reasoner via incremental materialization
A scalable ontology reasoner via incremental materializationRokan Uddin Faruqui
 
Prolog Programming : Basics
Prolog Programming : BasicsProlog Programming : Basics
Prolog Programming : BasicsMitul Desai
 
10 logic+programming+with+prolog
10 logic+programming+with+prolog10 logic+programming+with+prolog
10 logic+programming+with+prologbaran19901990
 
Introduction to Prolog
Introduction to Prolog Introduction to Prolog
Introduction to Prolog Showkot Usman
 
Artificial Intelligence and Expert System
Artificial Intelligence and Expert System Artificial Intelligence and Expert System
Artificial Intelligence and Expert System Showkot Usman
 
Introduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in LogicIntroduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in LogicVishal Tandel
 
Expert Systems & Prolog
Expert Systems & PrologExpert Systems & Prolog
Expert Systems & PrologFatih Karatana
 

Similar to CPSC 125 Ch 1 Sec 5 (18)

#8 formal methods – pro logic
#8 formal methods – pro logic#8 formal methods – pro logic
#8 formal methods – pro logic
 
Family Tree on PROLOG
Family Tree on PROLOGFamily Tree on PROLOG
Family Tree on PROLOG
 
Plc part 4
Plc  part 4Plc  part 4
Plc part 4
 
Prolog
Prolog Prolog
Prolog
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)
 
Prolog final
Prolog finalProlog final
Prolog final
 
2nd Proj. Update: Integrating SWI-Prolog for Semantic Reasoning in Bioclipse
2nd Proj. Update: Integrating SWI-Prolog for Semantic Reasoning in Bioclipse2nd Proj. Update: Integrating SWI-Prolog for Semantic Reasoning in Bioclipse
2nd Proj. Update: Integrating SWI-Prolog for Semantic Reasoning in Bioclipse
 
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
 
ARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptxARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptx
 
Prolog,Prolog Programming IN AI.pdf
Prolog,Prolog Programming IN AI.pdfProlog,Prolog Programming IN AI.pdf
Prolog,Prolog Programming IN AI.pdf
 
A scalable ontology reasoner via incremental materialization
A scalable ontology reasoner via incremental materializationA scalable ontology reasoner via incremental materialization
A scalable ontology reasoner via incremental materialization
 
Logic Programming and ILP
Logic Programming and ILPLogic Programming and ILP
Logic Programming and ILP
 
Prolog Programming : Basics
Prolog Programming : BasicsProlog Programming : Basics
Prolog Programming : Basics
 
10 logic+programming+with+prolog
10 logic+programming+with+prolog10 logic+programming+with+prolog
10 logic+programming+with+prolog
 
Introduction to Prolog
Introduction to Prolog Introduction to Prolog
Introduction to Prolog
 
Artificial Intelligence and Expert System
Artificial Intelligence and Expert System Artificial Intelligence and Expert System
Artificial Intelligence and Expert System
 
Introduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in LogicIntroduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in Logic
 
Expert Systems & Prolog
Expert Systems & PrologExpert Systems & Prolog
Expert Systems & Prolog
 

More from David Wood

Internet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainInternet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainDavid Wood
 
Returning to Online Privacy?
Returning to Online Privacy?Returning to Online Privacy?
Returning to Online Privacy?David Wood
 
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...David Wood
 
BlockSW 2019 Keynote
BlockSW 2019 KeynoteBlockSW 2019 Keynote
BlockSW 2019 KeynoteDavid Wood
 
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221David Wood
 
Privacy in the Smart City
Privacy in the Smart CityPrivacy in the Smart City
Privacy in the Smart CityDavid Wood
 
Controlling Complexities in Software Development
Controlling Complexities in Software DevelopmentControlling Complexities in Software Development
Controlling Complexities in Software DevelopmentDavid Wood
 
Privacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsPrivacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsDavid Wood
 
Implementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelImplementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelDavid Wood
 
So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301David Wood
 
Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601David Wood
 
When Metaphors Kill
When Metaphors KillWhen Metaphors Kill
When Metaphors KillDavid Wood
 
Secularism in Australia
Secularism in AustraliaSecularism in Australia
Secularism in AustraliaDavid Wood
 
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsMeditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsDavid Wood
 
Building a writer's platform with social media
Building a writer's platform with social mediaBuilding a writer's platform with social media
Building a writer's platform with social mediaDavid Wood
 
Summary of the Hero's Journey
Summary of the Hero's JourneySummary of the Hero's Journey
Summary of the Hero's JourneyDavid Wood
 
Open by Default
Open by DefaultOpen by Default
Open by DefaultDavid Wood
 
Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926David Wood
 
Linked Data ROI 20110426
Linked Data ROI 20110426Linked Data ROI 20110426
Linked Data ROI 20110426David Wood
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesDavid Wood
 

More from David Wood (20)

Internet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainInternet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchain
 
Returning to Online Privacy?
Returning to Online Privacy?Returning to Online Privacy?
Returning to Online Privacy?
 
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
 
BlockSW 2019 Keynote
BlockSW 2019 KeynoteBlockSW 2019 Keynote
BlockSW 2019 Keynote
 
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
 
Privacy in the Smart City
Privacy in the Smart CityPrivacy in the Smart City
Privacy in the Smart City
 
Controlling Complexities in Software Development
Controlling Complexities in Software DevelopmentControlling Complexities in Software Development
Controlling Complexities in Software Development
 
Privacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsPrivacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable Claims
 
Implementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelImplementing the Verifiable Claims data model
Implementing the Verifiable Claims data model
 
So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301
 
Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601
 
When Metaphors Kill
When Metaphors KillWhen Metaphors Kill
When Metaphors Kill
 
Secularism in Australia
Secularism in AustraliaSecularism in Australia
Secularism in Australia
 
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsMeditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
 
Building a writer's platform with social media
Building a writer's platform with social mediaBuilding a writer's platform with social media
Building a writer's platform with social media
 
Summary of the Hero's Journey
Summary of the Hero's JourneySummary of the Hero's Journey
Summary of the Hero's Journey
 
Open by Default
Open by DefaultOpen by Default
Open by Default
 
Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926
 
Linked Data ROI 20110426
Linked Data ROI 20110426Linked Data ROI 20110426
Linked Data ROI 20110426
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
 

Recently uploaded

Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 

Recently uploaded (20)

20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 

CPSC 125 Ch 1 Sec 5

  • 1. Formal Logic Mathematical Structures for Computer Science Chapter 1 Copyright © 2006 W.H. Freeman & Co. MSCS Slides Formal Logic
  • 2. Declarative Programming Languages ●  A declarative language is based on predicate logic. ●  A program written in a declarative language consists only of statements (actually predicate wffs) that are declared as hypotheses. ●  Execution of a declarative program allows the user to pose queries, asking for information about possible conclusions that can be derived from the hypotheses. ●  After obtaining the user’s query, the language turns on its “inference engine” and applies its rules of inference to the hypotheses to see which conclusions fit the user’s query. Section 1.5 Logic Programming 1
  • 3. Prolog ●  Prolog (PROgramming in LOGic) is a declarative programming language. ●  The set of declarations that constitutes a Prolog program is also known as a Prolog database. ●  Items in a Prolog database are either facts or rules. ●  Example of Prolog facts (a binary predicate called “eat”): ■  eat (bear, fish) ■  eat (bear, fox) ■  eat (deer, grass) ●  “bear,” “fish,” “fox,” “deer,” and “grass” are constants because they represent specific elements in the domain. Section 1.5 Logic Programming 2
  • 4. Prolog ●  Other facts that we could add to the Prolog database: ■  animal (bear) ■  animal (fish) ■  animal (fox) ■  animal (deer) ■  plant (grass) ●  We can now pose some simple queries. ■  is (eat (deer, grass)) •  yes ■  is (eat (bear, rabbit)) •  no ●  “is” asks if the fact exists in the database. Section 1.5 Logic Programming 3
  • 5. Prolog ●  Queries may include variables, for example: ■  which(x: eat(bear, x)) ●  produces: ■  fish ■  fox ●  The second type of item in a Prolog database is a Prolog rule. ●  A rule is a description of a predicate by means of an implication. Section 1.5 Logic Programming 4
  • 6. Prolog Rules ●  For example, we might use a rule to define a predicate of prey: ■  prey(x) if eat(y, x) and animal(x) ●  This says that x is a prey if it is an animal that is eaten. If we add this rule to our database, then in response to the query: ■  which(x: prey(x)) ●  we would get: ■  fish ■  fox Section 1.5 Logic Programming 5
  • 7. Horn Clauses and Resolution ●  We can describe the facts in our database by the wffs ■  E(b, fi) ■  E(b, fo) ■  E(d, g) ■  A(b) ■  A( fi) ■  A( fo) ■  A(d) ■  P(g) ■  with the rule: E(y, x) Λ A(x) → Pr (x) ●  Prolog treats the rule as being universally quantified and uses universal instantiation to strip off the universal quantifiers: ■  (∀y)(∀x)[E(y, x) Λ A(x) → Pr(x)] Section 1.5 Logic Programming 6
  • 8. Horn Clauses and Resolution ●  A Horn clause is a wff composed of predicates or the negations of predicates (with either variables or constants as arguments) joined by disjunctions, where, at most, one predicate is unnegated. ●  Example of Horn clause: ■  [E(y, x)]ʹ′ V [A(x)]ʹ′ V Pr(x) ●  This can be rewritten using DeMorgan’s law as ■  [E(y,x) Λ A(x)] V Pr(x) ●  This is equivalent to: ■  E(y, x) Λ A(x) → Pr(x) ●  The above is a rule in the Prolog program. Section 1.5 Logic Programming 7
  • 9. Horn Clauses and Resolution ●  The rule of inference used by Prolog is called resolution. ●  Two Horn clauses in a Prolog database are resolved into a new Horn clause if one contains an unnegated predicate that matches a negated predicate in the other clause. ●  For example: •  A(a) •  [A(a)]ʹ′ V B(b) ■  is equivalent to: •  A(a), A(a) → B(b) ■  Prolog infers: •  B(b) ●  which is just an application of modus ponens. ●  Therefore, Prolog’s rule of inference includes modus ponens as a special case. Section 1.5 Logic Programming 8
  • 10. Recursion ●  Prolog rules are implications. ●  Their antecedents may depend on facts or other rules. ●  The antecedent of a rule may also depend on that rule itself, in which case the rule is defined in terms of itself. ●  For example, we can then define a binary relation in-food- chain(x, y), meaning “y is in x’s food chain.” This means one of two things: 1.  x eats y directly. 2.  x eats something that eats something that eats something ... that eats y. This can also be stated as: 2.  x eats z and y is in z’s food chain. Section 1.5 Logic Programming 9
  • 11. Recursion ●  Case (1) is simple to test from our existing facts, but without (2), in- food-chain means nothing different than eat. ●  On the other hand, (2) without (1) sends us down an infinite path of something eating something eating something and so on, with nothing telling us when to stop. ●  Recursive definitions always need a stopping point that consists of specific information. ●  The Prolog rule for in-food-chain incorporates (1) and (2): ■  in-food-chain(x, y) if eat(x, y) ■  in-food-chain(x, y) if eat(x, z) and in-food-chain(z, y) ●  is a recursive rule because it defines the predicate in-food-chain in terms of in-food-chain. Section 1.5 Logic Programming 10
  • 12. Expert Systems ●  Many interesting applications programs have been developed, in Prolog and similar logic programming languages, that gather a database of facts and rules about some domain and then use this database to draw conclusions. ●  Such programs are known as expert systems, knowledge- based systems, or rule-based systems. ●  The database in an expert system attempts to capture the knowledge (“elicit the expertise”) of a human expert in a particular field. ●  This includes both the facts known to the expert and the expert’s reasoning path in reaching conclusions from those facts. Section 1.5 Logic Programming 11