Logic. Propositional Logic (Calculus) First Order Logic Based on Russell and Norvig slides. Using Logic in KBS. Many Knowledge-Based Systems use some form of logic for the representation of knowledge especially older generation systems
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Logic
Propositional Logic (Calculus)
First Order Logic
Based on Russell and Norvig slides
AIC
AIC
Propositional logic is concerned with the truth or falsehood of statements (propositions) like:
the valve is closed
five plus four equals nine
Connectives:and
or
not
implies
equivalent
(X (Y Z)) ((X Y) (X Z))
“X implies Y and Z is the same as X implies Y and X implies Z”
AIC
AIC
...and
...or
...implies
..is equivalent
...not
AIC
AIC
“If it is hot and humid, then it is raining”
“If it is humid, then it is hot”
“It is humid.”
Ho = “It is hot”
Hu = “It is humid”
R = “It is raining”
AIC
S := <Sentence> ;
<Sentence> := <AtomicSentence> | <ComplexSentence> ;
<AtomicSentence> := "TRUE" | "FALSE" |
"P" | "Q" | "S" ;
<ComplexSentence> := "(" <Sentence> ")" |
<Sentence> <Connective> <Sentence> |
"NOT" <Sentence> ;
<Connective> := "NOT" | "AND" | "OR" | "IMPLIES" | "EQUIVALENT" ;
AIC
AIC
AIC
AIC
The five logical connectives:
A complex sentence:
AIC
AIC
AIC
RULEPREMISECONCLUSION
Modus PonensA, A => BB
And IntroductionA, BA ^ B
And EliminationA ^ BA
Double Negation~~AA
Unit ResolutionA v B, ~BA
ResolutionA v B, ~B v CA v C
AIC
AIC
AIC
“If it is hot and humid, then it is raining”
“If it is humid, then it is hot”
“It is humid.”
We want to prove that it is raining
AIC
1 HuPremise“It is humid”
2 Hu=>Ho Premise“If it is humid, it is hot”
3 Ho Modus Ponens(1,2)“It is hot”
4 (Ho^Hu)=>RPremise“If it’s hot & humid, it’s raining”
5 Ho^Hu And Introduction(1,2)“It is hot and humid”
6 R Modus Ponens(4,5)“It is raining”
AIC
AIC
Soundness: If KB |- Q then KB |= Q
Completeness: If KB |= Q then KB |- Q
AIC
FOL adds relations, variables, and quantifiers, e.g.,
AIC
AIC
P = “person”; Q = “mortal”; R = “Confucius”
P => Q; R => P; R => Q
AIC
AIC
AIC
AIC
AIC
AIC
Two important extensions to Propositional Logic are:
predicates and quantifiers
less-than-zero
weighs-more-than
for all (the universal quantifier)
there exists (the existential quantifier)
So with predicate calculus we can make statements like:
XYZ: Smaller(X,Y) Smaller(X,Z) Smaller(X,Z)
AIC
Predicate calculus is very general but not very powerful
Two useful additions are functions and the predicate equals
absolute-value
number-of-wheels
colour
Functions do not return true or false but return objects.
AIC
Two individuals are “equal” if and only if they are indistinguishable under all predicates and functions.
Predicate calculus with these additions is a variety of first order logic.
A logic is of first order if it permits quantification over individuals but not over predicates and functions. For example a statement like “all predicates have only one argument” cannot be expressed in first order logic.
The advantage of first order logic as a representational formalism lies in its formal structure. It is relatively easy to check for consistency and redundancy.
AIC
“If a sentence S is a logical consequence of a set of sentences A then S is still a logical consequence of any set of sentences that includes A. So if we think of A as embodying the set of beliefs we started with, the addition of new beliefs cannot lead to the logical repudiation of old consequences.”
So the set of theorems derivable from the premises is not reduced (increases monotonically) by the adding of new premises.
AIC
AIC
Sentences
Brother(KingJohn, RichardTheLionHart)
> (Length (LeftLegOf(RichardThe…)
(Length (LeftLegOf(KingJohn)
Sibling(KingJohn, Richard…)
Sibling(Richard…, KingJohn)
AIC
At(KingJohn,Aegean) Smart(KingJohn)
At(Richard, Aegean) Smart(Richard)
At(Robin, Aegean) Smart(Robin)
...
AIC
x At(x,Aegean) Smart(x)
means “Everyone is at Aegean and everyone is smart”
AIC
At(KingJohn,Aegean) Smart(KingJohn)
At(Richard, Aegean) Smart(Richard)
At(Robin, Aegean) Smart(Aegean)
...
AIC
x At(x,Aegean) Smart(x)
is true if there is anyone who is not at Aegean!
AIC
AIC
x,ySibling(x,y) [(x = y) m,f (m = f) Parent(m,x) Parent(f,x) Parent(m,y) Parent(f,y)]
AIC
The kinship domain:
x,y Brother(x,y) Sibling(x,y)
m,c Mother(c) = m (Female(m) Parent(m,c))
x,y Sibling(x,y) Sibling(y,x)
AIC
AIC
One-bit full adder
AIC
Type(X1) = XOR
Type(X1, XOR)
XOR(X1)
AIC
AIC
Type(X1) = XOR Type(X2) = XOR
Type(A1) = AND Type(A2) = AND
Type(O1) = OR
Connected(Out(1,X1),In(1,X2))Connected(In(1,C1),In(1,X1))
Connected(Out(1,X1),In(2,A2))Connected(In(1,C1),In(1,A1))
Connected(Out(1,A2),In(1,O1)) Connected(In(2,C1),In(2,X1))
Connected(Out(1,A1),In(2,O1)) Connected(In(2,C1),In(2,A1))
Connected(Out(1,X2),Out(1,C1)) Connected(In(3,C1),In(2,X2))
Connected(Out(1,O1),Out(2,C1)) Connected(In(3,C1),In(1,A2))
AIC
What are the possible sets of values of all the terminals for the adder circuit?
i1,i2,i3,o1,o2 Signal(In(1,C_1)) = i1 Signal(In(2,C1)) = i2 Signal(In(3,C1)) = i3 Signal(Out(1,C1)) = o1 Signal(Out(2,C1)) = o2
May have omitted assertions like 1 ≠ 0
AIC
Once you deduce something in first order logic you cannot get rid of it.
Can be handled in the following way:
Reads-empty(PM) Faulty(PM) Empty(PT)
AIC
AIC