Coq中的笛卡尔积建模集

时间:2018-09-04 18:18:09

标签: coq

我正在尝试对元素的某些特定集合(Ensembles)进行建模 本身就是合奏。

所有“内部”合奏都是两套笛卡尔积 来自其他一些集合(W1和W2),我想证明 (a,b)和(c,d)在笛卡尔乘积中,然后(a,d)和(c,b) 产品中也有。

我使用的是Coq的Ensembles,它将集表示为谓词,但是在 在我的情况下,如果集合包含 相同的元素,并且这些术语在集合中或不在集合中 (在构造逻辑中并非所有此类集合都如此...)

我无法完成证明,因为我似乎丢失了一些 信息,感谢您的帮助。

首先是一些定义:

Require Import Ensembles.

Variables T1 T2:Type.
(* S1 and S2 are two "container" sets for the left and right elements,
   but I'm not doing the cartesian product of S1 and S2 but of
   some subsets of S1 and S2, (see W1 and W2 below) 
*)
Variables (S1: Ensemble T1) (S2:Ensemble T2).


Notation "a ∈ A" := (In _ A a) (at level 50).
Notation "a === b" := (Same_set _ a b) (at level 50).

Hypothesis S1dec: forall x, x ∈ S1 \/ ~ x ∈ S1.
Hypothesis S2dec: forall y, y ∈ S2 \/ ~ y ∈ S2.

Variables (W1 : Ensemble (Ensemble T1)).
Variables (W2 : Ensemble (Ensemble T2)).

Hypothesis W1_closed: forall A B, A === B -> A ∈ W1 -> B ∈ W1.
Hypothesis W2_closed: forall A B, A === B -> A ∈ W2 -> B ∈ W2.

Hypothesis W1_in_S1: forall w, w ∈ W1 -> Included _ w S1.
Hypothesis W2_in_S2: forall w, w ∈ W2 -> Included _ w S2.

(* extract the elements on the left or right "side" of the product set *)
Definition projL (w:Ensemble (T1*T2)) := fun x => exists y, (x,y) ∈ w.
Definition projR (w:Ensemble (T1*T2)) := fun y => exists x, (x,y) ∈ w.

笛卡尔乘积由集合W1W2的成员制成。

(* The definition of the product set. The members are those
sets whose both left and right projection are in W1 and W2 *)
Definition prodW1W2 : Ensemble (Ensemble (T1*T2)) :=
  fun (S:Ensemble (T1*T2)) =>
     projL S ∈ W1 /\ projR S ∈ W2.

了解...可能有用吗?

Lemma projL_closed: forall A B , A === B -> projL A === projL B.
Proof.  firstorder. Qed.
Lemma projR_closed: forall A B , A === B -> projR A === projR B.
Proof.  firstorder. Qed.

这是我想证明的定理:

Theorem all_pairs_are_in_the_product:
    forall WW, WW ∈ prodW1W2 ->
          forall x y, (x, y) ∈ WW ->
                 forall z w, (z, w) ∈ WW ->
                        (x, w) ∈ WW.
Proof.
  intros WW (H1 & H2 ) x y Hxy z w Hzw.

  assert (WW === (fun x => let (a,b) := x in a ∈ projL WW /\ b ∈ projR WW)).
  {
    split; intros [a b] Hx.
    - eexists; eauto; firstorder.
    - destruct Hx; firstorder.
      (* This is where I'm stuck *)
    admit.
  }

  enough ((x, w) ∈ (fun x : T1 * T2 => let (a, b) := x in a ∈ projL WW /\ b ∈ projR WW))
  as [Ha Hb] by firstorder.

  firstorder.
Admitted.

类型和集合如何组合在一起: How the types and set are intended to go together

0 个答案:

没有答案