I believe there is no way of convincing Coq that this is OK. However, you achieve a similar effect by using other features, such as canonical structures or type classes. This is how one could translate your example with type classes, for instance:
Class R1 T :=
{
op1 : T -> T
}.
Class R2 T :=
{
op2 : T -> T
}.
Class R12 T `{R1 T} `{R2 T} :=
{}.
Section S.
Context T `{R12 T}.
Variable x : T.
Hypothesis id1 : op1 x = x.
Hypothesis id2 : op2 x = x.
End S.
Notice that class R12
doesn't have any methods of its own, but requires type T
to be an instance both of R1
and R2
, which results morally in the same thing. The Context
declaration forces Coq to assume instances for R1
and R2
automatically, in virtue of those requirements.
Edit:
If you try to add an R0
class to complete the diagram, you may get a weird error resulting from a failing type-class inference. One solution is to turn off the automatic generalization in R12
(i.e., remove the back quotes), and force R1
and R2
to be based on the same R0
instance:
Class R0 (T : Type) := {}.
Class R1 T `{R0 T} :=
{
op1 : T -> T
}.
Class R2 T `{R0 T} :=
{
op2 : T -> T
}.
Class R12 T `{R0 T} {r1:R1 T} {r2:R2 T} :=
{}.
Section S.
Context T `{R12 T}.
Variable x : T.
Hypothesis id1 : op1 x = x.
Hypothesis id2 : op2 x = x.
End S.
Unfortunately, I don't really have a good explanation to why an error could occur there, as type class inference is somewhat complex. However, I think it is not related to the problem you had had first, because there aren't actually ambiguous paths like before.