coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Roger Witte <Roger.Witte AT dft.gov.uk>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] How can I extract data from this exists Prop?
- Date: Mon, 10 Aug 2020 17:58:38 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=dft.gov.uk; dmarc=pass action=none header.from=dft.gov.uk; dkim=pass header.d=dft.gov.uk; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kdOLF0H4XTLkNFjRPF0+l8Lkn1cfFDfNIwNkELZ2j1g=; b=E3zo3ZOnrw2Ys+8qFw2gAdQqwi6h+hGg6CTtHjJdGXnCCaaMhm3K0s6gDWaIFzwG6A4gCE8iBUSmk+ZHFaaVD8E9ftFLb2/RHXNGCIssXxaDk7uvm6GfhxjZehSfdq0U0LOw075/PehPn6yaOB1I8seDn5nMNiQNdpAdVpoLj4P7VfJpErHyLmyC3YhQX0GRrWl/CKJoJ62sYRJJWclR2AFAwhatV7pWqjFc3q7R5F0zip72SNXNL1x8NLq2wL6PjEenmaDbf3wfsl6vxnYSEnBdhmwGNIwbtFzloGmBR8oEeyI9yqPud3nX1UwwwyIoZ0vL75NnRkovHs6l13duFg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UF3/V5Xn9UOdq7UbA/ti61KyGQGDBATBKohgO8npFDt5EDwY7MRE7JPtLW0BFbZMcWBn6HlrbZjkk0gYChcls6NKJVhs8l7nnrnAFSIu3MxHplqzHH5CeyI0u3aCj0b6JdYzubpKz7hP5q7X2UnUbmiEl0u6esNixT6T9Vag9yXX4R0IO0qNZDNxfAeGblJu+JqG6Z1Cz/KOg0pGJpxJ8Qct+zOHThIw0yS6u4vbLh+mrF1dHMrcgS1zOAVfRpFem3SR5Pon8HvTR9mvQvQMb4ZtVn71xa881NSMO7MIAYNm5C01cKnobUdVI4a3f1dxKHWC3E7HnE2AonHFC7IeOw==
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=Roger.Witte AT dft.gov.uk; spf=Pass smtp.mailfrom=Roger.Witte AT dft.gov.uk; spf=None smtp.helo=postmaster AT mx07-0003f101.pphosted.com
- Ironport-phdr: 9a23:JpUvsBDENKuwwzOSQ7o3UyQJP3N1i/DPJgcQr6AfoPdwSPX9pcbcNUDSrc9gkEXOFd2Cra4d1ayG4+u5ADxIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfLJ/IA+1oAjSucUanJZuJ6UswRbVv3VEfPhby3l1LlyJhRb84cmw/J9n8ytOvv8q6tBNX6bncakmVLJUFDspPXw7683trhnDUBCA5mAAXWUMkxpHGBbK4RfnVZrsqCT6t+592C6HPc3qSL0/RDqv47t3RBLulSwKMSMy/mPKhcxqlK9VoAyvqQFjw4DaY4+VOvhxfqLBctwVXmdORNpdWjZbD4+gc4cCDewMNvtYoYnnoFsOqAOzCxWrBOPg1DBInGL90q070+Q9DQHJwhErEtUSvnTTo9X6Kr0SXfq1w6nJ0TXDc+1Z1Czg54jGbhAtu/6MXbVuccbL1EkvFBrIg1ONooPqIz2bzP4Cs3SH7+V+T+KvjXYqpQ5+rzWh2Mshl5XFi4YaxF3K6Sl03YY4K9K3RkN6b9CqHoVcuiKEO4Z2XM4vQXxktTs1xLACuZC3YCcExZAkyhPZdveJcJCI7wr+WOuSITp0nm9pdbyhixqo7EStyfHwWtOq3FtKsCZJisfAuWoR2xDP78WLVPVw8Vug1DuKyg/c9vxILloxmKrVMZEt3qI8m58OvknABSD5g0D7g7OXe0gg5OSl7ufqbankq5KfMoJ5iADzPb8hl8CnH+g1MxQCUmae9OihyLHs50z0TbBUgvEqkaTUtZDXKMUeq6O8HQNY0oAu4AulATi8ytQXh3wHIUpFeB2Zi4jpPEnDIPX3DPujgVmgiStny+zaMrDvDJXBM2TPnKr7cbZl805cyA0zzctD551KF74NOu78Wkj0tNDADx85NRK7w/r/Bdlg1Y4TWXiDDrKXPa/Mq1OE++EiL/WWaIMLuDvxNeAp5/v0gn84nV8dc7Op3ZwSaH2gAvpmJEqZbmT2gtsbEWgKvxY+TPD0h1CZTDFTaWqyU7gz5jE8FoKqF5rDRoO1jLybwCi7BoFWZnxBCl2UDXjocJyEV+4QZyKWP89uiScJVaOhSo8kzRGhrhX2y7thLurO+y0Xr4jv1NZv576bqRZnvzdzFoGW13yHZ2ByhGIBATEslugrqktkj1yHzKJQgvpCFNUV6ekfASkgMpuJ9et1Bsq6ZQPdYtrBHGyhTdi8Rw4wUs4869MAfwByHMvkkxOVjHniOKMci7HeXM98yanbxXWkf58smUaD77EoihwdeuUKMGSngqBl8A2KXdzFnVnfmKG0M7kfjneUqDWziFGWtUQdazZeFL3fVClFNEfYsZL24V2EUrz8Ue16YDsE8taLL+5xUvOsjVhCQ62zatHOOz30wz/oXhjRnurKdJLqfH4B0SmbA08BwVge
Use CRelationClasses.PartialOrder instead of PartialOrder and you'll be OK.
Regards
Roger
From: Agnishom Chattopadhyay <agnishom AT cmi.ac.in>
Sent: Monday, 10 August 2020 18:27
To: coq-club AT inria.fr
Subject: Re: [Coq-Club] How can I extract data from this exists Prop?
Thank You. These are both great ideas. However, what I presented was a simplification of what I actually wanted. I am trying to define prefixes in the context of trace monoids (i.e, lists in which certain shufflings are allowed), in which case
Definition witness (x y : list A) := skipn (length x) y.
does not hold.
Probably the best I can do is to work with the type
sig (fun z => x ++ z = y).
This has the downside that I can't use definitions like PartialOrder from the standard library.
On Mon, Aug 10, 2020 at 4:01 AM Castéran Pierre <pierre.casteran AT gmail.com> wrote:
Hello,
You can define isPrefixOf as an inductive predicate :
Inductive isPrefixOf {A:Type}: relation (list A) :=pf1 : forall x, isPrefixOf nil x| pf2 : forall a x y, isPrefixOf x y -> isPrefixOf (a::x) (a::y).
Then prove a small inversion lemma:
Lemma isPrefix_inv {A:Type} (x y: list A) (a b:A) :isPrefixOf (a::x) (b::y) -> a = b /\ isPrefixOf x y.Proof. inversion 1; auto. Qed.
Then you prove an equivalence between this definition and your sig definition (by induction on the lists, and applications of IsPrefix_inv).
Lemma isPrefixOf_ok {A} (x y:list A) : isPrefixOf x y -> {z | x ++ z = y}.
Lemma isPrefixOf_okR {A} (x y z:list A) : x ++ z = y -> isPrefixOf x y.
Best regards,
Pierre
Le 10 août 2020 à 05:55, Agnishom Chattopadhyay <agnishom AT cmi.ac.in> a écrit :
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.
Another option seems to be to define
Definition isPrefixOf (x y : list A) :=
sig (fun z => x ++ z = y).
But I do not like this because this does not let me define things like Instance isPrefixOf_PreOrder : PreOrder isPrefixOf.
So, how can I have my cake and eat it too?
__________________________________________________________________________________________
This email has originated from external sources and has been scanned by DfT’s email scanning service.
__________________________________________________________________________________________
This email has originated from external sources and has been scanned by DfT’s email scanning service.
__________________________________________________________________________________________
The information in this email may be confidential or otherwise protected by law. If you received it in error, please let us know by return e-mail and then delete it immediately, without printing or passing it on to anybody else.
Incoming and outgoing e-mail messages are routinely monitored for compliance with our policy on the use of electronic communications and for other lawful purposes.
- Re: [Coq-Club] How can I extract data from this exists Prop?, (continued)
- 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?, Clément Pit-Claudel, 08/27/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, jonikelee AT gmail.com, 08/25/2020
- Message not available
- Message not available
- Re: [Coq-Club] How can I extract data from this exists Prop?, Robbert Krebbers, 08/25/2020
- Re: [Coq-Club] How can I extract data from this exists Prop?, Agnishom Chattopadhyay, 08/10/2020
Archive powered by MHonArc 2.6.19+.