Formal Languages aa bb baab ba ab Formally Coinductively - - PowerPoint PPT Presentation

formal languages
SMART_READER_LITE
LIVE PREVIEW

Formal Languages aa bb baab ba ab Formally Coinductively - - PowerPoint PPT Presentation

Formal Languages aa bb baab ba ab Formally Coinductively and a b a b a b a b a b a b a b . . . . . . . . . . . . Dmitriy Traytel Contribution Isabelle H O L = library of formal languages in


slide-1
SLIDE 1

Formal Languages

ε

aa ba ab bb baab

···

and

Formally Coinductively

. . . . . . . . . . . . a b a b a b a b a b a b a b

Dmitriy Traytel

slide-2
SLIDE 2

Contribution library of formal languages in

λ → ∀

=

Isabelle

β α

H O L

slide-3
SLIDE 3

Contribution

define regular operations ∅, ε, Atom, +, ·, ∗ prove axioms of Kleene Algebra

library of formal languages in

λ → ∀

=

Isabelle

β α

H O L

slide-4
SLIDE 4

Contribution

define regular operations ∅, ε, Atom, +, ·, ∗ prove axioms of Kleene Algebra

Coinductive library of formal languages in

λ → ∀

=

Isabelle

β α

H O L

slide-5
SLIDE 5

Contribution

define regular operations ∅, ε, Atom, +, ·, ∗ prove axioms of Kleene Algebra

Coinductive library of formal languages in

λ → ∀

=

Isabelle

β α

H O L

Tutorial for corecursion and coinduction

slide-6
SLIDE 6

Contribution

define regular operations ∅, ε, Atom, +, ·, ∗ prove axioms of Kleene Algebra

Coinductive library of formal languages in

λ → ∀

=

Isabelle

β α

H O L

Formal Structure

Tutorial for corecursion and coinduction

Computation Deduction

slide-7
SLIDE 7

Contribution

define regular operations ∅, ε, Atom, +, ·, ∗ prove axioms of Kleene Algebra

Coinductive library of formal languages in

λ → ∀

=

Isabelle

β α

H O L

Formal Structure

Tutorial for corecursion and coinduction

Computation Deduction This talk: Tutorial in 20 min

slide-8
SLIDE 8

Related Work: A Selection of CoTutorials

C

  • d

a t a t y p e C

  • r

e c u r s i

  • n

C

  • i

n d u c t i

  • n

P r

  • f

A s s i s t a n t Jacobs, Rutten EATCS’97 stream Rutten CONCUR’98 language Giménez, Castéran ’98 stream, lazy list Rutten MSCS’05 stream Hinze JFP’11 stream Chlipala ’13 stream, while Rot, Rutten, Bonsangue

LATA’13

language Kozen, Silva MSCS’14 stream Setzer Festschrift Jäger’16 stream Traytel FSCD’16 language

λ → ∀ =

I s a b e l l e

β α H O L
slide-9
SLIDE 9

Codatatype Corecursion Coinduction

slide-10
SLIDE 10

Codatatype Corecursion Coinduction

slide-11
SLIDE 11

. . . . . . . . . . . . a b a b a b a b a b a b a b

slide-12
SLIDE 12

codatatype

lang = L bool lang lang . . . . . . . . . . . . a b a b a b a b a b a b a b

slide-13
SLIDE 13

codatatype αlang = L bool (α ⇒ αlang)

. . . . . . . . . . . . a b a b a b a b a b a b a b

slide-14
SLIDE 14

codatatype αlang = L bool (α ⇒ αlang)

. . . . . . . . . . . . a b a b a b a b a b a b a b

slide-15
SLIDE 15

codatatype αlang = L bool (α ⇒ αlang)

. . . . . . . . . . . . a b a b a b a b a b a b a b

slide-16
SLIDE 16

codatatype αlang = L bool (α ⇒ αlang)

  • :: αlang ⇒ bool

δ :: αlang ⇒ α ⇒ αlang

. . . . . . . . . . . . a b a b a b a b a b a b a b

slide-17
SLIDE 17

primrec ∈

∈ :: αlist ⇒ αlang ⇒ bool [] ∈ ∈ L = o L

aw ∈

∈ L = w ∈ ∈ δ L a

. . . . . . . . . . . . a b a b a b a b a b a b a b

slide-18
SLIDE 18

primrec ∈

∈ :: αlist ⇒ αlang ⇒ bool [] ∈ ∈ L = o L

aw ∈

∈ L = w ∈ ∈ δ L a

aa ∈

. . . . . . . . . . . . a b a b a b a b a b a b a b

slide-19
SLIDE 19

primrec ∈

∈ :: αlist ⇒ αlang ⇒ bool [] ∈ ∈ L = o L

aw ∈

∈ L = w ∈ ∈ δ L a

a ∈

. . . . . . . . . . . . a b a b a b a b a b a b a b

slide-20
SLIDE 20

primrec ∈

∈ :: αlist ⇒ αlang ⇒ bool [] ∈ ∈ L = o L

aw ∈

∈ L = w ∈ ∈ δ L a

. . .

[] ∈ ∈

. . . . . . . . . a b a b a b a b a b a b a b

slide-21
SLIDE 21

primrec ∈

∈ :: αlist ⇒ αlang ⇒ bool [] ∈ ∈ L = o L

aw ∈

∈ L = w ∈ ∈ δ L a

. . . . . . . . . . . . a b a b a b a b a b a b a b

slide-22
SLIDE 22

Codatatype Corecursion Coinduction

slide-23
SLIDE 23

primcorec ∅ :: αlang

  • ∅ =

δ ∅ = λ_. ∅

slide-24
SLIDE 24

primcorec ∅ :: αlang

  • ∅ =

δ ∅ = λ_. ∅

. . . . . . a b a b a b

slide-25
SLIDE 25

primcorec ∅ :: αlang

  • ∅ =

δ ∅ = λ_. ∅

. . . . . . a b a b a b

primcorec ε :: αlang

  • ε =

δ ε = λ_. ∅

. . . . . . a b a b a b

slide-26
SLIDE 26

primcorec ∅ :: αlang

  • ∅ =

δ ∅ = λ_. ∅

. . . . . . a b a b a b

primcorec ε :: αlang

  • ε =

δ ε = λ_. ∅

. . . . . . a b a b a b

primcorec Atom :: α ⇒ αlang

  • (Atom a) =

δ (Atom a) = λb. if a = b then ε else ∅

slide-27
SLIDE 27

primcorec ∅ :: αlang

  • ∅ =

δ ∅ = λ_. ∅

. . . . . . a b a b a b

primcorec ε :: αlang

  • ε =

δ ε = λ_. ∅

. . . . . . a b a b a b

primcorec Atom :: α ⇒ αlang

  • (Atom a) =

δ (Atom a) = λb. if a = b then ε else ∅

. . . . . . a b a b a b . . . . . . a b a b a b

slide-28
SLIDE 28

primrec primcorec

Syntactic criterion for termination productivity

  • f functions of type

αlist ⇒ ··· ··· ⇒ αlang

slide-29
SLIDE 29

primrec primcorec

Syntactic criterion for termination productivity

  • f functions of type

αlist ⇒ ··· ··· ⇒ αlang

Philosophy consume 1

pattern match argument

slide-30
SLIDE 30

primrec primcorec

Syntactic criterion for termination productivity

  • f functions of type

αlist ⇒ ··· ··· ⇒ αlang

Philosophy consume 1 produce 1

pattern match argument copattern match output

slide-31
SLIDE 31

primrec primcorec

Syntactic criterion for termination productivity

  • f functions of type

αlist ⇒ ··· ··· ⇒ αlang

Philosophy consume 1 produce 1

pattern match argument copattern match output

(Co)recursive call arguments very restricted context arbitrary

slide-32
SLIDE 32

primrec primcorec

Syntactic criterion for termination productivity

  • f functions of type

αlist ⇒ ··· ··· ⇒ αlang

Philosophy consume 1 produce 1

pattern match argument copattern match output

(Co)recursive call arguments very restricted arbitrary context arbitrary very restricted

slide-33
SLIDE 33

primrec primcorec

Syntactic criterion for termination productivity

  • f functions of type

αlist ⇒ ··· ··· ⇒ αlang

Philosophy consume 1 produce 1

pattern match argument copattern match output

(Co)recursive call arguments very restricted arbitrary context arbitrary very restricted

. . . . . . a b a b a b . . . . . . a b a b a b

Atom a Atom b

slide-34
SLIDE 34

primrec primcorec

Syntactic criterion for termination productivity

  • f functions of type

αlist ⇒ ··· ··· ⇒ αlang

Philosophy consume 1 produce 1

pattern match argument copattern match output

(Co)recursive call arguments very restricted arbitrary context arbitrary very restricted

. . . . . . a b a b a b

+

. . . . . . a b a b a b

Atom a Atom b

=

. . . . . . a b a b a b

slide-35
SLIDE 35

primrec primcorec

Syntactic criterion for termination productivity

  • f functions of type

αlist ⇒ ··· ··· ⇒ αlang

Philosophy consume 1 produce 1

pattern match argument copattern match output

(Co)recursive call arguments very restricted arbitrary context arbitrary very restricted

. . . . . . a b a b a b

+

. . . . . . a b a b a b

Atom a Atom b

=

. . . . . . a b a b a b

primcorec + :: αlang ⇒ αlang ⇒ αlang

  • (L + K) = o L∨ o K

δ (L + K) = λa. δ L a + δ K a

slide-36
SLIDE 36
  • (L + K) = o L∨ o K

δ (L + K) = λa. δ L a + δ K a

  • (Atom a) =

δ (Atom a) = λb. if a = b then ε else ∅

  • ε =

δ ε = λ_. ∅

  • ∅ =

δ ∅ = λ_. ∅

slide-37
SLIDE 37

nullability

                

=

  • ε

=

  • (Atom a) =
  • (L + K)

= o L∨ o K

L, K :: αlang L + ∅ = L Brzozowski derivative

               δ ∅ = λ_. ∅ δ ε = λ_. ∅ δ (Atom a) = λb. if a = b then ε else ∅ δ (L + K) = λa. δ L a + δ K a

slide-38
SLIDE 38

=

  • ε

=

  • (Atom a) =
  • (L + K)

=

  • L∨ o K

L, K :: α regex L + ∅ = L d ∅

= λ_. ∅

d ε

= λ_. ∅

d (Atom a) = λb. if a = b then ε else ∅ d (L + K)

= λa. d L a + d K a

slide-39
SLIDE 39

=

  • ε

=

  • (Atom a) =
  • (L + K)

=

  • L∨ o K
  • (L · K)

=

  • L∧ o K
  • (L∗)

=

L, K :: α regex L + ∅ = L d ∅

= λ_. ∅

d ε

= λ_. ∅

d (Atom a) = λb. if a = b then ε else ∅ d (L + K)

= λa. d L a + d K a

d (L · K)

= ...

d (L∗)

= ...

slide-40
SLIDE 40

nullability

                

=

  • ε

=

  • (Atom a) =
  • (L + K)

=

  • L∨ o K
  • (L · K)

=

  • L∧ o K
  • (L∗)

=

L, K :: α regex L + ∅ = L Brzozowski derivative

              

d ∅

= λ_. ∅

d ε

= λ_. ∅

d (Atom a) = λb. if a = b then ε else ∅ d (L + K)

= λa. d L a + d K a

d (L · K)

= ...

d (L∗)

= ...

slide-41
SLIDE 41
  • (L · K)

=

  • L∧ o K

L, K :: α regex L + ∅ = L d (L · K)

= ...

slide-42
SLIDE 42

primcorec · :: αlang ⇒ αlang ⇒ αlang

  • (L · K) = o L∧ o K

δ (L · K) = λa. if o L

then δ L a · K + δ K a else δ L a · K

slide-43
SLIDE 43

primcorec

✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿ · :: αlang ⇒ αlang ⇒ αlang

  • (L · K) = o L∧ o K

δ (L · K) = λa. if o L

then δ L a · K + δ K a else δ L a · K

Nonprimitively corecursive specification

slide-44
SLIDE 44

primcorec

✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿ · :: αlang ⇒ αlang ⇒ αlang

  • (L · K) = o L∧ o K

δ (L · K) = λa. if o L

then δ L a · K + δ K a else δ L a · K

Nonprimitively corecursive specification

This paper L · K = ˆ

⊕ (Lˆ · K)

with ˆ

· and ˆ ⊕ primitively

corecursive

slide-45
SLIDE 45

corec · :: αlang ⇒ αlang ⇒ αlang

  • (L · K) = o L∧ o K

δ (L · K) = λa. if o L

then δ L a · K + δ K a else δ L a · K

This paper L · K = ˆ

⊕ (Lˆ · K)

with ˆ

· and ˆ ⊕ primitively

corecursive

Blanchette, Popescu, Traytel @ ICFP’15 +

corec

Blanchette, Bouzy, Lochbihler, Popescu, Traytel

slide-46
SLIDE 46

Codatatype Corecursion Coinduction

slide-47
SLIDE 47

How to prove?

theorem

∅ + L = L

slide-48
SLIDE 48

by (coinduction arbitrary : L) auto theorem

∅ + L = L

slide-49
SLIDE 49

proof (rule coinductlang) define R K1 K2 = (∃L. K1 = ∅ + L ∧ K2 = L) show R (∅ + L) L by simp fix L1 and L2 assume R L1 L2 then obtain L where L1 = ∅ + L and L2 = L by simp then show o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x) by simp qed

theorem

∅ + L = L

slide-50
SLIDE 50

proof (rule coinductlang) define R K1 K2 = (∃L. K1 = ∅ + L ∧ K2 = L) show R (∅ + L) L by simp fix L1 and L2 assume R L1 L2 then obtain L where L1 = ∅ + L and L2 = L by simp then show o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x) by simp qed

R K1 K2

∀L1 L2. R L1 L2 − → (o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x))

K1 = K2

theorem

∅ + L = L

slide-51
SLIDE 51

proof (rule coinductlang) define R K1 K2 = (∃L. K1 = ∅ + L ∧ K2 = L) show R (∅ + L) L by simp fix L1 and L2 assume R L1 L2 then obtain L where L1 = ∅ + L and L2 = L by simp then show o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x) by simp qed

R K1 K2

∀L1 L2. R L1 L2 − → (o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x))

K1 = K2

theorem

∅ + L = L

slide-52
SLIDE 52

proof (rule coinductlang) define R K1 K2 = (∃L. K1 = ∅ + L ∧ K2 = L) show R (∅ + L) L by simp fix L1 and L2 assume R L1 L2 then obtain L where L1 = ∅ + L and L2 = L by simp then show o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x) by simp qed

R K1 K2

∀L1 L2. R L1 L2 − → (o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x))

K1 = K2

theorem

∅ + L = L

slide-53
SLIDE 53

proof (rule coinductlang) define R K1 K2 = (∃L. K1 = ∅ + L ∧ K2 = L) show R (∅ + L) L by simp fix L1 and L2 assume R L1 L2 then obtain L where L1 = ∅ + L and L2 = L by simp then show o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x) by simp qed

R K1 K2

∀L1 L2. R L1 L2 − → (o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x))

K1 = K2

theorem

∅ + L = L

slide-54
SLIDE 54

proof (rule coinductlang) define R K1 K2 = (∃L. K1 = ∅ + L ∧ K2 = L) show R (∅ + L) L by simp fix L1 and L2 assume R L1 L2 then obtain L where L1 = ∅ + L and L2 = L by simp then show o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x) by simp qed

R K1 K2

∀L1 L2. R L1 L2 − → (o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x))

K1 = K2

theorem

∅ + L = L

  • L1 = o (∅ + L) = (o ∅ ∨ o L) = (

∨ o L) = o L = o L2

R (δ L1 x) (δ L2 x) = R (δ (∅ + L) x) (δ L x)

= R (δ ∅ x + δ L x) (δ L x) = R (∅ + δ L x) (δ L x) = (∃L′. ∅ + δ L x = ∅ + L′ ∧ δ L x = L′) =

slide-55
SLIDE 55

proof (rule coinductlang) define R K1 K2 = (∃L. K1 = ∅ + L ∧ K2 = L) show R (∅ + L) L by simp fix L1 and L2 assume R L1 L2 then obtain L where L1 = ∅ + L and L2 = L by simp then show o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x) by simp qed

theorem

∅ + L = L

slide-56
SLIDE 56

by (coinduction arbitrary : L) auto theorem

∅ + L = L

slide-57
SLIDE 57

proof (rule coinductlang) define R K1 K2 = (∃L. K1 = ∅ + L ∧ K2 = L) show R (∅ + L) L by simp fix L1 and L2 assume R L1 L2 then obtain L where L1 = ∅ + L and L2 = L by simp then show o L1 = o L2 ∧ ∀x. R (δ L1 x) (δ L2 x) by simp qed

theorem

∅ + L = L

slide-58
SLIDE 58

by (coinduction arbitrary : L) auto theorem

L + L = L

by (coinduction arbitrary : L) auto theorem

L1 + L2 = L2 + L1

by (coinduction arbitrary : L1 L2) auto theorem

(L1 + L2) + L3 = L1 + (L2 + L3)

by (coinduction arbitrary : L1 L2 L3) auto theorem

∅ + L = L

slide-59
SLIDE 59

theorem

(L + K) · M = (L · M) + (K · M)

by (coinduction arbitrary : K L) auto

slide-60
SLIDE 60

theorem

(L + K) · M = (L · M) + (K · M)

by (coinduction arbitrary : K L) auto

✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿

··· − → R = λL1 L2. ∃L K. L1 = (L + K) · M ∧

L2 = (L · M) + (K · M) −

R ((δ L′ x + δ K ′ x) · M

+ δ M x) ((δ L′ x · M + δ K ′ x · M) + δ M x)

slide-61
SLIDE 61

theorem

(L + K) · M = (L · M) + (K · M)

by (coinduction arbitrary : L K rule: coinduct+

lang) auto

slide-62
SLIDE 62

theorem

(L + K) · M = (L · M) + (K · M)

by (coinduction arbitrary : L K rule: coinduct+

lang) auto

R K1 K2

∀L1 L2. R L1 L2 − → (o L1 = o L2 ∧ ∀x. R

+(δ L1 x) (δ L2 x))

K1 = K2

slide-63
SLIDE 63

Languages, Languages, Languages

codatatype αlang = L bool (α ⇒ αlang)

slide-64
SLIDE 64

Languages, Languages, Languages

codatatype αlang = L bool (α ⇒ αlang) codatatype (α, β)langMoore = LMoore β (α ⇒ (α, β)langMoore) codatatype (α, β)langMealy = LMealy (α ⇒ β) (α ⇒ (α, β)langMealy)

slide-65
SLIDE 65

Languages, Languages, Languages

codatatype αlang = L bool (α ⇒ αlang) codatatype (α, β)langMoore = LMoore β (α ⇒ (α, β)langMoore) codatatype (α, β)langMealy = LMealy (α ⇒ β) (α ⇒ (α, β)langMealy) codatatype αlangNondet = LNondet bool (α ⇒ αlangNondet setκ)

slide-66
SLIDE 66

Languages, Languages, Languages

codatatype αlang = L bool (α ⇒ αlang) codatatype (α, β)langMoore = LMoore β (α ⇒ (α, β)langMoore) codatatype (α, β)langMealy = LMealy (α ⇒ β) (α ⇒ (α, β)langMealy) codatatype αlangNondet = LNondet bool (α ⇒ αlangNondet setκ) codatatype αlangω = Lω (αlang) (α ⇒ αlangω)

slide-67
SLIDE 67

Languages, Languages, Languages

codatatype αlang = L bool (α ⇒ αlang) codatatype (α, β)langMoore = LMoore β (α ⇒ (α, β)langMoore) codatatype (α, β)langMealy = LMealy (α ⇒ β) (α ⇒ (α, β)langMealy) codatatype αlangNondet = LNondet bool (α ⇒ αlangNondet setκ) codatatype αlangω = Lω (αlang) (α ⇒ αlangω)

Hölzl, Lochbihler, Traytel, ITP 2015

        

codatatype αlangMarkov = LMarkov (α×αlangMarkov) pmf codatatype αlangReact = LReact (α ⇒ αlangReact pmf option) codatatype αlangSegala = LSegala (α×αlangSegala) pmf setκ

slide-68
SLIDE 68

Formal Languages

ε

aa ba ab bb baab

···

and

Formally Coinductively

. . . . . . . . . . . . a b a b a b a b a b a b a b

Dmitriy Traytel

OBRIGADO! QUESTÕES?

slide-69
SLIDE 69

Puzzle for the RTA Community

slide-70
SLIDE 70

Brzozowski Derivatives

d a ∅

= ∅

d a ε

= ∅

d a (Atom b)

=

if a = b then ε else ∅

d a (r + s)

=

d a r + d a s d a (r · s)

=

if o r then d a r · s + d a s else d a r · s

d a (r∗)

=

d a r · r∗

slide-71
SLIDE 71

Brzozowski Derivatives

Finiteness

d a ∅

= ∅

d a ε

= ∅

d a (Atom b)

=

if a = b then ε else ∅ d a (r + s)

=

d a r + d a s d a (r · s)

=

if o r then d a r · s + d a s else d a r · s d a (r∗)

=

d a r · r∗

slide-72
SLIDE 72

Brzozowski Derivatives

Finiteness

d a ∅

= ∅

d a ε

= ∅

d a (Atom b)

=

if a = b then ε else ∅ d a (r + s)

=

d a r + d a s d a (r · s)

=

if o r then d a r · s + d a s else d a r · s d a (r∗)

=

d a r · r∗

ˆ

d [] r

=

r

ˆ

d aw r

= ˆ

d w (d a r)

slide-73
SLIDE 73

Brzozowski Derivatives

Finiteness

d a ∅

= ∅

d a ε

= ∅

d a (Atom b)

=

if a = b then ε else ∅ d a (r + s)

=

d a r + d a s d a (r · s)

=

if o r then d a r · s + d a s else d a r · s d a (r∗)

=

d a r · r∗

ˆ

d [] r

=

r

ˆ

d aw r

= ˆ

d w (d a r) Theorem [Brzozowski’64]

{[ˆ

d w r]ACI | w ∈ Σ∗} is finite for all r

slide-74
SLIDE 74

Brzozowski Derivatives

Finiteness

d a ∅

= ∅

d a ε

= ∅

d a (Atom b)

=

if a = b then ε else ∅ d a (r + s)

=

d a r + d a s d a (r · s)

=

if o r then d a r · s + d a s else d a r · s d a (r∗)

=

d a r · r∗

ˆ

d [] r

=

r

ˆ

d aw r

= ˆ

d w (d a r) Theorem [Brzozowski’64]

{[ˆ

d w r]ACI | w ∈ Σ∗} is finite for all r Corollary

{[ˆ

d w r]ACIUD | w ∈ Σ∗} is finite for all r

slide-75
SLIDE 75

Brzozowski Derivatives

Finiteness

d a ∅

= ∅

d a ε

= ∅

d a (Atom b)

=

if a = b then ε else ∅ d a (r + s)

=

d a r + d a s d a (r · s)

=

if o r then d a r · s + d a s else d a r · s d a (r∗)

=

d a r · r∗

ˆ

d [] r

=

r

ˆ

d aw r

= ˆ

d w (d a r)

ˆ

dACI [] r

= |r|ACI ˆ

dACI aw r

= ˆ

dACI w |d a r|ACI Theorem [Brzozowski’64]

{[ˆ

d w r]ACI | w ∈ Σ∗} is finite for all r Corollary

{[ˆ

d w r]ACIUD | w ∈ Σ∗} is finite for all r

slide-76
SLIDE 76

Brzozowski Derivatives

Finiteness

d a ∅

= ∅

d a ε

= ∅

d a (Atom b)

=

if a = b then ε else ∅ d a (r + s)

=

d a r + d a s d a (r · s)

=

if o r then d a r · s + d a s else d a r · s d a (r∗)

=

d a r · r∗

ˆ

d [] r

=

r

ˆ

d aw r

= ˆ

d w (d a r)

ˆ

dACI [] r

= |r|ACI ˆ

dACI aw r

= ˆ

dACI w |d a r|ACI Theorem [Brzozowski’64]

{[ˆ

d w r]ACI | w ∈ Σ∗} is finite for all r Corollary

{[ˆ

d w r]ACIUD | w ∈ Σ∗} is finite for all r Lemma

|d a |r|ACI|ACI = |d a r|ACI

Corollary

dACI w r | w ∈ Σ∗} is finite for all r

slide-77
SLIDE 77

Brzozowski Derivatives

Finiteness

d a ∅

= ∅

d a ε

= ∅

d a (Atom b)

=

if a = b then ε else ∅ d a (r + s)

=

d a r + d a s d a (r · s)

=

if o r then d a r · s + d a s else d a r · s d a (r∗)

=

d a r · r∗

ˆ

d [] r

=

r

ˆ

d aw r

= ˆ

d w (d a r)

ˆ

dACI [] r

= |r|ACI ˆ

dACI aw r

= ˆ

dACI w |d a r|ACI Theorem [Brzozowski’64]

{[ˆ

d w r]ACI | w ∈ Σ∗} is finite for all r Corollary

{[ˆ

d w r]ACIUD | w ∈ Σ∗} is finite for all r Lemma

|d a |r|ACI|ACI = |d a r|ACI

Corollary

dACI w r | w ∈ Σ∗} is finite for all r Conjecture

dACIUD w r | w ∈ Σ∗} is finite for all r

slide-78
SLIDE 78

Brzozowski Derivatives

Finiteness as a Rewriting Problem

Input Convergent ordered regex rewriting system R with ACI ⊆ R Question Under which conditions is {ˆ dR w r | w ∈ Σ∗} finite for all r?

slide-79
SLIDE 79

Brzozowski Derivatives

Finiteness as a Rewriting Problem

Input Convergent ordered regex rewriting system R with ACI ⊆ R Question Under which conditions is {ˆ dR w r | w ∈ Σ∗} finite for all r?

Negative Example R = ACI ∪ {ε · r∗ → r∗ · r∗}

slide-80
SLIDE 80

Brzozowski Derivatives

Finiteness as a Rewriting Problem

Input Convergent ordered regex rewriting system R with ACI ⊆ R Question Under which conditions is {ˆ dR w r | w ∈ Σ∗} finite for all r?

Negative Example R = ACI ∪ {ε · r∗ → r∗ · r∗}

a∗

d

→ ε · a∗

slide-81
SLIDE 81

Brzozowski Derivatives

Finiteness as a Rewriting Problem

Input Convergent ordered regex rewriting system R with ACI ⊆ R Question Under which conditions is {ˆ dR w r | w ∈ Σ∗} finite for all r?

Negative Example R = ACI ∪ {ε · r∗ → r∗ · r∗}

a∗

d

→ ε · a∗

R!

a∗ · a∗

slide-82
SLIDE 82

Brzozowski Derivatives

Finiteness as a Rewriting Problem

Input Convergent ordered regex rewriting system R with ACI ⊆ R Question Under which conditions is {ˆ dR w r | w ∈ Σ∗} finite for all r?

Negative Example R = ACI ∪ {ε · r∗ → r∗ · r∗}

a∗

d

→ ε · a∗

R!

a∗ · a∗

d

→ (ε · a∗) · a∗ + ε · a∗

slide-83
SLIDE 83

Brzozowski Derivatives

Finiteness as a Rewriting Problem

Input Convergent ordered regex rewriting system R with ACI ⊆ R Question Under which conditions is {ˆ dR w r | w ∈ Σ∗} finite for all r?

Negative Example R = ACI ∪ {ε · r∗ → r∗ · r∗}

a∗

d

→ ε · a∗

R!

a∗ · a∗

d

→ (ε · a∗) · a∗ + ε · a∗

R!

→ (a∗ · a∗) · a∗ + a∗ · a∗

slide-84
SLIDE 84

Brzozowski Derivatives

Finiteness as a Rewriting Problem

Input Convergent ordered regex rewriting system R with ACI ⊆ R Question Under which conditions is {ˆ dR w r | w ∈ Σ∗} finite for all r?

Negative Example R = ACI ∪ {ε · r∗ → r∗ · r∗}

a∗

d

→ ε · a∗

R!

a∗ · a∗

d

→ (ε · a∗) · a∗ + ε · a∗

R!

→ (a∗ · a∗) · a∗ + a∗ · a∗

d

→ ...