src/HOL/WF.ML
changeset 5316 7a8975451a89
parent 5281 f4d16517b360
child 5318 72bf8039b53f
     1.1 --- a/src/HOL/WF.ML	Thu Aug 13 18:07:56 1998 +0200
     1.2 +++ b/src/HOL/WF.ML	Thu Aug 13 18:14:26 1998 +0200
     1.3 @@ -12,7 +12,7 @@
     1.4  val H_cong1 = refl RS H_cong;
     1.5  
     1.6  (*Restriction to domain A.  If r is well-founded over A then wf(r)*)
     1.7 -val [prem1,prem2] = goalw WF.thy [wf_def]
     1.8 +val [prem1,prem2] = Goalw [wf_def]
     1.9   "[| r <= A Times A;  \
    1.10  \    !!x P. [| ! x. (! y. (y,x) : r --> P(y)) --> P(x);  x:A |] ==> P(x) |]  \
    1.11  \ ==>  wf(r)";
    1.12 @@ -22,7 +22,7 @@
    1.13  by (best_tac (claset() addSEs [prem1 RS subsetD RS SigmaE2] addIs [prem2]) 1);
    1.14  qed "wfI";
    1.15  
    1.16 -val major::prems = goalw WF.thy [wf_def]
    1.17 +val major::prems = Goalw [wf_def]
    1.18      "[| wf(r);          \
    1.19  \       !!x.[| ! y. (y,x): r --> P(y) |] ==> P(x) \
    1.20  \    |]  ==>  P(a)";
    1.21 @@ -36,26 +36,25 @@
    1.22             rename_last_tac a ["1"] (i+1),
    1.23             ares_tac prems i];
    1.24  
    1.25 -val prems = goal WF.thy "[| wf(r);  (a,x):r;  (x,a):r |] ==> P";
    1.26 +Goal "[| wf(r);  (a,x):r;  (x,a):r |] ==> P";
    1.27  by (subgoal_tac "! x. (a,x):r --> (x,a):r --> P" 1);
    1.28 -by (blast_tac (claset() addIs prems) 1);
    1.29 -by (wf_ind_tac "a" prems 1);
    1.30 +by (Blast_tac 1);
    1.31 +by (wf_ind_tac "a" [] 1);
    1.32  by (Blast_tac 1);
    1.33  qed "wf_asym";
    1.34  
    1.35 -val prems = goal WF.thy "[| wf(r);  (a,a): r |] ==> P";
    1.36 -by (rtac wf_asym 1);
    1.37 -by (REPEAT (resolve_tac prems 1));
    1.38 +Goal "[| wf(r);  (a,a): r |] ==> P";
    1.39 +by (blast_tac (claset() addEs [wf_asym]) 1);
    1.40  qed "wf_irrefl";
    1.41  
    1.42  (*transitive closure of a wf relation is wf! *)
    1.43 -val [prem] = goal WF.thy "wf(r) ==> wf(r^+)";
    1.44 -by (rewtac wf_def);
    1.45 +Goal "wf(r) ==> wf(r^+)";
    1.46 +by (stac wf_def 1);
    1.47  by (Clarify_tac 1);
    1.48  (*must retain the universal formula for later use!*)
    1.49  by (rtac allE 1 THEN assume_tac 1);
    1.50  by (etac mp 1);
    1.51 -by (res_inst_tac [("a","x")] (prem RS wf_induct) 1);
    1.52 +by (eres_inst_tac [("a","x")] wf_induct 1);
    1.53  by (rtac (impI RS allI) 1);
    1.54  by (etac tranclE 1);
    1.55  by (Blast_tac 1);
    1.56 @@ -72,14 +71,13 @@
    1.57   * Minimal-element characterization of well-foundedness
    1.58   *---------------------------------------------------------------------------*)
    1.59  
    1.60 -val wfr::_ = goalw WF.thy [wf_def]
    1.61 -    "wf r ==> x:Q --> (? z:Q. ! y. (y,z):r --> y~:Q)";
    1.62 -by (rtac (wfr RS spec RS mp RS spec) 1);
    1.63 +Goalw [wf_def] "wf r ==> x:Q --> (? z:Q. ! y. (y,z):r --> y~:Q)";
    1.64 +bd spec 1;
    1.65 +by (etac (mp RS spec) 1);
    1.66  by (Blast_tac 1);
    1.67  val lemma1 = result();
    1.68  
    1.69 -Goalw [wf_def]
    1.70 -    "(! Q x. x:Q --> (? z:Q. ! y. (y,z):r --> y~:Q)) ==> wf r";
    1.71 +Goalw [wf_def] "(! Q x. x:Q --> (? z:Q. ! y. (y,z):r --> y~:Q)) ==> wf r";
    1.72  by (Clarify_tac 1);
    1.73  by (dres_inst_tac [("x", "{x. ~ P x}")] spec 1);
    1.74  by (Blast_tac 1);
    1.75 @@ -138,11 +136,10 @@
    1.76   * Wellfoundedness of `disjoint union'
    1.77   *---------------------------------------------------------------------------*)
    1.78  
    1.79 -Goal
    1.80 - "[| !i:I. wf(r i); \
    1.81 -\    !i:I.!j:I. r i ~= r j --> Domain(r i) Int Range(r j) = {} & \
    1.82 -\                              Domain(r j) Int Range(r i) = {} \
    1.83 -\ |] ==> wf(UN i:I. r i)";
    1.84 +Goal "[| !i:I. wf(r i); \
    1.85 +\        !i:I.!j:I. r i ~= r j --> Domain(r i) Int Range(r j) = {} & \
    1.86 +\                                  Domain(r j) Int Range(r i) = {} \
    1.87 +\     |] ==> wf(UN i:I. r i)";
    1.88  by(asm_full_simp_tac (HOL_basic_ss addsimps [wf_eq_minimal]) 1);
    1.89  by(Clarify_tac 1);
    1.90  by(rename_tac "A a" 1);
    1.91 @@ -181,9 +178,8 @@
    1.92  by(Blast_tac 1);
    1.93  qed "wf_Union";
    1.94  
    1.95 -Goal
    1.96 - "[| wf r; wf s; Domain r Int Range s = {}; Domain s Int Range r = {} \
    1.97 -\ |] ==> wf(r Un s)";
    1.98 +Goal "[| wf r; wf s; Domain r Int Range s = {}; Domain s Int Range r = {} \
    1.99 +\     |] ==> wf(r Un s)";
   1.100  br(simplify (simpset()) (read_instantiate[("R","{r,s}")]wf_Union)) 1;
   1.101  by(Blast_tac 1);
   1.102  by(Blast_tac 1);
   1.103 @@ -251,10 +247,9 @@
   1.104                          eresolve_tac [transD, mp, allE]));
   1.105  val wf_super_ss = HOL_ss addSolver indhyp_tac;
   1.106  
   1.107 -val prems = goalw WF.thy [is_recfun_def,cut_def]
   1.108 +Goalw [is_recfun_def,cut_def]
   1.109      "[| wf(r);  trans(r);  is_recfun r H a f;  is_recfun r H b g |] ==> \
   1.110      \ (x,a):r --> (x,b):r --> f(x)=g(x)";
   1.111 -by (cut_facts_tac prems 1);
   1.112  by (etac wf_induct 1);
   1.113  by (REPEAT (rtac impI 1 ORELSE etac ssubst 1));
   1.114  by (asm_simp_tac (wf_super_ss addcongs [if_cong]) 1);
   1.115 @@ -274,15 +269,13 @@
   1.116  
   1.117  (*** Main Existence Lemma -- Basic Properties of the_recfun ***)
   1.118  
   1.119 -val prems = goalw WF.thy [the_recfun_def]
   1.120 +Goalw [the_recfun_def]
   1.121      "is_recfun r H a f ==> is_recfun r H a (the_recfun r H a)";
   1.122 -by (res_inst_tac [("P", "is_recfun r H a")] selectI 1);
   1.123 -by (resolve_tac prems 1);
   1.124 +by (eres_inst_tac [("P", "is_recfun r H a")] selectI 1);
   1.125  qed "is_the_recfun";
   1.126  
   1.127 -val prems = goal WF.thy
   1.128 - "!!r. [| wf(r);  trans(r) |] ==> is_recfun r H a (the_recfun r H a)";
   1.129 -by (wf_ind_tac "a" prems 1);
   1.130 +Goal "[| wf(r);  trans(r) |] ==> is_recfun r H a (the_recfun r H a)";
   1.131 +by (wf_ind_tac "a" [] 1);
   1.132  by (res_inst_tac [("f","cut (%y. H (the_recfun r H y) y) r a1")]
   1.133                   is_the_recfun 1);
   1.134  by (rewtac is_recfun_def);
   1.135 @@ -309,7 +302,7 @@
   1.136  val unwind1_the_recfun = rewrite_rule[is_recfun_def] unfold_the_recfun;
   1.137  
   1.138  (*--------------Old proof-----------------------------------------------------
   1.139 -val prems = goal WF.thy
   1.140 +val prems = Goal
   1.141      "[| wf(r);  trans(r) |] ==> is_recfun r H a (the_recfun r H a)";
   1.142  by (cut_facts_tac prems 1);
   1.143  by (wf_ind_tac "a" prems 1);
   1.144 @@ -376,7 +369,7 @@
   1.145  (*---------------------------------------------------------------------------
   1.146   * This form avoids giant explosions in proofs.  NOTE USE OF == 
   1.147   *---------------------------------------------------------------------------*)
   1.148 -val rew::prems = goal WF.thy
   1.149 +val rew::prems = goal thy
   1.150      "[| f==wfrec r H;  wf(r) |] ==> f(a) = H (cut f r a) a";
   1.151  by (rewtac rew);
   1.152  by (REPEAT (resolve_tac (prems@[wfrec]) 1));