second-order acgs as hyperedge replacement grammars · mctag: multi-component tree-adjoining...

43
Second-order ACGs as Hyperedge Replacement Grammars Makoto Kanazawa NII, Tokyo

Upload: others

Post on 30-Sep-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Second-order ACGs as Hyperedge Replacement

GrammarsMakoto Kanazawa

NII, Tokyo

Page 2: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

This talk

: second-order abstract categorial grammars (de Groote 2001) : hyperedge replacement graph grammars (Bauderon and Courcelle 1987, Habel and Kreowski 1987)Generalize “context-free” grammars on strings/trees

string generating power

tree generating power

STR(A) = STR(HR)

TR(A) = TR(HR)

A

HR

Page 3: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

This talk

: second-order abstract categorial grammars (de Groote 2001) : hyperedge replacement graph grammars (Bauderon and Courcelle 1987, Habel and Kreowski 1987)Generalize “context-free” grammars on strings/trees

string generating power

tree generating power

STR(A) = STR(HR)

TR(A) = TR(HR)

A

HR

already known(de Groote & Pogodalla, Salvati)

Page 4: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

This talk

: second-order abstract categorial grammars (de Groote 2001) : hyperedge replacement graph grammars (Bauderon and Courcelle 1987, Habel and Kreowski 1987)Generalize “context-free” grammars on strings/trees

string generating power

tree generating power

STR(A) = STR(HR)

TR(A) = TR(HR)

A

HR

already known(de Groote & Pogodalla, Salvati)

new!

Page 5: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

“Context-free” grammar formalisms

A

B C

derivation tree

“yield” (string, tree, ...)

Page 6: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

“Context-free” grammar formalisms

A

B C

derivation tree

“yield” (string, tree, ...)

set of derivation tree = local set

Page 7: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

“Context-free” grammar formalisms

A

B C

derivation tree

“yield” (string, tree, ...)

set of derivation tree = local set

linear, non-deleting, non-destructive operation

Page 8: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

“Context-free” grammar formalisms

A

B C

derivation tree

“yield” (string, tree, ...)

A! BC

X1 X2A

!:! B(X1), C(X2).

“context-free” production

top-down view bottom-up view

set of derivation tree = local set

linear, non-deleting, non-destructive operation

Page 9: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Multiple context-free grammars{ ambncmdn | m, n ! 0 }

S

A B

am cmbn dn

am bn cm dn

S(x1y1x2y2) :− A(x1, x2), B(y1, y2).A(ax1, cx2) :− A(x1, x2).A(!, !).

B(by1, dy2) :− B(y1, y2).B(!, !).

Page 10: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Multiple context-free grammars{ ambncmdn | m, n ! 0 }

S

A B

am cmbn dn

am bn cm dn

S(x1y1x2y2) :− A(x1, x2), B(y1, y2).A(ax1, cx2) :− A(x1, x2).A(!, !).

B(by1, dy2) :− B(y1, y2).B(!, !).

tuple of strings

Page 11: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

“Context-free” grammars on …

RTG: regular tree grammarLCFTG: linear non-deleting context-free tree grammarMCFG: multiple context-free grammarMRTG: multiple regular tree grammarMCTAG: multi-component tree-adjoining grammar

strings trees tree contextsC[x1]

n-ary tree contexts C[x1,...,xn]

single CFG RTG TAG (monadic LCFTG) LCFTG

multiple MCFG MRTG MCTAG

Page 12: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

“Context-free” grammars on …

RTG: regular tree grammarLCFTG: linear non-deleting context-free tree grammarMCFG: multiple context-free grammarMRTG: multiple regular tree grammarMCTAG: multi-component tree-adjoining grammar

strings trees tree contextsC[x1]

n-ary tree contexts C[x1,...,xn]

single CFG RTG TAG (monadic LCFTG) LCFTG

multiple MCFG MRTG MCTAG

MLCFTG: multiple linear non-deleting context-free tree grammar

MLCFTG

Page 13: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

MLCFTG

S

A

A

A

A

„,

«.

f f

a a

f f

b b b b

a

a

f

b

b

b

b

a

a

f

b

b

b

b

f f

a

b b

a

b b

a

b b b b

a

f

e e e e

e eee

f

a a

b b b b

f f

y1 y2S

!:! A(y1, y2).

y1 y2A

,

!:! A(y1, y2).

Page 14: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

string abbac !z.a(b(b(a(cz))))

tree a(f (be)(be))

n-ary tree context

!x1x2.a(f (bx1)(bx2))

tuple (N1, N2, N3) !w.wN1N2N3

logical formula !x"y(Rxy) !(!x."(!y.Rxy))

ACG: Everything is a linear λ-term

f

a

b b

f

a

b b

ee

Page 15: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

MLCFTGs as second-order ACGs

MLCFTG:

a a

b b b b

y1 y2A

,

!:! A(y1, y2).

Page 16: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

MLCFTGs as second-order ACGs

MLCFTG:

a a

b b b b

y1 y2A

,

!:! A(y1, y2).

2nd-order ACG: linear λ-termA

`!w.X(!y1y2.w(!x1x2.a(y1(bx1)(bx2)))(!x1x2.a(y2(bx1)(bx2))))

´:! A(X).

Page 17: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

MLCFTGs as second-order ACGs

MLCFTG:

a a

b b b b

y1 y2A

,

!:! A(y1, y2).

a a

b b b b

y1 y2A

!w.X(!y1y2.w

„ «„ «)

!:! A(X).

2nd-order ACG: linear λ-termA

`!w.X(!y1y2.w(!x1x2.a(y1(bx1)(bx2)))(!x1x2.a(y2(bx1)(bx2))))

´:! A(X).

Page 18: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

MLCFTGs as second-order ACGs

MLCFTG:

a a

b b b b

y1 y2A

,

!:! A(y1, y2).

f f

a

b b

a

b b

f f

Page 19: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

MLCFTGs as second-order ACGs

MLCFTG:

a a

b b b b

y1 y2A

,

!:! A(y1, y2).

f f

a

b b

a

b b

f f

!w.(!v.v(!x1x2.f x1x2)(!x1x2.f x1x2))(!y1y2.w(!x1x2.a(y1(bx1)(bx2)))(!x1x2.a(y2(bx1)(bx2))))

!" !w.w(!x1x2.a(f (bx1)(bx2)))(!x1x2.a(f (bx1)(bx2)))

Page 20: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

MLCFTGs as second-order ACGs

MLCFTG:

a a

b b b b

y1 y2A

,

!:! A(y1, y2).

f f

a

b b

a

b b

f f

β-reduction

a a

b b b b

y1 y2f f!w.(!v.v

„ «„ «)(!y1y2.w

„ «„ «)!" !w.w

„ «„ «f f

a

b b

a

b b

!w.(!v.v(!x1x2.f x1x2)(!x1x2.f x1x2))(!y1y2.w(!x1x2.a(y1(bx1)(bx2)))(!x1x2.a(y2(bx1)(bx2))))

!" !w.w(!x1x2.a(f (bx1)(bx2)))(!x1x2.a(f (bx1)(bx2)))

Page 21: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

MLCFTGs as second-order ACGs

TR(A) ! MLCFTL

MLCFTG:

a a

b b b b

y1 y2A

,

!:! A(y1, y2).

f f

a

b b

a

b b

f f

!w.(!v.v(!x1x2.f x1x2)(!x1x2.f x1x2))(!y1y2.w(!x1x2.a(y1(bx1)(bx2)))(!x1x2.a(y2(bx1)(bx2))))

!" !w.w(!x1x2.a(f (bx1)(bx2)))(!x1x2.a(f (bx1)(bx2)))

Page 22: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

HR: Everything is a hypergrapha ab b c

1 2

string graph

bb

f

ee

1

a

bb

f

1

a

2

3

tree graph of type 1 tree graph of type 3

node

f1 2

3

hyperedge

2external node

Page 23: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

HR: Everything is a hypergrapha ab b c

1 2

string graph

bb

f

ee

1

a

bb

f

1

a

2

3

tree graph of type 1 tree graph of type 3

node

f1 2

3

hyperedge

2external node

tuple = disjoint union

Page 24: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

MLCFTGs as HRs

MLCFTG:

a a

b b b b

y1 y2A

,

!:! A(y1, y2).

HR:

X

a a

b b b b

3 6

1 2 4 5

1

2

3

4

5

6

A

!:! A(X)

hypergraph

Page 25: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Hyperedge replacement

a a

b b b b

3 6

1 2 4 5

1 2

3

4 5

6

f f

1 2

3

4 5

6

a a

b b b b

3 6

1 2 4 5

f f

hyperedgereplacement

Page 26: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Hyperedge replacement

a a

b b b b

3 6

1 2 4 5

1 2

3

4 5

6

f f

1 2

3

4 5

6

a a

b b b b

3 6

1 2 4 5

f f

hyperedgereplacement

TR(HR) ! MLCFTL

Page 27: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Example: LadderX

a

a

a

1 2

X

a a

1 2

1 2

S

!:! A(X).

A

!:! A(X).

A` ´

.1 2

a a

a

a a

a

a a

a

a a

a

a a

Page 28: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Example: LadderX

a

a

a

1 2

X

a a

1 2

1 2

S

!:! A(X).

A

!:! A(X).

A` ´

. hypergraphs λ-terms!"1 2

a a

a

a a

a

a a

a

a a

a

a a

Page 29: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Linear λ-terms vs. hypergraphs

stringstrees

tree contexts

ladder

?

hypergraphslinear λ-terms

Page 30: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

λ-terms as hypergraphs!(!x."(!y.Rxy))

Page 31: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

λ-terms as hypergraphs!(!x."(!y.Rxy))

tree graph

1

!

!x

!

λy

R

x y

Page 32: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

λ-terms as hypergraphs!(!x."(!y.Rxy))

tree graph

1

!

!x

!

λy

R

x y

Page 33: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

λ-terms as hypergraphs!(!x."(!y.Rxy))

tree graph

1

!

!x

!

λy

R

x y

!

!

R

x y

1

term graph

Page 34: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

λ-terms as hypergraphs!(!x."(!y.Rxy))

tree graph

1

!

!x

!

λy

R

x y

!

!

R

x y

1

term graph

rank(c) = |type(c)|3 = |(e! t)! t|

Page 35: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

λ-terms as hypergraphs!(!x."(!y.Rxy))

tree graph

1

!

!x

!

λy

R

x y

!

!

R

x y

1

term graph

linear λ-terms hypergraphs!

rank(c) = |type(c)|3 = |(e! t)! t|

Page 36: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

2nd-order ACGs as HRsS

`X(!x.Y x)

´:! NP(X),VP(Y ).

VP`!x.Y (!y.Xxy)

´:! V(X),NP(Y ).

V(!xy.Rxy).

NP(!u."(!x.ux)).NP(!u.#(!x.ux)).

X

Y

1

2

x y

VP

!:! V(X),NP(Y ).

Page 37: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Linear β-reduction ashyperedge replacement

1

!

!

R

x y

1

!

2 3

x

!

R

x y

1

2

1

hyperedgereplacement

!(!x."(!y.Rxy))

Page 38: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Second-order ACGs vs. hyperedge replacement grammars

λ-term generating power

MLCFTL ! TR(A)MLCFTL ! TR(HR)LT (A) ! LT (HR)

Page 39: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Second-order ACGs vs. hyperedge replacement grammars

λ-term generating power

MLCFTL ! TR(A)MLCFTL ! TR(HR)LT (A) ! LT (HR)

(Engelfriet and Maneth 2000)TR(HR) ! MLCFTL

Page 40: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Second-order ACGs vs. hyperedge replacement grammars

λ-term generating power

TR(A) = TR(HR)

MLCFTL ! TR(A)MLCFTL ! TR(HR)LT (A) ! LT (HR)

(Engelfriet and Maneth 2000)TR(HR) ! MLCFTL

Page 41: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Convergence of mildly context-sensitive grammar formalisms

TAG=LIG=HG=C2

MCFG=MCTAG=DTWT=MG=HR=A

LCFTG

string languages

Page 42: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG

Convergence of mildly context-sensitive grammar formalisms

TAG=LIG=HG=C2

MCFG=MCTAG=DTWT=MG=HR=A

LCFTG

string languages

TAG

LCFTG

sur-AT=HR=A=MLCFTG

tree languages

Page 43: Second-order ACGs as Hyperedge Replacement Grammars · MCTAG: multi-component tree-adjoining grammar strings trees tree contexts C[x1] n-ary tree contexts C[x1,...,xn] single CFG