
Coq is a Lean Typechecker - palmskog
https://coq.discourse.group/t/alpha-announcement-coq-is-a-lean-typechecker/581
======
perthmad
This particular feat was triggered by Kevin Buzzard's unsubstantiated claim
that "Lean was better than Coq" as a foundation for mathematics, because it
had built-in quotient types. The work described above precisely shows that
such types can be encoded as well using features shipped with the vanilla Coq
distro. See [https://sympa.inria.fr/sympa/arc/coq-
club/2020-01/msg00006.h...](https://sympa.inria.fr/sympa/arc/coq-
club/2020-01/msg00006.html).

~~~
jmgrosen
My understanding is that this shows how vanilla Coq _still_ can’t encode
quotients well. This project relies on a PR [0] that breaks term
normalization, which makes it highly unlikely it will be merged. My
understanding is that Lean’s implementation of quotients also breaks
normalization, but they don’t care as much about that as Coq devs do.

[0]:
[https://github.com/coq/coq/pull/10390#issuecomment-554316311](https://github.com/coq/coq/pull/10390#issuecomment-554316311)

~~~
SkySkimmer
The normalization issue is not about quotients at all. It's
[https://arxiv.org/abs/1911.08174](https://arxiv.org/abs/1911.08174) "Failure
of Normalization in Impredicative Type Theory with Proof-Irrelevant
Propositional Equality"

~~~
jmgrosen
Well, I will defer to your judgment! I’m by no means a type theory person.

My understanding was that these features are how quotients are managed to be
implemented. But perhaps that is wrong.

------
Ericson2314
The more powerful our languages get and more robust our programs written in
them get (those go hand in hand), the easier it will be to compile languages
from one language to another without compromising code quality or legibility.

I hope this will lead to a new golden age of programming and PL research where
more software is not "trapped" in the language and era it is first developed,
and we aren't constantly bouncing between the extremes of endlessly
accumulating tech debt or naively rewriting.

~~~
firethief
> The more powerful our languages get[...], the easier it will be to compile
> languages from one language to another

I'm not sure about this. Don't languages get their power from restrictions and
opinionatedness, that create a fundamental impedance mismatch between any
languages that aren't redundant? You can do anything the processor can do in
assembly, and the unstructured mass is about as powerful as muscle with no
bone.

But maybe I'm reading "powerful" too positively. As languages get kitchen-
sinky, as JavaScript/C++/Java are with reckless abandon, it will be easier to
use them as translation targets (and harder to reason about the results). But
won't kitchen-sinky languages eventually give way to languages that haven't
yet had time to tie themselves in knots, as C++ (which finished the kitchen
and is now putting a second sink in the bathroom) is losing ground to Rust
(which only just bolted on async), in an endless cycle of collapse and
renewal?

------
zozbot234
Very nice work. This kind of embedding (a direct equivalent to "transpiling"
for code) is quite common in the formal methods community; for example, Freek
Wiedijk has shown a similar embedding of HOL Light
[https://www.cs.ru.nl/~freek/notes/index.html](https://www.cs.ru.nl/~freek/notes/index.html)
into Coq.

~~~
perthmad
You can actually do much better than mere embeddings. Using program
translations similar to what Haskell users routinely perform when using the
do-notation for monads, you can actually extend your type theory with new
reasoning principles. See for instance the parametric exceptional theory [1],
which adds well-behaved exceptions and allows to extend Coq with the
independence of premises, i.e. (¬A → ∃n:ℕ. P n) → ∃n:ℕ. (¬A → P n).

[1]
[https://hal.inria.fr/hal-01840643/document](https://hal.inria.fr/hal-01840643/document)

------
spidermango
How do you pronounce Coq?

~~~
rburhum
Not trying to be childish, but let's be honest, this is a horrible name if you
are not a native english speaker. I just hear giggles every time somebody
mentions this name...

~~~
munk-a
This is a horrible name even for native english speakers. I still have to
coach people not to giggle whenever I bring up LaTeX - unless it's exclusively
vocally in which case the "lah-TECH" puts their mind elsewhere.

~~~
TurboHaskal
I kinda miss those times where you could talk about those Thinkpad clits at
work and no one would bat an eye. The degree of puritanism of the new
generation is a bit terrifying.

We had plenty of women in the lab, btw.

~~~
munk-a
I don't think it's puritanism, it's just keeping things separate. In an office
we're all there to work and not get embroiled in relationship drama - so
calling that nub a clit is just unnecessarily bringing sex into things.

