Added function elim_vars.
authorberghofe
Mon, 30 Sep 2002 16:40:57 +0200
changeset 13608 9a6f43b8eae1
parent 13607 6908230623a3
child 13609 73c3915553b4
Added function elim_vars.
src/Pure/Proof/proof_rewrite_rules.ML
--- a/src/Pure/Proof/proof_rewrite_rules.ML	Mon Sep 30 16:38:22 2002 +0200
+++ b/src/Pure/Proof/proof_rewrite_rules.ML	Mon Sep 30 16:40:57 2002 +0200
@@ -12,6 +12,7 @@
   val rprocs : bool -> (string * (typ list -> Proofterm.proof -> Proofterm.proof option)) list
   val rewrite_terms : (term -> term) -> Proofterm.proof -> Proofterm.proof
   val elim_defs : Sign.sg -> bool -> thm list -> Proofterm.proof -> Proofterm.proof
+  val elim_vars : (typ -> term) -> Proofterm.proof -> Proofterm.proof
   val setup : (theory -> theory) list
 end;
 
@@ -256,4 +257,18 @@
       (insert_refl defnames [] (f prf))
   end;
 
+
+(**** eliminate all variables that don't occur in the proposition ****)
+
+fun elim_vars mk_default prf =
+  let
+    val prop = Reconstruct.prop_of prf;
+    val vars = fold_proof_terms add_term_vars snd ([], prf) \\ term_vars prop;
+    val inst = map (fn Var (ixn, T) => (ixn, list_abs
+      (apfst (map (pair "x")) (apsnd mk_default (strip_type T))))) vars
+  in
+    norm_proof (Envir.Envir {iTs = Vartab.empty, asol = Vartab.make inst,
+      maxidx = 0}) prf
+  end;
+
 end;