Skip to Content.
Sympa Menu

coq-club - RE: [Coq-Club] Equality-witnessing coercions?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

RE: [Coq-Club] Equality-witnessing coercions?


chronological Thread 
  • From: Nikhil Swamy <nswamy AT microsoft.com>
  • To: Adam Chlipala <adam AT chlipala.net>
  • Cc: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: RE: [Coq-Club] Equality-witnessing coercions?
  • Date: Tue, 9 Nov 2010 23:39:35 +0000
  • Accept-language: en-US

> > Say I want to write this function (using the same definitions of A, B and 
> > foo
> as below):
> >
> > Definition bar (a:A) (b:B a) : (B a * unit) :=
> >    (b, match a with
> >          | One =>  foo b
> >          | Two =>  tt
> >        end).
> >
> 
> An instance of what I call the convoy pattern in CPDT gives us this version:
> 
> Definition bar (a:A) (b:B a) : (B a * unit) :=
>    (b, match a return B a -> _ with
>          | One => foo
>          | Two => fun _ => tt
>        end b).
> 

Very cool! This does what I want, I think. Thanks much ... I really should 
read your book! : )
-Nik




Archive powered by MhonArc 2.6.16.

Top of Page