improving proof procedure for transforming cases rule in the predicate compiler to handle free variables of function type
--- a/src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML Wed Apr 28 15:42:10 2010 +0200
+++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML Wed Apr 28 16:45:48 2010 +0200
@@ -531,14 +531,17 @@
let
val (cases, (eqs, prems)) = apsnd (chop (nargs - nparams)) (chop n prems)
val case_th = MetaSimplifier.simplify true
- (@{thm Predicate.eq_is_eq} :: map meta_eq_of eqs)
- (nth cases (i - 1))
+ (@{thm Predicate.eq_is_eq} :: map meta_eq_of eqs) (nth cases (i - 1))
val prems' = maps (dest_conjunct_prem o MetaSimplifier.simplify true tuple_rew_rules) prems
val pats = map (swap o HOLogic.dest_eq o HOLogic.dest_Trueprop) (take nargs (prems_of case_th))
val (_, tenv) = fold (Pattern.match thy) pats (Vartab.empty, Vartab.empty)
fun term_pair_of (ix, (ty,t)) = (Var (ix,ty), t)
val inst = map (pairself (cterm_of thy) o term_pair_of) (Vartab.dest tenv)
- val thesis = Thm.instantiate ([], inst) case_th OF (replicate nargs @{thm refl}) OF prems'
+ val case_th' = Thm.instantiate ([], inst) case_th OF (replicate nargs @{thm refl})
+ val (_, tenv) = fold (Pattern.match thy) (prems_of case_th' ~~ map prop_of prems') (Vartab.empty, Vartab.empty)
+ val inst' = map (pairself (cterm_of thy) o term_pair_of) (Vartab.dest tenv)
+ val case_th'' = Thm.instantiate ([], inst') case_th'
+ val thesis = case_th'' OF prems'
in
(rtac thesis 1)
end