24 fun mk_all2 (v, t) = HOLogic.all_const (fastype_of v) $ lambda v t; |
24 fun mk_all2 (v, t) = HOLogic.all_const (fastype_of v) $ lambda v t; |
25 val rhs = hs |
25 val rhs = hs |
26 val np = length ps |
26 val np = length ps |
27 val (fm',np) = List.foldr (fn ((x, T), (fm,n)) => mk_all ((x, T), (fm,n))) |
27 val (fm',np) = List.foldr (fn ((x, T), (fm,n)) => mk_all ((x, T), (fm,n))) |
28 (List.foldr HOLogic.mk_imp c rhs, np) ps |
28 (List.foldr HOLogic.mk_imp c rhs, np) ps |
29 val (vs, _) = List.partition (fn t => q orelse (type_of t) = \<^typ>\<open>nat\<close>) |
29 val (vs, _) = List.partition (fn t => q orelse (type_of t) = \<^Type>\<open>nat\<close>) |
30 (Misc_Legacy.term_frees fm' @ Misc_Legacy.term_vars fm'); |
30 (Misc_Legacy.term_frees fm' @ Misc_Legacy.term_vars fm'); |
31 val fm2 = List.foldr mk_all2 fm' vs |
31 val fm2 = List.foldr mk_all2 fm' vs |
32 in (fm2, np + length vs, length rhs) end; |
32 in (fm2, np + length vs, length rhs) end; |
33 |
33 |
34 (*Object quantifier to meta --*) |
34 (*Object quantifier to meta --*) |
82 (Thm.trivial ct)) |
82 (Thm.trivial ct)) |
83 fun assm_tac i = REPEAT_DETERM_N nh (assume_tac ctxt i) |
83 fun assm_tac i = REPEAT_DETERM_N nh (assume_tac ctxt i) |
84 (* The result of the quantifier elimination *) |
84 (* The result of the quantifier elimination *) |
85 val (th, tac) = |
85 val (th, tac) = |
86 (case Thm.prop_of pre_thm of |
86 (case Thm.prop_of pre_thm of |
87 Const (\<^const_name>\<open>Pure.imp\<close>, _) $ (Const (\<^const_name>\<open>Trueprop\<close>, _) $ t1) $ _ => |
87 \<^Const_>\<open>Pure.imp for \<^Const_>\<open>Trueprop for t1\<close> _\<close> => |
88 let |
88 let |
89 val pth = linzqe_oracle (ctxt, Envir.eta_long [] t1) |
89 val pth = linzqe_oracle (ctxt, Envir.eta_long [] t1) |
90 in |
90 in |
91 ((pth RS iffD2) RS pre_thm, |
91 ((pth RS iffD2) RS pre_thm, |
92 assm_tac (i + 1) THEN (if q then I else TRY) (resolve_tac ctxt [TrueI] i)) |
92 assm_tac (i + 1) THEN (if q then I else TRY) (resolve_tac ctxt [TrueI] i)) |