300 likes | 439 Views
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 WLPE’07. Research Centers. Pissaro, 1871. Loria. Rhône-Alpes. Rocquencourt, 2007. Futurs. Irisa.
E N D
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 WLPE’07 Deransart, Ducassé, Ferrand WLPE 2007
Research Centers Pissaro, 1871 Loria Rhône-Alpes Rocquencourt, 2007 Futurs Irisa Sophia Antipolis Deransart, Ducassé, Ferrand WLPE 2007
ICLP 2005, St Malo Deransart, Ducassé, Ferrand WLPE 2007
JFPLC 97, Orléans Deransart, Ducassé, Ferrand WLPE 2007
Prolog Box Model by Lawrence Byrd, 1980 Deransart, Ducassé, Ferrand WLPE 2007
Prolog Box Model, latter Deransart, Ducassé, Ferrand WLPE 2007
CONTEXT, HISTORY • From 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, LNCS1870, 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 Deransart, Ducassé, Ferrand WLPE 2007
GENERICITY and INTEROPERABILITY PRINCIPLES Deransart, Ducassé, Ferrand WLPE 2007
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 Deransart, Ducassé, Ferrand WLPE 2007
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 Deransart, Ducassé, Ferrand WLPE 2007
ORGANISATION • History • The meaning of traces • Different traces (virtual and actual) • Observational semantics of the box model • Actual trace extraction • Virtual trace rebuilding • Conclusions Deransart, Ducassé, Ferrand WLPE 2007
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 Deransart, Ducassé, Ferrand WLPE 2007
And this? 1 Call 2 Call 2 Exit 3 Call 3 Fail 2 Redo 2 Exit 4 Call 4 Exit 1 Exit ?? Deransart, Ducassé, Ferrand WLPE 2007
Easier? 1 Call 2 Call 2 Exit 3 Call 3 Fail 2 Redo 2 Exit 4 Call 4 Exit 1 Exit ?? Deransart, Ducassé, Ferrand WLPE 2007
A two stages understanding • Finding relevant concepts and relations whose evolution is coded in the trace (Trace Interpretation) • Relating these concepts with some real or hypothetic process from which the trace is or may be originated.(Observational Semantics) Deransart, Ducassé, Ferrand WLPE 2007
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 currentfull virtual state Deransart, Ducassé, Ferrand WLPE 2007
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) Deransart, Ducassé, Ferrand WLPE 2007
Full Virtual Trace: evolution of a full virtual state Full Virtual State Initial State: S0 { {e}, e, 1, {(e,1)}, {(e, goal)}, {e, cl-list}, {e, tr}, fa , fa } Deransart, Ducassé, Ferrand WLPE 2007
Virtual Trace: Observational Semantics Deransart, Ducassé, Ferrand WLPE 2007
And actual trace extraction: Deransart, Ducassé, Ferrand WLPE 2007
Example 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 • goal:-p(X),eq(X,b). • p(a). • p(b). • eq(X,X). Deransart, Ducassé, Ferrand WLPE 2007
Actual state reconstruction Full virtual state: S Actual stateQ Initial state: S0 { {e}, e, 1, {(e,1)}, {(e, goal)}, {e, cl-list}, {e, tr}, fa , fa } Initial rebuilt state: Q0 = S0/Q(restriction of S to Q ) Deransart, Ducassé, Ferrand WLPE 2007
Interpretation Schema (rebuilding) Deransart, Ducassé, Ferrand WLPE 2007
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 existsSi+1 such that Ai = E(Si,Si+1) andC(wt*,Q0)= Si/Q (Ai attributes of wi) We develop methods to prove faithfulness Deransart, Ducassé, Ferrand WLPE 2007
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 Deransart, Ducassé, Ferrand WLPE 2007
Thank you! P. Deransart, M. Ducassé, G. Ferrand Observational Semantics of the Prolog Resolution Box Model May 2007 (comprehensive version, in French) INRIA, RR 6229 http://hal.inria.fr/inria-00151285 Deransart, Ducassé, Ferrand WLPE 2007