Let
o:
and (3 b any strings. By �( o:,(3),
we denote the number of occurrences of (3 in o:. The 1 ngth of a. stringo:
is d noted by Io:
J. Thei
th symbol of o: from the left is denoted byo:[i].
Let x be a symbol not belonging to any finite alphabet�.
Every1r E
(
.:..J U{
x}
)+ is called a. one-variable pattern and x is referred to as the patternva.ria.bl of 1r. If � ( 1r, x
) � 1
then th pat tern 1r i called proper. The set of all onevariable pattern is denoted by P1, and for any pattern 1r, the language* of 1r is already defined.
Let * be a sp cial symbol not belonging to
�
U { x }. A stringw E (�
U {*})
+ iscalled incomplete if �(
w,
*)� 1 .
L t T and F b finit subsets of (�U
{ *} )+ such that T n F =0.
A m mber of T is called a po itive xample and a 1nemb r of F is said to be a negative example. Th ind finite value of a string containing* is assigned by the following function.DEFINITION 5.2.1. For any alphabet
�'
the expression <I>E denotes the set of allc.p:
(� U
{*})+ -+�+ such that c.pE
<I>E iff for eachwE (� U
{*})+, if�(w,*)
= 0,then
c.p(w)
=w,
and if �(w,*)� 1,
thenc.p(w)
is a stringw' E �lwl
such that for any1 :::; i:::;
Jwl andw[i] =1-
*,w'[i]
=w[i].
*Note that no erasing substitution is assumed in this study.
Let T,
F �
L.J +. A pattern 1r EP1
is said to be consistent with the T U F if T� L(
1r)
and F nL(
1r)
=0.
Thus, if there is a consistent pattern for T U F, then such a pattern can be thought of as explaining th data given. Moreover, since every pattern language generated by a proper pattern is infinite, a consistent pattern for T U F can b also regard d as a generalization or extension of the data sets T and F.Following Boros t
al. [14],
w next give the semantics of*·DEFINITION 5.2.2. LetT and F be any finit subsets of (�U {*})+such that TnF =
0.
There is an extension for T U F iff there exists a pattern 1r EP1
such that 1r is consistent with T U F. There is a consistent extension for T U F iff there exists a pattern1r
EP1
and a r.p E <l>r; such that 1r is consistent with r.p(T) U r.p( F). Moreover, there is a 1obust extension for T U F iff there exists a pattern 1r EP1
such that1r
is consist n t with r.p(T) U r.p( F) for all r.p E <I>r;.PROBLEM 5.2.1. The extension p1oblem, denoted by E, is to decide, on input any sets T, F
�
�+ wheth r there exists an extension for T U F. The con i tent extension p1oblem, denoted by CE is to decide, on input any sets T, F�
(� U { *})+,
whetherthere exists a consistent extension for T U F. F inally, the Tobust extension problem, denoted by RE, is to de ide, on consistent ext nsion ( abbr. CE) is the problem to decid d on input any ts T, F
�
(� U { *}
)+ wh ther there exists a robust extension forTUF.Clearly, the complexity of th s problems i m asured in the length of the input.
Next we x mplify these probl rns.
EXAMPLE 5.2.1. Let � = {
a
,b,
c}
, T ={abacababacacabaca abacabaca }
and F ={
aabaacabaca}.
Then, there are thre patterns 1r1 = x1r2
=xbxcabaca
and 1r3 =abacabxcx
that are consist nt with T, but1r1
and1r2
ar not consistent with F becauseJri[aabaacabacajx]
=1r2[aajx]
=aabaacabaca.
On the other hand, 1r3 is consist nt with T U F, and thus, there exists an extension ofT U F.Next, let T =
{ abacababacacabaca, abacabaca }
and let F = { *abb
*cabaca } .
Then, the answer to CE is "yes," since1r
=xbxcabaca
is consistent with T U r.p( F) for r.p( *abb*c
a
baca
) =aabbacabaca
such that1r2
is consistent with T and r.p(F).Finally, let T
= {a* b, ab * aba * cb}
and F ={ bb * cba}.
Then, the 7f= axb
is consistent with <p(T) and <p(F) for every <p E <I>E. Thus, in this case, there exists a robust extension.In this study, w generally assume that
11�11 2: 2
because of the following reasons.L t LJ consi t of on symbol, say �
= {a}.
Then, there exist trivial reductions fromCE
to E and from RE toE
by replacing all * in giv n strings by the same symbola.
For each wE�+ let
Lw(i,j) = {1r
E P1I �(1r,a) = i, �(1r,x)
=j, 1r[ujx] =
w,lui=
(lwl- i)/ j}
. Sin e11�11 =
1, for any w,w' E �+and 1:::;i,j:::;
min{lwl,lw'l},
it holds thatLw(i,j) = Lw'(i,j)
iffLw(i,j)nLw'(i,j) =/- 0.
Thus, if11�11 =
1, then the problemE,
CE and RE ar d cidable in time polynomial in th size of the sum of the length of given strings.We first study th complexity of problems E and
CE.
First of all, we would like to establish an upp r bound for the complexity of these problems (i.e., we aim to show that both ar in NP). This is straightforward forE,
since membership for one-variable patterns is in P(
cf.[1]).
Thus, we may just guess a pattern 7r and check whether or not all strings from T ar contained inL( 1r),
and none of the strings from F does behave thus. Therefore, it is only natural to try the same approach forCE.
However, this imm diat ly l ad us to the following version of th membership problem.PROBLEM 5.2.2. For any given w E (� U
{ *} )
+ and 7r E P1 th existential membership probl m denoted by
3M EM (
7r, w), is to d ide whether there exi ts a <p E <I>E such that <p(
w)
EL(1r).
LEMMA 5.2.1.
3MEM(7r,
w) E P.PROOF. L t 7r
= v1xv2x
· · · VnXVn+I be th input pattern, wherevi
E �* for all1 :::;
i:::; n
+ 1. First, w che k whether or notlwl 2: l1rl
inO(l1rl
+lwl)
time.If
lwl
<l1rl,
then <p(
w) rJ_ L(1r)
for all <p E <I>E· Iflwl 2: l1rl,
then we computem = lwl-
LI�i�n+Ilvil
and test wh ther or notm/n
is a positive integer. This can be done inO(lwl)
time. Ifm/n
is not a positive integ r, then ther exists no substitutionu such that
1r[ujx] =
w. Now, let k =m/n
be a positive integ r. Th n, w is of the form w=
w1s1w2s2 · · · WnSnWn+I such that for each 1:::; i :::; n
+ 1,lwil = lvil
andls1l =
· · · =l
snI
= k.We can ch ck wh ther or not there exists an 1
:::; i :::;
n +1
and a 1:::; j :::; lvil
such that
vi [j] # wi [j]
andwi [j] #
*inO(lwl).
If there exists suchi
andj,
thenc.p( w) �
L( 1r) for anyc.p
E <I>L:. If not for each 1:::; j :::;
n, we next compute the string CXj = si[j]
s2[j]
· · · sn[j]
. If an a1 contains two different constants, then there exists no <p E <I>L: that maps allsi [j],
. .. , sn[j]
to the same constant. Thus,c.p( w) �
L( 1r) for any c.p E <I>L:. Conversely, if for eachj,
the a1 contains at most one constant, then there exists a c.p E <I>L: such thatc.p
(w
) E L(1r). The time to check all the aj isO
(k
n ) =O(m) :::; O(lwl).
Hence, the time to decid whether ther existsc.p
E <I>L: suchthat
c.p
(w)
E L(1r) is O(max{l1rl +lwl}
).Q.E.D.
Cons quently Lemma 5.2.1 implies that, with respect to polynomial-time, incom
plete strings do not make the membership problem for one-variable patterns difficult.
Moreover, L mma 5.2.1 directly allows the following corollary.
COROLLARY 5.2.1. CE E NP.
Cl arly, th next question arising naturally is whether or not CE is even in P or NP-complete. However, while we must leave this problem open our next result will shed some additional light on the question which problem is more difficult, E or CE. For that purpose w assume th restriction to CE that the given sets of positive examples T contain only constant strings (i.e. T
<;;;;;; L:+).
Th r stricted probl m is denoted byRCE. The next th orem clarifi s th r lation between RCE and E.
THEOREM 5.2.1. E is equival nt to RCE with r spect to polynomial-time reductions.
PROOF. Cl arly, E is polynomial-time reducible to RCE. For the opposite direction, suppose a finite set T
<;;;;;;
L:+ and a finit set F<;;;;;; (
U {*} )+,
wher IIL:II � 2. We want to construct sets T' and F' such that the answ r to E on input T' and F', is "yes" iffRCE is answ r d thus on input T and F. We set T' = T and L:' =
L:
U{0, 1},
where L: n{0, 1}
=0.
For eachw
E F, definew'
over L:' such that for each 1:::; i :::; lwl, w' [i]
=w[i]
ifw [i]
EL:, w' [i]
=0
ifw [j]
EL:
for allj
<i
andw' [i]
= 1 otherwise. That is ifw
EL:+,
thenw'
=w
and if�(w,
*) � 1, thenw'
is obtained by replacing the first* in
w
by0
and by replacing all other * inw
by 1. Finally, we defin F' to be the set of allw'
obtained.Since T
=
T' �I:+,
any pattern containing 0 or 1 is not consistent with T'. Thus, it is suffici nt to show that ther exist a1r E (I:
U {x} )+
and a <.pE
<I>E such that'P(F) n L( 1r) =
0 iff there exists a1r' E (I:
U {x} )+
such thatF' n L( 1r') =
0. Moreover, since for anyw E
F,w E I:+
iffw E F',
we can assume that each string inF
contains at least one*· Thus, for achw' E F', �(w',O) =
1.First, assum that there are a <.p
E
<I>E and a pattern1r E (I:
U {x} )+
such that'P(F)
nL(1r) =
0.Let
�(1r,x)
� 2. Since�(1r,O) =
�(1r,1)=
0 and for eachw' E F', �(w',O) =
1, then, ther xists no sub titutionu E I:'+
such that1r[ujx]
EF'.
Thus, in this case,F' n L ( 1r) =
0.Let
�(1r,x) =
1. Then1r
is of the form1r = ax{3,
wherea{3
EI:+.
Sincerp(F) n L( 1r) =
0, for anyw E F,
th r xist the following three cases.Case
1:lwl
<l1rl, Case
2: There exists a prefixa'
ofw
such thatla'l = lal
anda' -/: a
andCase 3:
There exists a suffix{3'
ofw
such that1!3'1 = 1!31
and{3' -/: {3.
Let the stringwE F
be reduced to aw' E F'.
InCase
1, sincelw'l =
lwl it is clear thatw'
tf_ L(1r).
In Case 2, eithera'
EI:+
or�(a',*)
� 1. Ifa'
EI:+,
then it is also a prefix ofw'.
Thus,1r[ujx] -/: w'
for anyu E I:'+.
If�(a',*)
� 1, then there exists an 1 � i �la'l
such thatw'[i] E
{0,1}.
Thus,1r[ujx]-/: w'
for anyu E I:'+. Case 3
is analogous. Hence, there exists a1r E (2.:
U {x
})+
such thatF' n L(1r) =
0.Conver ely a sume that there is a
1r E (I:
U{ x} )+
such that for anyw' E
F'w' rf_
L(1r).
Let the stringw' E
F' be reduced fromawE F.
Let1r = v1xv2x
·· · VnXVn+l,
where
Vi E
2.:* for each 1 � i � n + 1. Sincelw'l = lwl,
if m= (lw' l
-(l1rl-
n))/
n is not a positive integer, thenrp(w) rf_ L(1r)
for any <.pE
<I>E. If m is a positive integer, thenw = w1s1w2s2 · · · WnSnWn+l
andw' = w�s�w; ; · · · w�s�w�+l
such that for each 1 � i � n +1, lwil = lw�l = lvil
andls1l =···= I nl =I ��=···=I �� =
m.If ther exist an 1 � i � n + 1 and a 1 �
j
�lw�l
such thatw�[j] E
2.: andw� [j] -/: vi[j],
th n, sinceWi [j] = wi[j],
for any <pE
<I>E,rp( w) rf_ L( 1r).
If there exist an 1 � i � n + 1 and a 1 �
j
�lw�l
such thatw�[j] E
{0,1}, thenwi[j] =
*· Thus, there exists a <p E <I>E such that it maps thewi[j]
to a symbol not equal to thevi[j] E
2.:. It follows thatrp(w) tf_ L(1r).
Thus, we can assume that
Vi = w� = Wi
for all 1 � i � n + 1. The remaining parts areCase
(a):�(1r, x) =
1 andCase
(b):�(1r, x)
� 2.In
Case
(a),w' = w�s�w;.
It follows thatw'
EL(1r);
a contradiction. InCase
(b), th re exists�,sj
E{s�,s;, ... ,s�}
such that i=f- j
ands�[k] =
0, where1:::; k:::; ls�l·
Since
si[k] =*,if j[k]
E LJ' then there exists ac.p
E <I>E such that it maps thesi[k]
toa symbol not qual to the
sj[k],
and ifsj[k]
= *, th n there exists ac.p
E <I>E such that it maps thei[k]
andsj[k]
to different symbols. Hence, there exist a1r
E(2::: U {x})+
and a
c.p
E <I>E such thatc.p(F) n L(1r) = 0.
Th r fore, there exist a1r
E(2::: U {x})+
and a
c.p
E <I>E such that c.p(F)n L( 1r) = 0
iff there exists a1r1
E(I:
U{ x} )+
such thatF' n L(1r') = 0. Q.E.D.
From this Th or n1, it seems that incomplete strings as negative examples cause the difficulty of the consi tency problem. However, it is open whether there is a gap between R E and
CE.
Moreover, there is a chance thatE
andRCE
are members inside NP (e.g.,E
and R ar in RP orP).
The next aim of this s ction is to show the NP-completeness of problem
RE.
Again,we begin with a version of membership adapted to RE as follows.
PROBLEM 5.2.3. For any given
w
E( U { *} )+
and1r
EP1,
theuniversal membership problem,
denoted byVMEM(1r, w),
is to decide whether for eachc.p
E <I>Ec.p(w)
EL(1r).
LEMMA 5.2.2.
VMEM(1r,w)
E P.PROOF. Let
1r = v1xv2x · · · VnXVn+l
be the input pattern wherevi
E 2:::* for all 1:::;
i:::;
n + 1. The test wh ther or notlwl � l1rl
can be done inO(l1rl
+lwl)
time.If
lwl � l1rl,
then similarly to Lemma5.2.1
we compute m= lwl- l:::1::;i::;n+l lvil
andcheck wheth r or not m
/
n is a positive integ r inO(lwl)
time. Let m/
n= k
be apositive integer. Th n,
w
is of th formw = w1 1w2 2 · · · Wn nWn+l
such that for each1 :::;
i:::;
n + 1,I Wi I = I Vi I
andI 1l = · · · = Is n I =
k.We can check whether or not there xists an
1 :::;
i:::;
n + 1 such thatvi =/- wi
inO(lwl)
time. If there exist suchVi
andwi,
th nc.p(w) rf_ L(1r)
for ac.p
E <I>E. If not, for each1 :::; j :::;
n, we next compute th stringO'j = si[j]s2[j] · · · sn[j].
Since we havevi= wi,
for each c.p E <I>E,c.p(w)
EL(1r)
iff for ach1 :::; j:::;
n,si[j] = · · · = sn[j].
The time to check all the O'j is O
(
kn) = O(m) :::; O(lwl).
Herre , the time to decide whetherc.p(w)
EL(1r)
for allc.p
E <I>E isO (
max{l 1
rl
+lwl}). Q.E.D.
We recall th problen1 of the robust extension RE for one-variable patterns in Def
inition
5.2.2
and Problem5.2.1.
This problem requires the universal consistency of a one-variable patt rn for every cp E <I>....,. Now, we give a log-space reduction from SAT to RE. For simplicity, in this reduction, SAT is restricted to 3-SAT, given a 3-CNF, to decid wh th r it is satisfiabl (for the NP-completeness of 3-SAT, see, e.g.,[50]).
LEMMA 5.2.3. 3-SAT is log-space reducible to RE.
PROOF. L t
c
=cl
1\c
2 1\ ... 1\Cm
be a 3-CNF of n variablesX},
X2, ... 'Xn such thatCi = ( ei1
Vei2
Vei3)
1 where eachei1
denotes a positive Or negative literal ofXi1
1that i
, Ri1
E{ Xi1, --.xi1}, 1 ::;
i::;
n and1 ::; j ::;
3. Let us fix an alphabet consisting ofn + 3 symbols such that E =
{
a1 a2, ... , an+I} U {A, B}.
First, we compute the stringsa1, a2, a3
anda4
as follows.ext, for each clause
ci = ( eil
vei2
vei3)
and i = 1' ..
. 'n we compute the corresponding stringf3i =
a111a2r2a3···an1nan+I such that for each1::; j::;
n,rj =
BA
ifx
j E{ ei1, fi2, ei3},
rj =AB
if--.x
j E{ ei1, fi2, ei3}
and rj = ** otherwise.Finally, we output T
= {a3,a4}
as the set of positive exan1ples and F ={a1,a2}U{f3k I 1 ::;
k::; m}
as the set of negative xamples. The idea for the string f3k E F is illustrated in Figure5.1.
We first prove the following claim.CLAIM 5.2.1. If a pattern
1r
E P1 is consistent with the stringsa1,a2,a3,
anda4,
then the
1r
is of the form1r =
a1X1a2X2a3 · · · anXnan+l, where Xi E{Ax, xA}
and1 ::;
i
::;
n.Suppose that there exists a pattern 1r E P1 consistent with the
a1, a2, a3,
anda4.
There are the following cases for a substitutionu
E E+ such that1r[ujx]
Ec = c1 A c2 A c3 A c4
\
Negativ examples
F igure 5.1: Negative examples computed from a 3-CNF
C
of n variables.Case
1: A substitution u contains anai
E{a1,a2, ... ,an+I}
such that1r[ujx]
E T.Sine any
ai
appears in the strings at most once, the1r
must be of the form wxw' such that wE{a1,a1A,a1AA}
and w' E{an+1,Aan+l,AAan+1}.
For any possible wand w', the1r
is not consistent with the negative examplea1.
Thus,Case
1 is removed.Case
2:7r[AA/x] = a3.
Then, 1f= a1Xla2X2a3 ... anXnan+I,
wherexi
E{AA, X}
and 1
�
i�
n. IfXj = AA
for a 1� j �
n, then the1r
containsajAAaj+I·
Sinceij(a4, ajAAaj+,) =
0, it is a contradiction. Thus, in this case the1r
is of the forma1xa2xa3 · · · anxan+I·
This pattern is inconsistent with the negative examplea2.
Case
3:1r[AAjx] = a4.
Then the1r
contains one of the stringsaiA3ai+I, aiAxai+I
andaixAai+I·
In case ofaiA3ai+I,
the1r
is not consistent with thea3.
It is a contradiction.Thus, for each 1
�
i�
n, the substring of1r
betweenai
andai+l
must beAx
orxA.
This
1r
satisfies Claim 5.2.1 and it is consistent with alla1, a2, a3,
anda4.
Case
4:1r[A/ x] = a3.
If the1r
contains a substringaiAAai+I,
then it is not consistent witha4.
Thus, the1r
satisfies Claim 5.2.1.Case
5:1r[Ajx] = a4.
In this ca , th 1r contains one ofaiA3ai+I, aixA2ai+I
andaiA2xai+I·
Since it is not consistent witha3,
this case is removed. Thus, Claim 5.2.1 is true.We set
II= {1r
E P1I a3, a4
EL(1r), a1,a2 rf_ L(1r)}.
By Claim 5.2.1, the proof of the theorem is now reduced to the consistency that the 3-CNFC
is satisfiable iff there exists a1r
E II such thatcp( F)
nL( 1r) = 0
for all cp E q>I:.Assume that the Cis s;atisfiable. There exists a truth assignment
f : {xi, ... , xn}
---+{0, 1}
such that for each clauseci = (eil
vei2
vei3) (1 �
i�
m)
, at least onee'
E{ ei1, ei2, ei3}
fulfills xactly one of the following conditions.Cas
(a) :e' =
xj
E{xI
, . . . , xn}
andf (
x j )= 1
, orCase (b)
:e' = ---, x j
andf ( x j) = 0.
Ther exists a one-to-one mapping fron1 truth assignments
f
forx1, ... , Xn
to the set II such that for each]�
i�
n,f(xi) = 0
iff1r
containsaixAai+I
andf(xi ) = 1
iff1r
containsaiAXai+I·
If an
f
satisfi s ach clause Ci, th n there exists a negative examplef3i
EF
con truct d from th
ci
such thatXj
E{ eil 'ci2' ci3}
ifff3i
containsajBAaj+l
and--.xj
E{ei1 f!i2 f!i3}
ifff3i
containsajABaj+I·
In
Case
(a), a1r
E II corresponding to the f containsajAXaj+I
and thef3i
constructed froin
ci
containsajBAaj+I·
We note that for any 7r E II andf3i
EF'
17r I =lf3i ,
. Thus, as compared with thestrings ajAXaj+l and ajBAaj+I
no substitution u E E+and no
cp
E <I> E satisfy1r [
u/ x] = cp({3i).
In
Case
(b), analogously a1r
corresponding to thef
containsajxAaj+I
and thef3i
constructed from Ci containajABaj+I·
Thus, th re is no substitutionu
andcp
for1r[uj x] = cp(f3i).
Hence, if C is atisfiable, then ther xist a
1r
E II such thatcp( F) n L( 1r) = 0
forall
cp
E <I> E .Conversely, l t the CNF C b unsatisfiabl . Then for any truth assignm nt f there xists a clause
ci
of c uch that for any literalC'
ofci,
itherC' = Xj
E{x
i,... ' Xn}
and
f(xj) = 0
orC' = --.xj
andf(xj) =
1.Th n, for each
C'
E{ ei1, ei2, ei3},
th1r
containajxAaj+I
and thef3i
E F containsajBAaj+I
ifC' = x
j E{XI
,... , Xn}
and th1r
containsajAXaj+I
and thef3i
containsajABaj+I
ifC' = --.xj.
Finally, we define
cp(f3i) = w
such that for each 1�
k� if3il,
if
1r[k] = x
and otherwise.It follows
<p({3i)
EL ( 1r)
for the substitutionB.
Hence, if C is unsatisfiable, then for any 7r EII,
there exists a<p
E <I>E such that<p(F)
nL(1r)-=/:- 0.
Thus, we conclude that the 3-CNF C is satisfiable iff there exists a robust extension for T andF. Q.E.D.
THEOREM 5.2.2. RE is NP-complete, even if
jjEjj = 2.
PROOF. Analogously we reduce a 3-CNF C to RE. Let C consist of m clauses cl'
c2'
... ' Cm and d fined byn
variablesxl' x2' . . . Xn-
Initially, we setE = {A, B}
and T
= { a1 = A 2n, a2 = A 3n}.
The set F of n gati ve examples over E is the sum of th setsN1 N2
andN3
defined as follows.N1 = {An}
U{f3i = A 2n+i I i
E{ 1, ... , 2n} \ { n, 2n}},
{ BA,
1 ::::; Vk ::::;
m and1 ::::; Vj ::::; n,
{k1= AB
**,
if Xj is a literal of Ck
if
-.x j
is a literal of C k, and otherwise.We define th s t
II� P1
such that 1r E II iff1r = X1X2···Xn,
whereXi
E{Ax xA}
and 1
::::; i ::::; n.
Th n, we prove the following claim.CLAIM 5.2.2.
1r
E II
iff1r
EP1
is consistent with T andN1
U<p(N2)
for all<p
E <I>E.First, assume
1r
E II. Th n, cl arly, T� L(1r).
For eachA2n+i
EN1, 1r[ujx]-=/:- A2n+i
because
i
E{1, ... ,2n} \ {n,2n}
and�(1r,A) = �(1r,x) = n.
Thus,N1 nL(1r) = 0.
Foreach odd number
i
such that 1::::; i ::::; 2n- 1, 1r[i]1r[i
+1] =Ax
or1r[i]1r[i
+1] = x A.
On the other hand, for any
{3j
EN2,
there xists xactly one odd numberi
such that{3j[i]f3j[i
+1] = BB.
Sincej1rj = !f3j!,
there exists no<p
E <I>E such that<p((3j)
EL(1r).
Thus, if
1r
E II, then 1r is consistent with<p(T)
and<p(N1
UN2)
for all<p
E <I>E.Suppose to the contrary that ther xists a
1r
EP1
and1r
rt II such that1r
is consistent with T andN1
U<p(N2)
for all<p
E <I>E. If1r
contains aB,
then clearly, T nL(1r) = 0.
Thus, we can assume1r
E{A,x}+.
We first show that
1r
must satisfy1r[Ajx] = a1
=A2n.
Assume that1r[ujx] = A2n
and
u =
N·, where2 � r � 2n.
Then,�(1r,x)
=n' �n
and�(1r,A) = 2n-rn'. Ifn' =
rz,then
7r = xn.
Sincexn[A/x] =An
EN1,
it is a contradiction. Thus,n' � n- 1.
For each1 � n' � n - 1,
there exists af3n'
EN1
such thatf3n'
=A 2n+n' = A (r+1)n' A 2n-rn'.
It follows th contradiction
1r[Ar+1jx] = f3n'·
Thus7r[A/x] = A2n.
Second, we show that
1r
must satisfy�( 1r, x) = n.
Assume that�( 7r, x) = n' # n.
In case of
n' � n - 1,
there existsf3n'
EN1
such thatf3n'
=A 2n+n' = A 2n' A 2n-n'.
Thus,f3n'
EL(1r)
for the substitutionA2.
In case of�(1r, x)
=n'
2::n+1,
sincea1 a2
EL(1r),
it holds thatn' � 2n -1.
Thus, there existsf3n'
EN1
such thatf3n' = A 2n+n' = A 2n' A 2n-n'.
It follows th contradiction
1r [A 2/ x] = f3n'.
Thus,�( 1r, x) = n.
By the condition that1r[Ajx]
=A2n
and�(1r,x) = n
th1r
must satisfy that�(1r,A) = �(1r A)= n.
Sine
7r
E{A x}+, 1r
tf. IT and�(1r,A) = �(1r,A) = n,
there exists an odd numb r
i
and1 � i � 2n- 1
such that1r[i]1r[i + 1] = xx.
On the other hand sine(i +
1)/2
i a positive integer, there is a the stringf3(i+1);2
EN2
such that it is of the form*i-1BB*2n-i-1.
Thus, there exists acp
E <l>r; such that for each1 � k � 2n, cp(,B(i+1)/2)[k] = B
if1r[k] = x
andcp(f3(i+1);2)[k] =A
otherwise. It follows the contradiction
1r[Bjx] = f3(i+1);2.
Hence if a1r
EP1
is consistent with T andN1
Ucp(N2)
forall
cp
E <I>r;, then7r = X1X2
· · ·Xn
such thatXe
E{Ax, xA}
and1 �
f� n.
This followsthat the laim
5.2.2
is true.Similarly to the proof of Le1nma 5.2.3 we can see that the 3-CNF is satisfiable iff there exists a
1r
E IT consi tent withcp(N3)
for allcp
E <I>r;. Thus w conclude that theRE is NP-complete, even if
11�11 = 2.
Q.E.D.EXAMPLE 5.2.2. Let C b a 3-CNF of
5
variables. Th n, T= {A10, A15}.
TheN1
and
N2
in Theorem5.2.2
are d fined as follows.N1 = {As' A 11, A 12' ... ' A 14, A 16, ... , A 19}
andLet us take a 1r E
P1
such that1r[ujx] = A10
for a substitution u E{A}+. Ifu #A,
then
u =An
for some2 � n �
10. Let�(7r, x) =
m, where1 �
m� 5.
If m= 5,
then7r =
x5
andA5
EL(1r).
Thus, this1r
is inconsistent withN1.
For each2 � n � 1
0 and1::; m::; 4 such that
1r[Anjx]
=A10
and�(1r,x)
= m, there exists awE /\1 such that1r[An+1jx]
= w. Thus, if a 7r is consistent withN1,
then1r[Ajx]
=A10.
If
�( 1r x)
< 5, then there exists 1 ::; n' ::; 4 such thatA lO+n'
E N1 n L( 1r)
and if�( 1r, x)
> 5, then there exists 6 ::; n' ::; 9 such thatA lO+n'
E N1 nL( 1r).
Thus, these1r
are inconsistent with N1. It follows that if a
1r
is consistent with N1, then�( 1r, x)
= 5.Hence,
�(1r,x)
=�(1r,A)
= 5.For xample, 1 t
1r
=xAxxAAxAAx tf.
II. Then, there exists a <p E <I>E and w =*2BB*6
E N2
such that c.p( w)
=BABBAABAAB
EL( 1r).
Let1r
=xAxAAxAxxA
E II. Then, there xists now E N2
and <p E <I>E such that c.p(w) EL(1r).
By r sult in h or m 5.2.2, the restricted robust extension is also NP-complete, indeed, any positive exampl in the reduction contains no
*·
However, we could not prove the NP-completeness of the restricted consistent extension which is equivalent to the extension in the sense of polynomial-time.Finally, we discuss the consistent extension itself. Since CE is in NP, its NP
complet ness is d rived by a reduction from
3-colorability of graphs
(abbr.3-CLR):
given a graph G =
(V, E),
to decide whether th G is3-colorable
that is, there exists a functionf: V
-t{a,
b,c}
such thatf(u) -1- f(v)
whenever(u, v)
EE
(cf., e.g.,[23]).
THEOREM 5.2.3. (St phan
[68]).
CE is NP-complete even ifIIEII
=2.
PROOF. W show the outlin of th reduction from
3-CLR
to CE. Let G =(V, E)
be any graph of n node . Th alphab t is fixed to
E
={0,
1}.
One can produce a problem CE such that, wh nev r there is a pattern1r
then1r
E{OOx OxO, xOO}n
wher for all i = 1, .. . , n, each ith block isOOx
for the firstOxO
for the s cond andxOO
for the third color.The positiv and negative examples are the following:
Positive:
(OOO)n
in order to get that the pattern has at most length 3n.Negative:
Oi
for all i <3
n in order to have that the pattern has xactly length 3n.The previous string enforces that
0
is the only constant in the pattern, and thus, taking[0/x],
the string oe is in th language generated by the pattern, where f is the length of the pattern.Positive:
(OOOO)n
in order to get that there are at most n occurrences ofx
in a pattern.Th variable
x
has to satisfyOJ
with j >1
to generate(OOOO)n,
and sox
canoccur at most n times; otherwise the string would have length 3n +
(
k -1 )h
forh
> n occurrences and this would be larg r than 4n.N gativ :
Ok
for k = 3n +1,
3n + 2, ... , 4n -1
in order to get that there are not less than n occurrences ofx.
Thes positiv and negative strings show that the pattern consists of 2n symbols
0
and n o currences of the variables
x.
Moreover, we set the following examples.Positiv :
(
* * 1 * * )n. This word has length 5n, so to satisfy it, we have to assign a string of l ngth 3 to th variablex.
Since0
does not occur in this string, we can most easily satisfy this condition by taking[111/x].
This allows now to localize the positions of thex
in the pattern and we obtain that the pattern consists of n blocks from{OOx, OxO, xOO}.
This further string enforces that neighboring nodes have different colors. There exists a one-to-one mapping between the functions f : V ---+
{
a, b, c}
and the patterns in{OOx,OxO,xOO}n.
For each edge (i,j) of G, we takes a string with0
in the middle position in the ith part and 1 in the middle position in the jth part. Thus, for each edge(
i j) w take the string: *5 · · · *5(
* *0
* *) *5 ... *5(
* *1
* *) *5 ... *5.If, for exampl , part i of the pattern is
OxO
and part j isOOx,
then we have[100/x]
such that
0(100)0
is satisfied by**0
** and00(100)
by** 1 * *· If i and j have the same part, sayOOx,
then theOOx
must satisfy both * *0
* * and * *1
* * which is a contradiction because0
and 1 can not be assigned at the same time. Since 3 colorsa, b, and c are corresponding to the codes
OOx OxO,
andxOO,
resp ctively, there is a pattern satisfying all the abov conditions iff G is 3-colorable. Thus, 3-CLR is log-spacereducible to C