from word/string automata to tree...

62
From word/string automata to tree automata Stefan Pedratscher Thomas Blaas Supervisor Franziska Rapp November 21, 2017

Upload: lamnguyet

Post on 02-Apr-2019

258 views

Category:

Documents


0 download

TRANSCRIPT

From word/string automata to tree automata

Stefan Pedratscher Thomas Blaas

SupervisorFranziska Rapp

November 21, 2017

String/word automataDeterministic Finite AutomataNondeterministic Finite Automata

Tree AutomataNondeterministic Finite Tree AutomataDeterministic Finite Tree AutomataTree HomomorphismMinimizationClosure Property

Tree Automata Completion

Timbuk (Live-demo)

Motivation

Buchi showed, that finite automata and second-order logic havethe same expressive power and the transformation from formulasto automata and vice versa are effective

Applications:

I Termination analysis

I Reachability analysis

I Decision problems

I Model checking

I Parse trees

I . . .

Motivation

Buchi showed, that finite automata and second-order logic havethe same expressive power and the transformation from formulasto automata and vice versa are effective

Applications:

I Termination analysis

I Reachability analysis (tree automata completion)

I Decision problems

I Model checking

I Parse trees

I . . .

Finite Automata

Application

Finite Automata are used in Linux: The command ”Grep” usesregular expressions to specify the search pattern and a finiteautomaton to implement the search itself.

Deterministic Finite Automata (DFA)

DefinitionA DFA is a tuple A = (Q,Σ, δ, s, F ) with

I Q: finite set of states

I Σ: input alphabet

I δ : Q× Σ→ Q: transition function

I s ∈ Q: start state

I F ⊆ Q: set of final states

Deterministic Finite Automata (DFA)

Example

q0start q1 q2 q3a

b

b

a

a

b

a,b

Q = {q0, q1, q2, q3}Σ = {a, b}s = q0

F = {q3}

δ a b

q0 q1 q0q1 q1 q2q2 q3 q0q3 q3 q3

Nondeterministic Finite Automata (NFA)

DefinitionA NFA is a tuple A = (Q,Σ, δ, S, F ) with

I Q: finite set of states

I Σ: input alphabet

I δ : Q× Σ→ 2Q : transition function

I S ⊆ Q: set of start states

I F ⊆ Q: set of final states

Nondeterministic Finite Automata (NFA)

Example

q0start q1 q2

a

a,b

b

a,b

a

Q = {q0, q1, q2}Σ = {a, b}S = {q0}F = {q2}

δ a b

q0 {q0, q1} {q0}q1 {q2} {q0, q2}q2 {q2} ∅

NFA with ε-Transitions (NFAε)

DefinitionA NFAε is a tuple N = (Q,Σ, ε, δ, S, F ) with:

I ε /∈ Σ

I Nε = (Q,Σ ∪ {ε}, δ, S, F ) is a NFA over thealphabet Σ ∪ {ε}

NFA with ε-Transitions (NFAε)

Example

q0start q1 q2ε

a

ε

b c

Q = {q0, q1, q2}Σ = {a, b, c} ∪ {ε}S = {q0}F = {q2}

δ a b c

q0 {q0, q1} ø øq1 ø {q1, q2} øq2 ø ø {q2}

Signature

Definition

I A signature F is a finite set of function symbols,each of them with an arity greater or equal to 0.

I Fi is the set of symbols of arity i.

Example

{+:2, s:1, 1:0}, {∧:2, ∨:2, ¬:1, >:0, ⊥:0}

T erm

Definition

I The set of terms over the signature F and V is the smallestset T (F ,V) such that:

I F0 ⊆ T (F ,V),I V ⊆ T (F ,V),I if i ≥ 1, f ∈ Fi and t1, . . . , ti ∈ T (F ,V),

then f(t1, . . . , ti) ∈ T (F ,V).

I A term without variables is called ground. T (F ,∅) = T (F)

I A term where each variable appears at most once is calledlinear.

Example

x, ¬(x), ∧(∨(x, ¬(y)), ¬(x))

T erm

Definition

I The set of terms over the signature F and V is the smallestset T (F ,V) such that:

I F0 ⊆ T (F ,V),I V ⊆ T (F ,V),I if i ≥ 1, f ∈ Fi and t1, . . . , ti ∈ T (F ,V),

then f(t1, . . . , ti) ∈ T (F ,V).

I A term without variables is called ground. T (F ,∅) = T (F)

I A term where each variable appears at most once is calledlinear.

Example

x, ¬(x), ∧(∨(x, ¬(y)), ¬(x))

Nondeterministic Finite Tree Automata (NFTA)

DefinitionA NFTA over F is a tuple A = (F , Q,Qf ,∆)

I F : signature

I Q : set of states

I Qf ⊆ Q : set of final states

I ∆ : transition rules

f(q1, . . . , qn)→ q, where f ∈ F and q, q1, . . . , qn ∈ Qor

p→ q where p, q ∈ Q (ε-transitions)

Nondeterministic Finite Tree Automata (NFTA)

Move Relation

f

g

a

a→A

f

g

qa

a→∗A

f

qg qa

A = (F , Q,Qf ,∆)

F = {f :2, g:1, a:0}Q = {qa, qg, qf , qr}Qf = {qf}

a → qag(qa) → qgg(qa) → qr

f(qg, qa) → qff(qr, qa) → qf

Nondeterministic Finite Tree Automata (NFTA)

Move Relation

f

g

a

a→A

f

g

qa

a→∗A

f

qr qa

A = (F , Q,Qf ,∆)

F = {f :2, g:1, a:0}Q = {qa, qg, qf , qr}Qf = {qf}

a → qag(qa) → qgg(qa) → qr

f(qg, qa) → qff(qr, qa) → qf

Deterministic Finite Tree Automata (DFTA)

DefinitionA DFTA is a special case of an NFTA

I Any L(A) recognised by NFTA can be recognised by DFTA

I Has no rules with the same left hand side (and no ε-rule)⇒ At most one run for every ground term

Is this automaton deterministic?

A = (F , Q,Qf ,∆)

F = {g:1, a:0}

Q = {q0, q1, q2}

Qf = {q0}

a → q0g(q0) → q1g(q2) → q1g(q1) → q0g(q2) → q0

Deterministic Finite Tree Automata (DFTA)

DefinitionA DFTA is a special case of an NFTA

I Any L(A) recognised by NFTA can be recognised by DFTA

I Has no rules with the same left hand side (and no ε-rule)⇒ At most one run for every ground term

Is this automaton deterministic?

A = (F , Q,Qf ,∆)

F = {g:1, a:0}

Q = {q0, q1, q2}

Qf = {q0}

a → q0g(q0) → q1g(q2) → q1g(q1) → q0g(q2) → q0

Deterministic Finite Tree Automata (DFTA)

DefinitionA DFTA is a special case of an NFTA

I Any L(A) recognised by NFTA can be recognised by DFTA

I Has no rules with the same left hand side (and no ε-rule)⇒ At most one run for every ground term

Is this automaton deterministic? No

A = (F , Q,Qf ,∆)

F = {g:1, a:0}

Q = {q0, q1, q2}

Qf = {q0}

a → q0g(q0) → q1g(q2) → q1g(q1) → q0g(q2) → q0

Bottom-Up vs Top-Down

Example

The shown tree automata were bottom-up.

I Bottom-up automata transitions look like this:f(q1, . . . , qn)→ q

I Top-down automata recognize a smaller set of languages

I Transitions have the form q → f(q1, . . . , qn)

I L{f(a, b), f(b, a)} is not recognizable by any deterministictop-down automaton

I DFA, NFA and NFAε have all the same accepting power

Tree Homomorphism

DefinitionLet F and F ′ be two sets of function symbols

I Vn = {x1, . . . , xn} is disjoint from F and F ′

I hF associates tf ∈ T (F ′,Vn) with every f ∈ F of arity n

I Tree homomorphism h : T (F)→ T (F ′) is defined as follows:

I h(a) = ta ∈ T (F ′) for each a ∈ F of arity 0I h(f(t1, . . . , tn)) = tf{x1 7→ h(t1), . . . , xn 7→ h(tn)}

I Tree homomorphism is only closed, if L is linear(no duplicate variables)

Tree Homomorphism

Example

Let F={g:3, a:0, b:0} and F ′={f :2, a:0, b:0}I hF (g) = f(x1, f(x2, x3))

I hF (a) = a

I hF (b) = b

g

a g

b b b

a →h

f

a f

f

b f

b b

a

Minimization of Tree Automata

IdeaFor every A there exists a unique minimal automaton Amin inthe number of states for a given recognizable L(A).The algorithm works only with reduced DFTA (withoutinaccessible states)

Minimization of Tree Automata

Algorithm

input: reduced DFTA A = (F , Q,Qf , δ)Set P to {Qf , Q \Qf}repeat

P ′ = Pq P ′ q′ if

q P q′

∀f ∈ Fn∀q1, . . . , qn ∈ Qδ(f(q1, . . . , q, . . . , qn))P δ(f(q1, . . . , q’, . . . , qn))

until P ′ = P

Set Qmin to the set of equivalence classes of P

Set δmin to {(f, [q1], . . . , [qn])→ [f(q1, . . . , qn)]}Set Qminf

to {[q] | q ∈ Qf}output: DFTA Amin = (F , Qmin, Qminf

, δmin)

Minimization of Tree Automata

Example

F = {f :2, a:0, b:0, c:0}Q = {q0, q1, q2, qf , qf ′}Qf = {qf , qf ′}

a → q0b → q1c → q2

f(q0, q0) → q0f(q0, q1) → q1f(q1, q0) → q1f(q1, q1) → q1f(q1, q2) → qff(q0, q2) → qf ′

{{q0, q1, q2}, {qf , q′f}}

Minimization of Tree Automata

Example

F = {f :2, a:0, b:0, c:0}Q = {q0, q1, q2, qf , qf ′}Qf = {qf , qf ′}

a → q0b → q1c → q2

f(q0, q0) → q0f(q0, q1) → q1f(q1, q0) → q1f(q1, q1) → q1f(q1, q2) → qff(q0, q2) → qf ′

{{q0, q1, q2}, {qf , q′f}}{{q0, q1}, {q2}, {qf , q′f}}

no other state p such thatf(q0, p) or f(q1, p)→ {qf , qf ′}

Minimization of Tree Automata

Example

F = {f :2, a:0, b:0, c:0}Q = {q0, q1, q2, qf , qf ′}Qf = {qf , qf ′}

a → q0b → q1c → q2

f(q0, q0) → q0f(q0, q1) → q1f(q1, q0) → q1f(q1, q1) → q1f(q1, q2) → qff(q0, q2) → qf ′

{{q0, q1, q2}, {qf , q′f}}{{q0, q1}, {q2}, {qf , q′f}}

Minimization of Tree Automata

Example

F = {f :2, a:0, b:0, c:0}Qmin = {q01, q2, qff ′}Qminf

= {qff ′}

a → q01b → q01c → q2

f(q01, q01) → q01f(q01, q2) → qff ′

{{q0, q1, q2}, {qf , q′f}}{{q0, q1}, {q2}, {qf , q′f}}

Closure Property

What is a closure property?

I A closure property of a class of (tree) languages is the factthat the class is closed under a particular operation.

I Example (closed under): Positive integers are closed underaddition, but not under subtraction: 1− 2 = −1

I The class of recognizable tree languages is closed underunion, complementation and intersection.

Closure Property

Union

I Let L1 and L2 be two recognizable tree languages

I Thus there exist two tree automata A1 = (F , Q1, Qf1,∆1)and A2 = (F , Q2, Qf2,∆2) with L1 = L(A1) andL2 = L(A2)

I Now we consider a NFTA A = (F , Q,Qf ,∆) defined byQ = Q1 ∪Q2, Qf = Qf1 ∪Qf2 and ∆ = ∆1 ∪∆2

⇒ L(A) = L(A1) ∪ L(A2)

Closure Property

Complementation

I Let L be a recognizable tree language.

I Let A = (F , Q,Qf ,∆) be a complete DFTA suchthat L(A) = L

I We can now complement the final states, to complement L:Ac = (F , Q,Qcf ,∆) with Qcf = Q \Qf

I If A is a NFTA we first apply determinization and thencomplement the final state set

Closure Property

IntersectionClosure under intersection follows from closure under union andcomplementation:

L1 ∩ L2 = L1 ∪ L2

L is the complement of L

Tree Automata Completion

What is Tree Automata Completion?

I Elegant and efficient technique to perform reachability analysis

I Starting from a regular language it aims to compute aregular superset of all terms that can be reached from a setof initial terms by performing rewriting.

I Possibly infinite sets of terms are represented with treeautomata

Substitution

Definition

I A substitution σ is a mapping from V to TI Application of a substitution σ to a term t, written as tσ:

tσ = σ(t) if t ∈ V andtσ = f(t1σ, . . . , tnσ) if t = f(t1, . . . , tn)

Term Rewriting System

DefinitionConsider a TRS R

I A rewrite rule is a pair of terms (l, r), written l→ r.

I R is a set of rewrite rules such that for all l→ r ∈ R, l is nota variable and Var(l) ⊇ Var(r)

I We define →R to be the smallest rewrite relation thatcontains R, that is, s→R t for two terms s iff there is arewrite rule l→ r, a position p and a substitution σ such thats = s[lσ]p and t = s[rσ]p

I The term s is in normal form with respect to R if there is noterm t such that s→R t. The set of normal forms of R isdenoted by NF(R)

Term Rewriting System

Example

Consider the TRS R with the following rewrite rules:

0 + y → y0× y → 0

s(x) + y → s(x+ y)s(x)× y → (x× y) + y

Computing the NF of term t = (s(0) + 0)× s(s(0)):

→R s(0 + 0)× s(s(0))

→R s(0)× s(s(0))

→R (0× s(s(0))) + s(s(0))

→R 0 + s(s(0))

→R s(s(0))

is in NF

σ1 = {x 7→ 0, y 7→ 0}σ2 = {y 7→ 0}σ3 = {x 7→ 0, y 7→ s(s(0))}σ4 = {y 7→ s(s(0))}σ5 = {y 7→ s(s(0))}

Term Rewriting System

Example

Consider the TRS R with the following rewrite rules:

0 + y → y0× y → 0

s(x) + y → s(x+ y)s(x)× y → (x× y) + y

Computing the NF of term t = (s(0) + 0)× s(s(0)):

→R s(0 + 0)× s(s(0))

→R s(0)× s(s(0))

→R (0× s(s(0))) + s(s(0))

→R 0 + s(s(0))

→R s(s(0))

is in NF

σ1 = {x 7→ 0, y 7→ 0}

σ2 = {y 7→ 0}σ3 = {x 7→ 0, y 7→ s(s(0))}σ4 = {y 7→ s(s(0))}σ5 = {y 7→ s(s(0))}

Term Rewriting System

Example

Consider the TRS R with the following rewrite rules:

0 + y → y0× y → 0

s(x) + y → s(x+ y)s(x)× y → (x× y) + y

Computing the NF of term t = (s(0) + 0)× s(s(0)):

→R s(0 + 0)× s(s(0))

→R s(0)× s(s(0))

→R (0× s(s(0))) + s(s(0))

→R 0 + s(s(0))

→R s(s(0))

is in NF

σ1 = {x 7→ 0, y 7→ 0}σ2 = {y 7→ 0}

σ3 = {x 7→ 0, y 7→ s(s(0))}σ4 = {y 7→ s(s(0))}σ5 = {y 7→ s(s(0))}

Term Rewriting System

Example

Consider the TRS R with the following rewrite rules:

0 + y → y0× y → 0

s(x) + y → s(x+ y)s(x)× y → (x× y) + y

Computing the NF of term t = (s(0) + 0)× s(s(0)):

→R s(0 + 0)× s(s(0))

→R s(0)× s(s(0))

→R (0× s(s(0))) + s(s(0))

→R 0 + s(s(0))

→R s(s(0))

is in NF

σ1 = {x 7→ 0, y 7→ 0}σ2 = {y 7→ 0}σ3 = {x 7→ 0, y 7→ s(s(0))}

σ4 = {y 7→ s(s(0))}σ5 = {y 7→ s(s(0))}

Term Rewriting System

Example

Consider the TRS R with the following rewrite rules:

0 + y → y0× y → 0

s(x) + y → s(x+ y)s(x)× y → (x× y) + y

Computing the NF of term t = (s(0) + 0)× s(s(0)):

→R s(0 + 0)× s(s(0))

→R s(0)× s(s(0))

→R (0× s(s(0))) + s(s(0))

→R 0 + s(s(0))

→R s(s(0))

is in NF

σ1 = {x 7→ 0, y 7→ 0}σ2 = {y 7→ 0}σ3 = {x 7→ 0, y 7→ s(s(0))}σ4 = {y 7→ s(s(0))}

σ5 = {y 7→ s(s(0))}

Term Rewriting System

Example

Consider the TRS R with the following rewrite rules:

0 + y → y0× y → 0

s(x) + y → s(x+ y)s(x)× y → (x× y) + y

Computing the NF of term t = (s(0) + 0)× s(s(0)):

→R s(0 + 0)× s(s(0))

→R s(0)× s(s(0))

→R (0× s(s(0))) + s(s(0))

→R 0 + s(s(0))

→R s(s(0))

is in NF

σ1 = {x 7→ 0, y 7→ 0}σ2 = {y 7→ 0}σ3 = {x 7→ 0, y 7→ s(s(0))}σ4 = {y 7→ s(s(0))}σ5 = {y 7→ s(s(0))}

Term Rewriting System

Example

Consider the TRS R with the following rewrite rules:

0 + y → y0× y → 0

s(x) + y → s(x+ y)s(x)× y → (x× y) + y

Computing the NF of term t = (s(0) + 0)× s(s(0)):

→R s(0 + 0)× s(s(0))

→R s(0)× s(s(0))

→R (0× s(s(0))) + s(s(0))

→R 0 + s(s(0))

→R s(s(0))

is in NF

σ1 = {x 7→ 0, y 7→ 0}σ2 = {y 7→ 0}σ3 = {x 7→ 0, y 7→ s(s(0))}σ4 = {y 7→ s(s(0))}σ5 = {y 7→ s(s(0))}

Tree Automata Completion

Example

Consider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions∆:

a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4

Is A compatible with R in L(A)?

Tree Automata Completion

Example

Consider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions∆:

a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4

Is A compatible with R in L(A)?

We say A is compatible with R in L if L ⊆ L(A) and for eachrewrite rule l→ r ∈ R and state substitution σ : Var → Q suchthat lσ →∗A q we have rσ →∗A q

Tree Automata Completion

Example

Consider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions∆:

a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4

Is A compatible with R in L(A)?

f(q3, q0)→ q4 σ={x 7→q3,y 7→q0}f(g(q3), g(q0))

Tree Automata Completion

Example

Consider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions∆:

a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4

Is A compatible with R in L(A)?

f(q3, q0)→ q4 σ={x 7→q3,y 7→q0} Xf(g(q3), g(q0))

Tree Automata Completion

Example

Consider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions∆:

a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4

Is A compatible with R in L(A)?

f(q3, q0)→ q4 σ={x 7→q3,y 7→q0} Xf(g(q3), g(q0)) X

Tree Automata Completion

Example

Consider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions∆:

a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4

Is A compatible with R in L(A)? No

f(q3, q0)→ q4 σ={x 7→q3,y 7→q0} Xf(g(q3), g(q0)) X

Tree Automata Completion

Make A compatible with R in L(A)Idea:

I Start with initial tree automaton A = (F , Q,Qf ,∆)accepting L(A)

I Look for violations: lσ →∗A q and rσ 9∗A q for some rewriterule l→ r ∈ R, state substitution σ : Var(l)→ Q and stateq ∈ Q

I Add new states and transitions to A to ensure rσ →∗A q

Tree Automata Completion

Make A compatible with R in L(A)Idea:

Figure: Completion Progress

Tree Automata CompletionConsider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions:a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4

is A compatible with R in L(A)?

f(q3, q0)→ q4 σ={x 7→q3,y 7→q0} Xf(g(q3), g(q0)) X

Tree Automata CompletionConsider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions:a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4f(q3, q3)→ q4

is A compatible with R in L(A)?

f(q3, q0)→ q4 σ={x 7→q3,y 7→q0} Xf(g(q3), g(q0)) X

Tree Automata CompletionConsider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions:a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4f(q3, q3)→ q4

is A compatible with R in L(A)?

f(q3, q0)→ q4 σ={x 7→q3,y 7→q0} Xf(g(q3), g(q0)) X

h(q0, q1)→ q4 σ={y 7→q1} Xh(g(q1), g(q1)) X

Tree Automata CompletionConsider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions:a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3g(q1)→ q5

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4f(q3, q3)→ q4h(q5, q5)→ q4

is A compatible with R in L(A)?

f(q3, q0)→ q4 σ={x 7→q3,y 7→q0} Xf(g(q3), g(q0)) X

h(q0, q1)→ q4 σ={y 7→q1} Xh(g(q1), g(q1)) X

Tree Automata CompletionConsider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions:a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3g(q1)→ q5

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4f(q3, q3)→ q4h(q5, q5)→ q4

is A compatible with R in L(A)?

f(q3, q0)→ q4 σ={x 7→q3,y 7→q0} Xf(g(q3), g(q0)) X

h(q0, q1)→ q4 σ={y 7→q1} Xh(g(q1), g(q1)) X

Tree Automata CompletionConsider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions:a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3g(q1)→ q5

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4f(q3, q3)→ q4h(q5, q5)→ q4

is A compatible with R in L(A)?

f(q3, q0)→ q4 σ={x 7→q3,y 7→q0} Xf(g(q3), g(q0)) X

h(q0, q1)→ q4 σ={y 7→q1} Xh(g(q1), g(q1)) Xh(q0, q2)→ q4 σ={y 7→q2} Xh(g(q2), g(q2)) X

Tree Automata CompletionConsider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions:a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3g(q1)→ q5g(q2)→ q6

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4f(q3, q3)→ q4h(q5, q5)→ q4h(q6, q6)→ q4

is A compatible with R in L(A)?

f(q3, q0)→ q4 σ={x 7→q3,y 7→q0} Xf(g(q3), g(q0)) X

h(q0, q1)→ q4 σ={y 7→q1} Xh(g(q1), g(q1)) Xh(q0, q2)→ q4 σ={y 7→q2} Xh(g(q2), g(q2)) X

Tree Automata CompletionConsider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q4 and transitions:a→ q0b→ q1c→ q2

g(q0)→ q3g(q3)→ q3g(q1)→ q5g(q2)→ q6

f(q3, q0)→ q4h(q0, q1)→ q4h(q0, q2)→ q4f(q3, q3)→ q4h(q5, q5)→ q4h(q6, q6)→ q4

is A compatible with R in L(A)? Yes

f(q3, q0)→ q4 σ={x 7→q3,y 7→q0} Xf(g(q3), g(q0)) X

h(q0, q1)→ q4 σ={y 7→q1} Xh(g(q1), g(q1)) Xh(q0, q2)→ q4 σ={y 7→q2} Xh(g(q2), g(q2)) X

Timbuk

Live-demo

TimbukConsider the left-linear TRS R consisting of the rewrite rules:

f(x, y)→ f(g(x), g(y)) h(a, y)→ h(g(y), g(y))

and the tree automaton A with the final state q0 and transitions:a→ q1b→ q2c→ q3

g(q1)→ q4g(q4)→ q4g(q2)→ q5g(q3)→ q7

f(q4, q1)→ q0h(q1, q2)→ q0h(q1, q3)→ q0f(q4, q4)→ q0h(q5, q5)→ q0h(q7, q7)→ q0

is A compatible with R in L(A)? Yes

f(q3, q0)→ q0 σ={x 7→q3,y 7→q0} Xf(g(q3), g(q0)) X

h(q0, q1)→ q0 σ={y 7→q1} Xh(g(q1), g(q1)) Xh(q0, q2)→ q0 σ={y 7→q2} Xh(g(q2), g(q2)) X

l

t h

e n d

e

F = {l:3, h:3, d:0, e:0, n:0, t:0}