gpt4 book ai didi

typeclass - Coq 部分 : require typeclass instance

转载 作者:行者123 更新时间:2023-12-01 13:32:59 26 4
gpt4 key购买 nike

Require Import Relations RelationClasses.

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

我如何要求 R 是偏序?

最佳答案

Context 语法,参见 Coq 引用手册,§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.

关于typeclass - Coq 部分 : require typeclass instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44768630/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com