• No results found

4.2 Bounded Perfet Mathing of a Complete Bipartite Graph

4.2.2 Algorithms, Data Strutures and Automati Program

Thesets

V

1

and

V

2

are implementedaslistsofnaturalswithoutdupliations. Weindiatethelengthofthelist

V

by

|V|

. Weindiatebytail

(V)

theoperation thatreturnthetailofthenonemptylist

V

.Theset

E

ofweightsisimplemented by alist oftriple ofnaturals

(i, j, v

i,j)

,with

i∈V

1

,

j∈V

2

and

v

i,j

weight of theedge

(i, j)

. Given

i∈V

1

,

j∈V

2

,theweightofthear

(i, j)

isindiatedby

E[i, j]

.Aperfetmathing

M

of

V

1

and

V

2

isimplementedbyalistofnaturals

M

withthe following twoproperties:

i)

for all

j

,if

M[j] =k

then

(V

1

[j], k)

, with

V

2

[m] =

k

for some

m

, belong to the perfet mathing and

ii)

for all

j6=k

,

M[j]6=M[k]

. By

i)

and

ii)

it followsthat

M

isa permutationof

V

2

. Undertheseassumptions thefuntionSUM

:N→N→(N×N×N)

→N

(thattakesin inputthe vetor ofnodes

V

1

, the mathingvetor

M

, the the matrixofweights

E

andreturnstheweight of

M

)isdenedas follow:

SUM

([],[], E) = 0

SUM

(v::V

1

, m::M, E) =E[v, m] +

SUM

(V

1

, M, E)

Givenaompleteweightedbipartitegraph

G= (V

1

, V

2

, E)

,with

|V

1

|=|V

2

|

,

M

isaompletemathingof

G

ifandonlyifMATCH

(M, V

2

)

,withtheprediate MATCHdenedasfollow:

rri

(M1)

MATCH

((:),(:))

MATCH

(M, V2\{n})

(M2)

V2[n] =m

MATCH

(m::M, V2)

Proposition 4.2.1.

∀l.

MATCH

(l, l)

Proof. Case

l= (:)

,by

(M1)

. Case

l= (a::l

)

,WehavetoproveMATCH

(l

, l

)

thatfollowbytheindutionhypothesis.

Now we supply a onstrutive proof of the existene (ornot) of aperfet

mathing(with weight higheror equalthana xedthreshold)of aomplete

bipartite graph. The used strategyis to enumerate all the possibilities, till

thedesiredsolutionisfound. Obviouslythissearhing methodis partiularly

ineient, anditrequireanexponentialnumberofstepswhenexeutedona

speiinputgraph.

Intherestofthehapterwewillusethefollowingonventions:

V

1

, V

2

, E, T

−→M

for

M

isaperfetmathingbetween

V

1

and

V

2

suhthat

T≤

SUM

(V

1

, M, E)

,thatisMATCH

(M, V

2

)∧T

SUM

(M, V

1

, E)

V

1

, V

2

, E, T

−→

n

M

for

V

1

6= (:)

,

V

1

, V

2

, E, T

−→M

and

|V

2

|−n≤♮(M[0], V

2

)

andwewrote

V\{m}

toindiatethelist

V

fromwhihisdroppedthenodein position

m

,with

m: 0, . . . ,|V| −1

and

♮(n, V

2

) =m

for

V

2

[m] =n

.

Theorem 4.2.2.

∀V

1

V

2

E, T.

(|V

1

|=|V

2

| ∧0≤T)→ ∃p.

p→(∃M.V

1

, V

2

, E, T

−→M)∧

(p→ ⊥)→(∃M.V

1

, V

2

, E, T

−→M)→ ⊥

Proof. By indution on

V

1

. Case

V

1

= (:)

: Assume

V

2

,

E

,

T

and ip:

(|(:)|

=

|V

2

|)∧0≤T)

. Byipitfollows

V

2

= (:)

. Theurrentthesisbeame:

∃p.

p→(∃M.(:),(:), E, T

−→M)∧

(p→ ⊥)→(∃M.(:),(:), E, T

−→M)→ ⊥

(4.1) Twoasesare possible: Case

0< T

: thennoperfet mathingdoesexist. So weintrodue for

p

. Thepositivepart of(4.1)is provedby(Efq). Toprove the negative part of (4.1) let's assume

and ip:

∃M.(:),(:), E, T

−→

M

. By ipdoes exists

M

suhthat MATCH

(M ,(:))

and

T

SUM

(M ,(:), E)

. Butif MATCH

(M ,(:))

by

(M1)

we have

M

= (:)

, and so SUM

((:),(:), E) = 0

that generate aontradition with thehypothesis

0

< T

SUM

((:),(:), E)

. Case

0 =T

: Introduettfor

p

. Thepositive partof(4.1)is provedintroduing

(:)

for

M

,and thenegativepart of(4.1) is provedby(Efq). Case

V

1

= (a::l)

: Assume

∀V

2

E, T.

(|l|=|V

2

| ∧0≤T)→ ∃p.

p→(∃M.l, V

2

, E, T

−→M)∧

(p→ ⊥)→(∃M.l, V

2

, E, T

−→M)→ ⊥

(4.2)

V

2

,

E

,

T

andip:

(|(a::l)|=|V

2

| ∧0≤T)

. Giventhenatural

a

,weprove

∃p.

p→(∃M.(a::l), V

2

, E, T

−→M)∧

(p→ ⊥)→(∃M.(a::l), V

2

, E, T

−→M)→ ⊥

(4.3)

Inordertoprove(4.3)weprovethefollowingassertion:

∀n.∃p.

p→(∃M.(a::l), V

2

, E, T

−→

n

M)∧

(p→ ⊥)→(∃M.(a::l), V

2

, E, T

−→

n

M)→ ⊥

(4.4)

Obviously(4.3) isobtainedinstantiating(4.4)on

|V

2

|

. Toprove(4.4)wepro- eed by indutionon

n

. Case

n

= 0

: Weshall look for a mathing

M

suh that

♮(M[0], V

2

)≥ |V

2

|

,butfromthisfollowaontradition. Sowe introdue for

p

. Thepositivepart of(4.4) isprovedby (Efq). For thenegativepart, assume

, and ip

:

∃M.(a

::l), V

2

, E, T

−→

|V

2|

M

. Fromip

it follows that

thereexists

M

suhthat

(a::l), V

2

, E, T

−→M

and

|V

2

| ≤♮(M[0], V

2

)

. But

ontradition. Nowlet'sassumethenestedindutivehypothesis

∃p.

p→(∃M.(a::l), V

2

, E, T

−→

n

M)∧

(p→ ⊥)→(∃M.(a::l), V

2

, E, T

−→

n

M)→ ⊥

(4.5)

anatural

n

,andweprove

∃p.

p→(∃M.(a::l), V

2

, E, T

−→

n+1

M)∧

(p→ ⊥)→(∃M.(a::l), V

2

, E, T

−→

n+1

M)→ ⊥

(4.6)

Therearetwoases,Case

E[a, V

2

[|V

2

| −(n+ 1)]]< T

: Weinstantiate(4.2)on

V

2

\{|V

2

| −(n+ 1)}

,

E

and

(T

−E[a, V

2

[|V

2

| −(n+ 1)]])

. Thisinstantiation produethefollowing hypothesis:

(|l|=|V

2

\{|V

2

| −(n+ 1)}| ∧0≤(T−E[a, V

2

[|V

2

| −(n+ 1)]]))→ ∃p.

p→(∃M.l, V

2

\{|V

2

| −(n+ 1)}, E,(T−E[a, V

2

[|V

2

| −(n+ 1)]])−→M)∧

(p→ ⊥)→

(∃M.l, V

2

\{|V

2

| −(n+ 1)}, E,(T−E[a, V

2

[|V

2

| −(n+ 1)]])−→M)→ ⊥

(4.7)

Byip,

|(a::l)|=|V

2

|

thus

|l|=|V

2

\{|V

2

| −(n+ 1)}|

,moreoverby

E[a, V

2

[|V

2

| −

(n+ 1)]]< T

it follows that

0≤(T

−E[a, V

2

[|V

2

| −(n+ 1)]])

. Instantiating (4.7)onthesetwofats,weknowaboolean

p

suhthat

p→(∃M.l, V

2

\{|V

2

| −(n+ 1)}, E,(T−E[a, V

2

[|V

2

| −(n+ 1)]])−→M)∧

(p→ ⊥)→

(∃M.l, V

2

\{|V

2

| −(n+ 1)}, E,(T

−E[a, V

2

[|V

2

| −(n+ 1)]])−→M)→ ⊥

(4.8)

Twoasesarepossible,Case

p

: Weintroduettfor

p

inthegoalformula(4.6) obtainingthenewgoal:

(

tt

→ ∃M.(a::l), V

2

, E, T

−→

n+1

M)∧

⊥ →((∃M.(a::l), V

2

, E, T

−→

n+1

M)→ ⊥)

(4.9)

Toprovethepositivepartof(4.9): assumettand instantiatetheleftof(4.8) on

p

,fromwhihitfollowthatthereexists

M

suhthat:

l, V

2

\{|V

2

| −(n+ 1)}, E,(T−E[a, V

2

[|V

2

| −(n+ 1)]])−→M

(4.10) Soweintrodue

(V

2

[|V

2

| −(n+ 1)] ::M)

for

M

. Wehavetoprove:

MATCH

((V

2

[|V

2

| −(n+ 1)] ::M), V

2

)

: by

(M2)

thisorrespondtoprove MATCH

(M , V

2

\{|V

2

| −(n+ 1)})

,thatholdby(4.10).

T

SUM

(a::l,(V

2

[|V

2

| −(n+ 1)] ::M), E)

: Thisorrespondto prove

T−E[a, V

2

[|V

2

| −(n+ 1)]]≤

SUM

(l, M , E)

,thatfollowby(4.10).

(n+ 1)] ::M)[0] =V

2

[|V

2

| −(n+ 1)]

andthen

♮(V

2

, V

2

[|V

2

| −(n+ 1)]) =

|V

2

| −(n+ 1)

.

Toprovethenegativepartof(4.9): by(Efq). Case

p→ ⊥

:by(4.5)thereexists

p

suhthat:

p→(∃M.(a::l), V

2

, E, T

−→

n

M)∧

(p→ ⊥)→(∃M.(a::l), V

2

, E, T

−→

n

M)→ ⊥

(4.11)

Weintrodue

p

for

p

in(4.6)obtainingthenewgoal:

p→(∃M.(a::l), V

2

, E, T

−→

n+1

M)∧

(p→ ⊥)→(∃M.(a::l), V

2

, E, T

−→

n+1

M)→ ⊥

.

(4.12)

Toprovethepositivepartof(4.12): assume

p

andinstantiatethepositivepart of(4.11)on

p

. Itfollowsthatthereexists

M

perfetmathingbetween

(a::l)

and

V

2

suhthat

|V

2

| −n≤♮(M[0], V

2

)

,andthus,

|V

2

| −(n+ 1)≤♮(M[0], V

2

)

. Toprovethenegativepartof(4.12): Assume

p→ ⊥

. Now,onsideringthat:

Instantiatingthenegative partof(4.8)on

(p→ ⊥)

therenotexists any

M

suhthat

l, V

2

\{|V

2

| −(n+ 1)}, E,(T−E[a, V

2

[|V

2

| −(n+ 1)]])−→M

. Thus,foreahmathing

M

,naming

δ

M

=

SUM

(l, M, E)

,wehave

δ

M

<

T−E[a, V

2

[|V

2

| −(n+ 1)]]

andthus

δ

M

+E[a, V

2

[|V

2

| −(n+ 1)]]< T

, i.e. thereexistsnomathing

M

between

(a::l)

and

V

2

suhthat

M[0] =

V

2

[|V

2

| −(n+ 1)]

.

Instantiatingthenegativepart of(4.11) on

p→ ⊥

therenotexists any

M

suhthat:

(a::l), V

2

, E, T

−→

n

M

weonludethatthereexistsnomathing

M

suhthat:

(a::l), V

2

, E, T

−→

n+1

M

. Case

E[a, V

2

[|V

2

| −(n+ 1)]]≥T

:Thevalueofthemathingbuiltsofaris higherthan

T

,soweanstopthesearh. Instantiate(4.2)on

V

2

\{|V

2

|−(n+1)}

,

E

and

0

. Thusthereexists

p

suhthat

p→(∃M.l, V

2

\{|V

2

| −(n+ 1)}, E,0−→M)∧

(p→ ⊥)→(∃M.l, V

2

\{|V

2

| −(n+ 1)}, E,0−→M)→ ⊥

(4.13)

Eahmathingbetweentwosethasavaluegreaterorequalthanzero(exept

the ase inwhihwe onsider ars with negative weight). Thus

p

has tobe true. Westatethisfatassertingthevalidityof

p

. Sowehavetwonewgoals:

p

and

p→

(4.6). Toprove

p

: weassertthat theexisteneamathingbetween

l

and

V

2

\{|V

2

| −(n+ 1)}

withavaluehigherorequalthan

0

. Wereatetwo newsubgoals:

(∃M.l, V

2

\{|V

2

| −(n+ 1)}, E,0−→M)→p.

(4.15) Toprove(4.14): by denitionthe returningmathing,ifit exists, is alist of naturals, permutationof

V

2

\{|V

2

| −(n+ 1)}

. Sowe anreturnthe identity permutation,thatisweintrodue

V

2

\{|V

2

| −(n+ 1)}

for

M

. Wehavetoprove:

MATCH

(V

2

\{|V

2

| −(n+ 1)}, V

2

\{|V

2

| −(n+ 1)})

: ByProp. 4.2.1.

0≤

SUM

(l, V

2

\{|V

2

| −(n+ 1)}, E)

: Bydenitionof SUM. To prove (4.15): Assume ip

:

M.l, V

2

\{|V

2

| −(n+ 1)}, E,0

−→

M

. The hypothesis(4.13) is aonjuntion, so both thebranheshaveto be true. In partiular, by ip,

(∃M.l, V

2

\{|V

2

| −(n+ 1)}, E,0

−→M)

→ ⊥

is false, thus

p→ ⊥

hastobefalseand

p

true. Toprove

p→

(4.6). Assume

p

. Weintrodue ttfor

p

in(4.6)obtaining

tt

→(∃M.(a::l), V

2

, E, T

−→

n+1

M)∧

⊥ →(∃M.(a::l), V

2

, E, T

−→

n+1

M)→ ⊥

(4.16)

Toprovethepositivepart of(4.16): assume tt. Instantiatetheleft of (4.13) on

p

,soweknow

M

suhthat:

l, V

2

\{|V

2

| −(n+ 1)}, E,0−→M

(4.17) Weintrodue

(V

2

[|V

2

| −(n+ 1)] ::M)

for

M

. Wehavetoprove:

MATCH

(V

2

[|V

2

| −(n+ 1)] ::

M , V

2

)

: By

(M2)

it orresponds to prove MATCH

(M , V

2

\{|V

2

| −(n+ 1)})

thatfollowby(4.17).

T

SUM

((a::

l), V

2

[|V

2

| −(n+ 1)] ::

M , E)

: It is equivalent to prove

T

E[a, V

2

[|V

2

| −(n+ 1)]] +

SUM

(l, M , E)

. This fat follows from SUM

(l, M , E)≥0

,by(4.17), andby thehypothesis

E[a, V

2

[|V

2

| −(n+

1)]]≥T

.

• |V

2

| −(n+ 1)≤♮((V

2

[|V

2

| −(n+ 1)] ::

M)[0], V

2

)

: alreadyprovedas a validinequality.

Toprovethenegativepartof(4.16): by(Efq).

TheomputationalontentoftheTheorem4.2.2isshowedinTable4.1(the algorithmiswrittenbymetarules)

Related documents