Skip to Content.
Sympa Menu

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

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

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


Chronological Thread 
  • From: Alex Meyer <alex153 AT outlook.lv>
  • To: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: [Coq-Club] Atb.: What Coq function definition `Definition Term := forall T: Type, term T.` means?
  • Date: Sun, 1 Jul 2018 15:21:39 +0000
  • Accept-language: lv-LV, en-US
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=alex153 AT outlook.lv; spf=Pass smtp.mailfrom=alex153 AT outlook.lv; spf=Pass smtp.helo=postmaster AT EUR01-VE1-obe.outbound.protection.outlook.com
  • Ironport-phdr: 9a23:cm1lSRdbakishNXPPa/8uaHllGMj4u6mDksu8pMizoh2WeGdxcW4Yx7h7PlgxGXEQZ/co6odzbaO7ea4ASQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7Ovr6GpLIj8Swyuu+54Dfbx9HiTahYL5+Ngm6oRnMvcQKnIVuLbo8xAHUqXVSYeRWwm1oJVOXnxni48q74YBu/SdNtf8/7sBMSar1cbg2QrxeFzQmLns65Nb3uhnZTAuA/WUTX2MLmRdVGQfF7RX6XpDssivms+d2xSeXMdHqQb0yRD+v6bpgRh31hycdLzM38H/ZhNFsjKxVoxyhqR5wzJLbb4yOLvVyYr/RcMkGSWZdXMZcUTFKDIOmb4sICuoMJfpVr43jqFoBsBCwAhejBePxxT9Sm3T72rc10+A/HgDJwQAtH9wDvW/TrNXoKKcSVee1zK7LzTnZa/NWxy7w5Y7VeR4vpvGMWKh/ccvXyUQ3FgPFiE+QqY3/MD+P2OQNqXCX4PZlVeKykWIotRx+oiW3yscji4nJmoIVyk3f+ilj3Ik1Iti4RFZgYd64CpRfqyKaN4xoQsw8WWFotiI6yroIuJKhYCcKz5EnywbDZPyHd4iI4wrjW/yVIThinn5lfqywhwq0/EO9yeP8TtG53VlWoiZfltTAqGoB2h3S58SdV/dx4kes1S6B1w/N6exIPUU5mK/GJJMu3rE/jZ8evlrdEiDqmUj7ibGae0sk9+Wr7unoeavqqoKBO4JylwrwKL4hmtalDuQ9KgUOX3aU+eC71LD78kP2TqlEguErnqXAv5/UKtkXqre+AwBOzIkv8RG/Dyq60NsDmnkHMVRFdw+dg4jxIVHOJ+z4AumjjFSwkTdrwPbGMqfmApXQMnjDlLDhfbF+60JG1AUzytVf64pVCrEHPv3zRlf8udPEAhMjNwG43fzrBdR8248ERG6DHq+UPLvXsVCS5+IvJ+eMZJUSuDb4M/Uq/frugmE2mFMAfaSk04AaaHelHvR6J0WZZn3sgtQbHWcOoAoyVPbqh0GaUT5Pe3ayWLox6S08CIK/FIvMWoStgKGa0yqgBZ1XZmVGCkiWHnvydoWEXe0MaCOILcN7nDwET+vpd4h0nxqprUrxz6dtBuvS4CwR85z5npAh7OrK0Bo26DZcDsKH0mjLQXsizU0SQDpj9aRysQRYx0aOy+AsivhVBYUOvNtOTxs+MpnfiehkXYOhEjndd8uEHQ71Cu6tBis8G4poko0+Jn1lEtDntSjtmi+jArsbjbuOXcZm9b/A23/2JIB51SSfjfVzvxwdWsJKcFaeqOtn7QGKXdzOjlmdkKGpM6ACjnaUqTWziFGWtUQdazZeFKXIWXdDORn7kO6hvwb8YubrDr4qdAxc1cSFN61GLMXziklLT+viP9KYZH+tn2C3BlCDwbbeNYc=

Now I am reading http://adam.chlipala.net/cpdt/html/Hoas.html and the presentation is almost clear. But I am stuck with the estimation, that the following is the exotic term:

Example exotic_prop := Forall (fun b : bool => if b then true_prop else false_prop).

Why it is called exotic terms, whats wrong with it? It is not so obvious for newbie..


No: coq-club-request AT inria.fr <coq-club-request AT inria.fr> Carlos Olarte <carlos.olarte AT gmail.com> vārdā
Nosūtīts: svētdiena, 2018. gada 1. jūlijs 10:19:51
Kam: coq-club AT inria.fr
Tēma: Re: [Coq-Club] What Coq function definition `Definition Term := forall T: Type, term T.` means?
 
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. 


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