coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Larry Darryl Lee <llee454 AT gmail.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:50:49 -0400
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=llee454 AT gmail.com; spf=Pass smtp.mailfrom=llee454 AT gmail.com; spf=None smtp.helo=postmaster AT mail-qt0-f181.google.com
- Ironport-phdr: 9a23:2T86nxJHy53JyciMaNmcpTZWNBhigK39O0sv0rFitYgRLvjxwZ3uMQTl6Ol3ixeRBMOHs60C07KempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9JDffwdFiCChbb9uMR67sRjfus4KjIV4N60/0AHJonxGe+RXwWNnO1eelAvi68mz4ZBu7T1et+ou+MBcX6r6eb84TaFDAzQ9L281/szrugLdQgaJ+3ART38ZkhtMAwjC8RH6QpL8uTb0u+ZhxCWXO9D9QLYpUjqg8qhrUgflhiQaOTA57m/ZhNB/gqVUrxyuvBF/343ZbZuJOPdkYq/Qf9UXTndBUMZLUCxBB5uxYY0VAOobJ+ZZr5T2qVUUohukHwmtBOfvwSJOiHDow6IxzuMsEQXC3AM+Ad0Dv3TZodruOacdVOC61qjIzTHZY/xK3jf97ZHFfxY8qv+PRbJ9adTdxVUrGg/fjVidqZbpMy2I2ukMqWSX8ultWf+3h2I5tw18piKjy8Yth4XTgo8YxUrI+Cd2zYszONa2UlR0YcS+H5tVryyaN5V5QsclQ2xwvSY10LwGuZqicCgT1JQr2wfTa/Kaf4WL/x7vTumRITB/hHJqfLKwmQy+/lSnyu35TsW00VBKoTRZktTUqHwByxje5tKER/Z95EutxyuD2gHJ5u1ZIk04iLLXK5s7zb4xkpoTv17DHijzmEjuiK+Wclsr9fan5unnbbjrvZCcN4puhQH/NqQigNCwAeM9MgQWRWiU5fy81KH//U3+WLhFkvo2krDAvJ/GIcQbu7W2DhRO0ocj7ha/Fy2p3M4ZnXkBNlJFeQiIg5LnO1HUc7jECqL1iFO11Txv2vruP7v7A5yLIGKJ2OPqeq844EpBwiIyy8pe7tRaEOdSDuj0XxrVvcbCH1cVOhau0uKvLNhwntcaXW+CXvLFGKzXuF6MoOkoJr/fN8cupD/hJq19tLbVhngjlApFJPj77d4scHm9W89eDQCcaHvojM0GFD5T7AU7Re3uzlaFVGwKPirgb+cH/jg+TbmeI8LbXIn02e6O2S66GttdYWUUUgnRQ0etTJ2NXrI3UAzXIsJllWZaB72oSotkzA328QGjm+MhIe3T9SkV85nk0Yot6g==
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.