Infinitary Term Graph Rewriting is Simple, Sound and Complete - - PowerPoint PPT Presentation
Infinitary Term Graph Rewriting is Simple, Sound and Complete - - PowerPoint PPT Presentation
Infinitary Term Graph Rewriting is Simple, Sound and Complete Patrick Bahr paba@diku.dk University of Copenhagen Department of Computer Science 23rd International Conference on Rewriting Techniques and Applications, Nagoya, Japan, March May
Infinitary Rewriting vs. Term Graph Rewriting
Pick one to avoid the other.
2
Infinitary Rewriting vs. Term Graph Rewriting
Pick one to avoid the other.
Pick term graph rewriting finite representation of infinite terms (via cycles) finite representation of infinite rewrite sequences
f g b h
2
Infinitary Rewriting vs. Term Graph Rewriting
Pick one to avoid the other.
Pick term graph rewriting finite representation of infinite terms (via cycles) finite representation of infinite rewrite sequences
f g b h
Pick infinitary rewriting avoid dealing with term graphs work on the unravelling instead
f g b h g b f g b h g c
2
Infinitary Term Graph Rewriting – What is it for?
A common formalism study correspondences between infinitary TRSs and finitary GRSs
3
Infinitary Term Graph Rewriting – What is it for?
A common formalism study correspondences between infinitary TRSs and finitary GRSs Lazy evaluation infinitary term rewriting only covers non-strictness however: lazy evaluation = non-strictness + sharing
3
Infinitary Term Graph Rewriting – What is it for?
A common formalism study correspondences between infinitary TRSs and finitary GRSs Lazy evaluation infinitary term rewriting only covers non-strictness however: lazy evaluation = non-strictness + sharing towards infinitary lambda calculi with letrec Ariola & Blom. Skew confluence and the lambda calculus with letrec. the calculus is non-confluent but there is a notion of infinite normal forms
3
Approach
Previous approach (RTA ’11) weak convergence two modes of convergence: metric & partial order
4
Approach
Previous approach (RTA ’11) weak convergence two modes of convergence: metric & partial order result:
◮ correspondence between metric & partial order approach ◮ soundness w.r.t. infinitary term rewriting (sorta kinda) 4
Approach
Previous approach (RTA ’11) weak convergence two modes of convergence: metric & partial order result:
◮ correspondence between metric & partial order approach ◮ soundness w.r.t. infinitary term rewriting (sorta kinda)
problem: complicated; difficult to analyse; completeness ??
4
Approach
Previous approach (RTA ’11) weak convergence two modes of convergence: metric & partial order result:
◮ correspondence between metric & partial order approach ◮ soundness w.r.t. infinitary term rewriting (sorta kinda)
problem: complicated; difficult to analyse; completeness ?? Our new approach strong convergence two modes of convergence: metric & partial order
4
Approach
Previous approach (RTA ’11) weak convergence two modes of convergence: metric & partial order result:
◮ correspondence between metric & partial order approach ◮ soundness w.r.t. infinitary term rewriting (sorta kinda)
problem: complicated; difficult to analyse; completeness ?? Our new approach strong convergence two modes of convergence: metric & partial order but: simpler (ignoring the sharing as much as possible)
4
Approach
Previous approach (RTA ’11) weak convergence two modes of convergence: metric & partial order result:
◮ correspondence between metric & partial order approach ◮ soundness w.r.t. infinitary term rewriting (sorta kinda)
problem: complicated; difficult to analyse; completeness ?? Our new approach strong convergence two modes of convergence: metric & partial order but: simpler (ignoring the sharing as much as possible) result:
◮ correspondence between metric & partial order approach ◮ soundness w.r.t. infinitary term rewriting ◮ completeness w.r.t. infinitary term rewriting 4
Approach
Previous approach (RTA ’11) weak convergence two modes of convergence: metric & partial order result:
◮ correspondence between metric & partial order approach ◮ soundness w.r.t. infinitary term rewriting (sorta kinda)
problem: complicated; difficult to analyse; completeness ?? Our new approach strong convergence = ⇒ independence from the rewriting formalism two modes of convergence: metric & partial order but: simpler (ignoring the sharing as much as possible) result:
◮ correspondence between metric & partial order approach ◮ soundness w.r.t. infinitary term rewriting ◮ completeness w.r.t. infinitary term rewriting 4
Outline
1
Introduction Goals A Different Approach
2
Modes of Convergence on Term Graphs Metric Approach Partial Order Approach Metric vs. Partial Order Approach
5
Metric Infinitary Term Rewriting
Complete metric on terms terms are endowed with a complete metric in order to formalise the convergence of infinite reductions. metric distance between terms: d(s, t) = 2−sim(s,t) sim(s, t) = maximum depth d s.t. s and t coincide up to depth d
6
Metric Infinitary Term Rewriting
Complete metric on terms terms are endowed with a complete metric in order to formalise the convergence of infinite reductions. metric distance between terms: d(s, t) = 2−sim(s,t) sim(s, t) = maximum depth d s.t. s and t coincide up to depth d Strong convergence via metric d and redex depth convergence in the metric space (T ∞(Σ), d)
- depth of the differences between the terms has to tend to infinity
6
Metric Infinitary Term Rewriting
Complete metric on terms terms are endowed with a complete metric in order to formalise the convergence of infinite reductions. metric distance between terms: d(s, t) = 2−sim(s,t) sim(s, t) = maximum depth d s.t. s and t coincide up to depth d Strong convergence via metric d and redex depth convergence in the metric space (T ∞(Σ), d)
- depth of the differences between the terms has to tend to infinity
depth of redexes has to tend to infinity
6
Example: Metric Convergence in TRSs
from from(x) → x :: from(s(x))
7
Example: Metric Convergence in TRSs
from :: from 1 from(x) → x :: from(s(x))
7
Example: Metric Convergence in TRSs
from :: :: 1 from 2 from(x) → x :: from(s(x))
+ 7
Example: Metric Convergence in TRSs
1 level from :: :: 1 from 2 from(x) → x :: from(s(x))
+ 7
Example: Metric Convergence in TRSs
1 level from :: :: 1 :: 2 from 3 from(x) → x :: from(s(x))
+ 7
Example: Metric Convergence in TRSs
2 levels from :: :: 1 :: 2 from 3 from(x) → x :: from(s(x))
+ 7
Example: Metric Convergence in TRSs
2 levels from :: :: 1 :: 2 :: 3 from 4 from(x) → x :: from(s(x))
+ 7
Example: Metric Convergence in TRSs
3 levels from :: :: 1 :: 2 :: 3 from 4 from(x) → x :: from(s(x))
+ 7
Example: Metric Convergence in TRSs
3 levels from :: :: 1 :: 2 :: 3 :: 4 from(x) → x :: from(s(x))
ω 7
Example: Metric Convergence in TRSs
from :: :: 1 :: 2 :: 3 :: 4 from(x) → x :: from(s(x))
ω 7
A Metric on Term Graphs
Depth of a node = length of a shortest path from the root to the node.
8
A Metric on Term Graphs
Depth of a node = length of a shortest path from the root to the node. Truncation of term graphs The truncation g†d is obtained from g by relabelling all nodes at depth d with ⊥, and removing all nodes that thus become unreachable from the root.
8
A Metric on Term Graphs
Depth of a node = length of a shortest path from the root to the node. Truncation of term graphs The truncation g†d is obtained from g by relabelling all nodes at depth d with ⊥, and removing all nodes that thus become unreachable from the root. The simple metric on term graphs d†(g, h) = 2−sim†(g,h) Where sim†(g, h) = maximum depth d s.t. g†d ∼ = h†d.
8
A Metric on Term Graphs
Depth of a node = length of a shortest path from the root to the node. Truncation of term graphs The truncation g†d is obtained from g by relabelling all nodes at depth d with ⊥, and removing all nodes that thus become unreachable from the root. The simple metric on term graphs d†(g, h) = 2−sim†(g,h) Where sim†(g, h) = maximum depth d s.t. g†d ∼ = h†d. Strong convergence via metric d† and redex depth convergence in the metric space (G∞
C (Σ), d†)
depth of redexes has to tend to infinity
8
Soundness & Completeness
9
Soundness & Completeness
soundness of metric convergence g h
m
s U (·) U (R) R
9
Soundness & Completeness
soundness of metric convergence g h
m
s U (·) U (R) R t
m
U (·)
9
Soundness & Completeness
Theorem (soundness of metric convergence) For every left-linear, left-finite GRS R we have g h
m
s U (·) U (R) R t
m
U (·)
9
Soundness & Completeness
Theorem (soundness of metric convergence) For every left-linear, left-finite GRS R we have g h
m
s U (·) U (R) R t
m
U (·) Completeness property s t
m
g U (·) U (R) R
9
Soundness & Completeness
Theorem (soundness of metric convergence) For every left-linear, left-finite GRS R we have g h
m
s U (·) U (R) R t
m
U (·) Completeness property s t
m
g U (·) U (R) R h
m
U (·)
9
Soundness & Completeness
Theorem (soundness of metric convergence) For every left-linear, left-finite GRS R we have g h
m
s U (·) U (R) R t
m
U (·) Completeness property s t
m
g U (·) U (R) R h
m
U (·)
9
Soundness & Completeness
Theorem (soundness of metric convergence) For every left-linear, left-finite GRS R we have g h
m
s U (·) U (R) R t
m
U (·) Completeness property s t
m
g U (·) U (R) R t′ h
m
U (·)
m
9
Soundness & Completeness
Theorem (soundness of metric convergence) For every left-linear, left-finite GRS R we have g h
m
s U (·) U (R) R t
m
U (·) Completeness property s t
m
g U (·) U (R) R t′ h
m
U (·)
m
[Kennaway et al., 1994]
9
Outline
1
Introduction Goals A Different Approach
2
Modes of Convergence on Term Graphs Metric Approach Partial Order Approach Metric vs. Partial Order Approach
10
Partial Order Infinitary Term Rewriting
Partial order on terms partial terms: terms with additional constant ⊥ (read as “undefined”) partial order ≤⊥ reads as: “is less defined than” ≤⊥ is a complete semilattice (= cpo + glbs of non-empty sets)
11
Partial Order Infinitary Term Rewriting
Partial order on terms partial terms: terms with additional constant ⊥ (read as “undefined”) partial order ≤⊥ reads as: “is less defined than” ≤⊥ is a complete semilattice (= cpo + glbs of non-empty sets) Convergence formalised by the limit inferior: lim inf
ι→α tι =
- β<α
- β≤ι<α
tι intuition: eventual persistence of nodes of the terms weak convergence: limit inferior of the terms of the reduction
11
Partial Order Infinitary Term Rewriting
Partial order on terms partial terms: terms with additional constant ⊥ (read as “undefined”) partial order ≤⊥ reads as: “is less defined than” ≤⊥ is a complete semilattice (= cpo + glbs of non-empty sets) Convergence formalised by the limit inferior: lim inf
ι→α tι =
- β<α
- β≤ι<α
tι intuition: eventual persistence of nodes of the terms weak convergence: limit inferior of the terms of the reduction strong convergence: limit inferior of the contexts of the reduction
11
Partial Order Infinitary Term Rewriting
Partial order on terms partial terms: terms with additional constant ⊥ (read as “undefined”) partial order ≤⊥ reads as: “is less defined than” ≤⊥ is a complete semilattice (= cpo + glbs of non-empty sets) Convergence formalised by the limit inferior: lim inf
ι→α tι =
- β<α
- β≤ι<α
tι intuition: eventual persistence of nodes of the terms weak convergence: limit inferior of the terms of the reduction strong convergence: limit inferior of the contexts of the reduction term obtained by replacing the redex with ⊥
11
Partial Order Convergence vs. Metric Convergence
Intuition of partial order convergence subterms that break m-convergence do p-converge to ⊥ every (continuous) reduction converges
12
Partial Order Convergence vs. Metric Convergence
Intuition of partial order convergence subterms that break m-convergence do p-converge to ⊥ every (continuous) reduction converges Theorem (total p-convergence = m-convergence) For every reduction S in a TRS the following equivalence holds: S : s ։
p t total
iff S : s ։
m t
12
Partial Order Convergence vs. Metric Convergence
Intuition of partial order convergence subterms that break m-convergence do p-converge to ⊥ every (continuous) reduction converges Theorem (total p-convergence = m-convergence) For every reduction S in a TRS the following equivalence holds: S : s ։
p t total
iff S : s ։
m t
Theorem (normalisation & confluence) Every orthogonal TRS is infinitarily normalising and infinitarily confluent w.r.t. strong p-convergence.
12
A Partial Order on Term Graphs – How?
Specialise on terms Consider terms as term trees (i.e. term graphs with tree structure) How to define the partial order ≤⊥ on term trees?
13
A Partial Order on Term Graphs – How?
Specialise on terms Consider terms as term trees (i.e. term graphs with tree structure) How to define the partial order ≤⊥ on term trees? ⊥-homomorphisms φ: g →⊥ h homomorphism condition suspended on ⊥-nodes allow mapping of ⊥-nodes to arbitrary nodes same mechanism describing matching in term graph rewriting
13
A Partial Order on Term Graphs – How?
Specialise on terms Consider terms as term trees (i.e. term graphs with tree structure) How to define the partial order ≤⊥ on term trees? ⊥-homomorphisms φ: g →⊥ h homomorphism condition suspended on ⊥-nodes allow mapping of ⊥-nodes to arbitrary nodes same mechanism describing matching in term graph rewriting Definition (Simple partial order ≤S
⊥ on term graphs)
For all g, h ∈ G∞(Σ⊥), let g ≤S
⊥ h iff there is some φ: g →⊥ h.
13
Partial Order Convergence on Term Graphs
Convergence Weak conv.: limit inferior of the term graphs along the reduction. Strong conv.: limit inferior of the contexts along the reduction.
14
Partial Order Convergence on Term Graphs
Convergence Weak conv.: limit inferior of the term graphs along the reduction. Strong conv.: limit inferior of the contexts along the reduction. Context Obtained by relabelling the root node of the redex with ⊥, and removing all nodes that become unreachable.
14
Partial Order Convergence on Term Graphs
Convergence Weak conv.: limit inferior of the term graphs along the reduction. Strong conv.: limit inferior of the contexts along the reduction. Context Obtained by relabelling the root node of the redex with ⊥, and removing all nodes that become unreachable. Example f f c f c
14
Partial Order Convergence on Term Graphs
Convergence Weak conv.: limit inferior of the term graphs along the reduction. Strong conv.: limit inferior of the contexts along the reduction. Context Obtained by relabelling the root node of the redex with ⊥, and removing all nodes that become unreachable. Example f f c f c
14
Partial Order Convergence on Term Graphs
Convergence Weak conv.: limit inferior of the term graphs along the reduction. Strong conv.: limit inferior of the contexts along the reduction. Context Obtained by relabelling the root node of the redex with ⊥, and removing all nodes that become unreachable. Example f f c f c context
14
Partial Order Convergence on Term Graphs
Convergence Weak conv.: limit inferior of the term graphs along the reduction. Strong conv.: limit inferior of the contexts along the reduction. Context Obtained by relabelling the root node of the redex with ⊥, and removing all nodes that become unreachable. Example f f c f c f f c f c context
14
Partial Order Convergence on Term Graphs
Convergence Weak conv.: limit inferior of the term graphs along the reduction. Strong conv.: limit inferior of the contexts along the reduction. Context Obtained by relabelling the root node of the redex with ⊥, and removing all nodes that become unreachable. Example f f c f c f f c ⊥ c context
14
Partial Order Convergence on Term Graphs
Convergence Weak conv.: limit inferior of the term graphs along the reduction. Strong conv.: limit inferior of the contexts along the reduction. Context Obtained by relabelling the root node of the redex with ⊥, and removing all nodes that become unreachable. Example f f c f c f f c ⊥ c context
14
Partial Order Convergence on Term Graphs
Convergence Weak conv.: limit inferior of the term graphs along the reduction. Strong conv.: limit inferior of the contexts along the reduction. Context Obtained by relabelling the root node of the redex with ⊥, and removing all nodes that become unreachable. Example f f c f c f f c ⊥ context
14
Metric vs. Partial Order Approach
Recall the situation on terms For every reduction S in a TRS S : s ։
p t total
⇐ ⇒ S : s ։
m t.
15
Metric vs. Partial Order Approach
Recall the situation on terms For every reduction S in a TRS S : s ։
p t total
⇐ ⇒ S : s ։
m t.
On term graphs For every reduction S in a GRS S : g ։
p h total
⇐ ⇒ S : g ։
m h.
15
Metric vs. Partial Order Approach
Recall the situation on terms For every reduction S in a TRS S : s ։
p t total
⇐ ⇒ S : s ։
m t.
On term graphs For every reduction S in a GRS S : g ։
p h total
⇐ ⇒ S : g ։
m h.
Theorem (soundness of partial order convergence) For every left-linear, left-finite GRS R we have g h
p
s U (·) U (R) R t
p
U (·)
15
Completeness for Partial Order Convergence
Theorem (Infinitary normalisation) For each term graph g, there is a reduction g ։
p h to a normal form h.
16
Completeness for Partial Order Convergence
Theorem (Infinitary normalisation) For each term graph g, there is a reduction g ։
p h to a normal form h.
Theorem (Completeness) Strong p-convergence in an orthogonal, left-finite GRS R is complete w.r.t. strong p-convergence in U (R). s t g U (·) t′ h U (·) U (R) R
16
Completeness for Partial Order Convergence
Theorem (Infinitary normalisation) For each term graph g, there is a reduction g ։
p h to a normal form h.
Theorem (Completeness) Strong p-convergence in an orthogonal, left-finite GRS R is complete w.r.t. strong p-convergence in U (R). Proof. s t g U (·) U (R) R
16
Completeness for Partial Order Convergence
Theorem (Infinitary normalisation) For each term graph g, there is a reduction g ։
p h to a normal form h.
Theorem (Completeness) Strong p-convergence in an orthogonal, left-finite GRS R is complete w.r.t. strong p-convergence in U (R). Proof. s t g U (·) h normalising U (R) R
16
Completeness for Partial Order Convergence
Theorem (Infinitary normalisation) For each term graph g, there is a reduction g ։
p h to a normal form h.
Theorem (Completeness) Strong p-convergence in an orthogonal, left-finite GRS R is complete w.r.t. strong p-convergence in U (R). Proof. s t g U (·) t′ h normalising U (·) soundness U (R) R
16
Completeness for Partial Order Convergence
Theorem (Infinitary normalisation) For each term graph g, there is a reduction g ։
p h to a normal form h.
Theorem (Completeness) Strong p-convergence in an orthogonal, left-finite GRS R is complete w.r.t. strong p-convergence in U (R). Proof. s t g U (·) t′ h normalising U (·) soundness confluence U (R) R
16
Conclusions
Infinitary term graph rewriting intuitive & simple generalisation however: weak convergence is wacky strong convergence is well-behaved
17
Conclusions
Infinitary term graph rewriting intuitive & simple generalisation however: weak convergence is wacky strong convergence is well-behaved Is it relevant? connection to lazy functional programming soundness & completeness
17
Conclusions
Infinitary term graph rewriting intuitive & simple generalisation however: weak convergence is wacky strong convergence is well-behaved Is it relevant? connection to lazy functional programming soundness & completeness Completeness of m-convergence for normalising reductions s t normalising g U (·) h U (·) U (R) R
17