- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
关注 Arthur's suggestion ,我换了我的Fixpoint
相互的关系 Inductive
关系“建立”了游戏之间的不同比较,而不是“深入研究”。
但现在我收到一条全新的错误消息:
Error: Parameters should be syntactically the same for each inductive type.
forall
中的所有内容),但我不明白为什么我必须这样做。
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).
Left
和
Right
)轮流玩游戏,最后一步的玩家获胜。每场比赛(意思是一场比赛中的每个位置)都可以理解为一组
Left
的选项和一组
Right
的选项写为
{G_L | G_R}
.比较两款游戏时,他们可以通过以下四种不同方式中的任意一种进行比较:
<
,
>
,
=
, 或
||
.
A < B
如果
B
严格优于
A
为
Left
,无论谁先行。
A > B
如果
A
优于
B
为
Left
.
A = B
如果这两个游戏是等价的(从某种意义上说,游戏的总和
A + -B
是一个零游戏,所以先走的玩家输了)。而且,
A || B
如果哪个游戏更适合
Left
取决于谁先走。
A <= B
如果所有 A
的 Left
children 是<| B
和 A <|
全部B
是对的 child 。 A <| B
如果 A
有一个右 child 是 <= B
或者如果 A <=
任何 B
留下了 child 。 >=
也类似和 >|
. A
和
B
,可以判断是否
A < B
(
A<=B
和
A<|B
),
A=B
(
A<=B
和
A>=B
),
A > B
(
A>=B
和
A>|B
),或
A || B
(
A<|B
和
A>|B
)。
最佳答案
这个限制很有趣,我以前从未遇到过。我看不出为什么应该拒绝这段代码的任何理由。我敢打赌,当人们设计 Coq 的基础时,这个限制使一些证明变得更容易,而且由于没有多少人对此感到恼火,所以它一直保持这种状态。不过,我可能完全错了;我确实知道参数和参数(即箭头右侧的参数)在某些方面的处理方式略有不同。例如,与参数相比,定义归纳类型时施加的 Universe 约束对参数的限制较少。
也许这应该转发到 Coq 俱乐部邮件列表? :)
你不必把所有东西都放在箭头的右边来让它工作。你可以做的一件事就是把除了 compare_quest
之外的所有东西都放进去。右边的参数。当您使用在构造函数中定义的相同类型的归纳时,您提供的参数不必与您在标题中提供的参数相同,所以没关系:
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 (c : compare_quest) : combiner -> side -> side ->
game -> game -> Prop :=
| compBoth : forall cbn g1s g2s (g1 g2 : game),
cbn (listGameCompare c cbn (g1s g1) g2)
(gameListCompare c cbn g1 (g2s g2)) ->
innerGCompare c cbn g1s g2s g1 g2
with listGameCompare (c : compare_quest) : combiner -> gamelist -> game -> Prop :=
| emptylgCompare : forall cbn, cbn_init cbn -> forall g2 : game, listGameCompare c cbn emptylist g2
| otlgCompare : forall cbn (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) : combiner -> game -> gamelist -> Prop :=
| emptyglCompare : forall cbn, cbn_init cbn -> forall g1 : game, gameListCompare c cbn g1 emptylist
| otglCompare : forall cbn (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).
Error: Non strictly positive occurrence of "listGameCompare" in
"forall (cbn : Prop -> Prop -> Prop) (g1s g2s : game -> gamelist)
(g1 g2 : game),
cbn (listGameCompare c cbn (g1s g1) g2) (gameListCompare c cbn g1 (g2s g2)) ->
innerGCompare c cbn g1s g2s g1 g2".
cbn
因为这可能导致该类型位于箭头的左侧(否定出现),众所周知,这会导致逻辑不一致。
compareCombiner
在最后三种类型的构造函数中,这可能需要对代码进行一些重构。同样,我很确定必须有更好的方法来定义它,但我不明白你想做得很好,所以我的帮助在那里有些有限。
关于comparison - 为什么coq互感类型必须有相同的参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17308978/
我正在尝试理解 Coq 定理: Theorem thm0 : UseCl Pos (PredVP (UsePN john_PN) walk_V) -> UseCl Pos
编辑 Require Import Bool List ZArith. Variable A: Type. Inductive error := | Todo. Induc
我试图在 Coq 中证明以下引理: Lemma not_eq_S2: forall m n, S m <> S n -> m <> n. 这似乎很容易,但我不知道如何完成证明。有人可以帮帮我吗? 谢谢
我想查看我的证明中使用的所有公理。 获取此类信息的最简单方法是什么? 我将使用哪些命令、脚本或工具? 我对所有公理或所有使用过的公理感兴趣。 最佳答案 你应该使用 Print Assumptions
我想以某种方式限制在归纳定义中允许什么样的输入构造函数。说我想说定义二进制数如下: Inductive bin : Type := | O : bin | D : bin -> bin |
Coq 标准库中是否有对自然数进行欧几里德除法的函数?我一直无法找到一个。如果没有,那么从数学上讲,是否有理由不应该有一个? 我想要这个的原因是因为我试图将一个列表分成两个较小的列表。我希望一个列表的
我在将参数传递给 coq 中的产品类型时遇到问题。我有一个看起来像这样的定义, Definition bar (a:Type) := a->Type. 我需要定义一个函数,它接收“a”和“ba
这是本在线类(class)中出现的证明https://softwarefoundations.cis.upenn.edu/plf-current/StlcProp.html#lab222 . Proo
在命题和谓词演算中证明了数十个引理后(有些比其他的更具挑战性,但通常仍然可以在 intro-apply-destruct 自动驾驶仪上证明)我从 ~forall 开始打了一个并立即被捕获。显然,我缺乏
我正在学习命题逻辑和推理规则。析取三段论规则指出,如果我们的前提中有(P 或 Q),并且也有(非 P);然后我们可以到达Q。 我一生都无法弄清楚如何在 Coq 中做到这一点。假设我有: H : A \
从 Coq 引用手册 (8.5p1) 来看,我的印象是 revert是 intro 的倒数,但 generalize 也是如此在某种程度上。例如,revert和 generalize dependen
假设我知道某些自然数是好的。我知道 1 很好,如果 n 很好,那么 3n 就是,如果 n 很好,那么 n+5 就是,这些只是构造好数字的方法。在我看来,这在 Coq 中的充分形式化是 Inductiv
通常在 Coq 中,我发现自己在做以下事情:我有证明目标,例如: some_constructor a c d = some_constructor b c d 而我真的只需要证明a = b因为无论如
我希望能够为不同的归纳定义定义相同的 Coq 符号,并根据参数的类型区分这些符号。 这是一个最小的例子: Inductive type : Type := | TBool : type. Induct
有没有办法对 Coq 的类型类使用递归?例如,在为列表定义显示时,如果您想调用 show递归列表函数,那么你将不得不使用这样的固定点: Require Import Strings.String. R
假设我有一个解决某种引理的奇特策略: Ltac solveFancy := some_preparation; repeat (first [important_step1 | importa
我是 Coq 的新手。我注意到可以使用在 Coq 中定义空集 Inductive Empty_set : Set :=. 是否也可以将函数从空集定义为另一个通用集/类型? 如果是这样怎么办? 最佳答案
有人能给我一个 Coq 中存在实例化和存在泛化的简单例子吗?当我想证明exists x, P ,其中 P是一些 Prop使用 x ,我经常想命名x (如 x0 或类似的),并操纵 P。这可以是 Coq
我见过很多在功能上相互重叠的 Coq 策略。 例如,当您在假设中有确切的结论时,您可以使用 assumption , apply , exact , trivial ,也许还有其他人。其他示例包括 d
我需要使用标准库中称为 Coq.Arith.PeanoNat ( https://coq.inria.fr/library/Coq.Arith.PeanoNat.html ) 的部分。 我尝试过导入整
我是一名优秀的程序员,十分优秀!