Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Comparing Coq and K

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Comparing Coq and K


Chronological Thread 
  • From: Brandon Moore <brandon_m_moore AT yahoo.com>
  • To: Coq Club <coq-club AT inria.fr>
  • Cc: grigore.rosu AT runtimeverification.com
  • Subject: Re: [Coq-Club] Comparing Coq and K
  • Date: Thu, 6 Feb 2020 19:34:57 +0000 (UTC)
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=brandon_m_moore AT yahoo.com; spf=Pass smtp.mailfrom=brandon_m_moore AT yahoo.com; spf=None smtp.helo=postmaster AT sonic309-21.consmr.mail.gq1.yahoo.com
  • Ironport-phdr: 9a23:QtPGpBMVnBFpkom/KeQl6mtUPXoX/o7sNwtQ0KIMzox0I/X6rarrMEGX3/hxlliBBdydt6sYzbeN+Pm7ACRAuc/H7ClZNsQUFlcssoY/p0QYGsmLCEn2frbBThcRO4B8bmJj5GyxKkNPGczzNBX4q3y26iMOSF2kbVImbuv6FZTPgMupyuu854PcYxlShDq6fLh+MAi6oR/eu8ULjoZuMKY8xxXGrndVdela2H5jKVaPkxrh/Mu984Nv/ipKt/4968JMVLjxcrglQ7BfEDkoKX0+6tfxtRnEQwuP538cXXsTnxFVHQXL7wz0U4novCfiueVzxCeVPcvtTbApQjui9LtkSAXpiCgcKTE09nzch9Fqg6JapBKhoAF/w5LRbYqIOvdyYr/RcNUHTmdaQM1fSzJODZ+9b4sXDuoOI+BYr5Xmp1ATqReyHBSgCP/zxjNNgHL9wK803Pk7EQze0gIuH8wAvnfWo9X7KakdXvy6wq7TwDrZc/9Zwizy5ZLUfh0jp/yHQLJ+cdDWyUkqDw7Ik0+QppbjPzyI0eQNtXWQ4e1nVeKokW4otRx6rz+0ycc2kIbJgJ8aylfC9SphxYY6Pdi4SEl8Yd6+DpRdrCGbOJF2QsMlRGFkojo1yroDuZOieiUB1Zopxxnaa/OdcoiI5AruVP2QITd3nHJlfKiwhxCo/Uin0O38WdG40VlQoSpbk9nDqGoN1xjN5cidTft8/l2t2TGV1wDc8u1EPFg0mrTdK54n2LI/iIccsVnbEi/shUX2irOWdkQh+ue29eTofK/mpp6SN491lg7xKLgums24AeQ+KAQBQ2+b+eG62bb+/kP5WK1Hg/k1n6XDrZzXK8YWqrS4DgJVyIov9hmyAjWg3d8Fh3cINkhFdwiCj4XxO1HBPvT4DfCnjlS3lzdrwfHGMaHvD5nRKnXPiantcatn50FAzwozy8tf55dOCr0bJfL8QE7xtNjCAh82Kgy43vzrCdVn2YMeXmKPBbWVP7/VsV+N/u4vIu+Ma5EJuDvlL/Uo5OTigWI3lFIfZ6Wk3JsaZGqlEvlpIUiVeX/sjc0AEWcOsAo+VuvqiFiaXDFIfXa9RaQ86Sw8CIKgFYjDQ5iigLmG3Ce8BJ1ZeHtLC1CWHnfocIWEXO0AZz6VIs9kijAET6SuS5c91RGysw/306ZoLu3N+iEBqZ3j0MV16PbImBEp9T10Ctyd3HuXQ2F1mGMIXT4207plrUxz0FfQmZR/1tdfDJR44+5DGlMxMoeZxOhnAfjzXBjAd5GHUgD1bM+hBGQbVNs3z9gIK2N6HM+vxkTJxSOsD7gToLm8AZsz6K/0znHxIME7wHHDgvpyx2I6S9dCYDX1zpV08BLeUsuQyx3AyvSaMJ8E1SuIz1+tiGqDuEYDAVxrVqPEVitHNw6M9JLy4UXZSqXoDL0mNk1O0JfEO6JKbdqvhlJDFq+6ZIbuJlmpkmL1Pi6mg6uWZdOzKXQU3CLaTkMDllJLpCfUBU0FHi6k5lnmInlrHFPrbVnr9LAn+mKyTkgziQqNah842g==

Hello Bas

For a bit more context, our comparison is specifically focused on defining programming languages and verifying programs written in those languages (as opposed to proving metatheory about the languages). This is what we've been using K for at Runtime Verification, and we been asked how it compares to Coq for that specific purpose. We're comparing K and Coq in the domain that K is designed to address; for more general reasoning like verifying consensus protocols we happily use Coq ourselves. The thing where K is distinctly faster is the performance of executing a program according to a language definition; program verification times were reasonably similar in our tests.

K language definitions are based on a form of rewrite rules, and we support execution with a compiler targeting LLVM.
Coq supports many styles of defining semantics, but we believe the best execution performance would come from an operational semantics with the transition relation defined by an extractible function. A previous K backend compiled to OCaml, and we only moved to more direct code generation when we couldn't further improve performance there, so we are confident K yields faster results than code extraction Coq. Also, language semantics in Coq seem to quite rarely use an extractible style, instead of inductively defined relations. I agree inductively defined relations are much more convenient for proofs, but it does mean that getting program extraction working requires additional user effort to write an alternative form of the language definition (or to develop a code generator for automatically making the conversion).

As for why we moved away from OCaml, we found that translating a large number of execution rules into a large match statement hit a bad case in its algorithm for compiling matches. A match with many large patterns blows out the cache of previously handled shapes, losing precision and performance of the executable while hurting compile times from touching so much memory. We're actually still building on Luc Maranget's, but using his paper "Compiling Pattern Matching to Good Decision Trees" instead of preferring code size of execution speed with OCaml's backtracking algorithm based on his work with Fabrice Le Fessant in "Optimizing Pattern Matching".

Brandon
On Monday, February 3, 2020, 12:26:43 PM CST, Bas Spitters <b.a.w.spitters AT gmail.com> wrote:


Dear Grigore,

This blog-post caught some attention from Coq-users, who don't fully
understand how to compare the two systems.


you later added that K is automatic (not interactive) and faster than Coq.

I'm wondering by what benchmark it is faster than Coq.

Emilio Gallego suggested that K might be a way to address the third
challenge of the poplmark.
"Challenge 3: Testing and Animating with Respect to the Semantics"

However, I've been unable to find solutions of the poplmark in K.

I've found the following solutions to challenge 3 (but the poplmark
website seems down).

Best regards,

Bas



Archive powered by MHonArc 2.6.18.

Top of Page