Infinitary Term Graph Rewriting is Simple, Sound and Complete - - PowerPoint PPT Presentation

infinitary term graph rewriting is simple sound and
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

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 30 – June 1, 2012

slide-2
SLIDE 2

Infinitary Rewriting vs. Term Graph Rewriting

Pick one to avoid the other.

2

slide-3
SLIDE 3

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

slide-4
SLIDE 4

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

slide-5
SLIDE 5

Infinitary Term Graph Rewriting – What is it for?

A common formalism study correspondences between infinitary TRSs and finitary GRSs

3

slide-6
SLIDE 6

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

slide-7
SLIDE 7

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

slide-8
SLIDE 8

Approach

Previous approach (RTA ’11) weak convergence two modes of convergence: metric & partial order

4

slide-9
SLIDE 9

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

slide-10
SLIDE 10

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

slide-11
SLIDE 11

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

slide-12
SLIDE 12

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

slide-13
SLIDE 13

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

slide-14
SLIDE 14

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

slide-15
SLIDE 15

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

slide-16
SLIDE 16

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

slide-17
SLIDE 17

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

slide-18
SLIDE 18

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

slide-19
SLIDE 19

Example: Metric Convergence in TRSs

from from(x) → x :: from(s(x))

7

slide-20
SLIDE 20

Example: Metric Convergence in TRSs

from :: from 1 from(x) → x :: from(s(x))

7

slide-21
SLIDE 21

Example: Metric Convergence in TRSs

from :: :: 1 from 2 from(x) → x :: from(s(x))

+ 7

slide-22
SLIDE 22

Example: Metric Convergence in TRSs

1 level from :: :: 1 from 2 from(x) → x :: from(s(x))

+ 7

slide-23
SLIDE 23

Example: Metric Convergence in TRSs

1 level from :: :: 1 :: 2 from 3 from(x) → x :: from(s(x))

+ 7

slide-24
SLIDE 24

Example: Metric Convergence in TRSs

2 levels from :: :: 1 :: 2 from 3 from(x) → x :: from(s(x))

+ 7

slide-25
SLIDE 25

Example: Metric Convergence in TRSs

2 levels from :: :: 1 :: 2 :: 3 from 4 from(x) → x :: from(s(x))

+ 7

slide-26
SLIDE 26

Example: Metric Convergence in TRSs

3 levels from :: :: 1 :: 2 :: 3 from 4 from(x) → x :: from(s(x))

+ 7

slide-27
SLIDE 27

Example: Metric Convergence in TRSs

3 levels from :: :: 1 :: 2 :: 3 :: 4 from(x) → x :: from(s(x))

ω 7

slide-28
SLIDE 28

Example: Metric Convergence in TRSs

from :: :: 1 :: 2 :: 3 :: 4 from(x) → x :: from(s(x))

ω 7

slide-29
SLIDE 29

A Metric on Term Graphs

Depth of a node = length of a shortest path from the root to the node.

8

slide-30
SLIDE 30

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

slide-31
SLIDE 31

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

slide-32
SLIDE 32

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

slide-33
SLIDE 33

Soundness & Completeness

9

slide-34
SLIDE 34

Soundness & Completeness

soundness of metric convergence g h

m

s U (·) U (R) R

9

slide-35
SLIDE 35

Soundness & Completeness

soundness of metric convergence g h

m

s U (·) U (R) R t

m

U (·)

9

slide-36
SLIDE 36

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

slide-37
SLIDE 37

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

slide-38
SLIDE 38

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

slide-39
SLIDE 39

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

slide-40
SLIDE 40

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

slide-41
SLIDE 41

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

slide-42
SLIDE 42

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

slide-43
SLIDE 43

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

slide-44
SLIDE 44

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

slide-45
SLIDE 45

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

slide-46
SLIDE 46

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

slide-47
SLIDE 47

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

slide-48
SLIDE 48

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

slide-49
SLIDE 49

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

slide-50
SLIDE 50

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

slide-51
SLIDE 51

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

slide-52
SLIDE 52

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

slide-53
SLIDE 53

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

slide-54
SLIDE 54

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

slide-55
SLIDE 55

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

slide-56
SLIDE 56

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

slide-57
SLIDE 57

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

slide-58
SLIDE 58

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

slide-59
SLIDE 59

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

slide-60
SLIDE 60

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

slide-61
SLIDE 61

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

slide-62
SLIDE 62

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

slide-63
SLIDE 63

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

slide-64
SLIDE 64

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

slide-65
SLIDE 65

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

slide-66
SLIDE 66

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

slide-67
SLIDE 67

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

slide-68
SLIDE 68

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

slide-69
SLIDE 69

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

slide-70
SLIDE 70

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

slide-71
SLIDE 71

Conclusions

Infinitary term graph rewriting intuitive & simple generalisation however: weak convergence is wacky strong convergence is well-behaved

17

slide-72
SLIDE 72

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

slide-73
SLIDE 73

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