Deciding Kleene Algebra with converse is PSpace -complete Talk at - - PowerPoint PPT Presentation

deciding kleene algebra with converse is pspace complete
SMART_READER_LITE
LIVE PREVIEW

Deciding Kleene Algebra with converse is PSpace -complete Talk at - - PowerPoint PPT Presentation

Introduction Deciding Kleene Algebra with converse is PSpace -complete Talk at the PACE meeting Paul Brunet & Damien Pous ENS de Lyon February 9 th , 2014 February 9 th , 2014 Paul Brunet (ENS de Lyon) 1 / 23 KAC is PSpace Introduction


slide-1
SLIDE 1

Introduction

Deciding Kleene Algebra with converse is PSpace-complete

Talk at the PACE meeting Paul Brunet & Damien Pous

ENS de Lyon

February 9th, 2014

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 1 / 23

slide-2
SLIDE 2

Introduction

Introduction

Kleene Algebra (i) : Abstraction for proving the equivalence of regular expressions.

(i). Conway, J. H. (1971). Regular algebra and finite machines. Chapman and Hall Mathematics Series

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 2 / 23

slide-3
SLIDE 3

Introduction

Introduction

Kleene Algebra (i) : Abstraction for proving the equivalence of regular expressions. The equivalence is PSpace-complete.

(i). Conway, J. H. (1971). Regular algebra and finite machines. Chapman and Hall Mathematics Series

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 2 / 23

slide-4
SLIDE 4

Introduction

Introduction

Kleene Algebra (i) : Abstraction for proving the equivalence of regular expressions. The equivalence is PSpace-complete. What if we add a converse operation to regular expressions ?

(i). Conway, J. H. (1971). Regular algebra and finite machines. Chapman and Hall Mathematics Series

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 2 / 23

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) KAC is PSpace February 9th, 2014 3 / 23

slide-6
SLIDE 6

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) KAC is PSpace February 9th, 2014 3 / 23

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) KAC is PSpace February 9th, 2014 3 / 23

slide-8
SLIDE 8

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) KAC is PSpace February 9th, 2014 3 / 23

slide-9
SLIDE 9

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) KAC is PSpace February 9th, 2014 3 / 23

slide-10
SLIDE 10

Introduction

Plan

1

Introduction

2

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

3

Closure of an automaton

4

The PSpace algorithm.

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 4 / 23

slide-11
SLIDE 11

KAC

Plan

1

Introduction

2

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

3

Closure of an automaton

4

The PSpace algorithm.

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 5 / 23

slide-12
SLIDE 12

KAC Kleene Algebra wih converse

Regular expressions with converse

Regular expressions with converse over X

Let X be a finite set, the set of regular expressions over X (written RegX

∨) are

  • btained with the grammar :

e, f 0|1|x ∈ X|e + f |e · f |e∗|e∨

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 6 / 23

slide-13
SLIDE 13

KAC Kleene Algebra wih converse

Regular expressions with converse

Regular expressions with converse over X

Let X be a finite set, the set of regular expressions over X (written RegX

∨) are

  • btained with the grammar :

e, f 0|1|x ∈ X|e + f |e · f |e∗|e∨ A relational interpretation of regular expressions with converse over X can be specified by a domain S and a map σ : X −→ P

  • S2

We will write ˆ σ : RegX

∨ −→ P

  • S2

for the unique morphism equal to σ on X.

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 6 / 23

slide-14
SLIDE 14

KAC Kleene Algebra wih converse

Relational equivalence

For e, f ∈ RegX

∨ :

e ≡Rel∨ f means that ∀S, ∀σ : X → P

  • S2

, ˆ σ(e) = ˆ σ(f ).

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 7 / 23

slide-15
SLIDE 15

KAC Kleene Algebra wih converse

A hint from the equational theory.

(a + b)∨ = a∨ + b∨ (1) (a · b)∨ = b∨ · a∨ (2) (a∗)∨ = (a∨)∗ (3) a∨∨ = a (4) a aa∨a (5)

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 8 / 23

slide-16
SLIDE 16

KAC Kleene Algebra wih converse

A hint from the equational theory.

(a + b)∨ = a∨ + b∨ (1) (a · b)∨ = b∨ · a∨ (2) (a∗)∨ = (a∨)∗ (3) a∨∨ = a (4) a aa∨a (5)

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 8 / 23

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 ′.

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 9 / 23

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 ′.

1

We see equations (1)-(4) as rewriting rules : (a + b)∨−→a∨ + b∨ (a · b)∨ −→b∨ · a∨ (a∗)∨ −→(a∨)∗ a∨∨ −→a 1∨ −→1 0∨ −→0

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 9 / 23

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 ′.

1

We see equations (1)-(4) as rewriting rules : (a + b)∨−→a∨ + b∨ (a · b)∨ −→b∨ · a∨ (a∗)∨ −→(a∨)∗ a∨∨ −→a 1∨ −→1 0∨ −→0

2

We substitute x∨ with x′ in the result. We get e ∈ RegX.

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 9 / 23

slide-20
SLIDE 20

KAC Reduction

Reduction relation

a aa∨a

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) KAC is PSpace February 9th, 2014 10 / 23

slide-21
SLIDE 21

KAC Reduction

Reduction relation

a aa∨a

w

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

u v

u1 · www · u2

  • u1 · w · u2

Example : abbabb′a′abbaa′

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 10 / 23

slide-22
SLIDE 22

KAC Reduction

Reduction relation

a aa∨a

w

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

u v

u1 · www · u2

  • u1 · w · u2

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

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 10 / 23

slide-23
SLIDE 23

KAC Reduction

Reduction relation

a aa∨a

w

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

u v

u1 · www · u2

  • u1 · w · u2

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

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 10 / 23

slide-24
SLIDE 24

KAC Reduction

Reduction relation

a aa∨a

w

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

u v

u1 · www · u2

  • u1 · w · u2

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

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 10 / 23

slide-25
SLIDE 25

KAC Reduction

Closure

cl (L)

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

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 11 / 23

slide-26
SLIDE 26

KAC Reduction

Closure

cl (L)

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

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) KAC is PSpace February 9th, 2014 11 / 23

slide-27
SLIDE 27

Construction

Plan

1

Introduction

2

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

3

Closure of an automaton

4

The PSpace algorithm.

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 12 / 23

slide-28
SLIDE 28

Construction

Problem

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

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 13 / 23

slide-29
SLIDE 29

Construction

Intuition

1 2 3 a a′ a

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 14 / 23

slide-30
SLIDE 30

Construction

Intuition

1 2 3 a a′ a a

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 14 / 23

slide-31
SLIDE 31

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) KAC is PSpace February 9th, 2014 14 / 23

slide-32
SLIDE 32

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) KAC is PSpace February 9th, 2014 14 / 23

slide-33
SLIDE 33

Construction

Intuition

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

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 14 / 23

slide-34
SLIDE 34

Construction

Intuition

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

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 14 / 23

slide-35
SLIDE 35

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) KAC is PSpace February 9th, 2014 15 / 23

slide-36
SLIDE 36

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) KAC is PSpace February 9th, 2014 15 / 23

slide-37
SLIDE 37

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.

If : q0

u

− − → q1

x

− − → q3

w

− − → q2 With : ∃u2 ∈ suffixes(ux) : w ∗ u2u2

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 15 / 23

slide-38
SLIDE 38

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.

If : q0

u

− − → q1

x

− − → q3

w

− − → q2 With : ∃u2 ∈ suffixes(ux) : w ∗ u2u2 Meaning : uxw ∗ uxu2u2 = u1u2u2u2 u1u2 = ux

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 15 / 23

slide-39
SLIDE 39

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.

If : q0

u

− − → q1

x

− − → q3

w

− − → q2 With : ∃u2 ∈ suffixes(ux) : w ∗ u2u2 Meaning : uxw ∗ uxu2u2 = u1u2u2u2 u1u2 = ux Then : (q0, γ(ǫ))

u

− → (q1, γ(u))

x

− → (q2, γ(ux))

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 15 / 23

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). 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.

If : q0

u

− − → q1

x

− − → q3

w

− − → q2 With : ∃u2 ∈ suffixes(ux) : w ∗ u2u2 Meaning : uxw ∗ uxu2u2 = u1u2u2u2 u1u2 = ux Then : (q0, γ(ǫ))

u

− → (q1, γ(u))

x

− → (q2, γ(ux))

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 15 / 23

slide-41
SLIDE 41

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) KAC is PSpace February 9th, 2014 16 / 23

slide-42
SLIDE 42

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 ∈ P
  • Q2

| ∃w ∈ X∗ : r = γ(w)

  • .

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 17 / 23

slide-43
SLIDE 43

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) KAC is PSpace February 9th, 2014 18 / 23

slide-44
SLIDE 44

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 )) (p, γ(u))

x

− − → (q, γ(ux)) ∃r ∈ Q ∃w ∈ Γ(ux) : p

x

− − → r

w

− − → q

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 18 / 23

slide-45
SLIDE 45

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 )) (p, γ(u))

x

− − → (q, γ(ux)) ∃r ∈ Q ∃v ∈ suffixes(ux) ∃w ∗ vv : p

x

− − → r

w

− − → q

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 18 / 23

slide-46
SLIDE 46

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) KAC is PSpace February 9th, 2014 19 / 23

slide-47
SLIDE 47

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). Futhurmore, it can be easily determinized : δ′ : ((Q1, γ(w)), x) → (Q1 · (∆x ◦ γ(wx)) , γ(wx))

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 19 / 23

slide-48
SLIDE 48

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). Futhurmore, 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 significantely smaller than 22n2 , the size of the automaton from the original construction.

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 19 / 23

slide-49
SLIDE 49

PSpace algorithm

Plan

1

Introduction

2

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

3

Closure of an automaton

4

The PSpace algorithm.

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 20 / 23

slide-50
SLIDE 50

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)) ∪ (L(B) \ L(A )) : |w| |A | × |B|.

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 21 / 23

slide-51
SLIDE 51

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)) ∪ (L(B) \ L(A )) : |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 ←random(Σ) ; /* 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) KAC is PSpace February 9th, 2014 21 / 23

slide-52
SLIDE 52

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)) ∪ (L(B) \ L(A )) : |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 ←random(Σ) ; /* 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) KAC is PSpace February 9th, 2014 21 / 23

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)) ∪ (L(B) \ L(A )) : |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 ←random(Σ) ; /* 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) KAC is PSpace February 9th, 2014 21 / 23

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)) ∪ (L(B) \ L(A )) : |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 ←random(Σ) ; /* 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) KAC is PSpace February 9th, 2014 21 / 23

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)) ∪ (L(B) \ L(A )) : |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 ←random(Σ) ; /* 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) KAC is PSpace February 9th, 2014 21 / 23

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)) ∪ (L(B) \ L(A )) : |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 ←random(Σ) ; /* 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) KAC is PSpace February 9th, 2014 21 / 23

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)) ∪ (L(B) \ L(A )) : |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 ←random(Σ) ; /* 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) KAC is PSpace February 9th, 2014 21 / 23

slide-58
SLIDE 58

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)) ∪ (L(B) \ L(A )) : |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 ←random(Σ) ; /* 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) KAC is PSpace February 9th, 2014 21 / 23

slide-59
SLIDE 59

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)) ∪ (L(B) \ L(A )) : |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 ←random(Σ) ; /* 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) KAC is PSpace February 9th, 2014 21 / 23

slide-60
SLIDE 60

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)) ∪ (L(B) \ L(A )) : |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 ←random(Σ) ; /* 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) KAC is PSpace February 9th, 2014 21 / 23

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 ←random(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) KAC is PSpace February 9th, 2014 22 / 23

slide-62
SLIDE 62

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 ←random(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) KAC is PSpace February 9th, 2014 22 / 23

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 ←random(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) KAC is PSpace February 9th, 2014 22 / 23

slide-64
SLIDE 64

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 ←random(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)

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-65
SLIDE 65

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 ←random(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)

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-66
SLIDE 66

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 ←random(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

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-67
SLIDE 67

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 ←random(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

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-68
SLIDE 68

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 ←random(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) + log(m) + n2 + m2 ∼ O

  • n2 + m2

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-69
SLIDE 69

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 ←random(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) + log(m) + n2 + m2 ∼ O

  • n2 + m2

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-70
SLIDE 70

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 ←random(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) + log(m) + n2 + m2 ∼ O

  • n2 + m2

O (log(n))

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-71
SLIDE 71

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 ←random(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) + log(m) + n2 + m2 ∼ O

  • n2 + m2

O (log(n))

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-72
SLIDE 72

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 ←random(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) + log(m) + n2 + m2 ∼ O

  • n2 + m2

O (log(n)) n2

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-73
SLIDE 73

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 ←random(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) + log(m) + n2 + m2 ∼ O

  • n2 + m2

O (log(n)) 2 × m2

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-74
SLIDE 74

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 ←random(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) + log(m) + n2 + m2 ∼ O

  • n2 + m2

O (log(n)) O

  • n2 + m2

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-75
SLIDE 75

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 ←random(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) + log(m) + n2 + m2 ∼ O

  • n2 + m2

O (log(n)) O

  • n2 + m2

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-76
SLIDE 76

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 ←random(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) + log(m) + n2 + m2 ∼ O

  • n2 + m2

O (log(n)) O

  • n2 + m2

O

  • n2 + m2

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 22 / 23

slide-77
SLIDE 77

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 ←random(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) + log(m) + n2 + 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) KAC is PSpace February 9th, 2014 22 / 23

slide-78
SLIDE 78

PSpace algorithm

Plan

1

Introduction

2

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

3

Closure of an automaton

4

The PSpace algorithm.

Paul Brunet (ENS de Lyon) KAC is PSpace February 9th, 2014 23 / 23