coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Agnishom Chattopadhyay <agnishom AT cmi.ac.in>
- To: Agnishom Chattopadhyay <agnishom AT cmi.ac.in>, coq-club AT inria.fr
- Subject: Re: [Coq-Club] How can I extract data from this exists Prop?
- Date: Tue, 25 Aug 2020 12:31:02 -0500
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=agnishom AT cmi.ac.in; spf=Pass smtp.mailfrom=agnishom AT cmi.ac.in; spf=None smtp.helo=postmaster AT mail.cmi.ac.in
- Ironport-phdr: 9a23:YHFJEh/ComN87/9uRHKM819IXTAuvvDOBiVQ1KB31O0cTK2v8tzYMVDF4r011RmVBNudsqgcwLOO6ujJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglVhTexe65+IAuqoQneq8UanZZuIbstxxXUpXdFZ/5Yzn5yK1KJmBb86Maw/Jp9/ClVpvks6c1OX7jkcqohVbBXAygoPG4z5M3wqBnMVhCP6WcGUmUXiRVHHQ7I5wznU5jrsyv6su192DSGPcDzULs5Vyiu47ttRRT1jioMKjw3/3zNisFog61brhCuqRxxzYDXfY+bKuZxc7jHct8GX2dMRNpdWzBDD466coABD/ABPeFdr4Tlu1YOoh2+BQi3BOPvzT9Ig2L90LM60+s7DQHGwAsgH8oUv3vJrNX0NL0dUOCox6TP1zrDYPVW2Tbm6IjIdRAhpOqBUq51ccrQ00UgDR/Kgk+RqYzjJj6Y0PkGvGeH4eR6T+2vl3InpB9rojip3soiipTEip4Jxl3L8Sh13YY4KNKkRUN/f9KpEJReuzyUOYZ4Rs4vQ39ltSY6xLAGuZC2YjYHxYo6yxPeavGKfYuF7xT+X+iSOTd1nG9pdKyxihqo8EWtxPfwWteo3FtEtCZJjMTAum4V2xDN9sSKTuFx80Sh1DqVygze6+BJLVopmafZKZMsxKM7mIAJvkTZBCD2nV37jK+IeUUg/eil8+Hnba/npp+YLYN7lgT+MqU0lsOlHes0KAkOX26D9eS90r3s41H5Ta1XgvEonKTVqpHXKMoBqqKnHwNY3Jwv5wiiAzu4yNgYmGMILFNBeBKJlYjpPFTOLejiAvewhVSskSxrx/DBPr3kGZjCMn3DkLb7cbln90FQ0gszzdZH65JOFr4BOO7zWlP2tNHAEhA5NBW0z//7B9V5y4MRQnmCArSZMaPXqV+H/PgjI+iKZI8PuTbyMeIp5/D0jSxxpVhIVKav3IAXb3XwNfRvP1meeXPggsYIAC9etwU4Tffqj1iqWjtSIX+5GaM6sHVzA4W/SIzHW4qFgbqb3S79EIcFSHpBDwWlHnHpbIWDXr8naCuOPsh5mzAERLGwA9so2hevrw/9zpJsK+uS8yZetJS1h4s93PHaiRxnrW88NM+ayWzYFzgozFNNfCc/2eVEmWI40k2KiPEqiPlZU9VYofJPAF9jZMzsitdiAtW3YTrvO9KASVKoWNKjWGhjRdcwhdYFJUd7SYz700LzmhGyCrpQrISlQZw59qWFgSr0Lsd5jX3D1e8ohB8nRJkXOA==
That's an interesting suggestion, thanks.
On Tue, Aug 25, 2020, 12:15 Emilio Jesús Gallego Arias <e AT x80.org> wrote:
Hi Agnishom,
Agnishom Chattopadhyay <agnishom AT cmi.ac.in> writes:
> I have a function that is something like this:
>
> Definition isPrefixOf (x : list A) (y : list A) :=
> exists z, x ++ z = y.
>
> Now, I want to define a witness function. Informally, it can be described
> as follows: Given x and y such that (isPrefixOf x y), return z which
> satisfies the criteria exists z, x ++ z = y.
>
> I would try to define it this way, but that would not work (possibly
> because exists z, x ++ z = y is a Prop and we are asking for something in
> Type) :
>
> Definition witness (x y : list A) {H : isPrefixOf x y} : list A.
> destruct H.
> Abort.
If you can afford to work with a type A which has a notion of choice
principle you can indeed write your witness function. Example:
From mathcomp Require Import all_ssreflect.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Variable (A : choiceType).
Definition isPrefixOf (x : list A) (y : list A) :=
exists z, x ++ z == y.
Definition extract x y (w : isPrefixOf x y) : list A := xchoose w.
Kind regards,
Emilio
- [Coq-Club] How can I extract data from this exists Prop?, Agnishom Chattopadhyay, 08/10/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, Guillaume Melquiond, 08/10/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, Castéran Pierre, 08/10/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, Agnishom Chattopadhyay, 08/10/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, Emilio Jesús Gallego Arias, 08/25/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, Agnishom Chattopadhyay, 08/25/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, jonikelee AT gmail.com, 08/25/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, Robbert Krebbers, 08/25/2020
- Message not available
- Message not available
- Re: [Coq-Club] How can I extract data from this exists Prop?, jonikelee AT gmail.com, 08/25/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, jonikelee AT gmail.com, 08/26/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, Arthur Azevedo de Amorim, 08/26/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, Robbert Krebbers, 08/27/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, jonikelee AT gmail.com, 08/27/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, Robbert Krebbers, 08/27/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, jonikelee AT gmail.com, 08/25/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, Clément Pit-Claudel, 08/27/2020
- Message not available
- Message not available
- Re: [Coq-Club] How can I extract data from this exists Prop?, Robbert Krebbers, 08/25/2020
- <Possible follow-up(s)>
- Re: [Coq-Club] How can I extract data from this exists Prop?, Roger Witte, 08/10/2020
Archive powered by MHonArc 2.6.19+.