## How to write a financial contract

Implements the theory from 'How to write a financial contract' by S.L Peyton Jones and J-M Eber

Tools:
```  1: //Implements the theory from 'How to write a financial contract' by S.L Peyton Jones
2: //and J-M Eber
3:
4: type RandomVariable<'a> = seq<'a>
5:
6: type Process<'a> = Process of (seq<RandomVariable<'a>>)
7:
8: let liftP f (Process(p)) =  Process(Seq.map (Seq.map f) p)
9:
10: let liftP2 f (Process(p1)) (Process(p2)) =
11:     Process(Seq.map2 (Seq.map2 f) p1 p2)
12:
13: let seq_map3 f xs1 xs2 xs3 =
14:   Seq.zip3 xs1 xs2 xs3 |> Seq.map (fun (a,b,c) -> f a b c)
15:
16: let liftP3 f (Process(p1)) (Process(p2)) (Process(p3))=
17:     Process(seq_map3 (seq_map3 f) p1 p2 p3)
18:
19: type Obs<'a when 'a :comparison> = Obs of (float -> Process<'a>)
20:
21: type Currency =
22:     |USD
23:     |EUR
24:     |JPY
25:     |GBP
26:
27: type Contract =
28:     | Zero
29:     | One of Currency
30:     | Give of Contract
31:     | And of Contract * Contract
32:     | Or of Contract * Contract
33:     | Scale of float Obs * Contract
34:     | Anytime of bool Obs * Contract
35:     | Cond of bool Obs * Contract * Contract
36:     | When of bool Obs * Contract //<--
37:     | Until of bool Obs * Contract
38:
39: let when' o c = When(o,c)
40: let anytime o c = Anytime(o,c)
41:
42: let rec always x = seq { yield x; yield! always x}
43:
44: let K x = Process  (always (always x))
45: let konst a = Obs (fun t -> K a)
46: let scaleK x c = Scale ((konst x), c)
47:
48: let TempInParis = konst 9.7
49:
50: let rec generate_time t = seq{ yield always t ; yield! generate_time (t + 1.) }
51:
52: let date = Obs (fun t -> Process(generate_time 0.) )
53:
54: let lift  f (Obs (o)) = Obs (fun t -> liftP f (o t))
55: let lift2 f (Obs(o1)) (Obs(o2)) = Obs(fun t -> liftP2 f (o1 t) (o2 t) )
56:
57: let eq_obs a b = a = b
58:
59: let at (t:float) = lift2 (fun x y -> eq_obs x y) date (konst t)
60:
61: let zcb t x k = when' (at t) (scaleK x (One k)) //Zero Coupon Bond
62:
63: let european t u = when' (at t) (Or(u,Zero))
64:
65: let (%>=) a b = lift2 (>=) a b
66: let (%<=) a b = lift2 (<=) a b
67:
68: let between t1 t2 = lift2 (&&) (date %>= t1) (date %<= t2)
69:
70: let american (t1, t2) u = anytime (between t1 t2) u
71:
72: let oneBuck = One USD;;
73: let hundredBucks = Scale((konst 100.),oneBuck);;
74:
75: let add_obs = liftP2 (+)
76: let (%+) = liftP2 (+)
77: let minus_obs = liftP2 (-)
78: let (%-) = liftP2 (-)
79: let mult_obs = liftP2 (*)
80: let (%*) = liftP2 (*)
81: let div_obs = liftP2 (/)
82: let (%/) = liftP2 (/)
83: let (~-) = liftP (~-)
84: let max = liftP2 max
85:
86: let cond = liftP3 (fun b tru fal -> if b then tru else fal)
87:
88: type Model  =
89:     abstract exch  : (Currency -> Currency -> Process<float>)
90:     abstract disc  : (Currency -> Process<bool>*Process<float> -> Process<float>)
91:     abstract snell : (Currency -> Process<bool>*Process<float> -> Process<float>)
92:     abstract absorb: (Currency -> Process<bool>*Process<float> -> Process<float>)
93:
94: let evalO (Obs(o)) = o 0.
95:
96: let ff = evalO TempInParis
97:
98: let rec evalC (m:Model) (cur:Currency) (c:Contract)    =
99:     let evalC' = evalC m cur
100:     match c with
101:     | Zero -> K 0.
102:     | One(cur2)  -> m.exch cur cur2
103:     | Give(c1)   -> -(evalC' c1)
104:     | Scale(o,c1) -> mult_obs (evalO o) (evalC' c1)
105:     | And(c2,c1) -> add_obs (evalC' c1) (evalC' c2)
106:     | Or(c2,c1) -> max (evalC' c1) (evalC' c2)
107:     | Cond(o,c1,c2) -> cond (evalO o) (evalC' c1) (evalC' c2)
108:     | When(o,c1) -> m.disc cur ((evalO o), (evalC' c1))
109:     | Anytime(o,c1) -> m.snell cur ((evalO o), (evalC' c1))
110:     | Until(o,c1) -> m.absorb cur ((evalO o), (evalC' c1))
111:
112:
113: let rates (rateNow:float) (delta:float) =
114:
115:     let rec generateSlice minRate n =
116:         seq { yield minRate + 2.*delta*float(n); yield! generateSlice minRate (n+1) }
117:
118:     let rateSlice minRate n = Seq.take n (generateSlice minRate 0)
119:
120:     let rec makeRateSlices rateNow n =
121:         seq {
122:             yield (rateSlice rateNow n) ;
123:             yield! (makeRateSlices (rateNow-delta) (n+1))}
124:
125:     Process(makeRateSlices rateNow 1)
126:
127:
128: open System.Collections.Generic
129:
130: let rateModels = new Dictionary<Currency,Process<float>>()
131:
132: Seq.iter (fun x -> rateModels.Add x) [
133:     USD, rates 7. 1.;
134:     EUR, rates 6. 1.;
135:     JPY, rates 8. 1.;
136:     GBP, rates 5. 1.;
137:     ]
138:
139: let rateModel k =
140:     match rateModels.TryGetValue(k) with
141:     | true, p -> p
142:     | _   , _ -> failwith "invalid currency"
143:
144: let unProc (Process(s)) = s
145:
146: let rec prevSlice (r:seq<float>) =
147:   seq {
148:             if not (Seq.isEmpty r) then
149:                 let rest = Seq.skip 1 r
150:                 if not (Seq.isEmpty rest) then
151:
152:                     let a = Seq.head r
153:                     let b = Seq.head rest
154:
155:                     yield ((a + b)/2.)
156:
157:                     yield! prevSlice rest
158:
159:     }
160:
161: let rec discCalc (pb:seq<RandomVariable<bool>>) (pf:seq<RandomVariable<float>>)
162:         (rates:seq<RandomVariable<float>>) =
163:     seq{
164:         if not(Seq.isEmpty pb || Seq.isEmpty pf || Seq.isEmpty rates) then
165:
166:             let bRv = Seq.head pb
167:             let pRv = Seq.head pf
168:
169:             //-- we need a termination condition or as much as it is needed to ensure a level of certainty
170:             if Seq.forall (fun x -> x) (Seq.truncate 10 bRv)
171:             then
172:                 yield pRv
173:             else
174:                 let rateRv = Seq.head rates
175:
176:                 let bs = Seq.skip 1 pb
177:                 let ps = Seq.skip 1 pf
178:                 let rs = Seq.skip 1 rates
179:
180:                 let rest = discCalc bs ps rs;
181:
182:                 if not(Seq.isEmpty rest) then
183:
184:                     let nextSlice = Seq.head rest
185:
186:                     let discSlice =
187:                         Seq.map2 (fun x r -> x / (1. + (r/100.))) (prevSlice nextSlice) rateRv
188:
189:                     let thisSlice =
190:                         seq_map3 (fun b p q -> if b then p else q) bRv pRv discSlice
191:
192:                     yield thisSlice; yield! rest
193:     }
194:
195: let disc k (Process(pb),Process(pf)) =
196:     Process(discCalc pb pf (unProc(rateModel k)))
197:
198: let model = {
199:     new Model with
200:         member m.exch   = fun cur1 cur2    -> K 1.
201:         member m.disc   = disc
202:         member m.snell  = fun cur1 (pb,pf) -> K 0.5//--
203:         member m.absorb =
204:             fun k (Process(bO),Process(rvs)) ->
205:                     Process(Seq.map2 (Seq.map2 (fun o p -> if o then 0. else p)) bO rvs)
206: }
207:
208: let GiltStrip = zcb 3.0 10. GBP
209:
210: let q = evalC model GBP GiltStrip
211:
212: printf "%A\n" q
213:
214: printf "%A\n" (evalO (at 3.0))
215: printf "%A\n" (evalO (date))
216: printf "%A\n" (rateModel GBP)
217: ```
Multiple items
val seq : seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------

type seq<'T> = System.Collections.Generic.IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>

type: seq<'T>
inherits: System.Collections.IEnumerable
Multiple items
union case Process.Process: seq<RandomVariable<'a>> -> Process<'a>

--------------------

type Process<'a> = | Process of seq<RandomVariable<'a>>

Full name: Snippet.Process<_>

type: Process<'a>
implements: System.IEquatable<Process<'a>>
implements: System.Collections.IStructuralEquatable
type RandomVariable<'a> = seq<'a>

Full name: Snippet.RandomVariable<_>

type: RandomVariable<'a>
inherits: System.Collections.IEnumerable
val liftP : ('a -> 'b) -> Process<'a> -> Process<'b>

Full name: Snippet.liftP
val f : ('a -> 'b)
val p : seq<RandomVariable<'a>>

type: seq<RandomVariable<'a>>
inherits: System.Collections.IEnumerable
module Seq

from Microsoft.FSharp.Collections
val map : ('T -> 'U) -> seq<'T> -> seq<'U>

Full name: Microsoft.FSharp.Collections.Seq.map
val liftP2 : ('a -> 'b -> 'c) -> Process<'a> -> Process<'b> -> Process<'c>

Full name: Snippet.liftP2
val f : ('a -> 'b -> 'c)
val p1 : seq<RandomVariable<'a>>

type: seq<RandomVariable<'a>>
inherits: System.Collections.IEnumerable
val p2 : seq<RandomVariable<'b>>

type: seq<RandomVariable<'b>>
inherits: System.Collections.IEnumerable
val map2 : ('T1 -> 'T2 -> 'U) -> seq<'T1> -> seq<'T2> -> seq<'U>

Full name: Microsoft.FSharp.Collections.Seq.map2
val seq_map3 : ('a -> 'b -> 'c -> 'd) -> seq<'a> -> seq<'b> -> seq<'c> -> seq<'d>

Full name: Snippet.seq_map3
val f : ('a -> 'b -> 'c -> 'd)
val xs1 : seq<'a>

type: seq<'a>
inherits: System.Collections.IEnumerable
val xs2 : seq<'b>

type: seq<'b>
inherits: System.Collections.IEnumerable
val xs3 : seq<'c>

type: seq<'c>
inherits: System.Collections.IEnumerable
val zip3 : seq<'T1> -> seq<'T2> -> seq<'T3> -> seq<'T1 * 'T2 * 'T3>

Full name: Microsoft.FSharp.Collections.Seq.zip3
val a : 'a
val b : 'b
val c : 'c
val liftP3 : ('a -> 'b -> 'c -> 'd) -> Process<'a> -> Process<'b> -> Process<'c> -> Process<'d>

Full name: Snippet.liftP3
val p3 : seq<RandomVariable<'c>>

type: seq<RandomVariable<'c>>
inherits: System.Collections.IEnumerable
Multiple items
union case Obs.Obs: (float -> Process<'a>) -> Obs<'a>

--------------------

type Obs<'a (requires comparison)> = | Obs of (float -> Process<'a>)

Full name: Snippet.Obs<_>
Multiple items
val float : 'T -> float (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.float

--------------------

type float<'Measure> = float

Full name: Microsoft.FSharp.Core.float<_>

type: float<'Measure>
implements: System.IComparable
implements: System.IConvertible
implements: System.IFormattable
implements: System.IComparable<float<'Measure>>
implements: System.IEquatable<float<'Measure>>
inherits: System.ValueType

--------------------

type float = System.Double

Full name: Microsoft.FSharp.Core.float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
type Currency =
| USD
| EUR
| JPY
| GBP

Full name: Snippet.Currency

type: Currency
implements: System.IEquatable<Currency>
implements: System.Collections.IStructuralEquatable
implements: System.IComparable<Currency>
implements: System.IComparable
implements: System.Collections.IStructuralComparable
union case Currency.USD: Currency
union case Currency.EUR: Currency
union case Currency.JPY: Currency
union case Currency.GBP: Currency
type Contract =
| Zero
| One of Currency
| Give of Contract
| And of Contract * Contract
| Or of Contract * Contract
| Scale of Obs<float> * Contract
| Anytime of Obs<bool> * Contract
| Cond of Obs<bool> * Contract * Contract
| When of Obs<bool> * Contract
| Until of Obs<bool> * Contract

Full name: Snippet.Contract
union case Contract.Zero: Contract
union case Contract.One: Currency -> Contract
union case Contract.Give: Contract -> Contract
union case Contract.And: Contract * Contract -> Contract
union case Contract.Or: Contract * Contract -> Contract
union case Contract.Scale: Obs<float> * Contract -> Contract
union case Contract.Anytime: Obs<bool> * Contract -> Contract
type bool = System.Boolean

Full name: Microsoft.FSharp.Core.bool

type: bool
implements: System.IComparable
implements: System.IConvertible
implements: System.IComparable<bool>
implements: System.IEquatable<bool>
inherits: System.ValueType
union case Contract.Cond: Obs<bool> * Contract * Contract -> Contract
union case Contract.When: Obs<bool> * Contract -> Contract
union case Contract.Until: Obs<bool> * Contract -> Contract
val when' : Obs<bool> -> Contract -> Contract

Full name: Snippet.when'
val o : Obs<bool>
val c : Contract
val anytime : Obs<bool> -> Contract -> Contract

Full name: Snippet.anytime
val always : 'a -> seq<'a>

Full name: Snippet.always
val x : 'a
val K : 'a -> Process<'a>

Full name: Snippet.K
val konst : 'a -> Obs<'a> (requires comparison)

Full name: Snippet.konst
val a : 'a (requires comparison)
val t : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
val scaleK : float -> Contract -> Contract

Full name: Snippet.scaleK
val x : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
val TempInParis : Obs<float>

Full name: Snippet.TempInParis
val generate_time : float -> seq<seq<float>>

Full name: Snippet.generate_time
val date : Obs<float>

Full name: Snippet.date
val lift : ('a -> 'b) -> Obs<'a> -> Obs<'b> (requires comparison and comparison)

Full name: Snippet.lift
val f : ('a -> 'b) (requires comparison and comparison)
val o : (float -> Process<'a>) (requires comparison)
val lift2 : ('a -> 'b -> 'c) -> Obs<'a> -> Obs<'b> -> Obs<'c> (requires comparison and comparison and comparison)

Full name: Snippet.lift2
val f : ('a -> 'b -> 'c) (requires comparison and comparison and comparison)
val o1 : (float -> Process<'a>) (requires comparison)
val o2 : (float -> Process<'b>) (requires comparison)
val eq_obs : 'a -> 'a -> bool (requires equality)

Full name: Snippet.eq_obs
val a : 'a (requires equality)
val b : 'a (requires equality)
val at : float -> Obs<bool>

Full name: Snippet.at
val y : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
val zcb : float -> float -> Currency -> Contract

Full name: Snippet.zcb
val k : Currency

type: Currency
implements: System.IEquatable<Currency>
implements: System.Collections.IStructuralEquatable
implements: System.IComparable<Currency>
implements: System.IComparable
implements: System.Collections.IStructuralComparable
val european : float -> Contract -> Contract

Full name: Snippet.european
val u : Contract
val a : Obs<'a> (requires comparison)
val b : Obs<'a> (requires comparison)
val between : Obs<float> -> Obs<float> -> Obs<bool>

Full name: Snippet.between
val t1 : Obs<float>
val t2 : Obs<float>
val american : Obs<float> * Obs<float> -> Contract -> Contract

Full name: Snippet.american
val oneBuck : Contract

Full name: Snippet.oneBuck
val hundredBucks : Contract

Full name: Snippet.hundredBucks
val add_obs : (Process<float> -> Process<float> -> Process<float>)

val minus_obs : (Process<int> -> Process<int> -> Process<int>)

Full name: Snippet.minus_obs
val mult_obs : (Process<float> -> Process<float> -> Process<float>)

Full name: Snippet.mult_obs
val div_obs : (Process<int> -> Process<int> -> Process<int>)

Full name: Snippet.div_obs
val max : (Process<float> -> Process<float> -> Process<float>)

Full name: Snippet.max
val cond : (Process<bool> -> Process<float> -> Process<float> -> Process<float>)

Full name: Snippet.cond
val b : bool

type: bool
implements: System.IComparable
implements: System.IConvertible
implements: System.IComparable<bool>
implements: System.IEquatable<bool>
inherits: System.ValueType
val tru : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
val fal : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
Multiple items
type Model =
interface
abstract member absorb : (Currency -> Process<bool> * Process<float> -> Process<float>)
abstract member disc : (Currency -> Process<bool> * Process<float> -> Process<float>)
abstract member exch : (Currency -> Currency -> Process<float>)
abstract member snell : (Currency -> Process<bool> * Process<float> -> Process<float>)
end

Full name: Snippet.Model

--------------------

Model
abstract member Model.exch : (Currency -> Currency -> Process<float>)

Full name: Snippet.Model.exch
abstract member Model.disc : (Currency -> Process<bool> * Process<float> -> Process<float>)

Full name: Snippet.Model.disc
abstract member Model.snell : (Currency -> Process<bool> * Process<float> -> Process<float>)

Full name: Snippet.Model.snell
abstract member Model.absorb : (Currency -> Process<bool> * Process<float> -> Process<float>)

Full name: Snippet.Model.absorb
val evalO : Obs<'a> -> Process<'a> (requires comparison)

Full name: Snippet.evalO
val ff : Process<float>

Full name: Snippet.ff

type: Process<float>
implements: System.IEquatable<Process<float>>
implements: System.Collections.IStructuralEquatable
val evalC : Model -> Currency -> Contract -> Process<float>

Full name: Snippet.evalC
val m : Model
val cur : Currency

type: Currency
implements: System.IEquatable<Currency>
implements: System.Collections.IStructuralEquatable
implements: System.IComparable<Currency>
implements: System.IComparable
implements: System.Collections.IStructuralComparable
val evalC' : (Contract -> Process<float>)
val cur2 : Currency

type: Currency
implements: System.IEquatable<Currency>
implements: System.Collections.IStructuralEquatable
implements: System.IComparable<Currency>
implements: System.IComparable
implements: System.Collections.IStructuralComparable
property Model.exch: Currency -> Currency -> Process<float>
val c1 : Contract
val o : Obs<float>
val c2 : Contract
property Model.disc: Currency -> Process<bool> * Process<float> -> Process<float>
property Model.snell: Currency -> Process<bool> * Process<float> -> Process<float>
property Model.absorb: Currency -> Process<bool> * Process<float> -> Process<float>
val rates : float -> float -> Process<float>

Full name: Snippet.rates
val rateNow : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
val delta : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
val generateSlice : (float -> int -> seq<float>)
val minRate : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
val n : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType
val rateSlice : (float -> int -> seq<float>)
val take : int -> seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.take
val makeRateSlices : (float -> int -> seq<seq<float>>)
namespace System
namespace System.Collections
namespace System.Collections.Generic
val rateModels : Dictionary<Currency,Process<float>>

Full name: Snippet.rateModels

type: Dictionary<Currency,Process<float>>
implements: IDictionary<Currency,Process<float>>
implements: ICollection<KeyValuePair<Currency,Process<float>>>
implements: seq<KeyValuePair<Currency,Process<float>>>
implements: System.Collections.IDictionary
implements: System.Collections.ICollection
implements: System.Collections.IEnumerable
implements: System.Runtime.Serialization.ISerializable
implements: System.Runtime.Serialization.IDeserializationCallback
type Dictionary<'TKey,'TValue> =
class
new : unit -> System.Collections.Generic.Dictionary<'TKey,'TValue>
new : int -> System.Collections.Generic.Dictionary<'TKey,'TValue>
new : System.Collections.Generic.IEqualityComparer<'TKey> -> System.Collections.Generic.Dictionary<'TKey,'TValue>
new : int * System.Collections.Generic.IEqualityComparer<'TKey> -> System.Collections.Generic.Dictionary<'TKey,'TValue>
new : System.Collections.Generic.IDictionary<'TKey,'TValue> -> System.Collections.Generic.Dictionary<'TKey,'TValue>
new : System.Collections.Generic.IDictionary<'TKey,'TValue> * System.Collections.Generic.IEqualityComparer<'TKey> -> System.Collections.Generic.Dictionary<'TKey,'TValue>
member Add : 'TKey * 'TValue -> unit
member Clear : unit -> unit
member Comparer : System.Collections.Generic.IEqualityComparer<'TKey>
member ContainsKey : 'TKey -> bool
member ContainsValue : 'TValue -> bool
member Count : int
member GetEnumerator : unit -> Enumerator<'TKey,'TValue>
member GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> unit
member Item : 'TKey -> 'TValue with get, set
member Keys : KeyCollection<'TKey,'TValue>
member OnDeserialization : obj -> unit
member Remove : 'TKey -> bool
member TryGetValue : 'TKey * 'TValue -> bool
member Values : ValueCollection<'TKey,'TValue>
type Enumerator =
struct
member Current : System.Collections.Generic.KeyValuePair<'TKey,'TValue>
member Dispose : unit -> unit
member MoveNext : unit -> bool
end
type KeyCollection =
class
new : System.Collections.Generic.Dictionary<'TKey,'TValue> -> KeyCollection
member CopyTo : 'TKey [] * int -> unit
member Count : int
member GetEnumerator : unit -> Enumerator<'TKey,'TValue>
type Enumerator =
struct
member Current : 'TKey
member Dispose : unit -> unit
member MoveNext : unit -> bool
end
end
type ValueCollection =
class
new : System.Collections.Generic.Dictionary<'TKey,'TValue> -> ValueCollection
member CopyTo : 'TValue [] * int -> unit
member Count : int
member GetEnumerator : unit -> Enumerator<'TKey,'TValue>
type Enumerator =
struct
member Current : 'TValue
member Dispose : unit -> unit
member MoveNext : unit -> bool
end
end
end

Full name: System.Collections.Generic.Dictionary<_,_>

type: Dictionary<'TKey,'TValue>
implements: IDictionary<'TKey,'TValue>
implements: ICollection<KeyValuePair<'TKey,'TValue>>
implements: seq<KeyValuePair<'TKey,'TValue>>
implements: System.Collections.IDictionary
implements: System.Collections.ICollection
implements: System.Collections.IEnumerable
implements: System.Runtime.Serialization.ISerializable
implements: System.Runtime.Serialization.IDeserializationCallback
val iter : ('T -> unit) -> seq<'T> -> unit

Full name: Microsoft.FSharp.Collections.Seq.iter
val x : Currency * Process<float>
Dictionary.Add(key: Currency, value: Process<float>) : unit
val rateModel : Currency -> Process<float>

Full name: Snippet.rateModel
Dictionary.TryGetValue(key: Currency, value: byref<Process<float>>) : bool
val p : Process<float>

type: Process<float>
implements: System.IEquatable<Process<float>>
implements: System.Collections.IStructuralEquatable
val failwith : string -> 'T

Full name: Microsoft.FSharp.Core.Operators.failwith
val unProc : Process<'a> -> seq<RandomVariable<'a>>

Full name: Snippet.unProc
val s : seq<RandomVariable<'a>>

type: seq<RandomVariable<'a>>
inherits: System.Collections.IEnumerable
val prevSlice : seq<float> -> seq<float>

Full name: Snippet.prevSlice
val r : seq<float>

type: seq<float>
inherits: System.Collections.IEnumerable
Multiple items
val seq : seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------

type seq<'T> = IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>

type: seq<'T>
inherits: System.Collections.IEnumerable
val not : bool -> bool

Full name: Microsoft.FSharp.Core.Operators.not
val isEmpty : seq<'T> -> bool

Full name: Microsoft.FSharp.Collections.Seq.isEmpty
val rest : seq<float>

type: seq<float>
inherits: System.Collections.IEnumerable
val skip : int -> seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.skip
val a : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
val head : seq<'T> -> 'T

val b : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
val discCalc : seq<RandomVariable<bool>> -> seq<RandomVariable<float>> -> seq<RandomVariable<float>> -> seq<RandomVariable<float>>

Full name: Snippet.discCalc
val pb : seq<RandomVariable<bool>>

type: seq<RandomVariable<bool>>
inherits: System.Collections.IEnumerable
val pf : seq<RandomVariable<float>>

type: seq<RandomVariable<float>>
inherits: System.Collections.IEnumerable
val rates : seq<RandomVariable<float>>

type: seq<RandomVariable<float>>
inherits: System.Collections.IEnumerable
val bRv : RandomVariable<bool>

type: RandomVariable<bool>
inherits: System.Collections.IEnumerable
val pRv : RandomVariable<float>

type: RandomVariable<float>
inherits: System.Collections.IEnumerable
val forall : ('T -> bool) -> seq<'T> -> bool

Full name: Microsoft.FSharp.Collections.Seq.forall
val x : bool

type: bool
implements: System.IComparable
implements: System.IConvertible
implements: System.IComparable<bool>
implements: System.IEquatable<bool>
inherits: System.ValueType
val truncate : int -> seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.truncate
val rateRv : RandomVariable<float>

type: RandomVariable<float>
inherits: System.Collections.IEnumerable
val bs : seq<RandomVariable<bool>>

type: seq<RandomVariable<bool>>
inherits: System.Collections.IEnumerable
val ps : seq<RandomVariable<float>>

type: seq<RandomVariable<float>>
inherits: System.Collections.IEnumerable
val rs : seq<RandomVariable<float>>

type: seq<RandomVariable<float>>
inherits: System.Collections.IEnumerable
val rest : seq<RandomVariable<float>>

type: seq<RandomVariable<float>>
inherits: System.Collections.IEnumerable
val nextSlice : RandomVariable<float>

type: RandomVariable<float>
inherits: System.Collections.IEnumerable
val discSlice : seq<float>

type: seq<float>
inherits: System.Collections.IEnumerable
val r : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
val thisSlice : seq<float>

type: seq<float>
inherits: System.Collections.IEnumerable
val p : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
val q : float

type: float
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<float>
implements: System.IEquatable<float>
inherits: System.ValueType
val disc : Currency -> Process<bool> * Process<float> -> Process<float>

Full name: Snippet.disc
val model : Model

Full name: Snippet.model
val cur1 : Currency

type: Currency
implements: System.IEquatable<Currency>
implements: System.Collections.IStructuralEquatable
implements: System.IComparable<Currency>
implements: System.IComparable
implements: System.Collections.IStructuralComparable
val pb : Process<bool>

type: Process<bool>
implements: System.IEquatable<Process<bool>>
implements: System.Collections.IStructuralEquatable
val pf : Process<float>

type: Process<float>
implements: System.IEquatable<Process<float>>
implements: System.Collections.IStructuralEquatable
val bO : seq<RandomVariable<bool>>

type: seq<RandomVariable<bool>>
inherits: System.Collections.IEnumerable
val rvs : seq<RandomVariable<float>>

type: seq<RandomVariable<float>>
inherits: System.Collections.IEnumerable
val o : bool

type: bool
implements: System.IComparable
implements: System.IConvertible
implements: System.IComparable<bool>
implements: System.IEquatable<bool>
inherits: System.ValueType
val GiltStrip : Contract

Full name: Snippet.GiltStrip
val q : Process<float>

Full name: Snippet.q

type: Process<float>
implements: System.IEquatable<Process<float>>
implements: System.Collections.IStructuralEquatable
val printf : Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printf