Learning Regular Sets Author: Dana Angluin Presented by: M. Andre - - PowerPoint PPT Presentation

learning regular sets
SMART_READER_LITE
LIVE PREVIEW

Learning Regular Sets Author: Dana Angluin Presented by: M. Andre - - PowerPoint PPT Presentation

Learning Regular Sets Author: Dana Angluin Presented by: M. Andre na Francisco Department of Computer Science Uppsala University February 3, 2014 Minimally Adequate Teachers A Minimally Adequate Teacher (MAT) is an Oracle that must


slide-1
SLIDE 1

Learning Regular Sets

Author: Dana Angluin Presented by: M. Andre´ ına Francisco

Department of Computer Science Uppsala University

February 3, 2014

slide-2
SLIDE 2

Minimally Adequate Teachers

A Minimally Adequate Teacher (MAT) is an Oracle that must answer correctly two types of questions:

Membership queries

the answer must be yes or no

Strong equivalence queries

the answer is yes or any counterexample

2 of 28

slide-3
SLIDE 3

Definitions

Prefix-closed

Every prefix of every member is also a member, that is uv ∈ S ⇒ u ∈ S i.e. the set {λ, a, ab}

Suffix-closed

Every suffix of every member is also a member, that is uv ∈ S ⇒ v ∈ S i.e. the set {λ, a, ba}

3 of 28

slide-4
SLIDE 4

Observation Table

An observation table is a triple STA, EXP, OT where:

STA = RED ∪ BLUE

RED ⊂ Σ∗ is a finite set of states BLUE = RED · Σ \ RED is the set of successor states of RED that

are not RED

EXP ⊂ Σ∗ is the experiment set. OT : STA × EXP → {0, 1, ∗} is a function such that:

OT[u][e] =    1 if ue ∈ L if ue / ∈ L ∗

  • therwise (not known)

4 of 28

slide-5
SLIDE 5

Observation Table

Examples

λ a λ 1 a 1 b 1 aa 1 ab 1 States Experiment set

5 of 28

slide-6
SLIDE 6

How to build an automaton from an OT

Q ← {qr : r ∈ RED} FA ← {qwe : we ∈ RED ∧ OT[w][e] = 1} FR ← {qwe : we ∈ RED ∧ OT[w][e] = 0 ∀qw ∈ Q ∧ ∀σ ∈ Σ | δ(qw, σ) ← qu : u ∈ RED ∧ OT[u] = OT[wσ] 6 of 28

slide-7
SLIDE 7

How to build an automaton from an OT

FA ← {qwe : we ∈ RED ∧ OT[w][e] = 1} ∀qw ∈ Q ∧ ∀σ ∈ Σ | δ(qw, σ) ← qu : u ∈ RED ∧ OT[u] = OT[wσ]

Examples

Observation Table λ a λ 1 a 1 b 1 aa 1 ab 1 Transition Table a b qλ qa qa qa qλ qa qλ start qa a,b a b

7 of 28

slide-8
SLIDE 8

Closed Table

A table is closed if for every row u ∈ BLUE there is a row v ∈ RED such that row(u) = row(v)

Examples

The following table is not closed because of row ’ab’ λ a λ 1 a 1 b 1 aa 1 ab 1 1

8 of 28

slide-9
SLIDE 9

How do we close a table?

Let s be the row of BLUE that is not in RED

Move s to RED ∀a ∈ Σ, add sa to BLUE

Examples

The following table is now closed but it is not complete. λ a λ 1 a 1 ab 1 1 b 1 aa 1 aba * * abb * *

9 of 28

slide-10
SLIDE 10

Consistent Table

A table is consistent if every pair of equivalent rows in RED remains equivalent after appending any symbol.

Examples

The following table is inconsistent λ a λ 1 a 1 ab 1 b 1 aa 1 aba abb 1

10 of 28

slide-11
SLIDE 11

Consistent Table

A table is consistent if every pair of equivalent rows in RED remains equivalent after appending any symbol.

Examples

The following table is inconsistent λ a λ 1 a 1 ab 1 b 1 aa 1 aba abb 1

10 of 28

slide-12
SLIDE 12

Consistent Table

A table is consistent if every pair of equivalent rows in RED remains equivalent after appending any symbol.

Examples

The following table is inconsistent λ a λ 1 a 1 ab 1 b 1 aa 1 aba abb 1

10 of 28

slide-13
SLIDE 13

How do we make a table consistent?

Let x ∈ Σ be the differentiating string such that OT[s1] = OT[s2]

but OT[s1x] = OT[s2x].

Let e be the experiment for which OT[s1x][e] = OT[s2x][e]. Adding the experiment ’xe’ will differentiate OT[s1] and OT[s2].

Examples

λ a aa λ 1 a 1 * ab 1 * b 1 * aa 1 * aba * abb 1 *

11 of 28

slide-14
SLIDE 14

The Learner L∗

  • 1. Initialize RED = EXP = {λ}
  • 2. Initialize BLUE = RED · Σ
  • 3. Complete the table
  • 4. while Teacher says NO

4.1 while table is not closed or not consistent

4.1.1 if not consistent → make it consistent (and complete) 4.1.2 if not closed → close it (and complete it)

4.2 Make a guess! 4.3 If the teacher says no, then

4.3.1 add the counterexample and all its prefixes to RED 4.3.2 update BLUE = RED · Σ 4.3.3 complete the table

12 of 28

slide-15
SLIDE 15

An Example Run of L∗

Suppose the unknown regular set is the set of all strings over {a, b} with an even number of a’s and an even number of b’s Initial table λ λ 1 a b

13 of 28

slide-16
SLIDE 16

An Example Run of L∗

Suppose the unknown regular set is the set of all strings over {a, b} with an even number of a’s and an even number of b’s Initial table λ λ 1 a b This table is not closed

13 of 28

slide-17
SLIDE 17

An Example Run of L∗

We close the table λ λ 1 a b aa * ab *

14 of 28

slide-18
SLIDE 18

An Example Run of L∗

We complete the table λ λ 1 a b aa 1 ab

15 of 28

slide-19
SLIDE 19

An Example Run of L∗

We complete the table λ λ 1 a b aa 1 ab This table is closed, consistent and complete, so we can make a guess

15 of 28

slide-20
SLIDE 20

An Example Run of L∗

The guess is... qλ start qa a,b a b (note that it is the same automaton as in the construction example, but the observation tables are different)

16 of 28

slide-21
SLIDE 21

An Example Run of L∗

Assume we get the counter example ’bb’.

  • 1. add the counterexample and all its prefixes to RED
  • 2. update BLUE = RED · Σ

λ λ 1 a b bb * aa 1 ab ba * bba * bbb *

17 of 28

slide-22
SLIDE 22

An Example Run of L∗

Assume we get the counter example ’bb’.

  • 1. add the counterexample and all its prefixes to RED
  • 2. update BLUE = RED · Σ

λ λ 1 a b bb 1 aa 1 ab ba bba bbb

18 of 28

slide-23
SLIDE 23

An Example Run of L∗

Assume we get the counter example ’bb’.

  • 1. add the counterexample and all its prefixes to RED
  • 2. update BLUE = RED · Σ

λ λ 1 a b bb 1 aa 1 ab ba bba bbb

18 of 28

slide-24
SLIDE 24

An Example Run of L∗

Add the experiment ’a’ λ a λ 1 a 1 b bb 1 aa 1 * ab * ba * bba * bbb *

19 of 28

slide-25
SLIDE 25

An Example Run of L∗

Add the experiment ’a’ λ a λ 1 a 1 b bb 1 aa 1 ab ba bba 1 bbb

20 of 28

slide-26
SLIDE 26

An Example Run of L∗

make a guess... q0 start q1 q2 a b b a a b

21 of 28

slide-27
SLIDE 27

An Example Run of L∗

Suppose we get the counterexample ’abb’ λ a λ 1 a 1 b bb 1 ab abb * * aa 1 ba bba 1 bbb aba * * abba * * abbb * *

22 of 28

slide-28
SLIDE 28

An Example Run of L∗

Suppose we get the counterexample ’abb’ λ a λ 1 a 1 b bb 1 ab abb 1 aa 1 ba bba 1 bbb aba abba 1 abbb

23 of 28

slide-29
SLIDE 29

An Example Run of L∗

The table is not consistent λ a λ 1 a 1 b bb 1 ab abb 1 aa 1 ba bba 1 bbb aba abba 1 abbb

24 of 28

slide-30
SLIDE 30

An Example Run of L∗

The table is not consistent λ a b λ 1 a 1 b 1 bb 1 ab abb 1 aa 1 * ba * bba 1 * bbb * aba * abba 1 * abbb *

25 of 28

slide-31
SLIDE 31

An Example Run of L∗

We complete the table λ a b λ 1 a 1 b 1 bb 1 ab abb 1 aa 1 ba bba 1 bbb 1 aba 1 abba 1 abbb

26 of 28

slide-32
SLIDE 32

An Example Run of L∗

We make a guess... and the Teacher says YES! :-) δ a b q0 q1 q2 q1 q0 q3 q2 q3 q0 q3 q2 q1 q0 start q1 q3 q2 a b b a a b a b

27 of 28

slide-33
SLIDE 33

Questions?

28 of 28