src/ZF/ex/LList.ML
changeset 1461 6bcb44e4d6e5
parent 782 200a16083201
child 2469 b50b8c0eec01
equal deleted inserted replaced
1460:5a6f2aabd538 1461:6bcb44e4d6e5
     1 (*  Title: 	ZF/ex/LList.ML
     1 (*  Title:      ZF/ex/LList.ML
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     4     Copyright   1994  University of Cambridge
     4     Copyright   1994  University of Cambridge
     5 
     5 
     6 Codatatype definition of Lazy Lists
     6 Codatatype definition of Lazy Lists
     7 *)
     7 *)
     8 
     8 
    31 qed "llist_mono";
    31 qed "llist_mono";
    32 
    32 
    33 (** Closure of quniv(A) under llist -- why so complex?  Its a gfp... **)
    33 (** Closure of quniv(A) under llist -- why so complex?  Its a gfp... **)
    34 
    34 
    35 val quniv_cs = subset_cs addSIs [QPair_Int_Vset_subset_UN RS subset_trans, 
    35 val quniv_cs = subset_cs addSIs [QPair_Int_Vset_subset_UN RS subset_trans, 
    36 				 QPair_subset_univ,
    36                                  QPair_subset_univ,
    37 				 empty_subsetI, one_in_quniv RS qunivD]
    37                                  empty_subsetI, one_in_quniv RS qunivD]
    38                  addIs  [Int_lower1 RS subset_trans]
    38                  addIs  [Int_lower1 RS subset_trans]
    39 		 addSDs [qunivD]
    39                  addSDs [qunivD]
    40                  addSEs [Ord_in_Ord];
    40                  addSEs [Ord_in_Ord];
    41 
    41 
    42 goal LList.thy
    42 goal LList.thy
    43    "!!i. Ord(i) ==> ALL l: llist(quniv(A)). l Int Vset(i) <= univ(eclose(A))";
    43    "!!i. Ord(i) ==> ALL l: llist(quniv(A)). l Int Vset(i) <= univ(eclose(A))";
    44 by (etac trans_induct 1);
    44 by (etac trans_induct 1);
    63 
    63 
    64 
    64 
    65 (*** Lazy List Equality: lleq ***)
    65 (*** Lazy List Equality: lleq ***)
    66 
    66 
    67 val lleq_cs = subset_cs
    67 val lleq_cs = subset_cs
    68 	addSIs [QPair_Int_Vset_subset_UN RS subset_trans, QPair_mono]
    68         addSIs [QPair_Int_Vset_subset_UN RS subset_trans, QPair_mono]
    69         addSEs [Ord_in_Ord, Pair_inject];
    69         addSEs [Ord_in_Ord, Pair_inject];
    70 
    70 
    71 (*Lemma for proving finality.  Unfold the lazy list; use induction hypothesis*)
    71 (*Lemma for proving finality.  Unfold the lazy list; use induction hypothesis*)
    72 goal LList.thy
    72 goal LList.thy
    73    "!!i. Ord(i) ==> ALL l l'. <l,l'> : lleq(A) --> l Int Vset(i) <= l'";
    73    "!!i. Ord(i) ==> ALL l l'. <l,l'> : lleq(A) --> l Int Vset(i) <= l'";
    78 by (safe_tac lleq_cs);
    78 by (safe_tac lleq_cs);
    79 by (fast_tac (subset_cs addSEs [Ord_trans, make_elim bspec]) 1);
    79 by (fast_tac (subset_cs addSEs [Ord_trans, make_elim bspec]) 1);
    80 qed "lleq_Int_Vset_subset_lemma";
    80 qed "lleq_Int_Vset_subset_lemma";
    81 
    81 
    82 bind_thm ("lleq_Int_Vset_subset",
    82 bind_thm ("lleq_Int_Vset_subset",
    83 	(lleq_Int_Vset_subset_lemma RS spec RS spec RS mp));
    83         (lleq_Int_Vset_subset_lemma RS spec RS spec RS mp));
    84 
    84 
    85 
    85 
    86 (*lleq(A) is a symmetric relation because qconverse(lleq(A)) is a fixedpoint*)
    86 (*lleq(A) is a symmetric relation because qconverse(lleq(A)) is a fixedpoint*)
    87 val [prem] = goal LList.thy "<l,l'> : lleq(A) ==> <l',l> : lleq(A)";
    87 val [prem] = goal LList.thy "<l,l'> : lleq(A) ==> <l',l> : lleq(A)";
    88 by (rtac (prem RS converseI RS lleq.coinduct) 1);
    88 by (rtac (prem RS converseI RS lleq.coinduct) 1);
   116 
   116 
   117 goalw LList.thy llist.con_defs "bnd_mono(univ(a), %l. LCons(a,l))";
   117 goalw LList.thy llist.con_defs "bnd_mono(univ(a), %l. LCons(a,l))";
   118 by (rtac bnd_monoI 1);
   118 by (rtac bnd_monoI 1);
   119 by (REPEAT (ares_tac [subset_refl, QInr_mono, QPair_mono] 2));
   119 by (REPEAT (ares_tac [subset_refl, QInr_mono, QPair_mono] 2));
   120 by (REPEAT (ares_tac [subset_refl, A_subset_univ, 
   120 by (REPEAT (ares_tac [subset_refl, A_subset_univ, 
   121 		      QInr_subset_univ, QPair_subset_univ] 1));
   121                       QInr_subset_univ, QPair_subset_univ] 1));
   122 qed "lconst_fun_bnd_mono";
   122 qed "lconst_fun_bnd_mono";
   123 
   123 
   124 (* lconst(a) = LCons(a,lconst(a)) *)
   124 (* lconst(a) = LCons(a,lconst(a)) *)
   125 bind_thm ("lconst",
   125 bind_thm ("lconst",
   126     ([lconst_def, lconst_fun_bnd_mono] MRS def_lfp_Tarski));
   126     ([lconst_def, lconst_fun_bnd_mono] MRS def_lfp_Tarski));