Coq 使用List.filter的列表交集

Coq 使用List.filter的列表交集,coq,Coq,根据我的问题,我正在证明如果两个列表的交集不是空的,那么通过向每个列表添加另一个列表,交集仍然不是空的。我想知道如何证明引理filterKeepIntersection。我试图通过seq库中的filter\u cat策略来解决这个问题,但似乎还不足以证明这个引理 Require Import List Nat. Inductive customType : Type := |Const1: nat -> customType |Const2: list nat ->

根据我的问题,我正在证明如果两个列表的交集不是空的,那么通过向每个列表添加另一个列表,交集仍然不是空的。我想知道如何证明引理
filterKeepIntersection
。我试图通过
seq
库中的
filter\u cat
策略来解决这个问题,但似乎还不足以证明这个引理

 Require Import  List Nat.
 Inductive customType : Type :=
  |Const1:  nat -> customType
  |Const2: list nat -> customType.

Inductive mydata : Set :=
   |Set1: customType * customType ->mydata
   |Set2: customType ->mydata.

   Fixpoint custome_Equal (c1 c2:customType) :bool:=
        match c1 with
            |Const1 nt => match c2 with 
                       |Const1 mt =>  eqb nt  mt
                       |Const2 (hm::lmt) => eqb nt hm
                      | _ => false
                                     end
           |Const2 (hn::lnt) => match c2 with                                                                            
                           |Const1 mt => eqb  hn  mt
                           |Const2 (hm:: lmt) => eqb hn  hm
                           | _ => false
                                     end
           | _ => false
          end.

 Fixpoint Search (l: mydata) (t:customType):  bool :=
    match l with
       |Set1 (a1, a2) =>  if (custome_Equal a2 t)  then  true else false
       | _=>false
    end.

Fixpoint search2 (c1 c2:mydata) :bool:=
         match c1,c2  with
       |Set1 (a1, a2) ,Set1(a3,a4)=>  if (custome_Equal a2 a4)  then  true else false
       | _,_=>false
    end.


Lemma filterKeepIntersection(l1 l2 l3 l4: list mydata):
(List.filter (fun n => List.existsb (search2 n) l2) l1) <> nil->
(List.filter (fun n => List.existsb (search2 n) (l3++l2)) (l4++l1))<>nil.
Proof.
需要导入列表Nat。
类型:类型:=
|Const1:nat->customType
|常量2:列出nat->customType。
归纳mydata:设置:=
|Set1:customType*customType->mydata
|Set2:customType->mydata。
固定点custome_Equal(c1 c2:customType):布尔:=
将c1与
|Const1 nt=>将c2与
|常数1 mt=>eqb nt mt
|常数2(hm::lmt)=>eqb nt hm
|_uz=>错误
终止
|常数2(hn::lnt)=>将c2与
|常数1 mt=>eqb hn mt
|常数2(hm::lmt)=>eqb-hn-hm
|_uz=>错误
终止
|_uz=>错误
终止
定点搜索(l:mydata)(t:customType):布尔:=
匹配
|Set1(a1,a2)=>if(custome_等于a2 t)则为true,否则为false
|_uz=>错误
终止
固定点搜索2(c1 c2:mydata):布尔:=
将c1、c2与
|Set1(a1,a2),Set1(a3,a4)=>if(custome_等于a2 a4),则true,否则false
|_u,=>false
终止
引理过滤器KeepInTersection(l1 l2 l3 l4:列表mydata):
(List.filter(fun=>List.existsb(search2n)l2)l1)nil->
(List.filter(fun=>List.existsb(search2n)(l3++l2))(l4++l1))无。
证据

根据
predI
对内部谓词稍加修改,再加上使用
filter\u predI
确实可以立即进行证明,但可以直接使用
mem\u filter