gpt4 book ai didi

math - 使用 Coq 证明有限集的幂集是有限的

转载 作者:行者123 更新时间:2023-12-03 17:30:02 25 4
gpt4 key购买 nike

在尝试证明某些事情时,我遇到了一个看似无辜的声明,但我未能在 Coq 中证明。声称对于给定的有限集成,幂集也是有限的。该语句在下面的 Coq 代码中给出。

我查看了关于有限集的 Coq 文档以及关于有限集和幂集的事实,但我找不到将幂集解构为子集并集的东西(这样可以使用 Union_is_finite 构造函数)。另一种方法可能是证明幂集的基数是 2^|S|但在这里我当然不知道如何进行证明。

From Coq Require Export Sets.Ensembles.
From Coq Require Export Sets.Powerset.
From Coq Require Export Sets.Finite_sets.

Lemma powerset_finite {T} (S : Ensemble T) :
Finite T S -> Finite (Ensemble T) (Power_set T S).
Proof.
(* I don't know how to proceed. *)
Admitted.

最佳答案

我没有完全解决它,因为我自己在这个证明上挣扎了很多。我只是顺着你的思路转过来的。现在问题的关键是,证明一组 n 个元素的幂集的基数是 2^n。

From Coq Require Export Sets.Ensembles.
From Coq Require Export Sets.Powerset.
From Coq Require Export Sets.Finite_sets.
From Coq Require Export Sets.Finite_sets_facts.

Fixpoint exp (n m : nat) : nat :=
match m with
| 0 => 1
| S m' => n * (exp n m')
end.

Theorem power_set_empty :
forall (U : Type), Power_set _ (Empty_set U) = Singleton _ (Empty_set _).
Proof with auto with sets.
intros U.
apply Extensionality_Ensembles.
unfold Same_set. split.
+ unfold Included. intros x Hin.
inversion Hin; subst.
apply Singleton_intro.
symmetry. apply less_than_empty; auto.

+ unfold Included. intros x Hin.
constructor. inversion Hin; subst.
unfold Included; intros; assumption.
Qed.

Lemma cardinality_power_set :
forall (U : Type) (A : Ensemble U) (n : nat),
cardinal U A n -> cardinal _ (Power_set _ A) (exp 2 n).
Proof.
intros U A n. revert A.
induction n; cbn; intros He Hc.
+ inversion Hc; subst. rewrite power_set_empty.
Search Singleton.
rewrite <- Empty_set_zero'.
constructor; repeat auto with sets.
+ inversion Hc; subst; clear Hc.
Admitted.



Lemma powerset_finite {T} (S : Ensemble T) :
Finite T S -> Finite (Ensemble T) (Power_set T S).
Proof.
intros Hf.
destruct (finite_cardinal _ S Hf) as [n Hc].
eapply cardinal_finite with (n := exp 2 n).
apply cardinality_power_set; auto.
Qed.

关于math - 使用 Coq 证明有限集的幂集是有限的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56240564/

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