The following is a legal contract from Genoa, written in the 14th century:
...Geri, [son] of the late Ser Lapo of Florence, Simone Guascone, [9 more Names listed], each of them [liable] for the amount written below, have acknowledged and in truth have declared to me, notary undersigned, as a public official [holding] a public office, making the stipulation and receiving in the name and stead of Federico Vivaldi, citizen of Genoa, that they have bought, have had, and have received from him a certain amount of goods of the said Frederico...And for these goods and in consideration of their price each of them has promised to give and to pay to said Frederico or to his accredited messenger: [from] the said Geri, 150 gold florins, the said Simone, 50 florins, [100 florins each from the other Names] within the next five months from now. Otherwise they have promised to give and to pay to the said Frederico the penalty of the double of it and of the entire amount to which and to the extent of which [this agreement] is violated or is not observed as above, together with restitution of all losses, unrealized profits, and expenses which might be incurred because of it in court or outside -- the aforesaid remaining as settled, and under hypothecation and pledge of their goods and [the goods] of any one of them, existing and future.
[The above is binding] with the exception and special reservation that if the amount of goods, property, and merchandise which was loaded or is to be loaded by Frederico Imperiale or by another in his behalf for the account of the said Frederico Vivaldi in Aigues-Mortes -- to be transported to Ayassoluk and Rhodes or to either of these two localities in a certain ship...and which departed from Aigues-Mortes or is about to depart in order to sail to aforesaid regions -- is brought and unloaded in the said localities of Ayasoluk and Rhodes or in either of them, in safety, then and in such a case the present intrument is cancelled, void, and of no value and pro rata. And be it understood that such a risk begins when the said ship departs and sets sail from Aigues-Mortes, and it remains and lasts, while the captain goes, stays [in port], sails, loads and unloads, from the said locality of Aigues-Mortres up to the said localities of Ayassoluk and Rhodes, in whatever manner and way he wishes, until said amount of goods, property, and merchandise has been brought and unloaded in Ayassoluk and Rhodes or in either of these two localities in safety, and pro rata. Let the present instrument also be cancelled if the said Frederico refrains from asking payments of the aforesaid amounts of money for the space of one year after the time or the time limit has elapsed for asking or obtaining their payment.... Done as above, September 15th, around nones. [1393 A.D.]
And written in the contract language:
insureGoods(goodsPremium="a certain amount of goods", principal="100 fl + 50 fl + 7*100 fl", penalty=2*principal, t1="5 months from now", t2="1 year after [legal] time limit has expired" goodsInsured="that amount of goods, property, and merchandise which was loaded")
You would probably be interested in the converse: code as contracts -
Production systems based on this work (or at least this line of thought) are in use on Wall Street, except using OCaml instead of Haskell.
Re:Code as contracts
btilly on 2009-02-25T21:52:52
I know someone who has code in use on Wall St using that line of thought that is written in SQL-CLR! (You didn't know that SQL Server has a functional language embedded in it? You're not alone!)
Are contracts a DSL?
Re:The More Fun Question Is
chromatic on 2009-03-10T01:51:25
They aren't, but they do use domain-specific language.