Coq 部分:需要类型类实例

Coq Section: require typeclass instance

Require Import Relations RelationClasses.

Section MySection.
  Variable A : Type.
  Variable R : relation A.
  (* ... *)
End MySection.

我如何要求 R 是部分订单?

Context语法,参见The Coq Reference manual,§20.4:

To ease the parametrization of developments by type classes, we provide a new way to introduce variables into section contexts, compatible with the implicit argument mechanism. The new command works similarly to the Variables vernacular (see 1.3.1), except it accepts any binding context as argument.

示例:

From Coq Require Import RelationClasses.

Generalizable Variable A eqA R.

Section MySection.
  Context `{PO : PartialOrder A eqA R}.
  (* ... *)
End MySection.