Skip to Content.
Sympa Menu

coq-club - [Coq-Club] A formalization in Coq of puzzles involving scales and fake coins.

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] A formalization in Coq of puzzles involving scales and fake coins.


Chronological Thread 
  • From: Fred Smith <fsmith1024 AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] A formalization in Coq of puzzles involving scales and fake coins.
  • Date: Sat, 14 Nov 2015 17:36:33 -0500
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=fsmith1024 AT gmail.com; spf=Pass smtp.mailfrom=fsmith1024 AT gmail.com; spf=None smtp.helo=postmaster AT mail-vk0-f44.google.com
  • Ironport-phdr: 9a23:yBvY2xE/S4g86SDtPnbaRp1GYnF86YWxBRYc798ds5kLTJ75pMqwAkXT6L1XgUPTWs2DsrQf27eQ7vyrADddqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh730psGYOl4VzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IAu3GePEzSqUdBzA7OUg04tfqvF/NV1ih/HwZB0sMnxYAOA3E8BGyCpnqtyrmtrMlgnWyMsj/TLRyUjOnufQ4ACT0gTsKYmZquFrcjdZ92fpW


Hi,

I jus completed my first unguided formalization in Coq.  That is, I formalized a result that I was initially not sure was true, and whose proof was not known to me in advance.

The result concerns a familiar type of puzzle involving scales.  In these puzzles, one is tasked with finding a fake coin amongst a collection of real coins using only a balance scale.  The goal is to use the balance scale as few times as possible.

The just-completed proof shows that the given algorithm is optimal for any number of coins where there is exactly one fake.  The source code and details are here:
           https://github.com/fsmith1024/scales

Although the proof only involves elementary facts, this proof was very challenging for me.  It ends up clocking in at 5000 lines of proof code; far beyond what I expected this exercise to require.

Having no prior exposure to Coq and pursuing this activity in spurts in off hours, most of the proofs are done in  SWAT team style -- what do I need to establish, kick down the door, and flail around hoping that once the dust clears no hypotheses remain. 

Having powered my way through brute force to the finish line, I am now not quite sure what to do with it.  So if you find it amusing, enjoy.  

If you have suggestions for improvement I would welcome those.

Best,

Fred Smith





Archive powered by MHonArc 2.6.18.

Top of Page