coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Emilio Jesús Gallego Arias <e AT x80.org>
- To: Agnishom Chattopadhyay <agnishom AT cmi.ac.in>
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] How can I extract data from this exists Prop?
- Date: Tue, 25 Aug 2020 19:15:14 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=e AT x80.org; spf=Pass smtp.mailfrom=e AT x80.org; spf=Pass smtp.helo=postmaster AT x80.org
- Ironport-phdr: 9a23:CombcRNTpdy+EXXa4DAl6mtUPXoX/o7sNwtQ0KIMzox0I//7rarrMEGX3/hxlliBBdydt6sazbOM6+u5ATVIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfLJ/IA+roQnPqsUajpZuJrosxhDUvnZGZuNayH9yK1mOhRj8/MCw/JBi8yRUpf0s8tNLXLv5caolU7FWFSwqPG8p6sLlsxnDVhaP6WAHUmoKiBpIAhPK4w/8U5zsryb1rOt92C2dPc3rUbA5XCmp4ql3RBP0jioMKiU0+3/LhMNukK1boQqhpx1hzI7SfIGVL+d1cqfEcd8HWWZNQsNdWipcCY2+coQPFfIMM+ZGoYfgoFsOoxWwCguvCuzhxTBHmmT73bEm3+k7DQ3KwBYtEtAIvX/JrNv1LqASUeWtwafHyDXDbvdW2Tb66IfQdh4uv+qMRahrccXJyEcgDQfFjlGOpozqODOazvgAs3Ka7+V6TuKklmkqpB9qrzmgxcoglpPFhoUPylDL7Ch0xps+KtKkRkBhe9GkDIdQuD+AN4twWs4vXWJltSg1xLMGupO1cikHxYknyhDRdfGKbYmF7wztWuufITl1mm9pdrKjihqs80Wtye3xW9W33VtOrydJjtnCu3YQ3BLQ8siKUuZx80Si1DqVyQzf9OBJLVopmafZNpIt2KM8m5QNvUjbAyP7mkT7gLWVe0gq4OSk9uDqb7X8qpOCN4J5hAfzObk0lMy/AOQ4KQgOX2md+eSz17Pj5VX3T6tWjvw4lanZqpPaKNwGqqO6AAJZyJgv5wi+Aju8zdgVn2QLIEhYdB+JkYTkPUzFLuriAvelmVuslS9mx/DYMb3lBZXANnfCnbT9cbpn7E5c0gUzwche55JSFL4BPOr+VlLyudHbFBM1LRK4zuf9BNlg1I4SRHiDDrKXPa/MqVOI4/ggI+iIZI8bojb9LP0l6ubwgnIill4QfrWl0YEQaHCiEfRqO1+Zbmb0gtcdDWcKuRIzQ/DtiF2bSDJce3KyX78n6TwgE4KnDYLDRpi3j7Cb3Se7GIdWZmFcBVyWH3fobdbMZ/BZQS2UI9RhlTlMfrioV5MmzRiitB7z2vIzJ+XS+zYYspfL3910oeTY0xA0o29aFcOYhkyITmV1mVQqSiSkx5dQqEh5x1iE5oFigvVDXYhez+MZCkE9L5GKnL8yMMz7Rg+UJoTBc12hWNjzRGhpFottke9LWF50HpCZtj6GxzCjUu0Fx+TNA4Y7oPqFjirBYv1lwnOD75EPylwvQ89BL2qj1/xvp1CVAJTGwRzAyvSaMJ8E1SuIz1+tiGqDuEYJAh4gCePCR39NP0Y=
- Organization: X80 Heavy Industries
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
Archive powered by MHonArc 2.6.19+.