Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] The definition of Union operation of Set in Coq standard library

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] The definition of Union operation of Set in Coq standard library


Chronological Thread 
  • From: Théo Zimmermann <theo.zimmi AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] The definition of Union operation of Set in Coq standard library
  • Date: Wed, 25 Apr 2018 13:17:59 +0000
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=theo.zimmi AT gmail.com; spf=Pass smtp.mailfrom=theo.zimmi AT gmail.com; spf=None smtp.helo=postmaster AT mail-ua0-f176.google.com
  • Ironport-phdr: 9a23:a9WwJxbGr+qQD1xWZS500TL/LSx+4OfEezUN459isYplN5qZoMq+bnLW6fgltlLVR4KTs6sC17KN9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCazbL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjmk8qxlSgLniD0fOjE2/mHYiMx+gqxYrhy8uRJw35XZb5uJOPdkZK7RYc8WSGhHU81MVyJBGIS8b44XAuQfPeZftY79qEMNohu/AAmsAf3gyiVNhnDs26061fkqHAba3AwgAd0Ot27YrdT0NKcXVOC1zbLFzTrGb/xM2Df97JLEfQwmofGJRL99d9fax0coFwPAlFqQqIrlMiuU1uQLqWib7vBvWfihi249sw1xrTmvxtssionUnY0Z0EzL9SJ8wIszONa2S1Z7bMa6HJdMsyyWLYh7T8M4T212pSo3yKcKtYO5cSULzpks2gTRZOadc4eS5xLuTOaRLil8hHJiYL+/ggy98UmkyuHlS8m7ykpGojNLktXRtH0A1gbf6seASvt68Ueh3SiA2xrP5eFDJEA4javbK5g/zb4sjpcfr1jPEyvslEj1jKKabFso9vWq5uj9f7nrpJ6RO5dxig7kM6QunsK/Af4/MggLR2Wb5eS826Pk/UHjQbRKj/g2kqzYsJ3BKsQbo7S2Aw5R0oo59xm/CDKm3MwCnXYbNFJFZA6Hj4/xNl7SJ/D4FO6zjEiokDd23P/LJabhA5XILnjbirjtZ7d960hGyAoy199T/ZxUCqtSaM70D0T2rZnTCgIzGw2y2efuTttnha0EXmfaPq8YN5TgsFqN6/gqKu+KLNsJuDv6beok4vvvpXA8kF4ZO6Ku2M1EOziDAv16LhDBMjLXidAbHDJS51tsfKnRkFSHFAVrSTO3VqM46Cs8Ddv/X4jGT4GpxreG2XXiR8EEViV9ElmJVEzQWcCcQf5VMXCdJ8ZglnoPUr3zE9Z8hyHrjxfzzv9cFsSR+iAcssi9ht185umWiBhqsDItUJrb3GaKQGV52GgPQm1u0Q==

Hello,

These two definitions are equivalent. See the small proof below.

Require Import Ensembles.

Section Ensembles.
  Variable U : Type.
  Definition Union' (B C: Ensemble U) : Ensemble U :=
    fun a:U => In _ B a \/ In _ C a.

  Theorem both_union_are_equivalent :
    forall A B : Ensemble U, Same_set _ (Union _ A B) (Union' A B).
  Proof.
    split; unfold Included, Union', In; intros * H.
    - destruct H.
      + now left.
      + now right.
    - destruct H.
      + now left.
      + now right.
  Qed.

End Ensembles.

In a way, the choice made in the Ensemble library is to "embed" the case disjunction in the definition of Union itself, instead of reusing the pre-defined \/ operator. There is no claim that this is the right way. Both ways have their advantages and drawbacks.

For instance, the A <-> B operator is currently defined as (A -> B) /\ (B -> A), but there is a long-standing proposal to transform this into an inductive definition: https://github.com/coq/coq/pull/140

Note on the other hand, that the Ensemble library is pretty old and will probably be removed / refactored during the upcoming general clean-up of the standard library.

Cheers,
Théo

Le mar. 24 avr. 2018 à 14:30, shyuan AT nuaa.edu.cn <shyuan AT nuaa.edu.cn> a écrit :
Dear All, 
    Recently, I try to describe classical set theory by using Coq and then I read the Coq library. I find the definition (see https://coq.inria.fr/distrib/current/stdlib/Coq.Sets.Ensembles.html) of Union operation of Set in Coq standard library is not same as I thinked, I prefer to define Union operation as follows:
 Definition Union (B C:Ensemble):Ensemble:= fun a:U => In B a \/ In C a.
    I don't understand why Union operation is defined in this way. Could you please tell me the reason?
Thanks a lot.


Shenghao Yuan
College of Computer Science and Technology           (CCST)
Nanjing University of Aeronautics and Astronautics  (NUAA)
Nanjing China



Archive powered by MHonArc 2.6.18.

Top of Page