Algebraic metalanguages for routing policy specification Alexander - - PowerPoint PPT Presentation

algebraic metalanguages for routing policy specification
SMART_READER_LITE
LIVE PREVIEW

Algebraic metalanguages for routing policy specification Alexander - - PowerPoint PPT Presentation

Algebraic metalanguages for routing policy specification Alexander Gurney Computer Laboratory, University of Cambridge Multi-Service Networks 2006 Coseners House, Abingdon, UK The Metarouting Idea A language for policy Build up


slide-1
SLIDE 1

Algebraic metalanguages for routing policy specification

Alexander Gurney Computer Laboratory, University of Cambridge Multi-Service Networks 2006 Cosener’s House, Abingdon, UK

slide-2
SLIDE 2

The Metarouting Idea

  • A language for policy
  • Build up complex protocol

descriptions, as simple algebras combined in known ways

  • Susceptible to proof
  • Suitable for implementation
  • One language, many meanings
slide-3
SLIDE 3

Meanwhile, in the world of mathematics

  • The shortest path problem, with numbers (Dijkstra, Bellman / Ford, Moore /

Shannon; and related works back to at least 1871)

  • Generalised shortest paths (Gondran / Minoux; Carré; Berge; ...)
  • All kinds of fun algebra: monoids, semirings, semilattices and other ordered

structures, actions, representations

  • “If the algebra has property X then we can use algorithm Y to find an optimal

solution” for various values of “X”, “Y”, and “optimal”

slide-4
SLIDE 4

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)
slide-5
SLIDE 5

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

2 4 6 4 5 2 1 9

slide-6
SLIDE 6

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

2 4 6 4 5 2 1 9 0+2+4+6+4

slide-7
SLIDE 7

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

2 4 6 4 5 2 1 9 16

slide-8
SLIDE 8

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

2 4 6 4 5 2 1 9 0+5+2+6+4 16

slide-9
SLIDE 9

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

2 4 6 4 5 2 1 9 16 17

slide-10
SLIDE 10

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

2 4 6 4 5 2 1 9 0+5+9+1 16 17

slide-11
SLIDE 11

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

2 4 6 4 5 2 1 9 16 17 15

slide-12
SLIDE 12

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

2 4 6 4 5 2 1 9 16 17 15

slide-13
SLIDE 13

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)
slide-14
SLIDE 14

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

∞ 2 4 5.8 4.5 5 2.3 1 9.1

slide-15
SLIDE 15

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

∞ 2 4 5.8 4.5 5 2.3 1 9.1 {2, 4, 5.8, 4.5}

slide-16
SLIDE 16

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

∞ 2 4 5.8 4.5 5 2.3 1 9.1 2

slide-17
SLIDE 17

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

∞ 2 4 5.8 4.5 5 2.3 1 9.1 {5, 2.3, 5.8, 4.5} 2

slide-18
SLIDE 18

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

∞ 2 4 5.8 4.5 5 2.3 1 9.1 2 2.3

slide-19
SLIDE 19

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

∞ 2 4 5.8 4.5 5 2.3 1 9.1 {5, 9.1, 1} 2 2.3

slide-20
SLIDE 20

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

∞ 2 4 5.8 4.5 5 2.3 1 9.1 2 2.3 1

slide-21
SLIDE 21

Model I: Path algebra

  • Monoid (M, +, 0): closed, associative, identity
  • Semiring (S, ∧, ⊕, ⊤, 0): two monoids (S, ∧, ⊤), (S, ⊕, 0) on the same set
  • Path algebra: has commutativity, distributivity, idempotence (a + a = a)
  • Examples: (N∞, min, +, ∞, 0), (℘(A), ∩, ∪, A, ∅), (R+, max, min, 0, ∞)

∞ 2 4 5.8 4.5 5 2.3 1 9.1 2 2.3 1

slide-22
SLIDE 22

Combining operations

  • D = (N∞, min, +, ∞, 0), B = (R+, max, min, 0, ∞)
  • D × B = (N∞ × R+, ∧, ⊕, (∞, 0), (0, ∞)), where

(d, b) ∧ (e, c) = (min(d, e), max(b, c)) (d, b) ⊕ (e, c) = (d + e, min(b, c))

  • D ×lex B = (N∞ × R+, ∧lex, ⊕, (∞, 0), (0, ∞)), where

(d, b) ∧lex (e, c) = (d, b) if d < e or [d = e and b > c]; (b, c) otherwise ⊕ is as before We obtain < from min by defining a ≤ b iff a = min(a, b)

slide-23
SLIDE 23

Dijkstra’s algorithm and the prefix property

  • To get the right answer out of Dijkstra, we need each prefix of a shortest path

to also be a shortest path

  • In semiring language: a = a ∧ b ⇒ (m + a) = (m + a) ∧ (m + b), for all a, b, m
  • This is the case when we have distributivity: (m + a) ∧ (m + b) = m + (a ∧ b)

a b m

slide-24
SLIDE 24

Property preservation

  • If A and B are distributive, then so is A × B; but A ×lex B may not be
  • So if we have a whole load of distributive semirings A, B, C, and D, then we

know we can run Dijkstra correctly on A × B × C × D

  • Similar rules exist for other properties and other operations – so we can

deduce facts like “we can’t do Dijkstra, but we can do Bellman-Ford”

slide-25
SLIDE 25

Expressiveness issues

  • Consider the ASPATH attribute of BGP (a list of numbers; shorter lists are

preferred, but we don’t care about the contents). How can we encode this?

  • Surely S must be the set of lists, and ⊕ is the append operation...

...and we can say by convention that we will only put one-element lists on the arcs... ...but what should ∧ be for two lists of equal length? It has to be something different from either operand, so maybe we can have a special “equal length” symbol, “E”. But then what is E ∧ a ? We actually need an Ek for each k. And we can extend ⊕ to work on these, too.

slide-26
SLIDE 26

Expressiveness issues

  • We now have a consistent

algebra

  • But we’ve lost touch with reality
  • E1 = E1 ∧ [1], so E1 < [1]
  • Ek tells us nothing about the

actual path. And we prefer these to concrete lists! ... lists of length 6 E6 lists of length 5 E5 ... better

slide-27
SLIDE 27

Multiple equivalent paths

  • S now consists of sets of lists (where all lists in a set are of the same length)
  • A ⊕ B = { append(a, b) | a ∈ A, b ∈ B }; identity { [ ] }
  • A ∧ B = { x ∈ A ∪ B | ∀y ∈ A ∪ B: |x| ≤ |y| }; identity ∅
  • Only ever put { [n] } on the arcs
  • Is this really ‘natural’? Can it be derived automatically?
slide-28
SLIDE 28

Model II: Routing algebras

  • (S, ≤) where ≤ is a preference relation (reflexive, transitive, total)
  • Label set L; application function ⊕ : L × S → S
  • Very general (even more so if we extend ≤ to a preorder)

We can encode ASPATH very easily, along with our other examples

  • Price to pay: not so algebraically nice
slide-29
SLIDE 29

Model III: Functional path algebras

  • A hybrid of (S, ⊕, ∧, 0, 1) and (S, ≤, L, ⊕)
  • (M, F) where M is a commutative monoid and F a set of functions M → M
  • Elements of F go on the arcs
  • If everything in F is a homomorphism, then these look a lot like path algebras.

But we do not require this.

slide-30
SLIDE 30

Embed routing algebra in functional path algebra

  • (S, ≤, L, ⊕) → ((℘≤ (S), ∪≤), FL), where

℘≤ (S) = { A ⊆ S | min≤ (S) = S }

A ∪≤ B = min≤ (A ∪ B) FL = { λ S . min≤ { l ⊕ s | s ∈ S } | l in L }

  • Multipath routing with a partial order, but secretly based on a far more general
  • rder
  • Arc labels are better than before – they seem like single elements
slide-31
SLIDE 31

The ASPATH example

  • Routing algebra is (S, ≤, L, ⊕) where

S = lists of AS numbers (and no list has the same number twice), plus E ≤ orders lists by length; E is topmost L = AS numbers n ⊕ ns = n:ns (unless n is in ns or n:ns is too long, when we return E)

slide-32
SLIDE 32

The ASPATH example

  • As a functional path algebra: ((℘≤ (S), ∪≤), FL)

Each element of ℘≤ (S) is a set of lists; all lists have the same length (and there is also an element {E}) p ∪≤ q is the set of shortest lists in p ∪ q so { [2, 1], [5, 1] } ∪≤ { [6, 1] } = { [2, 1], [5, 1], [6, 1] }; and { [2, 1] } ∪≤ { [4] } = { [4] } Each element of F is a function fk, adding k to each list in the given set f6 { [1, 4], [3, 6] } = min { [6, 1, 4], E } = { [6, 1, 4] }

slide-33
SLIDE 33

Canonical constructions

  • Direct and lexical products
  • Parallel sum A || B: a + b = E
  • Layered sum A ◁ B: a + b = a
  • Local preference: F = { λx.a | a }
  • Origin preference: F = { id }
  • many more
slide-34
SLIDE 34

The metalanguage

  • Borrow syntax from maths (but this will definitely be syntax)
  • Expressions E ::= atom | unary(E) | (E binary E)

unary ::= LP , OP , FLIP , FLATTEN, ... binary ::= ×, ×lex, ||, ◁, ...

  • For each kind of structure, an evaluation function, appropriately typed

written as (S, ≤)〚 ... 〛= ...

  • Notational convenience: (A1, ... , Ak)〚 ... 〛= (A1〚 ... 〛, ... , Ak〚 ... 〛)
slide-35
SLIDE 35

Sample rules

  • ≤〚 A || B 〛= ≤〚A〛∪ ≤〚B〛
  • (M, +)〚 A ◁ B 〛= ( M〚A〛∪ M〚B〛, ⊕ )

where a ⊕ a’ = a +〚A〛a’; b ⊕ b’ = b +〚B〛b’; a ⊕ b = a

  • F〚 LP(A) 〛= { λx.a | a ∈ M〚A〛}
  • a ⊕〚LP(A)〛a’ = a
slide-36
SLIDE 36

Integration of properties

  • We can make sense of properties in the same framework
  • Want DISTRIB〚 A 〛iff A is distributive
  • Prove DISTRIB〚 A x B 〛= ( DISTRIB〚 A 〛and DISTRIB〚 B 〛)
  • and so forth
slide-37
SLIDE 37

Scoped product derivation

  • A Θ B = ( OP(A) ×lex B ) +F ( A ×lex LP(B) )
  • M〚 A Θ B 〛

= M〚OP(A) ×lex B〛∪ M〚 A ×lex LP(B)〛 = (M〚OP(A)〛× M〚B〛) ∪ (M〚A〛× M〚LP(B)〛) = ( M〚A〛× M〚B〛)

  • F〚A Θ B〛

= F〚OP(A) ×lex B〛∪ F〚A ×lex LP(B)〛 = (F〚OP(A)〛× F〚B〛) ∪ (F〚A〛× F〚LP(B)〛) = { (id, f ) | f ∈ F〚B〛} ∪ { (g, λx.b) | g ∈ F〚A〛, b ∈ M〚B〛}

slide-38
SLIDE 38

Scoped product

(a, b) (f(a), b’) (f(a), h(b’)) ( g(f(a)), b’’) (f, b’) (g, b’’) h

slide-39
SLIDE 39

Future directions

  • Generate programs / configuration files by the same means
  • Handle more complex policy interactions
  • Maths: find good operators from the category theory zoo
  • Deeper understanding of algorithms
  • Modality, migration, other protocol aspects