Kleene Algebra with Converse Talk at RAMICS 14 Paul Brunet & - - PowerPoint PPT Presentation

kleene algebra with converse
SMART_READER_LITE
LIVE PREVIEW

Kleene Algebra with Converse Talk at RAMICS 14 Paul Brunet & - - PowerPoint PPT Presentation

Kleene Algebra with Converse Talk at RAMICS 14 Paul Brunet & Damien Pous LIP, CNRS, ENS de Lyon, INRIA, Universit de Lyon, UMR 5668 April 28 th , 2014 April 28 th , 2014 Paul Brunet (ENS de Lyon, Universit de Lyon) Kleene Algebra


slide-1
SLIDE 1

Kleene Algebra with Converse

Talk at RAMICS ’14 Paul Brunet & Damien Pous

LIP, CNRS, ENS de Lyon, INRIA, Université de Lyon, UMR 5668 April 28th, 2014

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 1 / 27

slide-2
SLIDE 2

Introduction

Introduction

(x⋆ + y) · z ≡Rel (x⋆ · z) + (y · z) ∀S, ∀σ : RegX → Rel (S) σ ((x⋆ + y) · z) σ ((x⋆ · z) + (y · z))

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 2 / 27

slide-3
SLIDE 3

Introduction

Introduction

(x⋆ + y) · z ≡Rel (x⋆ · z) + (y · z) ∀S, ∀σ : RegX → Rel (S) σ ((x⋆ + y) · z) = σ ((x⋆ · z) + (y · z))

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 2 / 27

slide-4
SLIDE 4

Introduction

Introduction

(x⋆ + y) · z ≡Rel (x⋆ · z) + (y · z) ∀S, ∀σ : RegX → Rel (S) σ ((x⋆ + y) · z) = σ ((x⋆ · z) + (y · z))

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 2 / 27

slide-5
SLIDE 5

Introduction

Introduction

e, f ∈ RegX KA ⊢ e = f e ≡Rel f e = f e, f ∈ RegX

KAC ⊢ e = f e ≡Rel∨ f cl (e) = cl (f )

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 3 / 27

slide-6
SLIDE 6

Introduction

Introduction

e, f ∈ RegX KA ⊢ e = f e ≡Rel f e = f What if we add a converse operation to regular expressions ? e, f ∈ RegX

KAC ⊢ e = f e ≡Rel∨ f cl (e) = cl (f )

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 3 / 27

slide-7
SLIDE 7

Introduction

Introduction

e, f ∈ RegX KA ⊢ e = f e ≡Rel f e = f e, f ∈ RegX

KAC ⊢ e = f e ≡Rel∨ f cl (e) = cl (f)

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 3 / 27

slide-8
SLIDE 8

Introduction

Introduction

e, f ∈ RegX

KAC ⊢ e = f e ≡Rel∨ f cl (e) = cl (f)

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 3 / 27

slide-9
SLIDE 9

Introduction

Plan

1

Introduction

2

From Kleene Algebra with Converse to regular languages Kleene Algebra with converse Reduction to an automaton problem

3

Closure of an automaton

4

The PSpace algorithm.

5

Conclusion

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 4 / 27

slide-10
SLIDE 10

KAC

Plan

1

Introduction

2

From Kleene Algebra with Converse to regular languages Kleene Algebra with converse Reduction to an automaton problem

3

Closure of an automaton

4

The PSpace algorithm.

5

Conclusion

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 5 / 27

slide-11
SLIDE 11

KAC Kleene Algebra with converse

Regular expressions with converse

Regular expressions with converse over X

e, f ∈ RegX

∨ 0 | 1 | x ∈ X | e + f | e · f | e⋆ | e∨

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 6 / 27

slide-12
SLIDE 12

KAC Kleene Algebra with converse

Regular expressions with converse

Regular expressions with converse over X

e, f ∈ RegX

∨ 0 | 1 | x ∈ X | e + f | e · f | e⋆ | e∨

Given any map : σ : X −→ Rel (S) , we can build uniquely a morphism ˆ σ : RegX

∨ −→ Rel (S) .

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 6 / 27

slide-13
SLIDE 13

KAC Kleene Algebra with converse

Relational equivalence

For e, f ∈ RegX

∨ :

e ≡Rel∨ f means that ∀S, ∀σ : X → Rel (S) , ˆ σ(e) = ˆ σ(f ).

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 7 / 27

slide-14
SLIDE 14

KAC Kleene Algebra with converse

The equational theory KAC

The equational theory KAC of regular algebras with converse over binary relations consists of the axioms of KA together with the following : (a + b)∨ = a∨ + b∨ (1) (a · b)∨ = b∨ · a∨ (2) (a⋆)∨ = (a∨)⋆ (3) a∨∨ = a (4) aa∨a a (5)

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 8 / 27

slide-15
SLIDE 15

KAC Kleene Algebra with converse

The equational theory KAC

The equational theory KAC of regular algebras with converse over binary relations consists of the axioms of KA together with the following : (a + b)∨ = a∨ + b∨ (1) (a · b)∨ = b∨ · a∨ (2) (a⋆)∨ = (a∨)⋆ (3) a∨∨ = a (4) aa∨a a (5)

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 8 / 27

slide-16
SLIDE 16

KAC Reduction

From RegX

∨ to RegX Let X be a finite alphabet. For e ∈ RegX, we write e ⊆ X ⋆ for the language denoted by e. X ′ ≔ {x′ | x ∈ X} is a disjoint copy of X, and X ≔ X ∪ X ′. We apply the following rewriting system :                        (a + b)∨−→a∨ + b∨ (a · b)∨ −→b∨ · a∨ (a⋆)∨ −→(a∨)⋆ a∨∨ −→a

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 9 / 27

slide-17
SLIDE 17

KAC Reduction

From RegX

∨ to RegX Let X be a finite alphabet. For e ∈ RegX, we write e ⊆ X ⋆ for the language denoted by e. X ′ ≔ {x′ | x ∈ X} is a disjoint copy of X, and X ≔ X ∪ X ′. We apply the following rewriting system :                        (a + b)∨−→a∨ + b∨ (a · b)∨ −→b∨ · a∨ (a⋆)∨ −→(a∨)⋆ a∨∨ −→a x∨ −→x′ (x ∈ X) x′∨ −→x (x ∈ X)

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 9 / 27

slide-18
SLIDE 18

KAC Reduction

From RegX

∨ to RegX Let X be a finite alphabet. For e ∈ RegX, we write e ⊆ X ⋆ for the language denoted by e. X ′ ≔ {x′ | x ∈ X} is a disjoint copy of X, and X ≔ X ∪ X ′. We apply the following rewriting system :                        (a + b)∨−→a∨ + b∨ (a · b)∨ −→b∨ · a∨ (a⋆)∨ −→(a∨)⋆ a∨∨ −→a x∨ −→x′ (x ∈ X) x′∨ −→x (x ∈ X) 1∨ −→1 0∨ −→0

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 9 / 27

slide-19
SLIDE 19

KAC Reduction

From RegX

∨ to RegX Let X be a finite alphabet. For e ∈ RegX, we write e ⊆ X ⋆ for the language denoted by e. X ′ ≔ {x′ | x ∈ X} is a disjoint copy of X, and X ≔ X ∪ X ′. We apply the following rewriting system :                        (a + b)∨−→a∨ + b∨ (a · b)∨ −→b∨ · a∨ (a⋆)∨ −→(a∨)⋆ a∨∨ −→a x∨ −→x′ (x ∈ X) x′∨ −→x (x ∈ X) 1∨ −→1 0∨ −→0 We get e ∈ RegX.

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 9 / 27

slide-20
SLIDE 20

KAC Reduction

Is it enough ?

e, f ∈ RegX

∨ :

e ≡Rel f ⇒ ⇐ cl(e = f )

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 10 / 27

slide-21
SLIDE 21

KAC Reduction

Is it enough ?

e, f ∈ RegX

∨ :

e ≡Rel∨ f

cl(e = f)

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 10 / 27

slide-22
SLIDE 22

KAC Reduction

Is it enough ?

e, f ∈ RegX

∨ :

e ≡Rel∨ f

cl(e = f) aa∨a a x

R

y

R∨

e = aa∨a, f = a : e = {aa′a} {a} = f

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 10 / 27

slide-23
SLIDE 23

KAC Reduction

Is it enough ?

e, f ∈ RegX

∨ :

e ≡Rel∨ f ⇒ ⇐ cl (e)=cl (f) aa∨a a x

R

y

R∨

e = aa∨a, f = a : e = {aa′a} {a} = f

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 10 / 27

slide-24
SLIDE 24

KAC Reduction

Reduction relation and closure

Converse for words : w

For a word w ∈ X⋆, we define inductively w : ∀x ∈ X, x ≔ x′ ǫ ≔ ǫ ∀x′ ∈ X ′, x′ ≔ x wx ≔ x w.

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 11 / 27

slide-25
SLIDE 25

KAC Reduction

Reduction relation and closure

Converse for words : w

For a word w ∈ X⋆, we define inductively w : ∀x ∈ X, x ≔ x′ ǫ ≔ ǫ ∀x′ ∈ X ′, x′ ≔ x wx ≔ x w.

Reduction relation : u v

u1 · www · u2

  • u1 · w · u2

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 11 / 27

slide-26
SLIDE 26

KAC Reduction

Reduction relation and closure

Converse for words : w

For a word w ∈ X⋆, we define inductively w : ∀x ∈ X, x ≔ x′ ǫ ≔ ǫ ∀x′ ∈ X ′, x′ ≔ x wx ≔ x w.

Reduction relation : u v

u1 · www · u2

  • u1 · w · u2

Closure of a language : cl (L)

cl (L) ≔ {v ∈ X⋆ | ∃u ∈ L : u ⋆ v }

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 11 / 27

slide-27
SLIDE 27

KAC Reduction

Reduction relation and closure

Converse for words : w

For a word w ∈ X⋆, we define inductively w : ∀x ∈ X, x ≔ x′ ǫ ≔ ǫ ∀x′ ∈ X ′, x′ ≔ x wx ≔ x w.

Reduction relation : u v

u1 · www · u2

  • u1 · w · u2

Closure of a language : cl (L)

cl (L) ≔ {v ∈ X⋆ | ∃u ∈ L : u ⋆ v }

Example :

aa′a = aaa a, so we have :cl ({aa′a}) = {a, aa′a} ⊇ {a}.

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 11 / 27

slide-28
SLIDE 28

KAC Reduction

Reduction relation and closure

Converse for words : w

For a word w ∈ X⋆, we define inductively w : ∀x ∈ X, x ≔ x′ ǫ ≔ ǫ ∀x′ ∈ X ′, x′ ≔ x wx ≔ x w.

Reduction relation : u v

u1 · www · u2

  • u1 · w · u2

Closure of a language : cl (L)

cl (L) ≔ {v ∈ X⋆ | ∃u ∈ L : u ⋆ v }

Example :

abbabb′a′abbaa′ = abb ·ab ·b′a′ ·ab ·baa′

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 11 / 27

slide-29
SLIDE 29

KAC Reduction

Reduction relation and closure

Converse for words : w

For a word w ∈ X⋆, we define inductively w : ∀x ∈ X, x ≔ x′ ǫ ≔ ǫ ∀x′ ∈ X ′, x′ ≔ x wx ≔ x w.

Reduction relation : u v

u1 · www · u2

  • u1 · w · u2

Closure of a language : cl (L)

cl (L) ≔ {v ∈ X⋆ | ∃u ∈ L : u ⋆ v }

Example :

abbabb′a′abbaa′ = abb ·ab ·b′a′ ·ab ·baa′ = abb ·ab ·ab ·ab ·baa′

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 11 / 27

slide-30
SLIDE 30

KAC Reduction

Reduction relation and closure

Converse for words : w

For a word w ∈ X⋆, we define inductively w : ∀x ∈ X, x ≔ x′ ǫ ≔ ǫ ∀x′ ∈ X ′, x′ ≔ x wx ≔ x w.

Reduction relation : u v

u1 · www · u2

  • u1 · w · u2

Closure of a language : cl (L)

cl (L) ≔ {v ∈ X⋆ | ∃u ∈ L : u ⋆ v }

Example :

abbabb′a′abbaa′ = abb ·ab ·b′a′ ·ab ·baa′ = abb ·ab ·ab ·ab ·baa′ abb ·ab ·baa′

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 11 / 27

slide-31
SLIDE 31

KAC Reduction

Closure

Theorem a

  • a. Bloom, S. L., Ésik, Z., and Stefanescu, G. (1995). Notes on equational theories
  • f relations.

Algebra Universalis, 33(1) :98–126

e ≡Rel∨ f ⇔ cl (e) = cl (f)

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 12 / 27

slide-32
SLIDE 32

Construction

Plan

1

Introduction

2

From Kleene Algebra with Converse to regular languages Kleene Algebra with converse Reduction to an automaton problem

3

Closure of an automaton

4

The PSpace algorithm.

5

Conclusion

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 13 / 27

slide-33
SLIDE 33

Construction

Problem

Input : an automaton A over X Output : an automaton A ′ over X such that L(A ′) = cl (L(A )).

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 14 / 27

slide-34
SLIDE 34

Construction

Intuition

1 2 3 a a′ a

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 15 / 27

slide-35
SLIDE 35

Construction

Intuition

1 2 3 a a′ a a

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 15 / 27

slide-36
SLIDE 36

Construction

Intuition

1 2 3 a a′ a a 1 2 3 4 5 6 a b b′ a′ a b

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 15 / 27

slide-37
SLIDE 37

Construction

Intuition

1 2 3 a a′ a a 1 2 3 4 5 6 a b b′ a′ a b b

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 15 / 27

slide-38
SLIDE 38

Construction

Intuition

1 2 3 a a′ a a 1 2 3 4 5 6 a c b b′ a′ a b b

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 15 / 27

slide-39
SLIDE 39

Construction

Intuition

1 2 3 a a′ a a 1 2 3 4 5 6 1 2 3 4 5 6 c b b′ a′ a b a b b′ a′ a b b

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 15 / 27

slide-40
SLIDE 40

Construction

General idea

Bloom, Ésik and Stefanescu give a construction, using the transitions monoid

  • f the initial automaton, building a deterministic automaton with size 22n2

(if the initial automaton has size n).

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 16 / 27

slide-41
SLIDE 41

Construction

General idea

Bloom, Ésik and Stefanescu give a construction, using the transitions monoid

  • f the initial automaton, building a deterministic automaton with size 22n2

(if the initial automaton has size n). We give an alternative construction, much lighter. The states of our automaton will be pairs of

◮ a state of the initial automaton ◮ and some history. Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 16 / 27

slide-42
SLIDE 42

Construction

General idea

Bloom, Ésik and Stefanescu give a construction, using the transitions monoid

  • f the initial automaton, building a deterministic automaton with size 22n2

(if the initial automaton has size n). We give an alternative construction, much lighter. The states of our automaton will be pairs of

◮ a state of the initial automaton (q) ◮ and some history (H).

We will do a transition (q1, H)

a

− − − − → (q2, H′) if :

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 16 / 27

slide-43
SLIDE 43

Construction

General idea

Bloom, Ésik and Stefanescu give a construction, using the transitions monoid

  • f the initial automaton, building a deterministic automaton with size 22n2

(if the initial automaton has size n). We give an alternative construction, much lighter. The states of our automaton will be pairs of

◮ a state of the initial automaton (q) ◮ and some history (H).

We will do a transition (q1, H)

a

− − − − → (q2, H′) if :

◮ q1

a

− − − − → q3,

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 16 / 27

slide-44
SLIDE 44

Construction

General idea

Bloom, Ésik and Stefanescu give a construction, using the transitions monoid

  • f the initial automaton, building a deterministic automaton with size 22n2

(if the initial automaton has size n). We give an alternative construction, much lighter. The states of our automaton will be pairs of

◮ a state of the initial automaton (q) ◮ and some history (H).

We will do a transition (q1, H)

a

− − − − → (q2, H′) if :

◮ q1

a

− − − − → q3,

◮ H

a

− − − − → H′,

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 16 / 27

slide-45
SLIDE 45

Construction

General idea

Bloom, Ésik and Stefanescu give a construction, using the transitions monoid

  • f the initial automaton, building a deterministic automaton with size 22n2

(if the initial automaton has size n). We give an alternative construction, much lighter. The states of our automaton will be pairs of

◮ a state of the initial automaton (q) ◮ and some history (H).

We will do a transition (q1, H)

a

− − − − → (q2, H′) if :

◮ q1

a

− − − − → q3,

◮ H

a

− − − − → H′,

◮ and H′ allows to jump from q3 to q2. Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 16 / 27

slide-46
SLIDE 46

Construction

Γ(w)

Definition : Γ(w)

Γ(ǫ) = {ǫ} Γ(wx) = ({x′} · Γ(w) · {x})⋆

Lemma

u ∈ Γ(w) ⇔ ∃v ∈ suffixes(w) : u ⋆ vv Γ(xn · · · x1) is recognised by the automaton : 1 2 n x′

1

x′

2

x′

3

x′

n

x1 x2 x3 xn

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 17 / 27

slide-47
SLIDE 47

Construction

γ(w)

Consider an automaton A = Q, A, I, T, ∆, we write ∆x ≔ {(p, q) | p

x

− → q ∈ ∆}.

Definition : γ(w)

γ(ǫ) = IdQ γ(wx) = (∆x′ ◦ γ(w) ◦ ∆x)⋆

Lemma

(p, q) ∈ γ(w) ⇔ ∃u ∈ Γ(w) : p

u

− → q ⇔ ∃u : ∃v ∈ suffixes(w) : p

u

− → q ∧ u ⋆ vv

Histories

The set of histories is G ≔ {r ∈ Rel (Q) | ∃w ∈ X⋆ : r = γ(w)}.

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 18 / 27

slide-48
SLIDE 48

Construction

Closure Automaton

cl (A )

cl (A ) ≔ Q × G, X, I × γ(ǫ), F × G, ∆′ with transitions ∆′ : (q1, γ(w))

x

− − →cl (A ) (q2, γ(wx)) if (q1, q2) ∈ ∆x ◦ γ(wx)

Theorem

L (cl (A )) = cl (L(A ))

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 19 / 27

slide-49
SLIDE 49

Construction

Size

∆′ : {((q1, γ(w)) , x, (q2, γ(wx))) | (q1, q2) ∈ ∆x ◦ γ(wx)} We can see that this construction produces a non-deterministic automaton of size at most n × 2n×(n−1).

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 20 / 27

slide-50
SLIDE 50

Construction

Size

∆′ : {((q1, γ(w)) , x, (q2, γ(wx))) | (q1, q2) ∈ ∆x ◦ γ(wx)} We can see that this construction produces a non-deterministic automaton of size at most n × 2n×(n−1). Furthermore, it can be easily determinized : δ′ : ((Q1, γ(w)), x) → (Q1 · (∆x ◦ γ(wx)) , γ(wx))

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 20 / 27

slide-51
SLIDE 51

Construction

Size

∆′ : {((q1, γ(w)) , x, (q2, γ(wx))) | (q1, q2) ∈ ∆x ◦ γ(wx)} We can see that this construction produces a non-deterministic automaton of size at most n × 2n×(n−1). Furthermore, it can be easily determinized : δ′ : ((Q1, γ(w)), x) → (Q1 · (∆x ◦ γ(wx)) , γ(wx)) This deterministic automaton has at most 2n × 2n×(n−1) = 2n2 states, which is significantly smaller than 22n2 , the size of the automaton from the original construction.

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 20 / 27

slide-52
SLIDE 52

PSpace algorithm

Plan

1

Introduction

2

From Kleene Algebra with Converse to regular languages Kleene Algebra with converse Reduction to an automaton problem

3

Closure of an automaton

4

The PSpace algorithm.

5

Conclusion

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 21 / 27

slide-53
SLIDE 53

PSpace algorithm

Automaton equivalence

Let A and B be two deterministic automata over some alphabet Σ.

Theorem

L(A ) L(B) ⇔ ∃w ∈ (L(A ) ⊖ L(B)) : |w| |A | × |B|.

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 22 / 27

slide-54
SLIDE 54

PSpace algorithm

Automaton equivalence

Let A and B be two deterministic automata over some alphabet Σ.

Theorem

L(A ) L(B) ⇔ ∃w ∈ (L(A ) ⊖ L(B)) : |w| |A | × |B|.

input : A1 = Q1, Σ, i1, T1, δ1 input : A2 = Q2, Σ, i2, T2, δ2

  • utput: A Boolean, saying whether or not A1 and A2 recognise the same language.

1 N ← (|Q1| × |Q2|) ; 2 (p1, p2) ← (i1, i2) ; 3 while N > 0 do 4

N ← N − 1; /* N bounds the recursion depth */

5

f1 ← is_in(p1, T1);

6

f2 ← is_in(p2, T2);

7

if f1 = f2 then

8

x ←choose_from(Σ) ; /* Non-deterministic choice */

9

(p1, p2) ← (δ1(p1, x), δ2(p2, x)) ;

10

else

11

return false; /* A difference appeared for some word, L(A1) L(A2) */

12

end

13 14 end 15 return true;

/* There was no difference, L(A1) = L(A2) */

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 22 / 27

slide-55
SLIDE 55

PSpace algorithm

Automaton equivalence

Let A and B be two deterministic automata over some alphabet Σ.

Theorem

L(A ) L(B) ⇔ ∃w ∈ (L(A ) ⊖ L(B)) : |w| |A | × |B|.

input : A1 = Q1, Σ, i1, T1, δ1 input : A2 = Q2, Σ, i2, T2, δ2

  • utput: A Boolean, saying whether or not A1 and A2 recognise the same language.

1 N ← (|Q1| × |Q2|) ; 2 (p1, p2) ← (i1, i2) ; 3 while N > 0 do 4

N ← N − 1; /* N bounds the recursion depth */

5

f1 ← is_in(p1, T1);

6

f2 ← is_in(p2, T2);

7

if f1 = f2 then

8

x ←choose_from(Σ) ; /* Non-deterministic choice */

9

(p1, p2) ← (δ1(p1, x), δ2(p2, x)) ;

10

else

11

return false; /* A difference appeared for some word, L(A1) L(A2) */

12

end

13 14 end 15 return true;

/* There was no difference, L(A1) = L(A2) */

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 22 / 27

slide-56
SLIDE 56

PSpace algorithm

Automaton equivalence

Let A and B be two deterministic automata over some alphabet Σ.

Theorem

L(A ) L(B) ⇔ ∃w ∈ (L(A ) ⊖ L(B)) : |w| |A | × |B|.

input : A1 = Q1, Σ, i1, T1, δ1 input : A2 = Q2, Σ, i2, T2, δ2

  • utput: A Boolean, saying whether or not A1 and A2 recognise the same language.

1 N ← (|Q1| × |Q2|) ; 2 (p1, p2) ← (i1, i2) ; 3 while N > 0 do 4

N ← N − 1; /* N bounds the recursion depth */

5

f1 ← is_in(p1, T1);

6

f2 ← is_in(p2, T2);

7

if f1 = f2 then

8

x ←choose_from(Σ) ; /* Non-deterministic choice */

9

(p1, p2) ← (δ1(p1, x), δ2(p2, x)) ;

10

else

11

return false; /* A difference appeared for some word, L(A1) L(A2) */

12

end

13 14 end 15 return true;

/* There was no difference, L(A1) = L(A2) */

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 22 / 27

slide-57
SLIDE 57

PSpace algorithm

Automaton equivalence

Let A and B be two deterministic automata over some alphabet Σ.

Theorem

L(A ) L(B) ⇔ ∃w ∈ (L(A ) ⊖ L(B)) : |w| |A | × |B|.

input : A1 = Q1, Σ, i1, T1, δ1 input : A2 = Q2, Σ, i2, T2, δ2

  • utput: A Boolean, saying whether or not A1 and A2 recognise the same language.

1 N ← (|Q1| × |Q2|) ; 2 (p1, p2) ← (i1, i2) ; 3 while N > 0 do 4

N ← N − 1; /* N bounds the recursion depth */

5

f1 ← is_in(p1, T1);

6

f2 ← is_in(p2, T2);

7

if f1 = f2 then

8

x ←choose_from(Σ) ; /* Non-deterministic choice */

9

(p1, p2) ← (δ1(p1, x), δ2(p2, x)) ;

10

else

11

return false; /* A difference appeared for some word, L(A1) L(A2) */

12

end

13 14 end 15 return true;

/* There was no difference, L(A1) = L(A2) */

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 22 / 27

slide-58
SLIDE 58

PSpace algorithm

A PSpace algorithm for KAC

input : Two regular expressions with converse e, f ∈ RegX

  • utput: A Boolean, saying whether or not KAC ⊢ e = f .

1 A1 = Q1, X, I1, T1, ∆1 ← Glushkov’ automaton recognising e ; 2 A2 = Q2, X, I2, T2, ∆2 ← Glushkov’ automaton recognising f ; 3 N ← (2(|e|+1)2 × 2(|f |+1)2) ; 4 ((P1, R1), (P2, R2)) ← ((I1, IdQ1), (I2, IdQ1)) ; 5 while N > 0 do 6

N ← N − 1;

7

f1 ← is_empty(P1 ∩ T1);

8

f2 ← is_empty(P2 ∩ T2);

9

if f1 = f2 then

10

x ←choose_from(X);

11

(R1, R2) ← ((∆1(x′) ◦ R1 ◦ ∆1(x))⋆, (∆2(x′) ◦ R2 ◦ ∆2(x))⋆) ;

12

(P1, P2) ← (P1 · (∆1(x) ◦ R1), P2 · (∆2(x) ◦ R2)) ;

13

else

14

return false

15

end

16 end 17 return true Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 23 / 27

slide-59
SLIDE 59

PSpace algorithm

A PSpace algorithm for KAC

input : Two regular expressions with converse e, f ∈ RegX

  • utput: A Boolean, saying whether or not KAC ⊢ e = f .

1 A1 = Q1, X, I1, T1, ∆1 ← Glushkov’ automaton recognising e ; 2 A2 = Q2, X, I2, T2, ∆2 ← Glushkov’ automaton recognising f ; 3 N ← (2(|e|+1)2 × 2(|f |+1)2) ; 4 ((P1, R1), (P2, R2)) ← ((I1, IdQ1), (I2, IdQ1)) ; 5 while N > 0 do 6

N ← N − 1;

7

f1 ← is_empty(P1 ∩ T1);

8

f2 ← is_empty(P2 ∩ T2);

9

if f1 = f2 then

10

x ←choose_from(X);

11

(R1, R2) ← ((∆1(x′) ◦ R1 ◦ ∆1(x))⋆, (∆2(x′) ◦ R2 ◦ ∆2(x))⋆) ;

12

(P1, P2) ← (P1 · (∆1(x) ◦ R1), P2 · (∆2(x) ◦ R2)) ;

13

else

14

return false

15

end

16 end 17 return true Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 23 / 27

slide-60
SLIDE 60

PSpace algorithm

A PSpace algorithm for KAC

input : Two regular expressions with converse e, f ∈ RegX

  • utput: A Boolean, saying whether or not KAC ⊢ e = f .

1 A1 = Q1, X, I1, T1, ∆1 ← Glushkov’ automaton recognising e ; 2 A2 = Q2, X, I2, T2, ∆2 ← Glushkov’ automaton recognising f ; 3 N ← (2(|e|+1)2 × 2(|f |+1)2) ; 4 ((P1, R1), (P2, R2)) ← ((I1, IdQ1), (I2, IdQ1)) ; 5 while N > 0 do 6

N ← N − 1;

7

f1 ← is_empty(P1 ∩ T1);

8

f2 ← is_empty(P2 ∩ T2);

9

if f1 = f2 then

10

x ←choose_from(X);

11

(R1, R2) ← ((∆1(x′) ◦ R1 ◦ ∆1(x))⋆, (∆2(x′) ◦ R2 ◦ ∆2(x))⋆) ;

12

(P1, P2) ← (P1 · (∆1(x) ◦ R1), P2 · (∆2(x) ◦ R2)) ;

13

else

14

return false

15

end

16 end 17 return true Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 23 / 27

slide-61
SLIDE 61

PSpace algorithm

A PSpace algorithm for KAC

input : Two regular expressions with converse e, f ∈ RegX

  • utput: A Boolean, saying whether or not KAC ⊢ e = f .

1 A1 = Q1, X, I1, T1, ∆1 ← Glushkov’ automaton recognising e ; 2 A2 = Q2, X, I2, T2, ∆2 ← Glushkov’ automaton recognising f ; 3 N ← (2(|e|+1)2 × 2(|f |+1)2) ; 4 ((P1, R1), (P2, R2)) ← ((I1, IdQ1), (I2, IdQ1)) ; 5 while N > 0 do 6

N ← N − 1;

7

f1 ← is_empty(P1 ∩ T1);

8

f2 ← is_empty(P2 ∩ T2);

9

if f1 = f2 then

10

x ←choose_from(X);

11

(R1, R2) ← ((∆1(x′) ◦ R1 ◦ ∆1(x))⋆, (∆2(x′) ◦ R2 ◦ ∆2(x))⋆) ;

12

(P1, P2) ← (P1 · (∆1(x) ◦ R1), P2 · (∆2(x) ◦ R2)) ;

13

else

14

return false

15

end

16 end 17 return true Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 23 / 27

slide-62
SLIDE 62

PSpace algorithm

A PSpace algorithm for KAC

input : Two regular expressions with converse e, f ∈ RegX

  • utput: A Boolean, saying whether or not KAC ⊢ e = f .

1 A1 = Q1, X, I1, T1, ∆1 ← Glushkov’ automaton recognising e ; 2 A2 = Q2, X, I2, T2, ∆2 ← Glushkov’ automaton recognising f ; 3 N ← (2(|e|+1)2 × 2(|f |+1)2) ; 4 ((P1, R1), (P2, R2)) ← ((I1, IdQ1), (I2, IdQ1)) ; 5 while N > 0 do 6

N ← N − 1;

7

f1 ← is_empty(P1 ∩ T1);

8

f2 ← is_empty(P2 ∩ T2);

9

if f1 = f2 then

10

x ←choose_from(X);

11

(R1, R2) ← ((∆1(x′) ◦ R1 ◦ ∆1(x))⋆, (∆2(x′) ◦ R2 ◦ ∆2(x))⋆) ;

12

(P1, P2) ← (P1 · (∆1(x) ◦ R1), P2 · (∆2(x) ◦ R2)) ;

13

else

14

return false

15

end

16 end 17 return true Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 23 / 27

slide-63
SLIDE 63

PSpace algorithm

A PSpace algorithm for KAC

Let’s write n and m for the sizes of e and f . input : Two regular expressions with converse e, f ∈ RegX

  • utput: A Boolean, saying whether or not KAC ⊢ e = f .

1 A1 = Q1, X, I1, T1, ∆1 ← Glushkov’ automaton recognising e ; 2 A2 = Q2, X, I2, T2, ∆2 ← Glushkov’ automaton recognising f ; 3 N ← (2(|e|+1)2 × 2(|f |+1)2) ; 4 ((P1, R1), (P2, R2)) ← ((I1, IdQ1), (I2, IdQ1)) ; 5 while N > 0 do 6

N ← N − 1;

7

f1 ← is_empty(P1 ∩ T1);

8

f2 ← is_empty(P2 ∩ T2);

9

if f1 = f2 then

10

x ←choose_from(X);

11

(R1, R2) ← ((∆1(x′) ◦ R1 ◦ ∆1(x))⋆, (∆2(x′) ◦ R2 ◦ ∆2(x))⋆) ;

12

(P1, P2) ← (P1 · (∆1(x) ◦ R1), P2 · (∆2(x) ◦ R2)) ;

13

else

14

return false

15

end

16 end 17 return true

O (n + m) ∼ log

  • 2n2 × 2m2

∼ O

  • n2 + m2

∼ log(n) + n2 + log(m) + m2 ∼ O

  • n2 + m2

O (log(n)) O

  • n2 + m2

O

  • n2 + m2

So we get a space complexity O

  • n2 + m2

.

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 23 / 27

slide-64
SLIDE 64

Conclusion

So far

New construction for deciding KAC.

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 24 / 27

slide-65
SLIDE 65

Conclusion

So far

New construction for deciding KAC. PSpace complexity.

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 24 / 27

slide-66
SLIDE 66

Conclusion

So far

New construction for deciding KAC. PSpace complexity. Simpler correctness proofs.

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 24 / 27

slide-67
SLIDE 67

Conclusion

So far

New construction for deciding KAC. PSpace complexity. Simpler correctness proofs. Toy implementation in OCaml of both constructions.

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 24 / 27

slide-68
SLIDE 68

Conclusion

So far

New construction for deciding KAC. PSpace complexity. Simpler correctness proofs. Toy implementation in OCaml of both constructions. Coq proof of confluence of the relation .

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 24 / 27

slide-69
SLIDE 69

Conclusion

Further work

Simpler proof of cl (e) = cl (f) ⇒ KAC ⊢ e = f (i).

(i). Ésik, Z. and Bernátsky, L. (1995). Equational properties of Kleene algebras of relations with conversion. Theoretical Computer Science, 137(2) :237–251

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 25 / 27

slide-70
SLIDE 70

Conclusion

Further work

Simpler proof of cl (e) = cl (f) ⇒ KAC ⊢ e = f (i). Formalize in Coq.

(i). Ésik, Z. and Bernátsky, L. (1995). Equational properties of Kleene algebras of relations with conversion. Theoretical Computer Science, 137(2) :237–251

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 25 / 27

slide-71
SLIDE 71

Conclusion

Further work

Simpler proof of cl (e) = cl (f) ⇒ KAC ⊢ e = f (i). Formalize in Coq. Other extensions of Kleene Algebra : Action Algebra (⊸), Kleene Algebra with Intersection (∧)...

(i). Ésik, Z. and Bernátsky, L. (1995). Equational properties of Kleene algebras of relations with conversion. Theoretical Computer Science, 137(2) :237–251

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 25 / 27

slide-72
SLIDE 72

Conclusion

That’s it !

Thank you !

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 26 / 27

slide-73
SLIDE 73

Conclusion

Plan

1

Introduction

2

From Kleene Algebra with Converse to regular languages Kleene Algebra with converse Reduction to an automaton problem

3

Closure of an automaton

4

The PSpace algorithm.

5

Conclusion

Paul Brunet (ENS de Lyon, Université de Lyon) Kleene Algebra with Converse April 28th, 2014 27 / 27