4-Reasoning-04-09-2024
4-Reasoning-04-09-2024
4-Reasoning-04-09-2024
Dr K Ganesan
Professor – HAG
SCORE, VIT, Vellore – 632014
[email protected]
Ph: 6382203768
AI Rules for the traffic lights control: There are 4
membership functions for each input-output fuzzy variable
of the system.
Table below shows the fuzzy variables of Arrival, Queue and
Extension of the system, the right hand notations are used
to shorten these variables.
Table : Fuzzy variables of arrival, queue and extension of the
traffic light control.
The size of the matrix or the number of rules is equal to the
number of input combinations derived from the number of
membership functions per input.
For example, in the traffic control system there are 2 inputs
each having 4 membership functions, then number of rules
would be equal to 16.
• In AI, reasoning refers to the process of drawing
logical conclusions from available information or
data.
• It's about making sense of the information and
using it to reach decisions or solve problems.
• Reasoning in AI can be divided into various types -
deductive reasoning, inductive reasoning,
abductive reasoning, and analogical reasoning.
• Deductive reasoning: This involves drawing specific
conclusions from general principles or rules.
• Inductive reasoning: In contrast to deductive
reasoning, inductive reasoning involves making
generalizations based on specific observations.
• Abductive reasoning: This type of reasoning involves
making guesses or hypotheses to explain the
observations or data.
• It's about finding most likely explanation for a given
set of evidence.
• Analogical reasoning: Analogical reasoning involves
drawing conclusions by finding similarities between
different situations or domains.
• In AI, reasoning is crucial for tasks such as problem-
solving, decision-making, planning, understanding
natural language.
• Various AI techniques - logic-based approaches,
probabilistic reasoning, and machine learning
algorithms, are used to enable different forms of
reasoning in AI systems
• Logic Bases Approach
• Propositional logic (PL) is the simplest form of logic where all the
statements are made by propositions.
• A proposition is a declarative statement which is either true or false
and it is a technique of knowledge representation in logical and
mathematical form. Examples:
• a) It is Sunday.
• b) The Sun rises from West (False proposition)
• c) 3+3= 7(False proposition)
• d) 5 is a prime number.
• Some basic facts about propositional logic:
• Propositional logic is called Boolean logic when it works on 0 and 1.
• In propositional logic, we use symbolic variables to represent the
logic, and we can use any symbol for a representing a proposition,
such A, B, C, P, Q, R, etc. (For e.g, Fuzzy Logic – lingustic variables)
• Propositions can be either true or false, but it cannot be both.
• Propositional logic consists of an object, relations or
function, and logical connectives.
• These connectives are also called logical operators
which connects two sentences..
• A proposition formula which is always true is
called tautology, and it is also called a valid sentence.
• A proposition formula which is always false is
called Contradiction.
• Statements which are questions, commands, or
opinions are not propositions.
• For e.g, "Where is Rohini?",
• "How are you?",
• "What is your name?", are not propositions.
• There are 2 types of Propositions:
• Atomic Propositions
• Compound propositions
• Atomic Proposition: Atomic propositions are the simple
propositions. It consists of a single proposition symbol.
• These are sentences which must be either true or false.
• Example:
• a) 2+2 is 4, it is an atomic proposition as it is a true fact
• b) "The Sun is cold" is a proposition as it is a false fact.
• Compound proposition: They are constructed by combining
simpler or atomic propositions, using parenthesis & logical
connectives.
• Example:
• a) "It is raining today, and street is wet."
• b) “Rajan is a doctor, and his clinic is in Vellore."
• Logical connectives are used to connect two simpler
propositions or representing a sentence logically.
• We can create compound propositions using logical
connectives
• There are mainly five connectives, given as follows:
• Negation: A sentence such as ¬ P is called negation of P.
• For e.g, P = I like ice cream. ¬ P = I do not like ice cream.
• A literal can be either Positive literal or negative literal.
• Conjunction: A sentence which has ∧ (similar to AND
operator) connective such as, P ∧ Q is called a
conjunction.
Disjunction: A sentence which has ∨ connective (similar to
OR operator), such as P ∨ Q is called disjunction, where P
and Q are the propositions.
Implication: A sentence such as P → Q, is called an
implication.
• Implications are known as if-then rules.
• Biconditional:
• A sentence such as P⇔ Q is a Biconditional sentence.
• For e.g, If I am breathing, then I am alive.
• P= I am breathing, Q= I am alive, is represented as P ⇔ Q.
• Following is table for Propositional Logic Connectives:
• Truth Table:
• In propositional logic, we need to know the truth values of
propositions in all possible scenarios. We can combine all 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:
• Truth table with three propositions:
• We can build a proposition composing three propositions P,
Q, and R. This truth table is made-up of 8n Tuples as we
have taken three proposition symbols.
•
• Precedence of connectives:
• In logic, precedence of connectives determines the order
in which logical operations are evaluated in an expression.
• A typical precedence hierarchy is from highest to lowest:
• Negation (¬)
• Conjunction (AND, ∧)
• Disjunction (OR, ∨)
• Conditional (IMPLIES, →)
• Biconditional (IF AND ONLY IF, ↔)
• This hierarchy ensures that operations are evaluated in a
consistent and predictable manner.
• For example, in an expression like "A ∧ B ∨ C," conjunction
(AND) takes precedence over disjunction (OR), so "A ∧ B"
would be evaluated first before the OR operation with C.
• Use parenthesis to overrule the precedence.
• We can add parentheses when ambiguity arises to clear
the order of operations.
• For example, the expression ¬p ∨ q ∧ r is equivalent to
the expression (¬p) ∨ (q ∧ r), while p ∨ q ∧ q ∨ r is
equivalent to p ∨ (q ∧ q) ∨ r.
• This leaves the question of which of the ∧ operators in
the expression p ∧q ∧ r is evaluated first.
• This is settled by the following rule:
• When several operators of equal precedence occur in
the absence of parentheses, they are evaluated from
left to right.
• Expression p ∧ q ∧ r is equivalent to (p ∧ q) ∧ r rather
than to p ∧ (q ∧ r)
• Logical equivalence:
• 2 propositions are said to be logically equivalent if and only
if columns in truth table are identical to each other
• Let's take two propositions A and B, so for logical
equivalence, we can write it as A⇔B. In the truth table
below, we can see that column for ¬A∨ B and A→B, are
identical hence A is Equivalent to B
•
• Let's consider the statements:
• Statement A: "If it is raining, then I will take my
umbrella."
• Statement B: "I will not take my umbrella unless it is
raining."
• These two statements are logically equivalent because
they convey the same meaning.
• If we break down the logic:
• If it is raining (A is true), then I will take my umbrella
(B is true).
• If I will not take my umbrella (B is false), then it is not
raining (A is false).
• In both cases, the truth values of the statements A and
B are the same.
• If A is true, then B is true; if A is false, then B is false.
• Properties of Operators:
• Commutativity:
– P∧ Q= Q ∧ P, or
– P ∨ Q = Q ∨ P.
• Associativity:
– (P ∧ Q) ∧ R= P ∧ (Q ∧ R),
– (P ∨ Q) ∨ R= P ∨ (Q ∨ R)
• Identity element:
– P ∧ True = P,
– P ∨ True= True.
• Distributive:
– P∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).
– P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).
• DE Morgan's Law:
– ¬ (P ∧ Q) = (¬P) ∨ (¬Q)
– ¬ (P ∨ Q) = (¬ P) ∧ (¬Q).
• Double-negation elimination:
– ¬ (¬P) = P.
• Limitations of Propositional logic:
• We cannot represent relations like ALL, some, or none
with propositional logic. Example:
– All the girls are intelligent.
– Some apples are sweet.
• Propositional logic has limited expressive power.
• In propositional logic, we cannot describe statements in
terms of their properties or logical relationships.
• Inference: In AI, we need intelligent computers which can create
new logic from old logic or by evidence. Generating conclusions
from evidence and facts is termed as Inference.
• Inference rules: Inference rules are applied to derive proofs in
artificial intelligence, and the proof is a sequence of the conclusion
that leads to the desired goal.
• In inference rules, implication among all connectives plays an
important role.
• Some terminologies related to inference rules:
• Implication: It is one of the logical connectives which can be
represented as P → Q. It is a Boolean expression.
• Converse: Converse of implication means right-hand side
proposition goes to left-hand side & vice-versa. It is given as Q → P
• Contrapositive: The negation of converse is termed as
contrapositive, and it can be represented as ¬ Q → ¬ P.
• Inverse: The negation of implication is called inverse. It can be
represented as ¬ P → ¬ Q.
• From the above term notice that some of the compound statements
are equivalent to each other, which we can prove using truth table:
1
• 2. Modus Tollens:
• The Modus Tollens rule state that if P→ Q is true and ¬ Q is
true, then ¬ P will also be true. It can be represented as:
• Proof by truth-table:
• 5. Addition:
• The Addition rule is one of the common inference
rule.It states that If P is true, then P∨Q will be true.
• 6. Simplification:
• The simplification rule state that if P∧ Q is true, then Q or
P will also be true. It can be represented as:
• Proof by Truth-Table:
• 7. Resolution:
• The Resolution rule states that if P∨Q and ¬ P∧R is true,
then Q∨R will also be true. It can be represented as
Proof by Truth-Table:
• First-Order Logic in Artificial intelligence
• In Propositional logic, unfortunately we can only represent
the facts, which are either true or false.
• Hence, Propositional Logic is not sufficient to represent the
complex sentences or natural language statements.
• The propositional logic has very limited expressive power.
• Consider following sentence, which we cannot represent
using Propositional Logic logic.
• "Some humans are intelligent“ or
• "Sachin likes cricket."
• To represent above statements, PL logic is not sufficient, so
we need some more powerful logic, such as first-order logic.
• First-order logic is another way of knowledge representation
in AI and it is an extension to propositional logic.
• First-order logic is also known as Predicate logic or First-order
predicate logic and it can express relationship between those
objects.
• First-order logic (like natural language) does not only assume
that the world contains facts like propositional logic but also
assumes the following things in the world:
• Objects: A, B, people, numbers, colors, wars, theories, squares,
pits, …
• Relations: It can be unary relation such as: red, round, is
adjacent, or n-any relation such as: the sister of, brother of, has
color, comes between
• Function: Father of, best friend, third innings of, end of, ......
• As a natural language, first-order logic also has two main parts:
– Syntax & Semantics
• Syntax of FOL determines which collection of symbols is a
logical expression in first-order logic.
• Basic syntactic elements of first-order logic are symbols.
• We write statements in short-hand notation in FOL.
• Basic Elements of First-order logic:
• Following are the basic elements of FOL syntax:
• Atomic sentences are basic sentences of first-order logic.
• These sentences are formed from a predicate symbol followed by a
parenthesis with a sequence of terms.
• Predicate (term1, term2, ......, term n).
• Chinky is a cat: => cat (Chinky).
• Complex sentences are made by combining atomic sentences using
connectives.
• Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
• First-order logic statements can be divided into two parts:
• Subject: Subject is the main part of the statement.
• Predicate: A predicate can be defined as a relation, which binds two
atoms together in a statement.
• Consider the statement: "x is an integer.", it consists of two parts,
first part x is subject of statement and second part "is an integer," is
known as a predicate.
• Quantifiers in First-order logic:
• A quantifier is a language element which generates
quantification, and specifies the quantity of specimen in the
universe of discourse.
• These are the symbols that allow us to determine or identify
the range and scope of the variable in the logical expression.
There are two types of quantifier:
– Universal Quantifier, (for all, everyone, everything)
– Existential quantifier, (for some, at least one).
• Universal Quantifier:
• Universal quantifier specifies that statement within its range
is true for everything or every instance of a particular thing.
• Universal quantifier is represented by a symbol ∀.
• In universal quantifier we use implication "→".
• If x is a variable, then ∀x is read as:
• For all x, For each x, For every x.
• Example: All man drink coffee.
• Let a variable x refers to a cat so all x can be represented in UOD as:
•
∀x man(x) → drink
(x, coffee).
It will be read as:
For all x where x is
a man who drinks
coffee.
• Existential quantifiers express that the statement
within its scope is true for at least one instance of
something.
• It is denoted by the logical operator ∃, which
resembles as inverted E.
• When it is used with a predicate variable then it is
called as an existential quantifier.
• Note: In Existential quantifier we always use AND or
Conjunction symbol (∧).
• If x is a variable, then existential quantifier will be ∃x or
∃(x). And it will be read as:
• There exists a 'x.'
• For some 'x.'
• For at least one 'x.'
• Example: Some boys are intelligent.