Coq: Certified Programming with Dependent Types
adam.chlipala.net
adam.chlipala.net
I found the first version much more useful so I'm posting it here for others.
"I try to keep the required background knowledge to a minimum in this book. I will assume familiarity with the material from usual discrete math and logic courses taken by undergraduate computer science majors, and I will assume that readers have significant experience programming in one of the ML dialects, in Haskell, or in some other, closely related language. Experience with only dynamically typed functional languages might lead to befuddlement in some places, but a reader who has come to understand Scheme deeply will probably be fine."
Then it is not for me, I am still struggling with Haskell.
If you're building those libraries, then you might want to use some clever type system tricks to bridge the gap between a friendly external API and an internal representation with strong guarantees. Some of those clever tricks might be done with dependent types, and you might use Coq to do them.
If you're building core infrastructure stuff, like crypto libraries, communication protocols, data storage/retrieval, language interpreters, etc. where something as trivial as an off-by-one error might cause large problems, then you might benefit from using Coq to formally prove that your implementations satisfy their specification.
So would you actually write the library in Coq - or do you somehow use Coq to prove that your eg. C++ code is correct?
I've not come across any libraries written in Coq yet.
So, best route is one of these languages with the tools, good coding guidelines, and formal inspections of design/code/docs for common issues.
> So would you actually write the library in Coq
It depends how complex the algorithms are. You would need to write a specification* and an implementation; there's not much point unless the specification is much simpler than the implementation. For example, if the specification of the tax software says things like:
If the FOO is less than 1000, then BAR is 12. If FOO is greater than or equal to 1000 then BAR is 20.
Then there's not much point using Coq: the specification is basically a step-by-step description of what to execute. All you need to do is rewrite it in a machine-readable form. You're just as likely to make mistakes translating it to Coq's specification (type) language as you are translating it straight to, eg., Haskell.If the specification less algorithmic, then it might be useful. For example, if it dictates things like:
The sum of FOO and BAR should never exceed BAZ.
QUUX can increase or decrease by 10% each year, providing that the difference between year N and year N+5 is less than 5%, and that there are no consecutive increases of length 3 or more.
Then you might consider implementing the core calculations in a language like Coq. Once you've proven your algorithms correct, you can "extract" them into some other language, eg. in Haskell, and call out to that from your regular code.> or do you somehow use Coq to prove that your eg. C++ code is correct?
That's far too difficult at the moment. You could use Coq to prove the correctness of some algorithm or protocol or whatever, in an abstract form, then go off and implement that algorithm in C++. You would have no guarantees that the C++ is correct (ie. whether it implements the algorithm/protocol faithfully); all you would know is that you're not wasting time trying to implement a flawed algorithm :)
* Well, you don't need to write a specification, but there's no point using Coq otherwise ;)
Well, no worse an homophone than 'bit' to French speakers...
Being a french speaker, I would say pronunciation is closer to "puck" with a k, so go with "Kuck".
http://dictionary.reference.com/browse/caulk
this link seems to agree, with the word represented in IPA as [kɔːk]
It's the cot-caught merger.
Using the name of this language in a workplace creates a hostile working environment[1]. That guarantees that no sensible person in the English speaking world will ever use the language at work.
Oh my, thanks for the laugh. I half imagined a Dilbert scenario when reading that.
It's weird to think of the simultaneous uptightness and childishness which would make it impossible to use this homonym in the proper context.
But I know for a fact that they thought it would be good joke as well.
Or at least a very [...] formal one
That's a good one ;)