I used to be a Lean user, now I want to switch to Coq. After going through some Software Foundations exercises, I found that Coq is somewhat similar to Lean. Coq runs blazingly fast even on the web. I am a competitive programmer and I want to use Coq for training purposes and also to explain solutions to problems! So, to learn the basics there is the helpful Software Foundations tutorial. As an ex Lean user, are there things that I need to unlearn in order to use Coq?
A long long time ago I already asked for a comparison between various systems. Your answers are very helpful.
@Huỳnh Trần Khanh there is unfortunately no canonical comparison between Coq and Lean. There are many features that are unique to each system individually. I can at least recommend https://github.com/coq-community/awesome-coq which lists many resources and libraries and plugins for Coq. In comparison to Lean, where Mathlib is the central library, Coq has many different libraries to choose from.
We compare some high-level aspects of Coq and Lean here: https://hal.inria.fr/hal-03592675v2/document#page=10
for a comparison of foundational differences, there is the classic: https://coq.discourse.group/t/alpha-announcement-coq-is-a-lean-typechecker/581
Thanks to the cross-platform binary format for compiled code used by Lean,
mathlib can be easily distributed both in source and binary form, which generally
leads to a faster setup than for comparable Coq libraries which are compiled from
source.
Color me confused. Coq also has object files right? Can't I just download some object files from some CI to speed things up?
we believe the operating-system-specific binary distributions of the Platform have comparable ease of use.
I can't read sorry :neutral: So the object files are just platform specific, but I can still download them off of somewhere. Is this correct?
I might need a detailed explanation about how these files work. I did a quick search and found that Coq does things quite differently.
Coq has object files like .vo
, but they don't work across Coq versions
and also, they don't work across different versions of the OCaml compiler (which compiled Coq). This typically means .vo
files are not portable across Linux/Mac/Windows
however, most people rely on the opam package manager to install Coq-related things, including Coq libraries and plugins, and opam is based on source code, so the binary file problem doesn't pop up too often
we recommend beginners to use the Coq Platform to install Coq, it has both source-based opam installation and binary packages for download
Are there any competitive programmers using Coq? I'd like to see competitive programming related projects in Coq.
For example, I'd love to see a formalized Fenwick tree.
I have first two Project Euler exercises formalized... :sweat_smile: Not exactly programming competition stuff, though. :sweat_smile:
(Written in C and then proven correct using VST. See here how it looks: https://github.com/LessnessRandomness/PE)
What exactly do you mean by formalizing Fenwick tree?
A Fenwick tree is a data structure that helps you calculate range sum quickly. Project Euler is pretty close to competitive programming, some competitive programmers also solve problems there too. I guess your repository counts!
So, formalizing a Fenwick tree means proving that a piece of code that uses Fenwick tree to answer range sum queries works correctly.
If you are inclined, I encourage you to try out competitive programming. It's fun.
I really want to use VST but the licenses discouraged me from trying it out. It's not really free software and I can easily get into trouble for using it. I'm researching alternatives.
Yeah, I sent an email to Absint a week ago (they sell licences for clightgen.exe
tool and also Compcert compiler).
If I want to use clightgen.exe
tool commercially, I have to pay €5980.50 for the licence. If I wanted to use Compcert compiler, it would cost me even more, I believe.
Which isn't that much actually, given the work it took to make all these tools. I would pay them if I had the money, gladly. But I'm poor student. :sweat_smile:
did you guys see the Kata stuff? https://www.codewars.com/kata/search/coq
Huỳnh Trần Khanh said:
I really want to use VST but the licenses discouraged me from trying it out. It's not really free software and I can easily get into trouble for using it. I'm researching alternatives.
@Huỳnh Trần Khanh did you see the VST and CompCert license discussion here? I think it's pretty clear that VST itself is open source, but sure, if you want to convert real C code to Clight, clightgen proprietary license stands in the way.
probably some nice challenges left here in converting https://functional-algorithms-verified.org to Coq/SSReflect/MathComp: https://github.com/clayrat/fav-ssr
Last updated: Oct 01 2023 at 17:01 UTC