1 deransart, ducassé, ferrand wlpe 20071 observational semantics of the prolog resolution box model...

30
1 Deransart, Ducassé, Ferrand WLPE 20 07 1 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand INRIA-Rocquencourt, IRISA-Rennes, LIFO- Orléans 13 September 2007

Upload: martin-fowler

Post on 17-Dec-2015

218 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

1

Deransart, Ducassé, Ferrand WLPE 2007 1

Observational Semantics of the Prolog Resolution

Box Model

Pierre Deransart, Mireille Ducassé, Gérard FerrandINRIA-Rocquencourt, IRISA-Rennes, LIFO-Orléans13 September 2007WLPE’07

Page 2: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

2

Deransart, Ducassé, Ferrand WLPE 2007 2

LoriaPissaro, 1871

Sophia Antipolis

Irisa

Rhône-Alpes

Futurs

Research Centers

Rocquencourt, 2007

Page 3: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

3

Deransart, Ducassé, Ferrand WLPE 2007 3

ICLP 2005, St Malo

Page 4: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

4

Deransart, Ducassé, Ferrand WLPE 2007 4

JFPLC 97, Orléans

Page 5: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

5

Deransart, Ducassé, Ferrand WLPE 2007 5

Prolog Box Model by Lawrence Byrd, 1980

Page 6: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

6

Deransart, Ducassé, Ferrand WLPE 2007 6

Prolog Box Model, latter

Page 7: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

7

Deransart, Ducassé, Ferrand WLPE 2007 7

CONTEXT, HISTORYFrom DiSCiPl to OADymPPaC

•DiSCiPl (1997-2000): enhance constraint debugging: resulted in prototypes, but still ad-hoc tools for correctness and performance analysis, but also showed usefulness of “visual traces”.

Book: P. Deransart and M. Hermenegildo and J. Maluszynski, Analysis and Visualization Tools for Constraint Programming, LNCS 1870, 2000

•OADymPPaC (2001-2004) URL: http://contraintes.inria.fr/OADymPPaC participants: A. Aggoun, T. Baudel, P. Deransart, M. Ducassé, F.Fages, J.D. Fekete, N. Jussien, C. de Sainte-Marie, …

main solved challenges:• Interoperability of tools: splitting: “trace” and “visualization”

• Scaling: possibility to handle hundreds of variables and constraints ----> use of specialized HMI

Resulted in powerful analyzers (prototypes and products), but worked on one domain and raised some problems

Page 8: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

8

Deransart, Ducassé, Ferrand WLPE 2007 8

GENERICITY and INTEROPERABILITY PRINCIPLES

Page 9: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

9

Deransart, Ducassé, Ferrand WLPE 2007 9

NEW PROBLEMS

OADymPPaC identified some bottlenecks:

•Trace Semantics (related to its genericity): what is the exact nature of the “Observational Semantics”

•Modeling of the Interactions between Observed Process and Analysis Tools

•How to keep the whole system efficient (need to evaluate efficiency)

•Is the approach generic itself? Can it be applied to new domains: software engineering, data stream analysis, cognition

Page 10: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

10

Deransart, Ducassé, Ferrand WLPE 2007 10

Ways to ANSWER to the PROBLEMS

•*Trace Semantics (related to its genericity): what is the exact nature of the “Observational Semantics”: model of trace for a family of processes

•Modeling of the Interactions between Observed Process and Analysis Tools: Introduction of Tracer Driver and Analyzer Manager

•How to keep the whole system efficient (need to evaluate efficiency): Concepts of Virtual full Trace, Actual incremental Trace extraction and rebuilding

•*Is the approach generic itself? Can it be applied to new domains (not just constraints) in particular in software engineering can the approach (full trace with partial OS, interactive tracer driver) be applied in new domains

Page 11: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

11

Deransart, Ducassé, Ferrand WLPE 2007 11

ORGANISATION

•History

•The meaning of traces

•Different traces (virtual and actual)

•Observational semantics of the box model

•Actual trace extraction

•Virtual trace rebuilding

•Conclusions

Page 12: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

12

Deransart, Ducassé, Ferrand WLPE 2007 12

What does it mean?

1 1 Call goal

2 2 Call p(X)

2 2 Exit p(a)

3 2 Call eq(a,b)

3 2 Fail eq(a,b)

2 2 Redo p(a)

2 2 Exit p(b)

4 2 Call eq(b,b)

4 2 Exit eq(b,b)

1 1 Exit goal

Page 13: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

13

Deransart, Ducassé, Ferrand WLPE 2007 13

And this?

1 Call

2 Call

2 Exit

3 Call

3 Fail

2 Redo

2 Exit

4 Call

4 Exit

1 Exit

??

Page 14: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

14

Deransart, Ducassé, Ferrand WLPE 2007 14

Page 15: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

15

Deransart, Ducassé, Ferrand WLPE 2007 15

Easier?

1 Call

2 Call

2 Exit

3 Call

3 Fail

2 Redo

2 Exit

4 Call

4 Exit

1 Exit

??

Page 16: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

16

Deransart, Ducassé, Ferrand WLPE 2007 16

A two stages understanding

1. Finding relevant concepts and relations whose evolution is coded in the trace (Trace Interpretation)

2. Relating these concepts with some real or hypothetic process from which the trace is or may be originated.(Observational Semantics)

Page 17: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

17

Deransart, Ducassé, Ferrand WLPE 2007 17

FULL VIRTUAL TRACE

unbounded sequence of trace events of the form

et: (t, at, St+1)

•et: unique identifier of the event

•t: chrono. Time of the trace

•at: kind of event, an identifier characterizing the kind of actions from which the process changed from St to St+1.

at belongs to a finite set R.

•St = p1,t..., pn,t : values of parameters at chrono t. St is the current full virtual state

Page 18: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

18

Deransart, Ducassé, Ferrand WLPE 2007 18

ACTUAL TRACE

unbounded sequence of trace events wt of the form

e’t : (t, At)

•e’t: unique identifier of the event

•t: chrono. Time of the trace

•At = set of attribute values

Extraction function: At = E(St,St+1). (Trace Schema)

Rebuilding function: Qt = C(wt*,Q0).

Q0 restriction of S0 (Trace interpretation)

Page 19: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

19

Deransart, Ducassé, Ferrand WLPE 2007 19

Full Virtual Trace: evolution of a full virtual state

Full Virtual State

Initial State: S0

{ {goalcl-listtrfafa

Page 20: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

20

Deransart, Ducassé, Ferrand WLPE 2007 20

Virtual Trace: Observational Semantics

Page 21: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

21

Deransart, Ducassé, Ferrand WLPE 2007 21

Page 22: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

22

Deransart, Ducassé, Ferrand WLPE 2007 22

Page 23: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

23

Deransart, Ducassé, Ferrand WLPE 2007 23

And actual trace extraction:

Page 24: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

24

Deransart, Ducassé, Ferrand WLPE 2007 24

Example

goal:-p(X),eq(X,b).

p(a).

p(b).

eq(X,X).

chrono nu(u) lp(u) port pd(u) Reached virtual state

1 1 1 Call goal S2

2 2 2 Call p(X) S3

3 2 2 Exit p(a) S4

4 3 2 Call eq(a,b) S5

5 3 2 Fail eq(a,b) S6

6 2 2 Redo p(a) S7

7 2 2 Exit p(b) S8

8 4 2 Call eq(b,b) S9

9 4 2 Exit eq(b,b) S10

10 1 1 Exit goal S11

Page 25: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

25

Deransart, Ducassé, Ferrand WLPE 2007 25

Page 26: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

26

Deransart, Ducassé, Ferrand WLPE 2007 26

Actual state reconstruction

Full virtual state: S

Actual state Q

Initial state: S0

Initial rebuilt state: Q0 = S0/Q (restriction of S to Q )

{ {goalcl-listtrfafa

Page 27: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

27

Deransart, Ducassé, Ferrand WLPE 2007 27

Interpretation Schema (rebuilding)

Page 28: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

28

Deransart, Ducassé, Ferrand WLPE 2007 28

Faithfulness

We develop methods to prove faithfulness

C is a faithful trace interpretation w.r.t. the OS and E, if for all actual trace Tw = <Q0,wt*>, t >=0, Q0 = S0/Q

for all i in [0…t-1] , there exists Si+1 such that

Ai = E(Si,Si+1) and C(wt*,Q0)= Si/Q

(Ai attributes of wi)

Page 29: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

29

Deransart, Ducassé, Ferrand WLPE 2007 29

CONCLUSIONS

•We may see

• the trace interpretation as the proper semantics of a trace

• the observational semantics as a semantics of the virtual trace

•Faithfulness guarantees that both combine well, and that traces are completely understood (interpretation and production)

•Ongoing work: definition of a virtual trace for CHR

•About the Prolog trace model:

• Our semantics allows trace reading at several levels of comprehensibility

• It is a model of Prolog tracers (not of Prolog, not unique)

• The Byrd’s box model is simple, beautiful, but incomplete, unsatisfactory, etc…but this all of you know very well

Page 30: 1 Deransart, Ducassé, Ferrand WLPE 20071 Observational Semantics of the Prolog Resolution Box Model Pierre Deransart, Mireille Ducassé, Gérard Ferrand

30

Deransart, Ducassé, Ferrand WLPE 2007 30

Thank you!

P. Deransart, M. Ducassé, G. FerrandObservational Semantics of the Prolog Resolution

Box Model May 2007(comprehensive version, in French)INRIA, RR 6229http://hal.inria.fr/inria-00151285