cs 74.757 formal logic 1 golog maruthappan shanmugasundaram (satish) graduate student department of...

41
CS 74.757 Formal Logic CS 74.757 Formal Logic 1 GOLOG GOLOG Maruthappan Shanmugasundaram (Satish) Maruthappan Shanmugasundaram (Satish) Graduate Student Graduate Student Department of Computer Science Department of Computer Science University of Manitoba University of Manitoba Winnipeg, R3T 2H4 Winnipeg, R3T 2H4 Email: [email protected] Email: [email protected]

Post on 18-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 11

GOLOGGOLOG

Maruthappan Shanmugasundaram (Satish)Maruthappan Shanmugasundaram (Satish)Graduate StudentGraduate Student

Department of Computer ScienceDepartment of Computer ScienceUniversity of ManitobaUniversity of Manitoba

Winnipeg, R3T 2H4Winnipeg, R3T 2H4Email: [email protected]: [email protected]

Page 2: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 22

OutlineOutline

IntroductionIntroduction Situation CalculusSituation Calculus GologGolog ConGologConGolog cc-Gologcc-Golog IndigologIndigolog GolexGolex pGologpGolog ConclusionConclusion

Page 3: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 33

IntroductionIntroduction

Computer systems are often embedded in Computer systems are often embedded in complex environments with which they interact.complex environments with which they interact.

Designers and users of such systems have a Designers and users of such systems have a mental model of the environment and how the mental model of the environment and how the systems actions affect the state of the systems actions affect the state of the environment.environment.

However, the system itself does not maintain a However, the system itself does not maintain a model of the environment it is operating in and model of the environment it is operating in and hence cannot justify its behaviour.hence cannot justify its behaviour.

Page 4: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 44

Introduction (contd..)Introduction (contd..)

This makes life difficult for users and designers This makes life difficult for users and designers as they may end reconstructing the model being as they may end reconstructing the model being used.used.

Reconfiguring or extending the system is also Reconfiguring or extending the system is also difficult as the system has no understanding at difficult as the system has no understanding at all of what it is doing.all of what it is doing.

To overcome these problems, the authors have To overcome these problems, the authors have developed a programming language called developed a programming language called GOLOG whose design is based on an extended GOLOG whose design is based on an extended version of situation calculus.version of situation calculus.

Page 5: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 55

Introduction (contd..)Introduction (contd..)

A Golog interpreter automatically maintains an A Golog interpreter automatically maintains an explicit model of the systems environment.explicit model of the systems environment.

This allows programs to reason about the state This allows programs to reason about the state of the world and consider the effects of various of the world and consider the effects of various courses of actions.courses of actions.

Hence programs may be written at a much Hence programs may be written at a much higher level of abstraction higher level of abstraction

The language is well suited for applications in The language is well suited for applications in high level control of robots, industrial processes, high level control of robots, industrial processes, discrete event simulations, intelligent software discrete event simulations, intelligent software agents etc. agents etc.

Page 6: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 66

Situation CalculusSituation Calculus

Situation Calculus is a first order language (with Situation Calculus is a first order language (with some second order features) specifically some second order features) specifically designed for representing dynamic domains.designed for representing dynamic domains.

All changes to the world are the result of named All changes to the world are the result of named actionsactions, which may be parameterized., which may be parameterized.

A first order term called a A first order term called a situationsituation is used to is used to denote a possible world history, which is simply denote a possible world history, which is simply a sequence of actions.a sequence of actions.

SS00 is a constant which denotes the initial is a constant which denotes the initial situation i.e. the situation in which no actions situation i.e. the situation in which no actions have yet occurred.have yet occurred.

Page 7: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 77

Situation Calculus (contd..)Situation Calculus (contd..) do(a,s)do(a,s) is a function which denotes the resulting situation is a function which denotes the resulting situation

from performing action from performing action aa in situation in situation ss..

In situation calculus actions are denoted by function In situation calculus actions are denoted by function symbols and situations as first order terms. For example,symbols and situations as first order terms. For example,

is a situation denoting the world history consisting of the sequence of actions,

Page 8: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 88

Situation Calculus (contd..)Situation Calculus (contd..)

Relations whose truth values vary from situation to Relations whose truth values vary from situation to situation are called situation are called relational fluentsrelational fluents and are denoted by and are denoted by predicate symbols taking a situation term as their last predicate symbols taking a situation term as their last argument. For example, argument. For example, is_holding(robot, p, s)is_holding(robot, p, s)..

Functions whose denotations vary from situation to Functions whose denotations vary from situation to situation are called situation are called functional fluentsfunctional fluents and are denoted and are denoted function symbols with an additional situation argument. function symbols with an additional situation argument. For example, For example, loc(robot, s)loc(robot, s)..

Actions in a domain are specified by providing certain Actions in a domain are specified by providing certain types of axioms, namely action precondition axiom, types of axioms, namely action precondition axiom, effect axioms and frame axioms.effect axioms and frame axioms.

Page 9: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 99

Situation Calculus (contd..)Situation Calculus (contd..) Action precondition axiomAction precondition axiom specify the conditions under specify the conditions under

which it is physically possible to perform an action.which it is physically possible to perform an action.

Effect axioms specify the effects of a given action on the fluents thereby providing the causal laws of the domain

Page 10: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 1010

Situation Calculus (contd..)Situation Calculus (contd..) Frame axiomsFrame axioms specify when fluents remain unchanged specify when fluents remain unchanged

by actions. These are necessary if one wants to reason by actions. These are necessary if one wants to reason about change. For example, a robot dropping things about change. For example, a robot dropping things does not affect an objects color:does not affect an objects color:

In general there can be a very large number of frame In general there can be a very large number of frame axioms (generally of the order of axioms (generally of the order of 2 X A X F2 X A X F, where A is , where A is the number of actions and F the number of fluents) in a the number of actions and F the number of fluents) in a system and this gives rise to the system and this gives rise to the Frame ProblemFrame Problem..

This complicates the task of axiomatizing a domain and This complicates the task of axiomatizing a domain and can make theorem proving extremely inefficient. can make theorem proving extremely inefficient.

Page 11: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 1111

Situation Calculus (contd..)Situation Calculus (contd..) The frame problem can be solved by an approach due to The frame problem can be solved by an approach due to

Raymond Reiter.Raymond Reiter. The basic idea is to collect all the effect axioms about a The basic idea is to collect all the effect axioms about a

given fluent and make a completeness assumption i.e. given fluent and make a completeness assumption i.e. assume that they specify all of the ways that the value of assume that they specify all of the ways that the value of the fluent may change. Then apply a syntactic the fluent may change. Then apply a syntactic transformation to the effect axioms to obtain a transformation to the effect axioms to obtain a successor successor state axiomstate axiom for the fluent. For example: for the fluent. For example:

Page 12: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 1212

Situation Calculus (contd..)Situation Calculus (contd..) In general, a particular domain of application will be In general, a particular domain of application will be

specified by a theory of the following form:specified by a theory of the following form:

Page 13: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 1313

GologGolog The situation calculus explained previously is good for The situation calculus explained previously is good for

representing and reasoning about simple actions.representing and reasoning about simple actions. It fails to address the problem of expressing and It fails to address the problem of expressing and

reasoning with complex actions and procedures like: reasoning with complex actions and procedures like:

Golog is a language based on the situation calculus which Golog is a language based on the situation calculus which allows for expressing and reasoning with complex actions allows for expressing and reasoning with complex actions and procedures.and procedures.

Golog Golog “alGOL in LOGic” “alGOL in LOGic”

Page 14: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 1414

Golog (contd..)Golog (contd..) Complex action expressions are defined using additional Complex action expressions are defined using additional

extralogical symbols (e.g., extralogical symbols (e.g., whilewhile, , ifif, etc.) which act as , etc.) which act as abbreviations for logical expressions in the language of abbreviations for logical expressions in the language of the situation calculus.the situation calculus.

These extralogical expressions are thought of as macros These extralogical expressions are thought of as macros which expand into genuine formulas of the situation which expand into genuine formulas of the situation calculus.calculus.

The abbreviation The abbreviation Do(Do(δδ, s, s’, s, s’)) is the most basic is the most basic abbreviation used in the Golog language, where abbreviation used in the Golog language, where δδ is a is a complex action expressioncomplex action expression..

Do(Do(δδ, s, s’, s, s’) ) means that executing means that executing δδ in situation in situation s s has has s’ s’ as a legal terminating situation. as a legal terminating situation.

Complex actions may be nondeterministic i.e., may have Complex actions may be nondeterministic i.e., may have several different executions terminating in different several different executions terminating in different situations.situations.

Page 15: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 1515

Golog (contd..)Golog (contd..)

Do is defined inductively on the structure of its first Do is defined inductively on the structure of its first argument as follows:argument as follows:

1. Primitive actions:1. Primitive actions:

2. Test actions:2. Test actions:

3. Sequence:3. Sequence:

Page 16: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 1616

Golog (contd..)Golog (contd..)

4. Nondeterministic choice of two actions:4. Nondeterministic choice of two actions:

5. Nondeterministic choice of action arguments:5. Nondeterministic choice of action arguments:

6. Nondeterministic iteration: Execute 6. Nondeterministic iteration: Execute δδ zero or more times.zero or more times.

Page 17: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 1717

Golog (contd..)Golog (contd..)

Conditionals and while loops are defined in terms of the Conditionals and while loops are defined in terms of the above constructs as follows:above constructs as follows:

Procedures are hard to define in situation calculus Procedures are hard to define in situation calculus semantics using macro expansion because there is no semantics using macro expansion because there is no straightforward way to macro expand a procedure body straightforward way to macro expand a procedure body when that body includes a recursive call to itself.when that body includes a recursive call to itself.

Page 18: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 1818

Golog (contd…. Procedures)Golog (contd…. Procedures)1. 1. An auxiliary macro definition:An auxiliary macro definition: For any predicate symbol P For any predicate symbol P

of arity n+2, taking a pair of situation arguments:of arity n+2, taking a pair of situation arguments:

2. Situation calculus semantics for programs involving 2. Situation calculus semantics for programs involving procedures: A Golog program follows the block-structured procedures: A Golog program follows the block-structured programming style. So a program such as, programming style. So a program such as,

Will be evaluated as:Will be evaluated as:

Page 19: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 1919

Golog (contd…. Procedures)Golog (contd…. Procedures)Example: A Golog blocks world program to make a seven block Example: A Golog blocks world program to make a seven block

tower while ensuring block A is clear in the final situation.tower while ensuring block A is clear in the final situation.

Page 20: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 2020

Golog (contd...)Golog (contd...)

Golog programs are executed using theorem proving.Golog programs are executed using theorem proving. Doing so is straightforward because program executions Doing so is straightforward because program executions

are formulas of the situation calculus. are formulas of the situation calculus. Program execution means, given a program Program execution means, given a program δδ and an and an

initial situation, find a terminating situation for initial situation, find a terminating situation for δδ, if one , if one exists. exists.

To do so, we prove the termination of To do so, we prove the termination of δδ as: as:

and then extract from the proof a binding for the and then extract from the proof a binding for the terminating situation.terminating situation.

Page 21: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 2121

Golog (contd...)Golog (contd...) An elevator controller in Golog.An elevator controller in Golog.

Page 22: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 2222

Golog (contd...)Golog (contd...)

Page 23: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 2323

Golog (contd...)Golog (contd...)

Page 24: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 2424

Golog (contd...)Golog (contd...)

This initial situation axiom specifies that, initially buttons This initial situation axiom specifies that, initially buttons 3 and 5 are on, and moreover no other buttons are on. 3 and 5 are on, and moreover no other buttons are on. Thus we have complete information initially about which Thus we have complete information initially about which call buttons are on.call buttons are on.

Running the program is a theorem proving task, which Running the program is a theorem proving task, which establishes the following entailment:establishes the following entailment:

Page 25: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 2525

Golog (contd...)Golog (contd...) The meaning of this entailment and why it makes sense:The meaning of this entailment and why it makes sense:

1. Do is a macro and not a predicate, and the expression 1. Do is a macro and not a predicate, and the expression stands for a much longer second order situation stands for a much longer second order situation calculus sentence.calculus sentence.

2. As this macro-expanded sentence is legitimate 2. As this macro-expanded sentence is legitimate situation calculus, it makes sense to seek a proof of it situation calculus, it makes sense to seek a proof of it from Axioms, which characterise the fluents and actions from Axioms, which characterise the fluents and actions of this elevator world.of this elevator world.

A successful proof for the elevator program may return A successful proof for the elevator program may return the following binding for the following binding for ss::

Page 26: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 2626

Golog (contd...)Golog (contd...)

The execution trace represented by this binding would The execution trace represented by this binding would be passed to the elevator’s execution module for be passed to the elevator’s execution module for controlling it in the physical world.controlling it in the physical world.

This example shows that Golog is a logic programming This example shows that Golog is a logic programming language in the following sense:language in the following sense:

• Its interpreter is a general purpose theorem prover.Its interpreter is a general purpose theorem prover.• Like Prolog, Golog programs are executed to obtain Like Prolog, Golog programs are executed to obtain

bindings for the existentially quantified variables of bindings for the existentially quantified variables of the theorem. the theorem.

Page 27: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 2727

Golog (contd...)Golog (contd...)

Golog is a logic programming language for Golog is a logic programming language for implementing applications in dynamic domains.implementing applications in dynamic domains.

But Golog omits some important considerations. But Golog omits some important considerations. Some of them are:Some of them are:

• Sensing and knowledgeSensing and knowledge• Sensing and knowing howSensing and knowing how• Exogenous actionsExogenous actions• Concurrency and reactivityConcurrency and reactivity• Continuous processesContinuous processes

Page 28: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 2828

ConGologConGolog

ConGolog is a concurrent programming language based ConGolog is a concurrent programming language based on the situation calculuson the situation calculus

The language includes facilities for prioritizing the The language includes facilities for prioritizing the execution of concurrent processes, interrupting the execution of concurrent processes, interrupting the execution when certain conditions become true, and execution when certain conditions become true, and dealing with exogenous actions.dealing with exogenous actions.

ConGolog differs from other formal models of ConGolog differs from other formal models of concurrency in at least two ways. First, it allows concurrency in at least two ways. First, it allows incomplete information about the environment. Second, it incomplete information about the environment. Second, it allows the primitive actions to affect the environment in a allows the primitive actions to affect the environment in a complex way and such changes to the environment can complex way and such changes to the environment can affect the execution of the remainder of the program.affect the execution of the remainder of the program.

Page 29: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 2929

ConGolog (contd…)ConGolog (contd…)

By using By using DoDo, programs are assigned a semantics in , programs are assigned a semantics in terms of a relation, denoted by the formulas terms of a relation, denoted by the formulas Do(Do(δδ, s, s’, s, s’)), , that a given program that a given program δδ and a situation and a situation ss, returns a , returns a situation situation s’s’ resulting from executing resulting from executing δδ starting in the starting in the situation situation ss..

Semantics of this form are called Semantics of this form are called evaluation semanticsevaluation semantics, , since they are based on the complete evaluation of the since they are based on the complete evaluation of the program.program.

To allow concurrency, it is more convenient to adopt a To allow concurrency, it is more convenient to adopt a different form of semantics, the so-called different form of semantics, the so-called transition transition semanticssemantics or or computation semanticscomputation semantics..

Transition semantics are based on defining single steps Transition semantics are based on defining single steps of computation in contrast to directly defining complete of computation in contrast to directly defining complete computations.computations.

Page 30: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 3030

ConGolog (contd…)ConGolog (contd…) For this two predicates are defined: For this two predicates are defined: Trans(Trans(δδ, s, , s, δδ’, s’’, s’))

and and Final(Final(δδ, s)., s). Trans(Trans(δδ, s, , s, δδ’, s’’, s’) ) holds if there is a transition from holds if there is a transition from

configuration (configuration (δδ, s, s) to the configuration () to the configuration (δδ’, s’’, s’)), i.e. if by , i.e. if by running program running program δδ starting in situation starting in situation s, s, one can get to one can get to situation situation s’s’ in one elemantary step with the program in one elemantary step with the program δδ’’ remaining to be executed.remaining to be executed.

Every elementary step will either be a the execution of Every elementary step will either be a the execution of an atomic action (which changes the situation) or the an atomic action (which changes the situation) or the execution of a test (which does not change the situation).execution of a test (which does not change the situation).

Also, if the program is nondeterministic, there are Also, if the program is nondeterministic, there are several transitions that are possible in a configuration. several transitions that are possible in a configuration.

Page 31: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 3131

ConGolog (contd…)ConGolog (contd…) Final(Final(δδ, s) , s) means that the configuartion means that the configuartion ((δδ, s, s)) is a final is a final

one, where the computation can be considered one, where the computation can be considered completed, i.e. no program remains to be executed.completed, i.e. no program remains to be executed.

The final situations reached after a finite number of The final situations reached after a finite number of transitions from a starting situation coincide with those transitions from a starting situation coincide with those satisfying the satisfying the DoDo relation. relation.

Complete computations are thus defined by repeatedly Complete computations are thus defined by repeatedly composing single transitions until a final configuration is composing single transitions until a final configuration is reached.reached.

With With TransTrans and and FinalFinal, a new definition of Do can be , a new definition of Do can be given as follows: given as follows:

Page 32: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 3232

ConGolog (contd…)ConGolog (contd…) As mentioned earlier, ConGolog is an extended verion of As mentioned earlier, ConGolog is an extended verion of

Golog that incorporates a rich account of concurrency.Golog that incorporates a rich account of concurrency. It is rich because it handles:It is rich because it handles:

• Concurrent processes with possibly different prioritiesConcurrent processes with possibly different priorities• High-level interruptsHigh-level interrupts• Arbitrary exogenous actionsArbitrary exogenous actions

Concurrent processes are modelled as Concurrent processes are modelled as interleavingsinterleavings of the of the primitive actions in the component processes. primitive actions in the component processes.

That is, a concurrent execution of two processes is one That is, a concurrent execution of two processes is one where the primitive actions in both processes occur, where the primitive actions in both processes occur, interleavedinterleaved in some fashion. in some fashion.

Here an important concept is that of a process being Here an important concept is that of a process being blockedblocked..

Page 33: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 3333

ConGolog (contd…)ConGolog (contd…) The ConGolog language like Golog except with the The ConGolog language like Golog except with the

following additional constructs: following additional constructs:

Exogenous actions:Exogenous actions:

Page 34: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 3434

cc-Gologcc-Golog cc-Golog is an action language which incorporates cc-Golog is an action language which incorporates

continuous change and event-driven behaviour.continuous change and event-driven behaviour. Used in high-level robot controllers which often need to Used in high-level robot controllers which often need to

specify event-driven behaviour and operate low-level specify event-driven behaviour and operate low-level processes that change the world in a continuous fashion.processes that change the world in a continuous fashion.

Main characteristics of a cc-Golog program:Main characteristics of a cc-Golog program:

• Timing of actions is largely Timing of actions is largely event-drivenevent-driven thereby thereby providing a reactive behaviour.providing a reactive behaviour.

• Actions are executed Actions are executed as soon as possibleas soon as possible..• Conditions change Conditions change continuouslycontinuously over time. over time.• Good Good blocking policiesblocking policies..

Page 35: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 3535

cc-Golog (contd..)cc-Golog (contd..)

Event-driven behaviour is achieved by including Event-driven behaviour is achieved by including a special action a special action waitFor(waitFor(ττ).).

Continuous change is incorporated through Continuous change is incorporated through continuous fluentscontinuous fluents, which are functional fluents , which are functional fluents whose values range over functions of time.whose values range over functions of time.

Blocking policies are specified by means of a Blocking policies are specified by means of a special instruction special instruction withCtrl(withCtrl(φφ,,σσ).).

Note: cc-Golog only provides deterministic Note: cc-Golog only provides deterministic instructions.instructions.

Page 36: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 3636

IndiGologIndiGolog IndiGolog is an action language which provides an IndiGolog is an action language which provides an

Incremental Interpreter for High-Level programs involving Incremental Interpreter for High-Level programs involving Nondeterminism and Sensing actions. Nondeterminism and Sensing actions.

Golog interpreter executes in an off-line manner.Golog interpreter executes in an off-line manner. Off-line execution is unsuitable for large programs and Off-line execution is unsuitable for large programs and

causes serious problems in the presence of sensing actions.causes serious problems in the presence of sensing actions. An Indigolog program executes on-line by means of an An Indigolog program executes on-line by means of an

incremental interpreter.incremental interpreter. On-line style of execution is well suited for programs where On-line style of execution is well suited for programs where

the initial state of the world is incompletely specified and the the initial state of the world is incompletely specified and the agent or robot must use sensors to determine values of agent or robot must use sensors to determine values of certain fluents.certain fluents.

Nondeterminism is taken care of by means of Nondeterminism is taken care of by means of off-line off-line lookahead search operator lookahead search operator ΣΣ..

Page 37: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 3737

GolexGolex

The field of autonomous mobile robots lacks methods The field of autonomous mobile robots lacks methods that bridge the gap between high-level symbolic that bridge the gap between high-level symbolic techniques and low-level robot control and navigation techniques and low-level robot control and navigation systems.systems.

Golex is an execution and monitoring system which Golex is an execution and monitoring system which bridges the gap between Golog and the complex and bridges the gap between Golog and the complex and distributed RHINO control software.distributed RHINO control software.

Golex provides the following features: Golex provides the following features:

• High level of abstractionHigh level of abstraction• Execution monitoringExecution monitoring• Sensing and Interaction Sensing and Interaction

Page 38: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 3838

pGologpGolog Actions of a robot are often best thought of as low level Actions of a robot are often best thought of as low level

processes with uncertain outcomes.processes with uncertain outcomes. A high level robot plan is a then a task, that combines A high level robot plan is a then a task, that combines

the low level processes in an appropriate way and may the low level processes in an appropriate way and may involve nondeterminism.involve nondeterminism.

The robot needs to turn a given plan into an executable The robot needs to turn a given plan into an executable program, through some from of projection such that it program, through some from of projection such that it satisfies a given goal with a sufficient degree of satisfies a given goal with a sufficient degree of probability.probability.

This is achieved through pGolog, a probabilistic variant This is achieved through pGolog, a probabilistic variant of Golog, whose programs model the low-level of Golog, whose programs model the low-level processes.processes.

High-level plans are ordinary Golog programs, except High-level plans are ordinary Golog programs, except that during projection the names of low-level processes that during projection the names of low-level processes are replaced by their pGolog definitions.are replaced by their pGolog definitions.

Page 39: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 3939

ConclusionConclusion Golog is a logic programming language for implementing Golog is a logic programming language for implementing

applications in dynamic domains like robotics, process applications in dynamic domains like robotics, process control, intelligent software agents, discrete event control, intelligent software agents, discrete event simulation etc.simulation etc.

It is based on a formal theory of actions specified in a It is based on a formal theory of actions specified in a extended version of the situation calculus. extended version of the situation calculus.

Golog has a number of novel features, both as a Golog has a number of novel features, both as a programming language and as an implementation tool.programming language and as an implementation tool.

Though Golog has several limitations, the extended Though Golog has several limitations, the extended versions of Golog (like ConGolog, cc-Golog etc.) versions of Golog (like ConGolog, cc-Golog etc.) address most of these limitations in appropriate ways.address most of these limitations in appropriate ways.

Thus Golog forms a stepping stone creating real world Thus Golog forms a stepping stone creating real world applications in dynamic domains. applications in dynamic domains.

Page 40: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 4040

ReferencesReferences

• Hector J. Levesque, Raymond Reiter, Yves Lesperance, Hector J. Levesque, Raymond Reiter, Yves Lesperance, Fangzhen Lin, and Richard Scherl, "Golog: A logic Fangzhen Lin, and Richard Scherl, "Golog: A logic programming language for dynamic domains”, programming language for dynamic domains”, Journal of Journal of Logic Programming, Logic Programming, 3131, 59-84, (1997)., 59-84, (1997).

• J. McCarthy, P. Hayes, “Some philosophical problems J. McCarthy, P. Hayes, “Some philosophical problems from the standpoint of artificial intelligence”, In B. Meltzer from the standpoint of artificial intelligence”, In B. Meltzer and D. Michie, editors,and D. Michie, editors, Machine Intelligence Machine Intelligence,, 44, 463-502, , 463-502, (1969).(1969).

• Giuseppe De Giacomo, Yves Lesperance, and Hector J. Giuseppe De Giacomo, Yves Lesperance, and Hector J. Levesque, “Congolog, a concurrent programming Levesque, “Congolog, a concurrent programming language based on the situation calculus”, language based on the situation calculus”, Artificial Artificial IntelligenceIntelligence, 121(1-2), 109-169, (2000)., 121(1-2), 109-169, (2000).

• Henrik Grosskreutz, and Gerald Lakemeyer, “ccGolog - Henrik Grosskreutz, and Gerald Lakemeyer, “ccGolog - An action language with continuous change” An action language with continuous change” Logic Logic Journal of the IGPLJournal of the IGPL, , 1111(2), 179-221, (2003).(2), 179-221, (2003).

Page 41: CS 74.757 Formal Logic 1 GOLOG Maruthappan Shanmugasundaram (Satish) Graduate Student Department of Computer Science University of Manitoba Winnipeg, R3T

CS 74.757 Formal LogicCS 74.757 Formal Logic 4141

References (contd…)References (contd…)

• Giuseppe De Giacomo, and Hector J. Levesque, “An Giuseppe De Giacomo, and Hector J. Levesque, “An incremental interpreter for high-level programs with incremental interpreter for high-level programs with sensing”, In Hector J. Levesque and Fiora Pirri, editors, sensing”, In Hector J. Levesque and Fiora Pirri, editors, Logical Foundations for Cognitive AgentsLogical Foundations for Cognitive Agents, 86-102, , 86-102, (1999).(1999).

• Dirk Hahnel, Wolfram Burgard, and Gerhard Lakemeyer, Dirk Hahnel, Wolfram Burgard, and Gerhard Lakemeyer, "Golex - bridging the gap between logic (golog) and a "Golex - bridging the gap between logic (golog) and a real robot" in real robot" in Proceedings of the 22nd German Proceedings of the 22nd German Conference on Artificial Intelligence (KI 98),Conference on Artificial Intelligence (KI 98), (1998). (1998).

• Henrik Grosskreutz, and Gerhard Lakemeyer, “Turning Henrik Grosskreutz, and Gerhard Lakemeyer, “Turning high-level plans into robot programs in uncertain high-level plans into robot programs in uncertain domains”, domains”, In ECAI’2000, In ECAI’2000, (2000).(2000).