coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Larry Darryl Lee <Larry.Lee AT nolijconsulting.com>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: [Coq-Club] Coq Standard Library Requests
- Date: Thu, 23 Aug 2018 10:48:30 -0400
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=Larry.Lee AT nolijconsulting.com; spf=Pass smtp.mailfrom=Larry.Lee AT nolijconsulting.com; spf=Pass smtp.helo=postmaster AT NAM03-BY2-obe.outbound.protection.outlook.com
- Ironport-phdr: 9a23:wuT44xd0SHURbxvSi9NuVzYXlGMj4u6mDksu8pMizoh2WeGdxcS+YB7h7PlgxGXEQZ/co6odzbaO7Oa4ASQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7Ovr6GpLIj8Swyuu+54Dfbx9HiTahY75+Ngm6oRnMvcQKnIVuLbo8xAHUqXVSYeRWwm1oJVOXnxni48q74YBu/SdNtf8/7sBMSar1cbg2QrxeFzQmLns65Nb3uhnZTAuA/WUTX2MLmRdVGQfF7RX6XpDssivms+d2xSeXMdHqQb0yRD+v6bpgRh31hycdLzM383zZhMxugqxVvB2voBNwzYHVYIyOKPpzfbnQcc8ASGZdXMtcUTFKDIOmb4sICuoMJeBWoJPnp1sUrRq1GAeiC/n1yj9Shn722bAx3eI/Hg7YwQctGNQAv27OrNXvNKYeS+a7w7fWwjjYafNW3jP96InKch89pvGMW6lwcdfVyUkzFgPFiFqQpZb5MDOS0+QAqm6W5PdjW+K3k2Mrth19rze1ysojiITFnI0Yxk7e+Slk3Yo5OcW0RFBnbdOgCpddtiCXO5FyT84tWW1luik3x7sbspChZicK0o4oxxvHZvyHbYeI5hXjWf6JLzpkg3xpZLyyiw+v/Eei1OHwT860301UoSZfldnMq2wN2AfU6siaTPty412t2S6V1wDU9uFLP1w7lbbaK54mxL48jJ0TsVnfHi/yn0X2i6yWel849eiv7uTrerTmppmCOI9okgzyL7gil8OlDek3MAUCRWeW9fqm2LH+4EH1XK1GjvgsnanYtJDaK94bpqm8AwJN1Igs8Qy/Dy2m0dgCm3cIMkxKdQmBj4juP1HOIfL4Auu4g1Sqizdr2vTGPqHgApXLIXjPiqvufbF460JE0go80chf545ICrEGOP/8RkjxtMXBAhAlNwy03v3oBc5m1oIeXGKPGrWWPLnTsV+O/OIvIvODaJUbuDbneLAZ4Kukhngg3FQZYKOB3J0NaXn+EO4saxGSZmOpidMcG08LuBA/RarkkgvRfyRUYiOWVrgm93kXAZi8HIOLYo2gyOil1T2hD9tya21uDFeIEHXjcIOfRvMQaSSdZMRml2pXBvCaV4Y92ET250fBwL19I7+Mo3xKhdfYzNFwotbru1Q3/D1wAd6a1jvUHWdzmmIKTDgwx717vU17xRGI1q0q2qUER+wW3OtAV0IBDbCZ1/ZzUYmgXAXFf9WCT1C9X9G6ADc+CNk2xo1WOhsvK5CZlhnGmhGSLfoVmriMWMNm1Iv5hyO0DfcnjnHM2e8mkkUsRdZJOSu+nKlj+gPPBonP1UKEi6Ktcqda1ynIpj6O
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Hi,
I recently worked on a small project and noticed that the List library
within the Coq Standard library is missing two obvious proofs.
First, the List library defines a proof `Forall_impl` that has an
obvious analog for the `Exists` predicate.
Second, the List library defines a proof `Forall_inv` that applies to
the head of a list, but lacks the obvious analogue for the tail of a
list.
I'd like to propose adding two proofs to the Standard List library. The
first, is a proof `Exists_impl` which fills the gap left by
`Forall_impl`:
(**
Accepts two predicates, [P] and [Q], and a
list, [xs], and proves that, if [P -> Q],
and there exists an element in [xs] for which
[P] is true, then there exists an element in
[xs] for which [Q] is true.
*)
Definition Exists_impl
: forall (A : Type) (P Q : A -> Prop),
(forall x : A, P x -> Q x) ->
forall xs : list A,
Exists P xs ->
Exists Q xs
:= fun _ P Q H xs H0
=> let H1
: exists x, In x xs /\ P x
:= proj1 (Exists_exists P xs) H0 in
let H2
: exists x, In x xs /\ Q x
:= ex_ind
(fun x H2
=> ex_intro
(fun x => In x xs /\ Q x)
x
(conj
(proj1 H2)
(H x (proj2 H2))))
H1 in
(proj2 (Exists_exists Q xs)) H2.
Arguments Exists_impl {A} {P} {Q} H xs H0.
The second is a proof `Forall_inv_tail` that fills the gap left by
`Forall_inv`. It's proof is similarly easy:
(**
Accepts a predicate, [P], and a list, [x0 ::
xs], and proves that if [P] is true for every
element in [x0 :: xs], then [P] is true for
every element in [xs].
*)
Definition Forall_inv_tail
: forall (A : Type) (P : A -> Prop) (x0 : A) (xs : list A),
Forall P (x0 :: xs) -> Forall P xs
:= fun _ P x0 xs H
=> let H0
: forall x, In x (x0 :: xs) -> P x
:= proj1 (Forall_forall P (x0 :: xs)) H in
let H1
: forall x, In x xs -> P x
:= fun x H2
=> H0 x (or_intror (x0 = x) H2) in
proj2 (Forall_forall P xs) H1.
Arguments Forall_tail {A} {P} x0 xs.
At the moment, I've defined these proofs in a small personal library
that I include in most of my projects, but I'd like to see these
obvious extensions included in the Standard Library one day.
Who should a I propose these additions to? What are the rules for
adding theorems to the Coq Standard Library?
- Larry Lee
- [Coq-Club] Coq Standard Library Requests, Larry Darryl Lee, 08/23/2018
- Re: [Coq-Club] Coq Standard Library Requests, Beta Ziliani, 08/23/2018
- <Possible follow-up(s)>
- [Coq-Club] Coq Standard Library Requests, Larry Darryl Lee, 08/23/2018
- Re: [Coq-Club] Coq Standard Library Requests, Larry Darryl Lee, 08/23/2018
- Re: [Coq-Club] Coq Standard Library Requests, Théo Zimmermann, 08/23/2018
- Re: [Coq-Club] Coq Standard Library Requests, Larry Darryl Lee, 08/23/2018
Archive powered by MHonArc 2.6.18.