| 1 |
Set Warnings "-uniform-inheritance". |
| 2 |
Set Printing All. |
| 3 |
|
| 4 |
Module TC. |
| 5 |
|
| 6 |
Class foo (A : Type) := { a : A }. |
| 7 |
#[local] Hint Mode foo + : typeclass_instances. |
| 8 |
|
| 9 |
#[local] Instance bool_foo : foo bool := {| a := true |}. |
| 10 |
#[local] Instance nat_foo : foo nat := {| a := 1 |}. |
| 11 |
#[local] Instance pair_foo A B : foo A -> foo B -> foo (A * B) := fun x y => {| a := (a,a) |}. |
| 12 |
|
| 13 |
Axiom T1 : Type -> Type. |
| 14 |
Axiom T2 : Type -> Type. |
| 15 |
Axiom x : T1 nat. |
| 16 |
|
| 17 |
Module T1. |
| 18 |
Axiom f : forall A, foo (A * bool) -> T1 A -> T2 nat. |
| 19 |
Coercion f : T1 >-> T2. |
| 20 |
Check (x : T2 _). |
| 21 |
End T1. |
| 22 |
|
| 23 |
Module T2. |
| 24 |
Axiom f : forall A, foo A -> T1 nat -> T2 A. |
| 25 |
Coercion f : T1 >-> T2. |
| 26 |
Check (x : T2 _). |
| 27 |
Check (x : T2 bool). |
| 28 |
End T2. |
| 29 |
|
| 30 |
End TC. |