Differential program semantics: sub-modular functions and partial - - PowerPoint PPT Presentation

differential program semantics sub modular functions and
SMART_READER_LITE
LIVE PREVIEW

Differential program semantics: sub-modular functions and partial - - PowerPoint PPT Presentation

Differential program semantics: sub-modular functions and partial metrics Guillaume Geoffroy, Paolo Pistone DIAPASoN, Unibo 27 February 2020 1 / 17 A metric on programs? Distance between programs ( t , s ) : 2 / 17 A metric on programs?


slide-1
SLIDE 1

Differential program semantics: sub-modular functions and partial metrics

Guillaume Geoffroy, Paolo Pistone DIAPASoN, Unibo 27 February 2020

1 / 17

slide-2
SLIDE 2

A metric on programs?

Distance between programs ∂(t, s):

2 / 17

slide-3
SLIDE 3

A metric on programs?

Distance between programs ∂(t, s): ◮ Compatible with product and function types,

2 / 17

slide-4
SLIDE 4

A metric on programs?

Distance between programs ∂(t, s): ◮ Compatible with product and function types, ◮ ∂(t, t) ✟

✟ ❍ ❍

= 0,

2 / 17

slide-5
SLIDE 5

A metric on programs?

Distance between programs ∂(t, s): ◮ Compatible with product and function types, ◮ ∂(t, t) ✟

✟ ❍ ❍

= 0, ◮ Asymmetric, ◮ No triangular inequality.

2 / 17

slide-6
SLIDE 6

Differential program semantics

C A B

3 / 17

slide-7
SLIDE 7

Differential program semantics – alternative approach

◮ Step 1: define a notion of approximate program denotation, ◮ Step 2: define distances between approximate denotations.

4 / 17

slide-8
SLIDE 8

Differential program semantics – alternative approach

◮ Step 1: define a notion of approximate program denotation, ◮ Step 2: define distances between approximate denotations.

Example: Programs of type R

◮ Approximate reals: [R] = {[x, y]; x ≤ y} ∪ {R},

4 / 17

slide-9
SLIDE 9

Differential program semantics – alternative approach

◮ Step 1: define a notion of approximate program denotation, ◮ Step 2: define distances between approximate denotations.

Example: Programs of type R

◮ Approximate reals: [R] = {[x, y]; x ≤ y} ∪ {R}, ◮ Distance: ∂(a, b) = diameter(a ∪ b)

4 / 17

slide-10
SLIDE 10

Differential program semantics – alternative approach

◮ Step 1: define a notion of approximate program denotation, ◮ Step 2: define distances between approximate denotations.

Example: Programs of type R

◮ Approximate reals: [R] = {[x, y]; x ≤ y} ∪ {R}, ◮ Distance: ∂(a, b) = diameter(a ∪ b) = diameter(a ∨ b).

4 / 17

slide-11
SLIDE 11

Approximate denotations

Definition

An interval space space I is the data of: ◮ a set |I|, ◮ a subset I ⊆ P(|I|) \ {∅} closed under non-empty intersections.

5 / 17

slide-12
SLIDE 12

Approximate denotations

Definition

An interval space space I is the data of: ◮ a set |I|, ◮ a subset I ⊆ P(|I|) \ {∅} closed under non-empty intersections.

Example

The interval space [R] ◮ |[R]|, ◮ [R] = {[x, y]; x ≤ y} ∪ {R}.

5 / 17

slide-13
SLIDE 13

Approximate functions – wrong definition

Definition?

◮ An approximate function from [R] to [R] is a function ϕ : R → [R],

6 / 17

slide-14
SLIDE 14

Approximate functions – wrong definition

Definition?

◮ An approximate function from [R] to [R] is a function ϕ : R → [R], ◮ Given ϕ, ψ : R → [R], ψ ◦ ϕ := x →

  • y∈ϕ(x)

ψ(y).

6 / 17

slide-15
SLIDE 15

Approximate functions – wrong definition

Definition?

◮ An approximate function from [R] to [R] is a function ϕ : R → [R], ◮ Given ϕ, ψ : R → [R], ψ ◦ ϕ := x →

  • y∈ϕ(x)

ψ(y). Problem: not associative

6 / 17

slide-16
SLIDE 16

Approximate functions

Definition

◮ An approximate function from [R] to [R] is a monotone function ϕ : [R] → [R],

7 / 17

slide-17
SLIDE 17

Approximate functions

Definition

◮ An approximate function from [R] to [R] is a monotone function ϕ : [R] → [R], ◮ ϕ is optimal if for all a ∈ [R], ϕ(a) =

x∈a ϕ({x}).

7 / 17

slide-18
SLIDE 18

Approximate functions

Definition

◮ An approximate function from [R] to [R] is a monotone function ϕ : [R] → [R], ◮ ϕ is optimal if for all a ∈ [R], ϕ(a) =

x∈a ϕ({x}).

Definition

Let I, J be interval spaces. An approximate function from I to J is a monotone function ϕ : I → J .

7 / 17

slide-19
SLIDE 19

Approximate functions

Definition

Let I, J be interval spaces. An approximate function from I to J is a monotone function ϕ : I → J .

7 / 17

slide-20
SLIDE 20

Approximate functions

Definition

Let I, J be interval spaces. An approximate function from I to J is a monotone function ϕ : I → J .

Definition

The category A of approximate programs is defined by: ◮ the objects of A are the interval spaces, ◮ for all I, J , A(I, J ) is the poset of approximate functions from I to J .

7 / 17

slide-21
SLIDE 21

Exact vs aproximate functions Notation For all ϕ ∈ A(I, J ),

|ϕ| = {f : |I| → |J | ; ∀x f (x) ∈ ϕ(x)} .

8 / 17

slide-22
SLIDE 22

Exact vs aproximate functions Notation For all ϕ ∈ A(I, J ),

|ϕ| = {f : |I| → |J | ; ∀x f (x) ∈ ϕ(x)} .

Definition For all f : |I| → |J |, the differential df ∈ A(I, J ) is

defined by: df (a) =

  • x∈a

f (x).

8 / 17

slide-23
SLIDE 23

Exact vs aproximate functions Notation For all ϕ ∈ A(I, J ),

|ϕ| = {f : |I| → |J | ; ∀x f (x) ∈ ϕ(x)} .

Definition For all f : |I| → |J |, the differential df ∈ A(I, J ) is

defined by: df (a) =

  • x∈a

f (x).

Lemma For all f , ϕ:

df ≤ ϕ ⇔ f ∈ |ϕ| .

8 / 17

slide-24
SLIDE 24

Cartesian product Definition For all I, J , let:

◮ |I × J | = |I| × |J |,

9 / 17

slide-25
SLIDE 25

Cartesian product Definition For all I, J , let:

◮ |I × J | = |I| × |J |, ◮ I × J = {a × b; a ∈ I, b ∈ J },

9 / 17

slide-26
SLIDE 26

Cartesian product Definition For all I, J , let:

◮ |I × J | = |I| × |J |, ◮ I × J = {a × b; a ∈ I, b ∈ J }, ◮ πL(a × b) = a and πR(a × b) = b,

9 / 17

slide-27
SLIDE 27

Cartesian product Definition For all I, J , let:

◮ |I × J | = |I| × |J |, ◮ I × J = {a × b; a ∈ I, b ∈ J }, ◮ πL(a × b) = a and πR(a × b) = b, ◮ ϕ, ψ = c → ϕ(a) × ϕ(b).

9 / 17

slide-28
SLIDE 28

Cartesian product Definition For all I, J , let:

◮ |I × J | = |I| × |J |, ◮ I × J = {a × b; a ∈ I, b ∈ J }, ◮ πL(a × b) = a and πR(a × b) = b, ◮ ϕ, ψ = c → ϕ(a) × ϕ(b). ◮ For all ϕ, ψ, πL ◦ ϕ, ψ = ϕ and πR ◦ ϕ, ψ = ψ,

9 / 17

slide-29
SLIDE 29

Cartesian product Definition For all I, J , let:

◮ |I × J | = |I| × |J |, ◮ I × J = {a × b; a ∈ I, b ∈ J }, ◮ πL(a × b) = a and πR(a × b) = b, ◮ ϕ, ψ = c → ϕ(a) × ϕ(b). ◮ For all ϕ, ψ, πL ◦ ϕ, ψ = ϕ and πR ◦ ϕ, ψ = ψ, ◮ For all χ, πL ◦ χ, πR ◦ χ = χ.

9 / 17

slide-30
SLIDE 30

Cartesian product Definition For all I, J , let:

◮ |I × J | = |I| × |J |, ◮ I × J = {a × b; a ∈ I, b ∈ J }, ◮ πL(a × b) = a and πR(a × b) = b, ◮ ϕ, ψ = c → ϕ(a) × ϕ(b). This defines a cartesian product in A: ◮ For all ϕ, ψ, πL ◦ ϕ, ψ = ϕ and πR ◦ ϕ, ψ = ψ, ◮ For all χ, πL ◦ χ, πR ◦ χ = χ.

9 / 17

slide-31
SLIDE 31

Exponentials Definition For all I, J , let:

◮ |exp(I, J )| = {functions from |I| to |J |},

10 / 17

slide-32
SLIDE 32

Exponentials Definition For all I, J , let:

◮ |exp(I, J )| = {functions from |I| to |J |}, ◮ exp(I, J ) = {|ϕ| ; ϕ ∈ A(I, J )},

10 / 17

slide-33
SLIDE 33

Exponentials Definition For all I, J , let:

◮ |exp(I, J )| = {functions from |I| to |J |}, ◮ exp(I, J ) = {|ϕ| ; ϕ ∈ A(I, J )}, ◮ for all ϕ ∈ A(K, exp(I, J )),

10 / 17

slide-34
SLIDE 34

Exponentials Definition For all I, J , let:

◮ |exp(I, J )| = {functions from |I| to |J |}, ◮ exp(I, J ) = {|ϕ| ; ϕ ∈ A(I, J )}, ◮ for all ϕ ∈ A(K, exp(I, J )), ev(ϕ) = c × a →

  • f ∈ϕ(c)
  • x∈a

f (x)

10 / 17

slide-35
SLIDE 35

Exponentials Definition For all I, J , let:

◮ |exp(I, J )| = {functions from |I| to |J |}, ◮ exp(I, J ) = {|ϕ| ; ϕ ∈ A(I, J )}, ◮ for all ϕ ∈ A(K, exp(I, J )), ev(ϕ) = c × a →

  • f ∈ϕ(c)
  • x∈a

f (x) =

  • f ∈ϕ(c)

df (a),

10 / 17

slide-36
SLIDE 36

Exponentials Definition For all I, J , let:

◮ |exp(I, J )| = {functions from |I| to |J |}, ◮ exp(I, J ) = {|ϕ| ; ϕ ∈ A(I, J )}, ◮ for all ϕ ∈ A(K, exp(I, J )), ev(ϕ) = c × a →

  • f ∈ϕ(c)
  • x∈a

f (x) =

  • f ∈ϕ(c)

df (a), ◮ for all ψ ∈ A(K × I, J ),

10 / 17

slide-37
SLIDE 37

Exponentials Definition For all I, J , let:

◮ |exp(I, J )| = {functions from |I| to |J |}, ◮ exp(I, J ) = {|ϕ| ; ϕ ∈ A(I, J )}, ◮ for all ϕ ∈ A(K, exp(I, J )), ev(ϕ) = c × a →

  • f ∈ϕ(c)
  • x∈a

f (x) =

  • f ∈ϕ(c)

df (a), ◮ for all ψ ∈ A(K × I, J ), λ(ψ) = c → |a → ψ(c, a)| .

10 / 17

slide-38
SLIDE 38

Exponentials

ev(ϕ) =

  • f ∈ϕ(c)

df (a) λ(ψ) = c → |a → ψ(c, a)|

11 / 17

slide-39
SLIDE 39

Exponentials

ev(ϕ) =

  • f ∈ϕ(c)

df (a) λ(ψ) = c → |a → ψ(c, a)|

Proposition This defines a lax-expenential:

◮ ev(ϕ ◦ χ) = ev(ϕ) ◦ (χ × id) and λ(ψ ◦ (χ × id)) = λ(ψ) ◦ χ,

11 / 17

slide-40
SLIDE 40

Exponentials

ev(ϕ) =

  • f ∈ϕ(c)

df (a) λ(ψ) = c → |a → ψ(c, a)|

Proposition This defines a lax-expenential:

◮ ev(ϕ ◦ χ) = ev(ϕ) ◦ (χ × id) and λ(ψ ◦ (χ × id)) = λ(ψ) ◦ χ, ◮ ev(λ(ψ)) ≤ ψ,

11 / 17

slide-41
SLIDE 41

Exponentials

ev(ϕ) =

  • f ∈ϕ(c)

df (a) λ(ψ) = c → |a → ψ(c, a)|

Proposition This defines a lax-expenential:

◮ ev(ϕ ◦ χ) = ev(ϕ) ◦ (χ × id) and λ(ψ ◦ (χ × id)) = λ(ψ) ◦ χ, ◮ ev(λ(ψ)) ≤ ψ, ◮ ϕ ≤ λ(ev(ϕ)).

11 / 17

slide-42
SLIDE 42

Exponentials

ev(ϕ) =

  • f ∈ϕ(c)

df (a) λ(ψ) = c → |a → ψ(c, a)|

Proposition This defines a lax-expenential:

◮ ev(ϕ ◦ χ) = ev(ϕ) ◦ (χ × id) and λ(ψ ◦ (χ × id)) = λ(ψ) ◦ χ, ◮ ev(λ(ψ)) ≤ ψ, ◮ ϕ ≤ λ(ev(ϕ)). If f ∈ |ϕ| and ϕ →βη ψ then f ∈ |ψ|.

11 / 17

slide-43
SLIDE 43

Differential program semantics – alternative approach

◮ Step 1: define a notion of approximate program denotation, ◮ Step 2: define distances between approximate denotations.

Example: Programs of type R

◮ Approximate reals: [R] = {[x, y]; x ≤ y} ∪ {R}, ◮ Distance: ∂(a, b) = δ(a ∨ b).

4 / 17

slide-44
SLIDE 44

Diameter spaces

Definition

A diameter space is the data of: ◮ an interval space I, ◮ a commutative integral quantale Q (e.g. [0, ∞]n), ◮ a monotone function δ : I → Q

12 / 17

slide-45
SLIDE 45

Diameter spaces

Definition

A diameter space is the data of: ◮ an interval space I, ◮ a commutative integral quantale Q (e.g. [0, ∞]n), ◮ a monotone function δ : I → Q such that: ∀a, b ∈ I, a ∧ b = ∅ ⇒ δ(a ∨ b) + δ(a ∧ b) ≤ δ(a) + δ(b).

12 / 17

slide-46
SLIDE 46

Sub-modularity

∀a, b ∈ I, a ∧ b = ∅ ⇒ δ(a ∨ b) + δ(a ∧ b) ≤ δ(a) + δ(b). a b

slide-47
SLIDE 47

Sub-modularity

∀a, b ∈ I, a ∧ b = ∅ ⇒ δ(a ∨ b) + δ(a ∧ b) ≤ δ(a) + δ(b). a b δ(a ∨ b) δ(a ∧ b) δ(a) δ(b)

13 / 17

slide-48
SLIDE 48

Pseudo-partial metric spaces

Proposition

Let (I, Q, δ) be a diameter space. For all a, b ∈ I, let ∂(a, b) = δ(a ∨ b).

14 / 17

slide-49
SLIDE 49

Pseudo-partial metric spaces

Proposition

Let (I, Q, δ) be a diameter space. For all a, b ∈ I, let ∂(a, b) = δ(a ∨ b). Then (I, ∂) is a pseudo partial metric space:

14 / 17

slide-50
SLIDE 50

Pseudo-partial metric spaces

Proposition

Let (I, Q, δ) be a diameter space. For all a, b ∈ I, let ∂(a, b) = δ(a ∨ b). Then (I, ∂) is a pseudo partial metric space: ◮ ∂(a, a) ≤ ∂(a, b), ◮ ∂(a, b) = ∂(b, a), ◮ ∂(a, c) + ∂(b, b) ≤ ∂(a, b) + ∂(b, c).

14 / 17

slide-51
SLIDE 51

Partial metrics on products and exponentials

Let (I, Q, δ) and (J , R, δ) be diameter spaces.

Definition We define a diameter space (I × J , Q × R, δ) by:

15 / 17

slide-52
SLIDE 52

Partial metrics on products and exponentials

Let (I, Q, δ) and (J , R, δ) be diameter spaces.

Definition We define a diameter space (I × J , Q × R, δ) by:

δ(a × b) = (δ(a), δ(b)).

15 / 17

slide-53
SLIDE 53

Partial metrics on products and exponentials

Let (I, Q, δ) and (J , R, δ) be diameter spaces.

Definition We define a diameter space (I × J , Q × R, δ) by:

δ(a × b) = (δ(a), δ(b)).

Definition We define a diameter space

(exp(I, J ), Poset(I, R), δ) by:

15 / 17

slide-54
SLIDE 54

Partial metrics on products and exponentials

Let (I, Q, δ) and (J , R, δ) be diameter spaces.

Definition We define a diameter space (I × J , Q × R, δ) by:

δ(a × b) = (δ(a), δ(b)).

Definition We define a diameter space

(exp(I, J ), Poset(I, R), δ) by: δ(ϕ) = a → δ  

f ∈ϕ

df (a)   .

15 / 17

slide-55
SLIDE 55

Diameter spaces and approximate functions

Definition

The category Aδ of approximate programs is defined by: ◮ the objects of Aδ are the diameter spaces, ◮ for all I, J , Aδ(I, J ) is the poset of approximate functions from I to J .

16 / 17

slide-56
SLIDE 56

Diameter spaces and approximate functions

Definition

The category Aδ of approximate programs is defined by: ◮ the objects of Aδ are the diameter spaces, ◮ for all I, J , Aδ(I, J ) is the poset of approximate functions from I to J . ◮ A cartesian lax-closed category whose objects are particular pseudo partial metric spaces.

16 / 17

slide-57
SLIDE 57

Replacing Set with a CCC C

◮ A set |I| An object |I| of C,

17 / 17

slide-58
SLIDE 58

Replacing Set with a CCC C

◮ A set |I| An object |I| of C, ◮ x ∈ |I| x ∈ C(1, |I|),

17 / 17

slide-59
SLIDE 59

Replacing Set with a CCC C

◮ A set |I| An object |I| of C, ◮ x ∈ |I| x ∈ C(1, |I|), ◮ f : |I| → |J | f ∈ C (|I| , |J |),

17 / 17

slide-60
SLIDE 60

Replacing Set with a CCC C

◮ A set |I| An object |I| of C, ◮ x ∈ |I| x ∈ C(1, |I|), ◮ f : |I| → |J | f ∈ C (|I| , |J |), ◮ ϕ ∈ A (|I| , |J |) Require |ϕ| = ∅.

17 / 17

slide-61
SLIDE 61

Replacing Set with a CCC C

◮ A set |I| An object |I| of C, ◮ x ∈ |I| x ∈ C(1, |I|), ◮ f : |I| → |J | f ∈ C (|I| , |J |), ◮ ϕ ∈ A (|I| , |J |) Require |ϕ| = ∅. Thank you!

17 / 17