4 - Artificial Intelligence I [ID:49623]
50 von 1147 angezeigt

Okay, so is this working? Okay. We were talking about Prolog as a programming language. And

we probably, this is different from most programming languages because instead of

having kind of a algorithm like upper model which works like a cooking recipe, right,

stir until done, serve and decorate or something like this where you have instructions as in an

imperative programming language as probably most of the languages you're used to. We have this

metaphor of describing a situation and then querying that situation which is much more like

databases but Prolog is kind of what we call a deductive database which has some representation

the situation, that's the program, and from the program we can compute a large number of facts

which we can then query. And of course since that number of facts might be infinite, we're not

actually doing it like a database does, like indexing everything ahead of time and then

efficiently querying, but this database of facts is computed on the fly. That makes it a programming

language. And we've basically started with a couple of examples, two situations we're going

to get back to. And we've looked at the syntax in terms of terms that you can write and literals

that you can write, literals being just like terms syntactically only that the heads of those

terms, the top symbols, are actually something we think of as predicates, sets of things like

the predicate dog actually stands for the set of all dogs, or the predicate love which is a two-place

predicate. We think of as a binary relation, John loves Mary, but maybe Mary doesn't love John,

those kind of things. And we have tertiary relations, something we're going to see today,

x plus y equals z, which is the relation between x, y and z. So we have literals and we have terms,

and from those we make facts and rules. And those facts and rules are terminated by a dot

syntactically. And we have this weird and wonderful way of making rules of the form something f, one,

two, three, four, five, who knows how many conditions. And that's how we program, that's how we

describe the situation in a programmatic way. And the somewhat surprising thing is that this is a

Turing complete programming language. And yes, it's going to be painful a bit, because we don't have

many things that you're used to from imperative programming language. We can't just say, oh, stuff

this big value into that variable and then use the variable instead. That's something we can do.

In functional programming languages and in Prologue, we can essentially bind a variable to some value

exactly once. Different, painful, but good for you. So the last thing we did was we looked at this

little program. It's supposed to program the predicate of being a natural number, which is

essentially the same as being a dog or so, except that different things are dogs than there are

natural numbers. So we have the predicate of natural numbers. And remember in Prologue,

we program with predicates. It's not functional programs where we program with functions. It's

not imperative program where we program with assignments. Here we program with predicates.

Takes a little bit of getting used to, but is doable if you actually try it.

Yes.

Yes.

We'll come to that. Variables are at the heart of programming in Prologue. We're going to go

into this. There's a special mechanism for that. The important thing here is to see that these

two lines of program really induce an infinite number of facts. Basically for every natural

number, 317, if we convert it into S of S of S of S of S of S of 0 or something like this,

then there is a fact, an induced fact in this big knowledge base that says 317 in this funny

S and O representation is actually a natural number. Yes.

No. No. The thing is we write down a program here and that kind of

induces which means we can compute an infinite number of facts. You're never going to be able

to write a program that has an infinite number of facts declared. No. No. It is different. I'll

come to that. So just suspend your skepticism for a second. Okay. This is not programming yet. This

is just me trying to prepare you for what's coming. Okay. So what we do is we use a procedure called

backchaining and backchaining has the following idea. If we have a query Q which has N literals

and we have a rule H if B1 to BN, we're going to call the literal H the head and the literals

B1 to BN the body, then backchaining does the following. It tries to look, it looks at H and

Teil einer Videoserie :

Zugänglich über

Offener Zugang

Dauer

01:30:05 Min

Aufnahmedatum

2023-10-25

Hochgeladen am

2023-10-25 14:29:06

Sprache

en-US

Einbetten
Wordpress FAU Plugin
iFrame
Teilen