Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Problems with dependent pattern matching

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Problems with dependent pattern matching


Chronological Thread 
  • From: Christian Kjær Larsen <christianden AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Problems with dependent pattern matching
  • Date: Tue, 2 May 2017 21:45:21 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=christianden AT gmail.com; spf=Pass smtp.mailfrom=christianden AT gmail.com; spf=None smtp.helo=postmaster AT mail-wm0-f50.google.com
  • Ironport-phdr: 9a23:70VOrhZldMDvHm37ldmTmlX/LSx+4OfEezUN459isYplN5qZoMmybnLW6fgltlLVR4KTs6sC0LuK9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQtFiT6ybL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjmk8qxlSgLniD0fOjAk7m/XhMx+gqFVrh2vqBNwwZLbbo6OOfpifK7QZ88WSXZPU8tTUSFKH4Oyb5EID+oEJetVsYn9p0EPrRulGQmsBfngyjlQiXHz36091P4hHhnA0gM6BdIOq2rbrNPoP6oVTe+1zLPIzTTYb/NK2Dfy8o7IfQ0/rvGKRr9wfs/RxlMuFwPBlFmftYvlPzaM2+kLrmOV7PJgWPqthmMosQ19vyajy8c2hoTKmI4Z0FDJ+TlhzIs2K9C0UlN3bN65HJdKqi2XOYR7Ttk/T2xrvisx16cItoShfCcQzZQq3x7fZOKDc4iP+h/jUfyeITZ8hH58drO/ggq+/VGuyuD8SsW4yllKri1CktnDsnACyQbf5dSASvt45kuh2DCP2B7P6uxcI005mrDXJ4M/zrMwjJYeslrPEjX2lUnqlKOWc18r+ums6+TpeLXmoZqcOpdohQH+KKQum9e/Afg5MgcUWWiU5Pqz1Lv48E32RbVFlPw2kq3DvJ/GIsQbo7a1AxVJ3YY79xa/EzCm3cwEknkANVJJYQ6Ij4z0O17VO/34Fve+g1G0kDhx3fzGP7vhAo/MLnfZirvhc6x9uAZgz184yska7JZJAJkAJujyUwn/ro/2FBg8Zie02ef8FNR00LQ9W+yVNYuQKrjftxfc7eI1IvKQZYYTtDv7A/cg7v/qy3Q+nAlOLuGSwZILZSXgTbxdKEKDbC+0jw==

Hi Guillaume,
> Definition map_fusion t G (e : exp G t) :=
> match e in exp _ t' return exp G t' -> exp G t' with
> | emap t2 t1 g em => ...
> | _ => fun e => e
> end e. (* notice "e" here! *)
>
> Now for the "..." part. The "em" binder is of type "exp G (TList t2)".
> But if you match on it, you necessarily lose the "TList t2" part. For
> instance, in the "etrue" case, this part is "TBool". This is obviously
> contradictory and thus "em" cannot be "etrue", but this is not readily
> apparent to Coq's type system. So you have to preserve the information
> manually.
>
> To do so, you need to change "em" so that it is of type "exp G lt2" for
> some arbitrary lt2 while keeping the identity "TList t2 = lt2" in your
> context. So the "..." part becomes
>
> (fun lt2 (em' : exp G lt2) =>
> match em' in exp _ lt2 return (TList t2 = lt2 -> _) with
> | emap t3 t2' f eb => fun Heq _ => emap (compose f ...) eb
> | _ => fun _ e => e
> end) (TList t2) em eq_refl
>
Thanks! I was trying something like this using the refine tactic, but
with your help I got it working.

Do you know if the Program tactic does something like this under the hood?

Cheers,
Christian



Archive powered by MHonArc 2.6.18.

Top of Page