| 1 |
Module test1. |
| 2 |
Section test1. |
| 3 |
|
| 4 |
Variable (A B C A' B' C' : Type). |
| 5 |
Variable (f1 : A -> A') (f2 : B -> B') (f3 : C -> C'). |
| 6 |
Variable (g1 : A -> B) (g2 : A' -> B') (h1 : B -> C) (h2 : B' -> C'). |
| 7 |
|
| 8 |
Local Coercion g1 : A >-> B. |
| 9 |
Local Coercion g2 : A' >-> B'. |
| 10 |
Local Coercion h1 : B >-> C. |
| 11 |
Local Coercion h2 : B' >-> C'. |
| 12 |
Local Coercion f1 : A >-> A'. |
| 13 |
Local Coercion f2 : B >-> B'. |
| 14 |
Local Coercion f3 : C >-> C'. |
| 15 |
(* [g1; h1; f3], [f1; g2; h2] : A >-> C' should not be reported as ambiguous *) |
| 16 |
(* paths because they are redundant with `[g1; f2], [f1; g2] : A >-> B'` and *) |
| 17 |
(* `[h1; f3], [f2; h2] : B >-> C'`. *) |
| 18 |
|
| 19 |
Print Graph. |
| 20 |
|
| 21 |
End test1. |
| 22 |
End test1. |
| 23 |
|
| 24 |
Module test2. |
| 25 |
Section test2. |
| 26 |
|
| 27 |
Variable (A B C D : Type). |
| 28 |
Variable (ab : A -> B) (bc : B -> C) (ac : A -> C) (cd : C -> D). |
| 29 |
|
| 30 |
Local Coercion ac : A >-> C. |
| 31 |
Local Coercion cd : C >-> D. |
| 32 |
Local Coercion ab : A >-> B. |
| 33 |
Local Coercion bc : B >-> C. |
| 34 |
(* `[ab; bc; cd], [ac; cd] : A >-> D` should not be reported as ambiguous *) |
| 35 |
(* paths because they are redundant with `[ab; bc], [ac] : A >-> C`. *) |
| 36 |
|
| 37 |
Print Graph. |
| 38 |
|
| 39 |
End test2. |
| 40 |
End test2. |
| 41 |
|
| 42 |
Module test3. |
| 43 |
Section test3. |
| 44 |
|
| 45 |
Variable (A B C : Type). |
| 46 |
Variable (ab : A -> B) (ba : B -> A) (ac : A -> C) (bc : B -> C). |
| 47 |
|
| 48 |
Local Coercion ac : A >-> C. |
| 49 |
Local Coercion bc : B >-> C. |
| 50 |
Local Coercion ab : A >-> B. |
| 51 |
Local Coercion ba : B >-> A. |
| 52 |
(* `[ba; ac], [bc] : B >-> C` should not be reported as ambiguous paths *) |
| 53 |
(* because they are redundant with `[ab; bc], [ac] : A >-> C` and *) |
| 54 |
(* `[ba; ab] : B >-> B`. *) |
| 55 |
|
| 56 |
Print Graph. |
| 57 |
|
| 58 |
End test3. |
| 59 |
End test3. |
| 60 |
|
| 61 |
Module test4. |
| 62 |
Section test4. |
| 63 |
Variable (A : Type) (P Q : A -> Prop). |
| 64 |
|
| 65 |
Record B := { |
| 66 |
B_A : A; |
| 67 |
B_P : P B_A }. |
| 68 |
|
| 69 |
Record C := { |
| 70 |
C_A : A; |
| 71 |
C_Q : Q C_A }. |
| 72 |
|
| 73 |
Record D := { |
| 74 |
D_A : A; |
| 75 |
D_P : P D_A; |
| 76 |
D_Q : Q D_A }. |
| 77 |
|
| 78 |
Local Coercion B_A : B >-> A. |
| 79 |
Local Coercion C_A : C >-> A. |
| 80 |
Local Coercion D_A : D >-> A. |
| 81 |
Local Coercion D_B (d : D) : B := Build_B (D_A d) (D_P d). |
| 82 |
Local Coercion D_C (d : D) : C := Build_C (D_A d) (D_Q d). |
| 83 |
|
| 84 |
Print Graph. |
| 85 |
|
| 86 |
End test4. |
| 87 |
End test4. |
| 88 |
|
| 89 |
Module test5. |
| 90 |
Section test5. |
| 91 |
|
| 92 |
Variable (A : Type) (P Q : A -> Prop). |
| 93 |
|
| 94 |
Definition A' (x : bool) := A. |
| 95 |
|
| 96 |
Record B (x : bool) := { |
| 97 |
B_A' : A' x; |
| 98 |
B_P : P B_A' }. |
| 99 |
|
| 100 |
Record C (x : bool) := { |
| 101 |
C_A' : A' x; |
| 102 |
C_Q : Q C_A' }. |
| 103 |
|
| 104 |
Record D := { |
| 105 |
D_A : A; |
| 106 |
D_P : P D_A; |
| 107 |
D_Q : Q D_A }. |
| 108 |
|
| 109 |
Local Coercion A'_A (x : bool) (a : A' x) : A := a. |
| 110 |
Local Coercion B_A' : B >-> A'. |
| 111 |
Local Coercion C_A' : C >-> A'. |
| 112 |
Local Coercion D_A : D >-> A. |
| 113 |
Local Coercion D_B (d : D) : B false := Build_B false (D_A d) (D_P d). |
| 114 |
Local Coercion D_C (d : D) : C true := Build_C true (D_A d) (D_Q d). |
| 115 |
|
| 116 |
Print Graph. |
| 117 |
|
| 118 |
End test5. |
| 119 |
End test5. |
| 120 |
|
| 121 |
Module test6. |
| 122 |
Section test6. |
| 123 |
|
| 124 |
Variable (A : Type) (P Q : A -> Prop). |
| 125 |
|
| 126 |
Record A' (x : bool) := { A'_A : A }. |
| 127 |
|
| 128 |
Record B (x : bool) := { |
| 129 |
B_A' : A' x; |
| 130 |
B_P : P (A'_A x B_A') }. |
| 131 |
|
| 132 |
Record C (x : bool) := { |
| 133 |
C_A' : A' x; |
| 134 |
C_Q : Q (A'_A x C_A') }. |
| 135 |
|
| 136 |
Record D := { |
| 137 |
D_A : A; |
| 138 |
D_P : P D_A; |
| 139 |
D_Q : Q D_A }. |
| 140 |
|
| 141 |
Local Coercion A'_A : A' >-> A. |
| 142 |
Local Coercion B_A' : B >-> A'. |
| 143 |
Local Coercion C_A' : C >-> A'. |
| 144 |
Local Coercion D_A : D >-> A. |
| 145 |
Local Coercion D_B (d : D) : B false := |
| 146 |
Build_B false (Build_A' false (D_A d)) (D_P d). |
| 147 |
Local Coercion D_C (d : D) : C true := |
| 148 |
Build_C true (Build_A' true (D_A d)) (D_Q d). |
| 149 |
|
| 150 |
Print Graph. |
| 151 |
|
| 152 |
End test6. |
| 153 |
End test6. |
| 154 |
|
| 155 |
Module test7. |
| 156 |
Record > NAT := wrap_nat { unwrap_nat :> nat }. |
| 157 |
Record > LIST (T : Type) := wrap_list { unwrap_list :> list T }. |
| 158 |
Record > TYPE := wrap_Type { unwrap_Type :> Type }. |
| 159 |
End test7. |
| 160 |
|
| 161 |
Module test8. |
| 162 |
Set Primitive Projections. |
| 163 |
Record > NAT_prim := wrap_nat { unwrap_nat :> nat }. |
| 164 |
Record > LIST_prim (T : Type) := wrap_list { unwrap_list :> list T }. |
| 165 |
Record > TYPE_prim := wrap_Type { unwrap_Type :> Type }. |
| 166 |
End test8. |