Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Proof irrelevant Specif?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Proof irrelevant Specif?


Chronological Thread 
  • From: e+coq-club AT x80.org (Emilio Jesús Gallego Arias)
  • To: Fred Smith <fsmith1024 AT gmail.com>
  • Cc: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Proof irrelevant Specif?
  • Date: Sat, 28 May 2016 10:51:43 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=e+coq-club AT x80.org; spf=Neutral smtp.mailfrom=e+coq-club AT x80.org; spf=None smtp.helo=postmaster AT boipeva.ensmp.fr
  • Ironport-phdr: 9a23:IEBGXR8sV47mhv9uRHKM819IXTAuvvDOBiVQ1KB92+wcTK2v8tzYMVDF4r011RmSDdSdtqoP07qempujcFJDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXsq3G/pQQfBg/4fVIsYL+lS8iP14/vh6ibwN76XUZhvHKFe7R8LRG7/036l/I9ps9cEJs30QbDuXBSeu5blitCLFOXmAvgtI/rpMYwuwwZgf8q9tZBXKPmZOx4COUAVHV1e1wysePxuBWLdg6O+ntUBmsNlxtUA1Gdtk3SUZL4sy+8ve14jnq0J8rzGL13UjO7qqxvVRXAmHdfcTkj/ymXp8lxiKNc6DCsvI5ki6HdZIWYO/02V7ncdMhbFjkJZdpYSyEUWtD0VIAIFedUeL8A94Q=
  • Organization: X80 Heavy Industries

Hi Fred,

Fred Smith
<fsmith1024 AT gmail.com>
writes:

> I wanted to define a small range of numbers and thought this would be a
> clean solution:
>
> Definition coord := { x | x>0 /\ x <= 3}.
>
> Then I can define the 3 valid coordinates:

In the line of Robert's reply, you may be interested in math-comp
subTypes, which provide extensive support for "irrelevant" sigma types,
as long as the property can be encoded as a bool. Thus, you can do:

Definition coord := { x | 0 < x <= 3 }.

and Coq will recognized coord automatically as a Subtype.

> Now I would like to prove:
>
> Lemma coord_all_wish:
> forall c:coord, c=c1 \/ c=c2 \/ c=c3.

I took the freedom to rewrite the lemma a bit:

Definition c1 : coord := exist _ 1 erefl.
Definition c2 : coord := exist _ 2 erefl.
Definition c3 : coord := exist _ 3 erefl.

Lemma coordP (c : coord) : c \in [:: c1; c2; c3].
Proof.
by rewrite -(mem_map val_inj); case: c => n /=; do 4!case: n => [//|n].
Qed.

Best regards,
Emilio

ps: I've put the code online in case you'd like to play with it (Chrome
required)
https://x80.org/collacoq/zebulayugu.coq



Archive powered by MHonArc 2.6.18.

Top of Page