1
00:00:50,800 --> 00:00:57,800
I had introduced first order logic in the last
lecture. So, from this lecture, we will start
2
00:00:58,910 --> 00:01:03,649
studying the mechanism of inferencing in first
order logic.
3
00:01:03,649 --> 00:01:10,649
We will see how we can deduce new facts from
the existing ones using first order logic.
4
00:01:10,850 --> 00:01:17,549
Now, just to do a brief recap: the difference
that we saw between propositional logic and
5
00:01:17,549 --> 00:01:23,420
first order logic was that, in first order
logic, you can have predicates, which have
6
00:01:23,420 --> 00:01:29,619
arguments. These arguments can be instantiated
with values from a given domain, right, and
7
00:01:29,619 --> 00:01:35,219
we can have quantifiers, which says, whether
there exists some member in the domain which
8
00:01:35,219 --> 00:01:42,219
can satisfy the predicate, which is- there
exists the variable for that predicate, or
9
00:01:43,279 --> 00:01:49,340
it could be a universal quantification, which
says that for all values of the variable x
10
00:01:49,340 --> 00:01:54,709
from each domain, the predicate is satisfied.
11
00:01:54,709 --> 00:01:59,880
It is the existence of these quantifiers,
which makes inferencing in first order logic
12
00:01:59,880 --> 00:02:04,249
more difficult than that of propositional
logic. In propositional logic, we saw that
13
00:02:04,249 --> 00:02:11,249
we can reduce the inferencing problem to an
equivalent sat problem of Boolean's satisfiability,
14
00:02:12,709 --> 00:02:17,670
and we have different Boolean satisfiability
solvers, which can solve this. But when we
15
00:02:17,670 --> 00:02:24,030
go to first order logic, we the the domains
of these variables can be very large and could
16
00:02:24,030 --> 00:02:31,030
be potentially infinite also, and therefore,
it is not so easy to reduce the problem to
17
00:02:31,269 --> 00:02:33,400
a sat instance.
18
00:02:33,400 --> 00:02:40,400
So, let us see some basic things that we need
to do in first order logic: firstly, we need
19
00:02:45,680 --> 00:02:52,680
to have some basic inference rules: what can
we deduce from what? The first of this is
20
00:02:53,859 --> 00:03:00,859
universal elimination. Universal elimination
says, for example, that if we have for all
21
00:03:01,299 --> 00:03:08,299
x likes x ice cream, right, then, we can substitute
x with Einstein and get likes Einstein ice
22
00:03:13,950 --> 00:03:20,950
cream. Now, we can do this, because we have
this for all quantifier here. We are given
23
00:03:21,480 --> 00:03:26,849
that for all x likes x ice cream, in other
words, it says that everyone likes ice cream,
24
00:03:26,849 --> 00:03:33,019
and so, if we replace x with Einstein, we
get likes Einstein ice cream, and we can deduce
25
00:03:33,019 --> 00:03:34,659
this from this statement.
26
00:03:34,659 --> 00:03:41,659
If this is given to us, then we can always
deduce that Einstein also likes ice cream.
27
00:03:42,150 --> 00:03:48,489
The substitutions will be shown like this,
when we have x slash Einstein, it means that
28
00:03:48,489 --> 00:03:55,489
we are substituting the variable x with Einstein.
Then, we have a concept of a ground term-
29
00:03:59,489 --> 00:04:06,489
I will define this more formally. A ground
term is- for the moment, let us say it is
30
00:04:08,889 --> 00:04:15,889
a constant, like we have Einstein here. It-
by a ground term, we mean that it will not
31
00:04:16,299 --> 00:04:20,859
have any more variables within it, so, there
is no further instantiation that you can do
32
00:04:20,859 --> 00:04:27,310
on a ground term. The second rule is existential
elimination.
33
00:04:27,310 --> 00:04:34,310
So, suppose we are given: there exists x likes
x ice cream, right. Then, if we are given
34
00:04:36,210 --> 00:04:43,210
a particular person, say Einstein, can we
infer that likes Einstein ice cream? No, we
35
00:04:43,599 --> 00:04:50,599
cannot, because we are given there exists
x. But, which of these from the domain of
36
00:04:51,020 --> 00:04:58,020
x will like ice cream is not known, right?
But we can do the following thing: we can
37
00:05:00,009 --> 00:05:07,009
replace x by, say, something like man, provided
that man does not appear elsewhere in the
38
00:05:07,960 --> 00:05:14,830
knowledge base. If it is an entity which does
not exist in the knowledge base, then we can
39
00:05:14,830 --> 00:05:21,830
actually replace x with man. So, this man
here is a ground term; we are not going to
40
00:05:21,949 --> 00:05:28,949
further instantiate this, but this is the
place holder for that x which likes ice cream.
41
00:05:30,180 --> 00:05:35,919
So, this 1 says there exists x, who likes
ice cream. So we are say ok Let that person
42
00:05:35,919 --> 00:05:38,590
who likes ice cream be called man, right?
43
00:05:38,590 --> 00:05:44,690
Now this man is a ground term, so, we do not
have any other quantifier before it. But,
44
00:05:44,690 --> 00:05:51,690
at the same time, it is not 1 of the people
whom we know, because if it is 1 of the people
45
00:05:51,740 --> 00:05:58,490
whom we know, then we do not know whether
that person likes ice cream or not. If if
46
00:05:58,490 --> 00:06:05,490
there is a person called man, then we cannot
use man here. Yes. No, the man is not a set-
47
00:06:12,750 --> 00:06:19,750
man is a ground term; it is 1 person, okay?
It is like this- that we are told that someone
48
00:06:20,270 --> 00:06:27,270
likes ice cream, right, so, we are saying
that okay, let that be man, right? And henceforth,
49
00:06:28,300 --> 00:06:34,030
we will say that man likes ice cream. It is
also possible that someone else also likes
50
00:06:34,030 --> 00:06:40,020
ice cream; their existence does not prevent
us from having more than 1 person, right?
51
00:06:40,020 --> 00:06:46,650
But we are naming this person man just to
use man as a ground term in the inference
52
00:06:46,650 --> 00:06:47,000
procedure.
53
00:06:47,000 --> 00:06:53,889
We will shortly see why this is useful, and
when we generalize this thing, we will call
54
00:06:53,889 --> 00:07:00,349
this Skolemization, or replacing a variable
by a skolem function. I will shortly describe
55
00:07:00,349 --> 00:07:07,349
that why this becomes useful. The third 1
is existential introduction. So, if we are
56
00:07:10,860 --> 00:07:17,860
given that likes Monalisa ice cream, then
we can infer, that there exists x, likes x
57
00:07:18,389 --> 00:07:24,919
ice cream. If we are given that Monalisa likes
ice cream, then, we can always say that there
58
00:07:24,919 --> 00:07:31,919
is someone who likes ice cream, right? So,
in all of these 3, the first 1 is given to
59
00:07:33,030 --> 00:07:39,389
us and we can deduce the second 1 from that,
right? For example, we can deduce likes Einstein
60
00:07:39,389 --> 00:07:45,259
ice cream from for all x likes x ice cream.
We can deduce likes man ice cream from there
61
00:07:45,259 --> 00:07:52,259
exists x likes x ice cream, right? And likewise,
if we are given likes Monalisa ice cream,
62
00:07:53,889 --> 00:08:00,889
then we can deduce there exists x likes x
ice cream, okay?
63
00:08:02,039 --> 00:08:09,039
Now, let us first study 1 example of reasoning
in first order logic, and then we will go
64
00:08:12,210 --> 00:08:19,210
to the formal way of doing it. So, this is
an example which is inspired from the asterisk
65
00:08:19,949 --> 00:08:26,949
comics. The loss is that it is a crime for
a Gaul to sell potion formulas to hostile
66
00:08:26,979 --> 00:08:33,979
nations, so this is our first sentence. The
second sentence says, the country Rome, which
67
00:08:35,280 --> 00:08:41,560
is an enemy of Gaul, has acquired some potion
formulas, and all of its formulas were sold
68
00:08:41,560 --> 00:08:48,560
to it by a Druid Traitorix. And then, we are
given that Traitorix is a Gaul, and the question
69
00:08:50,220 --> 00:08:57,220
that we have to solve is that- is Traitorix
a criminal? So, let us first see, that how
70
00:08:57,960 --> 00:09:04,960
we translate each of these statements into
first order logic, and then, we will see how
71
00:09:05,190 --> 00:09:12,190
to do the deduction of the final statement
from the first 3.
72
00:09:12,600 --> 00:09:18,570
First 1 is: the law says that it is a crime
for a Gaul to sell potion formulas to hostile
73
00:09:18,570 --> 00:09:25,570
nations. What predicates will we require?
Okay.
74
00:09:28,030 --> 00:09:35,030
We will use predicates like, okay, let us
write them down. Gaul x to indicate that x
75
00:09:44,000 --> 00:09:51,000
is a Gaul. Okay, hostile, say z, indicating
that z is a hostile nation. Then, we will
76
00:10:00,650 --> 00:10:07,650
use
potion y to indicate that y is a potion, right?
And, we will also use criminal, say x, to
77
00:10:23,260 --> 00:10:30,260
indicate x is a criminal, right, and we will
also have selling- sells- this will indicate,
78
00:10:40,370 --> 00:10:47,370
let us say, x sells y to z. So, x is is going
to indicate x sells y to z, where y is a potion
79
00:11:04,560 --> 00:11:11,560
formula and x is a person and z is a country
is a nation. And I think we will also require
80
00:11:19,210 --> 00:11:26,210
owns- so owns x y, which will indicate x owns
y, where x is a potion formula; y is a nation,
81
00:11:42,040 --> 00:11:49,040
right? Now, let us look at the first statement,
which says that the that the law says that
82
00:11:49,790 --> 00:11:55,300
it is a crime for a Gaul to sell potion formulas
to hostile nations.
83
00:11:55,300 --> 00:12:02,300
It is a crime for a Gaul to sell potion formulas
to hostile nations. So, we can say that Gaul
84
00:12:03,020 --> 00:12:10,020
x
and potion y and sells, and
if x is a Gaul, y is a potion and z is a hostile
nation, and x sells y to z, which means that
85
00:12:56,760 --> 00:13:03,760
this Gaul sells the potion y to the hostile
nation z, then implies criminal x, right?
86
00:13:13,800 --> 00:13:20,800
Okay. When we write this kind of rules without
saying anything here, it will mean that we
87
00:13:23,370 --> 00:13:30,370
always have a for all x, for all y, for all
z. If there is any existential quantification,
88
00:13:33,050 --> 00:13:40,050
we will explicitly write it down, right? So,
this is our first sentence- that the law says
89
00:13:42,640 --> 00:13:49,640
that it is a crime for a Gaul to sell potion
formulas to hostile nations.
90
00:13:50,160 --> 00:13:57,160
So, if anybody has done that, then it implies
that that person is a criminal, okay? The
91
00:13:57,550 --> 00:14:04,550
second sentence says that the country Rome
is an enemy of Gaul, right? So, what should
92
00:14:08,610 --> 00:14:15,610
we have for that? Hostile Rome. This is our
second sentence: that Rome is hostile, for
93
00:14:26,980 --> 00:14:33,980
Gauls, of course. And then, we have that Rome
has acquired some potion formulas, right?
94
00:14:37,220 --> 00:14:44,220
Rome has acquired some potion formulas. There
exists a y, such that potion y and owns...
95
00:14:56,660 --> 00:15:03,660
this says that Rome owns some potion, right?
And then, we are given that all of its formulas
96
00:15:15,010 --> 00:15:20,560
were sold to it by Druid territories, okay?
97
00:15:20,560 --> 00:15:27,560
That means that for all y which is a potion-
potion y- and owns
Rome y, means that this was sold to Rome by
98
00:15:44,640 --> 00:15:51,640
Traitorix, so sells... right? So, for all
y which is a potion and which is owned by
99
00:16:18,310 --> 00:16:25,310
Rome, so, all potion formulas that are owned
by Rome were sold to Rome by Traitorix, right?
100
00:16:28,510 --> 00:16:35,510
Finally, we are given that Traitorix is a
Gaul, so Gaul..., right? Yes, the second 1
101
00:16:57,250 --> 00:17:04,049
is to show that at least 1 potion is there,
because we are also told that the country
102
00:17:04,049 --> 00:17:11,049
Rome and enemy of Gaul has acquired some potion
formulas, right? So, that set of potion formulas
103
00:17:11,419 --> 00:17:18,419
acquired by Rome is no zero non-empty, right,
and further, all this formulas all these formulas
104
00:17:21,329 --> 00:17:25,250
were sold to it by Traitorix.
105
00:17:25,250 --> 00:17:32,250
Now, let us see- what do we have to deduce?
We have to deduce that is Traitorix a criminal?
106
00:17:41,779 --> 00:17:48,779
The goal that we have the goal that we have
is, we want to deduce this and we want to
107
00:18:10,250 --> 00:18:17,250
deduce this from this set of formulas. First
1 is this, right, and then, we have this as
108
00:18:25,080 --> 00:18:32,080
the second one, this as the third one, this
as the 4th one, and this as the fifth one.
109
00:18:34,559 --> 00:18:41,559
So, we are trying to see whether 1 through
5 implies this goal g. Firstly, what we are
110
00:18:58,710 --> 00:19:05,710
going to study is- we will try to use modus
ponens, as we did in propositional logic,
111
00:19:06,440 --> 00:19:11,509
which means that we will try to see whether
the left hand side is satisfied, and if the
112
00:19:11,509 --> 00:19:16,429
left hand side of an implication is satisfied,
then we can deduce the right hand side.
113
00:19:16,429 --> 00:19:23,429
In an implication of the form a implies b,
if a holds, then we can deduce b. We will
114
00:19:24,029 --> 00:19:28,950
try to go in the same way, and as we had seen
previously, that there are 2 ways of doing
115
00:19:28,950 --> 00:19:34,340
this: 1 is forward chaining, where we start
from the given set of rules and repeatedly
116
00:19:34,340 --> 00:19:41,340
apply them until we arrive at the goal, and
the other option is to start with the goal,
117
00:19:41,769 --> 00:19:47,559
and then go backwards, to see that what do
we need in order to derive this goal. We will
118
00:19:47,559 --> 00:19:54,559
study both of this, inferencing, using simple
modus ponens, or the extension of the modus
119
00:19:54,960 --> 00:19:59,389
ponens for propositional logic, as we having
first order logic.
120
00:19:59,389 --> 00:20:06,389
Let us see; we want to start we start with
the formula, so this is forward chaining.
121
00:20:08,090 --> 00:20:15,090
We start with- there exists y, potion y and...,
okay? Now, there exist some y, so, what we
122
00:20:39,809 --> 00:20:46,809
will do first here is, we will eliminate this
implication by replacing y with something;
123
00:20:48,450 --> 00:20:52,080
something which does not exist in a knowledge
base right now. You remember, we did this
124
00:20:52,080 --> 00:20:59,080
for that- there exists x likes x ice cream
and we replace x by man? So, we will replace
125
00:20:59,749 --> 00:21:06,749
this y by, let us say, we will replace it
by some potion p. So, once we do that, that
126
00:21:08,970 --> 00:21:15,970
gives us potion p and owns..., okay, and then,
we also have the rule which says, portion
127
00:21:43,259 --> 00:21:50,259
y and owns Rome y implies that sells Traitorix
y Rome.
128
00:22:15,960 --> 00:22:22,960
Now, if we use these 2 now, we will do a thing
called an unification- we will try to see
129
00:22:29,970 --> 00:22:36,970
whether we can use this to match the left
hand side of this; in order to do that, we
130
00:22:37,970 --> 00:22:44,960
see that we have to substitute this variable
y here by p. And there is no problem in doing
131
00:22:44,960 --> 00:22:51,129
so, because recall, that in all of these,
we have this for all y outside. So, if this
132
00:22:51,129 --> 00:22:58,129
holds for all y, then it will also hold for
p. Therefore, whenever you have for all, you
133
00:22:59,519 --> 00:23:06,519
can always replace the variable by any other
ground term of your choice. We say that the
134
00:23:06,799 --> 00:23:13,799
left hand side of this rule will unify with
this one, and that will happen if we substitute
135
00:23:18,120 --> 00:23:25,120
this y here with p. This is the substitution
that we are applying on this and that is going
136
00:23:25,539 --> 00:23:32,100
to unify their left hand sides and therefore
we can deduce the right hand side.
137
00:23:32,100 --> 00:23:38,470
But again, when we unify it, when we do this
substitution of y by p, we will we will have
138
00:23:38,470 --> 00:23:45,470
to do it on both sides. Therefore, we have
we have deduced that sells Traitorix p Rome.
139
00:23:47,070 --> 00:23:54,070
We have sells
140
00:24:17,429 --> 00:24:24,429
and further, we are given hostile Rome, right,
and we are also given Gaul Traitorix
and from here we have potion p. Let us see:
141
00:24:56,509 --> 00:25:03,509
what do we have? We have potion p, hostile
Rome, Gaul Traitorix and sells Traitorix p
142
00:25:06,259 --> 00:25:13,259
Rome, right? Now then, we can use this rule-
Gaul x portion y sells x y hostile z implies
143
00:25:15,970 --> 00:25:22,299
criminal x. But the left hand sides will now
have to be unified with these predicates that
144
00:25:22,299 --> 00:25:29,230
we have here. That means that here, x is going
to be replaced by Traitorix, y is going to
145
00:25:29,230 --> 00:25:34,929
be replaced by p and z is going to be replaced
by Rome.
146
00:25:34,929 --> 00:25:39,429
If we do that substitution on the left hand
side, then the left hand side matches with
147
00:25:39,429 --> 00:25:44,159
what we have here, in the knowledge base.
We have potion p- we have hostile Rome, we
148
00:25:44,159 --> 00:25:49,559
have Gaul Traitorix, and we have sells Traitorix
p Rome. These 4 facts I have already been
149
00:25:49,559 --> 00:25:55,379
deduced and are there in the knowledge base,
so, they unify with the left hand side of
150
00:25:55,379 --> 00:26:01,360
this rule and it gives us the right hand side
again, with the same substitution, which means
151
00:26:01,360 --> 00:26:08,360
that it gives us criminal Traitorix. Out of
these 4 and that rule, and the rule 1 that
152
00:26:11,779 --> 00:26:18,779
we had, will give us.... Here? Yes. No, no,
because, see, you need to have Gaul x, potion
153
00:26:49,340 --> 00:26:56,340
y, sells xyz and hostile z- all 4 together,
to infer criminal x.
154
00:26:59,029 --> 00:27:06,029
If you just put potion p here, then you do
not get that Traitorix is a criminal. You
155
00:27:08,999 --> 00:27:15,999
just get that for all y x Gaul x and potion
p for all z sells xyz and hostile z is implies
156
00:27:21,029 --> 00:27:28,029
criminal x. See, once you instantiate something,
that particular quantifier will go, but the
157
00:27:28,759 --> 00:27:35,759
others will still be there. You can only deduce
criminal Traitorix if you have instantiated
158
00:27:38,580 --> 00:27:45,580
all of these variables, or else, if you are
if suppose, you replace x with Traitorix and
159
00:27:51,529 --> 00:27:58,119
then, you have to find y and z, which satisfies
potion y and sells xyz, only then, you can
160
00:27:58,119 --> 00:28:05,119
deduce criminal Traitorix. Once we have substituted
x with Traitorix, y with p and z with Rome,
161
00:28:09,009 --> 00:28:12,580
then, we have all these facts in the knowledge
base.
162
00:28:12,580 --> 00:28:19,580
We have hostile Rome, we have potion p, we
have Gaul Traitorix, and we also have sells
163
00:28:19,799 --> 00:28:26,269
Traitorix p Rome; all these facts were there
in the knowledge base, when we applied this
164
00:28:26,269 --> 00:28:33,269
rule, and we have deduced criminal Traitorix.
Now, this is forward chaining. This is where
165
00:28:37,509 --> 00:28:44,509
we started from the existing facts and rules
in the knowledge base and deduced that Traitorix
166
00:28:45,769 --> 00:28:52,269
is a criminal. We can do the reverse also-
we can start with criminal Traitorix and then
167
00:28:52,269 --> 00:28:59,269
try to figure out, that how to deduce whether
this is true or not. For that, we will start
168
00:29:00,350 --> 00:29:06,230
with criminal Traitorix, and then work backwards.
Let us see how that is going to work. We are
169
00:29:06,230 --> 00:29:13,230
going to start by saying that okay, my initial
goal is to deduce that criminal Traitorix.
170
00:29:24,909 --> 00:29:31,440
Then we start with this rule- we start with
this rule, because this is the rule which
171
00:29:31,440 --> 00:29:33,679
has criminal Traitorix on the right hand side.
172
00:29:33,679 --> 00:29:38,739
We will now start unifying with the right
hand side. So, with the right hand side, if
173
00:29:38,739 --> 00:29:45,739
we unify this, then we will see that we can
get criminal Traitorix, provided that we can
174
00:29:46,529 --> 00:29:53,529
find a Gaul x, a potion y; provided that we
can find a potion y and a nation z, such that
175
00:29:56,929 --> 00:30:03,129
Traitorix has sold a potion to that nation.
What we need, therefore, if we look at this
176
00:30:03,129 --> 00:30:10,129
rule, then, what we need in order to deduce
that criminal Traitorix, is that we need Gaul
177
00:30:15,429 --> 00:30:22,429
Traitorix, we need some potion y, we need
some hostile z and we need sells xyz, and
178
00:30:56,190 --> 00:31:03,190
this is an and, because we need all of these,
we need to solve of these. Now, we have 4
179
00:31:03,239 --> 00:31:10,239
sub-goals- 1 is Gaul Traitorix, 1 is potion
y, 1 is hostile z and sells xyz. Yes, sells
180
00:31:11,220 --> 00:31:18,220
Traitorix xyz- that is right, it should be
sells Traitorix xyz, right?
181
00:31:19,759 --> 00:31:26,759
But, these sub-goals are not independent,
because they have this binding which has to
182
00:31:27,190 --> 00:31:34,190
be honored. For example, the potion y that
you instantiate y with, should also be the
183
00:31:34,249 --> 00:31:41,249
1 which has been sold. If we instantiate this
potion y with some p and instantiate this
184
00:31:41,869 --> 00:31:48,869
y with some q, then Traitorix is not a criminal,
because the 1 which has been sold and the
185
00:31:50,220 --> 00:31:57,220
1 that you have here are not the same. There
is a binding which is there between these.
186
00:32:02,720 --> 00:32:09,720
Then, once you have this, we will again move
backwards, okay, this is a solved node, because
187
00:32:11,590 --> 00:32:16,409
this is given to us, this is there in the
knowledge base, so this is solved. We do not
188
00:32:16,409 --> 00:32:23,409
need to do anything about this. But for potion
y, we need to do something- we need a potion
189
00:32:26,220 --> 00:32:32,080
y, which has been sold to this thing.
190
00:32:32,080 --> 00:32:38,899
What we will do is, we will start from this
rule now, that sells Traitorix y Rome can
191
00:32:38,899 --> 00:32:45,899
be had, provided that there is that for all
y potion y and owns Rome y. If we have to
192
00:32:49,679 --> 00:32:56,679
have this, then again, we have 2 sub-goals:
1 which says potion y, which actually we already
193
00:33:01,129 --> 00:33:08,129
have, and we need
194
00:33:18,970 --> 00:33:25,970
owns Rome y. Now, we are going to use this,
that there exists y, potion y and owns Rome
195
00:33:41,710 --> 00:33:48,710
y, and we will replace use existential elimination
to replace the y with a p. The moment we have
196
00:33:53,779 --> 00:34:00,779
that, we will have owns Rome p, and these
2 are going to have potion p, and recall that
197
00:34:16,890 --> 00:34:23,890
the moment that we substituted Rome here.
We will now try to see whether we can instantiate
198
00:34:28,440 --> 00:34:34,530
this also with the same thing, and we indeed
find, that in the knowledge base, we have
199
00:34:34,530 --> 00:34:41,530
hostile Rome, so this is going to be hostile
Rome. With that now, we have arrived at the
200
00:34:50,390 --> 00:34:52,850
entire set of ground terms.
201
00:34:52,850 --> 00:34:59,850
So, this is solved, this is solved, this is
solved and also this is solved. Therefore,
202
00:35:03,200 --> 00:35:10,200
we have completed deducing that Traitorix
is a criminal. We will study backward chaining
203
00:35:17,750 --> 00:35:24,720
in a lot more detail, when we study a language
called prolog, which will start after a few
204
00:35:24,720 --> 00:35:29,140
lectures. I will start with prolog- that is
a logic programming language, and there, you
205
00:35:29,140 --> 00:35:36,140
will see that this backward chaining is the
predominant way of doing the computation.
206
00:35:38,110 --> 00:35:45,110
Let us now see, that what are important formalisms
that are necessary to create a deductive engine
207
00:35:46,900 --> 00:35:53,900
out of what we have just now studied? We need
the generalized modus ponens. What does the
208
00:35:57,380 --> 00:36:00,560
generalized modus ponens give us?
209
00:36:00,560 --> 00:36:07,560
That if we have atomic sentences like these,
pi, pi dash and q, where there is a substitution
210
00:36:13,860 --> 00:36:20,860
theta, such that if you apply that substitution,
then pi dash and pi becomes equal for all
211
00:36:24,230 --> 00:36:31,230
i- okay, let us understand what this means.
This is the left hand side of a rule, right,
212
00:36:34,300 --> 00:36:41,300
p 1 and p 2 and pn- these are all predicates,
they have their arguments. p 1 dash, p 2 dash,
213
00:36:44,910 --> 00:36:51,910
pn dash, are also predicates which are there
in the knowledge base. We know that these
214
00:36:52,000 --> 00:36:58,310
are given- so, we are given that p 1 dash,
p 2 dash and pn dash are all given to us,
215
00:36:58,310 --> 00:37:05,310
and we are given this rule, that p 1 and p
2... pn implies q.
216
00:37:06,100 --> 00:37:12,110
We are trying to see whether we can infer
q from this, whether we can deduce q from
217
00:37:12,110 --> 00:37:19,110
this, and we can deduce q, provided that the
left side of the rule unifies with what we
218
00:37:19,600 --> 00:37:26,600
have, like, what we were doing just now is,
we were trying to see, that whether we were
219
00:37:27,930 --> 00:37:34,930
able to see the- text please. We were seeing
that whether we find a Gaul, a potion, a hostile
220
00:37:41,130 --> 00:37:48,130
nation which unifies with x, y and z, such
that sells xyz is also given in the knowledge
221
00:37:48,880 --> 00:37:55,880
base; when we have that, then we can deduce
this. So, when we have a Gaul, a potion, a
222
00:37:56,030 --> 00:38:03,030
hostile nation and sells xyz, like we deduced
from forward chaining, we had potion p, hostile
223
00:38:04,450 --> 00:38:11,290
Rome, Gaul Traitorix and sells Traitorix p
Rome, then we could deduce criminal x. Therefore,
224
00:38:11,290 --> 00:38:18,290
these are our p 1 dash, p 2 dash p, 3 dash,
etc., and these are our p one, p 2, p 3, etc.
225
00:38:19,160 --> 00:38:26,160
If they can unify with each other; in other
words, if there is a substation of the variables
226
00:38:26,180 --> 00:38:33,180
such that the 2 becomes equal, like, for example,
if we substitute x with Traitorix, then it
227
00:38:34,960 --> 00:38:38,530
unifies with Gaul Traitorix.
228
00:38:38,530 --> 00:38:45,530
If we substitute y with p, then it unifies
with potion p; if we substitute z with Rome,
229
00:38:45,870 --> 00:38:51,550
then it unifies with hostile Rome, right?
So, the complete substitution that we have
230
00:38:51,550 --> 00:38:58,550
is, x with Traitorix and y with p and z with
Rome, so that whole substitution is theta.
231
00:39:03,690 --> 00:39:10,690
If we looked here, if you have such a substitution
theta, which is able to unify pi dash with
232
00:39:12,030 --> 00:39:19,030
pi for all i, which means p 1 dash with p
one, p 2 dash with p 2, and so on, then we
233
00:39:19,570 --> 00:39:25,490
will deduce q also with that substitution,
because recall that when we make a substitution
234
00:39:25,490 --> 00:39:29,010
on the left hand side of the rule, we have
to make it also on the right hand side of
235
00:39:29,010 --> 00:39:30,420
the rule.
236
00:39:30,420 --> 00:39:37,420
So, that gives us: we are able to deduce q
with the same substitution. Is this clear?
237
00:39:50,810 --> 00:39:57,810
Is it clear? Yes or no? Fine. Yes, in the
goal, yes, in the- when we made the substitution
238
00:40:04,170 --> 00:40:11,170
of x by Traitorix here, we also have to make
it here, this also has to be replaced by Traitorix,
239
00:40:13,080 --> 00:40:18,850
because you see, this is your whole formula,
so if you make a substation of any variable
240
00:40:18,850 --> 00:40:25,690
with a ground term, you have to do it uniformly
on the formula, because whatever is the x
241
00:40:25,690 --> 00:40:32,690
here, is also the x here, that is why we have
this substitution of q also by theta.What
242
00:40:44,030 --> 00:40:48,290
is the important thing here? The important
thing here is to deduce- how do we do this
243
00:40:48,290 --> 00:40:50,310
unification?
244
00:40:50,310 --> 00:40:56,560
Because this unification of p 1 with p 1 dash,
p 2 with p 2 dash, and pn with pn dash, is
245
00:40:56,560 --> 00:41:03,560
what helps us in using the rule. We have to
be able to formulize a mechanism for doing
246
00:41:04,830 --> 00:41:11,830
this unification. Let us look at some examples
of this unification. The first 1 is, let us
247
00:41:15,510 --> 00:41:22,510
say- so, we define this function unify p q
as theta, where substitution of p with that
248
00:41:30,640 --> 00:41:37,640
theta- now, what do I mean by this? p is a
formula, theta is a substitution; what kind
249
00:41:37,670 --> 00:41:39,980
of substitution is theta?
250
00:41:39,980 --> 00:41:45,870
Say x by something, y by something, z by something,
like that, right. When we apply that substitution
251
00:41:45,870 --> 00:41:52,870
on p, and when we apply that same substation
on q, we should get the same predicate. If
252
00:41:58,120 --> 00:42:04,840
we are able to get the same formula by doing
the substitution, then we say that p and q
253
00:42:04,840 --> 00:42:11,840
are unified by the substitution theta. Is
it clear? p is a predicate, q is a predicate
254
00:42:17,380 --> 00:42:24,320
and the same substitution is able to unify
the 2 or make them equal. Let us see some
255
00:42:24,320 --> 00:42:31,320
examples. Suppose we have knows Erdos x is
1 predicate, knows Erdos x. Erdos is the name
256
00:42:37,630 --> 00:42:44,630
of a very famous mathematician, and we have
knows Erdos Godel, right? Then, the unification
257
00:42:47,160 --> 00:42:53,870
here is x replaced with Godel, because if
you replace the variable x with Godel, then
258
00:42:53,870 --> 00:43:00,260
these 2- this p and this q- will become identical.
259
00:43:00,260 --> 00:43:07,260
Now, this example is inspired from the Erdos
number. Are you familiar with what is the
260
00:43:07,970 --> 00:43:14,970
Erdos number? Yes. So, the Erdos numbers were
very interesting, because Erdos wrote lots
261
00:43:17,610 --> 00:43:24,610
of papers, and there are several numbers which
indicate how many co-authors he had and how
262
00:43:25,520 --> 00:43:32,520
many people published a paper with a co-author
of Erdos. So, 1 of the Erdos numbers is direct
263
00:43:35,270 --> 00:43:42,270
co-authors of Erdos, another Erdos number
is the number of people or the number of publication
264
00:43:44,170 --> 00:43:51,170
where a person's Erdos number is number of
publications in which that person was a co-author
265
00:43:51,840 --> 00:43:58,840
of a co-author of Erdos. And that number becomes-
actually, if we go to 1 or 2 more levels,
266
00:44:00,250 --> 00:44:03,100
the number becomes really staggering.
267
00:44:03,100 --> 00:44:10,100
Anyway, so let us return to our example. Let
us say that we have knows Erdos x and knows
268
00:44:13,580 --> 00:44:20,580
y Godel, right, then, the unifier is x replaced
with Godel and y replaced with Erdos. And
269
00:44:22,700 --> 00:44:29,190
see this theta- the substitution is actually
replacing 1 variable of this predicate, another
270
00:44:29,190 --> 00:44:34,990
variable of this predicate. But after that
substitution is done, then, these 2 becomes
271
00:44:34,990 --> 00:44:40,210
identical, because the left hand side will
become knows Erdos Godel; the right hand side
272
00:44:40,210 --> 00:44:43,010
will also become knows Erdos Godel.
273
00:44:43,010 --> 00:44:50,010
Now, let us get to a few little more complicated
example. Suppose we know, we have knows Erdos
274
00:44:54,350 --> 00:45:01,350
x and knows y father of y- so, every person
knows the person's father, right? Now, here,
275
00:45:07,130 --> 00:45:14,130
the unifier is y with Erdos, and then this
is more interesting- x with the father of
276
00:45:14,770 --> 00:45:21,770
Erdos. Now, see the- what is this father?
It is a function, right? Recall that in first
277
00:45:25,400 --> 00:45:31,200
order logic, we can have functions also as
arguments of predicates. Then, this side will
278
00:45:31,200 --> 00:45:38,200
become Erdos, father of Erdos, and this side
will also become Erdos and father of Erdos.
279
00:45:43,520 --> 00:45:50,520
Then, when does unification fail? It fails
in cases like this, that you have knows Erdos
280
00:45:55,620 --> 00:46:02,620
x and knows x Godel; now, this x is a common
variable here, and now there is no way that
281
00:46:04,260 --> 00:46:11,260
you can unify these 2 or there is no substitution
of x which will make this predicate and this
282
00:46:11,440 --> 00:46:17,970
predicate identical. So, the unifier is empty.
283
00:46:17,970 --> 00:46:24,970
Now, the important thing is that we require
the most general unifier. And why do we require
284
00:46:27,540 --> 00:46:32,440
the most general unifier? And what is the
meaning of the most general unifier? The most
285
00:46:32,440 --> 00:46:39,440
general unifier means that when we replace
a variable with a ground term, then we are
286
00:46:40,020 --> 00:46:47,020
effectively replacing- we are creating a special
instance of that rule, and deducing a fact
287
00:46:47,200 --> 00:46:54,200
for a very specific person. Like if we have
for all x likes x ice cream, and we replace
288
00:46:56,280 --> 00:47:03,280
x with Einstein and put likes Einstein ice
cream, well, that is fine, but it also- we
289
00:47:03,970 --> 00:47:09,520
must also remember that this is just 1 of
the many special cases of, for all x likes
290
00:47:09,520 --> 00:47:15,100
x ice cream, because there are every other
person who also likes ice cream. The fact
291
00:47:15,100 --> 00:47:20,420
that likes Einstein ice cream is fine, but
if that is not what we require for our proof,
292
00:47:20,420 --> 00:47:25,260
then, we could have- we could generate a lot
of people liking ice cream without actually
293
00:47:25,260 --> 00:47:30,690
using the fact.
294
00:47:30,690 --> 00:47:37,690
When we replace something with a unifier-
when we unify something, we will have to see
295
00:47:37,750 --> 00:47:44,750
that we unify in the most unrestricted way.
The more ground terms that you bring into
296
00:47:46,520 --> 00:47:53,480
it, you will find that it is the the right
hand side will also have more instantiations
297
00:47:53,480 --> 00:48:00,480
and it will be useful for a more restricted
set of cases. During some tutorial, I will
298
00:48:01,860 --> 00:48:08,240
talk in more detail about the most general
unifier and how to derive the most general
299
00:48:08,240 --> 00:48:15,240
unifier. And we will also see, that when we
use the most general unifier, then the number
300
00:48:15,460 --> 00:48:22,460
of steps in your deduction will go down. Did
you get an idea about what is meant by the
301
00:48:22,820 --> 00:48:29,820
most general unifier? We will study this in
more depth when we study prolog.
302
00:48:49,820 --> 00:48:56,820
This is a logic which is a which is a fragment
of first order logic- it is called horn logic.
303
00:48:59,790 --> 00:49:05,000
And what is a horn logic? Do you remember
that when we are studying propositional calculus,
304
00:49:05,000 --> 00:49:11,130
I briefly mentioned what are horn sentences?
Horn sentences are one, where on the left
305
00:49:11,130 --> 00:49:15,580
hand side of the rule, you can have a conjunction
of many predicates, and on the right hand
306
00:49:15,580 --> 00:49:22,580
side you have a single goal. Now, we do not
allow or of predicates on the left hand side
307
00:49:24,680 --> 00:49:31,680
or the right hand side. The similar thing
applies for first order logic also, and that
308
00:49:32,960 --> 00:49:39,760
fragment of first order logic is called horn
logic. And in horn logic, the advantage is
309
00:49:39,760 --> 00:49:46,760
that you can always repeatedly use modus ponens
to unify with the left hand side and deduce
310
00:49:47,350 --> 00:49:54,350
the right hand side. So, what we can do is,
we can convert the horn sentences to a canonical
311
00:49:56,260 --> 00:50:00,670
form, and then use generalized modus ponens
with unification.
312
00:50:00,670 --> 00:50:05,930
We can convert them to implicational form,
some left hand side implies right hand side,
313
00:50:05,930 --> 00:50:12,100
and then use this modus ponens consistently.
So, we will skolemize existential formulas
314
00:50:12,100 --> 00:50:17,640
and remove the universal ones. Skolemization
means that when you have there exists of some
315
00:50:17,640 --> 00:50:22,870
variable, replace that variable with some
constant which is not there in the knowledge
316
00:50:22,870 --> 00:50:29,870
base, as we did for the potion, and as we
did for that replacing x by man. Then this
317
00:50:30,900 --> 00:50:36,390
gives us a conjunction of clauses that are
inserted in the knowledge base and modus ponens
318
00:50:36,390 --> 00:50:41,970
helps us in inferring new clauses. And as
we have seen, that there are 2 ways of doing
319
00:50:41,970 --> 00:50:48,970
this: 1 is forward chaining, another is backward
chaining. So, what we had here right now was
320
00:51:03,490 --> 00:51:10,490
actually a case of- what we had in our deduction
here was indeed in horn logic.
321
00:51:14,650 --> 00:51:21,650
So, if you recall that we started with this
one, we skolemized this out and obtain potion
322
00:51:24,000 --> 00:51:30,630
p and owns Rome p and thereafter, we kept
on using modus ponens. We unified the left
323
00:51:30,630 --> 00:51:37,630
hand side of this rule with this, and thereby,
we were able to deduce the right hand side.
324
00:51:38,340 --> 00:51:42,880
Now, the idea is that whatever you deduce
on the right hand side, we go back into your
325
00:51:42,880 --> 00:51:49,470
knowledge base. You will see whether you are
able to unify the left hand side with what
326
00:51:49,470 --> 00:51:54,510
you have in the knowledge base. In this case,
we have potion p and we have owns Rome p;
327
00:51:54,510 --> 00:51:58,700
we have unified that with the left hand side,
deduce the right hand side, this goes back
328
00:51:58,700 --> 00:52:03,720
into the knowledge base. And then, we have
hostile Rome, Gaul Traitorix and potion p
329
00:52:03,720 --> 00:52:10,720
in the knowledge base, and these 4 together,
instantiate the left hand side of this rule
330
00:52:12,460 --> 00:52:17,480
and we are able to deduce criminal x which
we have here.
331
00:52:17,480 --> 00:52:24,480
In this way, if we have horn logic, we can
continue applying modus ponens to add new
332
00:52:27,040 --> 00:52:31,010
and new newer and newer facts into the knowledge
base, either through forward chaining or through
333
00:52:31,010 --> 00:52:38,010
backward chaining, and we are able to deduce
the fact. But we will see that this reasoning
334
00:52:43,040 --> 00:52:48,430
is not complete, in the sense that there are
formulas in first order logic which can be
335
00:52:48,430 --> 00:52:55,430
deduced, but cannot be deduced with this kind
of inferencing. So, generalized modus ponens
336
00:52:56,270 --> 00:53:01,240
is not a complete reasoning procedure. And
then, in the next lecture, we will study a
337
00:53:01,240 --> 00:53:08,240
mechanism which is a complete resolution procedure
or a complete proof mechanism, right? We will
338
00:53:09,000 --> 00:53:16,000
define what I mean by complete, and we will
study that in the next lecture.
339
00:53:40,590 --> 00:53:47,590
Let us continue with our study of proof mechanisms
in first order logic. So far, what we have
340
00:53:48,120 --> 00:53:52,380
seen is proof by using generalized modus ponens.
341
00:53:52,380 --> 00:53:56,380
Which was different from propositional modus
ponens, in the sense that we have to unify
342
00:53:56,380 --> 00:54:01,240
the left hand side of the rules, in order
to derive the right hand side of the rules.
343
00:54:01,240 --> 00:54:08,240
So, we are going to study resolution refutation
proofs, which is a complete proof procedure
344
00:54:08,960 --> 00:54:10,560
for first order logic.
345
00:54:10,560 --> 00:54:17,560
But first, we must understand that what is
the completeness issue for modus ponens. For
346
00:54:18,990 --> 00:54:25,990
that, let us look at this example. We have
for all x, px implies qx, right; we also have
347
00:54:31,530 --> 00:54:38,530
for all x, not px implies rx, right. Then,
we have for all x, qx implies sx, and for
348
00:54:43,980 --> 00:54:50,980
all x, rx implies sx. Now, we should be able
to conclude sa from this. Why? Because it
349
00:54:58,180 --> 00:55:05,180
is either pa or not pa, right? It is either
pa or not pa. Therefore, it is qa or ra; if
350
00:55:09,950 --> 00:55:16,950
it is qa, then also, we have sa. If it is
ra, then also we have sa. We should be able
351
00:55:20,790 --> 00:55:27,790
to deduce sa from this, but we cannot do it
by generalized modus ponens, because modus
352
00:55:29,150 --> 00:55:36,150
ponens will not observe that this and this-
the left hand sides together cover the entire
353
00:55:39,150 --> 00:55:46,150
domain of the predicate, because it is either
px or not px. That this and this together
354
00:55:49,300 --> 00:55:56,300
gives us true or of this, is not observed
by generalized modus ponens. And the problem
355
00:55:57,030 --> 00:56:03,780
is that this kind of thing that when you when
you have not px implies rx, cannot be converted
356
00:56:03,780 --> 00:56:10,780
to horn form, because we have negation on
the left hand side.
357
00:56:11,600 --> 00:56:18,600
Here is the generalized resolution rule, so
let us study this closely. We are given, say,
358
00:56:23,060 --> 00:56:30,060
2 rules, which has p1 through pn1 it implies
r1 through rn2, and we have s1 through sn3,
359
00:56:39,640 --> 00:56:46,640
which gives us q1 through qn4, and for some
j and some and for some k, we have unify pj
360
00:56:54,560 --> 00:57:01,560
qk is theta. It means that 1 of these this
pj out here and this qk out here- they unify,
361
00:57:07,020 --> 00:57:13,360
and they unify under the substitution theta.
Now, do you see what we have here? We have
362
00:57:13,360 --> 00:57:14,370
this qk here and this pj here, and they unify
with substitution theta.
363
00:57:14,370 --> 00:57:21,370
We have distributed the, and over or, and
that gives us a set of 3 clauses. 1 is not
364
00:57:23,630 --> 00:57:30,630
px or qx gx, the second class is not px or
not of pfa, third class is this, right? And
365
00:57:32,240 --> 00:57:39,240
then, we simplify this- this is an optional
step to obtain this: not of px or qx gx as
366
00:57:45,160 --> 00:57:52,160
1 clause, and not of pfa as other clause.
How do we get this from this? Try to solve
367
00:58:07,660 --> 00:58:13,590
it. Take this down as an exercise, and just
try to see how we deduce this thing from this.
368
00:58:13,590 --> 00:58:20,590
This is- it is not difficult, it is just give
you an idea of, it will give you an idea of
369
00:58:23,340 --> 00:58:30,340
how to use unification, in order to get rid
of the third clause, okay? So, in the next
370
00:58:44,160 --> 00:58:51,160
lecture, we will see how we can use resolution
refutation with some examples, to deduce or
371
00:59:00,190 --> 00:59:07,190
to prove certain sentences in first order
logic. Yes, the slide please. Thank you.