semirings for breakfast - marc pouly · semirings for breakfast marc pouly [email protected]...

35
Semirings for Breakfast Marc Pouly [email protected] Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg July 2010 Marc Pouly Semirings for Breakfast 1/ 27

Upload: others

Post on 19-Oct-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Semirings for Breakfast

Marc Pouly

[email protected]

Interdisciplinary Center for Security, Reliability and TrustUniversity of Luxembourg

July 2010

Marc Pouly Semirings for Breakfast 1/ 27

Page 2: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Semirings

Algebraic structure with two operations + and × over a set A.+ and × are associative+ is commutative× distributes over +: a× (b + c) = (a× b) + (a× c)

If × is commutative too commutative semiring

Marc Pouly Semirings for Breakfast 2/ 27

Page 3: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Examples I

Arithmetic Semirings: 〈R,+, ·〉, 〈Z,+, ·〉, 〈N,+, ·〉, . . .Boolean Semiring: 〈{0,1},∨,∧〉Tropical Semiring: 〈N,min,+〉Arctic Semiring: 〈N,max,+〉Possibilistic Semiring: 〈[0,1],max, ·〉Powerset lattice: 〈P(S),∪,∩〉Bottleneck Semiring: 〈R,max,min〉Truncation Semiring: 〈{0, . . . , k},max,min{a + b, k}〉Lukasiewicz Semiring: 〈[0,1],min,max{a + b − 1,0}〉Division Semiring: 〈N, lcm,gcd〉Formal Languages: 〈P(Σ∗),∪, ◦〉 not commutative

Marc Pouly Semirings for Breakfast 3/ 27

Page 4: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Examples II

Vectors over semirings form a semiring

Matrices over semirings form a semiring

Polynomials over semirings form a semiring

...

Marc Pouly Semirings for Breakfast 4/ 27

Page 5: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Today’s Breakfast Lessons

2 reasons why computer scientists are interested in semirings:they reduce problem complexity

they enable generic problem solving

2 reasons why mathematicians are interested in semirings:ordered semirings are fundamentally different from fields

new research fields thanks to applications in CS

Marc Pouly Semirings for Breakfast 5/ 27

Page 6: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Today’s Breakfast Lessons

2 reasons why computer scientists are interested in semirings:they reduce problem complexity

they enable generic problem solving

2 reasons why mathematicians are interested in semirings:ordered semirings are fundamentally different from fields

new research fields thanks to applications in CS

Marc Pouly Semirings for Breakfast 5/ 27

Page 7: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Lesson 1:

Reducing Problem Complexity

Marc Pouly Semirings for Breakfast 6/ 27

Page 8: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Bayesian Networks

Visit to Asia Smoking

Tuberculosis

pos. X-ray

EitherT or L

Lung Cancer Bronchitis

Dyspnoea

p(t|a) = 0.05p(t|a) = 0.01

p( x|e) = 0.98p( x|e) = 0.05

p(d|e, b) = 0.9p(d|e, b) = 0.7p(d|e, b) = 0.8p(d|e, b) = 0.1

p(s) = 0.4

p(l |s) = 0.1p(l |s) = 0.01

p(b|s) = 0.6p(b|s) = 0.3

p(a) = 0.01

Marc Pouly Semirings for Breakfast 7/ 27

Page 9: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Medical Diagnostics

A patient turns to a doctor and complains about shortness ofbreath (Dyspnoea). Also, she confirms a recent trip to Asia.What is the probability that she suffers from Bronchitis?

p(B|A,D) =p(A,B,D)

p(A,D)

This requires to compute

p(A,B,D) =∑

E ,L,S,T ,X

p(A,B,D,E ,L,S,T ,X )

with

p(A,B,D,E ,L,S,T ,X ) = p(A)× p(T |A)× · · · × p(D|E ,B)

Marc Pouly Semirings for Breakfast 8/ 27

Page 10: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Medical Diagnostics

A patient turns to a doctor and complains about shortness ofbreath (Dyspnoea). Also, she confirms a recent trip to Asia.What is the probability that she suffers from Bronchitis?

p(B|A,D) =p(A,B,D)

p(A,D)

This requires to compute

p(A,B,D) =∑

E ,L,S,T ,X

p(A,B,D,E ,L,S,T ,X )

with

p(A,B,D,E ,L,S,T ,X ) = p(A)× p(T |A)× · · · × p(D|E ,B)

Marc Pouly Semirings for Breakfast 8/ 27

Page 11: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Complexity Concerns

p(A,B,D,E ,L,S,T ,X ) is a table with 28 values

A joint prob. distribution over n variables has 2n entries

Quick Medical Reference has more than 5000 variables

Solution: Apply the distributive law:

p(A,B,D) =∑

E ,L,S,T ,X

p(A,B,D,E ,L,S,T ,X )

is equal to

p(A)∑

E

p(D|B,E)∑

X

p(X |E)(∑

T

p(T |A)(∑

L

p(E |L,T )(∑

S

p(L|S)p(B|S)p(S))))

Marc Pouly Semirings for Breakfast 9/ 27

Page 12: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Complexity Concerns

p(A,B,D,E ,L,S,T ,X ) is a table with 28 values

A joint prob. distribution over n variables has 2n entries

Quick Medical Reference has more than 5000 variables

Solution: Apply the distributive law:

p(A,B,D) =∑

E ,L,S,T ,X

p(A,B,D,E ,L,S,T ,X )

is equal to

p(A)∑

E

p(D|B,E)∑

X

p(X |E)(∑

T

p(T |A)(∑

L

p(E |L,T )(∑

S

p(L|S)p(B|S)p(S))))

Marc Pouly Semirings for Breakfast 9/ 27

Page 13: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Complexity Concerns

p(A)∑

E

p(D|B,E)∑

X

p(X |E)(∑

T

p(T |A)(∑

L

p(E |L,T )(∑

S

p(L|S)p(B|S)p(S))))

The largest intermediate table involves 4 variables

Semirings allow to reduce complexity.

Intuitively, compare the number of operations

a× (b + c) = (a× b) + (a× c)

The fusion algorithm produces such factorizations

Marc Pouly Semirings for Breakfast 10/ 27

Page 14: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Lesson 2:

Generic Reasoning

Marc Pouly Semirings for Breakfast 11/ 27

Page 15: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Generic Reasoning

The fusion algorithm is only based on the properties of acommutative semiring

We can exchange the semiring in the problem description

Example: take 〈[0,1],max, ·〉 instead of 〈R,+, ·〉

maxE,L,S,T ,X

p(A,B,D,E , L,S,T ,X) =

p(A) max p(D|B,E) max p(X |E)(

max p(T |A)(

max p(E |L,T )(

max p(L|S)p(B|S)p(S))))

This identifies the value of the most probable configuration

Marc Pouly Semirings for Breakfast 12/ 27

Page 16: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Beyond Bayesian Networks

The same computational problem over different semirings:〈{0,1},∨,∧〉 crisp constraint reasoning〈N,min,+〉 weighted constraint reasoning〈[0,1],max, ·〉 possibilistic constraint reasoning〈P(S),∪,∩〉 assumption-based reasoning

Different semirings different semantics ofthe same problemthe same algorithmthe same complexitythe same implementation

Marc Pouly Semirings for Breakfast 13/ 27

Page 17: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Lesson 3:

A fundamentally different Branchof Mathematics

Marc Pouly Semirings for Breakfast 14/ 27

Page 18: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Semirings and Order I

We introduce the following relation on a semiring:

a � b if, and only if ∃c ∈ A such that a + c = b

Reflexivity: a � a

Transitivity: a � b and b � c ⇒ a � c

Conclusion: � is a preorder called canonical preorder

All semirings provide a canonical preorder

Marc Pouly Semirings for Breakfast 15/ 27

Page 19: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Semirings and Order I

We introduce the following relation on a semiring:

a � b if, and only if ∃c ∈ A such that a + c = b

Reflexivity: a � a

Transitivity: a � b and b � c ⇒ a � c

Conclusion: � is a preorder called canonical preorder

All semirings provide a canonical preorder

Marc Pouly Semirings for Breakfast 15/ 27

Page 20: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Semirings and Order II

In general, � is not antisymmetric, i.e.

a � b and b � a ; a = b

Example: in 〈Z,+, ·〉 we have −1 � 2 and 2 � −1

Does not only hold for 〈Z,+, ·〉 but for all structures withinverse additive elements

Antisymmetry of � contradicts the group structure of (A,+)

Marc Pouly Semirings for Breakfast 16/ 27

Page 21: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Semirings and Order II

In general, � is not antisymmetric, i.e.

a � b and b � a ; a = b

Example: in 〈Z,+, ·〉 we have −1 � 2 and 2 � −1

Does not only hold for 〈Z,+, ·〉 but for all structures withinverse additive elements

Antisymmetry of � contradicts the group structure of (A,+)

Marc Pouly Semirings for Breakfast 16/ 27

Page 22: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Dioids

This splits algebra into:semirings with additive inverse elements (e.g. fields)

semirings with a canonical partial order called dioids

Dioid theory is fundamentally different from maths over fields

Are dioids of (practical) importance ?

Marc Pouly Semirings for Breakfast 17/ 27

Page 23: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Examples of Dioids

TheoremSemirings with idempotent + (i.e. a + a = a) are always dioids.

Arithmetic Semirings: 〈R,+, ·〉, 〈Z,+, ·〉, 〈N,+, ·〉, . . .Boolean Semiring: 〈{0, 1},∨,∧〉Tropical Semiring: 〈N,min,+〉Arctic Semiring: 〈N,max,+〉Possibilistic Semiring: 〈[0, 1],max, ·〉Powerset lattice: 〈P(S),∪,∩〉Bottleneck Semiring: 〈R,max,min〉Truncation Semiring: 〈{0, . . . , k},max,min{a + b, k}〉Lukasiewicz Semiring: 〈[0, 1],min,max{a + b − 1, 0}〉Division Semiring: 〈N, lcm, gcd〉Formal Languages: 〈P(Σ∗),∪, ◦〉 not commutative

Marc Pouly Semirings for Breakfast 18/ 27

Page 24: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Examples of Dioids

TheoremSemirings with idempotent + (i.e. a + a = a) are always dioids.

Arithmetic Semirings: 〈R,+, ·〉, 〈Z,+, ·〉, 〈N,+, ·〉, . . .Boolean Semiring: 〈{0, 1},∨,∧〉Tropical Semiring: 〈N,min,+〉Arctic Semiring: 〈N,max,+〉Possibilistic Semiring: 〈[0, 1],max, ·〉Powerset lattice: 〈P(S),∪,∩〉Bottleneck Semiring: 〈R,max,min〉Truncation Semiring: 〈{0, . . . , k},max,min{a + b, k}〉Lukasiewicz Semiring: 〈[0, 1],min,max{a + b − 1, 0}〉Division Semiring: 〈N, lcm, gcd〉Formal Languages: 〈P(Σ∗),∪, ◦〉 not commutative

Marc Pouly Semirings for Breakfast 18/ 27

Page 25: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Lesson 4:

Application of Dioid Theory

Marc Pouly Semirings for Breakfast 19/ 27

Page 26: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Shortest Distance from S to T

C

B D

TAS9

3

4

6

2

1 5

Compute

9 + 4 = 131 + 6 + 5 = 12

1 + 2 + 3 + 5 = 11

and then

min{13,12,11} = 11

Marc Pouly Semirings for Breakfast 20/ 27

Page 27: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Connectivity of S and T

C

B D

TAS0

0

1

1

1

1 1

Compute

min{0,1} = 0min{1,1,1} = 1

min{1,1,0,1} = 0

and then

max{0,1,0} = 1

Marc Pouly Semirings for Breakfast 21/ 27

Page 28: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Largest Capacity from S to T

C

B D

TAS3.4

3.5

4.5

5.5

4.2

3.6 5.1

Compute

min{3.4,4.5} = 3.4min{3.6,5.5,5.1} = 3.6

min{3.6,4.2,3.5,5.1} = 3.5

and then

max{3.4,3.6,3.5} = 3.6

Marc Pouly Semirings for Breakfast 22/ 27

Page 29: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Maximum Reliability from S to T

C

B D

TAS0.4

1.0

0.8

0.2

0.9

0.9 0.7

Compute

0.4 · 0.8 = 0.320.9 · 0.2 · 0.7 = 0.126

0.9 · 0.9 · 1.0 · 0.7 = 0.567

and then

max{0.32,0.126,0.567} = 0.567

Marc Pouly Semirings for Breakfast 23/ 27

Page 30: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Language leading from S to T in the Automaton

C

B D

TAS

{b}

{c}

{b}

{c}

{a} {a}

{a}

Compute

{a} ◦ {c} = {ac}{a} ◦ {b} ◦ {a} = {aba}

{a} ◦ {c} ◦ {b} ◦ {a} = {acba}and then⋃

{{ac}, {aba}, {acba}} = {ac,aba,acba}

Marc Pouly Semirings for Breakfast 24/ 27

Page 31: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

The Algebraic Path Problem

These are path problems over different semirings

If M denotes the matrix of edge weights in the graph,all-pairs path problems are solved by computing

D =⊕r≥0

Mr = I + M + M2 + M3 + . . .

This is an infinite series of semiring matrices

A solution is obtained if the series converges. Thisrequires the notion of a topology

Marc Pouly Semirings for Breakfast 25/ 27

Page 32: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

The Algebraic Path Problem

These are path problems over different semirings

If M denotes the matrix of edge weights in the graph,all-pairs path problems are solved by computing

D =⊕r≥0

Mr = I + M + M2 + M3 + . . .

This is an infinite series of semiring matrices

A solution is obtained if the series converges. Thisrequires the notion of a topology

Marc Pouly Semirings for Breakfast 25/ 27

Page 33: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Semiring Topology

The partial order in dioids allows to introduce a particulartopology and to study the convergence of the series

TheoremIf the limit D exists, then it corresponds to the least solution tothe fixpoint equation X = MX + I

Hence, arbitrary path problems are computed by a singlealgorithm that solves a dioid fixpoint equation system

This was the hour of birth of semiring topology

Marc Pouly Semirings for Breakfast 26/ 27

Page 34: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Semiring Topology

The partial order in dioids allows to introduce a particulartopology and to study the convergence of the series

TheoremIf the limit D exists, then it corresponds to the least solution tothe fixpoint equation X = MX + I

Hence, arbitrary path problems are computed by a singlealgorithm that solves a dioid fixpoint equation system

This was the hour of birth of semiring topology

Marc Pouly Semirings for Breakfast 26/ 27

Page 35: Semirings for Breakfast - Marc Pouly · Semirings for Breakfast Marc Pouly marc.pouly@unifr.ch Interdisciplinary Center for Security, Reliability and Trust University of Luxembourg

Recap of today’s Breakfast Lessons

2 reasons why computer scientists are interested in semirings:they reduce problem complexity

they enable generic problem solving

2 reasons why mathematicians are interested in semirings:ordered semirings are fundamentally different from fields

new research fields thanks to applications in CS

Marc Pouly Semirings for Breakfast 27/ 27