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

时间:2019-05-21 14:30:51

标签: math coq formal-verification powerset

在尝试证明某些事情时,我遇到了一个无辜的声称,即我未能在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.

1 个答案:

答案 0 :(得分:0)

我没有完全解决它,因为我自己为此证明付出了很多努力。我只是按照您的思路进行了转移。现在问题的症结在于,证明一组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.