
Learn Coq in Y Minutes - xvilka
https://learnxinyminutes.com/docs/coq
======
paulgb
Are there any good resources (similarly short and informal) about doing proofs
in Coq? I don't have anything particular to prove, but I find it interesting
and would like to build up intuition for the Curry-Howard Correspondence.

Also, more tangential, but this comment section might attract people who know
the answer: any good resources for getting started on type systems more
generally?

~~~
kryptiskt
Software Foundations
([https://softwarefoundations.cis.upenn.edu](https://softwarefoundations.cis.upenn.edu))
is pretty informal and understandable, what it isn't is short. But it's a very
useful resource.

The best general introduction is probably still Types and Programming
Languages:
([https://www.cis.upenn.edu/~bcpierce/tapl/index.html](https://www.cis.upenn.edu/~bcpierce/tapl/index.html))
It's a great book, but it doesn't get to dependent types.

~~~
goodmattg
I'm currently in Prof. Pierce's class at UPenn! Can confirm this is a great
book, and we literally work through the exercises. Taking this class AFTER
using Scala in industry has really put a lot into context. It's so easy to
start too - download CoqIDE or ProofGeneral and get to it!

------
janvdberg
I love learnxinyminutes.com: ad-free concise single page reference/tutorials.
Such a simple idea, such great execution.

------
maelito
If you wonder about the name :
[https://fr.m.wikipedia.org/wiki/Coq](https://fr.m.wikipedia.org/wiki/Coq)

And the symbol :
[https://en.m.wikipedia.org/wiki/Gallic_rooster](https://en.m.wikipedia.org/wiki/Gallic_rooster)

~~~
domnomnom
You posted an article in French..

~~~
frutiger
It has an image of a chicken, which should help.

------
philzook
Hey neat! I wrote this tutorial. Lemme know if you have suggestions for
improvement (or you can make a pull request).

------
abeppu
Can anyone here comment on what kinds of proofs coq is a good tool for, and
what kinds of proofs are impractically hard for it to handle? I'm aware that
most proofs aren't formalized, and now and again we hear that mathematicians
spend a long time trying to assess whether a proof has errors. From that, I
infer that there are proof approaches that are challenging to capture in tools
like this (or else any proof not obviously correct could be formalised to
resolve the issue). What are those hard-to-capture techniques?

~~~
philzook
You may be interested in a recent survey "QED at Large: A Survey of
Engineering of Formally Verified Software"
[https://www.nowpublishers.com/article/Details/PGL-045](https://www.nowpublishers.com/article/Details/PGL-045)
(have to sign up for a free account to access :\ )

~~~
wuschel
Hi, signed up for a free account, but access was not granted. Email is in my
profile, if you would be so kind to help.

------
haolez
Are there benefits in learning Coq for those who work mainly with general
purpose programming?

~~~
tom_mellior
It's fun, and it gives you new perspectives about how you might reason about
program correctness in other languages as well, even if only informally in
your head.

~~~
seanwilson
Agree with that - I found it makes you write simpler code because you start
thinking e.g. "hmm, if I write the algorithm this way, it would take forever
to prove correct in Coq so it must be an overly complex approach".

If you find it hard to justify robustly in your head why some code should work
it's probably very difficult to prove formally which usually means there's a
large surface area for bugs too.

I found a big aspect of proving program correctness was formulating programs
in a way first that made them easier to prove. It makes you cringe at mutable
state and loops with nontrivial conditions.

------
siraben
If you're looking to do some dependently-typed programming and theorem
proving, Coq is perhaps the most mature tool to learn. It's actually two
different languages, Gallina, which is what is shown in OP, and Ltac, which is
the tactic language. I enjoyed Software Foundations[1], which, if you have the
time, lets you self-study theorem proving starting from scratch. Somewhat less
known is the book Formal Reasoning About Programs[2] which is more advanced
but informative as well.

[1] [https://softwarefoundations.cis.upenn.edu/lf-
current/index.h...](https://softwarefoundations.cis.upenn.edu/lf-
current/index.html)

[2] [http://adam.chlipala.net/frap/](http://adam.chlipala.net/frap/)

------
kiterunner2346
Ummm, so how is "Coq" pronounced?

~~~
sincerely
[https://github.com/coq/coq/wiki/Presentation](https://github.com/coq/coq/wiki/Presentation)

>Did you really need to name it like that?

>Some French computer scientists have a tradition of naming their software as
animal species: Caml, Elan, Foc or Phox are examples of this tacit convention.
In French, “coq” means rooster, and it sounds like the initials of the
Calculus of Constructions CoC on which it is based.

~~~
tarsinge
The big irony is: "Coq" is for English speaker exactly what "Bit" is in
French. No problem when written, and ok spoken between grown up professionals
obviously (though I still avoid translating bitwise operator because it
becomes "cock to cock operator" when spoken), but elementary school with all
the 8/16/32 bits consoles was painful...

------
hcarvalhoalves
I wonder, can I define floating point arithmetic w/ this language?

~~~
philzook
As others have mentioned, it's possible and has been done in the FlocQ
library. I don't have personal experience using them. I would expect proving
properties to be somewhat challenging. There is a book available

[https://www.elsevier.com/books/computer-arithmetic-and-
forma...](https://www.elsevier.com/books/computer-arithmetic-and-formal-
proofs/boldo/978-1-78548-112-3)

You may also want to look at this thesis

[https://www.lri.fr/~melquion/doc/19-hdr.pdf](https://www.lri.fr/~melquion/doc/19-hdr.pdf)

~~~
philzook
As a side note, I believe native floating point operations are in the works.
This is more of a speed benefit though?
[http://drops.dagstuhl.de/opus/volltexte/2019/11062/pdf/LIPIc...](http://drops.dagstuhl.de/opus/volltexte/2019/11062/pdf/LIPIcs-
ITP-2019-7.pdf)

------
jannes
What a great name

~~~
g4d
Presumably its pronounced cock?

~~~
enz
In French, yes.

~~~
domnomnom
How is it pronounce it in English lol

~~~
wisnesky
Yes, Coq is pronounced like "cock" in English. C'est la vie

------
nprateem
That's what she said

~~~
dang
Please don't do this here.

------
domnomnom
How do I pronounce Coq?

------
hart_russell
I've been learning my own version of Coq for decades now

