• Aucun résultat trouvé

A bridge between semirings

N/A
N/A
Protected

Academic year: 2022

Partager "A bridge between semirings"

Copied!
30
0
0

Texte intégral

(1)

A bridge between semirings

Flavien BREUVART

PPS, Paris Denis Diderot & LIPN, Paris Nord

march 11th-26th 2014

(2)

Introduction

Semirings S , R for resource management

Many papers are using semirings for modelizing quantitative resources.

Bounded logics B

S

LL [Ghica&Al13,Brunel&Al13]

Generalisation of previous works that decompose LL exponential along semirings.

No generic concrete model.

Model Rel

R

of LL [CarraroEhrhardSalibra09]

The relational model endowed with a non free exponential using semiring-indexed multisets.

General theorem

Every bounded logic B

S

LL has as model REL

(R,˜∈,S)

.

(3)

Table of content

Logic

Ordered semirings

Curry Howard

The logic B

S

LL

Examples

Categorical semantic

Ghica&Smith vs Brunel&Al

Refining models of LL

Brunel&Al’s

Concrete semantic

Rel

Our Rel

(R,˜∈,S)

Carraro&All’s Rel

R

Universality

(4)

Table of content

Logic

Ordered semirings

Curry Howard

The logic B

S

LL

Examples

Categorical semantic

Ghica&Smith vs Brunel&Al

Refining models of LL

Brunel&Al’s

Concrete semantic

Rel

Our Rel

(R,˜∈,S)

Carraro&All’s Rel

R

Universality

(5)

Definition of ordered semirings

Ordered semiring S

An ordered semiring is a structure S = (|S|, +, 0, ∗, 1, ≤) where (|S|, ≤) is a poset, 0, 1 ∈ |S| and where +, · : |S|

2

→ S such that:

+ and ∗ are associative,

+ is commutative and distribute over ∗,

0 is neutral for + and 1 is neutral for ∗,

if J ≤ J

0

and K ≤ K

0

then J ∗ J

0

≤ K ∗ K

0

and J+J

0

≤ K +K

0

.

Examples of ordered semirings

1 : the trivial Semiring with just one element.

P oly : the polynomials with their usual sum, product and order.

T rop = ( N , max, −∞, +, 0, ≤) and A rt = ( ¯ N , min, ∞, +, 0, ≤),

A ut

M

: for any commutative monoid ( M , +, 0), the automorphisms

(Mon( M , M ), +, cst

0

, ◦, id

M

, id

Mon(M,M)

)

(6)

Grammar of B S LL

Formulas

(formulas) A, B , C := α | A ⊗ B | A ( B | !

K

A ,∀K ∈ S This is only IMB

R

LL and can be generalised.

Sequents Γ ` A

IMLL plus:

Γ ` B (!w) Γ, !

0

A ` B

Γ, A ` B Γ, !

1

A ` B (!d)

Γ, !

J

A, !

K

A ` B Γ, !

J+K

A ` B (!c)

!

J1

A

1

, · · · , !

Jn

A

n

` B

!

K∗J1

A

1

, · · ·!

K∗Jn

A

n

`!

K

B (!s)

Γ, !

J

A ` B K ≥ J

(Sw )

Γ, !

K

A ` B

(7)

Curry-Howard: Λ S

Grammar of Λ

S

Given a semiring S we define typed lambda calculus:

(terms) Λ M, N ::= x | λx.M | M N

(types) T

S`

θ := α | K ·θ ( θ ,∀K ∈ S

Some examples (with S = Hom( N ))

λxy .y: 0·θ ( 1·θ

0

( θ

0

λxy.x(xy ): 4·(3·θ ( θ) ( 9·θ ( θ λxy.xyy: 1·(2·θ ( 3·θ ( θ

0

) ( 5·θ ( θ

0

λxyz.x (yz ): 1·(f ·θ ( θ) ( f ·(g ·θ ( θ) ( f ◦g ·θ ( θ

λxyz .y (xz ): g ·(f ·θ ( θ) ( 1·(g ·θ ( θ) ( g ◦f ·θ ( θ

(8)

Typing judgements

Ghica’s linear type system

x:1·θ ` x:θ Id Γ ` M :θ Γ, x :0·θ

0

` M:θ Weak

Γ, x:K ·θ ` M:θ

0

Γ ` λx .M:K ·θ ( θ

0

Abs Γ ` M:K ·θ ( θ

0

Γ

0

` N:θ |Γ| = |Γ

0

|

Γ+ K ∗Γ

0

` M N : θ

0

App

where |Γ| = |Γ

0

| means the equality of contexts except for the multiplicity of the types:

|(x

i

:K

i

·θ

i

)

i≤k

| = |(y

i

:L

i

·θ

0i

)

i≤k0

| ⇔ (k = k

0

∧ x

i

= y

i

∧ θ

i

= θ

0i

) and where Γ+ K ·Γ

0

is the context obtain by applying addition and multiplication to the semiring:

(x

i

:K

i

·θ

i

)

i

+(x

i

:L

i

·θ

i

)

i

:= (x

i

:(K +L)·θ

i

)

i

K ∗(x

i

:L·θ

i

)

i

:= (x

i

:K ∗L·θ

i

)

i

(9)

Examples and interest

Counting resources

N : if M : n·A ( U then the KAM on M N will evaluate at most n times the N.

P oly : if M is typable then M N has a polynomial head reduction on the size on N.

A rt: with streams of type Str and the operations tl : 1·Str ( Str and hd : 1·Str ( U , if M : n·Str ( A, its argument will be explored at depth at most n.

A more complicated example: Ghica&Smith’s

[ ]+[ , ] = [ , , ]

[ ] ∗ [ , ] = [ , ]

This computes the sequentially of an execution.

(10)

Table of content

Logic

Ordered semirings

Curry Howard

The logic B

S

LL

Examples

Categorical semantic

Ghica&Smith vs Brunel&Al

Refining models of LL

Brunel&Al’s

Concrete semantic

Rel

Our Rel

(R,˜∈,S)

Carraro&All’s Rel

R

Universality

(11)

Categorical semantic

There is two choices of categorical semantic in the literature:

Brunel&al’s categorical semantic

– Difficult to understand – Over 20 commutative

diagrams

+ Accept any model of LL as a degenerative model + The syntax itself is a model

GhicaSmith’s categorical semantic

+ Quite simple to understand and realise

– The only accepted model of LL is the singleton (up-to iso)

– The syntax is not a model

Restricting models of LL into models of B

S

LL

LL model + π

J

:!A →!

J

A + ι,

J

:!

J

A →!A + 5 diagrams = B

S

LL

model

(12)

Brunel&al’s categorical semantic

Ordered semirings as categories

Any ordered semiring can be seen as bimonoidal category whose objects are the elements of the semirings and whose homesets S(J, K ) are either singleton (when J ≤ K ) or empty.

Bounded exponential situation

A bounded exponential situation is the given of:

a symmetric monoidal category (model of MLL) (A, ⊗, ( , 1),

a bifunctor: • : S × A → A

6 naturals transformations:

δ

0

: (J∗K )•A = ⇒ J •K •A

0

: 1•A = ⇒ A c

0

: (J+K )•A = ⇒ J•A ⊗ K •A w

0

: 0•A = ⇒ 1 m

0

: J•A ⊗ J•B = ⇒ J •(A ⊗ B) n

0

: 1 = ⇒ J•1

and more than 20 commutative diagrams.

(13)

An example of wanted diagram

(J+K )•A ⊗ (J +K )•B

((J •A) ⊗ (K •A)) ⊗ ((J•B) ⊗ (K •B )) (J+K )•(A ⊗ B)

((J•A) ⊗ (J •B)) ⊗ (K •A ⊗ K •B) J•(A ⊗ B) ⊗ K •(A ⊗ B)

c

0

⊗ c

0

m

0

α

c

0

m

0

⊗ m

0

(14)

Obtaining bounded exponential as retractions of usual exponential

Bounded exponential situation by retraction-embedding

A bounded exponential situation by retraction-embedding is the given of:

a model of MELL (A, ⊗, !, 1, ( , δ, , c, w , m, n),

a bifunctor: • : S × A → A

2 naturals transformations:

ι : J •A = ⇒!A π :!A = ⇒ J•A

and 5 commutative diagrams.

The retraction-embedding diagram

The equation ι

J,A

; π

J,A

= id

J•A

is not a priori needed, but is true in every

interesting considered model.

(15)

An examples and interest of wanted diagrams

!A !A⊗!A !A⊗!B !(A ⊗ B)

(J +K )•A J • A ⊗ K •A J•A ⊗ J•B J •(A ⊗ B)

!A !A⊗!A !A⊗!B !(A ⊗ B)

c

π π ⊗ π

ι π

c

m

π π ⊗ π

ι π

m

(16)

An examples and interest of wanted diagrams

!A !A⊗!A !A⊗!B !(A ⊗ B)

(J +K )•A J • A ⊗ K •A J•A ⊗ J•B J •(A ⊗ B)

def .c

0

def .m

0

!A !A⊗!A !A⊗!B !(A ⊗ B)

c

π π ⊗ π

c

π π ⊗ π

c

0

ι π

c

m

π π ⊗ π

m

π π ⊗ π

m

0

ι π

m

(17)

An examples and interest of wanted diagrams

!A !A⊗!A !A⊗!B !(A ⊗ B)

C M

(J +K )•A J • A ⊗ K •A J•A ⊗ J•B J •(A ⊗ B)

!A !A⊗!A !A⊗!B !(A ⊗ B)

c

π π ⊗ π

c

0

ι π

c

ι π

c

m

π π ⊗ π

m

0

ι π

m

ι π

m

(18)

Theorem

Theorem:

LL model + π

J

:!A → J•A + ι,

J

: J•A →!A + 5 diagrams = B

S

LL model

δ

J,K,A0

= ι

J∗K,A

; δ

A

; !π

K,A

; π

J,K•A

0A

= ι

1,A

;

A

c

J,K,A0

= ι

J+K,A

; c

A

; (π

J,A

⊗ π

K,A

) w

A0

= ι

0,A

; w

A

m

0J,A,B

= (ι

J,A

⊗ ι

J,B

); m

A,B

; π

J,A⊗B

n

0J

= n; π

J,1

(19)

An example of wanted diagram

(J+K )•A ⊗ (J +K )•B

((J •A) ⊗ (K •A)) ⊗ ((J•B) ⊗ (K •B )) (J+K )•(A ⊗ B)

LL

((J•A) ⊗ (J •B)) ⊗ (K •A ⊗ K •B) J•(A ⊗ B) ⊗ K •(A ⊗ B) def c

0

⊗ def c

0

def m

0

nat α

C

M ⊗ M

c

0

⊗ c

0

m

0

α

c

0

m

0

⊗ m

0

ι ⊗ ι

c ⊗ c

(π ⊗ π) ⊗ (π ⊗ π) m π

α

(π ⊗ π) ⊗ (π ⊗ π)

c

π ⊗ π

m ⊗ m

(20)

Table of content

Logic

Ordered semirings

Curry Howard

The logic B

S

LL

Examples

Categorical semantic

Ghica&Smith vs Brunel&Al

Refining models of LL

Brunel&Al’s

Concrete semantic

Rel

Our Rel

(R,˜∈,S)

Carraro&All’s Rel

R

Universality

(21)

The model Rel of LL [folklore]

The category Rel : a model of MLL

Objects: Sets Morphisms: Relations Multiplicatifs: A ⊗ B = A ( B = A × B and 1 = {∗}

Rel

N

: a model of MELL

Exponential: !A = M

f

(A)

δ

A

= {(u, V ) | V ∈!!A, u = ΣV }

A

= {([a], a) | a ∈ A}

c

A

= {(u, (v, w )) | u = v +w } w

A

= {([], ∗)} n = {(∗, [∗, ..., ∗])}

m

A,B

= {((u, v ), w ) | ∀a, u(a) = Σ

b∈B

w (a, b), ∀b, v (b) = Σ

a∈A

w (a, b)}

(22)

Hypothesis: multiplicity [Carraro&Al]

A semiring R has multiplicities if

(MS1) it is positive: m+n = 0 ⇒ m = n = 0 (MS2) it is discreet: m+n = 1 ⇒ m = 0 or n = 0 (MS3) it has additive splitting properties.

m

1

+n

1

= m

2

+n

2

⇒ ∃(p

ij

)

1≤i,j≤2

, m

i

= p

i1

+p

i2

, n

j

= p

1j

+p

2j.

(MS4) it has multiplicative k-ary splitting property:

n

1

+n

2

= pm ⇒ ∃k, p

1

, p

2

, m

11

, m

12

, m

21

, m

22

, p = X

j≤k

p

j

,

n

i

= X

j≤k

p

j

m

ji

, ∀j ≤ k , m = m

j1

+mj 2

Examples

N

N ¯

N × N

M

f

( N )

R morally behave like N

R contain N as sub semiring

The sum in R is the one of N

(23)

The model Rel R of LL [Carraro&Al]

Definition of R

f

hAi

Given a semiring R and a set A, the space of functions f : A → R of finite support is denoted R

f

hAi. It is a semimodule over R with:

A commutative sum: (f +g )(x) = f (x)+g (x )

An external product: (K ·f )(x ) = K ·f (x )

Rel

R

: a model of MELL

Exponential: !A = R

f

hAi

δ

A

= {(u, V ) | V ∈!!A, u = Σ

v∈!A

V (v)·v }

A

= {([1·a], a) | a ∈ A}

c

A

= {(u, (v , w ) | u = v+w ∈!A} w

A

= {([], ∗)} n = {(∗, [J·∗])|J ∈R}

m

A,B

= {((u, v ), w ) | ∀a, u(a) = Σ

b∈B

w (a, b), ∀b, v (b) = Σ

a∈A

w (a, b)}

It is a generalisation of Rel

N

Indeed M

f

(A) is an other notation for N hAi.

(24)

The model Rel (R,˜ ∈,S) of B S LL

Semiring refinement (R, ∈, ˜ S)

R is a semiring with multiplicities,

S is an ordered semiring,

∈ ˜ is a relation between those,

1

R

∈1 ˜

S

and 0

R

∈0 ˜

S

,

n ∈J ˜ and m ∈K ˜ imply n+m ∈ ˜ J+K and n∗m ∈ ˜ J∗K ,

J ≤ K iff J ⊆K ˜ .

Rel

(R,∈,S)˜

: a model of B

S

LL

Bounded exponential: J•A = {u ∈ R

f

hAi | Σ

a∈A

u(a)˜ ∈J}

projection and injection:: π

J,A

= ι

J,A

= {(u, u) | u ∈ J•A}

Since !A = RhAi, we have that i•A ⊆!A

(25)

Some examples

R S ∈ ˜ 0•A 1•A

( B ool, id ) {(0, 0)} ∪ {(n + 1, 1)} {[]} M

f

(A)−{[]}

( B ool, 0≤1) {(0, 0)} ∪ {(n, 1)} {[]} M

f

(A) ( B ool, 1≤0) {(n, 0), (n+1, 1)} M

f

(A) M

f

(A)−{[]}

( B ool, id ) R × B ool − {(0, 1), (1, 0)} M

f

(A)−{[a]} M

f

(A)−{[]}

N ( Z /2 Z , id ) {(2n, 0), (2n+1, 1)} even size odd size ( N , id ) {(n, n) | n ∈ N } n•A = {[a

1

, ..., a

n

]}

( N , ≤

N

) {(m, n) | m ≤ n} n•A = {[a

1

, ..., a

m

] | m ≤ n}

( ¯ N , ≤

) {(m, n) | m ≤ n} n•A : idem ω•A = M

f

(A)

(P

( N ), ⊆) {(n, U ) | n ∈ U } U•A = {[a

1

, ..., a

n

] | n ∈ U }

(26)

The semiring M f ( M )

M

f

( M )

Given a monoid M , M

f

( M ) is a semiring with:

A commutative sum:

(f +g )(x ) = f (x)+g (x)

A product (Dirichlet convolution):

(f ·g )(x) = X

x=yy,z·z

f (y)·g (z )

Example of such semirings

N = M

f

( B ool)

Ghica’s M

f

(Aff

1c

)

P oly = M

f

( N

+

)

M

f

( M ) has multiplicities M

f

(S

) refines S

[K

1

, ..., K

n

] ˜ ∈

S

J iff Σ

i

K

i

≤ J

(27)

The two level of semirings

R: semantic semiring

R represent the actual resources.

0 : the absence of resources.

1 : the unitary amount of resources.

Any bag of resources can be separated and reformed

S : syntactical semiring

S represent information on resources.

0: you may not have resources.

Sames goes for 1.

S

is the accuracy of the information.

S as a quotient

With R = M

f

(S

) where you forgot

“paralleled history”.

S as non-determinism

S = (P

f

(R), ⊆) can encode non deterministic operators.

S as a limit

S = (P (R), ⊆) or

S = R can encode

fixpoints.

(28)

Extensions

Does S have to be a semiring?

Remark: only 0 ∈J ˜ is necessary to perform weakening in J and 1 ∈J ˜ to perform dereliction.

One can replace 0 and 1 by sets Z and U such that:

if J ∈ Z then J +K ≥ K

if J ∈ U then J ∗ K ≥ K

if J ∈ Z then J ∗ K ∈ Z

Alex’s intersection type

[[J

1

·A

1

· · · J

n

·A

n

]] = {σ

i

u

u

∈![[A]] | ∀i ≤ n, u

i

∈ [[J

i

·A

i

]]}

Where A is the simple type obtained by forgetting resource annotation in

any of the A

i

.

(29)

Theorem and conclusion

General theorem

Any bounded logic B

S

LL has as model REL

Mf(S),˜S,S

. but it may has other more accurate relational models Current works:

Identifying the categorical sens of the relation ˜ ∈.

Investigate the Locals of 1.

Identifying the sens of the natural transformations ι and π.

Creating non degenerated models via double gluing.

Find models when S is a bimonoidal category and not a semiring.

Generalising all this to resource-dependants logics.

(30)

Forgetful adjunction

If we denotes RpoSemirings the category of ordered semirings and relation (preserving the structure) and RpoMonoids the same category for monoids:

RpoSemirings > RpoMonoids ( )

M

f

( )

Indeed ( )

is the forgetful functor and M

f

( ) the free functor generating the free semimodule over the multiplicative monoid M .

We have that ˜ ∈

S

= der (M

f

(( )

))

S

: (M

f

(()S

) → S)

Références

Documents relatifs

The Relational Database Model (RDBM) [3, 4] is one of the most relevant database models that are being currently used to manage data.. Although some alternative models are also

Hybrid multisets [7,10] are a generalization of multisets. In a hybrid multiset, the multiplicity of an element can be negative. an anti a): positive and negative multiplets of the

The equation of motions and the conditions on surfaces and edges between fluids and solids in presence of non-constant surface energies, as in the case of surfactants attached to

G , κ, N um) is not covering prime then there is no election algorithm and no naming algorithm for the graph G with N um as port numbering using Inst as set of basic instructions..

Proof. Since K is fixed, this gives us polynomial-time. For the two player case, note that whenever Max fixes a strategy σ, the resulting game is a one player game in which Min can

More and more researche projects are using semirings to model ideas of quantitative resources, we are trying to links these approaches.. Ghica’s type system T

(2) justifies most of the classical intuitive inference laws for reasoning from cause to effect; and (3) provides users with formulae to determine certain quantitative and

In the next section, § 4, I will explain how the mathematical work of Emmy Noether and its repercussions in physics has strengthened even more the bind between invariances,