Partial review of work presented in the article: http://dl.acm.org/citation.cfm?id=2784747
Domain specific language for financial derivatives, including multiparty aspect. Certified implementation using Coq proof assistant - and extraction of Haskell code.
1. Certified symbolic management of financial
multiparty contracts 1
Dragiˇsa ˇZuni´c
Meta-CLF2 reading group
February 20, 2017.
1. Research by P. Bahr, J. Berthold and M. Elsman in http://dl.acm.
org/citation.cfm?id=2784747 £
1 / 21
2.
3. Examples :
£
¢
¡1 of 4
we use examples from foreign exchange (FX) market
days as a basic time unit
first we look at a forward contract
£
3 / 21
4. Examples :
£
¢
¡2 of 4
because we want to represent American option..
the language has the conditional : if..within..then..else..
one party may, at any time before the contract ends, decide to
execute a purchase
£
4 / 21
5. Examples :
£
¢
¡3 of 4
next we deal with an asian option
on a set date in the future, a party may decide to buy an
underlying (or not to buy)
but the price is established from an of past prices (all the days)
£
5 / 21
6. Examples :
£
¢
¡4 of 4 (multiparty contract)
to illustrate the multiparty aspect of the language
consider credit default swap (CDS) on a zero-coupon bond
£
6 / 21
7. Examples :
£
¢
¡4 of 4 (multiparty contract)
the above bond contract is denoted cbond , and CDS contract
cCDS
when we combine them as cbond &cCDS we get the contract
we wanted : CDS for a zero coupon bond
compound contract - Y acts as both holder of the bond, and
buyer of the CDS
Y interacts with both X and Z £
7 / 21
8. Examples :
£
¢
¡4 of 4 (multiparty contract)
compound contract - Y acts as both holder of the bond, and
buyer of the CDS
Y interacts with both X and Z
£
8 / 21
9. Syntax and type system
An overview of the contract language - including the
expression sub-language
l ∈ Label - refers to observables (eg., interest rate, X exercises
an option, etc.)
p, q ∈ Party - refers to participants / parties
a ∈ Asset - refers to
x ∈ Var - refers to expressions £
9 / 21
10. Syntax and type system
we assume that each label in Label is assigned a unique type
τ, and we write Labelτ for the set of labels of type τ
examples : “FX(USD,DKK)” ∈ LabelReal , and “X exercises
option” ∈ LabelBool
sometimes a party/client has control over an observable
£
10 / 21
12. Syntax and type system
The form let x = e in c - evaluates expression e at a current
time, and stores the resulting value in x, for later reference in
the contract c
£
12 / 21
13. Syntax and type system
For example, write an option contract that is cancelled
as soon as a foreign exchange rate rises beyond the previously
observed exchange rate (threshold) :
£
13 / 21
19. Next
Contract causality - only allow for contracts that make sense.
Namely input from the external environment of tomorrow
should not influence cash-flow of today - Such contracts are
not causal.
eg. cash-flow today specified by an exchange rate of tomorrow
Contract horizon - definition
Refined original typing rules - so that the well typed
contracts are causal
Theorem : If contract is well typed then it is causal
Theorem : Type inference is sound and complete
£
19 / 21
20. Content of research
an expressive multi-party contract DSL
a type system that statically ensures the that the contracts
follow the principle of causality
a reduction semantics that for the contract language, which
evolves contracts over time, in accordance with the
denotational semantics
formally verified correctness : type inference, reduction
semantics, contract specialisation and horizon inference
using the code extraction of Coq, to generate Haskel code for
contract certified analysis and transformation
£
20 / 21
21. Sources
Certified symbolic management of financial multi-party
contracts → http://dl.acm.org/citation.cfm?id=2784747
Implementations in Coq and Haskell →
https://github.com/HIPERFIT/contracts
Composing contracts : an adventure in financial engineering
→ http://dl.acm.org/citation.cfm?id=351267
Thank you
£
21 / 21