# HG changeset patch # User bulwahn # Date 1272465948 -7200 # Node ID 9cff57fc71130afcf658fbefcc7db1cd00643838 # Parent 3e677ca1e564fbc162938b6323f6b53fb5891971 improving proof procedure for transforming cases rule in the predicate compiler to handle free variables of function type diff -r 3e677ca1e564 -r 9cff57fc7113 src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML --- 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