Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] What Coq function definition `Definition Term := forall T: Type, term T.` means?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] What Coq function definition `Definition Term := forall T: Type, term T.` means?


Chronological Thread 
  • From: Carlos Olarte <carlos.olarte AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] What Coq function definition `Definition Term := forall T: Type, term T.` means?
  • Date: Sun, 1 Jul 2018 09:19:51 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=carlos.olarte AT gmail.com; spf=Pass smtp.mailfrom=carlos.olarte AT gmail.com; spf=None smtp.helo=postmaster AT mail-it0-f46.google.com
  • Ironport-phdr: 9a23:9PyM2Ra7Du2ahz1XtpYLwxj/LSx+4OfEezUN459isYplN5qZr8m7bnLW6fgltlLVR4KTs6sC17KI9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCa8bL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjmk8qxlSgLniD0fOjE2/mHYiMx+gqxYrhy8uRJw35XZb5uJOPdkZK7RYc8WSGhHU81MVyJBGIS8b44XAucfJ+lYtY39p1wVrRCjHAesAPngyiVUhnDowKY31PguHhvc3AwkGNIOq27YrNLxNKgIS+C10LfHwC7Mb/NTwzj96YzIfgo9rvGLWLJ9aMzcwlQhGQPCi1Wfs43lPzWN2+sRtmib8vBsWvyyhG46sw1xrTmvxtssionUnY0Z0EzL9SJ8wIotPt24VFR0bsKnEJtXqSGVKZF2Qs0mQ2Fvtic20KEJuZm+fCQS1Jsnxxrfa/2fc4eS5hLsTvydITFmi3J5YL6/iBey8VSgyu3hTca4ykxGoTZCktnJsH0Gyh/d6tCfR/dj4kus3SyD2gPT5+1eP0w4iKXWJ4Quz7MxkJcYrF7NETXsmErsia+bbkUk9fas6+Tgerjmo4WTN45wig3nM6QuhtCzDf02MgUBXmWX4+u81Lrk/U32RLVFkOc6nbXesJDfPcgbp6i5DBFJ0os79RqzEzOr3M4bkHQHNl5JZg+LgofzN1zBIf30FfK/jE6tkDdvyfDGJLrhApDVI3ffirjhZ7J960lHyAYpytBf44hbCqsdIP3tQULxu9nYAQU4Mwyw2eroFNJ91oYGVWKVHqCZKL/SsUOP5u83P+aMY5YVtC/hJPgh+v7hlmQ0mUQdfKmsxZsYcmq0HvVgI0WDYHrjmM0NEWkQvll2cOu/g1qbFDVXenyaXqQm5zh9Bpj1I53EQ9WGiaaF2zzzOZlffHxLQgSHGG3scJ7CXPMFcj6fCsBkmz0AE7OmTtlyhlmVqAbmxu8/faLv8SoCuMe7jYkn16jojRg3sAdMIYGY2mCJQXtzmzpRFTAz1aF750d6zwXaiPQqs7ljDdVWoshxfEIiL5eFlr51DtnzXkTKedLbEA/7EOXjOik4S5cK+/FLY0t5HI//3BXK3i7vAqNN0rLXWto79aXT23W3LMF4mS7L

Dear Alex,
 We used PHOAS [4] to encode the binders of (first order) linear logic.  The 'forall T' construction is needed to avoid exotic terms (Ie, terms that do not correspond to any syntax) 

Roughly, since the construction is parametric on any Type, an inhabitant of Term or Aprop cannot do pattern matching on the input and generate (structurally) different formulas. 

This link from Adam Chilipala's book is quite useful to understand the technique. 

http://adam.chlipala.net/cpdt/html/Hoas.html

Best 
Carlos 

On Sun, 1 Jul 2018 at 03:03 ikdc <ikdc AT mit.edu> wrote:
Looks like a PHOAS construction; see http://adam.chlipala.net/papers/PhoasICFP08/ for details.

(Reference [4] in the paper you linked.)

On Jun 30, 2018 20:24, Alex Meyer <alex153 AT outlook.lv> wrote:

I am reading about mechanization of linear logic in Coq
https://github.com/brunofx86/LL and I have trouble to understand the the function definition Term(and other function definitions involving forall) from

Definition Term := forall T:Type,  term T. (* type for terms *)
Definition AProp := forall T:Type, aprop T. (* type for atomic propositions *)

Why we need forall construction in function definition, what additional meaning it gives? Is is creating some kind of set - i.e. - that function returns set of results - one result for each type.

I asked this question on stackoverflow:

https://stackoverflow.com/questions/51017013/what-coq-function-definition-definition-term-forall-t-type-term-t-means

and received one answer there but I would like to get more elaborate answer, I still does not understand this this construction. Maybe there is some good and exact reference in literature?





Archive powered by MHonArc 2.6.18.

Top of Page