coq-club AT inria.fr
Subject: The Coq mailing list
List archive
Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?
Chronological Thread
- From: Michiel Helvensteijn <mhelvens AT gmail.com>
- To: Arnaud Spiwack <aspiwack AT lix.polytechnique.fr>
- Cc: Pierre-Marie Pédrot <pierre-marie.pedrot AT inria.fr>, coq-club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?
- Date: Tue, 16 Jul 2013 00:28:33 +0200
On Mon, Jul 15, 2013 at 2:02 PM, Arnaud Spiwack
<aspiwack AT lix.polytechnique.fr>
wrote:
> The last two propositions are equivalent <...>. The T + { a = remove } is
> different though. In particular it allows you to return a T even if
> a=remove.
But I can do that with all three:
Fixpoint f (n: nat) : n <> 0 -> nat.
intro; exact 42. Defined.
Fixpoint f' (n: {m: nat | m <> 0}) : nat.
exact 42. Defined.
Fixpoint f'' (n: nat) : nat + {n = 0}.
exact (inleft 42). Defined.
> If we are willing to make the hypothesis that your index type Op is indeed
> an inductive type, there is an alternative idiom which may be even better
> for your uses:
>
> Definition do_stuff (a: Op) : match a with remove => True | _ -> T end.
>
> Here you never have to provide a proof yourself. However, you'll exchange
> this for more annotations on pattern matchings over Op.
I've started using this idiom. Let's see how that goes. :-)
--
www.mhelvens.net
- [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Michiel Helvensteijn, 07/14/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Pierre-Marie Pédrot, 07/14/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Michiel Helvensteijn, 07/14/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Arnaud Spiwack, 07/15/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Michiel Helvensteijn, 07/16/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Arnaud Spiwack, 07/16/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Michiel Helvensteijn, 07/16/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Arnaud Spiwack, 07/16/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Michiel Helvensteijn, 07/16/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Arnaud Spiwack, 07/15/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Michiel Helvensteijn, 07/14/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Hendrik Tews, 07/16/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Michiel Helvensteijn, 07/16/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Hendrik Tews, 07/17/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Michiel Helvensteijn, 07/17/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Hendrik Tews, 07/17/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Michiel Helvensteijn, 07/16/2013
- Re: [Coq-Club] Subtype argument, precondition or sumor return type? Which to choose?, Pierre-Marie Pédrot, 07/14/2013
Archive powered by MHonArc 2.6.18.