src/ZF/ex/LList.thy
changeset 46822 95f1e700b712
parent 42798 02c88bdabe75
child 46935 38ecb2dc3636
equal deleted inserted replaced
46821:ff6b0c1087f2 46822:95f1e700b712
    28 
    28 
    29 (*Previously used <*> in the domain and variant pairs as elements.  But
    29 (*Previously used <*> in the domain and variant pairs as elements.  But
    30   standard pairs work just as well.  To use variant pairs, must change prefix
    30   standard pairs work just as well.  To use variant pairs, must change prefix
    31   a q/Q to the Sigma, Pair and converse rules.*)
    31   a q/Q to the Sigma, Pair and converse rules.*)
    32 coinductive
    32 coinductive
    33   domains "lleq(A)" <= "llist(A) * llist(A)"
    33   domains "lleq(A)" \<subseteq> "llist(A) * llist(A)"
    34   intros
    34   intros
    35     LNil:  "<LNil, LNil> \<in> lleq(A)"
    35     LNil:  "<LNil, LNil> \<in> lleq(A)"
    36     LCons: "[| a \<in> A; <l,l'> \<in> lleq(A) |] 
    36     LCons: "[| a \<in> A; <l,l'> \<in> lleq(A) |] 
    37             ==> <LCons(a,l), LCons(a,l')> \<in> lleq(A)"
    37             ==> <LCons(a,l), LCons(a,l')> \<in> lleq(A)"
    38   type_intros  llist.intros
    38   type_intros  llist.intros
    72 
    72 
    73 (*An elimination rule, for type-checking*)
    73 (*An elimination rule, for type-checking*)
    74 inductive_cases LConsE: "LCons(a,l) \<in> llist(A)"
    74 inductive_cases LConsE: "LCons(a,l) \<in> llist(A)"
    75 
    75 
    76 (*Proving freeness results*)
    76 (*Proving freeness results*)
    77 lemma LCons_iff: "LCons(a,l)=LCons(a',l') <-> a=a' & l=l'"
    77 lemma LCons_iff: "LCons(a,l)=LCons(a',l') \<longleftrightarrow> a=a' & l=l'"
    78 by auto
    78 by auto
    79 
    79 
    80 lemma LNil_LCons_iff: "~ LNil=LCons(a,l)"
    80 lemma LNil_LCons_iff: "~ LNil=LCons(a,l)"
    81 by auto
    81 by auto
    82 
    82 
   105         one_in_quniv [THEN qunivD, intro!]
   105         one_in_quniv [THEN qunivD, intro!]
   106 declare qunivD [dest!]
   106 declare qunivD [dest!]
   107 declare Ord_in_Ord [elim!]
   107 declare Ord_in_Ord [elim!]
   108 
   108 
   109 lemma llist_quniv_lemma [rule_format]:
   109 lemma llist_quniv_lemma [rule_format]:
   110      "Ord(i) ==> \<forall>l \<in> llist(quniv(A)). l Int Vset(i) \<subseteq> univ(eclose(A))"
   110      "Ord(i) ==> \<forall>l \<in> llist(quniv(A)). l \<inter> Vset(i) \<subseteq> univ(eclose(A))"
   111 apply (erule trans_induct)
   111 apply (erule trans_induct)
   112 apply (rule ballI)
   112 apply (rule ballI)
   113 apply (erule llist.cases)
   113 apply (erule llist.cases)
   114 apply (simp_all add: QInl_def QInr_def llist.con_defs)
   114 apply (simp_all add: QInl_def QInr_def llist.con_defs)
   115 (*LCons case: I simply can't get rid of the deepen_tac*)
   115 (*LCons case: I simply can't get rid of the deepen_tac*)
   133 
   133 
   134 declare Ord_in_Ord [elim!] 
   134 declare Ord_in_Ord [elim!] 
   135 
   135 
   136 (*Lemma for proving finality.  Unfold the lazy list; use induction hypothesis*)
   136 (*Lemma for proving finality.  Unfold the lazy list; use induction hypothesis*)
   137 lemma lleq_Int_Vset_subset [rule_format]:
   137 lemma lleq_Int_Vset_subset [rule_format]:
   138      "Ord(i) ==> \<forall>l l'. <l,l'> \<in> lleq(A) --> l Int Vset(i) \<subseteq> l'"
   138      "Ord(i) ==> \<forall>l l'. <l,l'> \<in> lleq(A) \<longrightarrow> l \<inter> Vset(i) \<subseteq> l'"
   139 apply (erule trans_induct)
   139 apply (erule trans_induct)
   140 apply (intro allI impI)
   140 apply (intro allI impI)
   141 apply (erule lleq.cases)
   141 apply (erule lleq.cases)
   142 apply (unfold QInr_def llist.con_defs, safe)
   142 apply (unfold QInr_def llist.con_defs, safe)
   143 apply (fast elim!: Ord_trans bspec [elim_format])
   143 apply (fast elim!: Ord_trans bspec [elim_format])
   198 
   198 
   199 declare flip_LNil [simp] 
   199 declare flip_LNil [simp] 
   200         flip_LCons [simp] 
   200         flip_LCons [simp] 
   201         not_type [simp]
   201         not_type [simp]
   202 
   202 
   203 lemma bool_Int_subset_univ: "b \<in> bool ==> b Int X \<subseteq> univ(eclose(A))"
   203 lemma bool_Int_subset_univ: "b \<in> bool ==> b \<inter> X \<subseteq> univ(eclose(A))"
   204 by (fast intro: Int_lower1 [THEN subset_trans] elim!: boolE)
   204 by (fast intro: Int_lower1 [THEN subset_trans] elim!: boolE)
   205 
   205 
   206 declare not_type [intro!]
   206 declare not_type [intro!]
   207 declare bool_Int_subset_univ [intro]
   207 declare bool_Int_subset_univ [intro]
   208 
   208 
   209 (*Reasoning borrowed from lleq.ML; a similar proof works for all
   209 (*Reasoning borrowed from lleq.ML; a similar proof works for all
   210   "productive" functions -- cf Coquand's "Infinite Objects in Type Theory".*)
   210   "productive" functions -- cf Coquand's "Infinite Objects in Type Theory".*)
   211 lemma flip_llist_quniv_lemma [rule_format]:
   211 lemma flip_llist_quniv_lemma [rule_format]:
   212      "Ord(i) ==> \<forall>l \<in> llist(bool). flip(l) Int Vset(i) \<subseteq> univ(eclose(bool))"
   212      "Ord(i) ==> \<forall>l \<in> llist(bool). flip(l) \<inter> Vset(i) \<subseteq> univ(eclose(bool))"
   213 apply (erule trans_induct)
   213 apply (erule trans_induct)
   214 apply (rule ballI)
   214 apply (rule ballI)
   215 apply (erule llist.cases, simp_all)
   215 apply (erule llist.cases, simp_all)
   216 apply (simp_all add: QInl_def QInr_def llist.con_defs)
   216 apply (simp_all add: QInl_def QInr_def llist.con_defs)
   217 (*LCons case: I simply can't get rid of the deepen_tac*)
   217 (*LCons case: I simply can't get rid of the deepen_tac*)