• Keine Ergebnisse gefunden

Theorem Knaster – Tarski

N/A
N/A
Protected

Academic year: 2022

Aktie "Theorem Knaster – Tarski"

Copied!
69
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Theorem Knaster – Tarski

Assume D is a complete lattice. Then every monotonic function f : D

D has a least fixpoint d0

D.

Let P

= {

d

D

|

f d

d

}

. Then d0

=

F P .

(2)
(3)

Theorem Knaster – Tarski

Assume D is a complete lattice. Then every monotonic function f : D

D has a least fixpoint d0

D.

Let P

= {

d

D

|

f d

d

}

. Then d0

=

F P .

Proof:

(1) d0

P :

(4)

Theorem Knaster – Tarski

Assume D is a complete lattice. Then every monotonic function f : D

D has a least fixpoint d0

D.

Let P

= {

d

D

|

f d

d

}

. Then d0

=

F P .

Proof:

(1) d0

P :

f d0

f d

d for all d

P

==⇒ f d0 is a lower bound of P

==⇒ f d0

d0 since d0

=

F P

==⇒ d0

P :-)

(5)

(2) f d0

=

d0 :

(6)

(2) f d0

=

d0 :

f d0

d0 by (1)

==⇒ f

(

f d0

) ⊑

f d0 by monotonicity of f

==⇒ f d0

P

==⇒ d0

f d0 and the claim follows :-)

(7)

(2) f d0

=

d0 :

f d0

d0 by (1)

==⇒ f

(

f d0

) ⊑

f d0 by monotonicity of f

==⇒ f d0

P

==⇒ d0

f d0 and the claim follows :-)

(3) d0 is least fixpoint:

(8)

(2) f d0

=

d0 :

f d0

d0 by (1)

==⇒ f

(

f d0

) ⊑

f d0 by monotonicity of f

==⇒ f d0

P

==⇒ d0

f d0 and the claim follows :-)

(3) d0 is least fixpoint:

f d1

=

d1

d1 an other fixpoint

==⇒ d1

P

==⇒ d0

d1 :-))

(9)

Remark:

The least fixpoint d0 is in P and a lower bound :-)

==⇒ d0 is the least value x with x

f x

(10)

Remark:

The least fixpoint d0 is in P and a lower bound :-)

==⇒ d0 is the least value x with x

f x

Application:

Assume xi

fi

(

x1, . . . , xn

)

, i

=

1, . . . ,n

(∗)

is a system of constraints where all fi : Dn

D are monotonic.

(11)

Remark:

The least fixpoint d0 is in P and a lower bound :-)

==⇒ d0 is the least value x with x

f x

Application:

Assume xi

fi

(

x1, . . . , xn

)

, i

=

1, . . . ,n

(∗)

is a system of constraints where all fi : Dn

D are monotonic.

==⇒ least solution of

(∗) ==

least fixpoint of F :-)

(12)

Example 1:

D

=

2U, f x

=

x

a

b

(13)

Example 1:

D

=

2U, f x

=

x

a

b

f fk

fk

0

U

(14)

Example 1:

D

=

2U, f x

=

x

a

b

f fk

fk

0

U

1 b a

b

(15)

Example 1:

D

=

2U, f x

=

x

a

b

f fk

fk

0

U

1 b a

b

2 b a

b

(16)

Example 1:

D

=

2U, f x

=

x

a

b

f fk

fk

0

U

1 b a

b

2 b a

b

Example 2:

D

=

N

∪ {

}

Assume f x

=

x

+

1. Then

fi

⊥ =

fi 0

=

ii

+

1

=

fi+1

(17)

Example 1:

D

=

2U, f x

=

x

a

b

f fk

fk

0

U

1 b a

b

2 b a

b

Example 2:

D

=

N

∪ {

}

Assume f x

=

x

+

1. Then

fi

⊥ =

fi 0

=

ii

+

1

=

fi+1

==⇒ Ordinary iteration will never reach a fixpoint :-(

==⇒ Sometimes, transfinite iteration is needed :-)

(18)

Conclusion:

Systems of inequations can be solved through fixpoint iteration, i.e., by repeated evaluation of right-hand sides :-)

(19)

Conclusion:

Systems of inequations can be solved through fixpoint iteration, i.e., by repeated evaluation of right-hand sides :-)

Warning:

Naive fixpoint iteration is rather inefficient :-(

(20)

Conclusion:

Systems of inequations can be solved through fixpoint iteration, i.e., by repeated evaluation of right-hand sides :-)

Warning:

Naive fixpoint iteration is rather inefficient :-(

Example:

3 2

4 5

0

1

y = 1;

x = x1;

y = x y;

Pos(x > 1) Neg(x >1)

0 1 2 3 4 5

(21)

Conclusion:

Systems of inequations can be solved through fixpoint iteration, i.e., by repeated evaluation of right-hand sides :-)

Warning:

Naive fixpoint iteration is rather inefficient :-(

Example:

3 2

4 5

0

1

y = 1;

x = x1;

y = x y;

Pos(x > 1) Neg(x >1)

1

0

1 {1,x >1,x1}

2 Expr

3 {1,x >1,x1}

4 {1}

5 Expr

(22)

Conclusion:

Systems of inequations can be solved through fixpoint iteration, i.e., by repeated evaluation of right-hand sides :-)

Warning:

Naive fixpoint iteration is rather inefficient :-(

Example:

3 2

4 5

0

1

y = 1;

x = x1;

y = x y;

Pos(x > 1) Neg(x >1)

1 2

0

1 {1,x >1,x1} {1}

2 Expr {1,x>1,x1}

3 {1,x >1,x1} {1,x>1,x1}

4 {1} {1}

5 Expr {1,x>1,x1}

(23)

Conclusion:

Systems of inequations can be solved through fixpoint iteration, i.e., by repeated evaluation of right-hand sides :-)

Warning:

Naive fixpoint iteration is rather inefficient :-(

Example:

3 2

4 5

0

1

y = 1;

x = x1;

y = x y;

Pos(x > 1) Neg(x >1)

1 2 3

0

1 {1,x >1,x1} {1} {1}

2 Expr {1,x>1,x1} {1,x >1}

3 {1,x >1,x1} {1,x>1,x1} {1,x>1,x1}

4 {1} {1} {1}

5 Expr {1,x>1,x1} {1,x >1}

(24)

Conclusion:

Systems of inequations can be solved through fixpoint iteration, i.e., by repeated evaluation of right-hand sides :-)

Warning:

Naive fixpoint iteration is rather inefficient :-(

Example:

3 2

4 5

0

1

y = 1;

x = x1;

y = x y;

Pos(x > 1) Neg(x >1)

1 2 3 4

0

1 {1,x >1,x1} {1} {1} {1}

2 Expr {1,x>1,x1} {1,x >1} {1,x >1}

3 {1,x >1,x1} {1,x>1,x1} {1,x>1,x1} {1,x >1}

4 {1} {1} {1} {1}

5 Expr {1,x>1,x1} {1,x >1} {1,x >1}

(25)

Conclusion:

Systems of inequations can be solved through fixpoint iteration, i.e., by repeated evaluation of right-hand sides :-)

Warning:

Naive fixpoint iteration is rather inefficient :-(

Example:

3 2

4 5

0

1

y = 1;

x = x1;

y = x y;

Pos(x > 1) Neg(x >1)

1 2 3 4 5

0

1 {1,x >1,x1} {1} {1} {1}

2 Expr {1,x>1,x1} {1,x >1} {1,x >1}

3 {1,x >1,x1} {1,x>1,x1} {1,x>1,x1} {1,x >1} dito

4 {1} {1} {1} {1}

5 Expr {1,x>1,x1} {1,x >1} {1,x >1}

(26)

Idea: Round Robin Iteration

Instead of accessing the values of the last iteration, always use the current values of unknowns :-)

(27)

Idea: Round Robin Iteration

Instead of accessing the values of the last iteration, always use the current values of unknowns :-)

Example:

3 2

4 5

0

1

y = 1;

x = x1;

y = xy;

Pos(x > 1) Neg(x > 1)

0 1 2 3 4 5

(28)

Idea: Round Robin Iteration

Instead of accessing the values of the last iteration, always use the current values of unknowns :-)

Example:

3 2

4 5

0

1

y = 1;

x = x1;

y = xy;

Pos(x > 1) Neg(x > 1)

1

0

1 {1} 2 {1,x > 1} 3 {1,x > 1} 4 {1} 5 {1,x > 1}

(29)

Idea: Round Robin Iteration

Instead of accessing the values of the last iteration, always use the current values of unknowns :-)

Example:

3 2

4 5

0

1

y = 1;

x = x1;

y = xy;

Pos(x > 1) Neg(x > 1)

1 2

0

1 {1} 2 {1,x > 1}

3 {1,x > 1} dito 4 {1}

5 {1,x > 1}

(30)

The code for Round Robin Iteration in Java looks as follows:

for

(

i

=

1;i

n;i

++)

xi

= ⊥

; do {

finished

=

true;

for

(

i

=

1; i

n; i

++)

{ new

=

fi

(

x1, . . . , xn

)

; if (!

(

xi

new

))

{

finished

=

false; xi

=

xi

new;

} }

} while

(

!finished

)

;

(31)

Correctness:

Assume y(id) is the i-th component of Fd

.

Assume x(id) is the value of xi after the d-th RR-iteration.

(32)

Correctness:

Assume y(id) is the i-th component of Fd

.

Assume x(id) is the value of xi after the i-th RR-iteration.

One proves:

(1) y(id)

x(id) :-)

(33)

Correctness:

Assume y(id) is the i-th component of Fd

.

Assume x(id) is the value of xi after the i-th RR-iteration.

One proves:

(1) y(id)

x(id) :-)

(2) xi(d)

zi for every solution

(

z1, . . . , zn

)

:-)

(34)

Correctness:

Assume y(id) is the i-th component of Fd

.

Assume x(id) is the value of xi after the i-th RR-iteration.

One proves:

(1) y(id)

x(id) :-)

(2) xi(d)

zi for every solution

(

z1, . . . , zn

)

:-) (3) If RR-iteration terminates after d rounds, then

(

x(1d), . . . , x(nd)

)

is a solution :-))

(35)

Warning:

The efficiency of RR-iteration depends on the ordering of the unknowns !!!

(36)

Warning:

The efficiency of RR-iteration depends on the ordering of the unknowns !!!

Good:

u before v, if u

v;

→ entry condition before loop body :-)

(37)

Warning:

The efficiency of RR-iteration depends on the ordering of the unknowns !!!

Good:

u before v, if u

v;

→ entry condition before loop body :-) Bad:

e.g., post-order DFS of the CFG, starting at start :-)

(38)

Good:

3 2

4 5

0

1

y = 1;

x = x1;

y = xy;

Pos(x > 1) Neg(x >1)

Bad:

0

5

4

3 2 1

x = x1;

y = xy;

Pos(x > 1) Neg(x > 1)

y = 1;

(39)

Inefficient Round Robin Iteration:

0

5

4

3 2 1

x = x1;

y = xy;

Pos(x > 1) Neg(x > 1)

y =1;

0 1 2 3 4 5

(40)

Inefficient Round Robin Iteration:

0

5

4

3 2 1

x = x1;

y = xy;

Pos(x > 1) Neg(x > 1)

y =1; 1

0 Expr

1 {1}

2 {1,x1,x >1}

3 Expr

4 {1}

5

(41)

Inefficient Round Robin Iteration:

0

5

4

3 2 1

x = x1;

y = xy;

Pos(x > 1) Neg(x > 1)

y =1; 1 2

0 Expr {1,x >1}

1 {1} {1}

2 {1,x1,x >1} {1,x1,x> 1}

3 Expr {1,x >1}

4 {1} {1}

5

(42)

Inefficient Round Robin Iteration:

0

5

4

3 2 1

x = x1;

y = xy;

Pos(x > 1) Neg(x > 1)

y =1; 1 2 3

0 Expr {1,x >1} {1,x >1}

1 {1} {1} {1}

2 {1,x1,x >1} {1,x1,x> 1} {1,x >1}

3 Expr {1,x >1} {1,x >1}

4 {1} {1} {1}

5

(43)

Inefficient Round Robin Iteration:

0

5

4

3 2 1

x = x1;

y = xy;

Pos(x > 1) Neg(x > 1)

y =1; 1 2 3 4

0 Expr {1,x >1} {1,x >1}

1 {1} {1} {1}

2 {1,x1,x >1} {1,x1,x> 1} {1,x >1} dito 3 Expr {1,x >1} {1,x >1}

4 {1} {1} {1}

5

==⇒ significantly less efficient :-)

(44)

... end of background on: Complete Lattices

(45)

... end of background on: Complete Lattices

Final Question:

Why is a (or the least) solution of the constraint system useful ???

(46)

... end of background on: Complete Lattices

Final Question:

Why is a (or the least) solution of the constraint system useful ???

For a complete lattice D, consider systems:

I [

start

] ⊒

d0

I [

v

] ⊒ [[

k

]]

(I [

u

])

k

= (

u,_,v

)

edge where d0

D and all

[[

k

]]

: D

D are monotonic ...

(47)

... end of background on: Complete Lattices

Final Question:

Why is a (or the least) solution of the constraint system useful ???

For a complete lattice D, consider systems:

I [

start

] ⊒

d0

I [

v

] ⊒ [[

k

]]

(I [

u

])

k

= (

u,_,v

)

edge where d0

D and all

[[

k

]]

: D

D are monotonic ...

==⇒ Monotonic Analysis Framework

(48)

Wanted: MOP

(Merge Over all Paths)

I

[

v

] =

G

{[[

π

]]

d0

|

π : start

v

}

(49)

Wanted: MOP

(Merge Over all Paths)

I

[

v

] =

G

{[[

π

]]

d0

|

π : start

v

}

Theorem

Kam, Ullman 1975

Assume

I

is a solution of the constraint system. Then:

I [

v

] ⊒ I

[

v

]

for every v

(50)

Jeffrey D. Ullman, Stanford

(51)

Wanted: MOP

(Merge Over all Paths)

I

[

v

] =

G

{[[

π

]]

d0

|

π : start

v

}

Theorem

Kam, Ullman 1975

Assume

I

is a solution of the constraint system. Then:

I [

v

] ⊒ I

[

v

]

for every v

In particular:

I [

v

] ⊒ [[

π

]]

d0 for every π : start

v

(52)

Proof:

Induction on the length of π.

(53)

Proof:

Induction on the length of π.

Foundation: π

=

ǫ (empty path)

(54)

Proof:

Induction on the length of π.

Foundation: π

=

ǫ (empty path) Then:

[[

π

]]

d0

= [[

ǫ

]]

d0

=

d0

⊑ I [

start

]

(55)

Proof:

Induction on the length of π.

Foundation: π

=

ǫ (empty path) Then:

[[

π

]]

d0

= [[

ǫ

]]

d0

=

d0

⊑ I [

start

]

Step: π

=

πk for k

= (

u,_, v

)

edge.

(56)

Proof:

Induction on the length of π.

Foundation: π

=

ǫ (empty path) Then:

[[

π

]]

d0

= [[

ǫ

]]

d0

=

d0

⊑ I [

start

]

Step: π

=

πk for k

= (

u,_, v

)

edge.

Then:

[[

π

]]

d0

⊑ I [

u

]

by I.H. for π

==⇒

[[

π

]]

d0

= [[

k

]]

([[

π

]]

d0

)

⊑ [[

k

]]

(I [

u

])

since

[[

k

]]

monotonic

⊑ I [

v

]

since

I

solution :-))

(57)

Disappointment:

Are solutions of the constraint system just upper bounds ???

(58)

Disappointment:

Are solutions of the constraint system just upper bounds ???

Answer:

In general: yes :-(

(59)

Disappointment:

Are solutions of the constraint system just upper bounds ???

Answer:

In general: yes :-(

With the notable exception when all functions

[[

k

]]

are distributive ... :-)

(60)

The function f : D1

D2 is called

• distributive, if f

(

F X

) =

F

{

f x

|

x

X

}

for all

∅ 6=

X

D;

• strict, if f

⊥ = ⊥

.

• totally distributive, if f is distributive and strict.

(61)

The function f : D1

D2 is called

• distributive, if f

(

F X

) =

F

{

f x

|

x

X

}

for all

∅ 6=

X

D;

• strict, if f

⊥ = ⊥

.

• totally distributive, if f is distributive and strict.

Examples:

f x

=

x

a

b for a, b

U .

(62)

The function f : D1

D2 is called

• distributive, if f

(

F X

) =

F

{

f x

|

x

X

}

for all

∅ 6=

X

D;

• strict, if f

⊥ = ⊥

.

• totally distributive, if f is distributive and strict.

Examples:

f x

=

x

a

b for a, b

U .

Strictness: f

∅ =

a

∩ ∅ ∪

b

=

b =

whenever b

= ∅

:-(

(63)

The function f : D1

D2 is called

• distributive, if f

(

F X

) =

F

{

f x

|

x

X

}

for all

∅ 6=

X

D;

• strict, if f

⊥ = ⊥

.

• totally distributive, if f is distributive and strict.

Examples:

f x

=

x

a

b for a, b

U .

Strictness: f

∅ =

a

∩ ∅ ∪

b

=

b =

whenever b

= ∅

:-(

Distributivity:

f

(

x1

x2

) =

a

∩ (

x1

x2

) ∪

b

=

a

x1

a

x2

b

= f x1

f x2 :-)

(64)

• D1

=

D2

=

N

∪ {

}

, inc x

=

x

+

1

(65)

• D1

=

D2

=

N

∪ {

}

, inc x

=

x

+

1

Strictness: f

⊥ =

inc 0

=

1 6=

:-(

(66)

• D1

=

D2

=

N

∪ {

}

, inc x

=

x

+

1

Strictness: f

⊥ =

inc 0

=

1 6=

:-(

Distributivity: f

(

F X

)

= F

{

x

+

1

|

x

X

}

for

∅ 6=

X :-)

(67)

• D1

=

D2

=

N

∪ {

}

, inc x

=

x

+

1

Strictness: f

⊥ =

inc 0

=

1 6=

:-(

Distributivity: f

(

F X

)

= F

{

x

+

1

|

x

X

}

for

∅ 6=

X :-)

• D1

= (

N

∪ {

})

2, D2

=

N

∪ {

}

, f

(

x1, x2

) =

x1

+

x2

(68)

• D1

=

D2

=

N

∪ {

}

, inc x

=

x

+

1

Strictness: f

⊥ =

inc 0

=

1 6=

:-(

Distributivity: f

(

F X

)

= F

{

x

+

1

|

x

X

}

for

∅ 6=

X :-)

• D1

= (

N

∪ {

})

2, D2

=

N

∪ {

}

, f

(

x1, x2

) =

x1

+

x2 : Strictness: f

⊥ =

0

+

0 = 0 :-)

(69)

• D1

=

D2

=

N

∪ {

}

, inc x

=

x

+

1

Strictness: f

⊥ =

inc 0

=

1 6=

:-(

Distributivity: f

(

F X

)

= F

{

x

+

1

|

x

X

}

for

∅ 6=

X :-)

• D1

= (

N

∪ {

})

2, D2

=

N

∪ {

}

, f

(

x1, x2

) =

x1

+

x2 : Strictness: f

⊥ =

0

+

0 = 0 :-)

Distributivity:

f

((

1, 4

) ⊔ (

4, 1

)) =

f

(

4, 4

) =

8

6= 5

=

f

(

1, 4

) ⊔

f

(

4, 1

)

:-)

Referenzen

ÄHNLICHE DOKUMENTE

For example, the transitions from health to depression (and viceversa) can be abrupt and unexpected and this is why their prediction is a major problem in psychiatry. When the ASS

Empirical and theoretical research on mutual-aid games indicates tha Empirical and theoretical research on mutual-aid games indicates tha engaged in joint enterprises Since

The main way jihadi groups get hold of these weapons is by stealing them from the regu- lar armed forces – like ISIL did in Iraq or Boko Haram in Nigeria.. In

tiresome, hard work at dusty archives and taken to the active virtual life via social media. Almost all photos got comments, disproving or confirming

The respect and prestige of scientist who manage to actually en- gage the general public in the USA (and other parts of the anglophone world) is seen evident in the likes of

• A transformation definition is a set of transformation rules that together describe how a model in the source language can be transformed into a model in the target language. •

Systems of inequations can be solved through fixpoint iteration, i.e., by repeated evaluation of right-hand sides :-).. Conclusion:.. Systems of inequations can be solved

Systems of inequations can be solved through fixpoint iteration, i.e., by repeated evaluation of right-hand sides :-).. Conclusion:.. Systems of inequations can be solved