src/HOL/MiniML/I.ML
changeset 1751 946efd210837
parent 1723 286f9b6370ab
child 1757 f7a573c46611
equal deleted inserted replaced
1750:817a34a54fb0 1751:946efd210837
     1 open I;
     1 open I;
     2 
       
     3 Unify.trace_bound := 45;
       
     4 Unify.search_bound := 50;
       
     5 
     2 
     6 goal thy
     3 goal thy
     7   "! a m s s' t n.  \
     4   "! a m s s' t n.  \
     8 \    (new_tv m a & new_tv m s) --> I e a m s = Ok(s',t,n) -->   \
     5 \    (new_tv m a & new_tv m s) --> I e a m s = Ok(s',t,n) -->   \
     9 \    ( ? r. W e ($ s a) m = Ok(r, $ s' t, n) & s' = ($ r o s) )";
     6 \    ( ? r. W e ($ s a) m = Ok(r, $ s' t, n) & s' = ($ r o s) )";
   111 by ((dres_inst_tac [("ts","$ s a")] new_tv_list_le 1) THEN (atac 1));
   108 by ((dres_inst_tac [("ts","$ s a")] new_tv_list_le 1) THEN (atac 1));
   112 by ((dtac new_tv_subst_tel 1) THEN (atac 1));
   109 by ((dtac new_tv_subst_tel 1) THEN (atac 1));
   113 by (fast_tac (HOL_cs addDs [new_tv_W] addss 
   110 by (fast_tac (HOL_cs addDs [new_tv_W] addss 
   114     (!simpset addsimps [subst_comp_tel])) 1);
   111     (!simpset addsimps [subst_comp_tel])) 1);
   115 qed_spec_mp "I_correct_wrt_W";
   112 qed_spec_mp "I_correct_wrt_W";
       
   113 
       
   114 (***
       
   115 We actually want the corollary
       
   116 
       
   117 goal I.thy
       
   118   "I e [] m id_subst = Ok(s,t,n) --> W e [] m = Ok(s, $s t, n)";
       
   119 by(cut_facts_tac [(read_instantiate[("x","id_subst")]
       
   120  (read_instantiate[("x","[]")](thm RS spec)
       
   121   RS spec RS spec))] 1);
       
   122 by(Full_simp_tac 1);
       
   123 by(fast_tac HOL_cs 1);
       
   124 qed;
       
   125 
       
   126 assuming that thm is the undischarged version of I_correct_wrt_W.
       
   127 
       
   128 Wait until simplification of thms is possible.
       
   129 ***)
       
   130 
       
   131 goal I.thy "!a m s. \
       
   132 \  new_tv m a & new_tv m s --> I e a m s = Fail --> W e ($s a) m = Fail";
       
   133 by (expr.induct_tac "e" 1);
       
   134   by(simp_tac (!simpset addsimps [app_subst_list]
       
   135                         setloop (split_tac [expand_if])) 1);
       
   136  by(simp_tac (!simpset setloop (split_tac [expand_bind])) 1);
       
   137  by(strip_tac 1);
       
   138  br notI 1;
       
   139  bd eq_OkD 1;
       
   140  be swap 1;
       
   141  by(subgoal_tac "TVar m # $ s a = $s(TVar m # a)" 1);
       
   142   by(asm_simp_tac HOL_ss 1);
       
   143   by(fast_tac (HOL_cs addSIs [new_tv_Suc_list RS mp,
       
   144                               lessI RS less_imp_le RS new_tv_subst_le]) 1);
       
   145  be conjE 1;
       
   146  bd (new_tv_not_free_tv RS not_free_impl_id) 1;
       
   147  by(Asm_simp_tac 1);
       
   148 by(simp_tac (!simpset setloop (split_tac [expand_bind])) 1);
       
   149 by(strip_tac 1);
       
   150 br conjI 1;
       
   151  by(fast_tac (HOL_cs addSDs [eq_OkD]) 1);
       
   152 by(strip_tac 1);
       
   153 br conjI 1;
       
   154  by(strip_tac 1);
       
   155  br notI 1;
       
   156  by(forward_tac [conjunct1] 1);
       
   157  by(forward_tac [conjunct2] 1);
       
   158  bd I_correct_wrt_W 1;
       
   159   ba 1;
       
   160  be exE 1;
       
   161  by(Asm_full_simp_tac 1);
       
   162  by(REPEAT(etac conjE 1));
       
   163  by(hyp_subst_tac 1);
       
   164  by(full_simp_tac (!simpset addsimps [o_def,subst_comp_tel]) 1);
       
   165  by(EVERY[dtac eq_OkD 1, etac notE 1, etac allE 1, etac allE 1, etac allE 1,
       
   166           etac impE 1, etac impE 2, atac 2, atac 2]);
       
   167  br conjI 1;
       
   168   by(fast_tac (HOL_cs addIs [W_var_ge RS new_tv_list_le]) 1);
       
   169  br new_tv_subst_comp_2 1;
       
   170   by(fast_tac (HOL_cs addIs [W_var_ge RS new_tv_subst_le]) 1);
       
   171  by(fast_tac (HOL_cs addSIs [new_tv_subst_tel]addIs[new_tv_W RS conjunct1])1);
       
   172 by(strip_tac 1);
       
   173 br notI 1;
       
   174 by(forward_tac [conjunct1] 1);
       
   175 by(forward_tac [conjunct2] 1);
       
   176 bd I_correct_wrt_W 1;
       
   177  ba 1;
       
   178 be exE 1;
       
   179 by(Asm_full_simp_tac 1);
       
   180 by(REPEAT(etac conjE 1));
       
   181 by(hyp_subst_tac 1);
       
   182 by(METAHYPS(fn [_,_,_,_,w1,_,i2,_,na,ns] =>
       
   183                (cut_facts_tac[na RS (ns RS new_tv_subst_tel RS
       
   184                       (w1 RSN (2,new_tv_W RS conjunct1) RS
       
   185                        (ns RS (w1 RS W_var_ge RS new_tv_subst_le) RS
       
   186                         new_tv_subst_comp_1 RS
       
   187                         (na RS (w1 RS W_var_ge RS new_tv_list_le) RS
       
   188                          (conjI RS (i2 RSN (2,I_correct_wrt_W)))))))]1))1);
       
   189 be exE 1;
       
   190 by(asm_full_simp_tac (!simpset addsimps
       
   191      [o_def,subst_comp_te RS sym,subst_comp_tel RS sym]) 1);
       
   192 by(REPEAT(etac conjE 1));
       
   193 by(hyp_subst_tac 1);
       
   194 by(asm_full_simp_tac (!simpset addsimps
       
   195            [subst_comp_te RS sym,subst_comp_tel RS sym]) 1);
       
   196 qed_spec_mp "I_complete_wrt_W";
       
   197 
       
   198 (***
       
   199 We actually want the corollary
       
   200 
       
   201   "I e [] m id_subst = Fail ==> W e [] m = Fail";
       
   202 
       
   203 Wait until simplification of thms is possible.
       
   204 ***)