Compositional Z Confluence for Permutative Conversion Koji Nakazawa - - PowerPoint PPT Presentation

compositional z
SMART_READER_LITE
LIVE PREVIEW

Compositional Z Confluence for Permutative Conversion Koji Nakazawa - - PowerPoint PPT Presentation

Compositional Z Confluence for Permutative Conversion Koji Nakazawa (Nagoya U) joint work with Ken-etsu Fujita (Gunma U) Workshop on Mathematical Logic and its Application 2016.9 @ Kyoto } } } } Confluence M ! ! M 1 M 2 ! ! N } }


slide-1
SLIDE 1

Compositional Z

Confluence for Permutative Conversion

Koji Nakazawa (Nagoya U) joint work with Ken-etsu Fujita (Gunma U) Workshop on Mathematical Logic and its Application 2016.9 @ Kyoto

slide-2
SLIDE 2

M } } ! ! M1 ! ! M2 } } ∃N

Confluence

slide-3
SLIDE 3

M } } ! ! M1 ! ! M2 } } ∃N

Confluence

Uniqueness of result of computation

slide-4
SLIDE 4

M } } ! ! M1 ! ! M2 } } ∃N

Confluence

Uniqueness of result of computation Consistency of equational theory

slide-5
SLIDE 5

This talk

  • Brief history of confluence of λ-calculus
  • parallel reduction and Z theorem
  • Compositional Z: a new confluence proof
  • simpler proof of λ + permutation rules
  • Z property for Church-Rosser theorem
  • quantitative analysis
slide-6
SLIDE 6

History of Confluence of λ

slide-7
SLIDE 7
  • Terms
  • Reduction rules

λβ

M, N ::= x | λx.M | MN

(λx.M)N →β M[x := N]

slide-8
SLIDE 8

History of Confluence of λβ

  • Church and Rosser (1936) “Some Properties of Conversion”
  • residuals of redexes
  • Tait and Martin-Löf (19??)
  • parallel reduction
  • Takahashi (1995) “Parallel Reduction in λ-Calculus”
  • maximum parallel reduction
  • Dehornoy and van Oostrom (2008)
  • Z theorem
slide-9
SLIDE 9

Z theorem

[Dehornoy&van Oostrom 2008]

M N

  • M∗

N∗

If we find a mapping (·)* s.t. then the reduction system is confluent

slide-10
SLIDE 10

Z theorem

[Dehornoy&van Oostrom 2008]

Z theorem

M N

  • M∗

N∗

M1

  • M2
  • M3
  • M4
  • · · ·

N M∗

1

M∗

2

M∗

3

· · ·

slide-11
SLIDE 11

Z theorem

[Dehornoy&van Oostrom 2008]

Z theorem

M N

  • M∗

N∗

M1

  • M2
  • M3
  • M4
  • · · ·

N M∗

1

M∗

2

M∗

3

· · ·

slide-12
SLIDE 12

Z theorem

[Dehornoy&van Oostrom 2008]

Z theorem

M N

  • M∗

N∗

M1

  • M2
  • M3
  • M4
  • · · ·

N M∗

1

M∗

2

M∗

3

· · ·

slide-13
SLIDE 13

Z theorem

[Dehornoy&van Oostrom 2008]

Z theorem

M N

  • M∗

N∗

M1

  • M2
  • M3
  • M4
  • · · ·

N M∗

1

M∗

2

M∗

3

· · ·

slide-14
SLIDE 14

Z theorem

[Dehornoy&van Oostrom 2008]

Z theorem

M N

  • M∗

N∗

M1

  • M2
  • M3
  • M4
  • · · ·

N M∗

1

M∗

2

M∗

3

· · ·

slide-15
SLIDE 15

Z theorem

[Dehornoy&van Oostrom 2008]

Z theorem

M N

  • M∗

N∗

M1

  • M2
  • M3
  • M4
  • · · ·

N M∗

1

M∗

2

M∗

3

· · ·

slide-16
SLIDE 16

Confluence of λβ by Z

slide-17
SLIDE 17

Confluence of λβ by Z

  • Takahashi's maximum parallel reduction is Z

x∗ = x (λx.M)∗ = λx.M∗ ((λx.M)N)∗ = M∗[x := N∗] (MN)∗ = M∗N∗ (M is not abst.)

slide-18
SLIDE 18

Confluence of λβ by Z

  • Takahashi's maximum parallel reduction is Z

x∗ = x (λx.M)∗ = λx.M∗ ((λx.M)N)∗ = M∗[x := N∗] (MN)∗ = M∗N∗ (M is not abst.)

M →∗ M∗ M∗[x := N∗] →∗ (M[x := N])∗

(i) (ii)

  • Key lemmas
slide-19
SLIDE 19

(λx.M)N

  • M[x := N]

(i)

  • M∗[x := N∗]

(ii)

(M[x := N])∗

Confluence of λβ by Z

  • Proof of the base case

M →∗ M∗ M∗[x := N∗] →∗ (M[x := N])∗

(i) (ii)

  • Key lemmas
slide-20
SLIDE 20

(λx.M)N

  • M[x := N]

(i)

  • M∗[x := N∗]

(ii)

(M[x := N])∗

Confluence of λβ by Z

  • Proof of the base case

M →∗ M∗ M∗[x := N∗] →∗ (M[x := N])∗

(i) (ii)

  • Key lemmas
slide-21
SLIDE 21

(λx.M)N

  • M[x := N]

(i)

  • M∗[x := N∗]

(ii)

(M[x := N])∗

Confluence of λβ by Z

  • Proof of the base case

M →∗ M∗ M∗[x := N∗] →∗ (M[x := N])∗

(i) (ii)

  • Key lemmas
slide-22
SLIDE 22

Z for Permutative Conversion

slide-23
SLIDE 23

Permutative conversion

  • for natural deduction with ∨ and ∃ [Prawitz 1965]
  • exchanges order of elimination rules
  • for normal proofs to have good properties


such as the subformula property

  • makes confluence proofs much harder


[Ando 2003]

slide-24
SLIDE 24

Exchanging E-Rules

π

. . . . P Γ A1 A2 . . . . Q1 Γ, A1 B C . . . . Q2 Γ, A2 B C Γ B C (E∨) . . . . R Γ B Γ C (E→)

. . . . P Γ A1 A2 . . . . Q1 Γ, A1 B C . . . . R Γ B Γ, A1 C (E→) . . . . Q2 Γ, A2 B C . . . . R Γ B Γ, A1 C (E→) Γ C (E∨)

slide-25
SLIDE 25

Exchanging E-Rules

π

. . . . P Γ A1 A2 . . . . Q1 Γ, A1 B C . . . . Q2 Γ, A2 B C Γ B C (E∨) . . . . R Γ B Γ C (E→)

. . . . P Γ A1 A2 . . . . Q1 Γ, A1 B C . . . . R Γ B Γ, A1 C (E→) . . . . Q2 Γ, A2 B C . . . . R Γ B Γ, A1 C (E→) Γ C (E∨)

P[x1.Q1R, x2.Q2R]

π

(case P with x1→Q1 | x2→Q2)R P[x1.Q1,x2.Q2]R =

slide-26
SLIDE 26
  • Terms and eliminators
  • Reduction rules

λβπ

M, N ::= x | λx.M | ι1M | ι2M | Me e ::= M | [x1.N1, x2.N2] (λx.M)N →β M[x := N] (ιiM)[x1.N1, x2.N2] →β Ni[xi := M] M[x1.N1, x2.N2]e →π M[x1.N1e, x2.N2e]

slide-27
SLIDE 27
  • Terms and eliminators
  • Reduction rules

λβπ

M, N ::= x | λx.M | ι1M | ι2M | Me e ::= M | [x1.N1, x2.N2] (λx.M)N →β M[x := N] (ιiM)[x1.N1, x2.N2] →β Ni[xi := M] M[x1.N1, x2.N2]e →π M[x1.N1e, x2.N2e]

uniform representation

  • f elimination for → and ∨
slide-28
SLIDE 28
  • Terms and eliminators
  • Reduction rules

λβπ

permutative conversion

left associative (M[x1.N1,x2.N2])e

M, N ::= x | λx.M | ι1M | ι2M | Me e ::= M | [x1.N1, x2.N2] (λx.M)N →β M[x := N] (ιiM)[x1.N1, x2.N2] →β Ni[xi := M] M[x1.N1, x2.N2]e →π M[x1.N1e, x2.N2e]

uniform representation

  • f elimination for → and ∨
slide-29
SLIDE 29

λβπ, for simplicity

M, N ::= x | λx.M | ιM | Me e ::= M | [x.N] (λx.M)N →β M[x := N] (ιM)[x.N] →β N[x := M] M[x.N]e →π M[x.Ne]

  • Terms and eliminators
  • Reduction rules
slide-30
SLIDE 30

Where are difficulties?

  • Parallel reduction for π-reduction
  • Maximum complete development for


the combination of β- and π-reductions

slide-31
SLIDE 31

Parallel reduction for π?

x[y.y][z.z][w.w]

π

  • π
  • x[y.y[z.z]][w.w]

π

  • x[y.y][z.z[w.w]]

π

  • x[y.y[z.z][w.w]]

π

  • x[y.y[z.z[w.w]]]
slide-32
SLIDE 32

Parallel reduction for π?

x[y.y][z.z][w.w]

π

  • π
  • x[y.y[z.z]][w.w]

π

  • x[y.y][z.z[w.w]]

π

  • x[y.y[z.z][w.w]]

π

  • x[y.y[z.z[w.w]]]
slide-33
SLIDE 33

Parallel reduction for π?

x[y.y][z.z][w.w]

π

  • π
  • x[y.y[z.z]][w.w]

π

  • x[y.y][z.z[w.w]]

π

  • x[y.y[z.z][w.w]]

π

  • x[y.y[z.z[w.w]]]

these steps must be considered as

  • ne-step parallel red.
slide-34
SLIDE 34

Parallel reduction for π?

x[y.y][z.z][w.w]

π

  • π
  • x[y.y[z.z]][w.w]

π

  • x[y.y][z.z[w.w]]

π

  • x[y.y[z.z][w.w]]

π

  • x[y.y[z.z[w.w]]]

these steps must be considered as

  • ne-step parallel red.

We can avoid parallel reduction by Z

slide-35
SLIDE 35

Z for π?

x[y.y][z.z][w.w]

π

  • π
  • x[y.y[z.z]][w.w]

π

  • x[y.y][z.z[w.w]]

π

  • x[y.y[z.z][w.w]]

π

  • x[y.y[z.z[w.w]]]

M N

  • M∗

N∗

slide-36
SLIDE 36

Z for π?

x[y.y][z.z][w.w]

π

  • π
  • x[y.y[z.z]][w.w]

π

  • x[y.y][z.z[w.w]]

π

  • x[y.y[z.z][w.w]]

π

  • x[y.y[z.z[w.w]]]

we have to do π completely

M N

  • M∗

N∗

slide-37
SLIDE 37
  • A naïve definition

Z for βπ?

x∗ = x (λx.M)∗ = λx.M∗ (ιM)∗ = ιM∗ ((λx.M)N)∗ = M∗[x := N∗] ((ιM)[x.N])∗ = N∗[x := M∗] (Me)∗ = M∗@e∗ (otherwise) (M[x.N])@e = M[x.N@e] M@e = Me (otherwise)

slide-38
SLIDE 38
  • A naïve definition

Z for βπ?

is not Z

x∗ = x (λx.M)∗ = λx.M∗ (ιM)∗ = ιM∗ ((λx.M)N)∗ = M∗[x := N∗] ((ιM)[x.N])∗ = N∗[x := M∗] (Me)∗ = M∗@e∗ (otherwise) (M[x.N])@e = M[x.N@e] M@e = Me (otherwise)

slide-39
SLIDE 39

Z for βπ?

x∗ = x (λx.M)∗ = λx.M∗ (ιM)∗ = ιM∗ ((λx.M)N)∗ = M∗[x := N∗] ((ιM)[x.N])∗ = N∗[x := M∗] (Me)∗ = M∗@e∗ (otherwise)

  • Monotonicity fails

(ι(x[y.y]))[z.z]w →π (ι(x[y.y]))[z.zw]

slide-40
SLIDE 40

Z for βπ?

x∗ = x (λx.M)∗ = λx.M∗ (ιM)∗ = ιM∗ ((λx.M)N)∗ = M∗[x := N∗] ((ιM)[x.N])∗ = N∗[x := M∗] (Me)∗ = M∗@e∗ (otherwise)

  • Monotonicity fails

(ι(x[y.y]))[z.z]w →π (ι(x[y.y]))[z.zw]

((ι(x[y.y]))[z.z]w)∗ = ((ι(x[y.y]))[z.z])∗@w = (x[y.y])@w = x[y.yw] ((ι(x[y.y]))[z.zw])∗ = (zw)∗[z := x[y.y]] = x[y.y]w

slide-41
SLIDE 41

Z for βπ?

x∗ = x (λx.M)∗ = λx.M∗ (ιM)∗ = ιM∗ ((λx.M)N)∗ = M∗[x := N∗] ((ιM)[x.N])∗ = N∗[x := M∗] (Me)∗ = M∗@e∗ (otherwise)

  • Monotonicity fails

(ι(x[y.y]))[z.z]w →π (ι(x[y.y]))[z.zw]

((ι(x[y.y]))[z.z]w)∗ = ((ι(x[y.y]))[z.z])∗@w = (x[y.y])@w = x[y.yw] ((ι(x[y.y]))[z.zw])∗ = (zw)∗[z := x[y.y]] = x[y.y]w permutation is applied to the result of β

slide-42
SLIDE 42

Z for βπ?

x∗ = x (λx.M)∗ = λx.M∗ (ιM)∗ = ιM∗ ((λx.M)N)∗ = M∗[x := N∗] ((ιM)[x.N])∗ = N∗[x := M∗] (Me)∗ = M∗@e∗ (otherwise)

  • Monotonicity fails

(ι(x[y.y]))[z.z]w →π (ι(x[y.y]))[z.zw]

((ι(x[y.y]))[z.z]w)∗ = ((ι(x[y.y]))[z.z])∗@w = (x[y.y])@w = x[y.yw] ((ι(x[y.y]))[z.zw])∗ = (zw)∗[z := x[y.y]] = x[y.y]w permutation is applied to the result of β

  • We want to consider functions for π and β


separately (and adapt Z to their composition)

slide-43
SLIDE 43

Compositional Z

slide-44
SLIDE 44

Z and weak Z

M N

  • M∗

N∗

(·)* is Z for → iff

slide-45
SLIDE 45

Z and weak Z

M N

  • M∗

N∗

(·)* is Z for → iff (·)* is weakly Z for → by →x iff

M N

x

  • M∗

x N∗

slide-46
SLIDE 46

Compositional Z

[N&Fujita'15]

  • Let → = →1 ∪ →2 


If mappings (·)1 and (·)2 satisfying following,

  • (·)1 is Z for →1
  • if M →1 N, then M2 →* N2
  • M1 →* M12 holds for any M
  • (·)12 is weakly Z for →2 by →

then the composition (·)12 is Z for →

slide-47
SLIDE 47

Compositional Z

M

1

N

1

  • M

2

N

  • M1

1

  • N1

M12 N12 M12 N12

slide-48
SLIDE 48

Z for 1 Compositional Z

M

1

N

1

  • M

2

N

  • M1

1

  • N1

M12 N12 M12 N12

slide-49
SLIDE 49

weak Z for 2 Z for 1 Compositional Z

M

1

N

1

  • M

2

N

  • M1

1

  • N1

M12 N12 M12 N12

slide-50
SLIDE 50

Confluence of βπ
 by compositional Z

xP = x (λx.M)P = λx.MP (ιM)P = ιMP (Me)P = MP@eP xB = x (λx.M)B = λx.MB (ιM)B = ιMB ((λx.M)N)B = MB[x := NB] ((ιM)[x.N])B = NB[x := MB] (Me)B = MBeB (otherwise)

The mappings (·)P and (·)B satisfies the conditions

  • f the compositional Z for →π and →β
slide-51
SLIDE 51

Applications

λ with permutative conversion π and β

slide-52
SLIDE 52

Applications

λ with permutative conversion π and β λμ with permutative conversion πμ and β

slide-53
SLIDE 53

Applications

λ with permutative conversion π and β λμ with permutative conversion πμ and β extensional λ η and β

slide-54
SLIDE 54

Applications

λ with permutative conversion π and β λμ with permutative conversion πμ and β extensional λ η and β λ with explicit subst. x and β

  • subst. propagation
slide-55
SLIDE 55

Applications

λ with permutative conversion π and β λμ with permutative conversion πμ and β extensional λ η and β λ with explicit subst. x and β

  • subst. propagation

Compositional Z enables us to prove confluence
 by dividing reduction system into two parts

slide-56
SLIDE 56

Church-Rosser via Z

slide-57
SLIDE 57

M } } ! ! M1 ! ! M2 } } ∃N

Confluence vs Church-Rosser

Confluence Church-Rosser (CR)

M1 ! ! M2 } } ∃N

slide-58
SLIDE 58

Confluence vs Church-Rosser

  • In many textbooks, CR is shown as a

corollary of confluence

  • In fact, they are equivalent in almost all of

rewriting systems

  • How can we prove CR directly?
slide-59
SLIDE 59

Church-Rosser via Z

  • Suppose
  • (A,→) : an ARS
  • M*: a Z function on A, and Mn* = n-fold of M*
  • Cross-Point Theorem [Fujita 2016]
  • a constructive proof of CR

For M =A N, we can find a common reduct
 decided by the numbers of → and ← in the conversion sequence

slide-60
SLIDE 60

Main Lemma

r = # of → in M0 = Mn l = # of ← in M0 = Mn

M0 / M1 · · ·

  • / Mn

t t Mr∗

slide-61
SLIDE 61

Main Lemma

r = # of → in M0 = Mn l = # of ← in M0 = Mn

M0 / * * M1 · · ·

  • / Mn

t t Mr∗ Ml∗

n

slide-62
SLIDE 62

Cross-point theorem [Fujita'16]

#l[0,r] = # of ← in M0 … Mr

= # of → in Mr … Mn = #r[r,n]

r = # of → in M0 = Mn l = # of ← in M0 = Mn

M0 ( ( / · · · Mr

  • · · ·
  • / Mn

v v M#l[0,r]∗

r

v v ( ( Mr∗ Ml∗

n

slide-63
SLIDE 63

Quantitative analysis via Z [Fujita'16]

  • From a bound of steps in Z property,


we can give a bound of steps in CR

  • Main lemma: M =A N ⇒ N →Main(M=N) Mr*
  • where Main(M=N) is defined from


Rev, Mon and maximum term size in M=N

M N

  • M∗

N∗

M → N ⇒ N →Rev(|M|) M* M →n N ⇒ M* →Mon(|M|,n) N*

slide-64
SLIDE 64

Quantitative analysis via Z

M0 ( ( / · · · Mr

  • · · ·
  • / Mn

v v M#l[0,r]∗

r

M N

  • M∗

N∗

M → N ⇒ N →Rev(|M|) M* M →n N ⇒ M* →Mon(|M|,n) N* Main(Mr=M0) Main(Mr=Mn)

slide-65
SLIDE 65

Quantitative analysis via Z

M0 ( ( / · · · Mr

  • · · ·
  • / Mn

v v M#l[0,r]∗

r

M N

  • M∗

N∗

M → N ⇒ N →Rev(|M|) M* M →n N ⇒ M* →Mon(|M|,n) N*

For λβ, it is
 non-elementary

Main(Mr=M0) Main(Mr=Mn)

slide-66
SLIDE 66

Quantitative analysis via compositional Z [Fujita&N'16]

  • From bounds of steps in compositional Z (given below),


we can give a bound Main(M=N) in CR

M →1 N ⇒ N →Rev1(|M|) M1 M →Eval2(|M|) M2 M →2 N ⇒ N →Rev2(|M|) M12 M →n N ⇒ M12 →Mon(|M|,n) N12

M

2

/ N ⌅ ⌅ M12 / / N12 M

1

/ N

1

| | M1

1

/ / ✏✏ N1 M12 / / N12

slide-67
SLIDE 67

Quantitative analysis via compositional Z

Main(M=N) is defined as 
 Main(M←N) = 1 Main(M→1N) = Rev1(|M|) + Eval2(|M1|) Main(M→2N) = Rev2(|M|) Main(M=P←Q) = Main(M=P) + 1 Main(M=P→1Q) = Mon(n,Main(M=P)) + Eval2(n) + Rev1(n) Main(M=P→2Q) = Mon(n,Main(M=P)) + Rev2(n) where n = maximum term size in M=N

slide-68
SLIDE 68

Summary

  • Confluence of λ with permutative conversions


becomes much simpler with compositional Z

  • Compositional Z suggests (quasi-)modular proofs

  • f confluence
  • Quantitative analysis for CR via Z


can be extended to compositional Z

  • K. Nakazawa and K. Fujita. Compositional Z: confluence proofs for permutative conversion.


Studia Logica, to appear.

  • K. Fujita and K. Nakazawa. Church-Rosser Theorem and Compositional Z-Property.


In Proceedings of 33rd JSSST, 2016

slide-69
SLIDE 69

“Simpler” proofs?

slide-70
SLIDE 70

“Simpler” proofs?

  • Easier to check?
slide-71
SLIDE 71

“Simpler” proofs?

  • Easier to check?
  • Easier to apply other calculi?
slide-72
SLIDE 72

“Simpler” proofs?

  • Easier to check?
  • Easier to apply other calculi?
  • Shorter formal proof? …depending on logical system
slide-73
SLIDE 73

“Simpler” proofs?

  • Easier to check?
  • Easier to apply other calculi?
  • Shorter formal proof? …depending on logical system
  • Easier to formalize? …I believe so, but we should check it
slide-74
SLIDE 74

“Simpler” proofs?

  • Easier to check?
  • Easier to apply other calculi?
  • Shorter formal proof? …depending on logical system
  • Easier to formalize? …I believe so, but we should check it

“I feel that the new proofs (…) are
 more beautiful than those we started with,
 and this is my actual motivation.” — [Pollack 1995]

slide-75
SLIDE 75

A Classical Japanese Poem

composed by Sutoku-In (崇徳院) in 12th cent.

瀬を早み 岩にせかるる滝川の
 われても末に 逢はむとぞ思ふ


(direct translation)
 A stream of the river separates into two streams after hitting the rock,
 but it will become one stream again


(that is,)
 although if I love someone but we cannot be together in this life,
 I can be together with her in the next life

Japanese-English Bilingual Corpus of Wikipedia's Kyoto Articles (National Institute of Information and Communications Technology)

slide-76
SLIDE 76

A Classical Japanese Poem

composed by Sutoku-In (崇徳院) in 12th cent.

瀬を早み 岩にせかるる滝川の
 われても末に 逢はむとぞ思ふ


(direct translation)
 A stream of the river separates into two streams after hitting the rock,
 but it will become one stream again


(that is,)
 although if I love someone but we cannot be together in this life,
 I can be together with her in the next life

Japanese-English Bilingual Corpus of Wikipedia's Kyoto Articles (National Institute of Information and Communications Technology)

confluence makes us happy!