Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Coq中引入n个不同的符号_Coq - Fatal编程技术网

如何在Coq中引入n个不同的符号

如何在Coq中引入n个不同的符号,coq,Coq,我为这个团体创造了一项记录。现在我想通过指定组乘法表来构建一个包含n个元素的组,例如10个元素 我的问题是,我需要n个符号作为我的团队的基础。我需要Coq知道这n个元素都是不同的 到目前为止我已经猜到了 Inductive ground_set : Type := A : ground_set | B : ground_set. Axiom diff: A<>B. 这对n=2有效。我不知道如何在不创建丑陋代码的情况下将其扩展到许多元素 我想有更好的方法生成这样的集合,但我找不到任

我为这个团体创造了一项记录。现在我想通过指定组乘法表来构建一个包含n个元素的组,例如10个元素

我的问题是,我需要n个符号作为我的团队的基础。我需要Coq知道这n个元素都是不同的

到目前为止我已经猜到了

Inductive ground_set : Type :=  A : ground_set | B : ground_set.
Axiom diff: A<>B.
这对n=2有效。我不知道如何在不创建丑陋代码的情况下将其扩展到许多元素

我想有更好的方法生成这样的集合,但我找不到任何方法。

对于归纳定义,您可以免费获得构造函数之间的不等式:

Inductive ground_set : Type :=  A : ground_set | B : ground_set.

Lemma diff: A <> B.
Proof.
  discriminate.
Qed.
对于归纳定义,可以免费获得构造函数之间的不等式:

Inductive ground_set : Type :=  A : ground_set | B : ground_set.

Lemma diff: A <> B.
Proof.
  discriminate.
Qed.

胡猜,但可能是这样的:

Inductive ground_set (limit: nat): Set :=
  | Elem : forall n, n < limit -> ground_set limit.

Lemma ground_set_discr (limit:nat): forall n p (hn: n < limit) (hp: p < limit),
  n <> p -> Elem _ n hn <> Elem _ p hp.
Proof.
intros n p hn hp hdiff h.
inversion h; subst; clear h.
now apply hdiff.
Qed.

胡猜,但可能是这样的:

Inductive ground_set (limit: nat): Set :=
  | Elem : forall n, n < limit -> ground_set limit.

Lemma ground_set_discr (limit:nat): forall n p (hn: n < limit) (hp: p < limit),
  n <> p -> Elem _ n hn <> Elem _ p hp.
Proof.
intros n p hn hp hdiff h.
inversion h; subst; clear h.
now apply hdiff.
Qed.

事实上,最好的方法是使用Vinz概述的方法。使用一些库会有所帮助,例如,在mathcomp中,它专门用于对有限群进行推理,您只需编写“I_n”就可以创建一个具有n个不同元素的类型,并且您将免费获得许多属性,例如有限性。

实际上,最好的方法是使用Vinz概述的方法。使用一些库会有所帮助,例如,在mathcomp中,它专门用于对有限群进行推理,您可以通过编写“I\u n”创建一个具有n个不同元素的类型,您将免费获得许多属性,例如有限性。

好的,这适用于区分部分。生成一个比2大得多的整数大小的地面集怎么样?好的,这适用于区分部分。生成一个比2大得多的整数大小的地面集如何?您可能需要一些证明无关性,这在nat命题中始终是正确的,以便对此类依赖类型进行推理。一种非常类似的方法是使用标准库中定义的Fin.t类型:Fin n是表示\1的方便方法。。n\.我同意,使用Fin type或mathcomp'I\n将是最好的选择,因为所有的支持都已经在这里了。我不确定这个问题,所以我尝试了天真的方法;您可能需要一些在nat命题上始终为真的证明无关性,以便对此类依赖类型进行推理。一种非常类似的方法是使用标准库中定义的Fin.t类型:Fin n是表示\1的方便方法。。n\.我同意,使用Fin type或mathcomp'I\n将是最好的选择,因为所有的支持都已经在这里了。我不确定这个问题,所以我尝试了天真的方法;