This document contains lecture slides on first order logic inference from a course on artificial intelligence at the University of Hildesheim in Germany. It introduces concepts like unification, forward chaining, backward chaining and resolution. Forward chaining uses generalized modus ponens to iteratively infer new statements from a knowledge base consisting of Horn clauses. Backward chaining works in the opposite direction, trying to satisfy query atoms by matching them to rule heads and replacing with rule bodies.
Supermathematics and Artificial General IntelligenceJordan Bennett
In a clear way, I outline how Supermathematics may apply in Artificial General Intelligence.
I describe standard Super-Hamiltonian usage, with respect to Dwave's "Quantum Boltzmann Machine".
1) The document discusses using a misspecified Bayesian model to extract specific information from big data, such as the value of an integral, rather than fully modeling the data.
2) It proposes choosing a misspecified model f(x|θ) and updating beliefs about the value of θ0 that satisfies the integral, rather than θ itself, using the Bayes update.
3) The argument is that this approach is asymptotically valid for learning about the target parameter θ* that minimizes expected loss, even if the model does not connect x to θ, as long as θ0 and θ* coincide under the chosen model.
This document summarizes a lecture on computational learning theory and machine learning. It discusses the difference between training error and generalization error, and how having a small training error does not necessarily mean good generalization. It introduces the Probably Approximately Correct (PAC) learning framework for relating training examples, hypothesis complexity, accuracy, and probability of successful learning. Key concepts discussed include the version space, sample complexity, VC dimension, and uniform convergence. The goal of computational learning theory is to understand what general laws constrain inductive learning and relate various factors like training examples, hypothesis complexity, and accuracy.
This document discusses different operations on linked lists such as insertion, deletion, and traversal. It begins with an introduction to linked lists explaining that each node contains a data field and pointer to the next node. It then covers implementing a basic node structure and various functions like creating a new node, adding a node to the beginning or end of the list, and deleting a node from the beginning, end, or a given position. Traversal and keeping track of previous nodes is important for operations like deletion from within the list. The document provides pseudocode to demonstrate common linked list operations.
The document discusses the different types of files in Linux, including regular files, directories, links, special files, sockets, and pipes. Regular files contain text, data, and executable programs. Directories track and locate other files. Links provide shortcuts to files. Special files represent devices for input/output. Sockets and pipes allow communication between processes, with sockets enabling communication over networks.
Hashing is a technique used to uniquely identify objects by assigning each object a key, such as a student ID or book ID number. A hash function converts large keys into smaller keys that are used as indices in a hash table, allowing for fast lookup of objects in O(1) time. Collisions, where two different keys hash to the same index, are resolved using techniques like separate chaining or linear probing. Common applications of hashing include databases, caches, and object representation in programming languages.
1. Planning involves finding a sequence of actions that achieves a goal starting from an initial state. It uses a set of operators that define the possible actions and their effects.
2. A plan is a sequence of operator instances that transforms the initial state into a goal state. Classical planning assumes fully observable, deterministic environments.
3. Planning problems can be represented using a logical language that describes states, goals, actions and their preconditions and effects. This representation allows planning algorithms to operate over problems.
The document provides an overview of object-oriented programming concepts in Java including inheritance, polymorphism, and abstraction. It discusses key inheritance concepts such as subclasses, superclasses, the extends keyword, and accessing members of parent classes. It also covers polymorphism through method overriding and abstract classes. The benefits and costs of inheritance are outlined as well as common forms of inheritance like generalization, specialization, and extension.
Supermathematics and Artificial General IntelligenceJordan Bennett
In a clear way, I outline how Supermathematics may apply in Artificial General Intelligence.
I describe standard Super-Hamiltonian usage, with respect to Dwave's "Quantum Boltzmann Machine".
1) The document discusses using a misspecified Bayesian model to extract specific information from big data, such as the value of an integral, rather than fully modeling the data.
2) It proposes choosing a misspecified model f(x|θ) and updating beliefs about the value of θ0 that satisfies the integral, rather than θ itself, using the Bayes update.
3) The argument is that this approach is asymptotically valid for learning about the target parameter θ* that minimizes expected loss, even if the model does not connect x to θ, as long as θ0 and θ* coincide under the chosen model.
This document summarizes a lecture on computational learning theory and machine learning. It discusses the difference between training error and generalization error, and how having a small training error does not necessarily mean good generalization. It introduces the Probably Approximately Correct (PAC) learning framework for relating training examples, hypothesis complexity, accuracy, and probability of successful learning. Key concepts discussed include the version space, sample complexity, VC dimension, and uniform convergence. The goal of computational learning theory is to understand what general laws constrain inductive learning and relate various factors like training examples, hypothesis complexity, and accuracy.
This document discusses different operations on linked lists such as insertion, deletion, and traversal. It begins with an introduction to linked lists explaining that each node contains a data field and pointer to the next node. It then covers implementing a basic node structure and various functions like creating a new node, adding a node to the beginning or end of the list, and deleting a node from the beginning, end, or a given position. Traversal and keeping track of previous nodes is important for operations like deletion from within the list. The document provides pseudocode to demonstrate common linked list operations.
The document discusses the different types of files in Linux, including regular files, directories, links, special files, sockets, and pipes. Regular files contain text, data, and executable programs. Directories track and locate other files. Links provide shortcuts to files. Special files represent devices for input/output. Sockets and pipes allow communication between processes, with sockets enabling communication over networks.
Hashing is a technique used to uniquely identify objects by assigning each object a key, such as a student ID or book ID number. A hash function converts large keys into smaller keys that are used as indices in a hash table, allowing for fast lookup of objects in O(1) time. Collisions, where two different keys hash to the same index, are resolved using techniques like separate chaining or linear probing. Common applications of hashing include databases, caches, and object representation in programming languages.
1. Planning involves finding a sequence of actions that achieves a goal starting from an initial state. It uses a set of operators that define the possible actions and their effects.
2. A plan is a sequence of operator instances that transforms the initial state into a goal state. Classical planning assumes fully observable, deterministic environments.
3. Planning problems can be represented using a logical language that describes states, goals, actions and their preconditions and effects. This representation allows planning algorithms to operate over problems.
The document provides an overview of object-oriented programming concepts in Java including inheritance, polymorphism, and abstraction. It discusses key inheritance concepts such as subclasses, superclasses, the extends keyword, and accessing members of parent classes. It also covers polymorphism through method overriding and abstract classes. The benefits and costs of inheritance are outlined as well as common forms of inheritance like generalization, specialization, and extension.
In which we see how an agent can find a sequence of actions that achieves its goals, when no single action will do.
The method of solving problem through AI involves the process of defining the search space, deciding start and goal states and then finding the path from start state to goal state through search space.
State space search is a process used in the field of computer science, including artificial intelligence(AI), in which successive configurations or states of an instance are considered, with the goal of finding a goal state with a desired property.
An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators
Operates in an environment
Perceive its environment through sensors
Acts upon its environment through actuators/ effectors
Has Goals
This document provides an introduction to artificial intelligence (AI). It defines AI as the science and engineering of making intelligent machines, and discusses how AI systems can learn, understand, and think like humans. The document outlines the history of AI from the 1950s to the present, traces some of the key developments in fields like machine learning, neural networks, and autonomous vehicles. It aims to examine different aspects of human and artificial intelligence.
El documento describe el proceso de realizar una búsqueda en profundidad (depth-first search) en dos gráficas diferentes, comenzando con los nodos D y H. En cada caso, se muestra cada nodo visitado y el orden en que se visitan, terminando cuando todos los nodos han sido visitados.
The document discusses various sorting techniques, including selection sort, insertion sort, bubble sort, quick sort, and merge sort. It provides descriptions of how each algorithm works, often including pseudocode and examples. Selection sort, insertion sort, and bubble sort are simple internal sorting algorithms that divide a list into sorted and unsorted sublists and move elements between them. Quick sort and merge sort are more advanced algorithms that use the divide and conquer approach.
The document discusses various sorting techniques, including selection sort, insertion sort, bubble sort, quick sort, and merge sort. It provides descriptions of how each algorithm works, often including pseudocode and examples. Selection sort, insertion sort, and bubble sort are linear sorting algorithms that divide the list into sorted and unsorted portions and move elements between them. Quick sort and merge sort are more efficient divide and conquer algorithms, with quick sort partitioning the list around a pivot and merge sort dividing the list in half, sorting each half, and merging the results.
The document discusses the nature of open source software. It defines open source as software where the source code is made available and may be redistributed and modified. The document outlines some key advantages of open source including availability of source code, lack of vendor lock-in, and lower costs compared to proprietary software. A number of popular open source applications and operating systems like Linux, Android and Firefox are provided as examples. The document also discusses open source licensing and common myths about open source software.
The document discusses the Linux operating system. It describes Linux as an open-source, free operating system that provides office software, games, video editors, and desktop environments. It explains that Linux uses a tree-like directory structure to organize files, similar to folders in Windows. Key directories include /bin for executable programs, /home for user files, /tmp for temporary files, and /var for variable or changing data. The document also distinguishes between absolute and relative file paths.
Data structures are fundamental building blocks of computer science that organize data in a computer. There are two main categories: primitive and non-primitive. Primitive structures like integers and characters are basic, while non-primitive structures like arrays and linked lists are more complex derived structures. Non-primitive structures can be linear, with elements connected sequentially, or non-linear with more complex connections. Common linear structures are stacks and queues, while common non-linear structures are trees and graphs. The choice of data structure affects the design and efficiency of algorithms and programs.
The document discusses different types of machine learning, including supervised learning where algorithms are trained using labeled examples, unsupervised learning which explores unlabeled data to find structures, semi-supervised learning which uses both labeled and unlabeled data, and reinforcement learning where an agent learns through trial and error interactions with an environment. It also covers topics such as natural language processing, ensemble learning techniques like boosting and bagging, and applications of machine learning like image recognition, medical diagnosis, and fraud detection. The document provides an overview of key concepts in machine learning including how learning systems work and the different steps involved in natural language processing.
The document discusses inference in first-order logic. It provides a brief history of reasoning and logic. It then discusses reducing first-order inference to propositional inference using techniques like universal instantiation and existential instantiation. It introduces the concepts of unification and generalized modus ponens to perform inference in first-order logic. Forward chaining and resolution are also discussed as algorithms for performing inference in first-order logic.
The document describes the A* and Iterated Deepening A* (IDA*) search algorithms. It provides examples of applying each algorithm to search problems. For A*, it shows the steps of expanding nodes from a queue and sorting by cost. For IDA*, it iteratively increases a depth limit and re-runs the search until the goal is found.
The document defines key concepts in artificial intelligence including intelligent agents, environments, and rational agents. An intelligent agent is anything that can perceive its environment and take actions to achieve its goals. Rational agents aim to maximize their performance measure given their percepts and knowledge. Different types of agents are described including reflex agents, model-based agents, goal-based agents, and utility-based agents. State representations and learning agents are also covered at a high level.
Object oriented programming (OOP) addresses limitations of procedural programming by dividing programs into objects that encapsulate both data and behaviors. OOP supports features like inheritance, polymorphism, and abstraction. Inheritance allows new classes to inherit attributes and behaviors from parent classes, polymorphism allows the same message to be interpreted differently depending on the object receiving it, and abstraction focuses on essential characteristics without implementation details. These features help make programs more modular, reusable, and maintainable.
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Sinan KOZAK
Sinan from the Delivery Hero mobile infrastructure engineering team shares a deep dive into performance acceleration with Gradle build cache optimizations. Sinan shares their journey into solving complex build-cache problems that affect Gradle builds. By understanding the challenges and solutions found in our journey, we aim to demonstrate the possibilities for faster builds. The case study reveals how overlapping outputs and cache misconfigurations led to significant increases in build times, especially as the project scaled up with numerous modules using Paparazzi tests. The journey from diagnosing to defeating cache issues offers invaluable lessons on maintaining cache integrity without sacrificing functionality.
In which we see how an agent can find a sequence of actions that achieves its goals, when no single action will do.
The method of solving problem through AI involves the process of defining the search space, deciding start and goal states and then finding the path from start state to goal state through search space.
State space search is a process used in the field of computer science, including artificial intelligence(AI), in which successive configurations or states of an instance are considered, with the goal of finding a goal state with a desired property.
An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators
Operates in an environment
Perceive its environment through sensors
Acts upon its environment through actuators/ effectors
Has Goals
This document provides an introduction to artificial intelligence (AI). It defines AI as the science and engineering of making intelligent machines, and discusses how AI systems can learn, understand, and think like humans. The document outlines the history of AI from the 1950s to the present, traces some of the key developments in fields like machine learning, neural networks, and autonomous vehicles. It aims to examine different aspects of human and artificial intelligence.
El documento describe el proceso de realizar una búsqueda en profundidad (depth-first search) en dos gráficas diferentes, comenzando con los nodos D y H. En cada caso, se muestra cada nodo visitado y el orden en que se visitan, terminando cuando todos los nodos han sido visitados.
The document discusses various sorting techniques, including selection sort, insertion sort, bubble sort, quick sort, and merge sort. It provides descriptions of how each algorithm works, often including pseudocode and examples. Selection sort, insertion sort, and bubble sort are simple internal sorting algorithms that divide a list into sorted and unsorted sublists and move elements between them. Quick sort and merge sort are more advanced algorithms that use the divide and conquer approach.
The document discusses various sorting techniques, including selection sort, insertion sort, bubble sort, quick sort, and merge sort. It provides descriptions of how each algorithm works, often including pseudocode and examples. Selection sort, insertion sort, and bubble sort are linear sorting algorithms that divide the list into sorted and unsorted portions and move elements between them. Quick sort and merge sort are more efficient divide and conquer algorithms, with quick sort partitioning the list around a pivot and merge sort dividing the list in half, sorting each half, and merging the results.
The document discusses the nature of open source software. It defines open source as software where the source code is made available and may be redistributed and modified. The document outlines some key advantages of open source including availability of source code, lack of vendor lock-in, and lower costs compared to proprietary software. A number of popular open source applications and operating systems like Linux, Android and Firefox are provided as examples. The document also discusses open source licensing and common myths about open source software.
The document discusses the Linux operating system. It describes Linux as an open-source, free operating system that provides office software, games, video editors, and desktop environments. It explains that Linux uses a tree-like directory structure to organize files, similar to folders in Windows. Key directories include /bin for executable programs, /home for user files, /tmp for temporary files, and /var for variable or changing data. The document also distinguishes between absolute and relative file paths.
Data structures are fundamental building blocks of computer science that organize data in a computer. There are two main categories: primitive and non-primitive. Primitive structures like integers and characters are basic, while non-primitive structures like arrays and linked lists are more complex derived structures. Non-primitive structures can be linear, with elements connected sequentially, or non-linear with more complex connections. Common linear structures are stacks and queues, while common non-linear structures are trees and graphs. The choice of data structure affects the design and efficiency of algorithms and programs.
The document discusses different types of machine learning, including supervised learning where algorithms are trained using labeled examples, unsupervised learning which explores unlabeled data to find structures, semi-supervised learning which uses both labeled and unlabeled data, and reinforcement learning where an agent learns through trial and error interactions with an environment. It also covers topics such as natural language processing, ensemble learning techniques like boosting and bagging, and applications of machine learning like image recognition, medical diagnosis, and fraud detection. The document provides an overview of key concepts in machine learning including how learning systems work and the different steps involved in natural language processing.
The document discusses inference in first-order logic. It provides a brief history of reasoning and logic. It then discusses reducing first-order inference to propositional inference using techniques like universal instantiation and existential instantiation. It introduces the concepts of unification and generalized modus ponens to perform inference in first-order logic. Forward chaining and resolution are also discussed as algorithms for performing inference in first-order logic.
The document describes the A* and Iterated Deepening A* (IDA*) search algorithms. It provides examples of applying each algorithm to search problems. For A*, it shows the steps of expanding nodes from a queue and sorting by cost. For IDA*, it iteratively increases a depth limit and re-runs the search until the goal is found.
The document defines key concepts in artificial intelligence including intelligent agents, environments, and rational agents. An intelligent agent is anything that can perceive its environment and take actions to achieve its goals. Rational agents aim to maximize their performance measure given their percepts and knowledge. Different types of agents are described including reflex agents, model-based agents, goal-based agents, and utility-based agents. State representations and learning agents are also covered at a high level.
Object oriented programming (OOP) addresses limitations of procedural programming by dividing programs into objects that encapsulate both data and behaviors. OOP supports features like inheritance, polymorphism, and abstraction. Inheritance allows new classes to inherit attributes and behaviors from parent classes, polymorphism allows the same message to be interpreted differently depending on the object receiving it, and abstraction focuses on essential characteristics without implementation details. These features help make programs more modular, reusable, and maintainable.
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Sinan KOZAK
Sinan from the Delivery Hero mobile infrastructure engineering team shares a deep dive into performance acceleration with Gradle build cache optimizations. Sinan shares their journey into solving complex build-cache problems that affect Gradle builds. By understanding the challenges and solutions found in our journey, we aim to demonstrate the possibilities for faster builds. The case study reveals how overlapping outputs and cache misconfigurations led to significant increases in build times, especially as the project scaled up with numerous modules using Paparazzi tests. The journey from diagnosing to defeating cache issues offers invaluable lessons on maintaining cache integrity without sacrificing functionality.
Generative AI Use cases applications solutions and implementation.pdfmahaffeycheryld
Generative AI solutions encompass a range of capabilities from content creation to complex problem-solving across industries. Implementing generative AI involves identifying specific business needs, developing tailored AI models using techniques like GANs and VAEs, and integrating these models into existing workflows. Data quality and continuous model refinement are crucial for effective implementation. Businesses must also consider ethical implications and ensure transparency in AI decision-making. Generative AI's implementation aims to enhance efficiency, creativity, and innovation by leveraging autonomous generation and sophisticated learning algorithms to meet diverse business challenges.
https://www.leewayhertz.com/generative-ai-use-cases-and-applications/
Null Bangalore | Pentesters Approach to AWS IAMDivyanshu
#Abstract:
- Learn more about the real-world methods for auditing AWS IAM (Identity and Access Management) as a pentester. So let us proceed with a brief discussion of IAM as well as some typical misconfigurations and their potential exploits in order to reinforce the understanding of IAM security best practices.
- Gain actionable insights into AWS IAM policies and roles, using hands on approach.
#Prerequisites:
- Basic understanding of AWS services and architecture
- Familiarity with cloud security concepts
- Experience using the AWS Management Console or AWS CLI.
- For hands on lab create account on [killercoda.com](https://killercoda.com/cloudsecurity-scenario/)
# Scenario Covered:
- Basics of IAM in AWS
- Implementing IAM Policies with Least Privilege to Manage S3 Bucket
- Objective: Create an S3 bucket with least privilege IAM policy and validate access.
- Steps:
- Create S3 bucket.
- Attach least privilege policy to IAM user.
- Validate access.
- Exploiting IAM PassRole Misconfiguration
-Allows a user to pass a specific IAM role to an AWS service (ec2), typically used for service access delegation. Then exploit PassRole Misconfiguration granting unauthorized access to sensitive resources.
- Objective: Demonstrate how a PassRole misconfiguration can grant unauthorized access.
- Steps:
- Allow user to pass IAM role to EC2.
- Exploit misconfiguration for unauthorized access.
- Access sensitive resources.
- Exploiting IAM AssumeRole Misconfiguration with Overly Permissive Role
- An overly permissive IAM role configuration can lead to privilege escalation by creating a role with administrative privileges and allow a user to assume this role.
- Objective: Show how overly permissive IAM roles can lead to privilege escalation.
- Steps:
- Create role with administrative privileges.
- Allow user to assume the role.
- Perform administrative actions.
- Differentiation between PassRole vs AssumeRole
Try at [killercoda.com](https://killercoda.com/cloudsecurity-scenario/)
Supermarket Management System Project Report.pdfKamal Acharya
Supermarket management is a stand-alone J2EE using Eclipse Juno program.
This project contains all the necessary required information about maintaining
the supermarket billing system.
The core idea of this project to minimize the paper work and centralize the
data. Here all the communication is taken in secure manner. That is, in this
application the information will be stored in client itself. For further security the
data base is stored in the back-end oracle and so no intruders can access it.
Build the Next Generation of Apps with the Einstein 1 Platform.
Rejoignez Philippe Ozil pour une session de workshops qui vous guidera à travers les détails de la plateforme Einstein 1, l'importance des données pour la création d'applications d'intelligence artificielle et les différents outils et technologies que Salesforce propose pour vous apporter tous les bénéfices de l'IA.
Discover the latest insights on Data Driven Maintenance with our comprehensive webinar presentation. Learn about traditional maintenance challenges, the right approach to utilizing data, and the benefits of adopting a Data Driven Maintenance strategy. Explore real-world examples, industry best practices, and innovative solutions like FMECA and the D3M model. This presentation, led by expert Jules Oudmans, is essential for asset owners looking to optimize their maintenance processes and leverage digital technologies for improved efficiency and performance. Download now to stay ahead in the evolving maintenance landscape.
1. Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 0/20
2. Artificial Intelligence
Artificial Intelligence
6. First Order Logic Inference
Lars Schmidt-Thieme
Information Systems and Machine Learning Lab (ISMLL)
Institute of Economics and Information Systems
& Institute of Computer Science
University of Hildesheim
http://www.ismll.uni-hildesheim.de
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 1/20
3. Artificial Intelligence
1. Unification
2. Forward Chaining
3. Backward Chaining
4. Resolution
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 1/20
4. Artificial Intelligence / 1. Unification
“Compound Expressions”
Formulas and function terms sometimes are described as
compound expressions.
For a compound formula, its operator and its arguments is
defined:
op(P(t1, . . . , tn)) := P args(P(t1, . . . , tn)) := (t1, . . . , tn)
op(f(t1, . . . , tn)) := f args(f(t1, . . . , tn)) := (t1, . . . , tn)
op(¬φ) := ¬ args(¬φ) := (φ)
op(φ ⊕ ψ) := ⊕ args(φ ⊕ ψ) := (φ, ψ), ⊕ ∈ {∧, ∨, →, ↔}
op(∀xφ) := ∀ args(∀xφ) := (x, φ)
op(∃xφ) := ∃ args(∃xφ) := (x, φ)
Atomic terms, i.e., constants and variables, are not considered
compound expressions.
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 1/20
5. Artificial Intelligence / 1. Unification
Unification / Algorithm
1 unify(x, y, θ) :
2 if θ = failure
3 return failure
4 elsif x = y
5 return θ
6 elsif is-variable(x)
7 return unify-var(x, y, θ)
8 elsif is-variable(y)
9 return unify-var(y, x, θ)
10 elsif is-compound(x) and is-compound(y)
11 return unify(args(x), args(y), unify(op(x), op(y), θ))
12 elsif is-list(x) and is-list(y)
13 return unify((x2, . . . , xn), (y2, . . ., yn), unify(x1, y1, θ))
14 else
15 return failure
16 fi
17
18 unify-var(var, x, θ) :
19 if θ(var) = ∅
20 return unify(θ(var), x, θ)
21 elsif θ(x) = ∅
22 return unify(var, θ(x), θ)
23 elsif occurs(var, x)
24 return failure
25 else
26 return θ ∪ {var → x}
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 2/20
6. Artificial Intelligence / 1. Unification
Unification / Example
unify(Knows(John, x), Knows(y, Mother(y)), ∅)
= unify((John, x), (y, Mother(y)), unify(Knows, Knows, ∅))
= unify((John, x), (y, Mother(y)), ∅)
= unify((x), (Mother(y)), unify(John, y, ∅))
= unify((x), (Mother(y)), {y/John})
= unify-var(x, Mother(y), {y/John})
= {y/John, x/Mother(y)}
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 3/20
7. Artificial Intelligence
1. Unification
2. Forward Chaining
3. Backward Chaining
4. Resolution
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 4/20
8. Artificial Intelligence / 2. Forward Chaining
Generalized Modus Ponens
premise conclusion name
F F, F F → G F G → -elimination / modus ponens
F F F Fθ universial instantiation
F F, F F → G, Fθ = F θ F Gθ generalized modus ponens
Lemma 1. Generalized modus ponens is sound.
Proof.
1. F F [assumption]
2. F Fθ [universal instantiation applied to 1]
3. F F → G [assumption]
4. F F θ → Gθ [universal instantiation applied to 3]
5. F Gθ [ → -elemination applied to 2,4]
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 4/20
9. Artificial Intelligence / 2. Forward Chaining
Generalized Modus Ponens / Example
Let the knowledge base F be
King(x) ∧ Greedy(x) → Evil(x)
King(John)
Greedy(y)
Now use
F :=King(John) ∧ Greedy(y)
F :=King(x) ∧ Greedy(x)
G :=Evil(x)
then for
θ := {x/John, y/John}
we have
Fθ = King(John) ∧ Greedy(John) = F θ
and thus we can derive
Gθ = Evil(John)
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 5/20
10. Artificial Intelligence / 2. Forward Chaining
Forward Chaining
Definitions for conjunctive normal forms (CNF), Horn clauses
and Horn formulas are the same as in propositional logic.
Here, atoms are formulas
P(t1, t2, . . . , tn)
where P is a predicate symbol and ti are any terms (including
variables).
A Horn clause C is called definite it it contains exactly one
positive literal, i.e., implications of type
(
n
i=1
¬Li) ≡(
n
i=1
Li → false)
are not possible.
If the knowledge base consists of Horn clauses only, then
generalized modus ponens can be used just like modus ponens
to infer statements iteratively by forward chaining.
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 6/20
11. Artificial Intelligence / 2. Forward Chaining
Example
The law says that it is a crime for an American to sell weapons to
hostile nations. The country Nono, an enemy of America, has
some missiles, and all of its missiles were sold to it by Colonel
West, who is American.
Prove that Col. West is a criminal.
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 7/20
12. Artificial Intelligence / 2. Forward Chaining
Example (2/4)
The law says that it is a crime for an American to sell weapons to
hostile nations.
∀American(x) ∧ Weapon(y) ∧ Hostile(z) ∧ Sell(x, y, z) → Criminal(x)
The country Nono,
Country(Nono)
an enemy of America,
Enemy(Nono, America)
has some missiles,
∃xMissile(x) ∧ Owns(Nono, x)
and all of its missiles were sold to it by Colonel West,
∀xMissile(x) ∧ Owns(Nono, x) → Sell(West, x, Nono)
who is American.
American(West)
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 8/20
13. Artificial Intelligence / 2. Forward Chaining
Example (3/4)
Additional background knowledge:
Missiles are weapons.
∀xMissile(x) → Weapon(x)
Enemies of America are hostile.
∀xEnemy(x, America) → Hostile(x)
Prove that Col. West is a criminal
Criminal(West)?
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 9/20
14. Artificial Intelligence / 2. Forward Chaining
Example (4/4)
The knowledge base can be simplified by
• existential instantiation and
• omitting universal quantifiers
(as all free variables are universally quantified anyway)
American(x) ∧ Weapon(y) ∧ Hostile(z) ∧ Sell(x, y, z) → Criminal(x)
Country(Nono)
Enemy(Nono, America)
Missile(M1) ∧ Owns(Nono, M1)
Missile(x) ∧ Owns(Nono, x) → Sell(West, x, Nono)
American(West)
Missile(x) → Weapon(x)
Enemy(x, America) → Hostile(x)
This knowledge base consists of definite Horn clauses only !
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 10/20
15. Artificial Intelligence / 2. Forward Chaining
Forward Chaining
1 entails-fc(FOL definite horn formula F, query atom Q) :
2 C := ∅
3 C′
:= clauses(F)
4 while C′
= ∅ do
5 C := C ∪ C′
6 C′
:= ∅
7 for C ∈ C do
8 C′
:= standardize-apart(C)
9 for atoms A1, A2, . . . , An ∈ C and θ with body(C′
)θ = (A1 ∧ A2 ∧ . . . ∧ An)θ do
10 H := head(C′
)θ
11 if H ∈ C and H ∈ C′
12 C′
:= C′
∪ {H}
13 if unify(H, Q) return true fi
14 fi
15 od
16 od
17 od
18 return false
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 11/20
16. Artificial Intelligence / 2. Forward Chaining
Forward Chaining / Example
Forward chaining proof
Enemy(Nono,America)Owns(Nono,M1)Missile(M1)American(West)
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 11/20
17. Artificial Intelligence / 2. Forward Chaining
Forward Chaining / Example
Forward chaining proof
Hostile(Nono)
Enemy(Nono,America)Owns(Nono,M1)Missile(M1)American(West)
Weapon(M1) Sells(West,M1,Nono)
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 11/20
18. Artificial Intelligence / 2. Forward Chaining
Forward Chaining / Example
Forward chaining proof
Hostile(Nono)
Enemy(Nono,America)Owns(Nono,M1)Missile(M1)American(West)
Weapon(M1)
Criminal(West)
Sells(West,M1,Nono)
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 11/20
19. Artificial Intelligence
1. Unification
2. Forward Chaining
3. Backward Chaining
4. Resolution
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 12/20
20. Artificial Intelligence / 3. Backward Chaining
Backward Chaining
Backward chaining works the other way around:
• keep a list of yet unsatisfied atoms Q
– starting with the query atom.
• try to find rules whichs head match atoms in Q (after
unification) and
replace the atom from Q by the atoms of the body of the
matching rule.
• proceed recursively until no more atoms have to be satisfied.
Backward chaining keeps track of the substitution needed during
the proof.
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 12/20
21. Artificial Intelligence / 3. Backward Chaining
Backward Chaining / Algorithm
1 entails-bc(FOL definite horn formula F, query atom Q) :
2 return entails-bc-goals(clauses(F), {Q}, ∅) = ∅
3
4 entails-bc-goals(set of FOL definite Horn clauses C, set of FOL atoms Q, θ) :
5 if Q = ∅ return {θ} fi
6 Θ := ∅
7 for C ∈ C do
8 C′
:= standardize-apart(C)
9 θ′
:= unify(head(C′
), Q[1]θ)
10 if θ′
= failure
11 Θ := Θ ∪ entails-bc-goals(C, atoms(body(C′
)) ∪ (Q {C}), θ ∪ θ′
)
12 fi
13 od
14 return Θ
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 13/20
22. Artificial Intelligence / 3. Backward Chaining
Backward Chaining / Example
Backward chaining example
Criminal(West)
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 13/20
23. Artificial Intelligence / 3. Backward Chaining
Backward Chaining / Example
Backward chaining example
Criminal(West)
Weapon(y)American(x) Sells(x,y,z) Hostile(z)
{x/West}
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 13/20
24. Artificial Intelligence / 3. Backward Chaining
Backward Chaining / Example
Backward chaining example
Criminal(West)
Weapon(y) Sells(x,y,z) Hostile(z)
{x/West}
{ }
American(West)
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 13/20
25. Artificial Intelligence / 3. Backward Chaining
Backward Chaining / Example
Backward chaining example
Hostile(Nono)
Criminal(West)
Missile(y)
Weapon(y) Sells(West,M1,z)American(West)
{ }
Sells(x,y,z) Hostile(z)
{x/West}
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 13/20
26. Artificial Intelligence / 3. Backward Chaining
Backward Chaining / Example
Backward chaining example
Hostile(Nono)
Criminal(West)
Missile(y)
Weapon(y) Sells(West,M1,z)American(West)
{ }
Sells(x,y,z) Hostile(z)
y/M1{ }
{x/West, y/M1}
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 13/20
27. Artificial Intelligence / 3. Backward Chaining
Backward Chaining / Example
Backward chaining example
Owns(Nono,M1)Missile(M1)
Criminal(West)
Missile(y)
Weapon(y) Sells(West,M1,z)American(West)
y/M1{ }
{ }z/Nono{ }
Hostile(z)
{x/West, y/M1, z/Nono}
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 13/20
28. Artificial Intelligence / 3. Backward Chaining
Backward Chaining / Example
Backward chaining example
Hostile(Nono)
Enemy(Nono,America)Owns(Nono,M1)Missile(M1)
Criminal(West)
Missile(y)
Weapon(y) Sells(West,M1,z)American(West)
y/M1{ } { }{ }{ }
{ }z/Nono{ }
{x/West, y/M1, z/Nono}
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 13/20
29. Artificial Intelligence / 3. Backward Chaining
Logic Programming: Prolog
Prolog: logical programming language (PROgrammation en
LOGique; Alain Colmerauer and Philippe Roussel, ca. 1972)
Allows knowlegde bases (= programs) consisting of definite Horn
clauses.
Uses depth-first, left-to-right backward chaining (with several
improvements).
Example:
evil(X) :- king(X), greedy(X).
king(john).
greedy(X).
?- evil(john)
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 14/20
30. Artificial Intelligence / 3. Backward Chaining
Negation as Failure
Prolog allows the usage of negated atoms in rule bodies
interpreting them by negation as failure:
good(X) :- not evil(X)
Now the query ?- good(richard) would evaluate to true as
the opposite, evil(richard) cannot be proved.
This is also called closed world assumption:
if a fact is not encoded in the knowledge base
and cannot be inferred,
then it is considered not to be true.
Negation as failure renders Prolog non-monotonic:
if one adds formulas to the knowledge base, inferences may
become untrue.
Example: add evil(richard) to the knowledge base,
now the query ?- good(richard) evaluates to false.
In first order logics we could not derive any conclusions about
good(richard).
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 15/20
31. Artificial Intelligence / 3. Backward Chaining
Prolog / Examples
Appending two lists to produce a third:
append(X,Y,Z) encodes that X appended to Y results in Z.
append([], Y, Y).
append([X|L], Y, [X|Z]) :- append(L, Y, Z).
query: append([1,2], [3,4], C) ?
answers: C=[1,2,3,4]
query: append(A, B, [1,2]) ?
answers: A=[] B=[1,2]
A=[1] B=[2]
A=[1,2] B=[]
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 16/20
32. Artificial Intelligence
1. Unification
2. Forward Chaining
3. Backward Chaining
4. Resolution
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 17/20
33. Artificial Intelligence / 4. Resolution
FOL Resolvents
Full first-order version:
1 ∨ · · · ∨ k, m1 ∨ · · · ∨ mn
( 1 ∨ · · · ∨ i−1 ∨ i+1 ∨ · · · ∨ k ∨ m1 ∨ · · · ∨ mj−1 ∨ mj+1 ∨ · · · ∨ mn)θ
where Unify( i, ¬mj) = θ.
For example,
¬Rich(x) ∨ Unhappy(x), Rich(Ken)
Unhappy(Ken)
with i = ¬Rich(x), mj = Rich(Ken) and θ = {x/Ken}
Apply resolution steps to CNF(KB ∧ ¬query); complete for FOL.
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 17/20
34. Artificial Intelligence / 4. Resolution
Conversion to CNF
Everyone who loves all animals is loved by
someone:∀x[∀yAnimal(y) =⇒ Loves(x, y)] =⇒ [∃yLoves(y, x)]
1. Eliminate biconditionals and implications
∀x[¬∀y¬Animal(y) ∨ Loves(x, y)] ∨ [∃yLoves(y, x)]
2. Move ¬ inwards: ¬∀x, p ≡ ∃x¬p, ¬∃x, p ≡ ∀x¬p:
∀x[∃y¬(¬Animal(y) ∨ Loves(x, y))] ∨ [∃yLoves(y, x)]
∀x[∃y¬¬Animal(y) ∧ ¬Loves(x, y)] ∨ [∃yLoves(y, x)]
∀x[∃yAnimal(y) ∧ ¬Loves(x, y)] ∨ [∃yLoves(y, x)]
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 18/20
35. Artificial Intelligence / 4. Resolution
Conversion to CNF
3. Standardize variables: each quantifier should use a different
one
∀x[∃yAnimal(y) ∧ ¬Loves(x, y)] ∨ [∃zLoves(z, x)]
4. Skolemize: a more general form of existential instantiation.
Each existential variable is replaced by a Skolem function
of the enclosing universally quantified variables:
∀x[Animal(F(x)) ∧ ¬Loves(x, F(x))] ∨ Loves(G(x), x)
5. Drop universal quantifiers:
[Animal(F(x)) ∧ ¬Loves(x, F(x))] ∨ Loves(G(x), x)
6. Distribute ∧ over ∨:
[Animal(F(x))∨Loves(G(x), x)]∧[¬Loves(x, F(x))∨Loves(G(x), x)]
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 19/20
36. Artificial Intelligence / 4. Resolution
Resolution / Example
Resolution proof: definite clauses
American(West)
Missile(M1)
Missile(M1)
Owns(Nono,M1)
Enemy(Nono,America) Enemy(Nono,America)
Criminal(x)Hostile(z)
L
Sells(x,y,z)
L
Weapon(y)
L
American(x)
L
>
>
>
>
Weapon(x)Missile(x)L
>
Sells(West,x,Nono)Missile(x)
L
Owns(Nono,x)
L
>
>
Hostile(x)Enemy(x,America)
L
>
Sells(West,y,z)
L
Weapon(y)
L
American(West)
L
>
>
Hostile(z)
L
>
Sells(West,y,z)
L
Weapon(y)
L
>
Hostile(z)
L
>
Sells(West,y,z)
L
>
Hostile(z)
L
>
L
Missile(y)
Hostile(z)
L
>
L
Sells(West,M1,z)
>
>
L
Hostile(Nono)
L
Owns(Nono,M1)
L
Missile(M1)
>
L
Hostile(Nono)L Owns(Nono,M1)
L
Hostile(Nono)
Criminal(West)
L Chapter 9 46
Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany,
Course on Artificial Intelligence, winter term 2012/2013 20/20