14 lines
381 B
Coq
14 lines
381 B
Coq
(* http://poleiro.info/posts/2019-08-06-contravariance-and-recursion.html *)
|
|
|
|
Inductive type : Type :=
|
|
| Top: type
|
|
| Int: type
|
|
| Arrow: type -> type -> type.
|
|
|
|
Inductive subtype : type -> type -> Type :=
|
|
| STTop: forall t:type, subtype t Top
|
|
| STInt: subtype Int Int
|
|
| STArrow: forall t1 t2 s1 s2:type,
|
|
subtype s1 t1 -> subtype s2 t2 ->
|
|
subtype (Arrow t1 s2) (Arrow s1 t2).
|