Ai Unit 4
Ai Unit 4
3. Meta-knowledge:
● Knowledge about the other types of knowledge is called Meta-knowledge.
● Some examples of meta knowledge include planning, learning.
4. Heuristic knowledge:
5. Structural knowledge:
• The details of the inference mechanisms are hidden inside TELL and ASK.
A simple knowledge-based agent
Initial situation:
Proper inference should only derive sound conclusions. (ones that are true assuming
the premises are true)
Propositional Logic Syntax
• Logical constants: True, False
• Propositional symbols: P, Q, etc. representing specific facts about the world.
• Constants and symbols are atomic, other sentences are complex.
• If S is a sentence, then (S) is a sentence
• If S and R are sentences then so are:
S ∧ R: conjunction, S and R are conjuncts
S ∨ R: disjunction, S and R are disjuncts
S ⇒ R: implication, S is a premise or antecedent,
R is the conclusion or consequent, also known as
a rule or if-then statement
• S ⇔ R: equivalence ( biconditional implication )
• ¬S: negation
• A literal is an atomic sentence or its negation (P, ¬S)
• Precedence of operators: ¬, ∧, ∨, ⇒, ⇔
Propositional Logic Semantics
KB |= S
or
(KB -> S) is valid
Validity and Inference
• Inference can be performed by validity checking.
• If one has a set of sentences: {S1,... Sn} defining
one’s background knowledge, and one want to
know whether a conclusion C logically follows,
construct the sentence:
S1 ∧ S2 ∧... ∧ Sn ⇒ C
and check whether it is valid.
How many rows do we need to check?
Satisfiability and Complexity of Inference
Entailments Examples:
• Modus Ponens: {α ⇒ β, α} |− β
{α ⇒ β, α}
----------------
β
• And Elimination: {α ∧ β} |- α ; {α ∧ β} |− β
• And Introduction: {α, Β} |− α ∧ β
• Or introduction: {α} |− α ∨ β
• Double negation Elimination: {¬ ¬α} |− α
• Implication Elimination: {α ⇒ β} |− ¬α ∨ β
• Unit resolution: {α ∨ β, ¬β} |− α
Sample Proof
• Forward Chaining
• For each new piece of data, generate all new facts, until the
desired fact is generated
• Data-directed reasoning
• Backward Chaining
• To prove the goal, find a clause that contains the goal as its head,
and prove the body recursively
• Goal-directed reasoning
Forward Chaining
● It is a strategy of an expert system to answer the question,
“What can happen next?”
● Data Driven
Here, the Inference Engine follows the chain of conditions and derivations
and finally deduces the outcome.
It considers all the facts and rules, and sorts them before concluding to a solution.
● This strategy is followed for working on conclusion,result,or effect.
● For example, prediction of share market status as an effect of changes in
interest rates.
Forward Chaining
Forward Chaining
Forward Chaining
Forward Chaining
A practical example will go as follows;
Tom is running (A)
If a person is running, he will sweat (A->B)
Therefore, Tom is sweating. (B)
Backward Chaining
● With this strategy, an expert system finds out the answer to the question,
“Why this happened?”
● Goal Driven
● On the basis of what has already happened, the Inference Engine tries
to find out which conditions could have happened in the past for this
result.
● This strategy is followed for finding out cause or reason. For example,
diagnosis of blood cancer in humans.
Backward Chaining
Backward Chaining
Backward Chaining
A suitable sequence can be as follows:
● The patient has a bacterial infection.
● The patient is vomiting.
● He/she is also experiencing diarrhea and severe stomach upset.
● Therefore, the patient has typhoid (salmonella bacterial infection).
The MYCIN expert system uses the information collected from the patient to
recommend suitable treatment.
Properties of Quantifiers:
Everyone is married to exactly one person. Second conjunct is needed to guarantee there is only one unique
spouse.
Higher-Order Logic
∀ f ∀ g [ (f=g) ⇔ (∀ x f(x) = g(x)) ]: Says that two functions are equal if and only if
they have the same value for all possible arguments.
The propositional logic has very limited expressive power. Consider the following
sentence, which we cannot represent using PL logic.
• Connectives
(&), (v), (->), (<=>), (~)
• Quantifiers
Universal Quantifier
Existential Quantifier
Quantifiers in First-order logic:
Properties of Quantifiers:
Substitution:
Substitution is a basic procedure that is applied to terms and formulations. It can be found in all first-order logic
inference systems. When there are quantifiers in FOL, the substitution becomes more complicated. When we write
F[a/x], we are referring to the substitution of a constant "a" for the variable "x."
Equality:
In First-Order Logic, atomic sentences are formed not only via the use of predicate and words, but also through the
application of equality. We can do this by using equality symbols, which indicate that the two terms relate to the
same thing.
In the above example, the object referred by the Brother (John) is close to the object referred by Smith. The equality
symbol can be used with negation to portray that two terms are not the same objects.
● Universal Generalization
● Universal Instantiation
● Existential Instantiation
● Existential introduction
Inference in First order logic
Inference in First order logic
Universal Generalization
● Universal generalization is a valid inference rule that states that if premise P(c) is
true for any arbitrary element c in the universe of discourse, we can arrive at the
conclusion x P. (x).
● It can be represented as
● If we want to prove that every element has a similar property, we can apply this rule.
● x must not be used as a free variable in this rule.
Let's represent, P(c): "A byte contains 8 bits", so "All bytes contain 8 bits."for ∀ x P(x) , it
will also be true.
Inference in First order logic
Universal Instantiation:
A valid inference rule is universal instantiation, often known as universal elimination or UI.
IF "Every person like ice-cream"=> ∀x P(x) so we can infer that
"John likes ice-cream" => P(c)
So we can infer: Crown(K) ∧ OnHead( K, John), as long as K does not appear in the
knowledge base.
● If we want to prove that every element has a similar property, we can apply this rule.
● x must not be used as a free variable in this rule.
In the second step, we will assemble the relevant knowledge which is required for digital
circuits. So for digital circuits, we have the following required knowledge:
○ If two terminals are connected then they have the same input signal, it can be
represented as:
∀ t1, t2 Terminal (t1) ∧ Terminal (t2) ∧ Connect (t1, t2) → Signal (t1) = Signal
(2).
○ Signal at every terminal will have either value 0 or 1, it will be represented as:
Since in the circuit there are two XOR, two AND, and one OR gate so atomic
sentences for these gates will be
1. ∃ i1, i2, i3 Signal (In(1, C1))=i1 ∧ Signal (In(2, C1))=i2 ∧ Signal (In(3, C1))= i3 ∧
Signal (Out(1, C1)) =0 ∧ Signal (Out(2, C1))=1