B ohm Reduction in Infinitary Term Graph Rewriting Systems - - PowerPoint PPT Presentation

b ohm reduction in infinitary term graph rewriting systems
SMART_READER_LITE
LIVE PREVIEW

B ohm Reduction in Infinitary Term Graph Rewriting Systems - - PowerPoint PPT Presentation

B ohm Reduction in Infinitary Term Graph Rewriting Systems Patrick Bahr IT University of Copenhagen Overview 1. Motivation Why term graphs? Why infinitary term graph rewriting? Why B ohm reduction? 2. B ohm Reduction on


slide-1
SLIDE 1

  • hm Reduction in

Infinitary Term Graph Rewriting Systems

Patrick Bahr

IT University of Copenhagen

slide-2
SLIDE 2

Overview

  • 1. Motivation

◮ Why term graphs? ◮ Why infinitary term graph rewriting? ◮ Why B¨

  • hm reduction?
  • 2. B¨
  • hm Reduction on Terms
  • 3. B¨
  • hm Reduction on Term Graphs
slide-3
SLIDE 3

From Terms to Term Graphs

f (g(a), h(g(a), a))

1 / 17

slide-4
SLIDE 4

From Terms to Term Graphs

f (g(a), h(g(a), a)) f g a h g a a

1 / 17

slide-5
SLIDE 5

From Terms to Term Graphs

f (g(a), h(g(a), a)) f g a h g a a f g a h

1 / 17

slide-6
SLIDE 6

From Terms to Term Graphs

f (g(a), h(g(a), a)) f g a h g a a f g a h unravel

1 / 17

slide-7
SLIDE 7

From Terms to Term Graphs

f g a h g a a f g a h a → b unravel

1 / 17

slide-8
SLIDE 8

From Terms to Term Graphs

f g a h g a a f g b h a → b unravel

1 / 17

slide-9
SLIDE 9

From Terms to Term Graphs

f g b h g b b f g b h a → b unravel

1 / 17

slide-10
SLIDE 10

From Terms to Term Graphs

f g b h g b b f g b h

1 / 17

slide-11
SLIDE 11

From Terms to Term Graphs

f g b h g b f g b h g b f g b h unravel

1 / 17

slide-12
SLIDE 12

From Terms to Term Graphs

f g b h g b f g b h g b f g b h b → c unravel

1 / 17

slide-13
SLIDE 13

From Terms to Term Graphs

f g b h g b f g b h g b f g c h b → c unravel

1 / 17

slide-14
SLIDE 14

From Terms to Term Graphs

f g c h g c f g c h g c f g c h b → c unravel

1 / 17

slide-15
SLIDE 15

Soundness & Completeness

Soundness of finite reductions

For every left-linear, left-finite GRS R we have

g h

s U (·) U (R) R

  • 1R. Kennaway et al. “On the adequacy of graph rewriting for simulating term

rewriting”. In: ACM Transactions on Programming Languages and Systems (1994).

2 / 17

slide-16
SLIDE 16

Soundness & Completeness

Soundness of finite reductions

For every left-linear, left-finite GRS R we have

g h

s U (·) U (R) R t U (·)

  • 1R. Kennaway et al. “On the adequacy of graph rewriting for simulating term

rewriting”. In: ACM Transactions on Programming Languages and Systems (1994).

2 / 17

slide-17
SLIDE 17

Soundness & Completeness

Soundness of finite reductions

For every left-linear, left-finite GRS R we have

g h

s U (·) U (R) R t U (·)

Completeness property

s t

regular

g U (·) U (R) R

  • 1R. Kennaway et al. “On the adequacy of graph rewriting for simulating term

rewriting”. In: ACM Transactions on Programming Languages and Systems (1994).

2 / 17

slide-18
SLIDE 18

Soundness & Completeness

Soundness of finite reductions

For every left-linear, left-finite GRS R we have

g h

s U (·) U (R) R t U (·)

Completeness property

s t

regular

g U (·) U (R) R h

U (·)

  • 1R. Kennaway et al. “On the adequacy of graph rewriting for simulating term

rewriting”. In: ACM Transactions on Programming Languages and Systems (1994).

2 / 17

slide-19
SLIDE 19

Soundness & Completeness

Soundness of finite reductions

For every left-linear, left-finite GRS R we have

g h

s U (·) U (R) R t U (·)

Completeness property

s t

regular

g U (·) U (R) R h

U (·)

  • 1R. Kennaway et al. “On the adequacy of graph rewriting for simulating term

rewriting”. In: ACM Transactions on Programming Languages and Systems (1994).

2 / 17

slide-20
SLIDE 20

Soundness & Completeness

Soundness of finite reductions

For every left-linear, left-finite GRS R we have

g h

s U (·) U (R) R t U (·)

Completeness property

s t

regular

g U (·) U (R) R t′ h

U (·)

regular

  • 1R. Kennaway et al. “On the adequacy of graph rewriting for simulating term

rewriting”. In: ACM Transactions on Programming Languages and Systems (1994).

2 / 17

slide-21
SLIDE 21

Infinitary Graph Rewriting – Motivation

◮ A common formalism

◮ study correspondences between infinitary TRSs and

finitary GRSs

  • 2Z. M. Ariola and S. Blom. “Skew confluence and the lambda calculus with

letrec”. In: Annals of Pure and Applied Logic (2002).

  • 3C. Grabmayer and J. Rochel. “Maximal Sharing in the Lambda Calculus with

Letrec”. In: ICFP. 2014.

3 / 17

slide-22
SLIDE 22

Infinitary Graph Rewriting – Motivation

◮ 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

  • 2Z. M. Ariola and S. Blom. “Skew confluence and the lambda calculus with

letrec”. In: Annals of Pure and Applied Logic (2002).

  • 3C. Grabmayer and J. Rochel. “Maximal Sharing in the Lambda Calculus with

Letrec”. In: ICFP. 2014.

3 / 17

slide-23
SLIDE 23

Infinitary Graph Rewriting – Motivation

◮ 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

◮ lambda calculi with letrec2,3

◮ these calculi are non-confluent ◮ but there is a notion of infinite normal forms

  • 2Z. M. Ariola and S. Blom. “Skew confluence and the lambda calculus with

letrec”. In: Annals of Pure and Applied Logic (2002).

  • 3C. Grabmayer and J. Rochel. “Maximal Sharing in the Lambda Calculus with

Letrec”. In: ICFP. 2014.

3 / 17

slide-24
SLIDE 24

Example: Cyclic Sharing

Term graph rules for a :: x → b :: a :: x ::

l

a x ::

r

b :: a ρ1:

4 / 17

slide-25
SLIDE 25

Example: Cyclic Sharing

Term graph rules for a :: x → b :: a :: x ::

l

a x ::

r

b :: a ρ1: Reductions: :: a :: b :: a :: b :: b :: a

ρ1 ρ1

4 / 17

slide-26
SLIDE 26

Example: Cyclic Sharing

Term graph rules for a :: x → b :: a :: x ::

l

a x ::

r

b :: a ρ1: Reductions: :: a :: b :: a :: b :: b :: b

ρ1 ρ1

4 / 17

slide-27
SLIDE 27

Example: Cyclic Sharing

Term graph rules for a :: x → b :: a :: x ::

l

a x ::

r

b :: a ρ1: ::

l

a x ::

r

b ρ2: Reductions: :: a :: b :: a :: b :: b :: b

ρ1 ρ1

4 / 17

slide-28
SLIDE 28

Example: Cyclic Sharing

Term graph rules for a :: x → b :: a :: x ::

l

a x ::

r

b :: a ρ1: ::

l

a x ::

r

b ρ2: Reductions: :: a :: b :: a :: b :: b :: b :: b

ρ1 ρ1 ρ2

4 / 17

slide-29
SLIDE 29

Problems of Infintary Graph Rewriting

Confluence of Orthogonal Systems

g g1 g2

5 / 17

slide-30
SLIDE 30

Problems of Infintary Graph Rewriting

Confluence of Orthogonal Systems

g g1 g2 g ′

5 / 17

slide-31
SLIDE 31

Problems of Infintary Graph Rewriting

Confluence of Orthogonal Systems

g g1 g2 g ′

5 / 17

slide-32
SLIDE 32

Problems of Infintary Graph Rewriting

Confluence of Orthogonal Systems

g g1 g2 g ′

Completeness

s t g U (·) U (R) R

5 / 17

slide-33
SLIDE 33

Problems of Infintary Graph Rewriting

Confluence of Orthogonal Systems

g g1 g2 g ′

Completeness

s t g U (·) U (R) R t′ h U (·)

5 / 17

slide-34
SLIDE 34

Problems of Infintary Graph Rewriting

Confluence of Orthogonal Systems

g g1 g2 g ′

Completeness

s t g U (·) U (R) R t′ h U (·)

5 / 17

slide-35
SLIDE 35

This paper

Study two techniques to solve these problems

◮ B¨

  • hm reduction

◮ partial order infinitary rewriting

  • 4R. Kennaway, V. van Oostrom, and F.-J. de Vries. “Meaningless Terms in

Rewriting”. In: J. Funct. Logic Programming (1999).

  • 5B. “Partial Order Infinitary Term Rewriting”.

In: LMCS (2014).

  • 6B. “Infinitary Term Graph Rewriting is Simple, Sound and Complete”.

In: RTA. 2012.

6 / 17

slide-36
SLIDE 36

This paper

Study two techniques to solve these problems

◮ B¨

  • hm reduction

◮ partial order infinitary rewriting

In previous work

◮ both yield confluence for infinitary term

rewriting4,5

◮ partial order approach yields completeness

property for infinitary term graph rewriting6

  • 4R. Kennaway, V. van Oostrom, and F.-J. de Vries. “Meaningless Terms in

Rewriting”. In: J. Funct. Logic Programming (1999).

  • 5B. “Partial Order Infinitary Term Rewriting”.

In: LMCS (2014).

  • 6B. “Infinitary Term Graph Rewriting is Simple, Sound and Complete”.

In: RTA. 2012.

6 / 17

slide-37
SLIDE 37

Infinitary Term Rewriting

slide-38
SLIDE 38

Failure of Infinitary Confluence

for Orthogonal Term Rewriting Systems

f (x) → x g(x) → x f g f g f g f (g(f (g(f (g(. . . ))))))

7 / 17

slide-39
SLIDE 39

Failure of Infinitary Confluence

for Orthogonal Term Rewriting Systems

f (x) → x g(x) → x f g f g f g

7 / 17

slide-40
SLIDE 40

Failure of Infinitary Confluence

for Orthogonal Term Rewriting Systems

f (x) → x g(x) → x f g f g f g

7 / 17

slide-41
SLIDE 41

Failure of Infinitary Confluence

for Orthogonal Term Rewriting Systems

f (x) → x g(x) → x f g f g f g g f g f g x ← f (x)

7 / 17

slide-42
SLIDE 42

Failure of Infinitary Confluence

for Orthogonal Term Rewriting Systems

f (x) → x g(x) → x f g f g f g g g f g x ← f (x) x ← f (x)

7 / 17

slide-43
SLIDE 43

Failure of Infinitary Confluence

for Orthogonal Term Rewriting Systems

f (x) → x g(x) → x f g f g f g g g g x ← f (x) x ← f (x) x ← f (x)

7 / 17

slide-44
SLIDE 44

Failure of Infinitary Confluence

for Orthogonal Term Rewriting Systems

f (x) → x g(x) → x f g f g f g g g g x ← f (x) x ← f (x) x ← f (x)

7 / 17

slide-45
SLIDE 45

Failure of Infinitary Confluence

for Orthogonal Term Rewriting Systems

f (x) → x g(x) → x f g f g f g g g g f f f x ← f (x) x ← f (x) x ← f (x) g(x) → x g(x) → x g(x) → x

7 / 17

slide-46
SLIDE 46

Failure of Infinitary Confluence

for Orthogonal Term Rewriting Systems

f (x) → x g(x) → x f g f g f g g g g f f f g ω f ω

7 / 17

slide-47
SLIDE 47

  • hm Reduction

Idea

◮ terms like f ω and g ω are

considered meaningless

◮ for each meaningless term

t, add rule t → ⊥

◮ meaningless terms are

characterised by a set of axioms f (g(f (g(. . . )))) f ω g ω

  • 7R. Kennaway et al. “Infinitary lambda calculus”.

In: Theoretical Computer Science (1997).

  • 8R. Kennaway, V. van Oostrom, and F.-J. de Vries. “Meaningless Terms in

Rewriting”. In: J. Funct. Logic Programming (1999).

8 / 17

slide-48
SLIDE 48

  • hm Reduction

Idea

◮ terms like f ω and g ω are

considered meaningless

◮ for each meaningless term

t, add rule t → ⊥

◮ meaningless terms are

characterised by a set of axioms f (g(f (g(. . . )))) f ω g ω ⊥

  • 7R. Kennaway et al. “Infinitary lambda calculus”.

In: Theoretical Computer Science (1997).

  • 8R. Kennaway, V. van Oostrom, and F.-J. de Vries. “Meaningless Terms in

Rewriting”. In: J. Funct. Logic Programming (1999).

8 / 17

slide-49
SLIDE 49

  • hm Reduction

Idea

◮ terms like f ω and g ω are

considered meaningless

◮ for each meaningless term

t, add rule t → ⊥

◮ meaningless terms are

characterised by a set of axioms f (g(f (g(. . . )))) f ω g ω ⊥ B¨

  • hm reduction = infinitary rewriting with ⊥-rules
  • 7R. Kennaway et al. “Infinitary lambda calculus”.

In: Theoretical Computer Science (1997).

  • 8R. Kennaway, V. van Oostrom, and F.-J. de Vries. “Meaningless Terms in

Rewriting”. In: J. Funct. Logic Programming (1999).

8 / 17

slide-50
SLIDE 50

Partial Order Infinitary Rewriting

◮ Alternative characterisation of B¨

  • hm reduction

◮ Changes the notion of convergence instead of

adding rules (uses a partial order instead of a metric)

  • 9B. “Partial Order Infinitary Term Rewriting”.

In: LMCS (2014).

9 / 17

slide-51
SLIDE 51

Partial Order Infinitary Rewriting

◮ Alternative characterisation of B¨

  • hm reduction

◮ Changes the notion of convergence instead of

adding rules (uses a partial order instead of a metric)

The Good & The Bad

+ less ad hoc + no need for infinitely many reduction rules

  • captures only a particular set of meaningless

terms (namely: root-active terms)

  • 9B. “Partial Order Infinitary Term Rewriting”.

In: LMCS (2014).

9 / 17

slide-52
SLIDE 52

Example: Convergence of a Reduction

R = {a → g(a)} f a

10 / 17

slide-53
SLIDE 53

Example: Convergence of a Reduction

R = {a → g(a)} f a

10 / 17

slide-54
SLIDE 54

Example: Convergence of a Reduction

R = {a → g(a)} f a f g a

10 / 17

slide-55
SLIDE 55

Example: Convergence of a Reduction

R = {a → g(a)} f a f g a

10 / 17

slide-56
SLIDE 56

Example: Convergence of a Reduction

R = {a → g(a)} f a f g a f g g a

10 / 17

slide-57
SLIDE 57

Example: Convergence of a Reduction

R = {a → g(a)} f a f g a f g g a

10 / 17

slide-58
SLIDE 58

Example: Convergence of a Reduction

R = {a → g(a)} f a f g a f g g a f g g g a

10 / 17

slide-59
SLIDE 59

Example: Convergence of a Reduction

R = {a → g(a)} f a f g a f g g a f g g g a f g g g g a

10 / 17

slide-60
SLIDE 60

Example: Convergence of a Reduction

R = {a → g(a)} f a f g a f g g a f g g g a f g g g g a

10 / 17

slide-61
SLIDE 61

Example: Convergence of a Reduction

R = {a → g(a)} f (a) ։ω

R f (g ω)

f a f g a f g g a f g g g a f g g g g a

10 / 17

slide-62
SLIDE 62

Example: Non-Convergence

R =

  • a → g(a)

h(x) → h(g(x)) f a h b

11 / 17

slide-63
SLIDE 63

Example: Non-Convergence

R =

  • a → g(a)

h(x) → h(g(x)) f a h b

11 / 17

slide-64
SLIDE 64

Example: Non-Convergence

R =

  • a → g(a)

h(x) → h(g(x)) f a h b f a h g b

11 / 17

slide-65
SLIDE 65

Example: Non-Convergence

R =

  • a → g(a)

h(x) → h(g(x)) f a h b f a h g b

11 / 17

slide-66
SLIDE 66

Example: Non-Convergence

R =

  • a → g(a)

h(x) → h(g(x)) f a h b f a h g b

11 / 17

slide-67
SLIDE 67

Example: Non-Convergence

R =

  • a → g(a)

h(x) → h(g(x)) f a h b f a h g b f g a h g b

11 / 17

slide-68
SLIDE 68

Example: Non-Convergence

R =

  • a → g(a)

h(x) → h(g(x)) f a h b f a h g b f g a h g b

11 / 17

slide-69
SLIDE 69

Example: Non-Convergence

R =

  • a → g(a)

h(x) → h(g(x)) f a h b f a h g b f g a h g b

11 / 17

slide-70
SLIDE 70

Example: Non-Convergence

R =

  • a → g(a)

h(x) → h(g(x)) f a h b f a h g b f g a h g b f g a h g g b

11 / 17

slide-71
SLIDE 71

Example: Non-Convergence

R =

  • a → g(a)

h(x) → h(g(x)) f a h b f a h g b f g a h g b f g a h g g b f g g a h g g b

11 / 17

slide-72
SLIDE 72

Example: Non-Convergence

R =

  • a → g(a)

h(x) → h(g(x)) f a h b f a h g b f g a h g b f g a h g g b f g g a h g g b . . .

11 / 17

slide-73
SLIDE 73

Example: Non-Convergence

R =

  • a → g(a)

h(x) → h(g(x)) f a h b f a h g b f g a h g b f g a h g g b f g g a h g g b . . .

11 / 17

slide-74
SLIDE 74

Partial Order Convergence

f a h b f a h g b f g a h g b f g a h g g b f g g a h g g b . . . f g g a h g g b

12 / 17

slide-75
SLIDE 75

Partial Order Convergence

f a h b f a h g b f g a h g b f g a h g g b f g g a h g g b . . . f g g a h g g b f g g eventually stable:

12 / 17

slide-76
SLIDE 76

Partial Order Convergence

f a h b f a h g b f g a h g b f g a h g g b f g g a h g g b . . . f g g a h g g b f g g ⊥ p-converges to

12 / 17

slide-77
SLIDE 77

Properties of Orthogonal TRS

property metric B¨

  • hm red.

compression ✔ ✔

  • inf. strip lemma

✔ ✔ developments ✘ ✔

  • inf. confluence

✘ ✔

  • inf. normalisation

✘ ✔

13 / 17

slide-78
SLIDE 78

Properties of Orthogonal TRS

property metric B¨

  • hm red.
  • part. order

compression ✔ ✔ ✔

  • inf. strip lemma

✔ ✔ ✔ developments ✘ ✔ ✔

  • inf. confluence

✘ ✔ ✔

  • inf. normalisation

✘ ✔ ✔

13 / 17

slide-79
SLIDE 79

Properties of Orthogonal TRS

property metric B¨

  • hm red.
  • part. order

compression ✔ ✔ ✔

  • inf. strip lemma

✔ ✔ ✔ developments ✘ ✔ ✔

  • inf. confluence

✘ ✔ ✔

  • inf. normalisation

✘ ✔ ✔

Theorem

If R is an orthogonal TRS and B the B¨

  • hm

extension of R (w.r.t. root-active terms), then s ։

p R t

iff s ։

m B t.

13 / 17

slide-80
SLIDE 80

Term Graph Rewriting

slide-81
SLIDE 81

Properties of Orthogonal GRS

property metric B¨

  • hm red.
  • part. order

compression ✔ ? ✔

  • inf. strip lemma

✔ ✔ ✔ developments ✘ ✔ ✔

  • inf. normalisation

✘ ✔ ✔

  • inf. confluence

✘ ? ?

14 / 17

slide-82
SLIDE 82

Properties of Orthogonal GRS

property metric B¨

  • hm red.
  • part. order

compression ✔ ? ✔

  • inf. strip lemma

✔ ✔ ✔ developments ✘ ✔ ✔

  • inf. normalisation

✘ ✔ ✔

  • inf. confluence

✘ ? ?

  • inf. confluence

modulo bisim. ✘ ✔ ✔

14 / 17

slide-83
SLIDE 83

Properties of Orthogonal GRS

property metric B¨

  • hm red.
  • part. order

compression ✔ ? ✔

  • inf. strip lemma

✔ ✔ ✔ developments ✘ ✔ ✔

  • inf. normalisation

✘ ✔ ✔

  • inf. confluence

✘ ? ?

  • inf. confluence

modulo bisim. ✘ ✔ ✔

Theorem

If R is an orth. GRS and B the B¨

  • hm extension of

R (w.r.t. root-active term graphs), then g ։

p R h

iff g ։

m B h.

14 / 17

slide-84
SLIDE 84

Soundness & Completeness

Soundness of metric convergence

For every left-linear, left-finite GRS R we have g h

p

s U (·) U (R) R

  • 10B. “Infinitary Term Graph Rewriting is Simple, Sound and Complete”.

In: RTA. 2012.

15 / 17

slide-85
SLIDE 85

Soundness & Completeness

Soundness of metric convergence

For every left-linear, left-finite GRS R we have g h

p

s U (·) U (R) R t

p

U (·)

  • 10B. “Infinitary Term Graph Rewriting is Simple, Sound and Complete”.

In: RTA. 2012.

15 / 17

slide-86
SLIDE 86

Soundness & Completeness

Soundness of metric convergence

For every left-linear, left-finite GRS R we have g h

p

s U (·) U (R) R t

p

U (·)

Completeness property

s t

p

g U (·) U (R) R

  • 10B. “Infinitary Term Graph Rewriting is Simple, Sound and Complete”.

In: RTA. 2012.

15 / 17

slide-87
SLIDE 87

Soundness & Completeness

Soundness of metric convergence

For every left-linear, left-finite GRS R we have g h

p

s U (·) U (R) R t

p

U (·)

Completeness property

s t

p

g U (·) U (R) R t′ h

p

U (·)

p

  • 10B. “Infinitary Term Graph Rewriting is Simple, Sound and Complete”.

In: RTA. 2012.

15 / 17

slide-88
SLIDE 88

Soundness & Completeness

Soundness of metric convergence

For every left-linear, left-finite GRS R we have g h

B

s U (·) U (R) R t

B

U (·)

Completeness property

s t

B

g U (·) U (R) R t′ h

B

U (·)

B

  • 10B. “Infinitary Term Graph Rewriting is Simple, Sound and Complete”.

In: RTA. 2012.

15 / 17

slide-89
SLIDE 89

Working with Term Graphs

Some Observations ◮ Term graphs can be messy

◮ Very operational style of term graph rewriting ◮ B¨

  • hm reduction is not left-linear

◮ But: sharing simplifies some things

◮ Reduction produces no duplication ◮ Residuals & developments are easier 16 / 17

slide-90
SLIDE 90

Working with Term Graphs

Some Observations ◮ Term graphs can be messy

◮ Very operational style of term graph rewriting ◮ B¨

  • hm reduction is not left-linear

◮ But: sharing simplifies some things

◮ Reduction produces no duplication ◮ Residuals & developments are easier

Example (g(x) → f (x, x))

g

l

x f

r

ρ: g c f c ρ

16 / 17

slide-91
SLIDE 91

Working with Term Graphs

Some Observations ◮ Term graphs can be messy

◮ Very operational style of term graph rewriting ◮ B¨

  • hm reduction is not left-linear

◮ But: sharing simplifies some things

◮ Reduction produces no duplication ◮ Residuals & developments are easier

◮ Weak convergence is even weirder than on terms:

16 / 17

slide-92
SLIDE 92

Working with Term Graphs

Some Observations ◮ Term graphs can be messy

◮ Very operational style of term graph rewriting ◮ B¨

  • hm reduction is not left-linear

◮ But: sharing simplifies some things

◮ Reduction produces no duplication ◮ Residuals & developments are easier

◮ Weak convergence is even weirder than on terms:

f c c f c f c c f c f c c

16 / 17

slide-93
SLIDE 93

Future Work

◮ Infinitary confluence for term graphs ◮ Coinductive definition of infinitary term graph

rewriting

◮ Axiomatic account of meaningless term graphs ◮ Partial-order reduction corresponding to B¨

  • hm

reductions other than root-active terms

17 / 17

slide-94
SLIDE 94

  • hm Reduction in

Infinitary Term Graph Rewriting Systems

Patrick Bahr

IT University of Copenhagen

slide-95
SLIDE 95

The Metric Model of Infinitary Rewriting

Convergence

based on the ‘usual’ complete metric space on terms d(s, t) = 2−n n = depth of the shallowest discrepancy of s and t

18 / 17

slide-96
SLIDE 96

The Metric Model of Infinitary Rewriting

Convergence

based on the ‘usual’ complete metric space on terms d(s, t) = 2−n n = depth of the shallowest discrepancy of s and t

Convergence of reductions

(a.k.a. strong convergence)

◮ convergence in the metric space, and ◮ rewrite rules are applied (eventually) at

increasingly large depth

18 / 17

slide-97
SLIDE 97

The Metric Model of Infinitary Rewriting

Convergence

based on the ‘usual’ complete metric space on terms d(s, t) = 2−n n = depth of the shallowest discrepancy of s and t

Convergence of reductions

(a.k.a. strong convergence)

◮ convergence in the metric space, and ◮ rewrite rules are applied (eventually) at

increasingly large depth

  • convergence of a reduction: depth at which the

rewrite rules are applied tends to infinity

18 / 17

slide-98
SLIDE 98

Partial Order Infinitary Rewriting

Partial order on terms

◮ partial terms: terms with additional constant ⊥ ◮ partial order ≤⊥ reads as: “is less defined than” ◮ ≤⊥ is a complete semilattice

(= cpo + glbs of non-empty sets)

19 / 17

slide-99
SLIDE 99

Partial Order Infinitary Rewriting

Partial order on terms

◮ partial terms: terms with additional constant ⊥ ◮ partial order ≤⊥ reads as: “is less defined than” ◮ ≤⊥ is a complete semilattice

(= cpo + glbs of non-empty sets)

Convergence: limit inferior

lim infι→α tι =

β<α

  • β≤ι<α tι

19 / 17

slide-100
SLIDE 100

Partial Order Infinitary Rewriting

Partial order on terms

◮ partial terms: terms with additional constant ⊥ ◮ partial order ≤⊥ reads as: “is less defined than” ◮ ≤⊥ is a complete semilattice

(= cpo + glbs of non-empty sets)

Convergence: limit inferior

lim infι→α tι =

β<α

  • β≤ι<α tι

◮ intuition: eventual persistence of nodes in the tree ◮ strong convergence: limit inferior of the contexts

  • f the reduction

19 / 17

slide-101
SLIDE 101

Metric on Term Graphs

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

20 / 17

slide-102
SLIDE 102

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.

20 / 17

slide-103
SLIDE 103

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.

Metric on term graphs

d(g, h) = 2−n Where n = maximum depth d s.t. g†d ∼ = h†d.

20 / 17

slide-104
SLIDE 104

A Partial Order on Term Graphs – How?

⊥-homomorphisms φ: g →⊥ h

◮ homomorphism condition suspended on

⊥-nodes

◮ allow mapping of ⊥-nodes to arbitrary nodes

21 / 17

slide-105
SLIDE 105

A Partial Order on Term Graphs – How?

⊥-homomorphisms φ: g →⊥ h

◮ homomorphism condition suspended on

⊥-nodes

◮ allow mapping of ⊥-nodes to arbitrary nodes

Proposition

For all terms s, t: s ≤⊥ t iff ∃φ: s →⊥ t

21 / 17

slide-106
SLIDE 106

A Partial Order on Term Graphs – How?

⊥-homomorphisms φ: g →⊥ h

◮ homomorphism condition suspended on

⊥-nodes

◮ allow mapping of ⊥-nodes to arbitrary nodes

Proposition

For all terms s, t: s ≤⊥ t iff ∃φ: s →⊥ t

Definition

For all term graphs g, h, let g ≤⊥ h iff there is some φ: g →⊥ h.

21 / 17

slide-107
SLIDE 107

R = { n(x, y) → n + 1(x, y) | n ∈ N }.

  • 11R. Kennaway et al. “On the adequacy of graph rewriting for simulating term

rewriting”. In: ACM Transactions on Programming Languages and Systems (1994).

22 / 17

slide-108
SLIDE 108

R = { n(x, y) → n + 1(x, y) | n ∈ N }. 1 1 1 2 1 2

  • 11R. Kennaway et al. “On the adequacy of graph rewriting for simulating term

rewriting”. In: ACM Transactions on Programming Languages and Systems (1994).

22 / 17

slide-109
SLIDE 109

R = { n(x, y) → n + 1(x, y) | n ∈ N }. 1 1 1 2 1 2 1 2 2 1 2 2

  • 11R. Kennaway et al. “On the adequacy of graph rewriting for simulating term

rewriting”. In: ACM Transactions on Programming Languages and Systems (1994).

22 / 17

slide-110
SLIDE 110

R = { n(x, y) → n + 1(x, y) | n ∈ N }. 1 1 1 2 1 2 1 2 2 1 2 2 ? ?

  • 11R. Kennaway et al. “On the adequacy of graph rewriting for simulating term

rewriting”. In: ACM Transactions on Programming Languages and Systems (1994).

22 / 17

slide-111
SLIDE 111

Example: Acyclic Sharing

Term graph rule for from(x) → x :: from(s(x)) from

l

x ::

r

from s

23 / 17

slide-112
SLIDE 112

Example: Acyclic Sharing

Term graph rule for from(x) → x :: from(s(x)) from

l

x ::

r

from s Reductions: from

23 / 17

slide-113
SLIDE 113

Example: Acyclic Sharing

Term graph rule for from(x) → x :: from(s(x)) from

l

x ::

r

from s Reductions: from :: from s

23 / 17

slide-114
SLIDE 114

Example: Acyclic Sharing

Term graph rule for from(x) → x :: from(s(x)) from

l

x ::

r

from s Reductions: from :: from s :: :: s from s

23 / 17

slide-115
SLIDE 115

Example: Acyclic Sharing

Term graph rule for from(x) → x :: from(s(x)) from

l

x ::

r

from s Reductions: from :: from s :: :: s from s :: :: s : s

23 / 17