Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] How do I handle computational parts of a proof?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] How do I handle computational parts of a proof?


Chronological Thread 
  • From: Emilio Jesús Gallego Arias <e AT x80.org>
  • To: Agnishom Chattopadhyay <agnishom AT cmi.ac.in>
  • Cc: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] How do I handle computational parts of a proof?
  • Date: Tue, 09 Jul 2019 14:42:56 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=e AT x80.org; spf=Pass smtp.mailfrom=e AT x80.org; spf=Pass smtp.helo=postmaster AT x80.org
  • Ironport-phdr: 9a23:NPrpYBZAVEtI+v8PVZ5JRZ3/LSx+4OfEezUN459isYplN5qZoMq8bnLW6fgltlLVR4KTs6sC17OM9fy6EjFeqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba5sIBmsogjdqMYajItjJ60s1hbHv3xEdvhMy2h1P1yThRH85smx/J5n7Stdvu8q+tBDX6vnYak2VKRUAzs6PW874s3rrgTDQhCU5nQASGUWkwFHDBbD4RrnQ5r+qCr6tu562CmHIc37SK0/VDq+46t3ThLjlTwKPCAl/m7JlsNwjbpboBO/qBx5347Ue5yeOP5ncq/AYd8WWW9NU8BMXCJDH4y8dZMCAeofM+hFqIn9qVUAohm9CwaiC+zg1iRFhmPq0aAgz+gtDRvL0Q4mEtkTsHrUttL1NKIKXO66yanIzDHDb/JR2Tjl7IbHbAshueuXXb1ocMTe000vFwfbgVWfrozqJy+Y1v4Ms2eB9OprSOWihHA8pgB+oTWj2t0gio7ThoIa013J8zhyzoUtJdCgVUJ2Yt2pHIFOuy2ENoZ6WN4uTmN1tCog17ELt4C3cDAIxZkl3RLTdvyKfouS7h7+V+udPS10iGxrdb+8gRu57FKuxffmVsau1VZHtipFncfItnAKzxHS5cuKRudn8kemwzaP2Bjf6uBCIU8qiarWM4Mtz70zm5YJr0jPAC77lF/rgKKUa0ko4PWk5ur5brn+o5+TLY50igXwMqQ0ncy/BPw1PRYVUmmU+umwyKfv/UrjQLVFlvE2iLXWsIjGJcQHoa60GxNa0oE66xqmEzim1MkYkmIcIVJeeBOHipDpNEvULPD5C/e/mVWsny1xy/DIJL2ySqnKe1HMlrb6fbF4o2VcwRYvyshW65JFA6BJdPv8XE7qtNvdJhQ8Mkq9yKDmDoMu+JkZXDeiB66dMaTlk1KTdPkYDOCIYIIavwHUMfks/La6gFcpyQdberOmi8hEIEukF+hrdh3KKUHnhc0MRCJT5lJnHb7azWaaWDsWXE6cGqc15zU1EoWjXNXTFtjrh6aOjn7iQs9mI1teA1XJKk/GMp2eUqZeeHLKZMh7nW5cDOXze8oazRir8TTC5f9nI+7Tq38I5cql08J6tbTe
  • Organization: X80 Heavy Industries

Hi Agnishom,

Agnishom Chattopadhyay
<agnishom AT cmi.ac.in>
writes:

> I am trying to prove the following statement:
>
> Lemma can_be_brute_forced : forall (n : nat), n < 10 -> n mod 10 = (n ^ 5)
> mod 10.
>
> Now, this is a computational proof, which requires mostly evaluation, and
> noticing the fact that only 10 cases need to be worked out.
>
> How do I prove this lemma without writing `destruct` 10 times?

In addition to the other answers in the thread, you can indeed reflect a
(boolean) forall on an efficiently enumerable finite type to something
that will compute OK.

Using math-comp:

8<-----------------------------------------------------------------------8<
From mathcomp Require Import all_ssreflect.

Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.

Lemma FFP n (f1 f2 : nat -> nat) :
[forall x : 'I_n, f1 x == f2 x] = all [pred x | f1 x == f2 x] (iota 0 n).
Proof.
apply/eqfunP/allP=> eqf x; last by apply/eqP/eqf; rewrite mem_iota /=.
by rewrite mem_iota; case/andP=> ? hx; have /= -> := eqf (Ordinal hx).
Qed.

Lemma can_be_brute_forced : forall (n : 'I_10), n == (n ^ 5) %[mod 10].
by apply/forallP; rewrite (FFP _ _ (fun x => x ^ 5 %% 10)); compute.
Qed.
8<-----------------------------------------------------------------------8<

Beware I wrote the FFP function in a hurry long time ago, likely the
code is not very good and math-comp may already provide that lemma in
one form or another.

Kind regards,
Emilio



Archive powered by MHonArc 2.6.18.

Top of Page