SlideShare una empresa de 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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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]
 

Similar 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
 

Similar 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

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
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
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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...
 
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
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
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...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
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
 

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