src/HOL/Induct/LList.ML
changeset 5069 3ea049f7979d
parent 4831 dae4d63a1318
child 5086 ef479934678b
     1.1 --- a/src/HOL/Induct/LList.ML	Mon Jun 22 17:13:09 1998 +0200
     1.2 +++ b/src/HOL/Induct/LList.ML	Mon Jun 22 17:26:46 1998 +0200
     1.3 @@ -14,13 +14,13 @@
     1.4  
     1.5  
     1.6  (*This justifies using llist in other recursive type definitions*)
     1.7 -goalw LList.thy llist.defs "!!A B. A<=B ==> llist(A) <= llist(B)";
     1.8 +Goalw llist.defs "!!A B. A<=B ==> llist(A) <= llist(B)";
     1.9  by (rtac gfp_mono 1);
    1.10  by (REPEAT (ares_tac basic_monos 1));
    1.11  qed "llist_mono";
    1.12  
    1.13  
    1.14 -goal LList.thy "llist(A) = {Numb(0)} <+> (A <*> llist(A))";
    1.15 +Goal "llist(A) = {Numb(0)} <+> (A <*> llist(A))";
    1.16  let val rew = rewrite_rule [NIL_def, CONS_def] in  
    1.17  by (fast_tac (claset() addSIs (map rew llist.intrs)
    1.18                        addEs [rew llist.elim]) 1)
    1.19 @@ -32,19 +32,19 @@
    1.20       THE COINDUCTIVE DEFINITION PACKAGE COULD DO THIS!
    1.21  ***)
    1.22  
    1.23 -goalw LList.thy [list_Fun_def]
    1.24 +Goalw [list_Fun_def]
    1.25      "!!M. [| M : X;  X <= list_Fun A (X Un llist(A)) |] ==>  M : llist(A)";
    1.26  by (etac llist.coinduct 1);
    1.27  by (etac (subsetD RS CollectD) 1);
    1.28  by (assume_tac 1);
    1.29  qed "llist_coinduct";
    1.30  
    1.31 -goalw LList.thy [list_Fun_def, NIL_def] "NIL: list_Fun A X";
    1.32 +Goalw [list_Fun_def, NIL_def] "NIL: list_Fun A X";
    1.33  by (Fast_tac 1);
    1.34  qed "list_Fun_NIL_I";
    1.35  AddIffs [list_Fun_NIL_I];
    1.36  
    1.37 -goalw LList.thy [list_Fun_def,CONS_def]
    1.38 +Goalw [list_Fun_def,CONS_def]
    1.39      "!!M N. [| M: A;  N: X |] ==> CONS M N : list_Fun A X";
    1.40  by (Fast_tac 1);
    1.41  qed "list_Fun_CONS_I";
    1.42 @@ -52,7 +52,7 @@
    1.43  AddSIs   [list_Fun_CONS_I];
    1.44  
    1.45  (*Utilise the "strong" part, i.e. gfp(f)*)
    1.46 -goalw LList.thy (llist.defs @ [list_Fun_def])
    1.47 +Goalw (llist.defs @ [list_Fun_def])
    1.48      "!!M N. M: llist(A) ==> M : list_Fun A (X Un llist(A))";
    1.49  by (etac (llist.mono RS gfp_fun_UnI2) 1);
    1.50  qed "list_Fun_llist_I";
    1.51 @@ -60,7 +60,7 @@
    1.52  (*** LList_corec satisfies the desired recurion equation ***)
    1.53  
    1.54  (*A continuity result?*)
    1.55 -goalw LList.thy [CONS_def] "CONS M (UN x. f(x)) = (UN x. CONS M (f x))";
    1.56 +Goalw [CONS_def] "CONS M (UN x. f(x)) = (UN x. CONS M (f x))";
    1.57  by (simp_tac (simpset() addsimps [In1_UN1, Scons_UN1_y]) 1);
    1.58  qed "CONS_UN1";
    1.59  
    1.60 @@ -84,7 +84,7 @@
    1.61  
    1.62  (** The directions of the equality are proved separately **)
    1.63  
    1.64 -goalw LList.thy [LList_corec_def]
    1.65 +Goalw [LList_corec_def]
    1.66      "LList_corec a f <= sum_case (%u. NIL) \
    1.67  \                          (split(%z w. CONS z (LList_corec w f))) (f a)";
    1.68  by (rtac UN_least 1);
    1.69 @@ -94,7 +94,7 @@
    1.70  			 UNIV_I RS UN_upper] 1));
    1.71  qed "LList_corec_subset1";
    1.72  
    1.73 -goalw LList.thy [LList_corec_def]
    1.74 +Goalw [LList_corec_def]
    1.75      "sum_case (%u. NIL) (split(%z w. CONS z (LList_corec w f))) (f a) <= \
    1.76  \    LList_corec a f";
    1.77  by (simp_tac (simpset() addsimps [CONS_UN1]) 1);
    1.78 @@ -104,7 +104,7 @@
    1.79  qed "LList_corec_subset2";
    1.80  
    1.81  (*the recursion equation for LList_corec -- NOT SUITABLE FOR REWRITING!*)
    1.82 -goal LList.thy
    1.83 +Goal
    1.84      "LList_corec a f = sum_case (%u. NIL) \
    1.85  \                           (split(%z w. CONS z (LList_corec w f))) (f a)";
    1.86  by (REPEAT (resolve_tac [equalityI, LList_corec_subset1, 
    1.87 @@ -121,7 +121,7 @@
    1.88  
    1.89  (*A typical use of co-induction to show membership in the gfp. 
    1.90    Bisimulation is  range(%x. LList_corec x f) *)
    1.91 -goal LList.thy "LList_corec a f : llist({u. True})";
    1.92 +Goal "LList_corec a f : llist({u. True})";
    1.93  by (res_inst_tac [("X", "range(%x. LList_corec x ?g)")] llist_coinduct 1);
    1.94  by (rtac rangeI 1);
    1.95  by Safe_tac;
    1.96 @@ -130,7 +130,7 @@
    1.97  qed "LList_corec_type";
    1.98  
    1.99  (*Lemma for the proof of llist_corec*)
   1.100 -goal LList.thy
   1.101 +Goal
   1.102     "LList_corec a (%z. sum_case Inl (split(%v w. Inr((Leaf(v),w)))) (f z)) : \
   1.103  \   llist(range Leaf)";
   1.104  by (res_inst_tac [("X", "range(%x. LList_corec x ?g)")] llist_coinduct 1);
   1.105 @@ -144,14 +144,14 @@
   1.106  (**** llist equality as a gfp; the bisimulation principle ****)
   1.107  
   1.108  (*This theorem is actually used, unlike the many similar ones in ZF*)
   1.109 -goal LList.thy "LListD(r) = diag({Numb(0)}) <++> (r <**> LListD(r))";
   1.110 +Goal "LListD(r) = diag({Numb(0)}) <++> (r <**> LListD(r))";
   1.111  let val rew = rewrite_rule [NIL_def, CONS_def] in  
   1.112  by (fast_tac (claset() addSIs (map rew LListD.intrs)
   1.113                        addEs [rew LListD.elim]) 1)
   1.114  end;
   1.115  qed "LListD_unfold";
   1.116  
   1.117 -goal LList.thy "!M N. (M,N) : LListD(diag(A)) --> ntrunc k M = ntrunc k N";
   1.118 +Goal "!M N. (M,N) : LListD(diag(A)) --> ntrunc k M = ntrunc k N";
   1.119  by (res_inst_tac [("n", "k")] less_induct 1);
   1.120  by (safe_tac ((claset_of Fun.thy) delrules [equalityI]));
   1.121  by (etac LListD.elim 1);
   1.122 @@ -165,7 +165,7 @@
   1.123  qed "LListD_implies_ntrunc_equality";
   1.124  
   1.125  (*The domain of the LListD relation*)
   1.126 -goalw LList.thy (llist.defs @ [NIL_def, CONS_def])
   1.127 +Goalw (llist.defs @ [NIL_def, CONS_def])
   1.128      "fst``LListD(diag(A)) <= llist(A)";
   1.129  by (rtac gfp_upperbound 1);
   1.130  (*avoids unfolding LListD on the rhs*)
   1.131 @@ -175,7 +175,7 @@
   1.132  qed "fst_image_LListD";
   1.133  
   1.134  (*This inclusion justifies the use of coinduction to show M=N*)
   1.135 -goal LList.thy "LListD(diag(A)) <= diag(llist(A))";
   1.136 +Goal "LListD(diag(A)) <= diag(llist(A))";
   1.137  by (rtac subsetI 1);
   1.138  by (res_inst_tac [("p","x")] PairE 1);
   1.139  by Safe_tac;
   1.140 @@ -191,35 +191,35 @@
   1.141      THE COINDUCTIVE DEFINITION PACKAGE COULD DO THIS!
   1.142   **)
   1.143  
   1.144 -goalw thy [LListD_Fun_def] "!!A B. A<=B ==> LListD_Fun r A <= LListD_Fun r B";
   1.145 +Goalw [LListD_Fun_def] "!!A B. A<=B ==> LListD_Fun r A <= LListD_Fun r B";
   1.146  by (REPEAT (ares_tac basic_monos 1));
   1.147  qed "LListD_Fun_mono";
   1.148  
   1.149 -goalw LList.thy [LListD_Fun_def]
   1.150 +Goalw [LListD_Fun_def]
   1.151      "!!M. [| M : X;  X <= LListD_Fun r (X Un LListD(r)) |] ==>  M : LListD(r)";
   1.152  by (etac LListD.coinduct 1);
   1.153  by (etac (subsetD RS CollectD) 1);
   1.154  by (assume_tac 1);
   1.155  qed "LListD_coinduct";
   1.156  
   1.157 -goalw LList.thy [LListD_Fun_def,NIL_def] "(NIL,NIL) : LListD_Fun r s";
   1.158 +Goalw [LListD_Fun_def,NIL_def] "(NIL,NIL) : LListD_Fun r s";
   1.159  by (Fast_tac 1);
   1.160  qed "LListD_Fun_NIL_I";
   1.161  
   1.162 -goalw LList.thy [LListD_Fun_def,CONS_def]
   1.163 +Goalw [LListD_Fun_def,CONS_def]
   1.164   "!!x. [| x:A;  (M,N):s |] ==> (CONS x M, CONS x N) : LListD_Fun (diag A) s";
   1.165  by (Fast_tac 1);
   1.166  qed "LListD_Fun_CONS_I";
   1.167  
   1.168  (*Utilise the "strong" part, i.e. gfp(f)*)
   1.169 -goalw LList.thy (LListD.defs @ [LListD_Fun_def])
   1.170 +Goalw (LListD.defs @ [LListD_Fun_def])
   1.171      "!!M N. M: LListD(r) ==> M : LListD_Fun r (X Un LListD(r))";
   1.172  by (etac (LListD.mono RS gfp_fun_UnI2) 1);
   1.173  qed "LListD_Fun_LListD_I";
   1.174  
   1.175  
   1.176  (*This converse inclusion helps to strengthen LList_equalityI*)
   1.177 -goal LList.thy "diag(llist(A)) <= LListD(diag(A))";
   1.178 +Goal "diag(llist(A)) <= LListD(diag(A))";
   1.179  by (rtac subsetI 1);
   1.180  by (etac LListD_coinduct 1);
   1.181  by (rtac subsetI 1);
   1.182 @@ -231,12 +231,12 @@
   1.183  				       LListD_Fun_CONS_I])));
   1.184  qed "diag_subset_LListD";
   1.185  
   1.186 -goal LList.thy "LListD(diag(A)) = diag(llist(A))";
   1.187 +Goal "LListD(diag(A)) = diag(llist(A))";
   1.188  by (REPEAT (resolve_tac [equalityI, LListD_subset_diag, 
   1.189                           diag_subset_LListD] 1));
   1.190  qed "LListD_eq_diag";
   1.191  
   1.192 -goal LList.thy 
   1.193 +Goal 
   1.194      "!!M N. M: llist(A) ==> (M,M) : LListD_Fun (diag A) (X Un diag(llist(A)))";
   1.195  by (rtac (LListD_eq_diag RS subst) 1);
   1.196  by (rtac LListD_Fun_LListD_I 1);
   1.197 @@ -247,7 +247,7 @@
   1.198  (** To show two LLists are equal, exhibit a bisimulation! 
   1.199        [also admits true equality]
   1.200     Replace "A" by some particular set, like {x.True}??? *)
   1.201 -goal LList.thy 
   1.202 +Goal 
   1.203      "!!r. [| (M,N) : r;  r <= LListD_Fun (diag A) (r Un diag(llist(A))) \
   1.204  \         |] ==>  M=N";
   1.205  by (rtac (LListD_subset_diag RS subsetD RS diagE) 1);
   1.206 @@ -291,11 +291,11 @@
   1.207  
   1.208  (** Obsolete LList_corec_unique proof: complete induction, not coinduction **)
   1.209  
   1.210 -goalw LList.thy [CONS_def] "ntrunc (Suc 0) (CONS M N) = {}";
   1.211 +Goalw [CONS_def] "ntrunc (Suc 0) (CONS M N) = {}";
   1.212  by (rtac ntrunc_one_In1 1);
   1.213  qed "ntrunc_one_CONS";
   1.214  
   1.215 -goalw LList.thy [CONS_def]
   1.216 +Goalw [CONS_def]
   1.217      "ntrunc (Suc(Suc(k))) (CONS M N) = CONS (ntrunc k M) (ntrunc k N)";
   1.218  by (Simp_tac 1);
   1.219  qed "ntrunc_CONS";
   1.220 @@ -327,7 +327,7 @@
   1.221  
   1.222  (*** Lconst -- defined directly using lfp, but equivalent to a LList_corec ***)
   1.223  
   1.224 -goal LList.thy "mono(CONS(M))";
   1.225 +Goal "mono(CONS(M))";
   1.226  by (REPEAT (ares_tac [monoI, subset_refl, CONS_mono] 1));
   1.227  qed "Lconst_fun_mono";
   1.228  
   1.229 @@ -336,21 +336,21 @@
   1.230  
   1.231  (*A typical use of co-induction to show membership in the gfp.
   1.232    The containing set is simply the singleton {Lconst(M)}. *)
   1.233 -goal LList.thy "!!M A. M:A ==> Lconst(M): llist(A)";
   1.234 +Goal "!!M A. M:A ==> Lconst(M): llist(A)";
   1.235  by (rtac (singletonI RS llist_coinduct) 1);
   1.236  by Safe_tac;
   1.237  by (res_inst_tac [("P", "%u. u: ?A")] (Lconst RS ssubst) 1);
   1.238  by (REPEAT (ares_tac [list_Fun_CONS_I, singletonI, UnI1] 1));
   1.239  qed "Lconst_type";
   1.240  
   1.241 -goal LList.thy "Lconst(M) = LList_corec M (%x. Inr((x,x)))";
   1.242 +Goal "Lconst(M) = LList_corec M (%x. Inr((x,x)))";
   1.243  by (rtac (equals_LList_corec RS fun_cong) 1);
   1.244  by (Simp_tac 1);
   1.245  by (rtac Lconst 1);
   1.246  qed "Lconst_eq_LList_corec";
   1.247  
   1.248  (*Thus we could have used gfp in the definition of Lconst*)
   1.249 -goal LList.thy "gfp(%N. CONS M N) = LList_corec M (%x. Inr((x,x)))";
   1.250 +Goal "gfp(%N. CONS M N) = LList_corec M (%x. Inr((x,x)))";
   1.251  by (rtac (equals_LList_corec RS fun_cong) 1);
   1.252  by (Simp_tac 1);
   1.253  by (rtac (Lconst_fun_mono RS gfp_Tarski) 1);
   1.254 @@ -359,19 +359,19 @@
   1.255  
   1.256  (*** Isomorphisms ***)
   1.257  
   1.258 -goal LList.thy "inj(Rep_llist)";
   1.259 +Goal "inj(Rep_llist)";
   1.260  by (rtac inj_inverseI 1);
   1.261  by (rtac Rep_llist_inverse 1);
   1.262  qed "inj_Rep_llist";
   1.263  
   1.264 -goal LList.thy "inj_on Abs_llist (llist(range Leaf))";
   1.265 +Goal "inj_on Abs_llist (llist(range Leaf))";
   1.266  by (rtac inj_on_inverseI 1);
   1.267  by (etac Abs_llist_inverse 1);
   1.268  qed "inj_on_Abs_llist";
   1.269  
   1.270  (** Distinctness of constructors **)
   1.271  
   1.272 -goalw LList.thy [LNil_def,LCons_def] "~ LCons x xs = LNil";
   1.273 +Goalw [LNil_def,LCons_def] "~ LCons x xs = LNil";
   1.274  by (rtac (CONS_not_NIL RS (inj_on_Abs_llist RS inj_on_contraD)) 1);
   1.275  by (REPEAT (resolve_tac (llist.intrs @ [rangeI, Rep_llist]) 1));
   1.276  qed "LCons_not_LNil";
   1.277 @@ -383,12 +383,12 @@
   1.278  
   1.279  (** llist constructors **)
   1.280  
   1.281 -goalw LList.thy [LNil_def]
   1.282 +Goalw [LNil_def]
   1.283      "Rep_llist(LNil) = NIL";
   1.284  by (rtac (llist.NIL_I RS Abs_llist_inverse) 1);
   1.285  qed "Rep_llist_LNil";
   1.286  
   1.287 -goalw LList.thy [LCons_def]
   1.288 +Goalw [LCons_def]
   1.289      "Rep_llist(LCons x l) = CONS (Leaf x) (Rep_llist l)";
   1.290  by (REPEAT (resolve_tac [llist.CONS_I RS Abs_llist_inverse,
   1.291                           rangeI, Rep_llist] 1));
   1.292 @@ -396,7 +396,7 @@
   1.293  
   1.294  (** Injectiveness of CONS and LCons **)
   1.295  
   1.296 -goalw LList.thy [CONS_def] "(CONS M N=CONS M' N') = (M=M' & N=N')";
   1.297 +Goalw [CONS_def] "(CONS M N=CONS M' N') = (M=M' & N=N')";
   1.298  by (fast_tac (claset() addSEs [Scons_inject]) 1);
   1.299  qed "CONS_CONS_eq2";
   1.300  
   1.301 @@ -409,7 +409,7 @@
   1.302  AddSDs [inj_on_Abs_llist RS inj_onD,
   1.303          inj_Rep_llist RS injD, Leaf_inject];
   1.304  
   1.305 -goalw LList.thy [LCons_def] "(LCons x xs=LCons y ys) = (x=y & xs=ys)";
   1.306 +Goalw [LCons_def] "(LCons x xs=LCons y ys) = (x=y & xs=ys)";
   1.307  by (Fast_tac 1);
   1.308  qed "LCons_LCons_eq";
   1.309  
   1.310 @@ -449,12 +449,12 @@
   1.311  
   1.312  (*** The functional "Lmap" ***)
   1.313  
   1.314 -goal LList.thy "Lmap f NIL = NIL";
   1.315 +Goal "Lmap f NIL = NIL";
   1.316  by (rtac (Lmap_def RS def_LList_corec RS trans) 1);
   1.317  by (Simp_tac 1);
   1.318  qed "Lmap_NIL";
   1.319  
   1.320 -goal LList.thy "Lmap f (CONS M N) = CONS (f M) (Lmap f N)";
   1.321 +Goal "Lmap f (CONS M N) = CONS (f M) (Lmap f N)";
   1.322  by (rtac (Lmap_def RS def_LList_corec RS trans) 1);
   1.323  by (Simp_tac 1);
   1.324  qed "Lmap_CONS";
   1.325 @@ -502,18 +502,18 @@
   1.326  
   1.327  (*** Lappend -- its two arguments cause some complications! ***)
   1.328  
   1.329 -goalw LList.thy [Lappend_def] "Lappend NIL NIL = NIL";
   1.330 +Goalw [Lappend_def] "Lappend NIL NIL = NIL";
   1.331  by (rtac (LList_corec RS trans) 1);
   1.332  by (Simp_tac 1);
   1.333  qed "Lappend_NIL_NIL";
   1.334  
   1.335 -goalw LList.thy [Lappend_def]
   1.336 +Goalw [Lappend_def]
   1.337      "Lappend NIL (CONS N N') = CONS N (Lappend NIL N')";
   1.338  by (rtac (LList_corec RS trans) 1);
   1.339  by (Simp_tac 1);
   1.340  qed "Lappend_NIL_CONS";
   1.341  
   1.342 -goalw LList.thy [Lappend_def]
   1.343 +Goalw [Lappend_def]
   1.344      "Lappend (CONS M M') N = CONS M (Lappend M' N)";
   1.345  by (rtac (LList_corec RS trans) 1);
   1.346  by (Simp_tac 1);
   1.347 @@ -523,12 +523,12 @@
   1.348            Lappend_CONS, LListD_Fun_CONS_I, range_eqI, image_eqI];
   1.349  
   1.350  
   1.351 -goal LList.thy "!!M. M: llist(A) ==> Lappend NIL M = M";
   1.352 +Goal "!!M. M: llist(A) ==> Lappend NIL M = M";
   1.353  by (etac LList_fun_equalityI 1);
   1.354  by (ALLGOALS Asm_simp_tac);
   1.355  qed "Lappend_NIL";
   1.356  
   1.357 -goal LList.thy "!!M. M: llist(A) ==> Lappend M NIL = M";
   1.358 +Goal "!!M. M: llist(A) ==> Lappend M NIL = M";
   1.359  by (etac LList_fun_equalityI 1);
   1.360  by (ALLGOALS Asm_simp_tac);
   1.361  qed "Lappend_NIL2";
   1.362 @@ -539,7 +539,7 @@
   1.363  (** Alternative type-checking proofs for Lappend **)
   1.364  
   1.365  (*weak co-induction: bisimulation and case analysis on both variables*)
   1.366 -goal LList.thy
   1.367 +Goal
   1.368      "!!M N. [| M: llist(A); N: llist(A) |] ==> Lappend M N: llist(A)";
   1.369  by (res_inst_tac
   1.370      [("X", "UN u:llist(A). UN v: llist(A). {Lappend u v}")] llist_coinduct 1);
   1.371 @@ -552,7 +552,7 @@
   1.372  qed "Lappend_type";
   1.373  
   1.374  (*strong co-induction: bisimulation and case analysis on one variable*)
   1.375 -goal LList.thy
   1.376 +Goal
   1.377      "!!M N. [| M: llist(A); N: llist(A) |] ==> Lappend M N: llist(A)";
   1.378  by (res_inst_tac [("X", "(%u. Lappend u N)``llist(A)")] llist_coinduct 1);
   1.379  by (etac imageI 1);
   1.380 @@ -569,11 +569,11 @@
   1.381  Addsimps ([Abs_llist_inverse, Rep_llist_inverse,
   1.382             Rep_llist, rangeI, inj_Leaf, inv_f_f] @ llist.intrs);
   1.383  
   1.384 -goalw LList.thy [llist_case_def,LNil_def]  "llist_case c d LNil = c";
   1.385 +Goalw [llist_case_def,LNil_def]  "llist_case c d LNil = c";
   1.386  by (Simp_tac 1);
   1.387  qed "llist_case_LNil";
   1.388  
   1.389 -goalw LList.thy [llist_case_def,LCons_def]
   1.390 +Goalw [llist_case_def,LCons_def]
   1.391      "llist_case c d (LCons M N) = d M N";
   1.392  by (Simp_tac 1);
   1.393  qed "llist_case_LCons";
   1.394 @@ -596,7 +596,7 @@
   1.395  
   1.396  (** llist_corec: corecursion for 'a llist **)
   1.397  
   1.398 -goalw LList.thy [llist_corec_def,LNil_def,LCons_def]
   1.399 +Goalw [llist_corec_def,LNil_def,LCons_def]
   1.400      "llist_corec a f = sum_case (%u. LNil) \
   1.401  \                           (split(%z w. LCons z (llist_corec w f))) (f a)";
   1.402  by (stac LList_corec 1);
   1.403 @@ -620,7 +620,7 @@
   1.404  
   1.405  (*** Deriving llist_equalityI -- llist equality is a bisimulation ***)
   1.406  
   1.407 -goalw LList.thy [LListD_Fun_def]
   1.408 +Goalw [LListD_Fun_def]
   1.409      "!!r A. r <= (llist A) Times (llist A) ==> \
   1.410  \           LListD_Fun (diag A) r <= (llist A) Times (llist A)";
   1.411  by (stac llist_unfold 1);
   1.412 @@ -628,7 +628,7 @@
   1.413  by (Fast_tac 1);
   1.414  qed "LListD_Fun_subset_Sigma_llist";
   1.415  
   1.416 -goal LList.thy
   1.417 +Goal
   1.418      "prod_fun Rep_llist Rep_llist `` r <= \
   1.419  \    (llist(range Leaf)) Times (llist(range Leaf))";
   1.420  by (fast_tac (claset() delrules [image_subsetI]
   1.421 @@ -644,7 +644,7 @@
   1.422  by (asm_simp_tac (simpset() addsimps [Abs_llist_inverse]) 1);
   1.423  qed "prod_fun_lemma";
   1.424  
   1.425 -goal LList.thy
   1.426 +Goal
   1.427      "prod_fun Rep_llist  Rep_llist `` range(%x. (x, x)) = \
   1.428  \    diag(llist(range Leaf))";
   1.429  by (rtac equalityI 1);
   1.430 @@ -654,7 +654,7 @@
   1.431  qed "prod_fun_range_eq_diag";
   1.432  
   1.433  (*Surprisingly hard to prove.  Used with lfilter*)
   1.434 -goalw thy [llistD_Fun_def, prod_fun_def]
   1.435 +Goalw [llistD_Fun_def, prod_fun_def]
   1.436      "!!A B. A<=B ==> llistD_Fun A <= llistD_Fun B";
   1.437  by Auto_tac;
   1.438  by (rtac image_eqI 1);
   1.439 @@ -682,7 +682,7 @@
   1.440  qed "llist_equalityI";
   1.441  
   1.442  (** Rules to prove the 2nd premise of llist_equalityI **)
   1.443 -goalw LList.thy [llistD_Fun_def,LNil_def] "(LNil,LNil) : llistD_Fun(r)";
   1.444 +Goalw [llistD_Fun_def,LNil_def] "(LNil,LNil) : llistD_Fun(r)";
   1.445  by (rtac (LListD_Fun_NIL_I RS prod_fun_imageI) 1);
   1.446  qed "llistD_Fun_LNil_I";
   1.447  
   1.448 @@ -693,7 +693,7 @@
   1.449  qed "llistD_Fun_LCons_I";
   1.450  
   1.451  (*Utilise the "strong" part, i.e. gfp(f)*)
   1.452 -goalw LList.thy [llistD_Fun_def]
   1.453 +Goalw [llistD_Fun_def]
   1.454       "!!l. (l,l) : llistD_Fun(r Un range(%x.(x,x)))";
   1.455  by (rtac (Rep_llist_inverse RS subst) 1);
   1.456  by (rtac prod_fun_imageI 1);
   1.457 @@ -728,12 +728,12 @@
   1.458  
   1.459  (*** The functional "lmap" ***)
   1.460  
   1.461 -goal LList.thy "lmap f LNil = LNil";
   1.462 +Goal "lmap f LNil = LNil";
   1.463  by (rtac (lmap_def RS def_llist_corec RS trans) 1);
   1.464  by (Simp_tac 1);
   1.465  qed "lmap_LNil";
   1.466  
   1.467 -goal LList.thy "lmap f (LCons M N) = LCons (f M) (lmap f N)";
   1.468 +Goal "lmap f (LCons M N) = LCons (f M) (lmap f N)";
   1.469  by (rtac (lmap_def RS def_llist_corec RS trans) 1);
   1.470  by (Simp_tac 1);
   1.471  qed "lmap_LCons";
   1.472 @@ -743,12 +743,12 @@
   1.473  
   1.474  (** Two easy results about lmap **)
   1.475  
   1.476 -goal LList.thy "lmap (f o g) l = lmap f (lmap g l)";
   1.477 +Goal "lmap (f o g) l = lmap f (lmap g l)";
   1.478  by (res_inst_tac [("l","l")] llist_fun_equalityI 1);
   1.479  by (ALLGOALS Simp_tac);
   1.480  qed "lmap_compose";
   1.481  
   1.482 -goal LList.thy "lmap (%x. x) l = l";
   1.483 +Goal "lmap (%x. x) l = l";
   1.484  by (res_inst_tac [("l","l")] llist_fun_equalityI 1);
   1.485  by (ALLGOALS Simp_tac);
   1.486  qed "lmap_ident";
   1.487 @@ -756,12 +756,12 @@
   1.488  
   1.489  (*** iterates -- llist_fun_equalityI cannot be used! ***)
   1.490  
   1.491 -goal LList.thy "iterates f x = LCons x (iterates f (f x))";
   1.492 +Goal "iterates f x = LCons x (iterates f (f x))";
   1.493  by (rtac (iterates_def RS def_llist_corec RS trans) 1);
   1.494  by (Simp_tac 1);
   1.495  qed "iterates";
   1.496  
   1.497 -goal LList.thy "lmap f (iterates f x) = iterates f (f x)";
   1.498 +Goal "lmap f (iterates f x) = iterates f (f x)";
   1.499  by (res_inst_tac [("r", "range(%u.(lmap f (iterates f u),iterates f (f u)))")] 
   1.500      llist_equalityI 1);
   1.501  by (rtac rangeI 1);
   1.502 @@ -771,7 +771,7 @@
   1.503  by (Simp_tac 1);
   1.504  qed "lmap_iterates";
   1.505  
   1.506 -goal LList.thy "iterates f x = LCons x (lmap f (iterates f x))";
   1.507 +Goal "iterates f x = LCons x (lmap f (iterates f x))";
   1.508  by (stac lmap_iterates 1);
   1.509  by (rtac iterates 1);
   1.510  qed "iterates_lmap";
   1.511 @@ -780,7 +780,7 @@
   1.512  
   1.513  (** Two lemmas about natrec n x (%m.g), which is essentially (g^n)(x) **)
   1.514  
   1.515 -goal LList.thy
   1.516 +Goal
   1.517      "nat_rec (LCons b l) (%m. lmap(f)) n =      \
   1.518  \    LCons (nat_rec b (%m. f) n) (nat_rec l (%m. lmap(f)) n)";
   1.519  by (nat_ind_tac "n" 1);
   1.520 @@ -821,18 +821,18 @@
   1.521  
   1.522  (*** lappend -- its two arguments cause some complications! ***)
   1.523  
   1.524 -goalw LList.thy [lappend_def] "lappend LNil LNil = LNil";
   1.525 +Goalw [lappend_def] "lappend LNil LNil = LNil";
   1.526  by (rtac (llist_corec RS trans) 1);
   1.527  by (Simp_tac 1);
   1.528  qed "lappend_LNil_LNil";
   1.529  
   1.530 -goalw LList.thy [lappend_def]
   1.531 +Goalw [lappend_def]
   1.532      "lappend LNil (LCons l l') = LCons l (lappend LNil l')";
   1.533  by (rtac (llist_corec RS trans) 1);
   1.534  by (Simp_tac 1);
   1.535  qed "lappend_LNil_LCons";
   1.536  
   1.537 -goalw LList.thy [lappend_def]
   1.538 +Goalw [lappend_def]
   1.539      "lappend (LCons l l') N = LCons l (lappend l' N)";
   1.540  by (rtac (llist_corec RS trans) 1);
   1.541  by (Simp_tac 1);
   1.542 @@ -840,12 +840,12 @@
   1.543  
   1.544  Addsimps [lappend_LNil_LNil, lappend_LNil_LCons, lappend_LCons];
   1.545  
   1.546 -goal LList.thy "lappend LNil l = l";
   1.547 +Goal "lappend LNil l = l";
   1.548  by (res_inst_tac [("l","l")] llist_fun_equalityI 1);
   1.549  by (ALLGOALS Simp_tac);
   1.550  qed "lappend_LNil";
   1.551  
   1.552 -goal LList.thy "lappend l LNil = l";
   1.553 +Goal "lappend l LNil = l";
   1.554  by (res_inst_tac [("l","l")] llist_fun_equalityI 1);
   1.555  by (ALLGOALS Simp_tac);
   1.556  qed "lappend_LNil2";
   1.557 @@ -853,7 +853,7 @@
   1.558  Addsimps [lappend_LNil, lappend_LNil2];
   1.559  
   1.560  (*The infinite first argument blocks the second*)
   1.561 -goal LList.thy "lappend (iterates f x) N = iterates f x";
   1.562 +Goal "lappend (iterates f x) N = iterates f x";
   1.563  by (res_inst_tac [("r", "range(%u.(lappend (iterates f u) N,iterates f u))")] 
   1.564      llist_equalityI 1);
   1.565  by (rtac rangeI 1);
   1.566 @@ -865,7 +865,7 @@
   1.567  (** Two proofs that lmap distributes over lappend **)
   1.568  
   1.569  (*Long proof requiring case analysis on both both arguments*)
   1.570 -goal LList.thy "lmap f (lappend l n) = lappend (lmap f l) (lmap f n)";
   1.571 +Goal "lmap f (lappend l n) = lappend (lmap f l) (lmap f n)";
   1.572  by (res_inst_tac 
   1.573      [("r",  
   1.574        "UN n. range(%l.(lmap f (lappend l n),lappend (lmap f l) (lmap f n)))")] 
   1.575 @@ -880,14 +880,14 @@
   1.576  qed "lmap_lappend_distrib";
   1.577  
   1.578  (*Shorter proof of theorem above using llist_equalityI as strong coinduction*)
   1.579 -goal LList.thy "lmap f (lappend l n) = lappend (lmap f l) (lmap f n)";
   1.580 +Goal "lmap f (lappend l n) = lappend (lmap f l) (lmap f n)";
   1.581  by (res_inst_tac [("l","l")] llist_fun_equalityI 1);
   1.582  by (Simp_tac 1);
   1.583  by (Simp_tac 1);
   1.584  qed "lmap_lappend_distrib";
   1.585  
   1.586  (*Without strong coinduction, three case analyses might be needed*)
   1.587 -goal LList.thy "lappend (lappend l1 l2) l3 = lappend l1 (lappend l2 l3)";
   1.588 +Goal "lappend (lappend l1 l2) l3 = lappend l1 (lappend l2 l3)";
   1.589  by (res_inst_tac [("l","l1")] llist_fun_equalityI 1);
   1.590  by (Simp_tac 1);
   1.591  by (Simp_tac 1);