Ai Notes
Ai Notes
1. Introduction
o Overview of Prolog and Logic Programming
o Importance of AI and Expert Systems
2. Prolog Programming Language
o 2.1 Operators in Prolog
2.1.1 Dot (.)
2.1.2 Semicolon (;)
2.1.3 Colon (:-)
2.1.4 Underscore (_)
o 2.2 Characteristics of Agents
o 2.3 Goal State Definition
3. Knowledge Representation in Expert Systems
o 3.1 Factual vs. Heuristic Knowledge
o 3.2 Search Algorithms
3.2.1 Pathfinding Algorithms
o 3.3 Heuristics
o 3.4 Reasoning Approaches
3.4.1 Forward vs. Backward Reasoning
4. Natural Language Processing Applications
o 4.1 Applications in Academia
5. Search Techniques
o 5.1 Greedy Best-First Search vs. A* Search
o 5.2 Logical Inference and Deduction
o 5.3 AI System Applications
5.3.1 Multi-layer Perceptron
5.3.2 Case-Based Reasoning Systems
6. Graph Search Algorithms
o 6.1 Hill Climbing
o 6.2 Depth-Limited Search
o 6.3 Uninformed Search
7. Expert Systems Design
o 7.1 Components of an Expert System
o 7.2 Application of Expert System Rules
8. A Algorithm Application*
o 8.1 Route Finding Example
o 8.2 Understanding Admissible Heuristics
9. First Order Predicate Logic (FOPL)
o 9.1 Role in AI
o 9.2 Knowledge Representation Examples
10. Intelligent Agents
o 10.1 Types of Agents
o 10.2 PEAS Description for Agents
1. Introduction
Artificial Intelligence (AI) is a branch of computer science that focuses on creating systems
capable of performing tasks that typically require human intelligence. Logic programming
languages, such as Prolog, play a critical role in AI, particularly in the development of expert
systems. These systems utilize knowledge representation and reasoning techniques to mimic
human decision-making.
2.1.1 Dot (.): The dot operator indicates the end of a statement or rule in Prolog. For
example:
prolog
Copy code
loves(john, mary).
2.1.2 Semicolon (;): This operator acts as a logical OR in Prolog. It is used to separate
alternative solutions or goals. For instance:
prolog
Copy code
loves(john, mary); loves(john, sue).
2.1.3 Colon (:-): The colon is used to define rules in Prolog, indicating that the left side is
true if the right side (the body) is true. For example:
prolog
Copy code
loves(john, mary) :- likes(john, mary).
prolog
Copy code
loves(_, mary).
1. Autonomy: Agents operate without human intervention. They perceive their environment
and make decisions based on their programming.
2. Reactivity: Agents respond to changes in their environment, allowing them to adapt their
behavior as necessary.
A goal state is a specific condition that an agent aims to achieve during its operation. For
example, in a puzzle-solving AI, the goal state might be the completed arrangement of puzzle
pieces.
Algorithms like Dijkstra’s or A* are commonly used to find the shortest path in graph structures.
A simple implementation of a breadth-first search algorithm could look like:
python
Copy code
def bfs(graph, start):
visited = set()
queue = [start]
while queue:
vertex = queue.pop(0)
if vertex not in visited:
visited.add(vertex)
queue.extend(set(graph[vertex]) - visited)
return visited
3.3 Heuristics
Forward Reasoning: This starts with the known facts and applies rules to infer new
facts. For instance, if “all humans are mortal” and “Socrates is a human,” forward
reasoning concludes that “Socrates is mortal.”
Backward Reasoning: This begins with the goal and works backward to find supporting
facts. For example, to prove “Socrates is mortal,” one would seek to verify that he is a
human.
1. Academic Writing Assistance: Tools that help students and faculty improve their
writing by providing grammar checks and style suggestions.
2. Chatbots for Student Support: Intelligent agents that interact with students to answer
common inquiries regarding admissions, course registrations, and more.
3. Sentiment Analysis on Course Feedback: Analyzing student feedback to improve
course content and delivery by understanding student sentiments.
5. Search Techniques
5.1 Greedy Best-First Search vs. A* Search
The Greedy Best-First Search algorithm evaluates nodes based solely on their estimated cost to
reach the goal (using the heuristic), while the A* Search incorporates both the cost to reach the
node and the estimated cost to the goal. A* is more efficient as it guarantees finding the shortest
path if the heuristic is admissible.
Logical inference involves deriving new facts from known facts using rules of inference. For
example, in propositional logic:
Modus Ponens: If "P implies Q" and "P is true," then "Q must also be true."
5.3.1 Multi-layer Perceptron: Often used in deep learning for tasks such as image
classification. For instance, a university can utilize it to automate the categorization of
student applications based on various attributes.
5.3.2 Case-Based Reasoning Systems: This system uses past cases to solve new
problems, ideal for legal or medical applications in a university’s research settings.
6. Graph Search Algorithms
6.1 Hill Climbing
Hill Climbing is a local search algorithm that continuously moves towards the direction of
increasing value (i.e., uphill) until no further improvements can be made. It is simple but can get
stuck in local maxima.
Depth-Limited Search is a variant of Depth-First Search that limits the depth of the search tree. It
is useful in scenarios where the search space is large, and you want to avoid getting lost in deep
paths.
Uninformed search strategies do not have additional information about the goal. Examples
include Breadth-First Search (BFS) and Depth-First Search (DFS), where the algorithm explores
all nodes at the present depth before moving on to the nodes at the next depth level.
Rules such as those provided in the question can help guide investment decisions in a financial
expert system. By employing forward and backward chaining methods, the system can deduce
investment strategies based on user input and predefined rules.
8. A* Algorithm Application
8.1 Route Finding Example
An admissible heuristic is one that never overestimates the cost to reach the goal. This property
is crucial because it ensures that the A* algorithm is optimal, meaning it will always find the
least-cost path if one exists.
FOPL extends propositional logic by allowing the use of quantifiers and predicates, making it
more expressive for representing knowledge in AI systems. It can capture relationships and
properties of objects effectively.
1. Simple Reflex Agents: Act on the current percept, following rules based on the current
state. N
2. Model-Based Reflex Agents: Maintain an internal state to represent the world.
3. Goal-Based Agents: Act to achieve specific goals, considering future actions.
4. Utility-Based Agents: Choose actions based on a utility function that quantifies the
preferences of the outcomes.