下列的亚瑟的建议 https://stackoverflow.com/a/17304209/403875,我改变了我的Fixpoint
相互关系Inductive
这种关系“建立”游戏之间的不同比较,而不是“深入研究”。
但现在我收到一条全新的错误消息:
Error: Parameters should be syntactically the same for each inductive type.
我认为错误消息表明我需要为所有这些互感定义提供相同的精确参数。
我意识到有一些简单的技巧可以解决这个问题(未使用的虚拟变量、包含所有内容的长函数类型)forall
),但我不明白为什么我必须这么做。
有人可以解释这种对互感类型的限制背后的逻辑吗?有没有更优雅的方式来写这个?此限制是否还意味着彼此之间的归纳调用必须全部使用相同的参数(在这种情况下,我不知道有任何黑客可以节省大量的代码重复)?
(所有类型和术语的定义,例如compare_quest、game、g1side等,与我的定义相同第一个问题 https://stackoverflow.com/q/17297165/403875.
Inductive gameCompare (c : compare_quest) : game -> game -> Prop :=
| igc : forall g1 g2 : game,
innerGCompare (nextCompare c) (compareCombiner c) (g1side c) (g2side c) g1 g2 ->
gameCompare c g1 g2
with innerGCompare (next_c : compare_quest) (cbn : combiner) (g1s g2s : side)
: game -> game -> Prop :=
| compBoth : forall g1 g2 : game,
cbn (listGameCompare next_c cbn (g1s g1) g2)
(gameListCompare next_c cbn g1 (g2s g2)) ->
innerGCompare next_c cbn g1s g2s g1 g2
with listGameCompare (c : compare_quest) (cbn : combiner) : gamelist -> game -> Prop :=
| emptylgCompare : cbn_init cbn -> forall g2 : game, listGameCompare c cbn emptylist g2
| otlgCompare : forall (g1_cdr : gamelist) (g1_car g2 : game),
(cbn (listGameCompare c cbn g1_cdr g2) (gameCompare c g1_car g2)) ->
listGameCompare c cbn (listCons g1_car g1_cdr) g2
with gameListCompare (c : compare_quest) (cbn : combiner) : game -> gamelist -> Prop :=
| emptyglCompare : cbn_init cbn -> forall g1 : game, gameListCompare c cbn g1 emptylist
| otglCompare : forall (g1 g2_car : game) (g2_cdr : gamelist),
(cbn (gameListCompare c cbn g1 g2_cdr) (gameCompare c g1 g2_car)) ->
gameListCompare c cbn g1 (listCons g2_car g2_cdr).
在 CGT 中,通常有两名玩家(名为Left
and Right
)轮流玩游戏,最后一步的玩家获胜。每个游戏(意味着游戏中的每个位置)都可以被解读为一组Left
的选项和一组Right
的选项写为{G_L | G_R}
。在比较两个游戏时,他们可以通过四种不同方式中的任何一种进行比较:<
, >
, =
, or ||
.
一个游戏是A < B
if B
严格优于A
for Left
,无论谁先走。A > B
if A
比B
for Left
. A = B
如果两个游戏是等价的(从某种意义上说,游戏的总和A + -B
是零游戏,所以先走的玩家就输了)。和,A || B
如果哪个游戏更适合Left
取决于谁先走。
检查两个游戏之间的比较的一种方法如下:
那么,然后看看哪一对这些关系适用于两个游戏A
and B
,可以判断是否A < B
(A<=B
and A<|B
), A=B
(A<=B
and A>=B
), A > B
(A>=B
and A>|B
), or A || B
(A<|B
and A>|B
).
这是关于 CGT 的维基文章 http://en.wikipedia.org/wiki/Combinatorial_game_theory.