I am working on a project in Lambda-calculus and i am trying to code polymorphe couple with coqide but a have a problem coding the constructor that respect the type pprod
Definition pprod : Set -> Set -> Set := fun A B => forall T : Set , (A -> B -> T) -> T.
I have a problem with pcpl
Definition pcpl : Set -> Set -> pprod :=
fun A B T : Set => fun (a : A) (b : B) => fun k : A -> B -> T => k a b.
this is the error i get :
The term "pprod" has type "Set -> Set -> Set"
which should be Set, Prop or Type.
The problem is that you are quantifying over
Set
, so the resulting product type cannot be of typeSet
, but of a larger typeType
. So your definition should look likethe constructor for products should look like
An alternative way to approach this is to use the polymorphic types in Coq, namely the types in
Prop
:Note the universes in Coq are a bit confusing. See What is different between Set and Type in Coq? for details.
I'm going to take this opportunity to advertise the new Proof Assistants stack exchange.