src/FOL/IFOL.ML
changeset 5309 01c2b317da88
parent 5139 013ea0f023e3
child 5888 d8e51792ca85
equal deleted inserted replaced
5308:3ca4da83012c 5309:01c2b317da88
   234  (fn [prem1,prem2] => [ (rtac (prem2 RS subst) 1), (rtac prem1 1) ]);
   234  (fn [prem1,prem2] => [ (rtac (prem2 RS subst) 1), (rtac prem1 1) ]);
   235 
   235 
   236 (** ~ b=a ==> ~ a=b **)
   236 (** ~ b=a ==> ~ a=b **)
   237 val [not_sym] = compose(sym,2,contrapos);
   237 val [not_sym] = compose(sym,2,contrapos);
   238 
   238 
       
   239 
       
   240 (* Two theorms for rewriting only one instance of a definition:
       
   241    the first for definitions of formulae and the second for terms *)
       
   242 
       
   243 val prems = goal IFOL.thy "(A == B) ==> A <-> B";
       
   244 by (rewrite_goals_tac prems);
       
   245 by (rtac iff_refl 1);
       
   246 qed "def_imp_iff";
       
   247 
       
   248 val prems = goal IFOL.thy "(A == B) ==> A = B";
       
   249 by (rewrite_goals_tac prems);
       
   250 by (rtac refl 1);
       
   251 qed "def_imp_eq";
       
   252 
   239 (*Substitution: rule and tactic*)
   253 (*Substitution: rule and tactic*)
   240 bind_thm ("ssubst", sym RS subst);
   254 bind_thm ("ssubst", sym RS subst);
   241 
   255 
   242 (*Fails unless the substitution has an effect*)
   256 (*Apply an equality or definition ONCE.
   243 fun stac th = CHANGED_GOAL (rtac (th RS ssubst));
   257   Fails unless the substitution has an effect*)
       
   258 fun stac th = 
       
   259   let val th' = th RS def_imp_eq handle _ => th
       
   260   in  CHANGED_GOAL (rtac (th' RS ssubst))
       
   261   end;
   244 
   262 
   245 (*A special case of ex1E that would otherwise need quantifier expansion*)
   263 (*A special case of ex1E that would otherwise need quantifier expansion*)
   246 qed_goal "ex1_equalsE" IFOL.thy
   264 qed_goal "ex1_equalsE" IFOL.thy
   247     "[| EX! x. P(x);  P(a);  P(b) |] ==> a=b"
   265     "[| EX! x. P(x);  P(a);  P(b) |] ==> a=b"
   248  (fn prems =>
   266  (fn prems =>
   380 val major::prems = goal IFOL.thy "[| P|Q;  P==>R;  Q==>S |] ==> R|S";
   398 val major::prems = goal IFOL.thy "[| P|Q;  P==>R;  Q==>S |] ==> R|S";
   381 by (rtac (major RS disjE) 1);
   399 by (rtac (major RS disjE) 1);
   382 by (REPEAT (eresolve_tac (prems RL [disjI1, disjI2]) 1));
   400 by (REPEAT (eresolve_tac (prems RL [disjI1, disjI2]) 1));
   383 qed "disj_imp_disj";
   401 qed "disj_imp_disj";
   384 
   402 
   385 (* The following two theorms are useful when rewriting only one instance  *) 
       
   386 (* of a definition                                                        *)
       
   387 (* first one for definitions of formulae and the second for terms         *)
       
   388 
       
   389 val prems = goal IFOL.thy "(A == B) ==> A <-> B";
       
   390 by (rewrite_goals_tac prems);
       
   391 by (rtac iff_refl 1);
       
   392 qed "def_imp_iff";
       
   393 
       
   394 val prems = goal IFOL.thy "(A == B) ==> A = B";
       
   395 by (rewrite_goals_tac prems);
       
   396 by (rtac refl 1);
       
   397 qed "def_imp_eq";
       
   398 
       
   399 
   403 
   400 (** strip ALL and --> from proved goal while preserving ALL-bound var names **)
   404 (** strip ALL and --> from proved goal while preserving ALL-bound var names **)
   401 
   405 
   402 local
   406 local
   403 
   407