5
What we want to do Precise description of a contract Scheduling for back office Valuation and hedging Legal and documentation etc….

6
What we want to do Precise description of a pudding Compute sugar content Estimate time to make Instructions to make it etc….

7
What we want to do Precise description of a pudding Compute sugar content Estimate time to make Instructions to make it Bad approach List all puddings ( trifle, lemon upside down pudding, Dutch apple cake, Christmas pudding) For each pudding, write down sugar content, time to make, instructions etc

8
What we want to do Precise description of a pudding Compute sugar content Estimate time to make Instructions to make it Good approach Define a small set of pudding combinators Define all puddings in terms of these combinators Calculate sugar content from these combinators too

9
Creamy fruit salad On top of Take Whipped 1 pintCream Mixture Take Chopped 3Apples Take 6Oranges Optional Combinators combine small puddings into bigger puddings

14
New combinators from old andGive :: Contract -> Contract -> Contract andGive u1 u2 = u1 `and` give u2 andGive is a new combinator, defined in terms of simpler combinators To the user, andGive is no different to a primitive, built-in combinator This is the key to extensibility: users can write their own libraries of combinators to extend the built-in ones

16
Acquisition dates one :: Currency -> Contract -- Receive one unit of currency immediately at :: Date -> Contract -> Contract -- Acquire the underlying contract at specified date If you acquire the contract (one k), you receive one unit of currency k immediately If you acquire the contract (at t u) at time s<t, then you acquire the contract u at the (later) time t. You cannot acquire (at t u) after t. The latest acquisition date of a contract is its horizon.

17
Choice An option gives the flexibility to Choose which contract to acquire (or, as a special case, whether to acquire a contract) Choose when to acquire a contract (exercising the option = acquiring the underlying contract)

23
Summary so far Only 10 combinators (after many, many design iterations) Each combinator does one thing Can be combined to describe a rich variety of contracts Surprisingly elegant

24
But what does it all mean? We need an absolutely precise specification of what the combinators mean: their semantics And we would like to do something useful with our (now precisely described) contracts One very useful thing is to compute a contracts value

25
Processing puddings Wanted: S(P), the sugar content of pudding P S( onTopOf p1 p2 ) = S( p1 ) + S( p2 ) S( whipped p ) = S( p ) S( take q i )= q * S(i) …etc… When we define a new recipe, we can calculate its sugar content with no further work Only if we add new combinators or new ingredients do we need to enhance S

27
What is the denotation of a contract? The denotation of a program is a mathematical value that embodies what the program means Two programs are equivalent if they have the same denotation A denotational semantics should be compositional: the denotation of (P1 + P2) is gotten by combining somehow the denotations of P1 and P2

28
What is the denotation of a contract? Main idea: the denotation of a contract is a random process that models the value of acquiring the contract at that moment. : Contract -> RandomProcess RandomProcess = Time -> RandomVariable Uncertainty increases with time Time

30
Valuation There are many numerical methods to compute discrete approximations to random processes (tons and tons and tons and tons and tons and tons and tons and tons and tons and tons of existing work) Contract Model of world (e.g. interest rates) Valuation engine

32
Space and time Obvious implementation computes the value tree for each sub-contract But these value trees can get BIG And often, parts of them are not needed at t t simple discounting

33
Haskell to the rescue Lazy evaluation means that data structures are computed incrementally, as they are needed (so the trees never exist in memory all at once) parts that are never needed are never computed Slogan We think of the tree as a first class value all at once but it is only materialised piecemeal

34
An operational semantics As time goes on, a contract evolves e.g. zcb t1 n k `and` zcb t2 n k Want to value your current contract book So we want to say formally how a contract, or group of contract evolves with time, and how it interacts with its environment (e.g. emit cash, make choice) Work on the operational semantics of programming languages is directly relevant (e.g. bisimulation)

35
Reasoning about equivalence Using this semantics we can prove (for example) that anytime (anytime c) = anytime c Depends on algebra of random processes (snell, discount, etc). Bring on the mathematicians!

38
Summary A small set of built-in combinators: named and tamed A user-extensible library defines the zoo of contracts Compositional denotational semantics, leads directly to modular valuation algorithms Risk Magazine Software Product of the Year Prize Jean-Marc has started a company, LexiFi, to commercialise the ideas Routine for us, radical stuff for financial engineers

39
Summary A small set of built-in combinators: named and tamed A user-extensible library defines the zoo of contracts Compositional denotational semantics, leads directly to modular valuation algorithms Risk Magazine Software Product of the Year Prize Jean-Marc has started a company, LexiFi, to commercialise the ideas Beats higher order logic hands down for party conversation Routine for us, radical stuff for financial engineers