SlideShare uma empresa Scribd logo
1 de 21
Introduction to Genifer – deduction source code:  deduction.lisp
 
 
 
In my Lisp code variables are denoted by  ?1 ,  ?2 , … etc
First order logic has the following  connectives  and  operators : /(AND)  (OR) ┐ (NOT) -> (IMPLY) ↔ (EQUIVALENCE) For example A -> B is equivalent to (┐A  B) and its truth table is: A B A->B T T   T T F   F F T   T F F   T ( I assume you still remember this stuff... )
Horn form If a bunch of formulae can be written as: A ← B /C /D /… B ← E /F /G /... and if  A  is the  goal  we want to solve: A then we can cross out A and replace it with A, B, C, D, … as the  new   sub-goals  and repeat the process: B, C, D, ..., E, F, G, … This makes solving the goals very efficient (similar to  production systems  in the old days). Formulae written in this form is called the  Horn form and is the basis of the language  Prolog . Genifer's logic is also based on Horn.
* Optional: Some first-order formulae  cannot  be expressed in Horn form. If we want to prove theorems in  full  first-order logic, we need to use a more general algorithm such as  resolution . The general procedure is: 1.  convert all the formulae into  CNF  (conjunctive normal form) 2.  eliminate all  existential quantifiers      by a process called Skolemization  (see next slide) 3.  repeatedly apply the resolution rule to formulae in the KB, until nothing more changes If we restrict resolution to Horn formulae we get  SLD-resolution which is very fast and is the search procedure in Prolog. I think Horn is expressive enough for making a first AGI prototype.
First order logic has 2  quantifiers : Universal : " X  liar(X)    for all X, X is a liar    “Everyone is a liar”. Existential :  X  brother(john, X)    exists X such that X is John's brother The existential quantifier can be eliminated by  Skolemization :  X  brother(john, X) “Exists X such that X is John's bro”   brother(john, f(john)) where f() is called a  Skolem function .  Its purpose is to map X to X's brother. With existential quantifiers eliminated, we can assume all variables are implicitly universally quantified, and omit the  " 's.
When we have a goal to prove... goal G KB knowledge base We try to  fetch  facts and rules from the KB to  satisfy  the goal. eg:  bachelor(john)  ? (defined in  memory.lisp )
[object Object]
This is known as  backward chaining . ,[object Object]
The black links represent “OR” (ie, the goal G can be solved by applying
either  rule1, rule2, rule3, ... etc.
[object Object]
I think  best-first  search may be better, which uses a  priority queue  to  rank  the nodes. Each element in the priority queue points to a tree node.  priority queue
A goal / sub-goal can be satisfied by either  facts   or   rules . example of a fact: bachelor(john) example of a rule: bachelor(?1) ←  male(?1) /single(?1) this is a variable A B
To satisfy a goal, some  variable substitutions  occur. We need to make these 2 terms identical;  this is done by a n algorithm known as  unification . The result of unification is a  set of substitutions , for example: {?1/john, ...}
[object Object]
new  set of substitutions .
Over time, a goal node can acquire

Mais conteúdo relacionado

Mais procurados

Otter 2014-12-15-01-slideshare
Otter 2014-12-15-01-slideshareOtter 2014-12-15-01-slideshare
Otter 2014-12-15-01-slideshare
Ruo Ando
 
Translating English to Propositional Logic
Translating English to Propositional LogicTranslating English to Propositional Logic
Translating English to Propositional Logic
Janet Stemwedel
 

Mais procurados (20)

Theory of Computation Unit 5
Theory of Computation Unit 5Theory of Computation Unit 5
Theory of Computation Unit 5
 
Admissions in India 2015
Admissions in India 2015Admissions in India 2015
Admissions in India 2015
 
Theory of Computation Unit 3
Theory of Computation Unit 3Theory of Computation Unit 3
Theory of Computation Unit 3
 
AI Lesson 16
AI Lesson 16AI Lesson 16
AI Lesson 16
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Truth table a.r
Truth table a.rTruth table a.r
Truth table a.r
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Truth table
Truth tableTruth table
Truth table
 
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaTheory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
 
Otter 2014-12-15-01-slideshare
Otter 2014-12-15-01-slideshareOtter 2014-12-15-01-slideshare
Otter 2014-12-15-01-slideshare
 
Matlab
MatlabMatlab
Matlab
 
Regular expression
Regular expressionRegular expression
Regular expression
 
Processing Regex Python
Processing Regex PythonProcessing Regex Python
Processing Regex Python
 
Translating English to Propositional Logic
Translating English to Propositional LogicTranslating English to Propositional Logic
Translating English to Propositional Logic
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 
Per4 function2
Per4 function2Per4 function2
Per4 function2
 
Systems of congruence
Systems of congruenceSystems of congruence
Systems of congruence
 
Logic
LogicLogic
Logic
 
AI Lesson 17
AI Lesson 17AI Lesson 17
AI Lesson 17
 
Adv math[unit 2]
Adv math[unit 2]Adv math[unit 2]
Adv math[unit 2]
 

Semelhante a introduction to Genifer -- Deduction

Jarrar.lecture notes.aai.2011s.ch7.p logic
Jarrar.lecture notes.aai.2011s.ch7.p logicJarrar.lecture notes.aai.2011s.ch7.p logic
Jarrar.lecture notes.aai.2011s.ch7.p logic
PalGov
 
6.c-CMPS 403-F19-Session 6-Resolution.pdf
6.c-CMPS 403-F19-Session 6-Resolution.pdf6.c-CMPS 403-F19-Session 6-Resolution.pdf
6.c-CMPS 403-F19-Session 6-Resolution.pdf
AmirMohamedNabilSale
 
1004_theorem_proving_2018.pptx on the to
1004_theorem_proving_2018.pptx on the to1004_theorem_proving_2018.pptx on the to
1004_theorem_proving_2018.pptx on the to
fariyaPatel
 
Propositional logic is a good vehicle to introduce basic properties of logic
Propositional logic is a good vehicle to introduce basic properties of logicPropositional logic is a good vehicle to introduce basic properties of logic
Propositional logic is a good vehicle to introduce basic properties of logic
pendragon6626
 
MetiTarski: An Automatic Prover for Real-Valued Special Functions
MetiTarski: An Automatic Prover for Real-Valued Special FunctionsMetiTarski: An Automatic Prover for Real-Valued Special Functions
MetiTarski: An Automatic Prover for Real-Valued Special Functions
Lawrence Paulson
 
2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou
vafopoulos
 
Jarrar.lecture notes.aai.2011s.ch8.fol.introduction
Jarrar.lecture notes.aai.2011s.ch8.fol.introductionJarrar.lecture notes.aai.2011s.ch8.fol.introduction
Jarrar.lecture notes.aai.2011s.ch8.fol.introduction
PalGov
 

Semelhante a introduction to Genifer -- Deduction (20)

Knowledge Representation, Inference and Reasoning
Knowledge Representation, Inference and ReasoningKnowledge Representation, Inference and Reasoning
Knowledge Representation, Inference and Reasoning
 
Jarrar.lecture notes.aai.2011s.ch7.p logic
Jarrar.lecture notes.aai.2011s.ch7.p logicJarrar.lecture notes.aai.2011s.ch7.p logic
Jarrar.lecture notes.aai.2011s.ch7.p logic
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
lect14-semantics.ppt
lect14-semantics.pptlect14-semantics.ppt
lect14-semantics.ppt
 
Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
 
Pnp
PnpPnp
Pnp
 
6.c-CMPS 403-F19-Session 6-Resolution.pdf
6.c-CMPS 403-F19-Session 6-Resolution.pdf6.c-CMPS 403-F19-Session 6-Resolution.pdf
6.c-CMPS 403-F19-Session 6-Resolution.pdf
 
1004_theorem_proving_2018.pptx on the to
1004_theorem_proving_2018.pptx on the to1004_theorem_proving_2018.pptx on the to
1004_theorem_proving_2018.pptx on the to
 
P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2
 
Propositional logic is a good vehicle to introduce basic properties of logic
Propositional logic is a good vehicle to introduce basic properties of logicPropositional logic is a good vehicle to introduce basic properties of logic
Propositional logic is a good vehicle to introduce basic properties of logic
 
constructing_generic_algorithms__ben_deane__cppcon_2020.pdf
constructing_generic_algorithms__ben_deane__cppcon_2020.pdfconstructing_generic_algorithms__ben_deane__cppcon_2020.pdf
constructing_generic_algorithms__ben_deane__cppcon_2020.pdf
 
C2.0 propositional logic
C2.0 propositional logicC2.0 propositional logic
C2.0 propositional logic
 
Master of Computer Application (MCA) – Semester 4 MC0080
Master of Computer Application (MCA) – Semester 4  MC0080Master of Computer Application (MCA) – Semester 4  MC0080
Master of Computer Application (MCA) – Semester 4 MC0080
 
Chapter 4 ds
Chapter 4 dsChapter 4 ds
Chapter 4 ds
 
MetiTarski: An Automatic Prover for Real-Valued Special Functions
MetiTarski: An Automatic Prover for Real-Valued Special FunctionsMetiTarski: An Automatic Prover for Real-Valued Special Functions
MetiTarski: An Automatic Prover for Real-Valued Special Functions
 
L03 ai - knowledge representation using logic
L03 ai - knowledge representation using logicL03 ai - knowledge representation using logic
L03 ai - knowledge representation using logic
 
2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou
 
Jarrar.lecture notes.aai.2011s.ch8.fol.introduction
Jarrar.lecture notes.aai.2011s.ch8.fol.introductionJarrar.lecture notes.aai.2011s.ch8.fol.introduction
Jarrar.lecture notes.aai.2011s.ch8.fol.introduction
 
Mathematical Statistics Homework Help
Mathematical Statistics Homework HelpMathematical Statistics Homework Help
Mathematical Statistics Homework Help
 
Knowledge extraction from support vector machines
Knowledge extraction from support vector machinesKnowledge extraction from support vector machines
Knowledge extraction from support vector machines
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 

introduction to Genifer -- Deduction

  • 1. Introduction to Genifer – deduction source code: deduction.lisp
  • 2.  
  • 3.  
  • 4.  
  • 5. In my Lisp code variables are denoted by ?1 , ?2 , … etc
  • 6. First order logic has the following connectives and operators : /(AND) (OR) ┐ (NOT) -> (IMPLY) ↔ (EQUIVALENCE) For example A -> B is equivalent to (┐A B) and its truth table is: A B A->B T T T T F F F T T F F T ( I assume you still remember this stuff... )
  • 7. Horn form If a bunch of formulae can be written as: A ← B /C /D /… B ← E /F /G /... and if A is the goal we want to solve: A then we can cross out A and replace it with A, B, C, D, … as the new sub-goals and repeat the process: B, C, D, ..., E, F, G, … This makes solving the goals very efficient (similar to production systems in the old days). Formulae written in this form is called the Horn form and is the basis of the language Prolog . Genifer's logic is also based on Horn.
  • 8. * Optional: Some first-order formulae cannot be expressed in Horn form. If we want to prove theorems in full first-order logic, we need to use a more general algorithm such as resolution . The general procedure is: 1. convert all the formulae into CNF (conjunctive normal form) 2. eliminate all existential quantifiers  by a process called Skolemization (see next slide) 3. repeatedly apply the resolution rule to formulae in the KB, until nothing more changes If we restrict resolution to Horn formulae we get SLD-resolution which is very fast and is the search procedure in Prolog. I think Horn is expressive enough for making a first AGI prototype.
  • 9. First order logic has 2 quantifiers : Universal : " X liar(X)  for all X, X is a liar  “Everyone is a liar”. Existential :  X brother(john, X)  exists X such that X is John's brother The existential quantifier can be eliminated by Skolemization :  X brother(john, X) “Exists X such that X is John's bro”  brother(john, f(john)) where f() is called a Skolem function . Its purpose is to map X to X's brother. With existential quantifiers eliminated, we can assume all variables are implicitly universally quantified, and omit the " 's.
  • 10. When we have a goal to prove... goal G KB knowledge base We try to fetch facts and rules from the KB to satisfy the goal. eg: bachelor(john) ? (defined in memory.lisp )
  • 11.
  • 12.
  • 13. The black links represent “OR” (ie, the goal G can be solved by applying
  • 14. either rule1, rule2, rule3, ... etc.
  • 15.
  • 16. I think best-first search may be better, which uses a priority queue to rank the nodes. Each element in the priority queue points to a tree node. priority queue
  • 17. A goal / sub-goal can be satisfied by either facts or rules . example of a fact: bachelor(john) example of a rule: bachelor(?1) ← male(?1) /single(?1) this is a variable A B
  • 18. To satisfy a goal, some variable substitutions occur. We need to make these 2 terms identical; this is done by a n algorithm known as unification . The result of unification is a set of substitutions , for example: {?1/john, ...}
  • 19.
  • 20. new set of substitutions .
  • 21. Over time, a goal node can acquire
  • 22. multiple sets of substitutions. {?1/john} {?1/pete} {?1/paul} … etc these are 3 substitution sets stored in the node Managing these set of substitutions can be a great source of complexity, as the next few slides illustrate...
  • 23. Each substitution set is associated with a truth value (TV). {?1/john} {?1/pete} {?1/paul} … etc TV1 TV2 TV3 ...
  • 24. {?1/john} {?1/pete} {?1/paul} … etc {?1/mary} {?1/paul} {?1/john} … etc male(john), male(pete), male(paul), … etc single(mary), single(paul), single(john), … etc male(?1) single(?1) bachelor(?1) ← male(?1) /single(?1) facts from KB that matches the sub-goals These 2 blocks of substitution-sets must be merged to give the result to the parent node. When handling substitution sets of a conjunction /...
  • 25. {?1/john} {?1/pete} {?1/paul} … etc {?1/mary} {?1/paul} {?1/john} … etc Each set on the left block has to be matched with each set of the right block. for example: {?1 / john} {?1 / mary} fail {?1 / john} {?1 / john} match Because the variable ?1 can only take on one value on each instance.
  • 26.
  • 27. we try to do the matching when a new substitution-set arrives.
  • 28. When we get a new set, say {?1 / john}, we try to merge it with each set in the other existing blocks: {?1 / mary } {?1 / sam } {?1 / paul } {?1 / john } .... etc new result from unification
  • 29. {?1/john} {?1/pete} {?1/paul} … etc {?1/mary} {?1/paul} {?1/john} … etc Substitution-sets propagate upwards along the proof tree. parent's block of substitution sets This part of the Lisp code may still need developing.
  • 30. The Lisp code contains these functions: backward-chain main function, manages the priority queue process-subgoal process-fact builds up the proof tree during search process-rule retract deletes a dead proof tree node propagate propagates TVs up the proof tree TO-DO: * some comments are excessive