HAL Id: hal-00563293
https://hal.archives-ouvertes.fr/hal-00563293
Submitted on 4 Feb 2011
HAL is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or
L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires
Handling Left-Quadratic Rules When Completing Tree Automata
Yohan Boichut, Roméo Courbis, Pierre-Cyrille Héam, Olga Kouchnarenko
To cite this version:
Yohan Boichut, Roméo Courbis, Pierre-Cyrille Héam, Olga Kouchnarenko. Handling Left-Quadratic
Rules When Completing Tree Automata. 2nd Workshop on Reachability Problems in Computational
Models - RP’08, Sep 2008, Liverpool, United Kingdom. pp.61–70, �10.1016/j.entcs.2008.12.031�. �hal-
00563293�
Completing Tree Automata
Y. Boihut
1
, R. Courbis
2
, P.-C. Héam
2
and O. Kouhnarenko
2
1
INRIA/PAREO
615 rue duJardin BotaniqueBP-101 F-54602 Villers-Lès Nany Cedex
boihutloria.fr
2
INRIA/CASSIS andLIFC/ University of Franhe-Comté 16route deGray
F-25030 Besançon Cedex
lastname.firstnamelif.univ-fomte.fr
Abstrat
Thispaperaddresses thefollowing general problem of treeregular model-heking:
deide whether
R ∗ (L) ∩ L p = ∅
whereR ∗
is the reexive and transitive losure ofa suessor relationindued by aterm rewriting system
R
,andL
andL p
are bothregulartreelanguages.Wedevelopanautomati approximation-basedtehnique to
handle this undeidable in general problem in the ase when term rewriting
system rules are left-quadrati. The most ommon pratial ase is handled this
way.
Keywords: Rewritingtehniques, tree automata,left-linearity,seurity.
1 Introdution
Automati veriation of software systems is one of the most hallenging re-
searhproblemsinomputeraidedveriation.Inthisontext,regularmodel-
hekinghasbeenproposedasageneralframeworkforanalysingandverifying
innite state systems. In this framework, systems are modelled using regular
representations: the systems ongurations are modelled by nite words or
trees (of unbounded size) and the dynami behaviour of systems is modelled
either by a transduer or a (term) rewriting system. Afterwards, a system
reahability-basedanalysisisreduedtothe regularlanguageslosureompu-
tation under(term) rewriting systems: given a regularlanguage
L
,a relationR
indued by a (term) rewriting system and a regular setL P
of bad ong-urations, the problem is to deide whether
R ∗ (L) ∩ L p = ∅
whereR ∗
is thereexiveand transitivelosureof
R
. SineR ∗ (L)
isingeneralneitherregularnor deidable, several approahes handle restrited ases of this problem.
In this paper we address this problem for tree regular languages by auto-
matially omputing over- and under-approximations of
R ∗ (L)
. Computingan over-approximation
K over
ofR ∗ (L)
may be useful for the veriation ifK over ∩ L p = ∅
, proving thatR ∗ (L) ∩ L p = ∅
. Dually, under-approximation may be suitable to prove thatR ∗ (L) ∩ L p 6= ∅
. This approah is relevant ifthe omputed approximations are not too oarse. Another important point
is that in general, there are some restritions on the rewriting systems in or-
der to ensure the soundness of the above approah. This paper follows and
adapts an expert-human guided approximation tehnique introdued in [18℄
forleft-linearterm-rewritingsystems.Morepreisely,thepaper1)extendsthis
approahtotermrewritingsystemswithleft-quadratirules,and2)illustrates
itsadvantages on examples.
Related Work Given a term rewriting system
R
and two ground termss
and
t
, deidingwhethers → ∗ R t
is a entralquestion in automati proof the-ory. This problem is shown deidable for term rewriting systems whih are
terminatingbut itis undeidablein general.Several syntati lasses of term
rewritingsystemshavebeenpointedouttohaveadeidableaessibilityprob-
lem, for instane by providing an algorithm to ompute
R ∗ (L)
whenL
is aregular tree language [15,13,20,23,25,26℄. In [18℄, authors fous on a general
ompletion based human-guided tehnique. This tehnique has been suess-
fullyused(notautomatially)toprovethe seurityofryptographiprotools
[19℄andreentlyJavaByteodeprograms[5℄.Thisframeworkwasextendedin
[24℄tolanguages aepted byAC-treeautomata.Several work ontreeregular
modelheking are proposed in[9,1,8,21℄.
Layout of the paper Thepaperisorganised asfollows.Setion2introdues
notations and the basi ompletion approah. Next, Setion 3 presents the
maintheoretialontributionsofthe paper, whileSetion4desribesafamily
of examples and gives relatedseurity issues. Finally, Setion5 onludes.
2 Preliminaries
2.1 Terms and TRSs
Comprehensivesurveys anbefound in[16,2℄forterm rewritingsystems,and
in[12,20℄ for tree automata and tree languagetheory.
Let
F
beanitesetofsymbols,assoiatedwithanarityfuntionar : F → N
,and let
X
be a ountable set of variables.T (F , X )
denotes the set of terms,and
T (F )
denotes the set of groundterms (termswithoutvariables).The set of variables of a termt
is denoted byV ar(t)
. A substitution is a funtionσ
from
X
intoT (F , X )
, whih an be extended uniquely to an endomorphism ofT (F , X )
. A positionp
for a termt
is a word overN
. The empty sequeneǫ
denotes the top-most position. The setP os(t)
of positions of a termt
isindutively dened by:
P os(t) = {ǫ}
ift ∈ X
andPos(f (t 1 , . . . , t n )) = {ǫ} ∪ {i.p | 1 ≤ i ≤ n
andp ∈ P os(t i )}
. Ifp ∈ Pos(t)
, thent| p
denotes the subtermof
t
at positionp
andt[s] p
denotes the term obtained by replaement of thesubterm
t| p
at positionp
by the terms
. We also denote byt(p)
the symbolourring in
t
atpositionp
. Given a termt ∈ T (F , X )
, wedenoteP os A (t) ⊆ P os(t)
the set of positions oft
suh thatP os A (t) = {p ∈ Pos(t) | t(p) ∈ A}
.Thus
P os F (t)
isthe set of funtional positionsoft
.A term rewriting system (TRS)
R
is a set of rewrite rulesl → r
, wherel, r ∈ T (F , X )
andl 6∈ X
. A rewrite rulel → r
is left-linear (resp. right- linear) if eah variable ofl
(resp.r
) ours only one withinl
(resp.r
). ATRS
R
isleft-linear(resp.right-linear)if every rewriterulel → r
ofR
isleft-linear (resp. right-linear). A TRS
R
is linear if it isright and left-linear.The TRSR
indues a rewriting relation→ R
on terms whose reexive transitivelosure is written
→ ⋆ R
. The set ofR
-desendants of a set of ground termsE
is
R ∗ (E) = {t ∈ T (F) | ∃s ∈ E
s.t.s → ⋆ R t}
.2.2 Tree Automata Completion
Notethat
R ∗ (E)
ispossibly innite:R
may not terminate and/orE
may beinnite.Theset
R ∗ (E)
isgenerallynotomputable[20℄.However,itispossibletoover-approximate it [18℄ using tree automata,i.e. anite representation of
innite(regular) sets of terms. We next dene tree automata.
Let
Q
be aniteset of symbols,ofarity0
,alledstates suh thatQ ∩ F = ∅
.T (F ∪ Q)
is alled the set of ongurations A transition is a rewrite rulec → q
, wherec ∈ T (F ∪ Q)
is a onguration andq ∈ Q
. A normalisedtransition is a transition
c → q
wherec = f(q 1 , . . . , q n )
,f ∈ F
,ar(f) = n
,and
q 1 , . . . , q n ∈ Q
.Abottom-upnon-deterministinitetree automaton(tree automaton for short) is a quadrupleA = hF , Q, Q f , ∆i
,Q f ⊆ Q
and∆
is a nite set of normalised transitions. The rewriting relation on
T (F ∪ Q)
indued by the transition set
∆
ofA
is denoted→ ∆
. When∆
is lear fromthe ontext,
→ ∆
is alsowritten→ A
. The tree language reognised byA
in astate
q
isL(A, q) = {t ∈ T (F ) | t → ⋆ A q}
. The language reognised byA
isL(A) = S q∈Q f L(A, q)
.Atreelanguageisregularifandonlyifitisreognisedby a tree automaton.
ability analysis. Given a tree automaton
A
and a TRSR
, the tree automataompletion algorithm proposed in [18℄ omputes a tree automaton
A k R
suhthat
L(A k R ) = R ∗ (L(A))
when it is possible (for the lasses of TRSs whereanexatomputationispossible,see [18℄),andsuhthat
L(A k R ) ⊇ R ∗ (L(A))
otherwise.
The tree automata ompletion works as follows. From
A = A 0 R
ompletionbuilds a sequene
A 0 R , A 1 R . . . A k R
of automata suh that ifs ∈ L(A i R )
ands → R t
thent ∈ L(A i+1 R )
. If there is a x-point automatonA k R
suh thatR ∗ (L(A k R )) = L(A k R )
, thenL(A k R ) = R ∗ (L(A 0 R ))
(orL(A k R ) ⊇ R ∗ (L(A))
if
R
is in no lass of [18℄). To buildA i+1 R
fromA i R
, a ompletion step isahieved. Itonsistsof ndingritialpairs between
→ R
and→ A i
R
. Todene
the notion of ritial pair, the substitution denition is extended to terms in
T (F ∪ Q)
. For a substitutionσ : X 7→ Q
and a rulel → r ∈ R
suh thatVar(r) ⊆ Var(l)
,ifthereexistsq ∈ Q
satisfyinglσ → ∗ A i
R q
thenlσ → ∗ A i
R q
andlσ → R rσ
isaritialpair. NotethatsineR
andA i R
isnite,there isonlyanite number of ritial pairs. Thus, for every ritial pair deteted between
R
andA i R
suh thatrσ 6→ ∗ A i
R q
, the tree automatonA i+1 R
is onstrutedby adding a new transition
rσ → q
toA i R
. Consequently,A i+1 R
reognisesrσ
inq
, i.e.rσ → A i+1
R q
. However, the transitionrσ → q
is not neessarilynormalised.Then,weuseabstrationfuntionswhosegoalistodeneasetof
normalised transitions
Norm
suh thatrσ → ∗ N orm q
. Thus, instead of addingthe transition
rσ → q
whih isnot normalised,the set oftransitionsNorm
isadded to
∆
,i.e., the transitionset of the urrentautomatonA i R
.Wegivebelowaverygeneraldenitionof abstrationfuntionswhihallotto
eahfuntionalpositionof
rσ
astateofQ
.The roleofanabstrationfuntionremains to dene equivalene lasses of terms where one lass orresponds
to one state of
Q
. An abstration funtionγ
is a funtionγ : ((R × (X → Q)×Q) 7→ N ∗ ) 7→ Q
suhthatγ(l → r, σ, q)(ǫ) = q
.Thus,givenanabstrationfuntion
γ
, the normalisation of a transitionrσ → q
is dened as follows.Let
γ
be an abstration funtion,∆
be a transition set,l → r ∈ R
withVar(r) ⊆ Var(l)
andσ : X → Q
suh thatlσ → ∗ ∆ q
.Theγ−
normalisation of the transitionrσ → q
,writtenNorm γ (l → r, σ, q)
, is dened by:Norm γ (l → r, σ, q) = {r(p)(β p.1 , . . . , β p.n ) → β | p ∈ Pos F (r),
β =
q if p = ǫ
γ(l → r, σ, q)(p) otherwise.
β p.i =
σ(r(p.i)) if r(p.i) ∈ X
γ(l → r, σ, q)(p.i) otherwise.
Example 1 Let
A = hF, Q, Q f , ∆i
be the tree automaton suh thatF = {a, b, c, d, e, f, ω}
withar(s) = 1
withs ∈ {a, b, c, d, e, f }
andar(ω) = 0
,Q = {q b , q f , q ω }
,Q f = {q f }
and∆ = {ω → q ω , b(q ω ) → q b , a(q b ) → q f }
.Thus,
L(A) = {a(b(ω))}
. Given the TRSR = {a(x) → c(d(x)), b(x) → e(f(x))}
, two ritial pairs are omputed:a(q b ) → ∗ A q f
,a(q b ) → R c(d(q b ))
and
b(q ω ) → ∗ A b(q ω ) → R e(f (q ω ))
. Letγ
be the abstration funtion suh thatγ(a(x) → c(d(x)), {x → q b }, q f )(ǫ) = q f
,γ(a(x) → c(d(x)), {x → q b }, q f )(1) = q f
,γ(b(x) → e(f(x)), {x → q ω }, q b )(ǫ) = q b
andγ(b(x) → e(f(x)), {x → q ω }, q b )(1) = q b
. So,Norm γ (a(x) → c(d(x)), {x → q b }, q f ) = {d(q b ) → q f , c(q f ) → q f }
andNorm γ (b(x) → e(f (x)), {x → q ω }, q b ) = {f (q ω ) → q b , e(q b ) → q b }
.Nowweformallydenewhataompletionstepis.Let
A = hF , Q, Q f , ∆i
beatreeautomaton,
γ
anabstrationfuntionandR
aleft-linearTRS.Wedene atree automatonC γ R (A) = hF , Q ′ , Q ′ f , ∆ ′ i
with:• ∆ ′ = ∆ ∪ S l→r∈R, σ:X 7→Q, lσ→ ∗ A q,rσ6→ ∗ A q Norm γ (l → r, σ, q)
,• Q ′ = {q | c → q ∈ ∆ ′ }
and• Q ′ f = Q f
.Example 2 Given
A
,R
andγ
of Example 1, performing one ompletionstep on
A
gives the automatonC γ R (A)
suh thatC γ R (A) = hF , Q, Q f , ∆ ′ i
where
∆ ′ = ∆ ∪ Norm γ (a(x) → c(d(x)), {x → q b }, q f ) ∪ Norm γ (b(x) → e(f(x)), {x → q ω }, q b ) = {ω → q ω , b(q ω ) → q b , a(q b ) → q f , d(q b ) → q f , c(q f ) → q f , f(q ω ) → q b , e(q b ) → q b }
.NotiethatC γ R (A)
isR
-lose,andinfatanover-approximation of
R ∗ (L(A))
is omputed. Indeed, the tree automatonC γ R (A)
reognises the term
a(e(e(f(ω))))
whenR ∗ (L(A)) = {a(b(ω)), a(e(f(ω))), c(d(b(ω))), c(d(e(f(ω))))}.
Proposition 3 ([18, Theorem 1℄) Let
A
be a tree automaton andR
be aTRSsuhthat
A
isdeterministiorR
isleft-linear,and foreveryl → r ∈ R
,Var(r) ⊆ Var(l)
. For any abstration funtionγ
, one has:L(A) ∪ R(L(A)) ⊆ C γ R (A).
Inaddition,anabstrationfuntionsan bedened insuhaway onlyterms,
atually reahable, will be omputed. This lass of abstration funtions is
alled
(A, R)−
exat abstration funtionsin [3℄.Let
A = hF , Q, Q f , ∆)
be a tree automaton andR
be a TRS. LetIm(γ) = {q | ∀l → r ∈ R, ∀p ∈ P os F (r) s.t. γ(l → r, σ, q)(p) = q}
. An abstrationfuntion
γ
is(A, R)−
exat ifγ
is injetiveandIm(γ) ∩ Q = ∅
.ByadaptingtheproofofTheorem2in[18℄tothenewlassofabstrations,we
showthatwithsuhabstrationfuntions,onlyreahabletermsareomputed.
Theorem 1 ([18, Theorem 2℄) Let
A
beatreeautomatonandR
beaTRSsuh that
A
is deterministi orR
is right-linear. Letα
be an(A, R)−
exatabstration funtion. One has:
C α R (A) ⊆ R ∗ (L(A))
.We now give the general result in [18℄ saying that, if there exists a x-point
automaton, then its language ontains all the terms atually reahable by
rewriting, atleast.
(A, R)−
exat abstrationfuntions.Theorem 2 ([18, Theorem 1℄) Let
A
,R
andγ
be respetively a tree au- tomaton,a TRS.For any abstration funtion,ifthereexistsN ∈ N
andN ≥ 0
suh that(C γ R ) (N) (A) = (C γ R ) (N +1) (A)
, thenR ∗ (L(A)) ⊆ L((C γ R ) (N) (A)).
The above method doesnot work for all TRSs. Forinstane, onsider aon-
stant
A
andthetreeautomatonA = ({q 1 , q 2 , q f }, {A → q 1 , A → q 2 , f(q 1 , q 2 ) → q f }, {q f })
andtheTRSR = {f (x, x) → g(x)}
.Thereisnosubstitutionσ
suhthat
lσ → ∗ A q
, for aq
in{q 1 , q 2 , q f }
. Thus, following the proedure, there isno transition to add. But
f(A, A) ∈ L(A)
. Thusg(A) ∈ R(L(A))
. Sineg(A) ∈ L(A) /
, the proedure stops (in fat does not begin) before providinganover-approximation of
R ∗ (L(A))
.3 Contributions
This setionextends anapproximation-basedtehnique introdued in[18℄ for
left-linearterm-rewritingsystems, to TRSs with left-quadratirules.
Let
A = (Q, ∆, Q f )
be a nite bottom-up tree automaton. The automatonA = (Q , ∆ , Q f )
isdened by:• Q = {{q} | q ∈ Q} ∪ {{q 1 , q 2 } | q 1 , q 2 ∈ Q}
(states ofQ
are denoted witha
exponent),• Q f = {{q} | q ∈ Q f }
,• ∆ = {f (q 1 , . . . , q n ) → q | ∀q ∈ q , ∃q 1 , . . . , q n ∈ Q, ∀1 ≤ i ≤ n, q i ∈ q i
andf (q 1 , . . . , q n ) → q ∈ ∆}
.To illustratethe denition above, let's onsider the automaton
A
whosenalstate is
q f
and whose transitions areA → q 1
,A → q 2
andf (q 1 , q 2 ) → q f
.The states of
A
are all pairs of states and singletons over{q 1 , q 2 , q f }
, andthe transitions are
A → {q 1 }
,A → {q 2 }
,A → {q 1 , q 2 }
,f ({q 1 }, {q 2 }) → {q f }
,f({q 1 , q i }, {q 2 , q j }) → {q f }
for alli, j ∈ {1, 2, f}
. When onsidering only theaessible states, among allthe transitions above we just have the transition
f({q 1 , q 2 }, {q 2 , q 1 }) → {q f }
(i = 2
andj = 1
).Proposition 4 Onehas
L(A) = L(A )
.Proof. Bydenitionof
A
,iff(q 1 , . . . , q n ) → q ∈ ∆
,thenf ({q 1 }, . . . , {q n }) → {q} ∈ ∆
. Consequently, for every termt
suh thatt → ∗ A q
, one also hast → ∗ A {q}
. Sinefor everyq f ∈ Q f
,{q f } ∈ Q f
,L(A) ⊆ L(A )
.Itremainstoprovethat
L(A ) ⊆ L(A)
.Wewillproveby indutiononk
thatfor every
k ≥ 1
, for every termt
, every stateq
ofA
, ift → k A q
, then forall
q ∈ q
,t → k A q
.•
Ift → A q
, then, by denition of∆
,t
is a onstant and for allq ∈ q
,thereexists atransition
t → q
ofA
.•
Assumenow that the laim is truefor a xed positiveintegerk
. Lett
be aterm and
q ∈ A
suh thatt → k+1 A q
. Consequently, there existsf ∈ F n
suh that
t → k A f (q 1 , . . . , q n ) → A q
. It follows thatt = f(t 1 , . . . , t k )
and for all
1 ≤ i ≤ k
,t i → k A q i
. Usingthe indution hypothesis,t i → k A q i
,forall
q i ∈ q i
.Consequently, for allq ∈ q
,f (q 1 , . . . , q n ) → q ∈ ∆
, provingthe indution.
So,
L(A ) ⊆ L(A)
.2
Lemma 5 If
C[q 1 , . . . , q n ] → ∗ A q
and ifq 1 , . . . q n
are states ofA
satisfyingq i ∈ q i
for all1 ≤ i ≤ n
, thenC[q 1 , . . . , q n ] → ∗ A {q}
.Proof. Weprovebyindutionon
k
thatforeveryk ≥ 1
,ifC[q 1 , . . . , q n ] → k A q
and if
q 1 , . . . q n
are states ofA
satisfyingq i ∈ q i
for all1 ≤ i ≤ n
, thenC[q 1 , . . . , q n ] → k A {q}
.•
Ifk = 1
,thenC[q 1 , . . . , q n ] → q
isatransitionofA
.Therefore,by denitionof
∆
,C[q 1 , . . . , q n ] → {q}
isa transitionofA
.•
Assumenowthatthepropositionistrueforallj ≤ k
andthatC[q 1 , . . . , q n ] → k+1 A q
. There existq 1 ′ , . . . , q ℓ ′
states ofA
andf ∈ F ℓ
suh thatC[q 1 , . . . , q n ] → k A f(q ′ 1 , . . . , q ℓ ′ ) → A q
.Consequently,C[q 1 , . . . , q n ]
isoftheformC[q 1 , . . . , q n ] = f(t 1 , . . . , t ℓ )
where thet i
's are terms overF ∪ {q 1 , . . . , q n }
. Moreover, forall
i
, there existsk i ≤ k
suh thatt i → k A i {q i ′ }
andP i k i = k
. There-fore, by indution hypothesis,
t i → k A i {q i ′ }
wheret i
is the term obtainedfrom
t i
by substitutingq i
byq i
. Now, sinef(q 1 ′ , . . . , q ℓ ′ ) → q
is a tran-sition of
A
,f ({q 1 ′ }, . . . , {q ℓ ′ }) → {q}
is a transition ofA
. It follows thatC[q 1 , . . . , q n ] → k+1 A {q}
, provingthe lemma.2
Lemma 6 If
t → ∗ A q 1
andt → ∗ A q 2
, thent → ∗ A {q 1 , q 2 }
.Proof. If
t → ∗ A q 1
andt → ∗ A q 2
, then there exists a funtionπ 1
(reps.π 2
)from positions of
t
intoQ
suh thatπ 1 (ε) = q 1
(resp.π 2 (ε) = q 2
) and forevery position
p
oft
,ift p ∈ F n
,thent(p)(π 1 (p.1), . . . , π 1 (p.n)) → π 1 (p)
(resp.t(p)(π 2 (p.1), . . . , π 2 (p.n)) → π 2 (p)
) is a transitionofA
. Therefore, by deni-tion of
∆
,t(p)({π 1 (p.1), π 2 (p.1)}, . . . , {π 1 (p.n), π 2 (p.n)}) → {π 1 (p), π 2 (p)}
isin
∆
. It follows thatt → ∗ A {q 1 , q 2 }
.2
Proposition 7 If
R
isleft-quadrati, thenR(L(A)) ∪ L(A) ⊆ L(C γ (A ))
.Proof. Sine
L(A) = L(A )
and sineL(A ) ⊆ L(C γ (A ))
,L(A) ⊆ L(C γ (A ))
.Let
t ∈ R(L(A))
.By denition there exists a rulel → r ∈ R
, a positionp
oft
and a substitutionµ
fromX
intoT (F)
suh thatt = t[rµ] p
andt[lµ] p ∈ L(A)
(1)It follows thereexist states
q, q f
ofA
suh thatq f
isnal,lµ → ∗ A q
andt[q] p → ∗ A q f .
(2)Consequently,
lµ → ∗ A {q}
andt[{q}] p → ∗ A {q f }.
(3)If
rµ → ∗ A {q}
, then (3) implies thatt[rµ] p → ∗ A {q f }
. In this ase, sinet = t[rµ] p
and sine{q f }
is by onstrution anal state ofA
,t
is inL(A )
,whih is asubset of
L(C γ (A ))
.Now wemay assumethat
rµ 6→ ∗ A {q}
.LetP l
bethe set of variable positionsof
l
; i.e.P l = {p | l(p) ∈ X )}
. SetP l = {p 1 , . . . , p ℓ }
. Sinelµ → ∗ A q
, by (2)there existstates
q 1 , . . . , q ℓ
ofA
suh thatµ(l(p i )) → ∗ A q i
andl[q 1 ] p 1 . . . [q ℓ ] p ℓ → ∗ A q.
(4)We denethe substitution
σ
fromvariablesourringinl
into2 Q
by:σ(x i ) = {q i | l(p i ) = x i }
. Sinel
is left-quadrati, for eahx i
,σ(x i )
ontains atmosttwo states. We laim that
lσ → ∗ A q
. Indeed by (4) and by Lemma 6for eahx i
ourring inl
,µ(x i ) → ∗ A σ(x i )
. It follows thatlµ → ∗ A lσ
. By (4) andusing Lemma 5,
lσ → ∗ A {q}
, proving the laim. By onstrution ofC γ (A )
,rσ → ∗ C γ (A ) {q}
. Moreover, by denition ofσ
,rµ → ∗ A rσ
. It follows thatt = t[rµ] p → ∗ A t[rσ] p → ∗ C γ (A ) t[{q}] p → ∗ A {q f },
whih ompletes the proof.
2
Proposition 8 If
R
isright-linearandifα
is(A, R)
-exat,thenL(C γ (A )) ⊆ R ∗ (L(A))
.Proof. This is a diretonsequene of Theorem 1and Proposition 4.
2
4.1 Example
We have tested our approah on the following family of examples. We rst
onsider afamilyoftree automata
(A n )
dened asfollows:the set ofstates ofA n
is{q 1 , . . . , q 2n+2 , q f }
,thesetofnalstateis{q f }
,andtheset oftransitions is{ω → q 1 , ω → q 2 , a(q 1 ) → q 1 , a(q 2 ) → q 2 , b(q 1 ) → q 1 , b(q 2 ) → q 2 , a(q 1 ) → q 3 , a(q 2 ) → q 4 , a(q i ) → q i+2 , b(q i ) → q i+2 , f(q 2n+1 , q 2n+2 ) → q f }
, fori ≥ 3
.The automaton
A n
aepts the set of terms of the formf (t 1 , t 2 )
wheret 1
and
t 2
are terms over{a, b, ω}
suh thatt 1 | 1 n−1
andt 2 | 1 n−1
exist and are in{a}.{a, b} ∗
. Roughly speaking, when using word automata,a(b(ω))
denotesab
, and eah pair(t 1 , t 2 )
an be viewed as words ofL = {a, b} n−1 .{a}.{a, b} ∗
satisfyingthe onditionabove. We seondonsider the termrewriting system
R
ontainingthesinglerulef (x, x) → x
,andwewanttoprovethatb n−1 a(ω) ∈ R ∗ (L(A n ))
.UsingnitelymanytimesTheorem1diretlyonA n
maynotprovethe results. However, to prove the results, one an determinise
A n
beforeusing Theorem 1. But, the minimal automaton of
L(A n )
has2 n
states atleast [22℄, [Exerise 3.20, p. 73℄. Then, the ompletion should be applied to
this automaton. Consequently, this automati proof requires an exponential
timestep. Usingour approah,one anompute
A
and applyProposition8, that providesthe proofrequiring a polynomialtime step.4.2 Left-linearity and Seurity Issues
4.2.1 Seurity Protool Analysis
The TRSs used in the seurity protool veriation ontext are often non
left-linear.Indeed, there isa lot of protools that annotbemodeledby left-
linear TRSs. Unfortunately, to be sound, the approximation-based analysis
desribedin[19℄requirestheuseofleft-linearTRSs.Nevertheless,thismethod
an stillbe applied to some non left-linear TRSs, whih satisfy some weaker
onditions. In [17℄ the authors propose new linearity onditions. However,
these new onditions are not well-adapted to be automatiallyheked.
In our previous work [6℄ we explain how to dene a riterion on
R
andA
tomakethe proedure automatiallywork forindustrialprotoolsanalysis. This
riterion ensures the soundness of the method desribed in [19,17℄. However,
tohandle protools the approah in[6℄is basedon akind ofonstant typing.
In [7℄ we go further and propose a proedure supporting a fully automati
analysis and handling withouttyping algebrai properties likeXOR.
theXORnon-leftlinearrule.Seond,in[6℄wehaverestritedXORoperationsto
typedtermstodealwiththeXORnon-leftlinearrule.However, someprotools
are known tobe awed by type onfusing attaks [14,10,11℄.Notie that our
approah in [7℄ an be applied to any kinds of TRSs. Moreover, it an ope
with exponentiation algebraiproperties and this way analyse Die-Hellman
based protools.
4.2.2 Bakward Analysis of Java Byteode
A reent work [4℄, dediated tothe stati analysis of Java byteode programs
using term-rewritingsystems, providesanautomati proeduretotranslatea
Java byteode into a term rewriting system modeling the ode exeution on
the JavaVirtual Mahine. In this ontext, generated TRSs are left-linearbut
right-quadrati. In order to ompute approximation renements as in [3℄ or
to manage bakward analyses that are in general and in pratie more
eient that forward analyses term rewriting systems have to be turned
left-right,i.e.left-and right-hand sides of rules have tobepermuted. Bythis
permutationright-quadratiTRSs beomeleft-quadrati ones.
5 Conlusion
Regularapproximation tehniques have been suessfully used in the ontext
of seurity protool analysis. In order to apply them to other appliations,
thispaperproposedanextensionoftheompletionproedureforhandlingleft-
quadratirules.Ourontributionsallowanalysingsomereahabilityproblems
usingpolynomialsteps omputing
A
,ratherthan automata determinisation steps that are exponential, even in pratial ases. Notie that the approahpresented only for quadrati rules an be extended to more omplex TRSs.
We intend to optimise this tehnique: polynomial is better than exponential
butmay alsoleadtohuge automatainfewsteps.Wehavebeen implementing
the tehniques in an eient rewriting tool in order to investigate omplex
systems bakward analyses.
Referenes
[1℄ Parosh Aziz Abdulla, Bengt Jonsson, Pritha Mahata, and Julien d'Orso.
Regular tree model heking. In Ed Brinksma and Kim Guldstrand Larsen,
editors,ComputerAidedVeriation,volume2404ofLetureNotesinComputer
Siene, pages555568. Springer-Verlag,July 2731 2002.
Press,1998.
[3℄ Y. Boihut, R. Courbis, P.-C. Héam, and O. Kouhnarenko. Finer is better:
Abstrationrenement for rewriting approximations. In RTA'08,LNCS, 2008.
To appear.
[4℄ Y.Boihut,Th.Genet,Th.Jensen,and L.Le Roux. Rewritingapproximations
for fast prototyping of stati analyzers. In proeedings of RTA, LNCS 4533,
pages4862. Springer,2007.
[5℄ Y. Boihut, Th. Genet, Th. P. Jensen, and L. Le Roux. Rewriting
approximationsforfastprototyping ofstatianalyzers.InFranzBaader,editor,
Term Rewriting and Appliations, 18th International Conferene, RTA 2007,
Paris,Frane, June 26-28,2007, Proeedings, volume4533 ofLNCS,pages48
62.Springer, 2007.
[6℄ Y. Boihut, P.-C. Héam, and O. Kouhnarenko. Automati Veriation of
SeurityProtools Using Approximations. Tehnial Report RR-5727, INRIA,
2005.
[7℄ Y.Boihut, P.-C. Héam,and O. Kouhnarenko. Handling algebrai properties
inautomatianalysisofseurityprotools.InKamelBarkaoui,AnaCavalanti,
andAntonioCerone,editors, ICTAC'06,volume 4281of LNCS,pages153167.
Springer,2006.
[8℄ A. Bouajjani, P. Habermehl, A. Rogalewiz, and T. Vojnar. Abstrat regular
treemodelheking.InInnity'05,volume149ofEletroniNotesinTheoretial
ComputerSiene, pages3748, 2006.
[9℄ Ahmed Bouajjani and Tayssir Touili. Extrapolating tree transformations. In
EdBrinksmaandKimGuldstrandLarsen,editors,ComputerAidedVeriation,
volume 2404 of Leture Notes in Computer Siene, pages 539554. Springer-
Verlag,July 27312002.
[10℄L.Bozga, Y. Lakhneh, and M. Perin. Pattern-based abstration for verifying
serey inprotools. In9th International Conferene on Tools and Algorithms
fortheConstrutionandAnalysisofSystems,TACAS2003,Proeedings,volume
2619 ofLNCS.Springer-Verlag,2003.
[11℄I. Cibrario, L. Durante, R. Sisto, and A. Valenzano. Automati detetion
of attaks on ryptographi protools: A ase study. In Christopher Kruegel
Klaus Julish, editor, Intrusion and Malware Detetion and Vulnerability
Assessment: Seond International Conferene, volume 3548 of LNCS, Vienna,
2005.
[12℄H.Comon, M. Dauhet, R. Gilleron, F. Jaquemard, D. Lugiez, S.Tison, and
M. Tommasi. Tree AutomataTehniquesand Appliations, 2002.
[13℄J.-L. Coquidé, M. Dauhet, R. Gilleron, and Vágvölgyi S. Bottom-up tree
pushdownautomataandrewritesystems.InRonaldV.Book,editor,Rewriting
TehniquesandAppliations,4thInternationalConferene,RTA-91,LNCS488,
pages287298, Como,Italy,April1012,1991. Springer-Verlag.
inryptographiprotools. Journalof Computer Seurity,14:143,2006.
[15℄DauhetandTison. Thetheoryofgroundrewritesystemsisdeidable.InLICS:
IEEE Symposiumon Logi in Computer Siene, 1990.
[16℄N.DershowitzandJ.-P.Jouannaud. HandbookofTheoretialComputerSiene,
volume B, hapter 6: Rewrite Systems, pages 244320. Elsevier Siene
Publishers B.V,1990.
[17℄G.Feuillade,Th.Genet,andV.VietTriemTong. Reahabilityanalysisofterm
rewriting systems. Tehnial Report RR-4970, INRIA, 2003. To be published
inJournal ofAutomated Reasoning,2004.
[18℄G.Feuillade,Th.Genet,andV.VietTriemTong.Reahabilityanalysisoverterm
rewritingsystems. Journal of Automated Reasonning,33 (3-4),2004.
[19℄Th. Genet and F. Klay. Rewritingfor Cryptographi ProtoolVeriation. In
proeedings of CADE, volume 1831 of LNCS, pages 271290. Springer-Verlag,
2000.
[20℄R. Gilleron and S. Tison. Regular tree languages and rewrite systems.
Fundamenta Informatia,24(1/2):157174, 1995.
[21℄P. Habermehl, R. Iosif, A. Rogalewiz, and T. Vojnar. Abstrat regular
tree model heking of omplex dynami data strutures. In SAS'06, 13th
International Stati Analysis Symposium, volume 4134 of LNCS,pages 5270,
2006.
[22℄J. Hoproft and J. D. Ullman. Introdution to Automata Theory, Languages,
andComputation. Addison-Wesley,1979.
[23℄F. Jaquemard. Deidable approximations of term rewriting systems. In
proeedings of RTA,volume 1103,pages 362376. Springer Verlag, 1996.
[24℄H. Ohsaki and T. Takai. ACTAS: A system design for assoiative and
ommutative tree automata theory. Eletr. Notes Theor. Comput. Si,
124(1):97111,2005.
[25℄P.RétyandJ.Vuotto. Regularsets ofdesendantsbyleftmoststrategy. Eletr.
NotesTheor. Comput.Si, 70(6), 2002.
[26℄K.Salomaa. Deterministitreepushdownautomataandmonaditreerewriting
systems. JCSS:Journal of Computer and SystemSienes,37,1988.