Decision problems for Clark-congruential languages Makoto Kanazawa 1 - - PowerPoint PPT Presentation

decision problems for clark congruential languages
SMART_READER_LITE
LIVE PREVIEW

Decision problems for Clark-congruential languages Makoto Kanazawa 1 - - PowerPoint PPT Presentation

Decision problems for Clark-congruential languages Makoto Kanazawa 1 e 2 Tobias Kapp 1 Hosei University, Tokyo 2 University College London Work performed at the National Institute of Informatics, Tokyo. LearnAut, July 13, 2018 1 Introduction


slide-1
SLIDE 1

Decision problems for Clark-congruential languages

Makoto Kanazawa1 Tobias Kapp´ e2

1Hosei University, Tokyo 2University College London Work performed at the National Institute of Informatics, Tokyo.

LearnAut, July 13, 2018

1

slide-2
SLIDE 2

Introduction

Suppose you know the following Japanese phrase: 猫は椅子で眠る The cat sleeps in the chair.

2

slide-3
SLIDE 3

Introduction

Suppose you know the following Japanese phrase: 猫は椅子で眠る The cat sleeps in the chair. You also know that dog is 犬. Now, you can form: 犬は椅子で眠る

2

slide-4
SLIDE 4

Introduction

Suppose you know the following Japanese phrase: 猫は椅子で眠る The cat sleeps in the chair. You also know that dog is 犬. Now, you can form: 犬は椅子で眠る The dog sleeps in the chair.

2

slide-5
SLIDE 5

Introduction

This works because 猫 and 犬 are nouns.

3

slide-6
SLIDE 6

Introduction

This works because 猫 and 犬 are nouns. Replacing nouns (probably) preserves grammatical correctness.

3

slide-7
SLIDE 7

Introduction

This works because 猫 and 犬 are nouns. Replacing nouns (probably) preserves grammatical correctness. 猫 and 犬 are (almost) syntactically congruent: u猫v ∈ Japanese “ ⇐ ⇒ ” u犬v ∈ Japanese

3

slide-8
SLIDE 8

Introduction

Idea: use syntactic congruence to drive learning.1

1Clark 2010. 4

slide-9
SLIDE 9

Introduction

Idea: use syntactic congruence to drive learning.1 When (for all we know) uwv ∈ L ⇐ ⇒ uxv ∈ L, presume w ≡L x.

1Clark 2010. 4

slide-10
SLIDE 10

Introduction

Idea: use syntactic congruence to drive learning.1 When (for all we know) uwv ∈ L ⇐ ⇒ uxv ∈ L, presume w ≡L x. . . . but how to represent the language?

1Clark 2010. 4

slide-11
SLIDE 11

Introduction

Definition (Informal)

A grammar is Clark-congruential (CC) if words derived from the same symbol are syntactically congruent for its language. A language is CC when there exists a CC grammar that describes it.

5

slide-12
SLIDE 12

Introduction

Definition (Informal)

A grammar is Clark-congruential (CC) if words derived from the same symbol are syntactically congruent for its language. A language is CC when there exists a CC grammar that describes it.

Example

Consider these grammars for L = {a, b}+: G1 : S → SS + a + b G2 : S → TS + a + b, T → a + b + ǫ

5

slide-13
SLIDE 13

Introduction

Definition (Informal)

A grammar is Clark-congruential (CC) if words derived from the same symbol are syntactically congruent for its language. A language is CC when there exists a CC grammar that describes it.

Example

Consider these grammars for L = {a, b}+: G1 : S → SS + a + b G2 : S → TS + a + b, T → a + b + ǫ If S derives w and x in G1, then uwv ∈ L implies uxv ∈ L — G1 is CC.

5

slide-14
SLIDE 14

Introduction

Definition (Informal)

A grammar is Clark-congruential (CC) if words derived from the same symbol are syntactically congruent for its language. A language is CC when there exists a CC grammar that describes it.

Example

Consider these grammars for L = {a, b}+: G1 : S → SS + a + b G2 : S → TS + a + b, T → a + b + ǫ If S derives w and x in G1, then uwv ∈ L implies uxv ∈ L — G1 is CC. However: T derives a and ǫ in G2. Now, a ∈ L but ǫ ∈ L — G2 is not CC.

5

slide-15
SLIDE 15

Introduction

Let G be a CC grammar describing L.

6

slide-16
SLIDE 16

Introduction

Let G be a CC grammar describing L. In the minimally adequate teacher (MAT) model, the learner can query: ◮ Given w ∈ Σ∗, does w ∈ L(G) hold? ◮ Given a grammar H, does L(G) = L(H) hold? If not, give a counterexample.

6

slide-17
SLIDE 17

Introduction

Let G be a CC grammar describing L. In the minimally adequate teacher (MAT) model, the learner can query: ◮ Given w ∈ Σ∗, does w ∈ L(G) hold? ◮ Given a grammar H, does L(G) = L(H) hold? If not, give a counterexample.

Theorem (Clark 2010)

Let L be a CC language; L is “MAT-learnable”. That is, given a MAT for L, we can construct a CC grammar for L.

6

slide-18
SLIDE 18

Introduction

Let G be a CC grammar describing L. In the minimally adequate teacher (MAT) model, the learner can query: ◮ Given w ∈ Σ∗, does w ∈ L(G) hold? ◮ Given a grammar H, does L(G) = L(H) hold? If not, give a counterexample.

Theorem (Clark 2010)

Let L be a CC language; L is “MAT-learnable”. That is, given a MAT for L, we can construct a CC grammar for L.

Question

Let L be a CC language; is L “MAT-teachable”? That is, given a CC grammar for L, can we construct a MAT for L?

6

slide-19
SLIDE 19

Introduction

Let G be a CC grammar describing L. In the minimally adequate teacher (MAT) model, the learner can query: ◮ Given w ∈ Σ∗, does w ∈ L(G) hold? ◮ Given a grammar H, does L(G) = L(H) hold? If not, give a counterexample.

Theorem (Clark 2010)

Let L be a CC language; L is “MAT-learnable”. That is, given a MAT for L, we can construct a CC grammar for L. Is this decidable?

Question

Let L be a CC language; is L “MAT-teachable”? That is, given a CC grammar for L, can we construct a MAT for L?

6

slide-20
SLIDE 20

Context

Equivalence problem

Given grammars G1 and G2, does L(G1) = L(G2) hold?

2Bar-Hillel, Perles, and Shamir 1961. 7

slide-21
SLIDE 21

Context

Equivalence problem

Given grammars G1 and G2, does L(G1) = L(G2) hold?

Congruence problem

Given a grammar G, and w, x ∈ Σ∗, are w and x syntactically congruent for L(G)?

2Bar-Hillel, Perles, and Shamir 1961. 7

slide-22
SLIDE 22

Context

Equivalence problem

Given grammars G1 and G2, does L(G1) = L(G2) hold?

Congruence problem

Given a grammar G, and w, x ∈ Σ∗, are w and x syntactically congruent for L(G)? Equivalence and congruence are undecidable for grammars in general.2

2Bar-Hillel, Perles, and Shamir 1961. 7

slide-23
SLIDE 23

Context

CC languages

8

slide-24
SLIDE 24

Context

CC languages Context-free languages

8

slide-25
SLIDE 25

Context

CC languages Context-free languages Pre-NTS languages

8

slide-26
SLIDE 26

Context

CC languages Context-free languages Pre-NTS languages NTS languages

8

slide-27
SLIDE 27

Context

Congruence Equivalence Pre-NTS NTS

✓3 ✓3 ✓4 ✓4

3S´

enizergues 1985.

4Autebert and Boasson 1992. 9

slide-28
SLIDE 28

Context

Congruence Equivalence CC Pre-NTS NTS

✓3 ✓3 ✓4 ✓4 ✓ ✓

3S´

enizergues 1985.

4Autebert and Boasson 1992. 9

slide-29
SLIDE 29

Preliminaries

A congruence on Σ∗ is an equivalence ≡ on Σ∗ such that w ≡ w′ x ≡ x′ wx ≡ w′x′

10

slide-30
SLIDE 30

Preliminaries

A congruence on Σ∗ is an equivalence ≡ on Σ∗ such that w ≡ w′ x ≡ x′ wx ≡ w′x′ Every language L induces a syntactic congruence ≡L: ∀u, v ∈ Σ∗. uwv ∈ L ⇐ ⇒ uxv ∈ L w ≡L x

10

slide-31
SLIDE 31

Preliminaries

A Context-Free Grammar (CFG) is a tuple G = V , →, I. Nonterminals

11

slide-32
SLIDE 32

Preliminaries

A Context-Free Grammar (CFG) is a tuple G = V , →, I. Production relation

11

slide-33
SLIDE 33

Preliminaries

A Context-Free Grammar (CFG) is a tuple G = V , →, I. Initial nonterminals

11

slide-34
SLIDE 34

Preliminaries

A Context-Free Grammar (CFG) is a tuple G = V , →, I. We fix G = V , →, I.

11

slide-35
SLIDE 35

Preliminaries

A Context-Free Grammar (CFG) is a tuple G = V , →, I. We fix G = V , →, I. αBγ ∈ (Σ ∪ V )∗ B → β αBγ ⇒G αβγ

11

slide-36
SLIDE 36

Preliminaries

A Context-Free Grammar (CFG) is a tuple G = V , →, I. We fix G = V , →, I. αBγ ∈ (Σ ∪ V )∗ B → β αBγ ⇒G αβγ L(G, α) = {w ∈ Σ∗ : α ⇒∗

G w}

11

slide-37
SLIDE 37

Preliminaries

A Context-Free Grammar (CFG) is a tuple G = V , →, I. We fix G = V , →, I. αBγ ∈ (Σ ∪ V )∗ B → β αBγ ⇒G αβγ L(G, α) = {w ∈ Σ∗ : α ⇒∗

G w}

L(G) =

  • A∈I

L(G, A)

11

slide-38
SLIDE 38

Preliminaries

A Context-Free Grammar (CFG) is a tuple G = V , →, I. We fix G = V , →, I. αBγ ∈ (Σ ∪ V )∗ B → β αBγ ⇒G αβγ L(G, α) = {w ∈ Σ∗ : α ⇒∗

G w}

L(G) =

  • A∈I

L(G, A)

Definition (More formal)

We say G is CC when for A ∈ V and w, x ∈ L(G, A), we have w ≡L(G) x.

11

slide-39
SLIDE 39

Preliminaries

We assume a total order on Σ.

12

slide-40
SLIDE 40

Preliminaries

We assume a total order on Σ. This order extends to a total order on Σ∗: ◮ If w is shorter than x, then w x. ◮ If w and x are of equal length, compare lexicographically.

12

slide-41
SLIDE 41

Preliminaries

We assume a total order on Σ. This order extends to a total order on Σ∗: ◮ If w is shorter than x, then w x. ◮ If w and x are of equal length, compare lexicographically. For α ∈ (Σ ∪ V )∗ with L(G, α) = ∅, write ϑG(α) for the -minimum of L(G, α).

12

slide-42
SLIDE 42

Deciding congruence

Let G be CC. We mimic an earlier method to decide congruence.5

5Autebert and Boasson 1992. 13

slide-43
SLIDE 43

Deciding congruence

Let G be CC. We mimic an earlier method to decide congruence.5 Let G be the smallest rewriting relation such that A → α L(G, α) = ∅ ϑG(α) G ϑG(A)

5Autebert and Boasson 1992. 13

slide-44
SLIDE 44

Deciding congruence

Let G be CC. We mimic an earlier method to decide congruence.5 Let G be the smallest rewriting relation such that A → α L(G, α) = ∅ ϑG(α) G ϑG(A)

Lemma

If w G x, then w ≡L(G) x.

5Autebert and Boasson 1992. 13

slide-45
SLIDE 45

Deciding congruence

Lemma

w ∈ L(G) if and only if w G ϑG(A) for some A ∈ I.

14

slide-46
SLIDE 46

Deciding congruence

Lemma

w ∈ L(G) if and only if w G ϑG(A) for some A ∈ I.

Example

Let G = {S}, {S → SS + (S) + ǫ}, {S}; this grammar is CC.

14

slide-47
SLIDE 47

Deciding congruence

Lemma

w ∈ L(G) if and only if w G ϑG(A) for some A ∈ I.

Example

Let G = {S}, {S → SS + (S) + ǫ}, {S}; this grammar is CC. G is generated by () G ǫ (()())()

14

slide-48
SLIDE 48

Deciding congruence

Lemma

w ∈ L(G) if and only if w G ϑG(A) for some A ∈ I.

Example

Let G = {S}, {S → SS + (S) + ǫ}, {S}; this grammar is CC. G is generated by () G ǫ (()())() G (())()

14

slide-49
SLIDE 49

Deciding congruence

Lemma

w ∈ L(G) if and only if w G ϑG(A) for some A ∈ I.

Example

Let G = {S}, {S → SS + (S) + ǫ}, {S}; this grammar is CC. G is generated by () G ǫ (()())() G (())() G ()()

14

slide-50
SLIDE 50

Deciding congruence

Lemma

w ∈ L(G) if and only if w G ϑG(A) for some A ∈ I.

Example

Let G = {S}, {S → SS + (S) + ǫ}, {S}; this grammar is CC. G is generated by () G ǫ (()())() G (())() G ()() G ()

14

slide-51
SLIDE 51

Deciding congruence

Lemma

w ∈ L(G) if and only if w G ϑG(A) for some A ∈ I.

Example

Let G = {S}, {S → SS + (S) + ǫ}, {S}; this grammar is CC. G is generated by () G ǫ (()())() G (())() G ()() G () G ǫ = ϑG(S)

14

slide-52
SLIDE 52

Deciding congruence

Lemma

w ∈ L(G) if and only if w G ϑG(A) for some A ∈ I.

Example

Let G = {S}, {S → SS + (S) + ǫ}, {S}; this grammar is CC. G is generated by () G ǫ (()())() G (())() G ()() G () G ǫ = ϑG(S) therefore: (()())() ∈ L(G).

14

slide-53
SLIDE 53

Deciding congruence

Lemma

w ∈ L(G) if and only if w G ϑG(A) for some A ∈ I.

Example

Let G = {S}, {S → SS + (S) + ǫ}, {S}; this grammar is CC. G is generated by () G ǫ (()())() G (())() G ()() G () G ǫ = ϑG(S) therefore: (()())() ∈ L(G). From )()(, we cannot reach ǫ; thus, )()( ∈ L(G).

14

slide-54
SLIDE 54

Deciding congruence

Write IG for the set of words irreducible by G.

15

slide-55
SLIDE 55

Deciding congruence

Write IG for the set of words irreducible by G.

Lemma

We can create a DPDA Mw such that L(Mw) = {u♯v : uwv ∈ L(G), u, v ∈ IG}.

15

slide-56
SLIDE 56

Deciding congruence

Write IG for the set of words irreducible by G.

Lemma

We can create a DPDA Mw such that L(Mw) = {u♯v : uwv ∈ L(G), u, v ∈ IG}.

Lemma

L(Mw) = L(Mx) if and only if w ≡L(G) x.

15

slide-57
SLIDE 57

Deciding congruence

Write IG for the set of words irreducible by G.

Lemma

We can create a DPDA Mw such that L(Mw) = {u♯v : uwv ∈ L(G), u, v ∈ IG}.

Lemma

L(Mw) = L(Mx) if and only if w ≡L(G) x. Decidable (S´ enizergues 1997)

15

slide-58
SLIDE 58

Deciding congruence

Write IG for the set of words irreducible by G.

Lemma

We can create a DPDA Mw such that L(Mw) = {u♯v : uwv ∈ L(G), u, v ∈ IG}.

Lemma

L(Mw) = L(Mx) if and only if w ≡L(G) x.

Theorem

Let w, x ∈ Σ∗. We can decide whether w ≡L(G) x.

15

slide-59
SLIDE 59

Deciding equivalence

Analogous to a result about NTS grammars,6 we find

Lemma

Let G1 = V1, →1, I1 and G2 = V2, →2, I2 be CC. Then L(G1) = L(G2) if and only if (i) for all A ∈ I1 , it holds that ϑG1(A) ∈ L(G2) (and vice versa) (ii) for all pairs u G1 v generating G1 , also u ≡L(G2) v (and vice versa)

6S´

enizergues 1985.

16

slide-60
SLIDE 60

Deciding equivalence

Analogous to a result about NTS grammars,6 we find

Lemma

Let G1 = V1, →1, I1 and G2 = V2, →2, I2 be CC. Then L(G1) = L(G2) if and only if (i) for all A ∈ I1 , it holds that ϑG1(A) ∈ L(G2) (and vice versa) (ii) for all pairs u G1 v generating G1 , also u ≡L(G2) v (and vice versa) Finitely many

6S´

enizergues 1985.

16

slide-61
SLIDE 61

Deciding equivalence

Analogous to a result about NTS grammars,6 we find

Lemma

Let G1 = V1, →1, I1 and G2 = V2, →2, I2 be CC. Then L(G1) = L(G2) if and only if (i) for all A ∈ I1 , it holds that ϑG1(A) ∈ L(G2) (and vice versa) (ii) for all pairs u G1 v generating G1 , also u ≡L(G2) v (and vice versa) Decidable

6S´

enizergues 1985.

16

slide-62
SLIDE 62

Deciding equivalence

Analogous to a result about NTS grammars,6 we find

Lemma

Let G1 = V1, →1, I1 and G2 = V2, →2, I2 be CC. Then L(G1) = L(G2) if and only if (i) for all A ∈ I1 , it holds that ϑG1(A) ∈ L(G2) (and vice versa) (ii) for all pairs u G1 v generating G1 , also u ≡L(G2) v (and vice versa) Finitely many

16

slide-63
SLIDE 63

Deciding equivalence

Analogous to a result about NTS grammars,6 we find

Lemma

Let G1 = V1, →1, I1 and G2 = V2, →2, I2 be CC. Then L(G1) = L(G2) if and only if (i) for all A ∈ I1 , it holds that ϑG1(A) ∈ L(G2) (and vice versa) (ii) for all pairs u G1 v generating G1 , also u ≡L(G2) v (and vice versa) Decidable

6S´

enizergues 1985.

16

slide-64
SLIDE 64

Deciding equivalence

Analogous to a result about NTS grammars,6 we find

Lemma

Let G1 = V1, →1, I1 and G2 = V2, →2, I2 be CC. Then L(G1) = L(G2) if and only if (i) for all A ∈ I1 , it holds that ϑG1(A) ∈ L(G2) (and vice versa) (ii) for all pairs u G1 v generating G1 , also u ≡L(G2) v (and vice versa)

Theorem

Let G1 and G2 be CC. We can decide whether L(G1) = L(G2).

6S´

enizergues 1985.

16

slide-65
SLIDE 65

Conclusion

So, are CC languages “MAT-teachable”?

17

slide-66
SLIDE 66

Conclusion

So, are CC languages “MAT-teachable”?

  • Yes. . . but there is a slight mismatch:

17

slide-67
SLIDE 67

Conclusion

So, are CC languages “MAT-teachable”?

  • Yes. . . but there is a slight mismatch:

◮ (Clark 2010) assumes an extended MAT.

17

slide-68
SLIDE 68

Conclusion

So, are CC languages “MAT-teachable”?

  • Yes. . . but there is a slight mismatch:

◮ (Clark 2010) assumes an extended MAT. ◮ That is, hypothesis grammars may not be CC!

17

slide-69
SLIDE 69

Conclusion

So, are CC languages “MAT-teachable”?

  • Yes. . . but there is a slight mismatch:

◮ (Clark 2010) assumes an extended MAT. ◮ That is, hypothesis grammars may not be CC! Two plausible fixes:

17

slide-70
SLIDE 70

Conclusion

So, are CC languages “MAT-teachable”?

  • Yes. . . but there is a slight mismatch:

◮ (Clark 2010) assumes an extended MAT. ◮ That is, hypothesis grammars may not be CC! Two plausible fixes: ◮ Adjust learning algorithm to have CC grammars as hypotheses.

17

slide-71
SLIDE 71

Conclusion

So, are CC languages “MAT-teachable”?

  • Yes. . . but there is a slight mismatch:

◮ (Clark 2010) assumes an extended MAT. ◮ That is, hypothesis grammars may not be CC! Two plausible fixes: ◮ Adjust learning algorithm to have CC grammars as hypotheses. ◮ Extend decision procedure, requiring only one grammar to be CC.

17

slide-72
SLIDE 72

Further work

Many open questions: ◮ Are CC grammars more expressive than pre-NTS grammars?

18

slide-73
SLIDE 73

Further work

Many open questions: ◮ Are CC grammars more expressive than pre-NTS grammars? ◮ Is the language of every CC grammar a DCFL?

18

slide-74
SLIDE 74

Further work

Many open questions: ◮ Are CC grammars more expressive than pre-NTS grammars? ◮ Is the language of every CC grammar a DCFL? ◮ Is it decidable whether a given grammar is CC?

18

slide-75
SLIDE 75

Bonus: grammar to DPDA

Lemma

Let G be CC, and let R be regular. We can create a CC grammar GR such that L(GR) = L(G) ∩ R.

19

slide-76
SLIDE 76

Bonus: grammar to DPDA

Lemma

Let G be CC, and let R be regular. We can create a CC grammar GR such that L(GR) = L(G) ∩ R.

Lemma

Let h : Σ∗ → Σ∗ be a strictly alphabetic morphism, that is, h(a) ∈ Σ for all a ∈ Σ. We can create a CC grammar G h such that L(G h) = h−1(L(G)).

19

slide-77
SLIDE 77

Bonus: grammar to DPDA

For a ∈ Σ, add ¯ a to Σ. Let h : Σ → Σ be such that h(a) = h(¯ a) = a. Create G h such that L(G h) = h−1(L(G)).

20

slide-78
SLIDE 78

Bonus: grammar to DPDA

For a ∈ Σ, add ¯ a to Σ. Let h : Σ → Σ be such that h(a) = h(¯ a) = a. Create G h such that L(G h) = h−1(L(G)).

Intuition

G h is the same as G, but positions in every word can be “marked” by ¯.

20

slide-79
SLIDE 79

Bonus: grammar to DPDA

Note that IG is a regular language. Create Gw such that L(Gw) = L(G h) ∩ IG ¯ wIG. Now Gw = {u ¯ wv : uwv ∈ L(G), u, v ∈ IG}.

21

slide-80
SLIDE 80

Bonus: grammar to DPDA

Note that IG is a regular language. Create Gw such that L(Gw) = L(G h) ∩ IG ¯ wIG. Now Gw = {u ¯ wv : uwv ∈ L(G), u, v ∈ IG}.

Intuition

L(Gw) has words in L(G) with w as a marked substring, with context reduced by G.

21

slide-81
SLIDE 81

Bonus: grammar to DPDA

Lemma

Without loss of generality, every rule generating Gw overlaps and preserves ¯ w.

22

slide-82
SLIDE 82

Bonus: grammar to DPDA

Lemma

Without loss of generality, every rule generating Gw overlaps and preserves ¯ w. We can now create a reduction G[w] and a finite set Sw such that ◮ Every rule generating G[w] contains and preserves ♯. ◮ {x ∈ Σ∗ : x G[w] y ∈ Sw} = {u♯v : uwv ∈ L(G), u, v ∈ IG}

22

slide-83
SLIDE 83

Bonus: grammar to DPDA

Lemma

Without loss of generality, every rule generating Gw overlaps and preserves ¯ w. We can now create a reduction G[w] and a finite set Sw such that ◮ Every rule generating G[w] contains and preserves ♯. ◮ {x ∈ Σ∗ : x G[w] y ∈ Sw} = {u♯v : uwv ∈ L(G), u, v ∈ IG} The DPDA Mw acts by reading u♯v up to ♯, putting the input on the stack. Then:

22

slide-84
SLIDE 84

Bonus: grammar to DPDA

Lemma

Without loss of generality, every rule generating Gw overlaps and preserves ¯ w. We can now create a reduction G[w] and a finite set Sw such that ◮ Every rule generating G[w] contains and preserves ♯. ◮ {x ∈ Σ∗ : x G[w] y ∈ Sw} = {u♯v : uwv ∈ L(G), u, v ∈ IG} The DPDA Mw acts by reading u♯v up to ♯, putting the input on the stack. Then: ◮ Pop from the stack or read from input into two buffers (encoded in state).

22

slide-85
SLIDE 85

Bonus: grammar to DPDA

Lemma

Without loss of generality, every rule generating Gw overlaps and preserves ¯ w. We can now create a reduction G[w] and a finite set Sw such that ◮ Every rule generating G[w] contains and preserves ♯. ◮ {x ∈ Σ∗ : x G[w] y ∈ Sw} = {u♯v : uwv ∈ L(G), u, v ∈ IG} The DPDA Mw acts by reading u♯v up to ♯, putting the input on the stack. Then: ◮ Pop from the stack or read from input into two buffers (encoded in state). ◮ Whenever possible, reduce according to the rules from G[w].

22

slide-86
SLIDE 86

Bonus: grammar to DPDA

Lemma

Without loss of generality, every rule generating Gw overlaps and preserves ¯ w. We can now create a reduction G[w] and a finite set Sw such that ◮ Every rule generating G[w] contains and preserves ♯. ◮ {x ∈ Σ∗ : x G[w] y ∈ Sw} = {u♯v : uwv ∈ L(G), u, v ∈ IG} The DPDA Mw acts by reading u♯v up to ♯, putting the input on the stack. Then: ◮ Pop from the stack or read from input into two buffers (encoded in state). ◮ Whenever possible, reduce according to the rules from G[w]. ◮ When the buffer resembles Sw and the input and stack are empty, accept.

22

slide-87
SLIDE 87

Bonus: grammar to DPDA

Lemma

Without loss of generality, every rule generating Gw overlaps and preserves ¯ w. We can now create a reduction G[w] and a finite set Sw such that ◮ Every rule generating G[w] contains and preserves ♯. ◮ {x ∈ Σ∗ : x G[w] y ∈ Sw} = {u♯v : uwv ∈ L(G), u, v ∈ IG} The DPDA Mw acts by reading u♯v up to ♯, putting the input on the stack. Then: ◮ Pop from the stack or read from input into two buffers (encoded in state). ◮ Whenever possible, reduce according to the rules from G[w]. ◮ When the buffer resembles Sw and the input and stack are empty, accept. With some analysis, we find that L(Mw) = {u♯v : uwv ∈ L(G), u, v ∈ IG}.

22

slide-88
SLIDE 88

Bonus: deciding Clark-congruentiality

Given a congruence ≡, we can extend it a congruence ˆ ≡ on (Σ ∪ V )∗, by stipulating ϑG(α) ≡ ϑG(β) α ˆ ≡ β

23

slide-89
SLIDE 89

Bonus: deciding Clark-congruentiality

Given a congruence ≡, we can extend it a congruence ˆ ≡ on (Σ ∪ V )∗, by stipulating ϑG(α) ≡ ϑG(β) α ˆ ≡ β

Lemma

Let ≡ be a congruence on Σ∗. The following are equivalent: (i) For all productions A → α, it holds that A ˆ ≡ α (ii) For all A ∈ V and w, x ∈ L(G, A), it holds that w ≡ x.

23

slide-90
SLIDE 90

Bonus: deciding Clark-congruentiality

Theorem

If ≡L(G) is decidable, then we can decide whether G is CC.

Proof.

For A → α, check whether A ˆ ≡L(G) α, i.e., whether ϑG(A) ≡L(G) ϑG(α).

24

slide-91
SLIDE 91

Bonus: deciding Clark-congruentiality

Theorem

If ≡L(G) is decidable, then we can decide whether G is CC.

Proof.

For A → α, check whether A ˆ ≡L(G) α, i.e., whether ϑG(A) ≡L(G) ϑG(α).

Corollary

If L(G) is a deterministic CFL, then it is decidable whether G is CC.

24