L
A
T EX & P4
A Rho calculus for graph rewriting
Clara Bertolissi joint work with Horatiu Cirstea, and Claude Kirchner (LORIA) & Paolo Baldan, and Furio Honsell (Univ.UDINE/VENEZIA)
Clara Bertolissi RHO WORKSHOP, March 12, 2004 1
A Rho calculus for graph rewriting Clara Bertolissi joint work - - PowerPoint PPT Presentation
EX & P 4 L T A A Rho calculus for graph rewriting Clara Bertolissi joint work with Horatiu Cirstea, and Claude Kirchner (LORIA) & Paolo Baldan, and Furio Honsell (Univ.UDINE/VENEZIA) Clara Bertolissi RHO WORKSHOP, March 12, 2004
L
A
T EX & P4
Clara Bertolissi joint work with Horatiu Cirstea, and Claude Kirchner (LORIA) & Paolo Baldan, and Furio Honsell (Univ.UDINE/VENEZIA)
Clara Bertolissi RHO WORKSHOP, March 12, 2004 1
Term Graph rewriting: directed acyclic graphs
Rewrite rules often ask for duplication of subterms: Sxyz → xz(yz) How to save space in actual implementations? Working with pointers to share subterms.
Clara Bertolissi RHO WORKSHOP, March 12, 2004 2
One step further: cyclic graphs
Cycles arise naturally in recursive structures. The optimized representation of the fixed point combinator Y M → M (Y M) is using a cyclic graph
Clara Bertolissi RHO WORKSHOP, March 12, 2004 3
Graph rewriting: different approaches
[Corradini,Montanari,Gadducci95], . . .
[Barendregt et all87],[Plump98],[Kennaway94],. . .
[Ariola,Klop97], . . .
Clara Bertolissi RHO WORKSHOP, March 12, 2004 4
1) GRHO-L: labels as pointers
Clara Bertolissi RHO WORKSHOP, March 12, 2004 5
Examples
unwinding)?
Clara Bertolissi RHO WORKSHOP, March 12, 2004 6
Example of reduction
Clara Bertolissi RHO WORKSHOP, March 12, 2004 7
Advantages/Drawbacks of GRHO-L
– Variables are maximally shared – Possibility of dealing with cycles in rewrite rules and matching – Matching algorithm suitable for different theories
– Problems in the correspondence between term rewriting and graph rewriting. – Evaluation rules difficult to write in a compact way – Matching needs non local contexts
Clara Bertolissi RHO WORKSHOP, March 12, 2004 8
2) GRHO-G: generalising cyclic lambda graphs
Clara Bertolissi RHO WORKSHOP, March 12, 2004 9
Examples
construction
y cannot be seen outside its letrec construction.
bound by the letrec construction, not by the arrow.
Clara Bertolissi RHO WORKSHOP, March 12, 2004 10
Example of reduction
the list of equations of the rhs.
f(y) | x = a, y = b →s f(b) | x = a, y = b
Clara Bertolissi RHO WORKSHOP, March 12, 2004 11
Advantages/Drawbacks of GRHO-G
– Matching can be defined at the calculus level – Problems of scope are partially solved by the local definition of names as variables
– Lost of some sharing – The natural notion of substitution causes non confluence – Matching: not easy generalisation to cyclic graphs
Clara Bertolissi RHO WORKSHOP, March 12, 2004 12
Comparing the two choises
– Using variables instead of labels allows a better control on the scope – Evaluation rules are easier to describe syntactically
– Redirections of pointers avoid copying when applying substitution – The matching algorithm can be easily adapted according to the graph relation we choose: homomorphism, bisimulation, . . .
Clara Bertolissi RHO WORKSHOP, March 12, 2004 13
Open problems
functional and relational graph bisimulation.
ρ-reductions on correspondent terms.
more convenient?
Clara Bertolissi RHO WORKSHOP, March 12, 2004 14
Higher-order term rewriting ➲ Representation of the CRS (term-rewrite system + abstractor) in the RHO
➲ Corollary: indirect representation of HRS in the RHO (using the equivalence of CRS and HRS in [vOvR93])
Clara Bertolissi RHO WORKSHOP, March 12, 2004 15
Translation of the CRS in the RHO CRS − → RHO R − → R A − → A Translation of the HRS in the RHO HRS − → CRS + Beta − → RHO R − → R′ + Beta − → R′ + Beta A − → A′ − → A′
Clara Bertolissi RHO WORKSHOP, March 12, 2004 16
Correction and completeness of the translation Given a CRS-derivation t0 → →CRS tn There exist n ρ-terms un . . . u0 such that every correspondent RHO-derivation terminates and converges to tn . . .
∗
. . . . . . . . . . . un(. . . (u0 t0))
∗
. . tn . . .
∗
Clara Bertolissi RHO WORKSHOP, March 12, 2004 17