Artificial Intelligence 2 Units Notes-1
Artificial Intelligence 2 Units Notes-1
5. Heuristic Reasoning............................................................................................... 39
6. Fuzzy Logic............................................................................................................ 39
7. Default Reasoning..................................................................................................39
8. Commonsense Reasoning..................................................................................... 40
Comparison of Deductive and Non-Deductive Methods.................................................. 40
Conclusion........................................................................................................................40
Inconsistencies and Uncertainties in Truth Maintenance Systems (TMS)-.................... 41
Key Concepts................................................................................................................... 41
1. Inconsistencies in TMS.......................................................................................... 41
Example of Inconsistency:..........................................................................................41
2. Uncertainties in TMS.............................................................................................. 41
Example of Uncertainty:............................................................................................. 41
How TMS Handles Inconsistencies and Uncertainties.....................................................41
1. Assumption-Based Truth Maintenance System (ATMS)........................................ 42
2. Justification-Based Truth Maintenance System (JTMS).........................................42
3. Probabilistic TMS (PTMS)...................................................................................... 42
Default Reasoning and Closed World Assumption-......................................................... 43
1. Default Reasoning........................................................................................................43
Definition:................................................................................................................... 43
Key Features:............................................................................................................. 43
Example:.................................................................................................................... 43
Applications:............................................................................................................... 43
Challenges:................................................................................................................ 43
2. Closed World Assumption (CWA)................................................................................ 44
Definition:................................................................................................................... 44
Key Features:............................................................................................................. 44
Example:.................................................................................................................... 44
Applications:............................................................................................................... 44
Challenges:................................................................................................................ 44
Comparison Between Default Reasoning and CWA........................................................ 45
Model and Temporary Logic in Artificial Intelligence-...................................................... 46
In artificial intelligence (AI) and knowledge representation, models and temporary logic
(also known as temporal logic) are two essential concepts used to reason about the
world and handle changes or states over time.................................................................46
Model................................................................................................................................46
Key Features of a Model:........................................................................................... 46
Types of Models in AI:................................................................................................ 46
Applications:............................................................................................................... 46
Temporal Logic................................................................................................................. 46
Key Features of Temporal Logic:................................................................................47
Temporal Operators:...................................................................................................47
UNIT 1
4
1. Learning: AI systems can improve over time through machine learning (ML), where
they learn patterns from data.
2. Reasoning: AI can make decisions or predictions based on logical rules or learned
patterns.
3. Adaptation: It adjusts to new inputs and situations dynamically.
4. Automation: AI performs repetitive or complex tasks without constant human
intervention.
Categories of AI:
1. Narrow AI: Specialized systems that perform a single task (e.g., virtual assistants
like Amazon Alexa, Siri).
2. General AI: A theoretical form of AI capable of performing any intellectual task that
humans can do.
3. Superintelligent AI: Hypothetical AI that surpasses human intelligence in virtually
every field.
Applications of AI:
Benefits of AI:
Challenges:
1. Perception: Like how humans see, hear, and recognize patterns, AI uses sensors
(like cameras and microphones) to understand the environment (e.g., object
recognition in images).
2. Learning: Similar to how humans learn from experience, AI can improve its
performance by analyzing data (using machine learning algorithms). For example,
AI can get better at recognizing faces after seeing many examples.
3. Reasoning and Problem-Solving: AI can solve problems or make decisions based
on rules and patterns. It's similar to how humans reason through a problem, such as
making decisions based on available information.
4. Memory: Like how we store and retrieve past experiences, AI systems can store
data and use it to make decisions or predictions.
5. Language Understanding: Just as humans understand and generate speech, AI
uses natural language processing (NLP) to understand and communicate with
humans in natural language (e.g., Siri or Google Assistant).
In summary, AI tries to emulate how humans think and act by creating systems that can
perceive, learn, reason, and make decisions, much like our own cognitive abilities.
7
1. Search Space: The space of possible solutions or decisions an AI can explore. For
example, in a chess game, the search space is all the possible moves from any given
position.
2. Efficiency vs. Completeness: When an AI searches for a solution, it can either:
○ Be exhaustive (searching through all possible options for the best solution),
but this can be time-consuming and computationally expensive.
○ Use shortcuts (like heuristics, which are rules of thumb) to speed up the
search, but this may miss the best solution.
3. Trade-off: If you use too much knowledge and search too deeply (exhaustive
search), it can be slow and computationally expensive. If you simplify the search
(using less knowledge or heuristics), the solution may not be the best one.
Example:
● Chess AI: A chess-playing AI could search every possible move (exhaustive) to find
the best one, but this would take a long time. Alternatively, it could use heuristics
(rules like "control the center of the board") to make decisions more quickly, but it
might not always find the best possible move.
The Trade-off:
● More Knowledge = Slower Search: The more knowledge (or options) the AI has to
consider, the longer it takes to process and find the optimal solution.
● Less Knowledge = Faster Search, Possible Suboptimal Solution: Reducing the
knowledge or the depth of search speeds up the process, but it might lead to a
less-than-optimal decision.
In practice, AI systems aim to strike a balance, where they use enough knowledge and
search depth to make good decisions without overwhelming computational resources.
8
1. Facts and Data: Raw data that the AI system has gathered, such as numbers,
measurements, or observations. For example, a recommendation system for movies
might store user preferences and ratings.
2. Rules and Heuristics: Predefined logic or guidelines used by AI to make decisions.
For instance, an expert system might store rules like "If the weather is rainy, wear a
raincoat."
3. Knowledge Base: A collection of information that the AI system uses to perform
tasks. It can be structured (like a database) or unstructured (like text). For example,
medical diagnosis systems might store a vast knowledge base of symptoms,
diseases, and treatments.
4. Memory and Experience: AI systems can learn and store experiences from
interactions, improving their performance over time. For example, machine learning
models store patterns and insights derived from historical data to predict future
outcomes.
5. Representations: AI stores knowledge in various representations, such as semantic
networks (a web of interconnected concepts), decision trees (used for classification
or decision-making), or neural networks (used to recognize patterns from data).
1. Declarative Knowledge: Information about "what" something is. For example, "The
Eiffel Tower is in Paris."
2. Procedural Knowledge: Information about "how" to do something. For example, "To
solve a quadratic equation, apply the quadratic formula."
Benefits:
Semantic nets-
Semantic Networks | Artificial Intelligence | Components | Knowledge Representation -…
Key Components:
Example:
In this example:
● The node "Dog" is connected to "Animal" via the edge "is a", indicating that a dog is a
type of animal.
● "Dog" is connected to "Tail" via the edge "has", showing that dogs have tails.
● "Dog" is connected to "Bark" via the edge "can", showing that dogs can bark.
Benefits:
Challenges:
● Scalability: As the knowledge base grows, managing large and complex networks
becomes difficult.
● Ambiguity: The meaning of certain relationships can be ambiguous, and
representing complex, subtle connections might require additional structures or
methods.
11
Modeling Process:
1. Problem Definition: Define what you want the model to solve or predict.
2. Data Collection: Gather relevant data for training and testing the model.
3. Model Design: Decide which type of model to use and how to represent the data.
4. Training and Validation: Train the model on data, validate its performance, and
adjust as necessary.
5. Deployment: Use the model in real-world scenarios to make predictions or
decisions.
Example of Modeling:
● Self-Driving Car: The AI model might represent the car’s environment (road,
pedestrians, other vehicles) using sensors and cameras. It learns through experience
(data) and optimizes driving behavior to avoid collisions and follow traffic rules.
In Simple Terms:
● Modeling in AI is like building a "map" of the world or problem you want the AI to
understand. You simplify and abstract the complex reality into something the system
can work with, and the AI uses this model to make decisions or predictions.
12
Elementary knowledge refers to the basic, fundamental concepts or facts that are essential
for understanding more complex ideas in AI. It forms the building blocks for more advanced
topics and helps in creating simple AI systems.
Data is the raw input for AI systems. It can come in many forms such as numbers,
images, text, or sounds. AI uses data to learn and make decisions.
Example: Data about customer purchases helps AI predict what products might interest
other customers.
2. Algorithms:
Machine Learning is a type of AI where machines learn from data without being explicitly
programmed. They find patterns or regularities in data and use them to make predictions or
decisions.
Example: A spam filter learns to recognize spam emails by analyzing data from previously
marked emails.
4. Model:
5. Neural Networks:
Neural Networks are a type of machine learning model inspired by how the human brain
works. They are particularly good at recognizing patterns in large amounts of data, like
images or speech.
Example: Neural networks help recognize handwritten digits in postal codes or classify
images as "cats" or "dogs."
6. Supervised Learning:
13
In supervised learning, AI learns from labeled data. It is provided with input-output pairs
and learns the mapping between them.
Example: A facial recognition system is trained on images with labels like "John" or
"Jane."
7. Unsupervised Learning:
Unsupervised learning involves learning patterns from data without labeled output. The AI
system tries to find hidden structures in the data.
Example: A clustering algorithm groups customers into similar categories based on
purchasing behavior.
1. Propositional Logic:
○ In propositional logic, statements (propositions) can be either true or false.
The goal is to combine and manipulate these propositions using logical
operators like AND, OR, NOT, etc.
○ Example:
■ "It is raining" (True) AND "I have an umbrella" (True) → "I am
prepared" (True).
○ Operators:
■ AND ( ∧ ): Both conditions must be true for the whole expression to
be true.
■ OR ( ∨ ): At least one condition must be true for the whole expression
to be true.
■ NOT ( ¬ ): Reverses the truth value of a condition.
2. Predicate Logic:
○ Predicate logic extends propositional logic by dealing with predicates,
variables, and quantifiers (like "for all" or "there exists"). It allows for more
complex statements about objects and their properties.
○ Example: "All humans are mortal." In logic, this might be written as:
■ ∀x (Human(x) → Mortal(x)), meaning "For all x, if x is a human, then x
is mortal."
○ This type of logic is useful for representing real-world knowledge and
reasoning about entities, relationships, and conditions.
3. Logical Inference:
○ Inference is the process of deriving new knowledge or conclusions from
known facts using logical rules.
○ Example:
■ Fact 1: "All cars have wheels."
■ Fact 2: "My car is a vehicle."
Logical Connectives:
Logical connectives are used to connect two simpler propositions or representing a sentence
logically. We can create compound propositions with the help of logical connectives. There
are mainly five connectives, which are given as follows:
Truth Table:
In propositional logic, we need to know the truth values of propositions in all possible
scenarios. We can combine all the possible combination with logical connectives, and the
representation of these combinations in a tabular format is called Truth table. Following are
the truth table for all logical connectives:
17
18
Predicate Logic:
Predicate Logic (also known as First-Order Logic) is an extension of propositional logic
that allows us to express statements involving objects, their properties, and relationships
between them. While propositional logic is limited to simple true/false propositions, predicate
logic provides a more powerful framework for expressing more complex logical statements.
1. Predicates:
○ A predicate is a function that takes one or more arguments and returns a
truth value (true or false).
○ Predicates represent properties or relations between objects.
○ Example: "isTall(x)" could be a predicate that says whether an object x is tall.
2. Variables:
○ Variables (like x, y, z) are used to represent objects or individuals in a
domain.
○ They are placeholders that can be replaced by specific values or entities.
3. Constants:
○ A constant represents a specific, unchanging object or entity in the domain.
○ Example: "John" could be a constant representing a specific person.
4. Quantifiers:
○ Universal Quantifier (∀): Indicates that a statement is true for all possible
values of a variable.
■ Example: ∀x (Human(x) → Mortal(x)) means "All humans are
mortal."
○ Existential Quantifier (∃): Indicates that there exists at least one value of a
variable for which the statement is true.
■ Example: ∃x (Cat(x) ∧ LovesFish(x)) means "There exists at least
one cat that loves fish."
5. Logical Connectives:
○ Just like propositional logic, predicate logic uses logical connectives such as
AND (∧), OR (∨), NOT (¬), IMPLIES (→), and IF AND ONLY IF (↔) to
combine statements and form complex expressions.
19
1. Knowledge Organization:
1. Knowledge Representation:
○ Knowledge representation is the process of encoding real-world knowledge
in a form that an AI system can use. It involves choosing the right structure to
represent facts, relationships, and entities.
○ Common methods of knowledge representation include:
■ Logic-based Representation: Using propositional and predicate logic
to represent knowledge, which allows formal reasoning.
■ Semantic Networks: Using a graph structure where nodes represent
concepts, and edges represent relationships between them.
■ Frames: Organizing knowledge into structured objects that represent
concepts and their associated properties.
■ Ontologies: A formal representation of knowledge that defines
concepts and the relationships between them in a specific domain.
■ Scripts and Schemas: Representing common sequences of events
or actions (like a "going to a restaurant" script).
2. Taxonomy:
○ A taxonomy is a hierarchical classification system that groups knowledge
into categories based on shared characteristics.
○ Example: In a biological classification system, animals might be categorized
into mammals, birds, fish, etc.
3. Hierarchical Models:
○ In this approach, knowledge is organized in layers of increasing abstraction.
For example, a hierarchy in AI might organize concepts from specific
instances to general categories.
○ Example: "Animal → Mammal → Dog → Golden Retriever."
4. Conceptual Graphs:
○ These are graphical representations of knowledge that capture concepts and
their relationships in a visual format.
○ They allow AI systems to represent and reason about concepts (such as
"person", "action", or "event") and their attributes or relations (like "John runs"
or "Mary loves pizza").
5. Associative Networks:
20
2. Knowledge Manipulation:
Knowledge manipulation refers to the processes by which AI systems use, process, and
infer new knowledge from the organized data. This includes reasoning, problem-solving,
learning, and decision-making.
1. Reasoning:
○ Reasoning is the process by which an AI system draws conclusions from
existing knowledge.
○ Types of reasoning:
■ Deductive Reasoning: From general facts to specific conclusions.
(E.g., "All humans are mortal, Socrates is human, therefore Socrates
is mortal.")
■ Inductive Reasoning: From specific facts to general conclusions.
(E.g., "I have seen 10 white swans, therefore all swans must be
white.")
■ Abductive Reasoning: Involves finding the most likely explanation for
a set of observations. (E.g., "The ground is wet, the most likely
explanation is that it rained.")
○ Inference Engines are used to perform reasoning in AI systems, helping the
system draw conclusions based on a knowledge base.
2. Problem-Solving:
○ AI systems use organized knowledge to solve problems. This process
involves breaking down a problem into smaller components and using
available knowledge to find solutions.
○ Techniques include:
■ Search Algorithms: Such as depth-first search, breadth-first search,
and A* search, which explore possible solutions systematically.
■ Heuristic Methods: Using "rules of thumb" to make decisions based
on experience or patterns.
3. Learning:
○ Machine Learning (ML): AI systems learn patterns from data and improve
over time without explicit programming. This involves manipulating large
datasets to extract useful knowledge and update models.
○ Types of Learning:
■ Supervised Learning: The system is trained on labeled data and
learns to map input to output.
■ Unsupervised Learning: The system learns patterns from unlabeled
data (e.g., clustering or dimensionality reduction).
■ Reinforcement Learning: The system learns by interacting with an
environment and receiving feedback in the form of rewards or
penalties.
21
4. Decision-Making:
○ AI systems use knowledge to make decisions. This could involve reasoning
about potential outcomes, weighing risks, and choosing the best course of
action.
○ Common decision-making models include:
■ Decision Trees: A tree-like structure where each node represents a
decision and branches represent possible outcomes.
■ Markov Decision Processes (MDPs): A mathematical model used
for decision-making in environments with uncertainty and
randomness.
■ Game Theory: A framework for understanding strategic
decision-making, particularly in multi-agent environments.
5. Natural Language Processing (NLP):
○ AI systems use knowledge manipulation to understand, interpret, and
generate human language.
○ NLP tasks like parsing, information extraction, and machine translation
involve organizing knowledge about language structure and meaning and
manipulating it to achieve desired outcomes.
6. Expert Systems:
○ Expert systems are AI systems that manipulate organized knowledge to
mimic the decision-making ability of a human expert. They rely on a
knowledge base of facts and rules to make inferences and solve specific
problems in fields like medicine, engineering, and finance.
22
Knowledge Acquisition
Knowledge Acquisition in AI refers to the process of gathering and collecting knowledge
from various sources to create or enhance an AI system's knowledge base. It involves
obtaining both explicit knowledge (e.g., facts, rules, and data) and implicit knowledge
(e.g., experience, intuition) to make AI systems capable of reasoning, decision-making, and
problem-solving.
1. Sources of Knowledge:
○ Human Experts: Knowledge can be obtained from people who are experts in
a particular domain. This might involve interviewing experts, reading
literature, or observing their decisions.
○ Existing Databases and Knowledge Bases: Many AI systems acquire
knowledge from existing structured data sources, such as relational
databases, ontologies, or knowledge graphs.
○ Documents and Text: AI can extract knowledge from texts, articles, and
other documents using Natural Language Processing (NLP) techniques.
○ Experience: Knowledge can be gathered through interaction with the
environment (e.g., reinforcement learning or expert systems).
○ Sensors and Real-World Data: AI systems can acquire knowledge from data
captured through sensors or online data sources (such as weather data or IoT
devices).
2. Methods of Knowledge Acquisition: Knowledge acquisition can be performed
through various techniques. These techniques can be broadly classified into manual
methods, automatic methods, and semi-automatic methods.
○ Manual Knowledge Acquisition:
■ Expert Interviews: Directly interviewing domain experts to gather
facts, rules, and heuristics.
■ Observation: Observing experts or practitioners to capture implicit
knowledge based on experience.
■ Surveys and Questionnaires: Asking targeted questions to experts
or users to gather information.
■ Knowledge Engineering: Manually designing the knowledge base,
sometimes with the help of knowledge engineers who understand both
the problem domain and AI system design.
○ Automatic Knowledge Acquisition:
■ Machine Learning: AI systems can learn from data using algorithms
like decision trees, neural networks, and clustering techniques. This is
an example of automatic knowledge acquisition from large datasets.
■ Data Mining: AI systems can automatically extract useful knowledge
from large datasets using techniques like classification, regression,
association rules, or clustering.
■ Natural Language Processing (NLP): AI can analyze and extract
useful information from textual data, such as extracting entities and
relationships from unstructured text (e.g., articles, social media posts).
23
Summary:
1. Symbolic Processing:
○ AI often deals with symbols, rather than numbers, to represent knowledge,
logic, and reasoning.
○ LISP excels at manipulating symbolic data, such as symbols and
expressions, making it ideal for tasks like natural language processing,
theorem proving, and expert systems.
2. Recursive Functions:
○ Many AI problems, such as tree traversal or search algorithms, are naturally
recursive.
○ LISP’s syntax and structure make it easy to implement and debug recursive
algorithms.
3. Dynamic Typing:
○ In AI, systems often deal with diverse types of data.
○ LISP’s dynamic typing allows variables to hold any type of data, adapting to
changing requirements in AI models.
4. Flexible Syntax:
○ LISP’s syntax is simple and uniform, allowing programs to manipulate their
own code.
○ This makes it easy to create AI programs that modify themselves or learn new
rules dynamically.
5. Garbage Collection:
○ Automatic memory management enables AI programs to handle large
amounts of dynamically generated data without worrying about memory
allocation or deallocation.
6. First-Class Functions:
○ Functions in LISP are treated as first-class citizens, meaning they can be
passed as arguments, returned as values, or stored in data structures.
○ This is crucial for AI tasks, such as defining and applying rules dynamically.
7. Prototyping and Experimentation:
○ LISP’s interactive environment (REPL - Read-Eval-Print Loop) supports rapid
prototyping and testing, which is essential for AI researchers to experiment
with new algorithms and ideas.
Applications of LISP in AI
25
1. Expert Systems:
○ Early AI expert systems, like MYCIN (a medical diagnostic system), were built
using LISP.
○ These systems encoded knowledge in the form of rules and performed
reasoning using symbolic data.
2. Natural Language Processing (NLP):
○ LISP was used in early NLP systems for tasks like parsing, sentence
generation, and machine translation.
○ Its symbolic processing capabilities made it well-suited for representing and
manipulating language constructs.
3. Theorem Proving:
○ AI systems that solve logical proofs or perform formal reasoning were
implemented in LISP.
○ For example, the Logic Theorist, one of the first AI programs, used symbolic
reasoning to prove mathematical theorems.
4. Robotics:
○ Early robotics systems used LISP for high-level reasoning, such as path
planning, rule-based decision-making, and symbolic representation of the
environment.
5. Machine Learning:
○ Although less common now, LISP was used for early implementations of
learning algorithms because of its flexibility and support for recursive
functions.
6. Knowledge Representation:
○ AI systems often need to represent and manipulate knowledge, such as
ontologies, taxonomies, and knowledge graphs.
○ LISP’s ability to define symbolic relationships and rules made it ideal for these
tasks.
26
Syntax of LISP
LISP has a simple and unique syntax based on S-expressions (symbolic expressions).
Everything in LISP, from data structures to code, is represented in parentheses.
1. Parentheses:
○ LISP uses fully parenthesized prefix notation.
○ Example: (+ 1 2) means "add 1 and 2."
2. Atoms:
○ Atoms are the simplest elements in LISP and include:
■ Numbers: 42, 3.14
■ Strings: "hello"
■ Symbols: x, my-var
3. Lists:
○ A list is a sequence of elements (atoms or other lists) enclosed in
parentheses.
○ Example: (1 2 3) or (x y z)
4. Functions:
○ Functions are written in the form:
Relational Operators:
These operators compare two numbers and return T (true) or NIL (false).
Equal:
Example:
(= 5 5) ; Result: T
Not Equal:
Example:
(/= 5 3) ; Result: T
Greater Than:
Example:
27
(> 7 3) ; Result: T
Less Than:
Example:
(< 3 7) ; Result: T
Example:
(>= 5 5) ; Result: T
Example:
(<= 4 6) ; Result: T
28
LISP and Prolog are both high-level programming languages commonly used in Artificial
Intelligence (AI). However, they differ significantly in terms of paradigm, syntax, and their
approach to solving problems. Here's a comparison:
1. Programming Paradigm
● LISP:
○ Primarily a functional programming language.
○ Focuses on recursive functions, symbolic computation, and list manipulation.
○ Developers explicitly define procedures or algorithms.
● Prolog:
○ A logic programming language.
○ Focuses on declarative programming, where the programmer specifies
what the solution is, not how to compute it.
○ The system derives solutions using rules and facts through automated
reasoning (backtracking).
2. Syntax
● LISP:
○ Uses prefix notation with extensive use of parentheses.
○ Syntax is highly uniform and uses S-expressions for both code and data.
Prolog:
3. Problem-Solving Approach
● LISP:
○ Problems are solved through procedures and functions explicitly defined by
the programmer.
○ It supports iterative and recursive approaches.
● Prolog:
○ Problems are solved through logic inference.
○ Prolog uses a knowledge base of facts and rules, then searches for a
solution using backward chaining and unification.
4. Core Applications
29
● LISP:
○ Widely used for symbolic computation and problems requiring dynamic
data structures.
○ Common in areas like:
■ Natural Language Processing (NLP)
■ Expert Systems
■ Machine Learning (historical relevance)
● Prolog:
○ Ideal for logical reasoning, knowledge representation, and problems
requiring rule-based inference.
○ Common in:
■ Expert Systems
■ Theorem Proving
■ Semantic Web and Ontologies
5. Execution Model
● LISP:
○ Programs execute as sequences of function calls and expressions.
○ Uses an interpreter or compiler for execution.
● Prolog:
○ Prolog employs a goal-driven execution model.
○ It resolves goals (queries) by applying rules and facts through backtracking.
6. Strengths
● LISP:
○ Highly flexible and extensible.
○ Powerful for recursive algorithms and symbolic computation.
○ Suitable for programs requiring self-modification or dynamic rule creation.
● Prolog:
○ Naturally suited for problems involving logical reasoning, constraint solving,
and relational data.
○ Easier for modeling real-world problems with rules and relationships.
7. Weaknesses
● LISP:
○ Requires a procedural approach, which can be less intuitive for certain logical
problems.
○ Syntax can be verbose and challenging for beginners due to excessive
parentheses.
30
● Prolog:
○ Less efficient for numeric computation or procedural tasks.
○ Debugging can be challenging, especially in complex rule bases.
31
1. Input Operations
● read: Reads a single LISP object (e.g., number, symbol, or list) from the input.
2. Output Operations
● The let construct allows you to declare local variables and their values within a
specific scope.
● Syntax:
1. Interaction in LISP
Interaction in LISP refers to taking input from the user and providing output dynamically. This
is commonly achieved using I/O functions like read, read-line, write, write-line,
and format.
(defun ask-for-name ()
(ask-for-name)
Explanation:
1. format t: This prints to the console. The t specifies the output stream (t refers to
standard output).
○ "What is your name?": The prompt to display.
○ "Hello, ~a!": Uses ~a as a placeholder to insert the value of name.
2. read-line: Captures the input entered by the user as a string.
3. let: Creates a local variable name to hold the user's input.
4. ~%: Prints a newline character for better formatting in output.
Hello, Alice!
33
2. Recursion in LISP
A property list (plist) in LISP is a list where keys and values alternate, often used for simple
key-value data storage. For example:
1. Python: Dictionaries
○ A dictionary is Python's built-in key-value pair data structure, similar to a plist.
python
plist = {"name": "Alice", "age": 25, "city": "New York"}
2.
3. JavaScript: Objects
○ JavaScript objects serve as key-value stores, similar to property lists.
javascript
let plist = { name: "Alice", age: 25, city: "New York" };
4.
5. Ruby: Hash
○ Ruby's Hash is a key-value data structure akin to a plist.
6. ruby
plist = { name: "Alice", age: 25, city: "New York" }
2. Array Alternatives
Arrays in LISP are flexible multi-dimensional structures, often initialized and accessed with
built-in functions like make-array and aref.
1. Python: Lists
○ Python lists serve as dynamic arrays for holding sequential data.
python
array = [1, 2, 3, 4]
35
2.
3. JavaScript: Arrays
○ JavaScript provides dynamic arrays with built-in methods.
javascript
let array = [1, 2, 3, 4];
let element = array[0];
4.
5. Ruby: Arrays
○ Ruby arrays work much like Python lists.
ruby
array = [1, 2, 3, 4]
6. element = array[0]
36
Examples of WFFs:
1. Atomic Formulae:
○ The simplest WFFs are atomic formulae, such as P(x)P(x)P(x) or QQQ.
○ They contain no logical connectives.
2. Compound Formulae:
○ Constructed by combining atomic formulae with logical connectives.
○ Example: P∧QP \wedge QP∧Q, ¬P\neg P¬P, P→QP \rightarrow QP→Q.
3. Quantifiers:
○ Use of universal (∀\forall∀) or existential (∃\exists∃) quantifiers.
○ Example: ∀x(P(x)→Q(x))\forall x (P(x) \rightarrow Q(x))∀x(P(x)→Q(x)).
4. Parentheses:
○ Parentheses are used to clarify the precedence of operations.
○ Example: P∧(Q∨R)P \wedge (Q \vee R)P∧(Q∨R) is different from
(P∧Q)∨R(P \wedge Q) \vee R(P∧Q)∨R.
1. Logical Connectives:
○ ¬\neg¬: Negation (not)
○ ∧\wedge∧: Conjunction (and)
○ ∨\vee∨: Disjunction (or)
○ →\rightarrow→: Implication (if-then)
○ ↔\leftrightarrow↔: Biconditional (if and only if)
2. Quantifiers:
37
Non-deductive inference methods involve reasoning processes where the conclusions are
not guaranteed to be true, even if the premises are true. Instead, these methods provide
conclusions that are probable, plausible, or likely based on the evidence. Unlike
deductive reasoning, which is strictly logical and guarantees certainty, non-deductive
reasoning accommodates uncertainty and incomplete information.
1. Inductive Reasoning
2. Abductive Reasoning
● Definition: Starts with an observation and seeks the most likely explanation.
● Key Feature: Often referred to as "inference to the best explanation."
● Example:
○ Observation: The ground is wet.
○ Possible Explanations:
1. It rained.
2. Someone spilled water.
○ Conclusion: It likely rained (the most plausible explanation).
● Use in AI: Diagnostic systems (e.g., medical diagnosis or fault detection) use
abduction to find probable causes for observed symptoms or failures.
3. Analogical Reasoning
4. Statistical Reasoning
5. Heuristic Reasoning
6. Fuzzy Logic
● Definition: Reasoning based on degrees of truth rather than binary true/false values.
● Key Feature: Handles uncertainty and vagueness.
● Example:
○ Premise: The weather is "somewhat hot."
○ Conclusion: It’s likely summer, but not guaranteed.
● Use in AI: Fuzzy control systems are used in appliances like washing machines and
air conditioners to handle vague inputs.
7. Default Reasoning
8. Commonsense Reasoning
Example All humans are mortal. Socrates is a Most humans enjoy music. John is a
human. → Socrates is mortal. human. → John likely enjoys music.
Conclusion
Non-deductive inference methods are essential for reasoning in real-world scenarios, where
information is often incomplete or uncertain. They are widely applied in artificial
intelligence for tasks such as learning, diagnosis, and decision-making, bridging the gap
between theoretical reasoning and practical applications.
41
Key Concepts
1. Inconsistencies in TMS
Inconsistencies occur when a knowledge base contains contradictory information. This can
happen in reasoning systems when:
Example of Inconsistency:
This creates a logical inconsistency because if AAA is true and A→BA \rightarrow BA→B,
BBB must be true.
2. Uncertainties in TMS
Example of Uncertainty:
Here, uncertainty arises about whether P(x)P(x)P(x) implies xxx can fly.
1. Default Reasoning
Definition:
Key Features:
Example:
However, if new information reveals that Tweety is a penguin, the system retracts the
conclusion.
Applications:
Challenges:
● Prioritization: Determining which defaults to apply when multiple ones are relevant.
Definition:
The closed world assumption is the principle that anything not explicitly stated to be true
is assumed to be false. It simplifies reasoning by assuming the system has complete
knowledge of the world.
Key Features:
Example:
Applications:
● Databases: Relational databases often use CWA when queries return "false" for
missing information.
● Logic Programming: Prolog uses CWA to infer negative facts when a query fails to
find evidence.
Challenges:
● Incomplete Knowledge: CWA assumes that the system knows everything relevant,
which may not be true in real-world scenarios.
● Open World Assumption (OWA): In contrast to CWA, OWA assumes that the
absence of information does not imply falsity, which is more suitable for dynamic or
incomplete environments.
45
Handling Allows for exceptions and overrides. Assumes missing facts are
Uncertainty false.
Example "Birds typically fly." Tweety can fly "Bob is not a teacher" if not
unless proven otherwise. explicitly stated in the database.
46
Model
Applications:
● Machine Learning: Models learn patterns and make predictions (e.g., neural
networks).
● Expert Systems: Logical models represent domain knowledge for reasoning.
● Simulations: Models simulate real-world processes for testing and optimization.
Temporal Logic
Temporal Operators: