Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

32
Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    226
  • download

    0

Transcript of Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Page 1: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Formal Modelingof Concurrent Processes:

PI and API Calculi

Shahram Rahimi

Page 2: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Introduction

• A formal model based on a process calculus could address several questions regarding:– preliminary evaluation– validation and verification, – performance,– security,

• Development of a formal model, capable of representation of a variety of agents/processes involved in the system, can address these concerns.

Page 3: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Introduction

• None of the current calculi covers all the natural characteristics of intelligent-agent based systems including: – Intelligence representation, – Organizational grouping, and – security aspects

Api-Calculus, and extended pi-calculus

Page 4: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

The API-Calculus

• An extension to PI-Calculus is a formal modeling calculus for multi-process and multi-agent systems

• addresses the migration, intelligence, organizational grouping, and potentially security aspect of processes and agents.

• introduces three core concepts:– Process (or agent)– Term– Milieu– Knowledge Unit

Page 5: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Definition I: Term:• (term)

(name) (fact or rule)

(functions)

Term

TR,

,...,, zyx,...,, cba

,...),,( zyxf

Page 6: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

A term can be a name, fact/rule or a function:

• A name can be a channel or a variable name.

• A term may be a function. – A function may have l parameters. – f ranges over the functions of and one

matches the arity of f

Term (cont.)

Page 7: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Process (cont.)

• The following expression define a process: 

(no action)(action prefix)(summation process)(conditional process)

(name restriction)(knowledge name restriction)(replication)

(constant)

0PP.|

21| PP

21 :][| PPRT

xP|

PK i )(|

P!|

LD

|

Page 8: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Knowledge Unit

• “Intelligence” considered to be a single or a group of knowledge units (KUs).

• A KU consists of a knowledge base and a set of facts.

• Agents/processes may add/drop facts to/from the fact list and modify the knowledge base by adding new rules or eliminating existing ones.

• Agents/processes are capable of carrying one or more knowledge units and sending and receiving them to/from other agents.

Page 9: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Knowledge Unit (cont.)

• A knowledge unit reacts to any new fact(s)

• K1, K2,… represents knowledge units.

• Ki denotes the set of knowledge units of process i (Pi).

• Here is the grammar of knowledge units:

K ≡ 0 (empty knowledge unit)

| r (a single rule)

| K1+K2 (knowledge units summation)

Page 10: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Knowledge Unit (cont.)

• 0 empty knowledge unit. – if all the rules and facts are deleted from it.

• A knowledge unit may consist of a single rule.

• K1+K2 knowledge unit summation

– both of the knowledge units react to a fact at the same time.

Page 11: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Actions

• We replace names with ‘terms’ and processes in Api actions.

is an internal process.•      is an input prefix.

– x stands for a name of an input port (channel) – stands for any tuple of processes or terms. – inputs arbitrary terms or processes at the

port x and then behaves like . – All free occurrences of the names in P are bound by

this action.

L

PLx ).(

1L

}/{ 1 LLP

L

)(Lx

Page 12: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Actions (cont.)

• is an output prefix. – name x is as an output port – outputs the tuple of terms or processes

at the port x and then behaves like P.

Lx

PLx .

L

Page 13: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Actions (cont.)

• is a knowledge unit call. - calls the knowledge unit, Ki, passes a list of

facts and places the results in .

- All free occurrences of in P are bound.

)(RaK i

R

R

Page 14: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Actions (cont.)

• is a prefix that adds tuple to the facts list of Ki, if it is a tuple of facts, or to

the rule list if it is a tuple of rules.

• is a prefix which drops a from the facts list (if a is a fact) or from the rule base (if a is a rule).

)(aK i

a

aK i

Page 15: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Actions (cont)

• join m.P makes process P to join milieu m and then acts like P inside of the milieu m.

• leave m.P makes process P to leave milieu m and then acts like P outside of milieu m.

Page 16: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Milieu

• The existence of separate locations is represented by a topology of boundaries.

• A Milieu is an environment (a bounded place) in which processes live and computations take place.

Page 17: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Milieu (cont.)

• A milieu is surrounded by a border, which needs to be passed to join or leave it.

• A whole milieu can move together with its whole content (all the processes/milieus inside the milieu) into another milieu.

• The concept of milieu can be used to address the problem of organizational grouping and security.

Page 18: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Milieu (cont.)

openmleavemjoin

M

MM

OOM

OM

M

||

.

]|[

][

0

1

21

21

Page 19: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Milieu (cont.)

• M[O] exhibits a tree structure induced by processes and the nesting of milieu brackets, i.e:

M[P1|…|Pp|M1[…]|…|Mq[…]].

• process mobility is represented as crossing of milieus’ boundaries.

• interaction between processes is by shared location within a common boundary or outside of any boundary.

Page 20: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

PPTT ..][

321321 )()( OOOOOO

1221 OOOO

11 0 OO

321321 |)|()|(| OOOOOO

OOO

1221 || OOOO

OO 0|

PTTPTT 1221

00 T)(,|)|( 12121 PftTifPTPPPT

PPP !|!

SC 1, Match

SC 2, Summation Associativity

SC 3, Summation Commutativity

SC 4, Summation Identity

SC 5, Composition Associativity

SC 6, Same Process

SC 7, Composition Commutativity

SC 8, Composition Identity

SC 9, Restriction

SC 10, Restriction Identity

SC 11, Restriction Composition

SC 12, Replication

Page 21: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Reflexivity O = O

Symmetry O1 = O2 implies O2 = O1

Transitivity O1 = O2 and O2 = O3 implies

O1 = O3

Generality P = Q implies C[P] = C [Q]

The rules of equational reasoning

Page 22: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Reduction Rules

PQP .

2121

11

|| OOOO

OO

QTPT

QP

QKPK

QP

)()(

][][ QMPM

QP

212122

11 OOandOOifOO

OO

TAU:

REACT:

PAR: RES: RES-K:

MIL:

STRUCT:

QT

RPQQRxPPTx |}{).(|)).((

Page 23: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Example 1: simple knowledge unit passing A knowledge unit with a private (local) name:

A knowledge unit with a non-private name:

Ki

Ki

P Qx

K1 K2

P' Q"

K1

K2

x

}/{'|'').(|'. 1111 KKQPQKxPKx

Page 24: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Abbreviations

1)Sometimes a communication needs to carry no parameter. To model this we presuppose a special name, , which is never bound; then we write:

)().(...

PinfreenotyPyxofplaceinPxPxofplaceinPx

Page 25: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Abbreviations (cont.)

2) We shall often omit ‘.0’ in an process, and write:

3) We often wish to allow input names to determine the course of computation.

to:

0.yxofplaceinyx

...)][]).([( 2211 PyvPyvvx

,...],[: 2211 PyPyx

Page 26: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Abbreviations (cont.)

4) Some composite prefixes:

nn yxyxmeansyyx ...... 11

)(...)()(...)( 11 nn yxyxmeansyyx

nn MjoinMjoinmeansMMjoin ...... 11

nn MleaveMleavemeansMMleave ...... 11

Page 27: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Abbreviations (cont.)

5) If a process leave a milieu just to communicate with a second process:

if the process needs to leave n milieus to communicate then:

PMjoinaxMleavemeansPjaxl ......

PMjoinMjoinaxMleaveMleave

meansPjaxl

nn

nn

.........

...

11

Page 28: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Example 2:knowledge unit call

• P receives a fact, a, from agent Q and then calls knowledge unit K1 by adding the fact to K1 facts

list and then behaving like P’ which in fact is the same as P{a/b}.

QbaPQaxPbx |/.|.

PPyaK i ).(

Page 29: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Example 3:Joining and Leaving Milieus

P 2P 1

M 1

M 2

Q 2Q 1

M 2M 1

P 2

P 1

Q 2Q 1

]|[]0[|.|. 21112111 PPMMPMjoinPMjoin ]]|[||[]|[. 2112122112 PPMQQMPPMMjoin

Page 30: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Example 4:Interaction Between Processes

M 2

M 1 P

Q

K

M 2

M 1

PQ

K

x

]|]0[|[]].[|[ 12112 PMQMPMleaveMQM

]]0[||[]|]0[|[ 1212 MPQMPMQM

]]0[||).([]]0[||[ 1212 MaPxQbxMMPQM

]]0[||).([]]0[||}/{[]]0[||).([ 121212 MPQaKMMPbaQMMaPxQbxM

Page 31: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

Discussion I

Api-calculus is capable of addressing several issues in intelligent agent modeling including:– Intelligence representation, – natural grouping (a new level of abstraction),and– potentially security

Page 32: Formal Modeling of Concurrent Processes: PI and API Calculi Shahram Rahimi.

• What are we missing?– Security details – Milieu ports– Compiler/Analyzer

– There are more!!!

Discussion II