• No se han encontrado resultados

3. ASPECTOS JURÍDICOS NECESARIOS EN LA REGULACIÓN LEGAL DE LA MATERNIDAD DISOCIADA EN EL PERÚ

3.1. RESPETO AL DERECHO A LA IDENTIDAD GENÉTICA EN LA PRÁCTICA DE LA MATERNIDAD DISOCIADA

3.1.2. VULNERACIÓN DEL DERECHO A LA IDENTIDAD GENÉTICA

Although we can now find all the intervals ofπin optimalO(n+N)time, we may prefer instead to find an O(n) algorithm that is capable of telling us all that we really need to know, namely the substitution decomposition ofπ, and hence whether it is simple. To this

end, define astrong intervalof a permutationπto be an intervalIofπfor which every other

intervalJ satisfies precisely one ofJ I,I J orJI =(i.e.I does not overlap with

any other interval). The strong intervals ofπare then precisely the intervals arising in the

substitution decomposition, including both the whole ofπ and all the singleton intervals.

Note that a permutation of lengthnhas at most2n−1strong intervals.

Up to now we have been working primarily with the three-sided intervals I`(i) and Ir(i)for eachi∈[n]of a permutationπof lengthn. We have seen that they can be used to

find all the intervals ofπ, but in order to restrict our attention to the strong intervals, we are

going to want to replace our three-sided intervals with four-sided ones. Define, therefore, theleft-maximuminterval of a positioni∈[n]to be the largest interval ofπwhose rightmost

point has positioni, and write the leftmost position of this interval aslmax(π;i). Similarly, letrmax(π;i)denote the rightmost position of the largest interval ofπwhose leftmost point

has positioni(theright-maximuminterval). Again we will abbreviate these tolmax(i)and rmax(i).

Trivially, we havelmax(i) minpos(I`(i))andrmax(i)≤maxpos(Ir(i)), and this sug-

gests a starting point for finding the left-maximum and right-maximum intervals. How- ever a direct search through the sets I`(i) and Ir(i) cannot necessarily be performed in

optimal time, so again we rely on the`- andr-supports to reduce our search.

Proposition 4.5 (Bergeronet al.[17, Theorem 3]). For a permutation π of lengthn,rmax(i)

can be computed inO(n)time.

Proof. Note first that Algorithm 4.5begins by settingrmax(i) = ifor eachi, with the ex-

ception ofrmax(1) which is set ton, as expected. Note next that theifstatement simply

checks to see whether[suppr(i),rmax(i)]is a set of positions corresponding to an interval. If true, thenrmax(j) forj = suppr(i)is changed tormax(i)if it is larger than the existing rmax(j). In either case, the set of points with positions[j,rmax(j)]will still correspond to an interval, so we need only check that the algorithm at some stage encounters the largest interval ofπwhose leftmost point isj.

Suppose forj[n]that the set of points with positions[j, j0]correspond to the largest interval with leftmost point j, and that the algorithm has correctly found rmax(i)for all

i such that supp(i) > j. We may assumej0 > j as otherwise it is easy to see that Al- gorithm 4.5 correctly outputsrmax(j) = j. By the maximality ofj0, we have Ir(j0) =

{(j0, π(j0))}andrmax(j0) = j0, so we are done ifsupp

r(j0) = j. (Notesuppr(j0) < jis im-

possible since[j, j0]corresponds to an interval.) Let us therefore assume thatsuppr(j0) =

j00 > j, and note that the rightmost point in I

r(j00) has positionj0, givingrmax(j00) = j0

(since Ir(j00) cannot be extended by a right pin). Ifsuppr(j00) = j then we are done, so

instead supposesupp(j00) = j000 > j, and observe that again we must havermax(j000) =j0. This process can only be repeated a limited number of times before we find somei > jwith

supp(i) =jandrmax(i) =j0. The complexity of Algorithm4.5follows immediately. The computation forlmax(i) is similar, and for our running exampleπ = 289576314 this gives:

i 1 2 3 4 5 6 7 8 9

lmax(i) 1 2 2 4 5 2 7 8 1

rmax(i) 9 6 3 6 6 6 7 8 9

Moving from the left-maximum and right-maximum intervals to the strong intervals is now a fairly straightforward process. We begin by listing the leftmost and rightmost

4.3 STRONGINTERVALS AND THESUBSTITUTION DECOMPOSITION 75

Algorithm 4.5Computingrmax(i) rmax(1)←n

forifrom2tondo

rmax(i)i

end for

forifromnto2do

ifsuppr(i)minpos(Ir(rmax(i)))andrmax(i)≤maxpos(Ir(suppr(i)))then rmax(suppr(i))max(rmax(i),rmax(suppr(i)))

end if end for

positions of the left-maximum and right-maximum intervals, marking right bounds with a bar, i.e. the set{i, i,lmax(i),rmax(i) :i[n]}containing4nbounds.

Next we sort this list into increasing order,{a1, a2, . . . , a4n}, listing left bounds before

right bounds, noting that this can be done in linear time since there are only2npossible

values that the entries can take, each being eitherior ifor somei [n]. The sort can be further simplified by also noting that for eachi[n]we are guaranteed to see bothiandi

at least once. For our example (π = 289576314), this list is

{1,1,1,1,2,2,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9}.

We now work from left to right through this list, storing left bounds on a stack as they appear, and when we see a right boundrwe take the top elementsoff the stack and return

[s, r]as a set of positions corresponding to a strong interval.

Theorem 4.6(Bergeronet al.[17, Proposition 8]). The strong intervals of a permutation π of lengthncan be computed inO(n)time.

Proof. If Algorithm 4.6 outputs an interval of the form [i,rmax(i)], then every interval whose positions are of the form[lmax(j), j] must have trivial intersection with[i,rmax(i)] (either [lmax(j), j] [i,rmax(i)] or [lmax(j), j] [i,rmax(i)] is empty). Subsequently, [i,rmax(i)]must intersect trivially with every interval ofπsince every interval is contained

Algorithm 4.6Computing the strong intervals ofπ Sa stack recording positions, with topmost elements

forifrom1to4ndo

ifaiis a left boundthen

pushaionS else print [s, ai] popsfromS end if end for

val. A similar argument can be applied if the algorithm outputs an interval of the form [lmax(j), j].

Now suppose the algorithm outputs the set of contiguous positions[i, j] for which neitherlmax(j) =inorrmax(i) =j. It follows that[i, j] = [lmax(j), j]∩[i,rmax(i)], and so [i, j]corresponds to a set of points ofπforming an interval. If[i, j]does not correspond to a strong interval, then there exists ak for which eitheri < k ≤j <rmax(k)orlmax(k)< i k < j. In the former case, every interval[k0,rmax(k0)]with i < rmax(k0) k must satisfyk0 ≥ k, and so the algorithm would only permit the output ofj as a right bound

when paired with left bounds at least as big as k, a contradiction, proving that[i, j] was strong.

Conversely, let [i, j] correspond to a set of positions forming a strong interval of π,

so there are no intervals ofπ whose positions have non-trivial intersection with[i, j]. To ensure the algorithm outputs[i, j], we must find a left boundiand a right boundjin the

ordered list of 4nbounds between which every left bound is matched by a right bound.

Letxdenote the number of positionskfor whichlmax(k) =iandk < j, andythe number

of positionskfor whichrmax(k) =jandi < k. In the list of bounds{a1, a2, . . . , a4n}, there

areyxmore left bounds than right between the last occurrence of the left boundiand

the first occurrence of the right bound j. There are, however, at leastx+ 1left boundsi

4.4 GRAPHSUBSTITUTION DECOMPOSITION 77 289576314 2 89576 89 8 9 576 5 76 7 6 3 1 4

Figure 4.3:The substitution decomposition tree ofπ= 289576314. Forπ = 289576314, after removing duplicates the output is

[1,1],[2,2],[3,3],[2,3],[4,4],[5,5],[6,6],[5,6],[4,6],[2,6],[7,7],[8,8],[9,9],[1,9].

We obtain the substitution decomposition tree by reading from right to left through our list of positions of strong intervals as output by Algorithm 4.6, noting that the strong intervals have been ordered as they would be output by a depth first search algorithm, working from right to left. Figure 4.3shows the tree obtained forπ = 289576314. Note that, by the definition of the strong intervals, in the cases where our permutationπis sum

or skew decomposable, each sum or skew component will occupy a separate node. Where

π is not sum or skew decomposable, the simple skeleton ofπis easily obtained by taking

the permutation order isomorphic to any chosen set of node representatives from the first level of the tree.