Unit 8 Part 2 Probability and Uncertainty
Unit 8 Part 2 Probability and Uncertainty
Logic:
Logics are formal languages for representing information such that conclusions can be drawn: It
has syntax and semantics:
– Syntax defines rules or grammar required for correct use and interpretation of language. It
specifies the symbols, operators, variables we can use in the language.
– Semantics define the meaning of sentences. That allows us to assign value to sentence
interpreted in certain world
Propositional logic:
Proposition is simple statement or sentence which may be true or false and propositional logic is
the language that allows to represents sentence, operate these facts and deduce new facts. Similar
to any language, it has syntax and semantics.
Syntax
The syntax or rules help us to represent statements, interpret it, make the knowledge base system,
deduce new facts from the existing ones etc. It allows us to represent or label the sentences in
symbol. We can use set of sentences in propositional logic. The sentence may be atomic or
compound sentence. For eg. Ram is tall. This is a proposition and propositional logic allows us
to label this statement symbolically by P.
Atom: Single proposition is atom. For eg. Today is Sunday. Constants like TRUE or FALSE are
also taken as atoms.
Literal: A single proposition or its negation is called literal.
Compound sentence: Two or more sentence combined through various connectors are called
compound statements. Proposition logic has various logical operators or connectors like V (or) ᴧ
(and) ¬ (Not) →(implication). Its value also may be true or false based on interpretation in
certain world.
P ᴧ Q is also a sentence whose value is be true when both of P and Q are true otherwise false.
P Q Pᴧ Q
T T T
T F T
F T T
F F F
P → Q is a sentence that states the if P is true then Q is true. It can be written as ¬P V Q as well
as ¬Q → ¬P.
P Q ¬P ¬P V Q P→ Q
T T F T T
T F F F F
F T T T T
F F T T T
P ↔ Q is the sentence states that P is true if and only if Q. It is similar to P XNOR Q i.e. it is
ANDing of P → Q and Q → P
P Q Q→P P→ Q P ↔ Q =(P→Q) ᴧ (Q→P) P XNOR Q
T T T T T T
T F T F F F
F T F T F F
F F T T T T
Semantics:
Interpretation of proposition in certain world provides the semantic or meaning of statement and
assigns value to the statement that may be true or false. A statement that is true in some world
may be false in some other world. It means interpretation is mapping of the given proposition in
Satisfiability:
If a sentence is evaluates to true under at least one interpretation, then the sentence is said to
have satisfiable. To check the satisfiability, we assign Boolean values to propositions and see
whether it is true at least for once.
Validity:
A proposition is said to be valid when it is always true irrespective of the world of its
interpretation. For eg. P V ¬P is always true thus it is a valid sentence or proposition such a
statement is also called tautology.
P Q ¬P PVQ PV¬P
T T F T T
T F F T T
F T T T T
F F T F T
Inference rules allows you to deduce the new things from existing ones. We have two popular
inference rules namely modus ponens and resolution.
Deductive reasoning:
Derives conclusions or new facts by combining given premises(facts) and rules.
Inductive reasoning:
Derives new rule by using set of premises, rules and conclusions.
Abductive reasoning:
Derives premises from set of rules, and conclusions.
Modus ponens:
This rule say that if P → Q and P is given (true) then we can infer or conclude that Q is true. This
→,
rule is written as follows. , Where upper one is premises and down one is conclusion.
Premises means given facts or conditions.
Forward Chaining:
Knowledge Base consists set of facts and set of rules. Facts are the proposition in knowledge
base and rules are in the form of implication. Facts in knowledge base are always true. In
forward chaining, we start facts and rules and deduce new facts. The new fact is kept in
knowledge base and again new facts are deduced. This process is continued till we get our goal.
Suppose we have following facts in knowledge base.
F1:A
F2: B
F3: D
Also suppose we have following rules.
R1: A ᴧ B → C
R2: C ᴧ D → E
R2: C ᴧ F → G
Now deduce if E is a fact.
From fact F1 and F2 and Rule R1, C is true, thus kept in knowledge base.
From facts C, D and rule R2, E is fact. Hence proved.
Backward Chaining:
In backward Chaining, We start from goal, and check whether the RHS of rules in knowledge
base contains the goal propositions. If so, we replace the goal proposition with LHS of the rule.
This is done till we get the facts in our goal. This is done in most of logic programming
language. Backward chaining is more powerful as it only focus on the goal. It does not compute
any unnecessary goals. For eg.
Suppose we have following facts in knowledge base.
F1:A
F2: B
F3: D
Also suppose we have following rules.
R1: A ᴧ B → C
R2: C ᴧ D → E
R2: C ᴧ F → G
Now deduce if E is a fact using backward chaining.
To convert ¬ (A→B) V (C→A) compound proposition into clause, following steps must be
taken.
1. Eliminate the implication ¬ (¬A V B) V (¬ C V A)
2. Eliminate the Double negation sign (A ᴧ ¬ B) V (¬ C V A)
3. Apply distributive or associative laws to get conjunctive normal forms.(A V ¬ C V A) ᴧ (¬ B V
¬ C V A) ((A V ¬ C ) ᴧ (¬ B V ¬ C V A)
4. Get the set of clauses.
(A V ¬ C )
(¬ B V ¬ C V A)
Resolution:
Resolution is another method of inference. This rule says that if P V Q is true and ¬P is given
,¬ ,¬
(true), then Q is true. This rule is written as . Resolution can be also written as
¬→,→
¬→
Steps in resolution.
o Convert the given proposition into clausal form.
o Negate the sentence to be proved.
o Combine the clauses into set.
o Iteratively apply the resolution to the clausal sets.
o If we got the null clause then it lets us in the situation of contradiction and it proves the given
fact.
With following KB prove that S can be inferred with resolution but not with modes ponens.
P→Q, Q→S, ¬P→R, R→S
Exercise:
1. Represent the following proposition in propositional logic labels and deduce some
conclusions.
If the unicorn is mythical, then it is immortal but if it is not mythical, then it is mortal mammal.
If the unicorn is either immortal or a mammal, then it is horned. The unicorn is magical, if it is
horned. Check if the unicorn is mythical, mammal or mortal.
Let
P : unicorn is mythical.
Q: unicorn is mortal.
R: unicorn is mammal.
S: unicorn is horned.
T: unicorn is magical.
From given proposition,
Syntax:
We can use followings to represent statements in first order logic.
Constant: we can use constants like a, 5, lalitpur. In fact it represents the objects of real world.
Predicate: we can use predicate that take arguments and return true or false value when
instantiated with the variable of some domain. For eg. Mother(x,y). The predicate can represent
Function: We can use function that take arguments and return some value which may numeric,
non-numeric etc. function represents the function of an object.
Everyone loves their mother. ∀ ∃ ℎ , , Here loves is prdicate and so is
mother.
∀ , ℎ Here mother is function that returns mother of x and loves is predicate. In
FOL, functions will never appear outside the predicate.
Different types of sentences like atomic sentence, complex sentence, quantified sentences.
Atomic sentence: It is the predicate that takes the arguments like constant, variable, or
functions. For eg mother(x,y).
Complex sentence: It is combination of two or more atomic sentences through connectives like
˄ , ¬, V, →, ↔. For eg Mother(x,y) V loves(x,y)
Existential Elimination:
∃x likes(x, icecream) we can eliminate existential elimination with skolem constant which will
not appear in knowledge base elsewhere. For eg. Likes(ram,icecream) is elimination of
existential quantifier. That does not appear in knowledge base. Skolem constant is also a ground
term as it will have no further instantiation. This process is also called skolemization.
Existential Introduction:
We can convert likes(monalisa, ice-cream) ∃x likes(x, ice-cream) as we know that monalisa likes
ice-cream which means there exists some x who likes ice-cream.
Horn sentences:
Any atomic sentences are horn sentences. For eg likes(x,flower) is a horn sentence. Implication
with conjunction of predicates at LHS with no existential quantifier and atomic sentence at RHS
is called horn sentence without any existential quantifier. For eg. ∀ , &0 1&", →
0
Unification:
It is a process of finding a particular substitution that makes two atomic sentences identical. Two
atomic sentences like prime(x) and prime(7) can be identical when x is substituted with 7. It
means when these two sentences are unified, the x is replaced with 7. It is formally written as
UNIFY( prime(x), prime(7)) = {x/7}. Unification of prime(x,7) and prime(47,x) is impossible.
The unification is necessary when we use modus ponens for reasoning. It is also required for
resolution process. Unification provides a special fact for some particular subject. The
unification must be unrestricted. Unification must be as our requirement and we must use most
general unifier.
Substitution:
It replaces the variables with constant. It is used during unification of two predicates. For eg.
SUBST({x/49} , perfect(x) )=perfect(49).
AND elimination:
Prime(x) 1 composite(x) can be written as prime(x) , composite(x) by eliminating AND operator.
AND operator can be introduce if two predicates are true.
Resolution in FOL
Represent following statements in first order logic and check if Traitorix is a criminal using
forward and backward chaining.
Law says that it is a crime to sell potion formula to hostile nations. The country Rome, an enemy
of Gaul has acquired some potion formulas and all of its potion formulas was sold by Druid
Traitorix. Traitorix is a Gaul.
Gaul(x)
Hostile(z)
Potion(y)
Criminal(x)
Sells(x,y,z).
Owns(x,y)
$ 1&" 1 , , (1ℎ"( → /","
Hostile(Rome)
∃ &" 1 ∋ , ,
&" 1' , , → "" , , ,
∀
Gaul(Traitorix) …………a
Forward chaining
∃ &" 1 ∋ , ,
&"&1 ∋ &, , (Eliminating existential quantifier with p that is not in knowledge).
From a,b,c,d,e
Criminal(Traitorix)
∀ & → 3
∀ 3 → 4
∀ ¬& → 5
∀ 5 → 4
From above knowledge base, we must be able to deduce S(A) is true. But using modus ponens,
we can’t.
¬∃ ,""$
The reasons for using probability reasoning under uncertainty are as follows
Specification becomes too large.
All antecedents are not known.
Some antecedents are not measurable.
Probability refers if a person is fat or not as we don’t know the person. Fuzzy logic refers how
fat is the person. Fat is not a true, false value in fuzzy logic. It is gradation. Possibility of being
fat is fuzzy.
Basics of probability
0<=P(A)<=1
P(true)=1
P(false)=0
Union probability of two independent events A and B is P(AVB)=P(A)+P(B)- P(A˄B).
Mutually exclusive events can’t occur simultaneously.
Conditional Probability:
Occurring of some events may depend upon the occurring of other events. In such case we must
calculate the conditional probability. Conditional probability of an event is defined as the it’s
probability given other events. Conditional probability is used for dependent events.
For eg. P(cavity|toothache)=0.8 means probability of cavity when there is a toothache is 0.8.
Bayes rules:
Bayes rule is very important for computing conditional probability for dependent events and
reasoning under uncertainty. Bayes rules states that
P(A|B)=P(B|A)*P(A)/P(B)
This can be proved like this
P(A˄B)=P(A|B)*P(B) …………. 1
P(B˄A)=P(B|A)*P(A) ………….2
From 1 and 2,
P(A|B)*P(B)=P(B|A)*P(A)
Or P(A|B)=P(B|A)*P(A)/P(B)
Joint probability is the method of representing the probability of all events. Joint probability
distribution encompasses all the probabilities of various combinations of different variables. It
also allows us to compute the probability of some events provided that other events are true or
false. In fact advantage of Full joint probability distribution is it enables us to answer all types
of queries. Joint probability of two independent events A and B is P(A˄B)=P(A)*P(B).
P(X1, X2,…, Xn) = P(Xn| Xn-1, Xn-2, ……….., X1) * P(Xn-1, ……….., X1)
= P(Xn| Xn-1, Xn-2, ……….., X1) * P(Xn-1|Xn-2, ……….., X1)P(Xn-2, ……….., X1)
=7?@AB 89" ∨ 9" − 1 … . . 9"
=P(Xi|parents(Xi)
P(cavity)=0.108+0.012+0.072+0.008=0.200
P(toothache V cavity)= 0.108+0.012+0.072+0.008+0.016+0.064=0.280
For eg Burglary alarm at home. Burglary alarm can be caused by somebody at the door, short
circuit, wind, animals etc. The cause may be infinite and listing of them in rule is not possible.
Such a rule that does not contain all causes can’t be tautology and can’t be useful. The alarm is
reliable at detecting burglary. It responds at minor earthquake also. Two neighbours john and
mary can call police hearing the alarm. John always calls the police when he hears the alarm. He
even calls the police when he is confused with the telephone rings with alarm. But mary likes
loud music and sometimes misses the alarm. Belief network of this scenario is given below.
Here the evidence lack of iodine has one path leading in and one path leading out of it. Now this
node d-separates other nodes and other nodes becomes independent of each other. Now goiter
only depends upon hormonal imbalance and lack of iodine. It means we can infer goiter or
computer its conditional probability given hormonal imbalance and lack of iodine.
Here malnutrition is evidence that has both paths leading out of it. Thus this also d-separates
other nodes.
- Neither Z nor its descendants are in E, and both path arrows lead in to Z.
Here lack of iodine is evidence and goiter has both path leading in. Thus goiter d-separates other
nodes.
Causal Inferences: From causes to effects that is deductive reasoning. It means it is computing
the probability of a child given the parent. For eg. Given the burglary, what is the probability that
john calls, mary calls.
P(JC|B)=0.86
P(MC|B)=0.67
Intercausal inferences: It is the reasoning between causes of common events. It computes the
probability of a parent given its siblings. Given alarm and earthquake what is the probability of
burglary.
P(B|A,E)=0.003
Mixed inferences: Some causes and some effects are known. It means computing the probability
of an event when its parent and child is known. For eg. Given john calls and no earthquake, what
is probability of Alarm?
P(A|JC ˄ ¬E)=0.003
Default Reasoning:
It is paradigm where we make some default assumption about some facts. For eg. If we can see
two wheel of a car from one side, then we can infer that there are two wheels in other side. Thus
we make such assumption and add them in knowledge base. It is non-monotonic reasoning as the
facts derived may change. Default rule can’t be applied any time. For eg if we know that one tyre
is stolen, then we can’t say by default that there are 2 wheels at other side.