intr/elim: use constant complexity thanks to tuned Thm.instantiate/implies_elim;
authorwenzelm
Tue, 12 Sep 2006 12:12:39 +0200
changeset 20508 8182d961c7cc
parent 20507 bb68343f6f83
child 20509 073a5ed7dd71
intr/elim: use constant complexity thanks to tuned Thm.instantiate/implies_elim;
src/Pure/conjunction.ML
--- a/src/Pure/conjunction.ML	Tue Sep 12 12:12:33 2006 +0200
+++ b/src/Pure/conjunction.ML	Tue Sep 12 12:12:39 2006 +0200
@@ -74,8 +74,8 @@
 
 local
 
-val A = read "PROP A";
-val B = read "PROP B";
+val A = read "PROP A" and vA = read "PROP ?A";
+val B = read "PROP B" and vB = read "PROP ?B";
 val C = read "PROP C";
 val ABC = read "PROP A ==> PROP B ==> PROP C";
 val A_B = read "PROP ProtoPure.conjunction(A, B)"
@@ -98,14 +98,25 @@
       (Thm.forall_intr C (Thm.implies_intr ABC
         (Drule.implies_elim_list (Thm.assume ABC) [Thm.assume A, Thm.assume B])))));
 
-fun intr tha thb = thb COMP (tha COMP Drule.incr_indexes2 tha thb conjunctionI);
+fun intr tha thb =
+  Thm.implies_elim
+    (Thm.implies_elim
+      (Thm.instantiate ([], [(vA, Thm.cprop_of tha), (vB, Thm.cprop_of thb)]) conjunctionI)
+    tha)
+  thb;
 
 fun intr_list [] = asm_rl
   | intr_list ths = foldr1 (uncurry intr) ths;
 
 fun elim th =
- (th COMP Drule.incr_indexes th conjunctionD1,
-  th COMP Drule.incr_indexes th conjunctionD2);
+  let
+    val (A, B) = dest_conjunction (Thm.cprop_of th)
+      handle TERM (msg, _) => raise THM (msg, 0, [th]);
+    val inst = Thm.instantiate ([], [(vA, A), (vB, B)]);
+  in
+   (Thm.implies_elim (inst conjunctionD1) th,
+    Thm.implies_elim (inst conjunctionD2) th)
+  end;
 
 (*((A && B) && C) && D && E -- flat*)
 fun elim_list th =